@@ -58,7 +58,7 @@ import { getNamespaceName } from "@/generators/utils/namespace.utils";
5858import { isSchemaObject } from "@/generators/utils/openapi-schema.utils" ;
5959import { isParamMediaTypeAllowed } from "@/generators/utils/openapi.utils" ;
6060import { getDestructuredVariables , isInfiniteQuery , isMutation , isQuery } from "@/generators/utils/query.utils" ;
61- import { shouldInlineEndpointsForTag } from "@/generators/utils/tag.utils" ;
61+ import { getEndpointTag , shouldInlineEndpointsForTag } from "@/generators/utils/tag.utils" ;
6262import { isNamedZodSchema } from "@/generators/utils/zod-schema.utils" ;
6363import { invalidVariableNameCharactersToCamel } from "@/generators/utils/js.utils" ;
6464
@@ -429,10 +429,12 @@ function renderQueryJsDocs({
429429 resolver,
430430 endpoint,
431431 mode,
432+ tag,
432433} : {
433434 resolver : SchemaResolver ;
434435 endpoint : Endpoint ;
435436 mode : "query" | "mutation" | "infiniteQuery" ;
437+ tag : string ;
436438} ) {
437439 const lines : string [ ] = [ "/** " ] ;
438440
@@ -460,6 +462,7 @@ function renderQueryJsDocs({
460462
461463 const params = getEndpointParamMapping ( resolver , endpoint , {
462464 ...( mode !== "infiniteQuery" ? { includeFileParam : true } : { } ) ,
465+ modelNamespaceTag : tag ,
463466 } ) ;
464467 for ( const endpointParam of params ) {
465468 lines . push (
@@ -481,6 +484,8 @@ function renderQueryJsDocs({
481484 const resultType = `${ withAxiosResponse ? "AxiosResponse<" : "" } ${ getImportedZodSchemaInferedTypeName (
482485 resolver ,
483486 endpoint . response ,
487+ undefined ,
488+ tag ,
484489 ) } ${ withAxiosResponse ? ">" : "" } `;
485490
486491 if ( mode === "query" ) {
@@ -648,13 +653,15 @@ function renderQuery({
648653} ) {
649654 const hasAxiosRequestConfig = resolver . options . axiosRequestConfig ;
650655 const hasAclCheck = resolver . options . checkAcl && endpoint . acl ;
656+ const tag = getEndpointTag ( endpoint , resolver . options ) ;
651657 const workspaceParamReplacements = resolver . options . workspaceContext
652658 ? getWorkspaceParamReplacements ( resolver , endpoint )
653659 : { } ;
654660 const endpointArgs = renderEndpointArgs ( resolver , endpoint , { } ) ;
655661 const resolvedEndpointArgs = renderEndpointArgs ( resolver , endpoint , { } , workspaceParamReplacements ) ;
656662 const endpointParams = renderEndpointParams ( resolver , endpoint , {
657663 optionalPathParams : resolver . options . workspaceContext ,
664+ modelNamespaceTag : tag ,
658665 } ) ;
659666 const hasQueryFn = endpointArgs . length > 0 || hasAxiosRequestConfig || hasAclCheck ;
660667 const hasQueryFnBody = Boolean ( hasAclCheck ) || Object . keys ( workspaceParamReplacements ) . length > 0 ;
@@ -663,7 +670,7 @@ function renderQuery({
663670 : getImportedEndpointName ( endpoint , resolver . options ) ;
664671
665672 const lines : string [ ] = [ ] ;
666- lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "query" } ) ) ;
673+ lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "query" , tag } ) ) ;
667674 lines . push (
668675 `export const ${ getQueryName ( endpoint ) } = <TData>(${ endpointParams ? `{ ${ endpointArgs } }: { ${ endpointParams } }, ` : "" } options?: AppQueryOptions<typeof ${ importedEndpoint } , TData>${ hasAxiosRequestConfig ? `, ${ AXIOS_REQUEST_CONFIG_NAME } ?: ${ AXIOS_REQUEST_CONFIG_TYPE } ` : "" } ) => {` ,
669676 ) ;
@@ -705,12 +712,14 @@ function renderMutation({
705712 const hasAclCheck = resolver . options . checkAcl && endpoint . acl ;
706713 const hasMutationEffects = resolver . options . mutationEffects ;
707714 const hasAxiosRequestConfig = resolver . options . axiosRequestConfig ;
715+ const tag = getEndpointTag ( endpoint , resolver . options ) ;
708716 const workspaceParamReplacements = resolver . options . workspaceContext
709717 ? getWorkspaceParamReplacements ( resolver , endpoint )
710718 : { } ;
711719 const endpointParams = renderEndpointParams ( resolver , endpoint , {
712720 includeFileParam : true ,
713721 optionalPathParams : resolver . options . workspaceContext ,
722+ modelNamespaceTag : tag ,
714723 } ) ;
715724 const resolvedEndpointArgs = renderEndpointArgs ( resolver , endpoint , { } , workspaceParamReplacements ) ;
716725 const destructuredMutationArgs = renderEndpointArgs ( resolver , endpoint , { includeFileParam : true } ) ;
@@ -728,7 +737,7 @@ function renderMutation({
728737 : endpointParams ;
729738
730739 const lines : string [ ] = [ ] ;
731- lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "mutation" } ) ) ;
740+ lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "mutation" , tag } ) ) ;
732741 lines . push (
733742 `export const ${ getQueryName ( endpoint , true ) } = (options?: AppMutationOptions<typeof ${ endpointFunction } , { ${ mutationVariablesType } }>${ hasMutationEffects ? ` & ${ MUTATION_EFFECTS . optionsType } ` : "" } ${ hasAxiosRequestConfig ? `, ${ AXIOS_REQUEST_CONFIG_NAME } ?: ${ AXIOS_REQUEST_CONFIG_TYPE } ` : "" } ) => {` ,
734743 ) ;
@@ -912,12 +921,14 @@ function renderInfiniteQuery({
912921} ) {
913922 const hasAclCheck = resolver . options . checkAcl && endpoint . acl ;
914923 const hasAxiosRequestConfig = resolver . options . axiosRequestConfig ;
924+ const tag = getEndpointTag ( endpoint , resolver . options ) ;
915925 const workspaceParamReplacements = resolver . options . workspaceContext
916926 ? getWorkspaceParamReplacements ( resolver , endpoint )
917927 : { } ;
918928 const endpointParams = renderEndpointParams ( resolver , endpoint , {
919929 excludePageParam : true ,
920930 optionalPathParams : resolver . options . workspaceContext ,
931+ modelNamespaceTag : tag ,
921932 } ) ;
922933 const endpointArgsWithoutPage = renderEndpointArgs ( resolver , endpoint , { excludePageParam : true } ) ;
923934 const resolvedEndpointArgsWithoutPage = renderEndpointArgs (
@@ -926,7 +937,6 @@ function renderInfiniteQuery({
926937 { excludePageParam : true } ,
927938 workspaceParamReplacements ,
928939 ) ;
929- const endpointArgsWithPage = renderEndpointArgs ( resolver , endpoint , { replacePageParam : true } ) ;
930940 const resolvedEndpointArgsWithPage = renderEndpointArgs (
931941 resolver ,
932942 endpoint ,
@@ -939,11 +949,10 @@ function renderInfiniteQuery({
939949 const hasQueryFnBody = Boolean ( hasAclCheck ) || Object . keys ( workspaceParamReplacements ) . length > 0 ;
940950
941951 const lines : string [ ] = [ ] ;
942- lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "infiniteQuery" } ) ) ;
952+ lines . push ( renderQueryJsDocs ( { resolver, endpoint, mode : "infiniteQuery" , tag } ) ) ;
943953 lines . push (
944954 `export const ${ getInfiniteQueryName ( endpoint ) } = <TData>(${ endpointParams ? `{ ${ endpointArgsWithoutPage } }: { ${ endpointParams } }, ` : "" } options?: AppInfiniteQueryOptions<typeof ${ endpointFunction } , TData>${ hasAxiosRequestConfig ? `, ${ AXIOS_REQUEST_CONFIG_NAME } ?: ${ AXIOS_REQUEST_CONFIG_TYPE } ` : "" } ) => {` ,
945955 ) ;
946- lines . push ( " const queryConfig = OpenApiQueryConfig.useConfig();" ) ;
947956 if ( hasAclCheck ) {
948957 lines . push ( ` const { checkAcl } = ${ ACL_CHECK_HOOK } ();` ) ;
949958 }
@@ -968,7 +977,6 @@ function renderInfiniteQuery({
968977 ) ;
969978 lines . push ( " }," ) ;
970979 lines . push ( " ...options," ) ;
971- lines . push ( " onError: options?.onError ?? queryConfig.onError," ) ;
972980 lines . push ( " });" ) ;
973981 lines . push ( "};" ) ;
974982 return lines . join ( "\n" ) ;
0 commit comments