@kubb/plugin-react-query 5.0.0-alpha.9 → 5.0.0-beta.10

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 (54) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +34 -85
  3. package/dist/components-Dow6tde8.js +1459 -0
  4. package/dist/components-Dow6tde8.js.map +1 -0
  5. package/dist/components-HwdCDefj.cjs +1603 -0
  6. package/dist/components-HwdCDefj.cjs.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +49 -179
  9. package/dist/components.js +1 -1
  10. package/dist/generators-CcOmnTPa.cjs +1454 -0
  11. package/dist/generators-CcOmnTPa.cjs.map +1 -0
  12. package/dist/generators-yfZr_qfT.js +1412 -0
  13. package/dist/generators-yfZr_qfT.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +9 -505
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +197 -126
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +193 -126
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-DG_OxOym.d.ts +363 -0
  23. package/extension.yaml +911 -0
  24. package/package.json +59 -64
  25. package/src/components/InfiniteQuery.tsx +79 -138
  26. package/src/components/InfiniteQueryOptions.tsx +55 -166
  27. package/src/components/Mutation.tsx +74 -111
  28. package/src/components/MutationOptions.tsx +61 -80
  29. package/src/components/Query.tsx +66 -142
  30. package/src/components/QueryOptions.tsx +56 -138
  31. package/src/components/SuspenseInfiniteQuery.tsx +79 -138
  32. package/src/components/SuspenseInfiniteQueryOptions.tsx +55 -166
  33. package/src/components/SuspenseQuery.tsx +66 -152
  34. package/src/generators/customHookOptionsFileGenerator.tsx +37 -51
  35. package/src/generators/hookOptionsGenerator.tsx +111 -174
  36. package/src/generators/infiniteQueryGenerator.tsx +158 -178
  37. package/src/generators/mutationGenerator.tsx +112 -139
  38. package/src/generators/queryGenerator.tsx +128 -142
  39. package/src/generators/suspenseInfiniteQueryGenerator.tsx +157 -156
  40. package/src/generators/suspenseQueryGenerator.tsx +126 -152
  41. package/src/index.ts +1 -1
  42. package/src/plugin.ts +134 -187
  43. package/src/resolvers/resolverReactQuery.ts +107 -0
  44. package/src/types.ts +172 -49
  45. package/src/utils.ts +10 -0
  46. package/dist/components-BHQT9ZLc.cjs +0 -1634
  47. package/dist/components-BHQT9ZLc.cjs.map +0 -1
  48. package/dist/components-CpyHYGOw.js +0 -1520
  49. package/dist/components-CpyHYGOw.js.map +0 -1
  50. package/dist/generators-DP07m3rH.cjs +0 -1469
  51. package/dist/generators-DP07m3rH.cjs.map +0 -1
  52. package/dist/generators-DkQwKTc2.js +0 -1427
  53. package/dist/generators-DkQwKTc2.js.map +0 -1
  54. package/dist/types-D5S7Ny9r.d.ts +0 -270
