@orval/swr 8.19.0 → 8.21.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 +19 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -97,8 +97,8 @@ const getSwrMutationFetcherOptionType = (httpClient, mutator) => {
|
|
|
97
97
|
else if (mutator.hasSecondArg) return `SecondParameter<typeof ${mutator.name}>`;
|
|
98
98
|
else return "";
|
|
99
99
|
};
|
|
100
|
-
const getSwrMutationFetcherType = (response, httpClient, includeHttpResponseReturnType,
|
|
101
|
-
if (httpClient === OutputHttpClient.FETCH) return `Promise<${fetchResponseTypeName(includeHttpResponseReturnType, response.definition.success,
|
|
100
|
+
const getSwrMutationFetcherType = (response, httpClient, includeHttpResponseReturnType, typeName, mutator) => {
|
|
101
|
+
if (httpClient === OutputHttpClient.FETCH) return `Promise<${fetchResponseTypeName(includeHttpResponseReturnType, response.definition.success, typeName)}>`;
|
|
102
102
|
else if (mutator) return `Promise<${response.definition.success || "unknown"}>`;
|
|
103
103
|
else return `Promise<AxiosResponse<${response.definition.success || "unknown"}>>`;
|
|
104
104
|
};
|
|
@@ -170,7 +170,7 @@ const generateSwrMutationArguments = ({ operationName, isRequestOptions, mutator
|
|
|
170
170
|
if (!isRequestOptions) return `swrOptions?: ${definition}`;
|
|
171
171
|
return `options?: { swr?:${definition}, ${getSwrRequestOptions(httpClient, mutator)}}\n`;
|
|
172
172
|
};
|
|
173
|
-
const generateSwrImplementation = ({ operationName, swrKeyFnName, swrKeyLoaderFnName, swrProperties, swrKeyProperties, params, mutator, isRequestOptions, response, swrOptions, props, doc, httpClient, pathOnlyParams, headerOnlyParams, hasQueryParams, queryParamType }) => {
|
|
173
|
+
const generateSwrImplementation = ({ operationName, typeName, swrKeyFnName, swrKeyLoaderFnName, swrProperties, swrKeyProperties, params, mutator, isRequestOptions, response, swrOptions, props, doc, httpClient, pathOnlyParams, headerOnlyParams, hasQueryParams, queryParamType }) => {
|
|
174
174
|
const swrProps = toObjectString(props, "implementation");
|
|
175
175
|
const queryResultVarName = props.some((prop) => prop.name === "query") ? "_query" : "query";
|
|
176
176
|
const httpFunctionProps = swrProperties;
|
|
@@ -180,9 +180,9 @@ const generateSwrImplementation = ({ operationName, swrKeyFnName, swrKeyLoaderFn
|
|
|
180
180
|
const errorType = getSwrErrorType(response, httpClient, mutator);
|
|
181
181
|
const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);
|
|
182
182
|
const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);
|
|
183
|
-
const errorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(
|
|
183
|
+
const errorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(typeName)}InfiniteError = ${errorType}\n` : "";
|
|
184
184
|
const useSWRInfiniteImplementation = swrOptions.useInfinite ? `
|
|
185
|
-
export type ${pascal(
|
|
185
|
+
export type ${pascal(typeName)}InfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>
|
|
186
186
|
${errorTypeExport}
|
|
187
187
|
${doc}export const ${camel(`use-${operationName}-infinite`)} = <TError = ${errorType}>(
|
|
188
188
|
${swrProps} ${generateSwrArguments({
|
|
@@ -208,9 +208,9 @@ ${doc}export const ${camel(`use-${operationName}-infinite`)} = <TError = ${error
|
|
|
208
208
|
...${queryResultVarName}
|
|
209
209
|
}
|
|
210
210
|
}\n` : "";
|
|
211
|
-
const queryErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(
|
|
211
|
+
const queryErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(typeName)}QueryError = ${errorType}\n` : "";
|
|
212
212
|
return useSWRInfiniteImplementation + `
|
|
213
|
-
export type ${pascal(
|
|
213
|
+
export type ${pascal(typeName)}QueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>
|
|
214
214
|
${queryErrorTypeExport}
|
|
215
215
|
${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(
|
|
216
216
|
${swrProps} ${generateSwrArguments({
|
|
@@ -237,7 +237,7 @@ ${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(
|
|
|
237
237
|
}
|
|
238
238
|
}\n`;
|
|
239
239
|
};
|
|
240
|
-
const generateSwrSuspenseImplementation = ({ operationName, swrKeyFnName, swrKeyProperties, params, mutator, isRequestOptions, response, swrOptions, props, doc, httpClient, httpFunctionProps }) => {
|
|
240
|
+
const generateSwrSuspenseImplementation = ({ operationName, typeName, 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
243
|
const enabledImplementation = `const isEnabled = swrOptions?.enabled !== false${params.length > 0 ? ` && ${params.map(({ name }) => `${name} !== null && ${name} !== undefined`).join(" && ")}` : ""}`;
|
|
@@ -245,9 +245,9 @@ const generateSwrSuspenseImplementation = ({ operationName, swrKeyFnName, swrKey
|
|
|
245
245
|
const errorType = getSwrErrorType(response, httpClient, mutator);
|
|
246
246
|
const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);
|
|
247
247
|
const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);
|
|
248
|
-
const suspenseErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(
|
|
248
|
+
const suspenseErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(typeName)}SuspenseQueryError = ${errorType}\n` : "";
|
|
249
249
|
return `
|
|
250
|
-
export type ${pascal(
|
|
250
|
+
export type ${pascal(typeName)}SuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>
|
|
251
251
|
${suspenseErrorTypeExport}
|
|
252
252
|
${doc}export const ${camel(`use-${operationName}-suspense`)} = <TError = ${errorType}>(
|
|
253
253
|
${swrProps} ${generateSwrArguments({
|
|
@@ -276,15 +276,15 @@ ${doc}export const ${camel(`use-${operationName}-suspense`)} = <TError = ${error
|
|
|
276
276
|
}
|
|
277
277
|
}\n`;
|
|
278
278
|
};
|
|
279
|
-
const generateSwrMutationImplementation = ({ isRequestOptions, operationName, swrKeyFnName, swrMutationFetcherName, swrKeyProperties, swrMutationFetcherProperties, swrProps, props, response, mutator, swrOptions, doc, swrBodyType, httpClient, verb }) => {
|
|
279
|
+
const generateSwrMutationImplementation = ({ isRequestOptions, operationName, typeName, swrKeyFnName, swrMutationFetcherName, swrKeyProperties, swrMutationFetcherProperties, swrProps, props, response, mutator, swrOptions, doc, swrBodyType, httpClient, verb }) => {
|
|
280
280
|
const queryResultVarName = props.some((prop) => prop.name === "query") ? "_query" : "query";
|
|
281
281
|
const swrKeyImplementation = `const swrKey = swrOptions?.swrKey ?? ${swrKeyFnName}(${swrKeyProperties});`;
|
|
282
282
|
const errorType = getSwrErrorType(response, httpClient, mutator);
|
|
283
283
|
const swrRequestSecondArg = getSwrRequestSecondArg(httpClient, mutator);
|
|
284
284
|
const httpRequestSecondArg = getHttpRequestSecondArg(httpClient, mutator);
|
|
285
|
-
const mutationErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(
|
|
285
|
+
const mutationErrorTypeExport = swrOptions.generateErrorTypes ? `export type ${pascal(typeName)}MutationError = ${errorType}\n` : "";
|
|
286
286
|
return `
|
|
287
|
-
export type ${pascal(
|
|
287
|
+
export type ${pascal(typeName)}MutationResult = NonNullable<Awaited<ReturnType<typeof ${operationName}>>>
|
|
288
288
|
${mutationErrorTypeExport}
|
|
289
289
|
${doc}export const ${camel(`use-${operationName}${verb === Verbs.GET ? "-mutation" : ""}`)} = <TError = ${errorType}>(
|
|
290
290
|
${swrProps} ${generateSwrMutationArguments({
|
|
@@ -311,7 +311,7 @@ ${doc}export const ${camel(`use-${operationName}${verb === Verbs.GET ? "-mutatio
|
|
|
311
311
|
}
|
|
312
312
|
}\n`;
|
|
313
313
|
};
|
|
314
|
-
const generateSwrHook = ({ queryParams, operationName, body, props, verb, params, override, mutator, response, summary, deprecated }, { route, context }) => {
|
|
314
|
+
const generateSwrHook = ({ queryParams, operationName, typeName, body, props, verb, params, override, mutator, response, summary, deprecated }, { route, context }) => {
|
|
315
315
|
const isRequestOptions = override.requestOptions !== false;
|
|
316
316
|
const httpClient = context.output.httpClient;
|
|
317
317
|
const doc = jsDoc({
|
|
@@ -371,6 +371,7 @@ export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${queryParams
|
|
|
371
371
|
}\n` : "";
|
|
372
372
|
const swrImplementation = generateSwrImplementation({
|
|
373
373
|
operationName,
|
|
374
|
+
typeName,
|
|
374
375
|
swrKeyFnName,
|
|
375
376
|
swrKeyLoaderFnName,
|
|
376
377
|
swrProperties,
|
|
@@ -390,6 +391,7 @@ export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${queryParams
|
|
|
390
391
|
});
|
|
391
392
|
const swrSuspenseImplementation = override.swr.useSuspense ? generateSwrSuspenseImplementation({
|
|
392
393
|
operationName,
|
|
394
|
+
typeName,
|
|
393
395
|
swrKeyFnName,
|
|
394
396
|
swrKeyProperties,
|
|
395
397
|
params,
|
|
@@ -406,7 +408,7 @@ export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${queryParams
|
|
|
406
408
|
const httpFnPropertiesForGet = [props.filter((prop) => prop.type !== GetterPropType.HEADER).map((prop) => {
|
|
407
409
|
return prop.type === GetterPropType.NAMED_PATH_PARAMS ? prop.destructured : prop.name;
|
|
408
410
|
}).join(", "), props.filter((prop) => prop.type === GetterPropType.HEADER).map((param) => param.name).join(", ")].filter(Boolean).join(", ");
|
|
409
|
-
const swrMutationFetcherType = getSwrMutationFetcherType(response, httpClient, override.fetch.includeHttpResponseReturnType,
|
|
411
|
+
const swrMutationFetcherType = getSwrMutationFetcherType(response, httpClient, override.fetch.includeHttpResponseReturnType, typeName, mutator);
|
|
410
412
|
const swrMutationFetcherOptionType = getSwrMutationFetcherOptionType(httpClient, mutator);
|
|
411
413
|
const swrMutationFetcherOptions = isRequestOptions && swrMutationFetcherOptionType ? `options${context.output.optionsParamRequired ? "" : "?"}: ${swrMutationFetcherOptionType}` : "";
|
|
412
414
|
const swrMutationFetcherFn = `
|
|
@@ -418,6 +420,7 @@ export const ${swrMutationFetcherName} = (${queryKeyProps} ${swrMutationFetcherO
|
|
|
418
420
|
`;
|
|
419
421
|
const swrMutationImplementation = generateSwrMutationImplementation({
|
|
420
422
|
operationName,
|
|
423
|
+
typeName,
|
|
421
424
|
swrKeyFnName,
|
|
422
425
|
swrMutationFetcherName,
|
|
423
426
|
swrKeyProperties,
|
|
@@ -457,6 +460,7 @@ export const ${swrMutationFetcherName} = (${swrProps} ${swrMutationFetcherOption
|
|
|
457
460
|
}\n`;
|
|
458
461
|
const swrImplementation = generateSwrMutationImplementation({
|
|
459
462
|
operationName,
|
|
463
|
+
typeName,
|
|
460
464
|
swrKeyFnName,
|
|
461
465
|
swrMutationFetcherName,
|
|
462
466
|
swrKeyProperties,
|
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\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 const innerHeader = getSwrHeader(params);\n const innerImpl =\n typeof innerHeader === 'string' ? innerHeader : innerHeader.implementation;\n const innerSharedTypes =\n typeof innerHeader === 'string' ? undefined : innerHeader.sharedTypes;\n\n const ownImplementation = `\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 ${innerImpl}\n `;\n\n if (innerSharedTypes && innerSharedTypes.length > 0) {\n return {\n implementation: ownImplementation,\n sharedTypes: innerSharedTypes,\n };\n }\n\n return ownImplementation;\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;EAC1B;EACA,EAAE,MAAM,qBAAqB;EAC7B,EAAE,MAAM,gBAAgB;EACxB,EAAE,MAAM,aAAa;CACvB;CACA,YAAY;AACd,CACF;AAEA,MAAa,8BACX,aACA,YACG;CACH,OAAO,QAAQ,QAAQ,OAAO,eAAe,iBAAiB,QAC1D,6BAA6B,aAAa,OAAO,IACjDA,wBAA6B,aAAa,OAAO;AACvD;AAEA,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;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aAAa,MAAM;CACvC,MAAM,YACJ,OAAO,gBAAgB,WAAW,cAAc,YAAY;CAC9D,MAAM,mBACJ,OAAO,gBAAgB,WAAW,KAAA,IAAY,YAAY;CAE5D,MAAM,oBAAoB;IAExB,OAAO,iBACH,KACA;0EAEL;IAEC,OAAO,oBAAoB,OAAO,YAC9B,wFACA,GACL;IACC,UAAU;;CAGZ,IAAI,oBAAoB,iBAAiB,SAAS,GAChD,OAAO;EACL,gBAAgB;EAChB,aAAa;CACf;CAGF,OAAO;AACT;AAEA,MAAa,eAA8B,aAAa,YAAY;CAClE,MAAM,UAAU,oBAAoB,WAAW;CAC/C,MAAM,yBAAyB,2BAC7B,aACA,OACF;CACA,MAAM,qBAAqB,gBAAgB,aAAa,OAAO;CAE/D,MAAM,oBACJ,QAAQ,QAAQ,OAAO,eAAe,iBAAiB;CAEzD,OAAO;EACL,gBAAgB,GAAG,uBAAuB,MAAM;EAChD;EACA,GAAI,qBAAqB,EAAE,YAAY,GAAG;CAC5C;AACF;AAEA,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,cAAc;AAChB;AAEA,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 typeName: string,\n mutator?: GeneratorMutator,\n) => {\n if (httpClient === OutputHttpClient.FETCH) {\n const responseType = fetchResponseTypeName(\n includeHttpResponseReturnType,\n response.definition.success,\n typeName,\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 typeName,\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 typeName: 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(typeName)}InfiniteError = ${errorType}\\n`\n : '';\n\n const useSWRInfiniteImplementation = swrOptions.useInfinite\n ? `\nexport type ${pascal(\n typeName,\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(typeName)}QueryError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n typeName,\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 typeName,\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 typeName: 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(typeName)}SuspenseQueryError = ${errorType}\\n`\n : '';\n\n const useSwrSuspenseImplementation = `\nexport type ${pascal(\n typeName,\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 typeName,\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 typeName: 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(typeName)}MutationError = ${errorType}\\n`\n : '';\n\n const useSwrImplementation = `\nexport type ${pascal(\n typeName,\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 typeName,\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 typeName,\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 typeName,\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 typeName,\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 typeName,\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 typeName,\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 const innerHeader = getSwrHeader(params);\n const innerImpl =\n typeof innerHeader === 'string' ? innerHeader : innerHeader.implementation;\n const innerSharedTypes =\n typeof innerHeader === 'string' ? undefined : innerHeader.sharedTypes;\n\n const ownImplementation = `\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 ${innerImpl}\n `;\n\n if (innerSharedTypes && innerSharedTypes.length > 0) {\n return {\n implementation: ownImplementation,\n sharedTypes: innerSharedTypes,\n };\n }\n\n return ownImplementation;\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;EAC1B;EACA,EAAE,MAAM,qBAAqB;EAC7B,EAAE,MAAM,gBAAgB;EACxB,EAAE,MAAM,aAAa;CACvB;CACA,YAAY;AACd,CACF;AAEA,MAAa,8BACX,aACA,YACG;CACH,OAAO,QAAQ,QAAQ,OAAO,eAAe,iBAAiB,QAC1D,6BAA6B,aAAa,OAAO,IACjDA,wBAA6B,aAAa,OAAO;AACvD;AAEA,MAAM,gCACJ,EACE,SACA,aACA,eACA,UACA,SACA,MACA,OACA,MACA,UACA,gBACA,UACA,oBAEF,EAAE,OAAO,cACN;CACH,MAAM,mBAAmB,SAAS,mB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;GACA,YAAY,QAAQ,OAAO;EAC7B,CAAC;EAED,OAAO,uBAAuB,mBAAmB;CACnD;AACF;AAEA,MAAa,qBAA0C,WAAW;CAChE,MAAM,cAAc,aAAa,MAAM;CACvC,MAAM,YACJ,OAAO,gBAAgB,WAAW,cAAc,YAAY;CAC9D,MAAM,mBACJ,OAAO,gBAAgB,WAAW,KAAA,IAAY,YAAY;CAE5D,MAAM,oBAAoB;IAExB,OAAO,iBACH,KACA;0EAEL;IAEC,OAAO,oBAAoB,OAAO,YAC9B,wFACA,GACL;IACC,UAAU;;CAGZ,IAAI,oBAAoB,iBAAiB,SAAS,GAChD,OAAO;EACL,gBAAgB;EAChB,aAAa;CACf;CAGF,OAAO;AACT;AAEA,MAAa,eAA8B,aAAa,YAAY;CAClE,MAAM,UAAU,oBAAoB,WAAW;CAC/C,MAAM,yBAAyB,2BAC7B,aACA,OACF;CACA,MAAM,qBAAqB,gBAAgB,aAAa,OAAO;CAE/D,MAAM,oBACJ,QAAQ,QAAQ,OAAO,eAAe,iBAAiB;CAEzD,OAAO;EACL,gBAAgB,GAAG,uBAAuB,MAAM;EAChD;EACA,GAAI,qBAAqB,EAAE,YAAY,GAAG;CAC5C;AACF;AAEA,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,cAAc;AAChB;AAEA,MAAa,sBAAsB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/swr",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"homepage": "https://orval.dev/docs/guides/swr",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/orval-labs/orval/issues"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"./package.json": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@orval/core": "8.
|
|
27
|
-
"@orval/fetch": "8.
|
|
26
|
+
"@orval/core": "8.21.0",
|
|
27
|
+
"@orval/fetch": "8.21.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"rimraf": "6.1.2",
|