@kubb/plugin-react-query 4.14.0 → 4.15.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.
Files changed (49) hide show
  1. package/dist/{components-CO636qn3.cjs → components-7ul5AP_u.cjs} +17 -12
  2. package/dist/components-7ul5AP_u.cjs.map +1 -0
  3. package/dist/{components-DQHnoHX_.js → components-CX83mklO.js} +16 -11
  4. package/dist/components-CX83mklO.js.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +15 -5
  7. package/dist/components.d.ts +15 -5
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-BNtUetHy.cjs → generators-CNv1RI1y.cjs} +331 -6
  10. package/dist/generators-CNv1RI1y.cjs.map +1 -0
  11. package/dist/{generators-Cz0OG9Qu.js → generators-CVc1Qlnh.js} +320 -8
  12. package/dist/generators-CVc1Qlnh.js.map +1 -0
  13. package/dist/generators.cjs +3 -1
  14. package/dist/generators.d.cts +8 -2
  15. package/dist/generators.d.ts +8 -2
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +10 -4
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +10 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-gh3CWciu.d.ts → types-B9xv5S0R.d.cts} +36 -2
  24. package/dist/{types-CYNrdDrD.d.cts → types-BAEc42Ae.d.ts} +36 -2
  25. package/package.json +7 -7
  26. package/src/components/InfiniteQuery.tsx +4 -1
  27. package/src/components/Mutation.tsx +4 -1
  28. package/src/components/Query.tsx +4 -1
  29. package/src/components/SuspenseInfiniteQuery.tsx +4 -1
  30. package/src/components/SuspenseQuery.tsx +4 -1
  31. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +89 -0
  32. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +103 -0
  33. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +83 -0
  34. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +103 -0
  35. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +105 -0
  36. package/src/generators/customHookOptionsFileGenerator.tsx +98 -0
  37. package/src/generators/hookOptionsGenerator.tsx +196 -0
  38. package/src/generators/index.ts +2 -0
  39. package/src/generators/infiniteQueryGenerator.tsx +2 -0
  40. package/src/generators/mutationGenerator.tsx +2 -0
  41. package/src/generators/queryGenerator.tsx +2 -0
  42. package/src/generators/suspenseInfiniteQueryGenerator.tsx +2 -0
  43. package/src/generators/suspenseQueryGenerator.tsx +2 -0
  44. package/src/plugin.ts +20 -2
  45. package/src/types.ts +21 -0
  46. package/dist/components-CO636qn3.cjs.map +0 -1
  47. package/dist/components-DQHnoHX_.js.map +0 -1
  48. package/dist/generators-BNtUetHy.cjs.map +0 -1
  49. package/dist/generators-Cz0OG9Qu.js.map +0 -1