@@ -1,1469 +0,0 @@
1
- const require_components = require("./components-BHQT9ZLc.cjs");
2
- let node_path = require("node:path");
3
- node_path = require_components.__toESM(node_path);
4
- let node_fs = require("node:fs");
5
- node_fs = require_components.__toESM(node_fs);
6
- let _kubb_plugin_client = require("@kubb/plugin-client");
7
- let _kubb_plugin_ts = require("@kubb/plugin-ts");
8
- let _kubb_plugin_zod = require("@kubb/plugin-zod");
9
- let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
10
- let _kubb_react_fabric = require("@kubb/react-fabric");
11
- let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
12
- let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
13
- let _kubb_core_hooks = require("@kubb/core/hooks");
14
- let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
15
- let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
16
- let remeda = require("remeda");
17
- //#region src/generators/customHookOptionsFileGenerator.tsx
18
- const customHookOptionsFileGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
19
- name: "react-query-custom-hook-options-file",
20
- Operations({ operations, generator, plugin, config }) {
21
- const { options, options: { output }, name: pluginName } = plugin;
22
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
23
- const { getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
24
- if (!options.customOptions) return null;
25
- const override = output.override ?? config.output.override ?? false;
26
- const { importPath, name } = options.customOptions;
27
- const root = node_path.default.resolve(config.root, config.output.path);
28
- const reactQueryImportPath = options.query ? options.query.importPath : "@tanstack/react-query";
29
- const getHookFilePath = (operations) => {
30
- const firstOperation = operations[0];
31
- if (firstOperation != null) return getFile(firstOperation, { prefix: "use" }).path;
32
- return driver.getFile({
33
- name: "index",
34
- extname: ".ts",
35
- pluginName
36
- }).path;
37
- };
38
- const ensureExtension = (filePath, extname) => {
39
- if (node_path.default.extname(filePath) === "") return filePath + extname;
40
- return filePath;
41
- };
42
- const getExternalFile = (filePath, rootPath) => {
43
- const actualFilePath = ensureExtension(filePath, ".ts");
44
- return {
45
- baseName: node_path.default.basename(actualFilePath),
46
- name: node_path.default.basename(actualFilePath, node_path.default.extname(actualFilePath)),
47
- path: node_path.default.resolve(rootPath, actualFilePath)
48
- };
49
- };
50
- const file = getExternalFile(importPath, node_path.default.dirname(getHookFilePath(operations)));
51
- if (node_fs.default.existsSync(file.path) && !override) return null;
52
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
53
- baseName: file.baseName,
54
- path: file.path,
55
- children: [
56
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
57
- name: ["QueryClient"],
58
- path: reactQueryImportPath,
59
- isTypeOnly: true
60
- }),
61
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
62
- name: ["useQueryClient"],
63
- path: reactQueryImportPath
64
- }),
65
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
66
- name: ["HookOptions"],
67
- root: file.path,
68
- path: node_path.default.resolve(root, "./index.ts")
69
- }),
70
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File.Source, {
71
- name: file.name,
72
- isExportable: true,
73
- isIndexable: true,
74
- children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
75
- name: "getCustomHookOptions",
76
- params: "{ queryClient }: { queryClient: QueryClient }",
77
- returnType: "Partial<HookOptions>",
78
- children: `return {
79
- // TODO: Define custom hook options here
80
- // Example:
81
- // useUpdatePetHook: {
82
- // onSuccess: () => {
83
- // void queryClient.invalidateQueries({ queryKey: ['pet'] })
84
- // }
85
- // }
86
- }`
87
- }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
88
- name,
89
- generics: "T extends keyof HookOptions",
90
- params: "{ hookName, operationId }: { hookName: T, operationId: string }",
91
- returnType: "HookOptions[T]",
92
- export: true,
93
- children: `const queryClient = useQueryClient()
94
- const customOptions = getCustomHookOptions({ queryClient })
95
- return customOptions[hookName] ?? {}`
96
- })]
97
- })
98
- ]
99
- });
100
- }
101
- });
102
- //#endregion
103
- //#region src/generators/hookOptionsGenerator.tsx
104
- const hookOptionsGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
105
- name: "react-query-hook-options",
106
- Operations({ operations, plugin, generator }) {
107
- const { options, options: { output }, name: pluginName } = plugin;
108
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
109
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
110
- const { getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
111
- if (!options.customOptions) return null;
112
- const name = "HookOptions";
113
- const file = driver.getFile({
114
- name,
115
- extname: ".ts",
116
- pluginName
117
- });
118
- const getOperationOptions = (operation) => {
119
- const operationOptions = generator.getOptions(operation, operation.method);
120
- return {
121
- ...options,
122
- ...operationOptions
123
- };
124
- };
125
- const isQuery = (operation) => {
126
- const operationOptions = getOperationOptions(operation);
127
- return typeof operationOptions.query === "boolean" ? true : operationOptions.query?.methods.some((method) => operation.method === method);
128
- };
129
- const isMutation = (operation) => {
130
- const operationOptions = getOperationOptions(operation);
131
- return operationOptions.mutation !== false && !isQuery(operation) && (0, remeda.difference)(operationOptions.mutation ? operationOptions.mutation.methods : [], operationOptions.query ? operationOptions.query.methods : []).some((method) => operation.method === method);
132
- };
133
- const isSuspense = (operation) => {
134
- return !!getOperationOptions(operation).suspense;
135
- };
136
- const isInfinite = (operation) => {
137
- const operationOptions = getOperationOptions(operation);
138
- return !!(operationOptions.infinite && typeof operationOptions.infinite === "object" ? operationOptions.infinite : void 0);
139
- };
140
- const getHookName = (operation) => {
141
- return getName(operation, {
142
- type: "function",
143
- prefix: "use"
144
- });
145
- };
146
- const getHookFile = (operation) => {
147
- return getFile(operation, { prefix: "use" });
148
- };
149
- const getQueryHookOptions = (operation) => {
150
- return getName(operation, {
151
- type: "function",
152
- suffix: "QueryOptions"
153
- });
154
- };
155
- const getQueryHookOptionsImport = (operation) => {
156
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
157
- name: [getQueryHookOptions(operation)],
158
- root: file.path,
159
- path: getHookFile(operation).path
160
- });
161
- };
162
- const getMutationHookOptions = (operation) => {
163
- return getName(operation, {
164
- type: "function",
165
- suffix: "MutationOptions"
166
- });
167
- };
168
- const getMutationHookOptionsImport = (operation) => {
169
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
170
- name: [getMutationHookOptions(operation)],
171
- root: file.path,
172
- path: getHookFile(operation).path
173
- });
174
- };
175
- const getSuspenseHookName = (operation) => {
176
- return getName(operation, {
177
- type: "function",
178
- prefix: "use",
179
- suffix: "suspense"
180
- });
181
- };
182
- const getSuspenseHookFile = (operation) => {
183
- return getFile(operation, {
184
- prefix: "use",
185
- suffix: "suspense"
186
- });
187
- };
188
- const getSuspenseHookOptions = (operation) => {
189
- return getName(operation, {
190
- type: "function",
191
- suffix: "SuspenseQueryOptions"
192
- });
193
- };
194
- const getSuspenseHookOptionsImport = (operation) => {
195
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
196
- name: [getSuspenseHookOptions(operation)],
197
- root: file.path,
198
- path: getSuspenseHookFile(operation).path
199
- });
200
- };
201
- const getInfiniteHookName = (operation) => {
202
- return getName(operation, {
203
- type: "function",
204
- prefix: "use",
205
- suffix: "infinite"
206
- });
207
- };
208
- const getInfiniteHookFile = (operation) => {
209
- return getFile(operation, {
210
- prefix: "use",
211
- suffix: "infinite"
212
- });
213
- };
214
- const getInfiniteHookOptions = (operation) => {
215
- return getName(operation, {
216
- type: "function",
217
- suffix: "InfiniteQueryOptions"
218
- });
219
- };
220
- const getInfiniteHookOptionsImport = (operation) => {
221
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
222
- name: [getInfiniteHookOptions(operation)],
223
- root: file.path,
224
- path: getInfiniteHookFile(operation).path
225
- });
226
- };
227
- const getSuspenseInfiniteHookName = (operation) => {
228
- return getName(operation, {
229
- type: "function",
230
- prefix: "use",
231
- suffix: "suspenseInfinite"
232
- });
233
- };
234
- const getSuspenseInfiniteHookFile = (operation) => {
235
- return getFile(operation, {
236
- prefix: "use",
237
- suffix: "suspenseInfinite"
238
- });
239
- };
240
- const getSuspenseInfiniteHookOptions = (operation) => {
241
- return getName(operation, {
242
- type: "function",
243
- suffix: "SuspenseInfiniteQueryOptions"
244
- });
245
- };
246
- const getSuspenseInfiniteHookOptionsImport = (operation) => {
247
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
248
- name: [getSuspenseInfiniteHookOptions(operation)],
249
- root: file.path,
250
- path: getSuspenseInfiniteHookFile(operation).path
251
- });
252
- };
253
- const imports = operations.flatMap((operation) => {
254
- if (isQuery(operation)) return [
255
- getQueryHookOptionsImport(operation),
256
- isSuspense(operation) ? getSuspenseHookOptionsImport(operation) : void 0,
257
- isInfinite(operation) ? getInfiniteHookOptionsImport(operation) : void 0,
258
- isSuspense(operation) && isInfinite(operation) ? getSuspenseInfiniteHookOptionsImport(operation) : void 0
259
- ].filter(Boolean);
260
- if (isMutation(operation)) return [getMutationHookOptionsImport(operation)];
261
- return [];
262
- }).filter(Boolean);
263
- const hookOptions = operations.reduce((acc, operation) => {
264
- if (isQuery(operation)) {
265
- acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getQueryHookOptions(operation)}>>`;
266
- if (isSuspense(operation)) acc[getSuspenseHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseHookOptions(operation)}>>`;
267
- if (isInfinite(operation)) acc[getInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getInfiniteHookOptions(operation)}>>`;
268
- if (isSuspense(operation) && isInfinite(operation)) acc[getSuspenseInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseInfiniteHookOptions(operation)}>>`;
269
- }
270
- if (isMutation(operation)) acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getMutationHookOptions(operation)}>>`;
271
- return acc;
272
- }, {});
273
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
274
- baseName: file.baseName,
275
- path: file.path,
276
- meta: file.meta,
277
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
278
- oas,
279
- output,
280
- config: driver.config
281
- }),
282
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
283
- oas,
284
- output
285
- }),
286
- children: [imports, /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
287
- name,
288
- isExportable: true,
289
- isIndexable: true,
290
- isTypeOnly: true,
291
- children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
292
- export: true,
293
- name,
294
- children: `{ ${Object.keys(hookOptions).map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)} }`
295
- })
296
- })]
297
- });
298
- }
299
- });
300
- //#endregion
301
- //#region src/generators/infiniteQueryGenerator.tsx
302
- const infiniteQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
303
- name: "react-infinite-query",
304
- Operation({ config, operation, generator, plugin }) {
305
- const { options, options: { output } } = plugin;
306
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
307
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
308
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
309
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
310
- const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
311
- const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
312
- const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
313
- const query = {
314
- name: getName(operation, {
315
- type: "function",
316
- prefix: "use",
317
- suffix: "infinite"
318
- }),
319
- typeName: getName(operation, { type: "type" }),
320
- file: getFile(operation, {
321
- prefix: "use",
322
- suffix: "infinite"
323
- })
324
- };
325
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
326
- const client = {
327
- name: shouldUseClientPlugin ? getName(operation, {
328
- type: "function",
329
- pluginName: _kubb_plugin_client.pluginClientName
330
- }) : getName(operation, {
331
- type: "function",
332
- suffix: "infinite"
333
- }),
334
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
335
- };
336
- const queryOptions = { name: getName(operation, {
337
- type: "function",
338
- suffix: "InfiniteQueryOptions"
339
- }) };
340
- const queryKey = {
341
- name: getName(operation, {
342
- type: "const",
343
- suffix: "InfiniteQueryKey"
344
- }),
345
- typeName: getName(operation, {
346
- type: "type",
347
- suffix: "InfiniteQueryKey"
348
- })
349
- };
350
- const type = {
351
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
352
- schemas: getSchemas(operation, {
353
- pluginName: _kubb_plugin_ts.pluginTsName,
354
- type: "type"
355
- })
356
- };
357
- const zod = {
358
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
359
- schemas: getSchemas(operation, {
360
- pluginName: _kubb_plugin_zod.pluginZodName,
361
- type: "function"
362
- })
363
- };
364
- if (!isQuery || isMutation || !infiniteOptions) return null;
365
- const normalizeKey = (key) => (key ?? "").replace(/\?$/, "");
366
- const queryParam = infiniteOptions.queryParam;
367
- const cursorParam = infiniteOptions.cursorParam;
368
- const queryParamKeys = type.schemas.queryParams?.keys ?? [];
369
- const responseKeys = [...type.schemas.responses?.flatMap((item) => item.keys ?? []) ?? [], ...type.schemas.response?.keys ?? []];
370
- const hasQueryParam = queryParam ? queryParamKeys.some((key) => normalizeKey(key) === queryParam) : false;
371
- const hasCursorParam = cursorParam ? responseKeys.some((key) => normalizeKey(key) === cursorParam) : true;
372
- if (!hasQueryParam || !hasCursorParam) return null;
373
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
374
- baseName: query.file.baseName,
375
- path: query.file.path,
376
- meta: query.file.meta,
377
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
378
- oas,
379
- output,
380
- config: driver.config
381
- }),
382
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
383
- oas,
384
- output
385
- }),
386
- children: [
387
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
388
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
389
- root: query.file.path,
390
- path: zod.file.path
391
- }),
392
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
393
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
394
- name: "fetch",
395
- path: options.client.importPath
396
- }),
397
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
398
- name: [
399
- "Client",
400
- "RequestConfig",
401
- "ResponseErrorConfig"
402
- ],
403
- path: options.client.importPath,
404
- isTypeOnly: true
405
- }),
406
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
407
- name: ["ResponseConfig"],
408
- path: options.client.importPath,
409
- isTypeOnly: true
410
- })
411
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
412
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
413
- name: ["fetch"],
414
- root: query.file.path,
415
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
416
- }),
417
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
418
- name: [
419
- "Client",
420
- "RequestConfig",
421
- "ResponseErrorConfig"
422
- ],
423
- root: query.file.path,
424
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
425
- isTypeOnly: true
426
- }),
427
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
428
- name: ["ResponseConfig"],
429
- root: query.file.path,
430
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
431
- isTypeOnly: true
432
- })
433
- ] }),
434
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
435
- name: [client.name],
436
- root: query.file.path,
437
- path: client.file.path
438
- }),
439
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
440
- name: ["buildFormData"],
441
- root: query.file.path,
442
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
443
- }),
444
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
445
- name: [
446
- type.schemas.request?.name,
447
- type.schemas.response.name,
448
- type.schemas.pathParams?.name,
449
- type.schemas.queryParams?.name,
450
- type.schemas.headerParams?.name,
451
- ...type.schemas.statusCodes?.map((item) => item.name) || []
452
- ].filter(Boolean),
453
- root: query.file.path,
454
- path: type.file.path,
455
- isTypeOnly: true
456
- }),
457
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
458
- name: queryKey.name,
459
- typeName: queryKey.typeName,
460
- operation,
461
- paramsCasing: options.paramsCasing,
462
- pathParamsType: options.pathParamsType,
463
- typeSchemas: type.schemas,
464
- transformer: options.queryKey
465
- }),
466
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
467
- name: client.name,
468
- baseURL: options.client.baseURL,
469
- operation,
470
- typeSchemas: type.schemas,
471
- zodSchemas: zod.schemas,
472
- dataReturnType: options.client.dataReturnType || "data",
473
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
474
- paramsType: options.paramsType,
475
- pathParamsType: options.pathParamsType,
476
- parser: options.parser
477
- }),
478
- options.customOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
479
- name: [options.customOptions.name],
480
- path: options.customOptions.importPath
481
- }),
482
- infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
483
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
484
- name: ["InfiniteData"],
485
- isTypeOnly: true,
486
- path: importPath
487
- }),
488
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
489
- name: ["infiniteQueryOptions"],
490
- path: importPath
491
- }),
492
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQueryOptions, {
493
- name: queryOptions.name,
494
- clientName: client.name,
495
- queryKeyName: queryKey.name,
496
- typeSchemas: type.schemas,
497
- paramsCasing: options.paramsCasing,
498
- paramsType: options.paramsType,
499
- pathParamsType: options.pathParamsType,
500
- dataReturnType: options.client.dataReturnType || "data",
501
- cursorParam: infiniteOptions.cursorParam,
502
- nextParam: infiniteOptions.nextParam,
503
- previousParam: infiniteOptions.previousParam,
504
- initialPageParam: infiniteOptions.initialPageParam,
505
- queryParam: infiniteOptions.queryParam
506
- })
507
- ] }),
508
- infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
509
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
510
- name: ["useInfiniteQuery"],
511
- path: importPath
512
- }),
513
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
514
- name: [
515
- "QueryKey",
516
- "QueryClient",
517
- "InfiniteQueryObserverOptions",
518
- "UseInfiniteQueryResult"
519
- ],
520
- path: importPath,
521
- isTypeOnly: true
522
- }),
523
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQuery, {
524
- name: query.name,
525
- queryOptionsName: queryOptions.name,
526
- typeSchemas: type.schemas,
527
- paramsCasing: options.paramsCasing,
528
- paramsType: options.paramsType,
529
- pathParamsType: options.pathParamsType,
530
- operation,
531
- dataReturnType: options.client.dataReturnType || "data",
532
- queryKeyName: queryKey.name,
533
- queryKeyTypeName: queryKey.typeName,
534
- initialPageParam: infiniteOptions.initialPageParam,
535
- queryParam: infiniteOptions.queryParam,
536
- customOptions: options.customOptions
537
- })
538
- ] })
539
- ]
540
- });
541
- }
542
- });
543
- //#endregion
544
- //#region src/generators/mutationGenerator.tsx
545
- const mutationGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
546
- name: "react-query",
547
- Operation({ config, plugin, operation, generator }) {
548
- const { options, options: { output } } = plugin;
549
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
550
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
551
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
552
- const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
553
- const isMutation = options.mutation !== false && !isQuery && (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
554
- const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
555
- const mutation = {
556
- name: getName(operation, {
557
- type: "function",
558
- prefix: "use"
559
- }),
560
- typeName: getName(operation, { type: "type" }),
561
- file: getFile(operation, { prefix: "use" })
562
- };
563
- const type = {
564
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
565
- schemas: getSchemas(operation, {
566
- pluginName: _kubb_plugin_ts.pluginTsName,
567
- type: "type"
568
- })
569
- };
570
- const zod = {
571
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
572
- schemas: getSchemas(operation, {
573
- pluginName: _kubb_plugin_zod.pluginZodName,
574
- type: "function"
575
- })
576
- };
577
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
578
- const client = {
579
- name: shouldUseClientPlugin ? getName(operation, {
580
- type: "function",
581
- pluginName: _kubb_plugin_client.pluginClientName
582
- }) : getName(operation, { type: "function" }),
583
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
584
- };
585
- const mutationOptions = { name: getName(operation, {
586
- type: "function",
587
- suffix: "MutationOptions"
588
- }) };
589
- const mutationKey = {
590
- name: getName(operation, {
591
- type: "const",
592
- suffix: "MutationKey"
593
- }),
594
- typeName: getName(operation, {
595
- type: "type",
596
- suffix: "MutationKey"
597
- })
598
- };
599
- if (!isMutation) return null;
600
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
601
- baseName: mutation.file.baseName,
602
- path: mutation.file.path,
603
- meta: mutation.file.meta,
604
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
605
- oas,
606
- output,
607
- config: driver.config
608
- }),
609
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
610
- oas,
611
- output
612
- }),
613
- children: [
614
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
615
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
616
- root: mutation.file.path,
617
- path: zod.file.path
618
- }),
619
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
620
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
621
- name: "fetch",
622
- path: options.client.importPath
623
- }),
624
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
625
- name: [
626
- "Client",
627
- "RequestConfig",
628
- "ResponseErrorConfig"
629
- ],
630
- path: options.client.importPath,
631
- isTypeOnly: true
632
- }),
633
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
634
- name: ["ResponseConfig"],
635
- path: options.client.importPath,
636
- isTypeOnly: true
637
- })
638
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
639
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
640
- name: ["fetch"],
641
- root: mutation.file.path,
642
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
643
- }),
644
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
645
- name: [
646
- "Client",
647
- "RequestConfig",
648
- "ResponseErrorConfig"
649
- ],
650
- root: mutation.file.path,
651
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
652
- isTypeOnly: true
653
- }),
654
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
655
- name: ["ResponseConfig"],
656
- root: mutation.file.path,
657
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
658
- isTypeOnly: true
659
- })
660
- ] }),
661
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
662
- name: [client.name],
663
- root: mutation.file.path,
664
- path: client.file.path
665
- }),
666
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
667
- name: ["buildFormData"],
668
- root: mutation.file.path,
669
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
670
- }),
671
- options.customOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
672
- name: [options.customOptions.name],
673
- path: options.customOptions.importPath
674
- }),
675
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
676
- name: [
677
- type.schemas.request?.name,
678
- type.schemas.response.name,
679
- type.schemas.pathParams?.name,
680
- type.schemas.queryParams?.name,
681
- type.schemas.headerParams?.name,
682
- ...type.schemas.statusCodes?.map((item) => item.name) || []
683
- ].filter(Boolean),
684
- root: mutation.file.path,
685
- path: type.file.path,
686
- isTypeOnly: true
687
- }),
688
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.MutationKey, {
689
- name: mutationKey.name,
690
- typeName: mutationKey.typeName,
691
- operation,
692
- pathParamsType: options.pathParamsType,
693
- typeSchemas: type.schemas,
694
- paramsCasing: options.paramsCasing,
695
- transformer: options.mutationKey
696
- }),
697
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
698
- name: client.name,
699
- baseURL: options.client.baseURL,
700
- operation,
701
- typeSchemas: type.schemas,
702
- zodSchemas: zod.schemas,
703
- dataReturnType: options.client.dataReturnType || "data",
704
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
705
- paramsType: options.paramsType,
706
- pathParamsType: options.pathParamsType,
707
- parser: options.parser
708
- }),
709
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
710
- name: ["mutationOptions"],
711
- path: importPath
712
- }),
713
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.MutationOptions, {
714
- name: mutationOptions.name,
715
- clientName: client.name,
716
- mutationKeyName: mutationKey.name,
717
- typeSchemas: type.schemas,
718
- paramsCasing: options.paramsCasing,
719
- paramsType: options.paramsType,
720
- pathParamsType: options.pathParamsType,
721
- dataReturnType: options.client.dataReturnType || "data"
722
- }),
723
- options.mutation && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
724
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
725
- name: ["useMutation"],
726
- path: importPath
727
- }),
728
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
729
- name: [
730
- "UseMutationOptions",
731
- "UseMutationResult",
732
- "QueryClient"
733
- ],
734
- path: importPath,
735
- isTypeOnly: true
736
- }),
737
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Mutation, {
738
- name: mutation.name,
739
- mutationOptionsName: mutationOptions.name,
740
- typeName: mutation.typeName,
741
- typeSchemas: type.schemas,
742
- operation,
743
- dataReturnType: options.client.dataReturnType || "data",
744
- paramsCasing: options.paramsCasing,
745
- pathParamsType: options.pathParamsType,
746
- mutationKeyName: mutationKey.name,
747
- customOptions: options.customOptions
748
- })
749
- ] })
750
- ]
751
- });
752
- }
753
- });
754
- //#endregion
755
- //#region src/generators/queryGenerator.tsx
756
- const queryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
757
- name: "react-query",
758
- Operation({ config, plugin, operation, generator }) {
759
- const { options, options: { output } } = plugin;
760
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
761
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
762
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
763
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
764
- const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
765
- const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
766
- const query = {
767
- name: getName(operation, {
768
- type: "function",
769
- prefix: "use"
770
- }),
771
- typeName: getName(operation, { type: "type" }),
772
- file: getFile(operation, { prefix: "use" })
773
- };
774
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
775
- const client = {
776
- name: shouldUseClientPlugin ? getName(operation, {
777
- type: "function",
778
- pluginName: _kubb_plugin_client.pluginClientName
779
- }) : getName(operation, { type: "function" }),
780
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
781
- };
782
- const queryOptions = { name: getName(operation, {
783
- type: "function",
784
- suffix: "QueryOptions"
785
- }) };
786
- const queryKey = {
787
- name: getName(operation, {
788
- type: "const",
789
- suffix: "QueryKey"
790
- }),
791
- typeName: getName(operation, {
792
- type: "type",
793
- suffix: "QueryKey"
794
- })
795
- };
796
- const type = {
797
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
798
- schemas: getSchemas(operation, {
799
- pluginName: _kubb_plugin_ts.pluginTsName,
800
- type: "type"
801
- })
802
- };
803
- const zod = {
804
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
805
- schemas: getSchemas(operation, {
806
- pluginName: _kubb_plugin_zod.pluginZodName,
807
- type: "function"
808
- })
809
- };
810
- if (!isQuery || isMutation) return null;
811
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
812
- baseName: query.file.baseName,
813
- path: query.file.path,
814
- meta: query.file.meta,
815
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
816
- oas,
817
- output,
818
- config: driver.config
819
- }),
820
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
821
- oas,
822
- output
823
- }),
824
- children: [
825
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
826
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
827
- root: query.file.path,
828
- path: zod.file.path
829
- }),
830
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
831
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
832
- name: "fetch",
833
- path: options.client.importPath
834
- }),
835
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
836
- name: [
837
- "Client",
838
- "RequestConfig",
839
- "ResponseErrorConfig"
840
- ],
841
- path: options.client.importPath,
842
- isTypeOnly: true
843
- }),
844
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
845
- name: ["ResponseConfig"],
846
- path: options.client.importPath,
847
- isTypeOnly: true
848
- })
849
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
850
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
851
- name: ["fetch"],
852
- root: query.file.path,
853
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
854
- }),
855
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
856
- name: [
857
- "Client",
858
- "RequestConfig",
859
- "ResponseErrorConfig"
860
- ],
861
- root: query.file.path,
862
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
863
- isTypeOnly: true
864
- }),
865
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
866
- name: ["ResponseConfig"],
867
- root: query.file.path,
868
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
869
- isTypeOnly: true
870
- })
871
- ] }),
872
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
873
- name: [client.name],
874
- root: query.file.path,
875
- path: client.file.path
876
- }),
877
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
878
- name: ["buildFormData"],
879
- root: query.file.path,
880
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
881
- }),
882
- options.customOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
883
- name: [options.customOptions.name],
884
- path: options.customOptions.importPath
885
- }),
886
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
887
- name: [
888
- type.schemas.request?.name,
889
- type.schemas.response.name,
890
- type.schemas.pathParams?.name,
891
- type.schemas.queryParams?.name,
892
- type.schemas.headerParams?.name,
893
- ...type.schemas.statusCodes?.map((item) => item.name) || []
894
- ].filter(Boolean),
895
- root: query.file.path,
896
- path: type.file.path,
897
- isTypeOnly: true
898
- }),
899
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
900
- name: queryKey.name,
901
- typeName: queryKey.typeName,
902
- operation,
903
- pathParamsType: options.pathParamsType,
904
- typeSchemas: type.schemas,
905
- paramsCasing: options.paramsCasing,
906
- transformer: options.queryKey
907
- }),
908
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
909
- name: client.name,
910
- baseURL: options.client.baseURL,
911
- operation,
912
- typeSchemas: type.schemas,
913
- zodSchemas: zod.schemas,
914
- dataReturnType: options.client.dataReturnType || "data",
915
- paramsType: options.paramsType,
916
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
917
- pathParamsType: options.pathParamsType,
918
- parser: options.parser
919
- }),
920
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
921
- name: ["queryOptions"],
922
- path: importPath
923
- }),
924
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
925
- name: queryOptions.name,
926
- clientName: client.name,
927
- queryKeyName: queryKey.name,
928
- typeSchemas: type.schemas,
929
- paramsCasing: options.paramsCasing,
930
- paramsType: options.paramsType,
931
- pathParamsType: options.pathParamsType,
932
- dataReturnType: options.client.dataReturnType || "data"
933
- }),
934
- options.query && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
935
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
936
- name: ["useQuery"],
937
- path: importPath
938
- }),
939
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
940
- name: [
941
- "QueryKey",
942
- "QueryClient",
943
- "QueryObserverOptions",
944
- "UseQueryResult",
945
- "QueryClient"
946
- ],
947
- path: importPath,
948
- isTypeOnly: true
949
- }),
950
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Query, {
951
- name: query.name,
952
- queryOptionsName: queryOptions.name,
953
- typeSchemas: type.schemas,
954
- paramsCasing: options.paramsCasing,
955
- paramsType: options.paramsType,
956
- pathParamsType: options.pathParamsType,
957
- operation,
958
- dataReturnType: options.client.dataReturnType || "data",
959
- queryKeyName: queryKey.name,
960
- queryKeyTypeName: queryKey.typeName,
961
- customOptions: options.customOptions
962
- })
963
- ] })
964
- ]
965
- });
966
- }
967
- });
968
- //#endregion
969
- //#region src/generators/suspenseInfiniteQueryGenerator.tsx
970
- const suspenseInfiniteQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
971
- name: "react-suspense-infinite-query",
972
- Operation({ config, operation, generator, plugin }) {
973
- const { options, options: { output } } = plugin;
974
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
975
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
976
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
977
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
978
- const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
979
- const isSuspense = !!options.suspense;
980
- const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
981
- const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
982
- const query = {
983
- name: getName(operation, {
984
- type: "function",
985
- prefix: "use",
986
- suffix: "suspenseInfinite"
987
- }),
988
- typeName: getName(operation, { type: "type" }),
989
- file: getFile(operation, {
990
- prefix: "use",
991
- suffix: "suspenseInfinite"
992
- })
993
- };
994
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
995
- const client = {
996
- name: shouldUseClientPlugin ? getName(operation, {
997
- type: "function",
998
- pluginName: _kubb_plugin_client.pluginClientName
999
- }) : getName(operation, {
1000
- type: "function",
1001
- suffix: "suspenseInfinite"
1002
- }),
1003
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
1004
- };
1005
- const queryOptions = { name: getName(operation, {
1006
- type: "function",
1007
- suffix: "SuspenseInfiniteQueryOptions"
1008
- }) };
1009
- const queryKey = {
1010
- name: getName(operation, {
1011
- type: "const",
1012
- suffix: "SuspenseInfiniteQueryKey"
1013
- }),
1014
- typeName: getName(operation, {
1015
- type: "type",
1016
- suffix: "SuspenseInfiniteQueryKey"
1017
- })
1018
- };
1019
- const type = {
1020
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
1021
- schemas: getSchemas(operation, {
1022
- pluginName: _kubb_plugin_ts.pluginTsName,
1023
- type: "type"
1024
- })
1025
- };
1026
- const zod = {
1027
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
1028
- schemas: getSchemas(operation, {
1029
- pluginName: _kubb_plugin_zod.pluginZodName,
1030
- type: "function"
1031
- })
1032
- };
1033
- if (!isQuery || isMutation || !isSuspense || !infiniteOptions) return null;
1034
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
1035
- baseName: query.file.baseName,
1036
- path: query.file.path,
1037
- meta: query.file.meta,
1038
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
1039
- oas,
1040
- output,
1041
- config: driver.config
1042
- }),
1043
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
1044
- oas,
1045
- output
1046
- }),
1047
- children: [
1048
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1049
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
1050
- root: query.file.path,
1051
- path: zod.file.path
1052
- }),
1053
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1054
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1055
- name: "fetch",
1056
- path: options.client.importPath
1057
- }),
1058
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1059
- name: [
1060
- "Client",
1061
- "RequestConfig",
1062
- "ResponseErrorConfig"
1063
- ],
1064
- path: options.client.importPath,
1065
- isTypeOnly: true
1066
- }),
1067
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1068
- name: ["ResponseConfig"],
1069
- path: options.client.importPath,
1070
- isTypeOnly: true
1071
- })
1072
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1073
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1074
- name: ["fetch"],
1075
- root: query.file.path,
1076
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
1077
- }),
1078
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1079
- name: [
1080
- "Client",
1081
- "RequestConfig",
1082
- "ResponseErrorConfig"
1083
- ],
1084
- root: query.file.path,
1085
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1086
- isTypeOnly: true
1087
- }),
1088
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1089
- name: ["ResponseConfig"],
1090
- root: query.file.path,
1091
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1092
- isTypeOnly: true
1093
- })
1094
- ] }),
1095
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1096
- name: [client.name],
1097
- root: query.file.path,
1098
- path: client.file.path
1099
- }),
1100
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1101
- name: ["buildFormData"],
1102
- root: query.file.path,
1103
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
1104
- }),
1105
- options.customOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1106
- name: [options.customOptions.name],
1107
- path: options.customOptions.importPath
1108
- }),
1109
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1110
- name: [
1111
- type.schemas.request?.name,
1112
- type.schemas.response.name,
1113
- type.schemas.pathParams?.name,
1114
- type.schemas.queryParams?.name,
1115
- type.schemas.headerParams?.name,
1116
- ...type.schemas.statusCodes?.map((item) => item.name) || []
1117
- ].filter(Boolean),
1118
- root: query.file.path,
1119
- path: type.file.path,
1120
- isTypeOnly: true
1121
- }),
1122
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
1123
- name: queryKey.name,
1124
- typeName: queryKey.typeName,
1125
- operation,
1126
- paramsCasing: options.paramsCasing,
1127
- pathParamsType: options.pathParamsType,
1128
- typeSchemas: type.schemas,
1129
- transformer: options.queryKey
1130
- }),
1131
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
1132
- name: client.name,
1133
- baseURL: options.client.baseURL,
1134
- operation,
1135
- typeSchemas: type.schemas,
1136
- zodSchemas: zod.schemas,
1137
- dataReturnType: options.client.dataReturnType || "data",
1138
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
1139
- paramsType: options.paramsType,
1140
- pathParamsType: options.pathParamsType,
1141
- parser: options.parser
1142
- }),
1143
- infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1144
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1145
- name: ["InfiniteData"],
1146
- isTypeOnly: true,
1147
- path: importPath
1148
- }),
1149
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1150
- name: ["infiniteQueryOptions"],
1151
- path: importPath
1152
- }),
1153
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQueryOptions, {
1154
- name: queryOptions.name,
1155
- clientName: client.name,
1156
- queryKeyName: queryKey.name,
1157
- typeSchemas: type.schemas,
1158
- paramsCasing: options.paramsCasing,
1159
- paramsType: options.paramsType,
1160
- pathParamsType: options.pathParamsType,
1161
- dataReturnType: options.client.dataReturnType || "data",
1162
- cursorParam: infiniteOptions.cursorParam,
1163
- nextParam: infiniteOptions.nextParam,
1164
- previousParam: infiniteOptions.previousParam,
1165
- initialPageParam: infiniteOptions.initialPageParam,
1166
- queryParam: infiniteOptions.queryParam
1167
- })
1168
- ] }),
1169
- infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1170
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1171
- name: ["useSuspenseInfiniteQuery"],
1172
- path: importPath
1173
- }),
1174
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1175
- name: [
1176
- "QueryKey",
1177
- "QueryClient",
1178
- "UseSuspenseInfiniteQueryOptions",
1179
- "UseSuspenseInfiniteQueryResult"
1180
- ],
1181
- path: importPath,
1182
- isTypeOnly: true
1183
- }),
1184
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQuery, {
1185
- name: query.name,
1186
- queryOptionsName: queryOptions.name,
1187
- typeSchemas: type.schemas,
1188
- paramsCasing: options.paramsCasing,
1189
- paramsType: options.paramsType,
1190
- pathParamsType: options.pathParamsType,
1191
- operation,
1192
- dataReturnType: options.client.dataReturnType || "data",
1193
- queryKeyName: queryKey.name,
1194
- queryKeyTypeName: queryKey.typeName,
1195
- customOptions: options.customOptions,
1196
- initialPageParam: infiniteOptions.initialPageParam,
1197
- queryParam: infiniteOptions.queryParam
1198
- })
1199
- ] })
1200
- ]
1201
- });
1202
- }
1203
- });
1204
- //#endregion
1205
- //#region src/generators/suspenseQueryGenerator.tsx
1206
- const suspenseQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
1207
- name: "react-suspense-query",
1208
- Operation({ config, operation, generator, plugin }) {
1209
- const { options, options: { output } } = plugin;
1210
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
1211
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
1212
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
1213
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
1214
- const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
1215
- const isSuspense = !!options.suspense;
1216
- const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
1217
- const query = {
1218
- name: getName(operation, {
1219
- type: "function",
1220
- prefix: "use",
1221
- suffix: "suspense"
1222
- }),
1223
- typeName: getName(operation, { type: "type" }),
1224
- file: getFile(operation, {
1225
- prefix: "use",
1226
- suffix: "suspense"
1227
- })
1228
- };
1229
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
1230
- const client = {
1231
- name: shouldUseClientPlugin ? getName(operation, {
1232
- type: "function",
1233
- pluginName: _kubb_plugin_client.pluginClientName
1234
- }) : getName(operation, {
1235
- type: "function",
1236
- suffix: "suspense"
1237
- }),
1238
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
1239
- };
1240
- const queryOptions = { name: getName(operation, {
1241
- type: "function",
1242
- suffix: "SuspenseQueryOptions"
1243
- }) };
1244
- const queryKey = {
1245
- name: getName(operation, {
1246
- type: "const",
1247
- suffix: "SuspenseQueryKey"
1248
- }),
1249
- typeName: getName(operation, {
1250
- type: "type",
1251
- suffix: "SuspenseQueryKey"
1252
- })
1253
- };
1254
- const type = {
1255
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
1256
- schemas: getSchemas(operation, {
1257
- pluginName: _kubb_plugin_ts.pluginTsName,
1258
- type: "type"
1259
- })
1260
- };
1261
- const zod = {
1262
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
1263
- schemas: getSchemas(operation, {
1264
- pluginName: _kubb_plugin_zod.pluginZodName,
1265
- type: "function"
1266
- })
1267
- };
1268
- if (!isQuery || isMutation || !isSuspense) return null;
1269
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
1270
- baseName: query.file.baseName,
1271
- path: query.file.path,
1272
- meta: query.file.meta,
1273
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
1274
- oas,
1275
- output,
1276
- config: driver.config
1277
- }),
1278
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
1279
- oas,
1280
- output
1281
- }),
1282
- children: [
1283
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1284
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
1285
- root: query.file.path,
1286
- path: zod.file.path
1287
- }),
1288
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1289
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1290
- name: "fetch",
1291
- path: options.client.importPath
1292
- }),
1293
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1294
- name: [
1295
- "Client",
1296
- "RequestConfig",
1297
- "ResponseErrorConfig"
1298
- ],
1299
- path: options.client.importPath,
1300
- isTypeOnly: true
1301
- }),
1302
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1303
- name: ["ResponseConfig"],
1304
- path: options.client.importPath,
1305
- isTypeOnly: true
1306
- })
1307
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1308
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1309
- name: ["fetch"],
1310
- root: query.file.path,
1311
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
1312
- }),
1313
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1314
- name: [
1315
- "Client",
1316
- "RequestConfig",
1317
- "ResponseErrorConfig"
1318
- ],
1319
- root: query.file.path,
1320
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1321
- isTypeOnly: true
1322
- }),
1323
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1324
- name: ["ResponseConfig"],
1325
- root: query.file.path,
1326
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1327
- isTypeOnly: true
1328
- })
1329
- ] }),
1330
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1331
- name: [client.name],
1332
- root: query.file.path,
1333
- path: client.file.path
1334
- }),
1335
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1336
- name: ["buildFormData"],
1337
- root: query.file.path,
1338
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
1339
- }),
1340
- options.customOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1341
- name: [options.customOptions.name],
1342
- path: options.customOptions.importPath
1343
- }),
1344
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1345
- name: [
1346
- type.schemas.request?.name,
1347
- type.schemas.response.name,
1348
- type.schemas.pathParams?.name,
1349
- type.schemas.queryParams?.name,
1350
- type.schemas.headerParams?.name,
1351
- ...type.schemas.statusCodes?.map((item) => item.name) || []
1352
- ].filter(Boolean),
1353
- root: query.file.path,
1354
- path: type.file.path,
1355
- isTypeOnly: true
1356
- }),
1357
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
1358
- name: queryKey.name,
1359
- typeName: queryKey.typeName,
1360
- operation,
1361
- paramsCasing: options.paramsCasing,
1362
- pathParamsType: options.pathParamsType,
1363
- typeSchemas: type.schemas,
1364
- transformer: options.queryKey
1365
- }),
1366
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
1367
- name: client.name,
1368
- baseURL: options.client.baseURL,
1369
- operation,
1370
- typeSchemas: type.schemas,
1371
- zodSchemas: zod.schemas,
1372
- dataReturnType: options.client.dataReturnType || "data",
1373
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
1374
- paramsType: options.paramsType,
1375
- pathParamsType: options.pathParamsType,
1376
- parser: options.parser
1377
- }),
1378
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1379
- name: ["queryOptions"],
1380
- path: importPath
1381
- }),
1382
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
1383
- name: queryOptions.name,
1384
- clientName: client.name,
1385
- queryKeyName: queryKey.name,
1386
- typeSchemas: type.schemas,
1387
- paramsCasing: options.paramsCasing,
1388
- paramsType: options.paramsType,
1389
- pathParamsType: options.pathParamsType,
1390
- dataReturnType: options.client.dataReturnType
1391
- }),
1392
- options.suspense && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
1393
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1394
- name: ["useSuspenseQuery"],
1395
- path: importPath
1396
- }),
1397
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
1398
- name: [
1399
- "QueryKey",
1400
- "QueryClient",
1401
- "UseSuspenseQueryOptions",
1402
- "UseSuspenseQueryResult"
1403
- ],
1404
- path: importPath,
1405
- isTypeOnly: true
1406
- }),
1407
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseQuery, {
1408
- name: query.name,
1409
- queryOptionsName: queryOptions.name,
1410
- typeSchemas: type.schemas,
1411
- paramsType: options.paramsType,
1412
- paramsCasing: options.paramsCasing,
1413
- pathParamsType: options.pathParamsType,
1414
- operation,
1415
- dataReturnType: options.client.dataReturnType || "data",
1416
- queryKeyName: queryKey.name,
1417
- queryKeyTypeName: queryKey.typeName,
1418
- customOptions: options.customOptions
1419
- })
1420
- ] })
1421
- ]
1422
- });
1423
- }
1424
- });
1425
- //#endregion
1426
- Object.defineProperty(exports, "customHookOptionsFileGenerator", {
1427
- enumerable: true,
1428
- get: function() {
1429
- return customHookOptionsFileGenerator;
1430
- }
1431
- });
1432
- Object.defineProperty(exports, "hookOptionsGenerator", {
1433
- enumerable: true,
1434
- get: function() {
1435
- return hookOptionsGenerator;
1436
- }
1437
- });
1438
- Object.defineProperty(exports, "infiniteQueryGenerator", {
1439
- enumerable: true,
1440
- get: function() {
1441
- return infiniteQueryGenerator;
1442
- }
1443
- });
1444
- Object.defineProperty(exports, "mutationGenerator", {
1445
- enumerable: true,
1446
- get: function() {
1447
- return mutationGenerator;
1448
- }
1449
- });
1450
- Object.defineProperty(exports, "queryGenerator", {
1451
- enumerable: true,
1452
- get: function() {
1453
- return queryGenerator;
1454
- }
1455
- });
1456
- Object.defineProperty(exports, "suspenseInfiniteQueryGenerator", {
1457
- enumerable: true,
1458
- get: function() {
1459
- return suspenseInfiniteQueryGenerator;
1460
- }
1461
- });
1462
- Object.defineProperty(exports, "suspenseQueryGenerator", {
1463
- enumerable: true,
1464
- get: function() {
1465
- return suspenseQueryGenerator;
1466
- }
1467
- });
1468
-
1469
- //# sourceMappingURL=generators-DP07m3rH.cjs.map