@orval/swr 8.9.0 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -174,7 +174,7 @@ const generateSwrImplementation = ({ operationName, swrKeyFnName, swrKeyLoaderFn
|
|
|
174
174
|
const swrProps = toObjectString(props, "implementation");
|
|
175
175
|
const queryResultVarName = props.some((prop) => prop.name === "query") ? "_query" : "query";
|
|
176
176
|
const httpFunctionProps = swrProperties;
|
|
177
|
-
const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${params.length > 0 ? ` &&
|
|
177
|
+
const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${params.length > 0 ? ` && ${params.map(({ name }) => `${name} !== null && ${name} !== undefined`).join(" && ")}` : ""}`;
|
|
178
178
|
const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;
|
|
179
179
|
const swrKeyLoaderImplementation = `const swrKeyLoader = swrOptions?.swrKeyLoader ?? (isEnabled ? ${swrKeyLoaderFnName}(${swrKeyProperties}) : () => null);`;
|
|
180
180
|
const errorType = getSwrErrorType(response, httpClient, mutator);
|
|
@@ -240,7 +240,7 @@ ${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(
|
|
|
240
240
|
const generateSwrSuspenseImplementation = ({ operationName, swrKeyFnName, swrKeyProperties, params, mutator, isRequestOptions, response, swrOptions, props, doc, httpClient, httpFunctionProps }) => {
|
|
241
241
|
const swrProps = toObjectString(props, "implementation");
|
|
242
242
|
const queryResultVarName = props.some((prop) => prop.name === "query") ? "_query" : "query";
|
|
243
|
-
const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${params.length > 0 ? ` &&
|
|
243
|
+
const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${params.length > 0 ? ` && ${params.map(({ name }) => `${name} !== null && ${name} !== undefined`).join(" && ")}` : ""}`;
|
|
244
244
|
const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;
|
|
245
245
|
const errorType = getSwrErrorType(response, httpClient, mutator);
|
|
246
246
|
const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);
|
|
@@ -482,9 +482,13 @@ const generateSwrHeader = (params) => `
|
|
|
482
482
|
`;
|
|
483
483
|
const generateSwr = (verbOptions, options) => {
|
|
484
484
|
const imports = generateVerbImports(verbOptions);
|
|
485
|
+
const functionImplementation = generateSwrRequestFunction(verbOptions, options);
|
|
486
|
+
const hookImplementation = generateSwrHook(verbOptions, options);
|
|
487
|
+
const isFetchHttpClient = options.context.output.httpClient !== OutputHttpClient.AXIOS;
|
|
485
488
|
return {
|
|
486
|
-
implementation: `${
|
|
487
|
-
imports
|
|
489
|
+
implementation: `${functionImplementation}\n\n${hookImplementation}`,
|
|
490
|
+
imports,
|
|
491
|
+
...isFetchHttpClient && { docComment: "" }
|
|
488
492
|
};
|
|
489
493
|
};
|
|
490
494
|
const swrClientBuilder = {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["generateFetchRequestFunction"],"sources":["../src/client.ts","../src/index.ts"],"sourcesContent":["import {\n type ClientHeaderBuilder,\n generateFormDataAndUrlEncodedFunction,\n generateMutatorConfig,\n generateMutatorRequestOptions,\n generateOptions,\n type GeneratorDependency,\n type GeneratorMutator,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GetterResponse,\n isSyntheticDefaultImportsAllow,\n OutputHttpClient,\n toObjectString,\n} from '@orval/core';\nimport {\n fetchResponseTypeName,\n generateFetchHeader,\n generateRequestFunction as generateFetchRequestFunction,\n} from '@orval/fetch';\n\nexport const AXIOS_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'axios',\n default: true,\n values: true,\n syntheticDefaultImport: true,\n },\n { name: 'AxiosRequestConfig' },\n { name: 'AxiosResponse' },\n { name: 'AxiosError' },\n ],\n dependency: 'axios',\n },\n];\n\nexport const generateSwrRequestFunction = (\n verbOptions: GeneratorVerbOptions,\n options: GeneratorOptions,\n) => {\n return options.context.output.httpClient === OutputHttpClient.AXIOS\n ? generateAxiosRequestFunction(verbOptions, options)\n : generateFetchRequestFunction(verbOptions, options);\n};\n\nconst generateAxiosRequestFunction = (\n {\n headers,\n queryParams,\n operationName,\n response,\n mutator,\n body,\n props,\n verb,\n formData,\n formUrlEncoded,\n override,\n paramsSerializer,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const isFormData = !override.formData.disabled;\n const isFormUrlEncoded = override.formUrlEncoded !== false;\n const isExactOptionalPropertyTypes =\n !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes;\n const isSyntheticDefaultImportsAllowed = isSyntheticDefaultImportsAllow(\n context.output.tsconfig,\n );\n\n const bodyForm = generateFormDataAndUrlEncodedFunction({\n formData,\n formUrlEncoded,\n body,\n isFormData,\n isFormUrlEncoded,\n });\n\n if (mutator) {\n const mutatorConfig = generateMutatorConfig({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal: false,\n isExactOptionalPropertyTypes,\n });\n\n const propsImplementation =\n mutator.bodyTypeName && body.definition\n ? toObjectString(props, 'implementation').replace(\n new RegExp(String.raw`(\\w*):\\s?${body.definition}`),\n `$1: ${mutator.bodyTypeName}<${body.definition}>`,\n )\n : toObjectString(props, 'implementation');\n\n const requestOptions = isRequestOptions\n ? generateMutatorRequestOptions(\n override.requestOptions,\n mutator.hasSecondArg,\n )\n : '';\n\n const requestImplementation = `export const ${operationName} = (\\n ${propsImplementation}\\n ${\n isRequestOptions && mutator.hasSecondArg\n ? `options${context.output.optionsParamRequired ? '' : '?'}: SecondParameter<typeof ${mutator.name}>`\n : ''\n }) => {${bodyForm}\n return ${mutator.name}<${response.definition.success || 'unknown'}>(\n ${mutatorConfig},\n ${requestOptions});\n }\n`;\n\n return requestImplementation;\n }\n\n const options = generateOptions({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions: override.requestOptions,\n isFormData,\n isFormUrlEncoded,\n paramsSerializer,\n paramsSerializerOptions: override.paramsSerializerOptions,\n isExactOptionalPropertyTypes,\n hasSignal: false,\n });\n\n return `export const ${operationName} = (\\n ${toObjectString(\n props,\n 'implementation',\n )} ${\n isRequestOptions ? `options?: AxiosRequestConfig\\n` : ''\n } ): Promise<AxiosResponse<${\n response.definition.success || 'unknown'\n }>> => {${bodyForm}\n return axios${\n isSyntheticDefaultImportsAllowed ? '' : '.default'\n }.${verb}(${options});\n }\n`;\n};\n\nexport const getSwrRequestOptions = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'axios?: AxiosRequestConfig'\n : 'fetch?: RequestInit';\n } else if (mutator.hasSecondArg) {\n return `request?: SecondParameter<typeof ${mutator.name}>`;\n } else {\n return '';\n }\n};\n\nexport const getSwrErrorType = (\n response: GetterResponse,\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (mutator) {\n return mutator.hasErrorType\n ? `ErrorType<${response.definition.errors || 'unknown'}>`\n : response.definition.errors || 'unknown';\n } else {\n const errorType =\n httpClient === OutputHttpClient.AXIOS ? 'AxiosError' : 'Promise';\n\n return `${errorType}<${response.definition.errors || 'unknown'}>`;\n }\n};\n\nexport const getSwrRequestSecondArg = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'axios: axiosOptions'\n : 'fetch: fetchOptions';\n } else if (mutator.hasSecondArg) {\n return 'request: requestOptions';\n } else {\n return '';\n }\n};\n\nexport const getHttpRequestSecondArg = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? `axiosOptions`\n : `fetchOptions`;\n } else if (mutator.hasSecondArg) {\n return 'requestOptions';\n } else {\n return '';\n }\n};\n\nexport const getSwrMutationFetcherOptionType = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'AxiosRequestConfig'\n : 'RequestInit';\n } else if (mutator.hasSecondArg) {\n return `SecondParameter<typeof ${mutator.name}>`;\n } else {\n return '';\n }\n};\n\nexport const getSwrMutationFetcherType = (\n response: GetterResponse,\n httpClient: OutputHttpClient,\n includeHttpResponseReturnType: boolean | undefined,\n operationName: string,\n mutator?: GeneratorMutator,\n) => {\n if (httpClient === OutputHttpClient.FETCH) {\n const responseType = fetchResponseTypeName(\n includeHttpResponseReturnType,\n response.definition.success,\n operationName,\n );\n\n return `Promise<${responseType}>`;\n } else if (mutator) {\n return `Promise<${response.definition.success || 'unknown'}>`;\n } else {\n return `Promise<AxiosResponse<${response.definition.success || 'unknown'}>>`;\n }\n};\n\nexport const getSwrHeader: ClientHeaderBuilder = (params) => {\n return params.output.httpClient === OutputHttpClient.FETCH\n ? generateFetchHeader(params)\n : '';\n};\n","import {\n camel,\n type ClientBuilder,\n type ClientDependenciesBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n generateVerbImports,\n type GeneratorDependency,\n type GeneratorMutator,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GetterParams,\n type GetterProp,\n type GetterProps,\n GetterPropType,\n type GetterResponse,\n jsDoc,\n OutputHttpClient,\n pascal,\n stringify,\n type SwrOptions,\n toObjectString,\n Verbs,\n} from '@orval/core';\n\nimport {\n AXIOS_DEPENDENCIES,\n generateSwrRequestFunction,\n getHttpRequestSecondArg,\n getSwrErrorType,\n getSwrHeader,\n getSwrMutationFetcherOptionType,\n getSwrMutationFetcherType,\n getSwrRequestOptions,\n getSwrRequestSecondArg,\n} from './client';\n\nconst PARAMS_SERIALIZER_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'qs',\n default: true,\n values: true,\n syntheticDefaultImport: true,\n },\n ],\n dependency: 'qs',\n },\n];\n\nconst SWR_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSwr', values: true, default: true },\n { name: 'SWRConfiguration' },\n { name: 'Key' },\n { name: 'Arguments' },\n ],\n dependency: 'swr',\n },\n];\n\nconst SWR_INFINITE_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSWRInfinite', values: true, default: true },\n { name: 'SWRInfiniteConfiguration' },\n { name: 'SWRInfiniteKeyLoader' },\n ],\n dependency: 'swr/infinite',\n },\n];\n\nconst SWR_MUTATION_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSWRMutation', values: true, default: true },\n { name: 'SWRMutationConfiguration' },\n { name: 'SWRMutationKey' },\n ],\n dependency: 'swr/mutation',\n },\n];\n\nexport const getSwrDependencies: ClientDependenciesBuilder = (\n hasGlobalMutator: boolean,\n hasParamsSerializerOptions: boolean,\n _packageJson,\n httpClient?: OutputHttpClient,\n) => [\n ...(!hasGlobalMutator && httpClient === OutputHttpClient.AXIOS\n ? AXIOS_DEPENDENCIES\n : []),\n ...(hasParamsSerializerOptions ? PARAMS_SERIALIZER_DEPENDENCIES : []),\n ...SWR_DEPENDENCIES,\n ...SWR_INFINITE_DEPENDENCIES,\n ...SWR_MUTATION_DEPENDENCIES,\n];\n\nconst generateSwrArguments = ({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite,\n httpClient,\n}: {\n operationName: string;\n mutator?: GeneratorMutator;\n isRequestOptions: boolean;\n isInfinite: boolean;\n httpClient: OutputHttpClient;\n}) => {\n const configType = isInfinite\n ? 'SWRInfiniteConfiguration'\n : 'SWRConfiguration';\n const optionsType = isInfinite\n ? '{ swrKeyLoader?: SWRInfiniteKeyLoader, enabled?: boolean }'\n : '{ swrKey?: Key, enabled?: boolean }';\n const definition = `${configType}<Awaited<ReturnType<typeof ${operationName}>>, TError> & ${optionsType}`;\n\n if (!isRequestOptions) {\n return `swrOptions?: ${definition}`;\n }\n\n return `options?: { swr?:${definition}, ${getSwrRequestOptions(httpClient, mutator)} }\\n`;\n};\n\nconst generateSwrMutationArguments = ({\n operationName,\n isRequestOptions,\n mutator,\n swrBodyType,\n httpClient,\n}: {\n operationName: string;\n isRequestOptions: boolean;\n mutator?: GeneratorMutator;\n swrBodyType: string;\n httpClient: OutputHttpClient;\n}) => {\n const definition = `SWRMutationConfiguration<Awaited<ReturnType<typeof ${operationName}>>, TError, Key, ${swrBodyType}, Awaited<ReturnType<typeof ${operationName}>>> & { swrKey?: string }`;\n\n if (!isRequestOptions) {\n return `swrOptions?: ${definition}`;\n }\n\n return `options?: { swr?:${definition}, ${getSwrRequestOptions(httpClient, mutator)}}\\n`;\n};\n\nconst generateSwrImplementation = ({\n operationName,\n swrKeyFnName,\n swrKeyLoaderFnName,\n swrProperties,\n swrKeyProperties,\n params,\n mutator,\n isRequestOptions,\n response,\n swrOptions,\n props,\n doc,\n httpClient,\n pathOnlyParams,\n headerOnlyParams,\n hasQueryParams,\n queryParamType,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrKeyLoaderFnName: string;\n swrProperties: string;\n swrKeyProperties: string;\n params: GetterParams;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n httpClient: OutputHttpClient;\n pathOnlyParams: string;\n headerOnlyParams: string;\n hasQueryParams: boolean;\n queryParamType: string;\n}) => {\n const swrProps = toObjectString(props, 'implementation');\n\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const httpFunctionProps = swrProperties;\n\n const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${\n params.length > 0\n ? ` && !!(${params.map(({ name }) => name).join(' && ')})`\n : ''\n }`;\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;\n const swrKeyLoaderImplementation = `const swrKeyLoader = swrOptions?.swrKeyLoader ?? (isEnabled ? ${swrKeyLoaderFnName}(${swrKeyProperties}) : () => null);`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const errorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}InfiniteError = ${errorType}\\n`\n : '';\n\n const useSWRInfiniteImplementation = swrOptions.useInfinite\n ? `\nexport type ${pascal(\n operationName,\n )}InfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${errorTypeExport}\n${doc}export const ${camel(\n `use-${operationName}-infinite`,\n )} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: true,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyLoaderImplementation}\n const swrFn = ${\n hasQueryParams\n ? `([_url, pageParams]: [string, ${queryParamType} & { page: number }]) => ${operationName}(${pathOnlyParams}${pathOnlyParams ? ', ' : ''}pageParams${headerOnlyParams ? ', ' + headerOnlyParams : ''}${httpRequestSecondArg ? ', ' + httpRequestSecondArg : ''})`\n : `([_url]: [string]) => ${operationName}(${pathOnlyParams}${headerOnlyParams ? (pathOnlyParams ? ', ' : '') + headerOnlyParams : ''}${httpRequestSecondArg ? (pathOnlyParams || headerOnlyParams ? ', ' : '') + httpRequestSecondArg : ''})`\n }\n\n const ${queryResultVarName} = useSWRInfinite<Awaited<ReturnType<typeof swrFn>>, TError>(swrKeyLoader, swrFn, ${\n swrOptions.swrInfiniteOptions\n ? `{\n ${stringify(swrOptions.swrInfiniteOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKeyLoader,\n ...${queryResultVarName}\n }\n}\\n`\n : '';\n\n const queryErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}QueryError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n operationName,\n )}QueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${queryErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: false,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyImplementation}\n const swrFn = () => ${operationName}(${httpFunctionProps}${\n httpFunctionProps && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg})\n\n const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${\n swrOptions.swrOptions\n ? `{\n ${stringify(swrOptions.swrOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKey,\n ...${queryResultVarName}\n }\n}\\n`;\n\n return useSWRInfiniteImplementation + useSwrImplementation;\n};\n\nconst generateSwrSuspenseImplementation = ({\n operationName,\n swrKeyFnName,\n swrKeyProperties,\n params,\n mutator,\n isRequestOptions,\n response,\n swrOptions,\n props,\n doc,\n httpClient,\n httpFunctionProps,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrKeyProperties: string;\n params: GetterParams;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n httpClient: OutputHttpClient;\n httpFunctionProps: string;\n}) => {\n const swrProps = toObjectString(props, 'implementation');\n\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${\n params.length > 0\n ? ` && !!(${params.map(({ name }) => name).join(' && ')})`\n : ''\n }`;\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const suspenseErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}SuspenseQueryError = ${errorType}\\n`\n : '';\n\n const useSwrSuspenseImplementation = `\nexport type ${pascal(\n operationName,\n )}SuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${suspenseErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}-suspense`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: false,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyImplementation}\n const swrFn = () => ${operationName}(${httpFunctionProps}${\n httpFunctionProps && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg})\n\n const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${\n swrOptions.swrOptions\n ? `{\n ${stringify(swrOptions.swrOptions)?.slice(1, -1)}\n suspense: true,\n ...swrOptions\n }`\n : '{ suspense: true, ...swrOptions }'\n })\n\n return {\n swrKey,\n ...${queryResultVarName},\n data: ${queryResultVarName}.data as NonNullable<typeof ${queryResultVarName}.data>,\n }\n}\\n`;\n\n return useSwrSuspenseImplementation;\n};\n\nconst generateSwrMutationImplementation = ({\n isRequestOptions,\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n response,\n mutator,\n swrOptions,\n doc,\n swrBodyType,\n httpClient,\n verb,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrMutationFetcherName: string;\n swrKeyProperties: string;\n swrMutationFetcherProperties: string;\n swrProps: string;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n swrBodyType: string;\n httpClient: OutputHttpClient;\n verb?: Verbs;\n}) => {\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? ${swrKeyFnName}(${swrKeyProperties});`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const mutationErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}MutationError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n operationName,\n )}MutationResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${mutationErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}${verb === Verbs.GET ? '-mutation' : ''}`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrMutationArguments({\n operationName,\n isRequestOptions,\n mutator,\n swrBodyType,\n httpClient,\n })}) => {\n\n ${isRequestOptions ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}` : ''}\n\n ${swrKeyImplementation}\n const swrFn = ${swrMutationFetcherName}(${swrMutationFetcherProperties}${\n swrMutationFetcherProperties && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg});\n\n const ${queryResultVarName} = useSWRMutation(swrKey, swrFn, ${\n swrOptions.swrMutationOptions\n ? `{\n ${stringify(swrOptions.swrMutationOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKey,\n ...${queryResultVarName}\n }\n}\\n`;\n\n return useSwrImplementation;\n};\n\nconst generateSwrHook = (\n {\n queryParams,\n operationName,\n body,\n props,\n verb,\n params,\n override,\n mutator,\n response,\n summary,\n deprecated,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const httpClient = context.output.httpClient;\n const doc = jsDoc({ summary, deprecated });\n\n const queryKeyProps = toObjectString(\n props.filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.QUERY_PARAM,\n ),\n 'implementation',\n );\n\n const swrProps = toObjectString(\n props.filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.QUERY_PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.HEADER,\n ),\n 'implementation',\n );\n\n const swrMutationFetcherProperties = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.QUERY_PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.HEADER,\n )\n .map((param) => {\n return param.type === GetterPropType.NAMED_PATH_PARAMS\n ? param.destructured\n : param.name;\n })\n .join(',');\n\n const swrKeyProperties = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.QUERY_PARAM,\n )\n .map((prop) => {\n return prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? prop.destructured\n : prop.name;\n })\n .join(',');\n\n const swrMutationFetcherName = camel(`get-${operationName}-mutation-fetcher`);\n\n if (verb === Verbs.GET) {\n const swrKeyProperties = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((param) => {\n if (param.type === GetterPropType.NAMED_PATH_PARAMS)\n return param.destructured;\n return param.type === GetterPropType.BODY\n ? body.implementation\n : param.name;\n })\n .join(',');\n\n const swrProperties = props\n .map((param) => {\n if (param.type === GetterPropType.NAMED_PATH_PARAMS)\n return param.destructured;\n return param.type === GetterPropType.BODY\n ? body.implementation\n : param.name;\n })\n .join(',');\n\n // For useSWRInfinite: separate path params from query params\n const pathOnlyParams = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS,\n )\n .map((param) => {\n return param.type === GetterPropType.NAMED_PATH_PARAMS\n ? param.destructured\n : param.name;\n })\n .join(',');\n\n const headerOnlyParams = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(',');\n\n const hasQueryParams = props.some(\n (prop) => prop.type === GetterPropType.QUERY_PARAM,\n );\n\n // Extract just the type name from definition (e.g., \"params: ListPetsParams\" -> \"ListPetsParams\")\n const queryParamType =\n props\n .find((prop) => prop.type === GetterPropType.QUERY_PARAM)\n ?.definition.split(': ')[1] ?? 'never';\n\n const queryKeyProps = toObjectString(\n props.filter((prop) => prop.type !== GetterPropType.HEADER),\n 'implementation',\n );\n\n const swrKeyFnName = camel(`get-${operationName}-key`);\n const swrKeyFn = `\nexport const ${swrKeyFnName} = (${queryKeyProps}) => [\\`${route}\\`${\n queryParams ? ', ...(params ? [params]: [])' : ''\n }] as const;\n`;\n\n const swrKeyLoaderFnName = camel(\n `get-${operationName}-infinite-key-loader`,\n );\n const swrKeyLoader = override.swr.useInfinite\n ? `export const ${swrKeyLoaderFnName} = (${queryKeyProps}) => {\n return (page: number, previousPageData?: Awaited<ReturnType<typeof ${operationName}>>) => {\n if (previousPageData) {\n const responseData = previousPageData.data\n if (!responseData) return null\n\n // Direct array response (e.g., API returns Pet[]) - stop when empty\n if (Array.isArray(responseData) && responseData.length === 0) return null\n\n // Wrapped response with data array (e.g., { data: Pet[], ... }) - stop when nested array is empty\n if (typeof responseData === 'object' && 'data' in responseData) {\n if (Array.isArray(responseData.data) && responseData.data.length === 0) return null\n }\n\n // Single object response (non-paginated endpoint) - stop after first page\n if (!Array.isArray(responseData) && !(typeof responseData === 'object' && 'data' in responseData)) return null\n }\n\n return [\\`${route}\\`${queryParams ? ', ...(params ? [{...params,page}]: [{page}])' : ''}${\n body.implementation ? `, ${body.implementation}` : ''\n }] as const;\n }\n}\\n`\n : '';\n\n const swrImplementation = generateSwrImplementation({\n operationName,\n swrKeyFnName,\n swrKeyLoaderFnName,\n swrProperties,\n swrKeyProperties,\n params,\n props,\n mutator,\n isRequestOptions,\n response,\n swrOptions: override.swr,\n doc,\n httpClient,\n pathOnlyParams,\n headerOnlyParams,\n hasQueryParams,\n queryParamType,\n });\n\n const swrSuspenseImplementation = override.swr.useSuspense\n ? generateSwrSuspenseImplementation({\n operationName,\n swrKeyFnName,\n swrKeyProperties,\n params,\n props,\n mutator,\n isRequestOptions,\n response,\n swrOptions: override.swr,\n doc,\n httpClient,\n httpFunctionProps: swrProperties,\n })\n : '';\n\n if (!override.swr.useSWRMutationForGet) {\n return (\n swrKeyFn + swrKeyLoader + swrImplementation + swrSuspenseImplementation\n );\n }\n\n // For OutputClient.SWR_GET_MUTATION, generate both useSWR and useSWRMutation\n const httpFnPropertiesForGetWithoutHeaders = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((prop) => {\n return prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? prop.destructured\n : prop.name;\n })\n .join(', ');\n\n const headerParamsForGet = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(', ');\n\n const httpFnPropertiesForGet = [\n httpFnPropertiesForGetWithoutHeaders,\n headerParamsForGet,\n ]\n .filter(Boolean)\n .join(', ');\n\n const swrMutationFetcherType = getSwrMutationFetcherType(\n response,\n httpClient,\n override.fetch.includeHttpResponseReturnType,\n operationName,\n mutator,\n );\n const swrMutationFetcherOptionType = getSwrMutationFetcherOptionType(\n httpClient,\n mutator,\n );\n\n const swrMutationFetcherOptions =\n isRequestOptions && swrMutationFetcherOptionType\n ? `options${context.output.optionsParamRequired ? '' : '?'}: ${swrMutationFetcherOptionType}`\n : '';\n\n const swrMutationFetcherFn = `\nexport const ${swrMutationFetcherName} = (${queryKeyProps} ${swrMutationFetcherOptions}) => {\n return (_: Key, __: { arg?: never }): ${swrMutationFetcherType} => {\n return ${operationName}(${httpFnPropertiesForGet}${\n swrMutationFetcherOptions.length > 0\n ? (httpFnPropertiesForGet.length > 0 ? ', ' : '') + 'options'\n : ''\n });\n }\n}\n`;\n\n const swrMutationImplementation = generateSwrMutationImplementation({\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n isRequestOptions,\n response,\n mutator,\n swrOptions: override.swr,\n doc,\n swrBodyType: 'never',\n httpClient,\n verb: Verbs.GET,\n });\n\n return (\n swrKeyFn +\n swrKeyLoader +\n swrImplementation +\n swrSuspenseImplementation +\n swrMutationFetcherFn +\n swrMutationImplementation\n );\n } else {\n const httpFnPropertiesWithoutHeaders = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((prop) => {\n if (prop.type === GetterPropType.NAMED_PATH_PARAMS) {\n return prop.destructured;\n } else if (prop.type === GetterPropType.BODY) {\n return `arg`;\n } else {\n return prop.name;\n }\n })\n .join(', ');\n\n const headerParams = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(', ');\n\n const httpFnProperties = [httpFnPropertiesWithoutHeaders, headerParams]\n .filter(Boolean)\n .join(', ');\n\n const swrKeyFnName = camel(`get-${operationName}-mutation-key`);\n const swrMutationKeyFn = `export const ${swrKeyFnName} = (${queryKeyProps}) => [\\`${route}\\`${\n queryParams ? ', ...(params ? [params]: [])' : ''\n }] as const;\n`;\n\n const swrMutationFetcherOptionType = getSwrMutationFetcherOptionType(\n httpClient,\n mutator,\n );\n\n const swrMutationFetcherOptions =\n isRequestOptions && swrMutationFetcherOptionType\n ? `options${context.output.optionsParamRequired ? '' : '?'}: ${swrMutationFetcherOptionType}`\n : '';\n\n const swrMutationFetcherArg = props.some(\n (prop) => prop.type === GetterPropType.BODY,\n )\n ? '{ arg }'\n : '__';\n\n const bodyProp = props.find((prop) => prop.type === GetterPropType.BODY);\n const baseSwrBodyType =\n bodyProp?.implementation.split(': ')[1] ?? 'Arguments';\n const swrBodyType =\n bodyProp && !bodyProp.required\n ? `${baseSwrBodyType} | undefined`\n : baseSwrBodyType;\n\n const swrMutationFetcherFn = `\nexport const ${swrMutationFetcherName} = (${swrProps} ${swrMutationFetcherOptions}) => {\n return (_: Key, ${swrMutationFetcherArg}: { arg: ${swrBodyType} }) => {\n return ${operationName}(${httpFnProperties}${\n swrMutationFetcherOptions.length > 0\n ? (httpFnProperties.length > 0 ? ', ' : '') + 'options'\n : ''\n });\n }\n}\\n`;\n\n const swrImplementation = generateSwrMutationImplementation({\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n isRequestOptions,\n response,\n mutator,\n swrOptions: override.swr,\n doc,\n swrBodyType,\n httpClient: context.output.httpClient,\n });\n\n return swrMutationFetcherFn + swrMutationKeyFn + swrImplementation;\n }\n};\n\nexport const generateSwrHeader: ClientHeaderBuilder = (params) =>\n `\n ${\n params.hasAwaitedType\n ? ''\n : `type AwaitedInput<T> = PromiseLike<T> | T;\\n\n type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\\n\\n`\n }\n ${\n params.isRequestOptions && params.isMutator\n ? `type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\\n\\n`\n : ''\n }\n ${getSwrHeader(params)}\n`;\n\nexport const generateSwr: ClientBuilder = (verbOptions, options) => {\n const imports = generateVerbImports(verbOptions);\n const functionImplementation = generateSwrRequestFunction(\n verbOptions,\n options,\n );\n const hookImplementation = generateSwrHook(verbOptions, options);\n\n return {\n implementation: `${functionImplementation}\\n\\n${hookImplementation}`,\n imports,\n };\n};\n\nconst swrClientBuilder: ClientGeneratorsBuilder = {\n client: generateSwr,\n header: generateSwrHeader,\n dependencies: getSwrDependencies,\n};\n\nexport const builder = () => () => swrClientBuilder;\n\nexport default builder;\n"],"mappings":";;;AAqBA,MAAa,qBAA4C,CACvD;CACE,SAAS;EACP;GACE,MAAM;GACN,SAAS;GACT,QAAQ;GACR,wBAAwB;GACzB;EACD,EAAE,MAAM,sBAAsB;EAC9B,EAAE,MAAM,iBAAiB;EACzB,EAAE,MAAM,cAAc;EACvB;CACD,YAAY;CACb,CACF;AAED,MAAa,8BACX,aACA,YACG;AACH,QAAO,QAAQ,QAAQ,OAAO,eAAe,iBAAiB,QAC1D,6BAA6B,aAAa,QAAQ,GAClDA,wBAA6B,aAAa,QAAQ;;AAGxD,MAAM,gCACJ,EACE,SACA,aACA,eACA,UACA,SACA,MACA,OACA,MACA,UACA,gBACA,UACA,oBAEF,EAAE,OAAO,cACN;CACH,MAAM,mBAAmB,SAAS,mBAAmB;CACrD,MAAM,aAAa,CAAC,SAAS,SAAS;CACtC,MAAM,mBAAmB,SAAS,mBAAmB;CACrD,MAAM,+BACJ,CAAC,CAAC,QAAQ,OAAO,UAAU,iBAAiB;CAC9C,MAAM,mCAAmC,+BACvC,QAAQ,OAAO,SAChB;CAED,MAAM,WAAW,sCAAsC;EACrD;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,KAAI,SAAS;EACX,MAAM,gBAAgB,sBAAsB;GAC1C;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,WAAW;GACX;GACD,CAAC;EAEF,MAAM,sBACJ,QAAQ,gBAA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,4BACJ,oBAAoB,+BAChB,UAAU,QAAQ,OAAO,uBAAuB,KAAK,IAAI,IAAI,iCAC7D;EAEN,MAAM,wBAAwB,MAAM,MACjC,SAAS,KAAK,SAAS,eAAe,KACxC,GACG,YACA;EAEJ,MAAM,WAAW,MAAM,MAAM,SAAS,KAAK,SAAS,eAAe,KAAK;EACxE,MAAM,kBACJ,UAAU,eAAe,MAAM,KAAK,CAAC,MAAM;EAC7C,MAAM,cACJ,YAAY,CAAC,SAAS,WAClB,GAAG,gBAAgB,gBACnB;EAEN,MAAM,uBAAuB;eAClB,uBAAuB,MAAM,SAAS,GAAG,0BAA0B;oBAC9D,sBAAsB,WAAW,YAAY;aACpD,cAAc,GAAG,mBACxB,0BAA0B,SAAS,KAC9B,iBAAiB,SAAS,IAAI,OAAO,MAAM,YAC5C,GACL;;;EAID,MAAM,oBAAoB,kCAAkC;GAC1D;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,YAAY,SAAS;GACrB;GACA;GACA,YAAY,QAAQ,OAAO;GAC5B,CAAC;AAEF,SAAO,uBAAuB,mBAAmB;;;AAIrD,MAAa,qBAA0C,WACrD;IAEE,OAAO,iBACH,KACA;0EAEL;IAEC,OAAO,oBAAoB,OAAO,YAC9B,wFACA,GACL;IACC,aAAa,OAAO,CAAC;;AAGzB,MAAa,eAA8B,aAAa,YAAY;CAClE,MAAM,UAAU,oBAAoB,YAAY;AAOhD,QAAO;EACL,gBAAgB,GAPa,2BAC7B,aACA,QACD,CAI2C,MAHjB,gBAAgB,aAAa,QAAQ;EAI9D;EACD;;AAGH,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,cAAc;CACf;AAED,MAAa,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["generateFetchRequestFunction"],"sources":["../src/client.ts","../src/index.ts"],"sourcesContent":["import {\n type ClientHeaderBuilder,\n generateFormDataAndUrlEncodedFunction,\n generateMutatorConfig,\n generateMutatorRequestOptions,\n generateOptions,\n type GeneratorDependency,\n type GeneratorMutator,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GetterResponse,\n isSyntheticDefaultImportsAllow,\n OutputHttpClient,\n toObjectString,\n} from '@orval/core';\nimport {\n fetchResponseTypeName,\n generateFetchHeader,\n generateRequestFunction as generateFetchRequestFunction,\n} from '@orval/fetch';\n\nexport const AXIOS_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'axios',\n default: true,\n values: true,\n syntheticDefaultImport: true,\n },\n { name: 'AxiosRequestConfig' },\n { name: 'AxiosResponse' },\n { name: 'AxiosError' },\n ],\n dependency: 'axios',\n },\n];\n\nexport const generateSwrRequestFunction = (\n verbOptions: GeneratorVerbOptions,\n options: GeneratorOptions,\n) => {\n return options.context.output.httpClient === OutputHttpClient.AXIOS\n ? generateAxiosRequestFunction(verbOptions, options)\n : generateFetchRequestFunction(verbOptions, options);\n};\n\nconst generateAxiosRequestFunction = (\n {\n headers,\n queryParams,\n operationName,\n response,\n mutator,\n body,\n props,\n verb,\n formData,\n formUrlEncoded,\n override,\n paramsSerializer,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const isFormData = !override.formData.disabled;\n const isFormUrlEncoded = override.formUrlEncoded !== false;\n const isExactOptionalPropertyTypes =\n !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes;\n const isSyntheticDefaultImportsAllowed = isSyntheticDefaultImportsAllow(\n context.output.tsconfig,\n );\n\n const bodyForm = generateFormDataAndUrlEncodedFunction({\n formData,\n formUrlEncoded,\n body,\n isFormData,\n isFormUrlEncoded,\n });\n\n if (mutator) {\n const mutatorConfig = generateMutatorConfig({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal: false,\n isExactOptionalPropertyTypes,\n });\n\n const propsImplementation =\n mutator.bodyTypeName && body.definition\n ? toObjectString(props, 'implementation').replace(\n new RegExp(String.raw`(\\w*):\\s?${body.definition}`),\n `$1: ${mutator.bodyTypeName}<${body.definition}>`,\n )\n : toObjectString(props, 'implementation');\n\n const requestOptions = isRequestOptions\n ? generateMutatorRequestOptions(\n override.requestOptions,\n mutator.hasSecondArg,\n )\n : '';\n\n const requestImplementation = `export const ${operationName} = (\\n ${propsImplementation}\\n ${\n isRequestOptions && mutator.hasSecondArg\n ? `options${context.output.optionsParamRequired ? '' : '?'}: SecondParameter<typeof ${mutator.name}>`\n : ''\n }) => {${bodyForm}\n return ${mutator.name}<${response.definition.success || 'unknown'}>(\n ${mutatorConfig},\n ${requestOptions});\n }\n`;\n\n return requestImplementation;\n }\n\n const options = generateOptions({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions: override.requestOptions,\n isFormData,\n isFormUrlEncoded,\n paramsSerializer,\n paramsSerializerOptions: override.paramsSerializerOptions,\n isExactOptionalPropertyTypes,\n hasSignal: false,\n });\n\n return `export const ${operationName} = (\\n ${toObjectString(\n props,\n 'implementation',\n )} ${\n isRequestOptions ? `options?: AxiosRequestConfig\\n` : ''\n } ): Promise<AxiosResponse<${\n response.definition.success || 'unknown'\n }>> => {${bodyForm}\n return axios${\n isSyntheticDefaultImportsAllowed ? '' : '.default'\n }.${verb}(${options});\n }\n`;\n};\n\nexport const getSwrRequestOptions = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'axios?: AxiosRequestConfig'\n : 'fetch?: RequestInit';\n } else if (mutator.hasSecondArg) {\n return `request?: SecondParameter<typeof ${mutator.name}>`;\n } else {\n return '';\n }\n};\n\nexport const getSwrErrorType = (\n response: GetterResponse,\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (mutator) {\n return mutator.hasErrorType\n ? `ErrorType<${response.definition.errors || 'unknown'}>`\n : response.definition.errors || 'unknown';\n } else {\n const errorType =\n httpClient === OutputHttpClient.AXIOS ? 'AxiosError' : 'Promise';\n\n return `${errorType}<${response.definition.errors || 'unknown'}>`;\n }\n};\n\nexport const getSwrRequestSecondArg = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'axios: axiosOptions'\n : 'fetch: fetchOptions';\n } else if (mutator.hasSecondArg) {\n return 'request: requestOptions';\n } else {\n return '';\n }\n};\n\nexport const getHttpRequestSecondArg = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? `axiosOptions`\n : `fetchOptions`;\n } else if (mutator.hasSecondArg) {\n return 'requestOptions';\n } else {\n return '';\n }\n};\n\nexport const getSwrMutationFetcherOptionType = (\n httpClient: OutputHttpClient,\n mutator?: GeneratorMutator,\n) => {\n if (!mutator) {\n return httpClient === OutputHttpClient.AXIOS\n ? 'AxiosRequestConfig'\n : 'RequestInit';\n } else if (mutator.hasSecondArg) {\n return `SecondParameter<typeof ${mutator.name}>`;\n } else {\n return '';\n }\n};\n\nexport const getSwrMutationFetcherType = (\n response: GetterResponse,\n httpClient: OutputHttpClient,\n includeHttpResponseReturnType: boolean | undefined,\n operationName: string,\n mutator?: GeneratorMutator,\n) => {\n if (httpClient === OutputHttpClient.FETCH) {\n const responseType = fetchResponseTypeName(\n includeHttpResponseReturnType,\n response.definition.success,\n operationName,\n );\n\n return `Promise<${responseType}>`;\n } else if (mutator) {\n return `Promise<${response.definition.success || 'unknown'}>`;\n } else {\n return `Promise<AxiosResponse<${response.definition.success || 'unknown'}>>`;\n }\n};\n\nexport const getSwrHeader: ClientHeaderBuilder = (params) => {\n return params.output.httpClient === OutputHttpClient.FETCH\n ? generateFetchHeader(params)\n : '';\n};\n","import {\n camel,\n type ClientBuilder,\n type ClientDependenciesBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n generateVerbImports,\n type GeneratorDependency,\n type GeneratorMutator,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GetterParams,\n type GetterProp,\n type GetterProps,\n GetterPropType,\n type GetterResponse,\n jsDoc,\n OutputHttpClient,\n pascal,\n stringify,\n type SwrOptions,\n toObjectString,\n Verbs,\n} from '@orval/core';\n\nimport {\n AXIOS_DEPENDENCIES,\n generateSwrRequestFunction,\n getHttpRequestSecondArg,\n getSwrErrorType,\n getSwrHeader,\n getSwrMutationFetcherOptionType,\n getSwrMutationFetcherType,\n getSwrRequestOptions,\n getSwrRequestSecondArg,\n} from './client';\n\nconst PARAMS_SERIALIZER_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'qs',\n default: true,\n values: true,\n syntheticDefaultImport: true,\n },\n ],\n dependency: 'qs',\n },\n];\n\nconst SWR_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSwr', values: true, default: true },\n { name: 'SWRConfiguration' },\n { name: 'Key' },\n { name: 'Arguments' },\n ],\n dependency: 'swr',\n },\n];\n\nconst SWR_INFINITE_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSWRInfinite', values: true, default: true },\n { name: 'SWRInfiniteConfiguration' },\n { name: 'SWRInfiniteKeyLoader' },\n ],\n dependency: 'swr/infinite',\n },\n];\n\nconst SWR_MUTATION_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'useSWRMutation', values: true, default: true },\n { name: 'SWRMutationConfiguration' },\n { name: 'SWRMutationKey' },\n ],\n dependency: 'swr/mutation',\n },\n];\n\nexport const getSwrDependencies: ClientDependenciesBuilder = (\n hasGlobalMutator: boolean,\n hasParamsSerializerOptions: boolean,\n _packageJson,\n httpClient?: OutputHttpClient,\n) => [\n ...(!hasGlobalMutator && httpClient === OutputHttpClient.AXIOS\n ? AXIOS_DEPENDENCIES\n : []),\n ...(hasParamsSerializerOptions ? PARAMS_SERIALIZER_DEPENDENCIES : []),\n ...SWR_DEPENDENCIES,\n ...SWR_INFINITE_DEPENDENCIES,\n ...SWR_MUTATION_DEPENDENCIES,\n];\n\nconst generateSwrArguments = ({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite,\n httpClient,\n}: {\n operationName: string;\n mutator?: GeneratorMutator;\n isRequestOptions: boolean;\n isInfinite: boolean;\n httpClient: OutputHttpClient;\n}) => {\n const configType = isInfinite\n ? 'SWRInfiniteConfiguration'\n : 'SWRConfiguration';\n const optionsType = isInfinite\n ? '{ swrKeyLoader?: SWRInfiniteKeyLoader, enabled?: boolean }'\n : '{ swrKey?: Key, enabled?: boolean }';\n const definition = `${configType}<Awaited<ReturnType<typeof ${operationName}>>, TError> & ${optionsType}`;\n\n if (!isRequestOptions) {\n return `swrOptions?: ${definition}`;\n }\n\n return `options?: { swr?:${definition}, ${getSwrRequestOptions(httpClient, mutator)} }\\n`;\n};\n\nconst generateSwrMutationArguments = ({\n operationName,\n isRequestOptions,\n mutator,\n swrBodyType,\n httpClient,\n}: {\n operationName: string;\n isRequestOptions: boolean;\n mutator?: GeneratorMutator;\n swrBodyType: string;\n httpClient: OutputHttpClient;\n}) => {\n const definition = `SWRMutationConfiguration<Awaited<ReturnType<typeof ${operationName}>>, TError, Key, ${swrBodyType}, Awaited<ReturnType<typeof ${operationName}>>> & { swrKey?: string }`;\n\n if (!isRequestOptions) {\n return `swrOptions?: ${definition}`;\n }\n\n return `options?: { swr?:${definition}, ${getSwrRequestOptions(httpClient, mutator)}}\\n`;\n};\n\nconst generateSwrImplementation = ({\n operationName,\n swrKeyFnName,\n swrKeyLoaderFnName,\n swrProperties,\n swrKeyProperties,\n params,\n mutator,\n isRequestOptions,\n response,\n swrOptions,\n props,\n doc,\n httpClient,\n pathOnlyParams,\n headerOnlyParams,\n hasQueryParams,\n queryParamType,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrKeyLoaderFnName: string;\n swrProperties: string;\n swrKeyProperties: string;\n params: GetterParams;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n httpClient: OutputHttpClient;\n pathOnlyParams: string;\n headerOnlyParams: string;\n hasQueryParams: boolean;\n queryParamType: string;\n}) => {\n const swrProps = toObjectString(props, 'implementation');\n\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const httpFunctionProps = swrProperties;\n\n const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${\n params.length > 0\n ? ` && ${params\n .map(({ name }) => `${name} !== null && ${name} !== undefined`)\n .join(' && ')}`\n : ''\n }`;\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;\n const swrKeyLoaderImplementation = `const swrKeyLoader = swrOptions?.swrKeyLoader ?? (isEnabled ? ${swrKeyLoaderFnName}(${swrKeyProperties}) : () => null);`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const errorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}InfiniteError = ${errorType}\\n`\n : '';\n\n const useSWRInfiniteImplementation = swrOptions.useInfinite\n ? `\nexport type ${pascal(\n operationName,\n )}InfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${errorTypeExport}\n${doc}export const ${camel(\n `use-${operationName}-infinite`,\n )} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: true,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyLoaderImplementation}\n const swrFn = ${\n hasQueryParams\n ? `([_url, pageParams]: [string, ${queryParamType} & { page: number }]) => ${operationName}(${pathOnlyParams}${pathOnlyParams ? ', ' : ''}pageParams${headerOnlyParams ? ', ' + headerOnlyParams : ''}${httpRequestSecondArg ? ', ' + httpRequestSecondArg : ''})`\n : `([_url]: [string]) => ${operationName}(${pathOnlyParams}${headerOnlyParams ? (pathOnlyParams ? ', ' : '') + headerOnlyParams : ''}${httpRequestSecondArg ? (pathOnlyParams || headerOnlyParams ? ', ' : '') + httpRequestSecondArg : ''})`\n }\n\n const ${queryResultVarName} = useSWRInfinite<Awaited<ReturnType<typeof swrFn>>, TError>(swrKeyLoader, swrFn, ${\n swrOptions.swrInfiniteOptions\n ? `{\n ${stringify(swrOptions.swrInfiniteOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKeyLoader,\n ...${queryResultVarName}\n }\n}\\n`\n : '';\n\n const queryErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}QueryError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n operationName,\n )}QueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${queryErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: false,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyImplementation}\n const swrFn = () => ${operationName}(${httpFunctionProps}${\n httpFunctionProps && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg})\n\n const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${\n swrOptions.swrOptions\n ? `{\n ${stringify(swrOptions.swrOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKey,\n ...${queryResultVarName}\n }\n}\\n`;\n\n return useSWRInfiniteImplementation + useSwrImplementation;\n};\n\nconst generateSwrSuspenseImplementation = ({\n operationName,\n swrKeyFnName,\n swrKeyProperties,\n params,\n mutator,\n isRequestOptions,\n response,\n swrOptions,\n props,\n doc,\n httpClient,\n httpFunctionProps,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrKeyProperties: string;\n params: GetterParams;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n httpClient: OutputHttpClient;\n httpFunctionProps: string;\n}) => {\n const swrProps = toObjectString(props, 'implementation');\n\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${\n params.length > 0\n ? ` && ${params\n .map(({ name }) => `${name} !== null && ${name} !== undefined`)\n .join(' && ')}`\n : ''\n }`;\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? ${swrKeyFnName}(${swrKeyProperties}) : null);`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const suspenseErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}SuspenseQueryError = ${errorType}\\n`\n : '';\n\n const useSwrSuspenseImplementation = `\nexport type ${pascal(\n operationName,\n )}SuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${suspenseErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}-suspense`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrArguments({\n operationName,\n mutator,\n isRequestOptions,\n isInfinite: false,\n httpClient,\n })}) => {\n ${\n isRequestOptions\n ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}`\n : ''\n }\n\n ${enabledImplementation}\n ${swrKeyImplementation}\n const swrFn = () => ${operationName}(${httpFunctionProps}${\n httpFunctionProps && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg})\n\n const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${\n swrOptions.swrOptions\n ? `{\n ${stringify(swrOptions.swrOptions)?.slice(1, -1)}\n suspense: true,\n ...swrOptions\n }`\n : '{ suspense: true, ...swrOptions }'\n })\n\n return {\n swrKey,\n ...${queryResultVarName},\n data: ${queryResultVarName}.data as NonNullable<typeof ${queryResultVarName}.data>,\n }\n}\\n`;\n\n return useSwrSuspenseImplementation;\n};\n\nconst generateSwrMutationImplementation = ({\n isRequestOptions,\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n response,\n mutator,\n swrOptions,\n doc,\n swrBodyType,\n httpClient,\n verb,\n}: {\n isRequestOptions: boolean;\n operationName: string;\n swrKeyFnName: string;\n swrMutationFetcherName: string;\n swrKeyProperties: string;\n swrMutationFetcherProperties: string;\n swrProps: string;\n props: GetterProps;\n response: GetterResponse;\n mutator?: GeneratorMutator;\n swrOptions: SwrOptions;\n doc?: string;\n swrBodyType: string;\n httpClient: OutputHttpClient;\n verb?: Verbs;\n}) => {\n const hasParamReservedWord = props.some(\n (prop: GetterProp) => prop.name === 'query',\n );\n const queryResultVarName = hasParamReservedWord ? '_query' : 'query';\n\n const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? ${swrKeyFnName}(${swrKeyProperties});`;\n\n const errorType = getSwrErrorType(response, httpClient, mutator);\n const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);\n const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);\n\n const mutationErrorTypeExport = swrOptions.generateErrorTypes\n ? `export type ${pascal(operationName)}MutationError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n operationName,\n )}MutationResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>\n${mutationErrorTypeExport}\n${doc}export const ${camel(`use-${operationName}${verb === Verbs.GET ? '-mutation' : ''}`)} = <TError = ${errorType}>(\n ${swrProps} ${generateSwrMutationArguments({\n operationName,\n isRequestOptions,\n mutator,\n swrBodyType,\n httpClient,\n })}) => {\n\n ${isRequestOptions ? `const {swr: swrOptions${swrRequestSecondArg ? `, ${swrRequestSecondArg}` : ''}} = options ?? {}` : ''}\n\n ${swrKeyImplementation}\n const swrFn = ${swrMutationFetcherName}(${swrMutationFetcherProperties}${\n swrMutationFetcherProperties && httpRequestSecondArg ? ', ' : ''\n }${httpRequestSecondArg});\n\n const ${queryResultVarName} = useSWRMutation(swrKey, swrFn, ${\n swrOptions.swrMutationOptions\n ? `{\n ${stringify(swrOptions.swrMutationOptions)?.slice(1, -1)}\n ...swrOptions\n }`\n : 'swrOptions'\n })\n\n return {\n swrKey,\n ...${queryResultVarName}\n }\n}\\n`;\n\n return useSwrImplementation;\n};\n\nconst generateSwrHook = (\n {\n queryParams,\n operationName,\n body,\n props,\n verb,\n params,\n override,\n mutator,\n response,\n summary,\n deprecated,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const httpClient = context.output.httpClient;\n const doc = jsDoc({ summary, deprecated });\n\n const queryKeyProps = toObjectString(\n props.filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.QUERY_PARAM,\n ),\n 'implementation',\n );\n\n const swrProps = toObjectString(\n props.filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.QUERY_PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.HEADER,\n ),\n 'implementation',\n );\n\n const swrMutationFetcherProperties = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.QUERY_PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.HEADER,\n )\n .map((param) => {\n return param.type === GetterPropType.NAMED_PATH_PARAMS\n ? param.destructured\n : param.name;\n })\n .join(',');\n\n const swrKeyProperties = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.QUERY_PARAM,\n )\n .map((prop) => {\n return prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? prop.destructured\n : prop.name;\n })\n .join(',');\n\n const swrMutationFetcherName = camel(`get-${operationName}-mutation-fetcher`);\n\n if (verb === Verbs.GET) {\n const swrKeyProperties = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((param) => {\n if (param.type === GetterPropType.NAMED_PATH_PARAMS)\n return param.destructured;\n return param.type === GetterPropType.BODY\n ? body.implementation\n : param.name;\n })\n .join(',');\n\n const swrProperties = props\n .map((param) => {\n if (param.type === GetterPropType.NAMED_PATH_PARAMS)\n return param.destructured;\n return param.type === GetterPropType.BODY\n ? body.implementation\n : param.name;\n })\n .join(',');\n\n // For useSWRInfinite: separate path params from query params\n const pathOnlyParams = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS,\n )\n .map((param) => {\n return param.type === GetterPropType.NAMED_PATH_PARAMS\n ? param.destructured\n : param.name;\n })\n .join(',');\n\n const headerOnlyParams = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(',');\n\n const hasQueryParams = props.some(\n (prop) => prop.type === GetterPropType.QUERY_PARAM,\n );\n\n // Extract just the type name from definition (e.g., \"params: ListPetsParams\" -> \"ListPetsParams\")\n const queryParamType =\n props\n .find((prop) => prop.type === GetterPropType.QUERY_PARAM)\n ?.definition.split(': ')[1] ?? 'never';\n\n const queryKeyProps = toObjectString(\n props.filter((prop) => prop.type !== GetterPropType.HEADER),\n 'implementation',\n );\n\n const swrKeyFnName = camel(`get-${operationName}-key`);\n const swrKeyFn = `\nexport const ${swrKeyFnName} = (${queryKeyProps}) => [\\`${route}\\`${\n queryParams ? ', ...(params ? [params]: [])' : ''\n }] as const;\n`;\n\n const swrKeyLoaderFnName = camel(\n `get-${operationName}-infinite-key-loader`,\n );\n const swrKeyLoader = override.swr.useInfinite\n ? `export const ${swrKeyLoaderFnName} = (${queryKeyProps}) => {\n return (page: number, previousPageData?: Awaited<ReturnType<typeof ${operationName}>>) => {\n if (previousPageData) {\n const responseData = previousPageData.data\n if (!responseData) return null\n\n // Direct array response (e.g., API returns Pet[]) - stop when empty\n if (Array.isArray(responseData) && responseData.length === 0) return null\n\n // Wrapped response with data array (e.g., { data: Pet[], ... }) - stop when nested array is empty\n if (typeof responseData === 'object' && 'data' in responseData) {\n if (Array.isArray(responseData.data) && responseData.data.length === 0) return null\n }\n\n // Single object response (non-paginated endpoint) - stop after first page\n if (!Array.isArray(responseData) && !(typeof responseData === 'object' && 'data' in responseData)) return null\n }\n\n return [\\`${route}\\`${queryParams ? ', ...(params ? [{...params,page}]: [{page}])' : ''}${\n body.implementation ? `, ${body.implementation}` : ''\n }] as const;\n }\n}\\n`\n : '';\n\n const swrImplementation = generateSwrImplementation({\n operationName,\n swrKeyFnName,\n swrKeyLoaderFnName,\n swrProperties,\n swrKeyProperties,\n params,\n props,\n mutator,\n isRequestOptions,\n response,\n swrOptions: override.swr,\n doc,\n httpClient,\n pathOnlyParams,\n headerOnlyParams,\n hasQueryParams,\n queryParamType,\n });\n\n const swrSuspenseImplementation = override.swr.useSuspense\n ? generateSwrSuspenseImplementation({\n operationName,\n swrKeyFnName,\n swrKeyProperties,\n params,\n props,\n mutator,\n isRequestOptions,\n response,\n swrOptions: override.swr,\n doc,\n httpClient,\n httpFunctionProps: swrProperties,\n })\n : '';\n\n if (!override.swr.useSWRMutationForGet) {\n return (\n swrKeyFn + swrKeyLoader + swrImplementation + swrSuspenseImplementation\n );\n }\n\n // For OutputClient.SWR_GET_MUTATION, generate both useSWR and useSWRMutation\n const httpFnPropertiesForGetWithoutHeaders = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((prop) => {\n return prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? prop.destructured\n : prop.name;\n })\n .join(', ');\n\n const headerParamsForGet = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(', ');\n\n const httpFnPropertiesForGet = [\n httpFnPropertiesForGetWithoutHeaders,\n headerParamsForGet,\n ]\n .filter(Boolean)\n .join(', ');\n\n const swrMutationFetcherType = getSwrMutationFetcherType(\n response,\n httpClient,\n override.fetch.includeHttpResponseReturnType,\n operationName,\n mutator,\n );\n const swrMutationFetcherOptionType = getSwrMutationFetcherOptionType(\n httpClient,\n mutator,\n );\n\n const swrMutationFetcherOptions =\n isRequestOptions && swrMutationFetcherOptionType\n ? `options${context.output.optionsParamRequired ? '' : '?'}: ${swrMutationFetcherOptionType}`\n : '';\n\n const swrMutationFetcherFn = `\nexport const ${swrMutationFetcherName} = (${queryKeyProps} ${swrMutationFetcherOptions}) => {\n return (_: Key, __: { arg?: never }): ${swrMutationFetcherType} => {\n return ${operationName}(${httpFnPropertiesForGet}${\n swrMutationFetcherOptions.length > 0\n ? (httpFnPropertiesForGet.length > 0 ? ', ' : '') + 'options'\n : ''\n });\n }\n}\n`;\n\n const swrMutationImplementation = generateSwrMutationImplementation({\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n isRequestOptions,\n response,\n mutator,\n swrOptions: override.swr,\n doc,\n swrBodyType: 'never',\n httpClient,\n verb: Verbs.GET,\n });\n\n return (\n swrKeyFn +\n swrKeyLoader +\n swrImplementation +\n swrSuspenseImplementation +\n swrMutationFetcherFn +\n swrMutationImplementation\n );\n } else {\n const httpFnPropertiesWithoutHeaders = props\n .filter((prop) => prop.type !== GetterPropType.HEADER)\n .map((prop) => {\n if (prop.type === GetterPropType.NAMED_PATH_PARAMS) {\n return prop.destructured;\n } else if (prop.type === GetterPropType.BODY) {\n return `arg`;\n } else {\n return prop.name;\n }\n })\n .join(', ');\n\n const headerParams = props\n .filter((prop) => prop.type === GetterPropType.HEADER)\n .map((param) => param.name)\n .join(', ');\n\n const httpFnProperties = [httpFnPropertiesWithoutHeaders, headerParams]\n .filter(Boolean)\n .join(', ');\n\n const swrKeyFnName = camel(`get-${operationName}-mutation-key`);\n const swrMutationKeyFn = `export const ${swrKeyFnName} = (${queryKeyProps}) => [\\`${route}\\`${\n queryParams ? ', ...(params ? [params]: [])' : ''\n }] as const;\n`;\n\n const swrMutationFetcherOptionType = getSwrMutationFetcherOptionType(\n httpClient,\n mutator,\n );\n\n const swrMutationFetcherOptions =\n isRequestOptions && swrMutationFetcherOptionType\n ? `options${context.output.optionsParamRequired ? '' : '?'}: ${swrMutationFetcherOptionType}`\n : '';\n\n const swrMutationFetcherArg = props.some(\n (prop) => prop.type === GetterPropType.BODY,\n )\n ? '{ arg }'\n : '__';\n\n const bodyProp = props.find((prop) => prop.type === GetterPropType.BODY);\n const baseSwrBodyType =\n bodyProp?.implementation.split(': ')[1] ?? 'Arguments';\n const swrBodyType =\n bodyProp && !bodyProp.required\n ? `${baseSwrBodyType} | undefined`\n : baseSwrBodyType;\n\n const swrMutationFetcherFn = `\nexport const ${swrMutationFetcherName} = (${swrProps} ${swrMutationFetcherOptions}) => {\n return (_: Key, ${swrMutationFetcherArg}: { arg: ${swrBodyType} }) => {\n return ${operationName}(${httpFnProperties}${\n swrMutationFetcherOptions.length > 0\n ? (httpFnProperties.length > 0 ? ', ' : '') + 'options'\n : ''\n });\n }\n}\\n`;\n\n const swrImplementation = generateSwrMutationImplementation({\n operationName,\n swrKeyFnName,\n swrMutationFetcherName,\n swrKeyProperties,\n swrMutationFetcherProperties,\n swrProps,\n props,\n isRequestOptions,\n response,\n mutator,\n swrOptions: override.swr,\n doc,\n swrBodyType,\n httpClient: context.output.httpClient,\n });\n\n return swrMutationFetcherFn + swrMutationKeyFn + swrImplementation;\n }\n};\n\nexport const generateSwrHeader: ClientHeaderBuilder = (params) =>\n `\n ${\n params.hasAwaitedType\n ? ''\n : `type AwaitedInput<T> = PromiseLike<T> | T;\\n\n type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\\n\\n`\n }\n ${\n params.isRequestOptions && params.isMutator\n ? `type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\\n\\n`\n : ''\n }\n ${getSwrHeader(params)}\n`;\n\nexport const generateSwr: ClientBuilder = (verbOptions, options) => {\n const imports = generateVerbImports(verbOptions);\n const functionImplementation = generateSwrRequestFunction(\n verbOptions,\n options,\n );\n const hookImplementation = generateSwrHook(verbOptions, options);\n\n const isFetchHttpClient =\n options.context.output.httpClient !== OutputHttpClient.AXIOS;\n\n return {\n implementation: `${functionImplementation}\\n\\n${hookImplementation}`,\n imports,\n ...(isFetchHttpClient && { docComment: '' }),\n };\n};\n\nconst swrClientBuilder: ClientGeneratorsBuilder = {\n client: generateSwr,\n header: generateSwrHeader,\n dependencies: getSwrDependencies,\n};\n\nexport const builder = () => () => swrClientBuilder;\n\nexport default builder;\n"],"mappings":";;;AAqBA,MAAa,qBAA4C,CACvD;CACE,SAAS;EACP;GACE,MAAM;GACN,SAAS;GACT,QAAQ;GACR,wBAAwB;GACzB;EACD,EAAE,MAAM,sBAAsB;EAC9B,EAAE,MAAM,iBAAiB;EACzB,EAAE,MAAM,cAAc;EACvB;CACD,YAAY;CACb,CACF;AAED,MAAa,8BACX,aACA,YACG;AACH,QAAO,QAAQ,QAAQ,OAAO,eAAe,iBAAiB,QAC1D,6BAA6B,aAAa,QAAQ,GAClDA,wBAA6B,aAAa,QAAQ;;AAGxD,MAAM,gCACJ,EACE,SACA,aACA,eACA,UACA,SACA,MACA,OACA,MACA,UACA,gBACA,UACA,oBAEF,EAAE,OAAO,cACN;CAC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AC9B,wFACA,GACL;IACC,aAAa,OAAO,CAAC;;AAGzB,MAAa,eAA8B,aAAa,YAAY;CAClE,MAAM,UAAU,oBAAoB,YAAY;CAChD,MAAM,yBAAyB,2BAC7B,aACA,QACD;CACD,MAAM,qBAAqB,gBAAgB,aAAa,QAAQ;CAEhE,MAAM,oBACJ,QAAQ,QAAQ,OAAO,eAAe,iBAAiB;AAEzD,QAAO;EACL,gBAAgB,GAAG,uBAAuB,MAAM;EAChD;EACA,GAAI,qBAAqB,EAAE,YAAY,IAAI;EAC5C;;AAGH,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,cAAc;CACf;AAED,MAAa,sBAAsB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/swr",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"nuke": "rimraf .turbo dist node_modules"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@orval/core": "8.
|
|
39
|
-
"@orval/fetch": "8.
|
|
38
|
+
"@orval/core": "8.10.0",
|
|
39
|
+
"@orval/fetch": "8.10.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"eslint": "10.1.0",
|