@@ -0,0 +1,196 @@
1
+ import { usePluginManager } from '@kubb/core/hooks'
2
+ import type { Operation } from '@kubb/oas'
3
+ import { createReactGenerator } from '@kubb/plugin-oas/generators'
4
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
5
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
6
+ import { File, Type } from '@kubb/react-fabric'
7
+ import { difference } from 'remeda'
8
+ import type { PluginReactQuery } from '../types'
9
+
10
+ export const hookOptionsGenerator = createReactGenerator<PluginReactQuery>({
11
+ name: 'react-query-hook-options',
12
+ Operations({ operations, plugin, generator }) {
13
+ const {
14
+ options,
15
+ options: { output },
16
+ key: pluginKey,
17
+ } = plugin
18
+ const pluginManager = usePluginManager()
19
+
20
+ const oas = useOas()
21
+ const { getName, getFile } = useOperationManager(generator)
22
+
23
+ if (!options.customOptions) {
24
+ return null
25
+ }
26
+
27
+ const name = 'HookOptions'
28
+ const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })
29
+
30
+ const getOperationOptions = (operation: Operation) => {
31
+ const operationOptions = generator.getOptions(operation, operation.method)
32
+ return { ...options, ...operationOptions }
33
+ }
34
+
35
+ const isQuery = (operation: Operation) => {
36
+ const operationOptions = getOperationOptions(operation)
37
+ return typeof operationOptions.query === 'boolean' ? true : operationOptions.query?.methods.some((method) => operation.method === method)
38
+ }
39
+
40
+ const isMutation = (operation: Operation) => {
41
+ const operationOptions = getOperationOptions(operation)
42
+ return (
43
+ operationOptions.mutation !== false &&
44
+ !isQuery(operation) &&
45
+ difference(operationOptions.mutation ? operationOptions.mutation.methods : [], operationOptions.query ? operationOptions.query.methods : []).some(
46
+ (method) => operation.method === method,
47
+ )
48
+ )
49
+ }
50
+
51
+ const isSuspense = (operation: Operation) => {
52
+ const operationOptions = getOperationOptions(operation)
53
+ return !!operationOptions.suspense
54
+ }
55
+
56
+ const isInfinite = (operation: Operation) => {
57
+ const operationOptions = getOperationOptions(operation)
58
+ const infiniteOptions = operationOptions.infinite && typeof operationOptions.infinite === 'object' ? operationOptions.infinite : undefined
59
+ return !!infiniteOptions
60
+ }
61
+
62
+ // Query/mutation hooks
63
+ const getHookName = (operation: Operation) => {
64
+ return getName(operation, { type: 'function', prefix: 'use' })
65
+ }
66
+
67
+ const getHookFile = (operation: Operation) => {
68
+ return getFile(operation, { prefix: 'use' })
69
+ }
70
+
71
+ // Query hooks
72
+ const getQueryHookOptions = (operation: Operation) => {
73
+ return getName(operation, { type: 'function', suffix: 'QueryOptions' })
74
+ }
75
+
76
+ const getQueryHookOptionsImport = (operation: Operation) => {
77
+ return <File.Import name={[getQueryHookOptions(operation)]} root={file.path} path={getHookFile(operation).path} />
78
+ }
79
+
80
+ // Mutation hooks
81
+ const getMutationHookOptions = (operation: Operation) => {
82
+ return getName(operation, { type: 'function', suffix: 'MutationOptions' })
83
+ }
84
+
85
+ const getMutationHookOptionsImport = (operation: Operation) => {
86
+ return <File.Import name={[getMutationHookOptions(operation)]} root={file.path} path={getHookFile(operation).path} />
87
+ }
88
+
89
+ // Suspense hooks
90
+ const getSuspenseHookName = (operation: Operation) => {
91
+ return getName(operation, { type: 'function', prefix: 'use', suffix: 'suspense' })
92
+ }
93
+
94
+ const getSuspenseHookFile = (operation: Operation) => {
95
+ return getFile(operation, { prefix: 'use', suffix: 'suspense' })
96
+ }
97
+
98
+ const getSuspenseHookOptions = (operation: Operation) => {
99
+ return getName(operation, { type: 'function', suffix: 'SuspenseQueryOptions' })
100
+ }
101
+
102
+ const getSuspenseHookOptionsImport = (operation: Operation) => {
103
+ return <File.Import name={[getSuspenseHookOptions(operation)]} root={file.path} path={getSuspenseHookFile(operation).path} />
104
+ }
105
+
106
+ // Infinite hooks
107
+ const getInfiniteHookName = (operation: Operation) => {
108
+ return getName(operation, { type: 'function', prefix: 'use', suffix: 'infinite' })
109
+ }
110
+
111
+ const getInfiniteHookFile = (operation: Operation) => {
112
+ return getFile(operation, { prefix: 'use', suffix: 'infinite' })
113
+ }
114
+
115
+ const getInfiniteHookOptions = (operation: Operation) => {
116
+ return getName(operation, { type: 'function', suffix: 'InfiniteQueryOptions' })
117
+ }
118
+
119
+ const getInfiniteHookOptionsImport = (operation: Operation) => {
120
+ return <File.Import name={[getInfiniteHookOptions(operation)]} root={file.path} path={getInfiniteHookFile(operation).path} />
121
+ }
122
+
123
+ // Suspense infinite hooks
124
+ const getSuspenseInfiniteHookName = (operation: Operation) => {
125
+ return getName(operation, { type: 'function', prefix: 'use', suffix: 'suspenseInfinite' })
126
+ }
127
+
128
+ const getSuspenseInfiniteHookFile = (operation: Operation) => {
129
+ return getFile(operation, { prefix: 'use', suffix: 'suspenseInfinite' })
130
+ }
131
+
132
+ const getSuspenseInfiniteHookOptions = (operation: Operation) => {
133
+ return getName(operation, { type: 'function', suffix: 'SuspenseInfiniteQueryOptions' })
134
+ }
135
+
136
+ const getSuspenseInfiniteHookOptionsImport = (operation: Operation) => {
137
+ return <File.Import name={[getSuspenseInfiniteHookOptions(operation)]} root={file.path} path={getSuspenseInfiniteHookFile(operation).path} />
138
+ }
139
+
140
+ const imports = operations
141
+ .flatMap((operation) => {
142
+ if (isQuery(operation)) {
143
+ return [
144
+ getQueryHookOptionsImport(operation),
145
+ isSuspense(operation) ? getSuspenseHookOptionsImport(operation) : undefined,
146
+ isInfinite(operation) ? getInfiniteHookOptionsImport(operation) : undefined,
147
+ isSuspense(operation) && isInfinite(operation) ? getSuspenseInfiniteHookOptionsImport(operation) : undefined,
148
+ ].filter(Boolean)
149
+ }
150
+ if (isMutation(operation)) {
151
+ return [getMutationHookOptionsImport(operation)]
152
+ }
153
+ return []
154
+ })
155
+ .filter(Boolean)
156
+
157
+ const hookOptions = operations.reduce(
158
+ (acc, operation) => {
159
+ if (isQuery(operation)) {
160
+ acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getQueryHookOptions(operation)}>>`
161
+ if (isSuspense(operation)) {
162
+ acc[getSuspenseHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseHookOptions(operation)}>>`
163
+ }
164
+ if (isInfinite(operation)) {
165
+ acc[getInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getInfiniteHookOptions(operation)}>>`
166
+ }
167
+ if (isSuspense(operation) && isInfinite(operation)) {
168
+ acc[getSuspenseInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseInfiniteHookOptions(operation)}>>`
169
+ }
170
+ }
171
+ if (isMutation(operation)) {
172
+ acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getMutationHookOptions(operation)}>>`
173
+ }
174
+ return acc
175
+ },
176
+ {} as Record<string, string>,
177
+ )
178
+
179
+ return (
180
+ <File
181
+ baseName={file.baseName}
182
+ path={file.path}
183
+ meta={file.meta}
184
+ banner={getBanner({ oas, output, config: pluginManager.config })}
185
+ footer={getFooter({ oas, output })}
186
+ >
187
+ {imports}
188
+ <File.Source name={name} isExportable isIndexable isTypeOnly>
189
+ <Type export name={name}>
190
+ {`{ ${Object.keys(hookOptions).map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)} }`}
191
+ </Type>
192
+ </File.Source>
193
+ </File>
194
+ )
195
+ },
196
+ })
@@ -1,3 +1,5 @@
1
+ export { customHookOptionsFileGenerator } from './customHookOptionsFileGenerator.tsx'
2
+ export { hookOptionsGenerator } from './hookOptionsGenerator.tsx'
1
3
  export { infiniteQueryGenerator } from './infiniteQueryGenerator.tsx'
2
4
  export { mutationGenerator } from './mutationGenerator.tsx'
3
5
  export { queryGenerator } from './queryGenerator.tsx'
@@ -163,6 +163,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
163
163
  parser={options.parser}
164
164
  />
165
165
  )}
166
+ {options.customOptions && <File.Import name={[options.customOptions.name]} path={options.customOptions.importPath} />}
166
167
  {infiniteOptions && (
167
168
  <>
168
169
  <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />
@@ -201,6 +202,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
201
202
  queryKeyTypeName={queryKey.typeName}
202
203
  initialPageParam={infiniteOptions.initialPageParam}
203
204
  queryParam={infiniteOptions.queryParam}
205
+ customOptions={options.customOptions}
204
206
  />
205
207
  </>
206
208
  )}
@@ -118,6 +118,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
118
118
  {!shouldUseClientPlugin && (
119
119
  <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
120
120
  )}
121
+ {options.customOptions && <File.Import name={[options.customOptions.name]} path={options.customOptions.importPath} />}
121
122
  <File.Import
122
123
  name={[
123
124
  type.schemas.request?.name,
@@ -182,6 +183,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
182
183
  paramsCasing={options.paramsCasing}
183
184
  pathParamsType={options.pathParamsType}
184
185
  mutationKeyName={mutationKey.name}
186
+ customOptions={options.customOptions}
185
187
  />
186
188
  </>
187
189
  )}
@@ -119,6 +119,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
119
119
  {!shouldUseClientPlugin && (
120
120
  <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
121
121
  )}
122
+ {options.customOptions && <File.Import name={[options.customOptions.name]} path={options.customOptions.importPath} />}
122
123
  <File.Import
123
124
  name={[
124
125
  type.schemas.request?.name,
@@ -181,6 +182,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
181
182
  dataReturnType={options.client.dataReturnType || 'data'}
182
183
  queryKeyName={queryKey.name}
183
184
  queryKeyTypeName={queryKey.typeName}
185
+ customOptions={options.customOptions}
184
186
  />
185
187
  </>
186
188
  )}
@@ -115,6 +115,7 @@ export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQu
115
115
  {!shouldUseClientPlugin && (
116
116
  <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
117
117
  )}
118
+ {options.customOptions && <File.Import name={[options.customOptions.name]} path={options.customOptions.importPath} />}
118
119
  <File.Import
119
120
  name={[
120
121
  type.schemas.request?.name,
@@ -187,6 +188,7 @@ export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQu
187
188
  dataReturnType={options.client.dataReturnType || 'data'}
188
189
  queryKeyName={queryKey.name}
189
190
  queryKeyTypeName={queryKey.typeName}
191
+ customOptions={options.customOptions}
190
192
  initialPageParam={infiniteOptions.initialPageParam}
191
193
  queryParam={infiniteOptions.queryParam}
192
194
  />
@@ -130,6 +130,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
130
130
  {!shouldUseClientPlugin && (
131
131
  <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
132
132
  )}
133
+ {options.customOptions && <File.Import name={[options.customOptions.name]} path={options.customOptions.importPath} />}
133
134
  <File.Import
134
135
  name={[
135
136
  type.schemas.request?.name,
@@ -194,6 +195,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
194
195
  dataReturnType={options.client.dataReturnType || 'data'}
195
196
  queryKeyName={queryKey.name}
196
197
  queryKeyTypeName={queryKey.typeName}
198
+ customOptions={options.customOptions}
197
199
  />
198
200
  </>
199
201
  )}
package/src/plugin.ts CHANGED
@@ -8,7 +8,15 @@ import { pluginTsName } from '@kubb/plugin-ts'
8
8
  import { pluginZodName } from '@kubb/plugin-zod'
9
9
  import { MutationKey } from './components'
10
10
  import { QueryKey } from './components/QueryKey.tsx'
11
- import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator } from './generators'
11
+ import {
12
+ customHookOptionsFileGenerator,
13
+ hookOptionsGenerator,
14
+ infiniteQueryGenerator,
15
+ mutationGenerator,
16
+ queryGenerator,
17
+ suspenseInfiniteQueryGenerator,
18
+ suspenseQueryGenerator,
19
+ } from './generators'
12
20
  import type { PluginReactQuery } from './types.ts'
13
21
 
14
22
  export const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']
@@ -26,11 +34,20 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
26
34
  transformers = {},
27
35
  paramsType = 'inline',
28
36
  pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',
29
- generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, suspenseInfiniteQueryGenerator, mutationGenerator].filter(Boolean),
37
+ generators = [
38
+ queryGenerator,
39
+ suspenseQueryGenerator,
40
+ infiniteQueryGenerator,
41
+ suspenseInfiniteQueryGenerator,
42
+ mutationGenerator,
43
+ hookOptionsGenerator,
44
+ customHookOptionsFileGenerator,
45
+ ].filter(Boolean),
30
46
  mutation = {},
31
47
  query = {},
32
48
  mutationKey = MutationKey.getTransformer,
33
49
  queryKey = QueryKey.getTransformer,
50
+ customOptions,
34
51
  paramsCasing,
35
52
  contentType,
36
53
  client,
@@ -80,6 +97,7 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
80
97
  importPath: '@tanstack/react-query',
81
98
  ...mutation,
82
99
  },
100
+ customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,
83
101
  paramsType,
84
102
  pathParamsType,
85
103
  parser,
package/src/types.ts CHANGED
@@ -85,6 +85,21 @@ export type Infinite = {
85
85
  initialPageParam: unknown
86
86
  }
87
87
 
88
+ type CustomOptions = {
89
+ /**
90
+ * Path to the hook that will be used to customize the hook options.
91
+ * It will be used as `import ${customOptions.name} from '${customOptions.importPath}'`.
92
+ * It allows both relative and absolute paths but be aware that we will not change the path.
93
+ */
94
+ importPath: string
95
+ /**
96
+ * Name of the exported hook that will be used to customize the hook options.
97
+ * It will be used as `import ${customOptions.name} from '${customOptions.importPath}'`.
98
+ * @default 'useCustomHookOptions'
99
+ */
100
+ name?: string
101
+ }
102
+
88
103
  export type Options = {
89
104
  /**
90
105
  * Specify the export location for the files and define the behavior of the output
@@ -151,6 +166,11 @@ export type Options = {
151
166
  * Override some useMutation behaviours.
152
167
  */
153
168
  mutation?: Partial<Mutation> | false
169
+ /**
170
+ * When set, a custom hook will be used to customize the options of the generated hooks.
171
+ * It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
172
+ */
173
+ customOptions?: CustomOptions
154
174
  /**
155
175
  * Which parser should be used before returning the data to `@tanstack/query`.
156
176
  * `'zod'` will use `@kubb/plugin-zod` to parse the data.
@@ -185,6 +205,7 @@ type ResolvedOptions = {
185
205
  query: NonNullable<Required<Query>> | false
186
206
  mutationKey: MutationKey | undefined
187
207
  mutation: NonNullable<Required<Mutation>> | false
208
+ customOptions: NonNullable<Required<CustomOptions>> | undefined
188
209
  }
189
210
 
190
211
  export type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>
@@ -1 +0,0 @@
1
- {"version":3,"file":"components-CO636qn3.cjs","names":["getParams","FunctionParams","getTransformer: Transformer","URLPath","getTransformer","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","Client","getNextPageParamExpr: string | undefined","getPreviousPageParamExpr: string | undefined","File","Function","getParams","FunctionParams","getTransformer: Transformer","URLPath","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","Client","getNextPageParamExpr: string | undefined","getPreviousPageParamExpr: string | undefined","File","Function","FunctionParams","File","Function"],"sources":["../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/InfiniteQuery.tsx","../src/components/InfiniteQueryOptions.tsx","../src/components/MutationKey.tsx","../src/components/MutationOptions.tsx","../src/components/Mutation.tsx","../src/components/Query.tsx","../src/components/SuspenseInfiniteQuery.tsx","../src/components/SuspenseInfiniteQueryOptions.tsx","../src/components/SuspenseQuery.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n })\n}\n\nconst getTransformer: Transformer = ({ operation, schemas, casing }) => {\n const path = new URLPath(operation.path, { casing })\n const keys = [\n path.toObject({\n type: 'path',\n stringify: true,\n }),\n schemas.queryParams?.name ? '...(params ? [params] : [])' : undefined,\n schemas.request?.name ? '...(data ? [data] : [])' : undefined,\n ].filter(Boolean)\n\n return keys\n}\n\nexport function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas, paramsCasing })\n const keys = transformer({\n operation,\n schemas: typeSchemas,\n casing: paramsCasing,\n })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nQueryKey.getParams = getParams\nQueryKey.getTransformer = getTransformer\n","import { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): KubbNode {\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'\n\n const clientParams = Client.getParams({\n typeSchemas,\n paramsCasing,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return queryOptions<${TData}, ResponseErrorConfig<${TError}>, ${TData}, typeof queryKey>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall({})})\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nQueryOptions.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n pageParamGeneric: string\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function InfiniteQuery({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n initialPageParam,\n queryParam,\n}: Props): KubbNode {\n const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n const returnType = 'UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }'\n const generics = [\n `TQueryFnData = ${responseType}`,\n `TError = ${errorType}`,\n 'TData = InfiniteData<TQueryFnData>',\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n `TPageParam = ${pageParamType}`,\n ]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n pageParamGeneric: 'TPageParam',\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useInfiniteQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nInfiniteQuery.getParams = getParams\n","import { getNestedAccessor } from '@kubb/core/utils'\nimport { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n cursorParam: Infinite['cursorParam']\n nextParam: Infinite['nextParam']\n previousParam: Infinite['previousParam']\n queryParam: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function InfiniteQueryOptions({\n name,\n clientName,\n initialPageParam,\n cursorParam,\n nextParam,\n previousParam,\n typeSchemas,\n paramsCasing,\n paramsType,\n dataReturnType,\n pathParamsType,\n queryParam,\n queryKeyName,\n}: Props): KubbNode {\n const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n\n const params = getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const clientParams = Client.getParams({\n paramsCasing,\n typeSchemas,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n\n // Determine if we should use the new nextParam/previousParam or fall back to legacy cursorParam behavior\n const hasNewParams = nextParam !== undefined || previousParam !== undefined\n\n let getNextPageParamExpr: string | undefined\n let getPreviousPageParamExpr: string | undefined\n\n if (hasNewParams) {\n // Use the new nextParam and previousParam\n if (nextParam) {\n const accessor = getNestedAccessor(nextParam, 'lastPage')\n if (accessor) {\n getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`\n }\n }\n if (previousParam) {\n const accessor = getNestedAccessor(previousParam, 'firstPage')\n if (accessor) {\n getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`\n }\n }\n } else if (cursorParam) {\n // Legacy behavior: use cursorParam for both next and previous\n getNextPageParamExpr = `getNextPageParam: (lastPage) => lastPage['${cursorParam}']`\n getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`\n } else {\n // Fallback behavior: page-based pagination\n if (dataReturnType === 'full') {\n getNextPageParamExpr =\n 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'\n } else {\n getNextPageParamExpr =\n 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1'\n }\n getPreviousPageParamExpr = 'getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1'\n }\n\n const queryOptions = [\n `initialPageParam: ${typeof initialPageParam === 'string' ? JSON.stringify(initialPageParam) : initialPageParam}`,\n getNextPageParamExpr,\n getPreviousPageParamExpr,\n ].filter(Boolean)\n\n const infiniteOverrideParams =\n queryParam && typeSchemas.queryParams?.name\n ? `\n params = {\n ...(params ?? {}),\n ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],\n } as ${typeSchemas.queryParams?.name}`\n : ''\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n if (infiniteOverrideParams) {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal, pageParam }) => {\n config.signal = signal\n ${infiniteOverrideParams}\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nInfiniteQueryOptions.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({}: GetParamsProps) {\n return FunctionParams.factory({})\n}\n\nconst getTransformer: Transformer = ({ operation, casing }) => {\n const path = new URLPath(operation.path, { casing })\n\n return [`{ url: '${path.toURLPath()}' }`]\n}\n\nexport function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas })\n const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nMutationKey.getParams = getParams\nMutationKey.getTransformer = getTransformer\n","import { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode, Params } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function MutationOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, mutationKeyName }: Props): KubbNode {\n const params = getParams({ typeSchemas })\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'\n\n const clientParams = Client.getParams({\n typeSchemas,\n paramsCasing,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n\n const dataParams = FunctionParams.factory({\n data: {\n // No use of pathParams because useMutation can only take one argument in object form,\n // see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation\n mode: 'object',\n children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {\n if (value) {\n acc[key] = {\n ...value,\n type: undefined,\n }\n }\n\n return acc\n }, {} as Params),\n },\n })\n\n const TRequest = mutationParams.toConstructor()\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})\n return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : 'void'}, typeof mutationKey>({\n mutationKey,\n mutationFn: async(${dataParams.toConstructor()}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nMutationOptions.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\nimport { MutationOptions } from './MutationOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n mutationOptionsName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n operation: Operation\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n const TRequest = mutationParams.toConstructor()\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return FunctionParams.factory({\n options: {\n type: `\n{\n mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'},\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n mutationOptionsName,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n mutationKeyName,\n}: Props): KubbNode {\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n\n const mutationOptionsParams = MutationOptions.getParams({ typeSchemas })\n\n const TRequest = mutationParams.toConstructor()\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n const returnType = `UseMutationResult<${generics}>`\n\n const mutationOptions = `${mutationOptionsName}(${mutationOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n generics={['TContext']}\n >\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n const baseOptions = ${mutationOptions} as UseMutationOptions<${generics}>\n\n return useMutation<${generics}>({\n ...baseOptions,\n mutationKey,\n ...mutationOptions,\n }, queryClient) as ${returnType}\n `}\n </Function>\n </File.Source>\n )\n}\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): KubbNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const returnType = `UseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as QueryObserverOptions, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nQuery.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n pageParamGeneric: string\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function SuspenseInfiniteQuery({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n initialPageParam,\n queryParam,\n}: Props): KubbNode {\n const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n const returnType = 'UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }'\n const generics = [\n `TQueryFnData = ${responseType}`,\n `TError = ${errorType}`,\n 'TData = InfiniteData<TQueryFnData>',\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n `TPageParam = ${pageParamType}`,\n ]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n pageParamGeneric: 'TPageParam',\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useSuspenseInfiniteQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nSuspenseInfiniteQuery.getParams = getParams\n","import { getNestedAccessor } from '@kubb/core/utils'\nimport { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n cursorParam: Infinite['cursorParam']\n nextParam: Infinite['nextParam']\n previousParam: Infinite['previousParam']\n queryParam: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function SuspenseInfiniteQueryOptions({\n name,\n clientName,\n initialPageParam,\n cursorParam,\n nextParam,\n previousParam,\n typeSchemas,\n paramsCasing,\n paramsType,\n dataReturnType,\n pathParamsType,\n queryParam,\n queryKeyName,\n}: Props): KubbNode {\n const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n\n const params = getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const clientParams = Client.getParams({\n paramsCasing,\n typeSchemas,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n\n // Determine if we should use the new nextParam/previousParam or fall back to legacy cursorParam behavior\n const hasNewParams = nextParam !== undefined || previousParam !== undefined\n\n let getNextPageParamExpr: string | undefined\n let getPreviousPageParamExpr: string | undefined\n\n if (hasNewParams) {\n // Use the new nextParam and previousParam\n if (nextParam) {\n const accessor = getNestedAccessor(nextParam, 'lastPage')\n if (accessor) {\n getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`\n }\n }\n if (previousParam) {\n const accessor = getNestedAccessor(previousParam, 'firstPage')\n if (accessor) {\n getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`\n }\n }\n } else if (cursorParam) {\n // Legacy behavior: use cursorParam for both next and previous\n getNextPageParamExpr = `getNextPageParam: (lastPage) => lastPage['${cursorParam}']`\n getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`\n } else {\n // Fallback behavior: page-based pagination\n if (dataReturnType === 'full') {\n getNextPageParamExpr =\n 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'\n } else {\n getNextPageParamExpr =\n 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1'\n }\n getPreviousPageParamExpr = 'getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1'\n }\n\n const queryOptions = [\n `initialPageParam: ${typeof initialPageParam === 'string' ? JSON.stringify(initialPageParam) : initialPageParam}`,\n getNextPageParamExpr,\n getPreviousPageParamExpr,\n ].filter(Boolean)\n\n const infiniteOverrideParams =\n queryParam && typeSchemas.queryParams?.name\n ? `\n params = {\n ...(params ?? {}),\n ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],\n } as ${typeSchemas.queryParams?.name}`\n : ''\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n if (infiniteOverrideParams) {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal, pageParam }) => {\n config.signal = signal\n ${infiniteOverrideParams}\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nSuspenseInfiniteQueryOptions.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\n/**\n * Generates a strongly-typed React Query Suspense hook function for an OpenAPI operation.\n *\n * The generated function wraps `useSuspenseQuery`, providing type-safe parameters and return types based on the supplied OpenAPI schemas and configuration.\n *\n * @returns A React component source node containing the generated query function.\n */\nexport function SuspenseQuery({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): KubbNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const returnType = `UseSuspenseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [`TData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useSuspenseQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as UseSuspenseQueryOptions, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nSuspenseQuery.getParams = getParams\n"],"mappings":";;;;;;;;;AAwBA,SAASA,aAAU,EAAE,gBAAgB,cAAc,eAA+B;AAChF,QAAOC,kCAAe,QAAQ;EAC5B,YAAY;GACV,MAAM,mBAAmB,WAAW,WAAW;GAC/C,oDAAwB,YAAY,YAAY;IAAE,OAAO;IAAM,QAAQ;IAAc,CAAC;GACvF;EACD,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,oCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EACJ,QAAQ,YAAY,aAAa,OAC7B;GACE,MAAM,YAAY,aAAa;GAC/B,oCAAqB,YAAY,aAAa,OA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