@kubb/plugin-react-query 3.0.0-beta.9 → 3.0.1

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/dist/{chunk-U35NELYJ.js → chunk-ARL3PQR3.js} +259 -41
  2. package/dist/chunk-ARL3PQR3.js.map +1 -0
  3. package/dist/{chunk-D5PFCZWQ.cjs → chunk-FYBD7BZP.cjs} +259 -41
  4. package/dist/chunk-FYBD7BZP.cjs.map +1 -0
  5. package/dist/{chunk-JKG4EZID.cjs → chunk-WMQRQT7P.cjs} +158 -116
  6. package/dist/chunk-WMQRQT7P.cjs.map +1 -0
  7. package/dist/{chunk-3OOSVEDM.js → chunk-WYNK6OE2.js} +147 -105
  8. package/dist/chunk-WYNK6OE2.js.map +1 -0
  9. package/dist/components.cjs +9 -9
  10. package/dist/components.d.cts +29 -16
  11. package/dist/components.d.ts +29 -16
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +6 -6
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +25 -25
  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 +24 -24
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-LhwfnVo7.d.cts → types-IuxCCG1K.d.cts} +46 -16
  24. package/dist/{types-LhwfnVo7.d.ts → types-IuxCCG1K.d.ts} +46 -16
  25. package/package.json +13 -12
  26. package/src/components/InfiniteQuery.tsx +53 -6
  27. package/src/components/InfiniteQueryOptions.tsx +47 -6
  28. package/src/components/Mutation.tsx +3 -1
  29. package/src/components/MutationKey.tsx +11 -5
  30. package/src/components/Query.tsx +62 -6
  31. package/src/components/QueryKey.tsx +17 -7
  32. package/src/components/QueryOptions.tsx +47 -7
  33. package/src/components/SuspenseQuery.tsx +52 -5
  34. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
  35. package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
  36. package/src/generators/__snapshots__/findByTags.ts +1 -1
  37. package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
  38. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
  39. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
  40. package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
  41. package/src/generators/__snapshots__/findInfiniteByTags.ts +3 -3
  42. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +3 -3
  43. package/src/generators/__snapshots__/postAsQuery.ts +1 -1
  44. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
  45. package/src/generators/infiniteQueryGenerator.tsx +48 -30
  46. package/src/generators/mutationGenerator.tsx +30 -18
  47. package/src/generators/queryGenerator.tsx +29 -17
  48. package/src/generators/suspenseQueryGenerator.tsx +34 -19
  49. package/src/plugin.ts +31 -25
  50. package/src/types.ts +35 -15
  51. package/dist/chunk-3OOSVEDM.js.map +0 -1
  52. package/dist/chunk-D5PFCZWQ.cjs.map +0 -1
  53. package/dist/chunk-JKG4EZID.cjs.map +0 -1
  54. package/dist/chunk-U35NELYJ.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkD5PFCZWQ_cjs = require('./chunk-D5PFCZWQ.cjs');
3
+ var chunkFYBD7BZP_cjs = require('./chunk-FYBD7BZP.cjs');
4
4
  var path = require('path');
5
5
  var core = require('@kubb/core');
6
6
  var transformers = require('@kubb/core/transformers');
@@ -10,6 +10,7 @@ var hooks = require('@kubb/plugin-oas/hooks');
10
10
  var pluginTs = require('@kubb/plugin-ts');
11
11
  var react = require('@kubb/react');
12
12
  var jsxRuntime = require('@kubb/react/jsx-runtime');
13
+ var remeda = require('remeda');
13
14
 
14
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
16
 
@@ -57,12 +58,13 @@ var clientGenerator = pluginOas.createReactGenerator({
57
58
  }
58
59
  ),
59
60
  /* @__PURE__ */ jsxRuntime.jsx(
60
- chunkD5PFCZWQ_cjs.Client,
61
+ chunkFYBD7BZP_cjs.Client,
61
62
  {
62
63
  name: client.name,
63
64
  baseURL: options.baseURL,
64
65
  dataReturnType: options.dataReturnType,
65
66
  pathParamsType: options.pathParamsType,
67
+ paramsType: options.paramsType,
66
68
  typeSchemas: type.schemas,
67
69
  operation,
68
70
  parser: options.parser,
@@ -83,7 +85,7 @@ var operationsGenerator = pluginOas.createReactGenerator({
83
85
  } = react.useApp();
84
86
  const name = "operations";
85
87
  const file = pluginManager.getFile({ name, extname: ".ts", pluginKey: [pluginClientName] });
86
- return /* @__PURE__ */ jsxRuntime.jsx(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: /* @__PURE__ */ jsxRuntime.jsx(chunkD5PFCZWQ_cjs.Operations, { name, operations }) });
88
+ return /* @__PURE__ */ jsxRuntime.jsx(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: /* @__PURE__ */ jsxRuntime.jsx(chunkFYBD7BZP_cjs.Operations, { name, operations }) });
87
89
  }
88
90
  });
89
91
  var groupedClientGenerator = pluginOas.createReactGenerator({
@@ -141,10 +143,12 @@ core.createPlugin((options) => {
141
143
  exclude = [],
142
144
  include,
143
145
  override = [],
144
- transformers: transformers4 = {},
146
+ transformers: transformers$1 = {},
145
147
  dataReturnType = "data",
146
148
  pathParamsType = "inline",
149
+ paramsType = "inline",
147
150
  operations = false,
151
+ baseURL,
148
152
  generators = [clientGenerator, group ? groupedClientGenerator : void 0, operations ? operationsGenerator : void 0].filter(Boolean),
149
153
  importPath = "@kubb/plugin-client/client",
150
154
  parser = "client"
@@ -157,8 +161,9 @@ core.createPlugin((options) => {
157
161
  parser,
158
162
  dataReturnType,
159
163
  importPath,
160
- pathParamsType,
161
- baseURL: void 0
164
+ paramsType,
165
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
166
+ baseURL
162
167
  },
163
168
  pre: [pluginOas.pluginOasName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean),
164
169
  resolvePath(baseName, pathMode, options2) {
@@ -176,7 +181,7 @@ core.createPlugin((options) => {
176
181
  resolveName(name, type) {
177
182
  const resolvedName = transformers.camelCase(name, { isFile: type === "file" });
178
183
  if (type) {
179
- return transformers4?.name?.(resolvedName, type) || resolvedName;
184
+ return transformers$1?.name?.(resolvedName, type) || resolvedName;
180
185
  }
181
186
  return resolvedName;
182
187
  },
@@ -185,12 +190,12 @@ core.createPlugin((options) => {
185
190
  const oas = await swaggerPlugin.context.getOas();
186
191
  const root = path__default.default.resolve(this.config.root, this.config.output.path);
187
192
  const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
188
- const baseURL = await swaggerPlugin.context.getBaseURL();
193
+ const baseURL2 = await swaggerPlugin.context.getBaseURL();
189
194
  const operationGenerator = new pluginOas.OperationGenerator(
190
- {
195
+ baseURL2 ? {
191
196
  ...this.plugin.options,
192
- baseURL
193
- },
197
+ baseURL: baseURL2
198
+ } : this.plugin.options,
194
199
  {
195
200
  oas,
196
201
  pluginManager: this.pluginManager,
@@ -228,7 +233,10 @@ var queryGenerator = pluginOas.createReactGenerator({
228
233
  } = react.useApp();
229
234
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
230
235
  const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
231
- !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method);
236
+ const isMutation = remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
237
+ (method) => operation.method === method
238
+ );
239
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
232
240
  const query = {
233
241
  name: getName(operation, { type: "function", prefix: "use" }),
234
242
  typeName: getName(operation, { type: "type" }),
@@ -253,13 +261,11 @@ var queryGenerator = pluginOas.createReactGenerator({
253
261
  file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
254
262
  schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
255
263
  };
256
- if (!isQuery || typeof options.query === "boolean") {
264
+ if (!isQuery || isMutation) {
257
265
  return null;
258
266
  }
259
267
  return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
260
268
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
261
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useQuery", "queryOptions"], path: options.query.importPath }),
262
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "QueryObserverOptions", "UseQueryResult"], path: options.query.importPath, isTypeOnly: true }),
263
269
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
264
270
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
265
271
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
@@ -280,54 +286,62 @@ var queryGenerator = pluginOas.createReactGenerator({
280
286
  }
281
287
  ),
282
288
  /* @__PURE__ */ jsxRuntime.jsx(
283
- chunkD5PFCZWQ_cjs.QueryKey,
289
+ chunkFYBD7BZP_cjs.QueryKey,
284
290
  {
285
291
  name: queryKey.name,
286
292
  typeName: queryKey.typeName,
287
293
  operation,
288
294
  pathParamsType: options.pathParamsType,
289
295
  typeSchemas: type.schemas,
290
- keysFn: options.query.key
296
+ transformer: options.queryKey
291
297
  }
292
298
  ),
293
299
  /* @__PURE__ */ jsxRuntime.jsx(
294
- chunkD5PFCZWQ_cjs.Client,
300
+ chunkFYBD7BZP_cjs.Client,
295
301
  {
296
302
  name: client.name,
297
303
  isExportable: false,
298
304
  isIndexable: false,
299
- baseURL: options.baseURL,
305
+ baseURL: options.client.baseURL,
300
306
  operation,
301
307
  typeSchemas: type.schemas,
302
308
  zodSchemas: zod.schemas,
303
309
  dataReturnType: options.client.dataReturnType,
310
+ paramsType: options.paramsType,
304
311
  pathParamsType: options.pathParamsType,
305
312
  parser: options.parser
306
313
  }
307
314
  ),
315
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
308
316
  /* @__PURE__ */ jsxRuntime.jsx(
309
- chunkD5PFCZWQ_cjs.QueryOptions,
317
+ chunkFYBD7BZP_cjs.QueryOptions,
310
318
  {
311
319
  name: queryOptions.name,
312
320
  clientName: client.name,
313
321
  queryKeyName: queryKey.name,
314
322
  typeSchemas: type.schemas,
323
+ paramsType: options.paramsType,
315
324
  pathParamsType: options.pathParamsType
316
325
  }
317
326
  ),
318
- /* @__PURE__ */ jsxRuntime.jsx(
319
- chunkD5PFCZWQ_cjs.Query,
320
- {
321
- name: query.name,
322
- queryOptionsName: queryOptions.name,
323
- typeSchemas: type.schemas,
324
- pathParamsType: options.pathParamsType,
325
- operation,
326
- dataReturnType: options.client.dataReturnType,
327
- queryKeyName: queryKey.name,
328
- queryKeyTypeName: queryKey.typeName
329
- }
330
- )
327
+ options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
328
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useQuery"], path: importPath }),
329
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "QueryObserverOptions", "UseQueryResult"], path: importPath, isTypeOnly: true }),
330
+ /* @__PURE__ */ jsxRuntime.jsx(
331
+ chunkFYBD7BZP_cjs.Query,
332
+ {
333
+ name: query.name,
334
+ queryOptionsName: queryOptions.name,
335
+ typeSchemas: type.schemas,
336
+ paramsType: options.paramsType,
337
+ pathParamsType: options.pathParamsType,
338
+ operation,
339
+ dataReturnType: options.client.dataReturnType,
340
+ queryKeyName: queryKey.name,
341
+ queryKeyTypeName: queryKey.typeName
342
+ }
343
+ )
344
+ ] })
331
345
  ] });
332
346
  }
333
347
  });
@@ -340,8 +354,9 @@ var mutationGenerator = pluginOas.createReactGenerator({
340
354
  }
341
355
  } = react.useApp();
342
356
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
343
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
344
- const isMutation = !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method);
357
+ const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
358
+ const isMutation = !isQuery && remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
359
+ const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
345
360
  const mutation = {
346
361
  name: getName(operation, { type: "function", prefix: "use" }),
347
362
  typeName: getName(operation, { type: "type" }),
@@ -363,13 +378,11 @@ var mutationGenerator = pluginOas.createReactGenerator({
363
378
  name: getName(operation, { type: "const", suffix: "MutationKey" }),
364
379
  typeName: getName(operation, { type: "type", suffix: "MutationKey" })
365
380
  };
366
- if (!isMutation || typeof options.mutation === "boolean") {
381
+ if (!isMutation) {
367
382
  return null;
368
383
  }
369
384
  return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
370
385
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
371
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useMutation"], path: options.mutation.importPath }),
372
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["UseMutationOptions"], path: options.mutation.importPath, isTypeOnly: true }),
373
386
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
374
387
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
375
388
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -389,44 +402,50 @@ var mutationGenerator = pluginOas.createReactGenerator({
389
402
  }
390
403
  ),
391
404
  /* @__PURE__ */ jsxRuntime.jsx(
392
- chunkD5PFCZWQ_cjs.MutationKey,
405
+ chunkFYBD7BZP_cjs.MutationKey,
393
406
  {
394
407
  name: mutationKey.name,
395
408
  typeName: mutationKey.typeName,
396
409
  operation,
397
410
  pathParamsType: options.pathParamsType,
398
411
  typeSchemas: type.schemas,
399
- keysFn: options.mutation.key
412
+ transformer: options.mutationKey
400
413
  }
401
414
  ),
402
415
  /* @__PURE__ */ jsxRuntime.jsx(
403
- chunkD5PFCZWQ_cjs.Client,
416
+ chunkFYBD7BZP_cjs.Client,
404
417
  {
405
418
  name: client.name,
406
419
  isExportable: false,
407
420
  isIndexable: false,
408
- baseURL: options.baseURL,
421
+ baseURL: options.client.baseURL,
409
422
  operation,
410
423
  typeSchemas: type.schemas,
411
424
  zodSchemas: zod.schemas,
412
425
  dataReturnType: options.client.dataReturnType,
426
+ paramsType: options.paramsType,
413
427
  pathParamsType: options.pathParamsType,
414
428
  parser: options.parser
415
429
  }
416
430
  ),
417
- /* @__PURE__ */ jsxRuntime.jsx(
418
- chunkD5PFCZWQ_cjs.Mutation,
419
- {
420
- name: mutation.name,
421
- clientName: client.name,
422
- typeName: mutation.typeName,
423
- typeSchemas: type.schemas,
424
- operation,
425
- dataReturnType: options.client.dataReturnType,
426
- pathParamsType: options.pathParamsType,
427
- mutationKeyName: mutationKey.name
428
- }
429
- )
431
+ options.mutation && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
432
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useMutation"], path: importPath }),
433
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["UseMutationOptions"], path: importPath, isTypeOnly: true }),
434
+ /* @__PURE__ */ jsxRuntime.jsx(
435
+ chunkFYBD7BZP_cjs.Mutation,
436
+ {
437
+ name: mutation.name,
438
+ clientName: client.name,
439
+ typeName: mutation.typeName,
440
+ typeSchemas: type.schemas,
441
+ operation,
442
+ dataReturnType: options.client.dataReturnType,
443
+ paramsType: options.paramsType,
444
+ pathParamsType: options.pathParamsType,
445
+ mutationKeyName: mutationKey.name
446
+ }
447
+ )
448
+ ] })
430
449
  ] });
431
450
  }
432
451
  });
@@ -439,8 +458,12 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
439
458
  }
440
459
  } = react.useApp();
441
460
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
442
- const isQuery = typeof options.query === "boolean" ? options.query : !!options.query.methods?.some((method) => operation.method === method);
443
- const isInfinite = isQuery && !!options.infinite;
461
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
462
+ const isMutation = remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
463
+ (method) => operation.method === method
464
+ );
465
+ const isInfinite = !!options.infinite;
466
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
444
467
  const query = {
445
468
  name: getName(operation, { type: "function", prefix: "use", suffix: "infinite" }),
446
469
  typeName: getName(operation, { type: "type" }),
@@ -465,13 +488,11 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
465
488
  file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
466
489
  schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
467
490
  };
468
- if (!isQuery || !isInfinite || typeof options.query === "boolean" || typeof options.infinite === "boolean") {
491
+ if (!isQuery || isMutation || !isInfinite) {
469
492
  return null;
470
493
  }
471
494
  return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
472
495
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
473
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useInfiniteQuery", "infiniteQueryOptions"], path: options.query.importPath }),
474
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "InfiniteQueryObserverOptions", "UseInfiniteQueryResult"], path: options.query.importPath, isTypeOnly: true }),
475
496
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
476
497
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
477
498
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
@@ -492,58 +513,69 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
492
513
  }
493
514
  ),
494
515
  /* @__PURE__ */ jsxRuntime.jsx(
495
- chunkD5PFCZWQ_cjs.QueryKey,
516
+ chunkFYBD7BZP_cjs.QueryKey,
496
517
  {
497
518
  name: queryKey.name,
498
519
  typeName: queryKey.typeName,
499
520
  operation,
500
521
  pathParamsType: options.pathParamsType,
501
522
  typeSchemas: type.schemas,
502
- keysFn: options.query.key
523
+ transformer: options.queryKey
503
524
  }
504
525
  ),
505
526
  /* @__PURE__ */ jsxRuntime.jsx(
506
- chunkD5PFCZWQ_cjs.Client,
527
+ chunkFYBD7BZP_cjs.Client,
507
528
  {
508
529
  name: client.name,
509
530
  isExportable: false,
510
531
  isIndexable: false,
511
- baseURL: options.baseURL,
532
+ baseURL: options.client.baseURL,
512
533
  operation,
513
534
  typeSchemas: type.schemas,
514
535
  zodSchemas: zod.schemas,
515
536
  dataReturnType: options.client.dataReturnType,
537
+ paramsType: options.paramsType,
516
538
  pathParamsType: options.pathParamsType,
517
539
  parser: options.parser
518
540
  }
519
541
  ),
520
- /* @__PURE__ */ jsxRuntime.jsx(
521
- chunkD5PFCZWQ_cjs.InfiniteQueryOptions,
522
- {
523
- name: queryOptions.name,
524
- clientName: client.name,
525
- queryKeyName: queryKey.name,
526
- typeSchemas: type.schemas,
527
- pathParamsType: options.pathParamsType,
528
- dataReturnType: options.client.dataReturnType,
529
- cursorParam: options.infinite.cursorParam,
530
- initialPageParam: options.infinite.initialPageParam,
531
- queryParam: options.infinite.queryParam
532
- }
533
- ),
534
- /* @__PURE__ */ jsxRuntime.jsx(
535
- chunkD5PFCZWQ_cjs.InfiniteQuery,
536
- {
537
- name: query.name,
538
- queryOptionsName: queryOptions.name,
539
- typeSchemas: type.schemas,
540
- pathParamsType: options.pathParamsType,
541
- operation,
542
- dataReturnType: options.client.dataReturnType,
543
- queryKeyName: queryKey.name,
544
- queryKeyTypeName: queryKey.typeName
545
- }
546
- )
542
+ options.infinite && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
543
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["InfiniteData"], isTypeOnly: true, path: importPath }),
544
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["infiniteQueryOptions"], path: importPath }),
545
+ /* @__PURE__ */ jsxRuntime.jsx(
546
+ chunkFYBD7BZP_cjs.InfiniteQueryOptions,
547
+ {
548
+ name: queryOptions.name,
549
+ clientName: client.name,
550
+ queryKeyName: queryKey.name,
551
+ typeSchemas: type.schemas,
552
+ paramsType: options.paramsType,
553
+ pathParamsType: options.pathParamsType,
554
+ dataReturnType: options.client.dataReturnType,
555
+ cursorParam: options.infinite.cursorParam,
556
+ initialPageParam: options.infinite.initialPageParam,
557
+ queryParam: options.infinite.queryParam
558
+ }
559
+ )
560
+ ] }),
561
+ options.infinite && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
562
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useInfiniteQuery"], path: importPath }),
563
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "InfiniteQueryObserverOptions", "UseInfiniteQueryResult"], path: importPath, isTypeOnly: true }),
564
+ /* @__PURE__ */ jsxRuntime.jsx(
565
+ chunkFYBD7BZP_cjs.InfiniteQuery,
566
+ {
567
+ name: query.name,
568
+ queryOptionsName: queryOptions.name,
569
+ typeSchemas: type.schemas,
570
+ paramsType: options.paramsType,
571
+ pathParamsType: options.pathParamsType,
572
+ operation,
573
+ dataReturnType: options.client.dataReturnType,
574
+ queryKeyName: queryKey.name,
575
+ queryKeyTypeName: queryKey.typeName
576
+ }
577
+ )
578
+ ] })
547
579
  ] });
548
580
  }
549
581
  });
@@ -556,8 +588,12 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
556
588
  }
557
589
  } = react.useApp();
558
590
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
559
- const isQuery = typeof options.query === "boolean" ? options.query : !!options.query.methods?.some((method) => operation.method === method);
560
- const isSuspense = isQuery && !!options.suspense;
591
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
592
+ const isMutation = remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
593
+ (method) => operation.method === method
594
+ );
595
+ const isSuspense = !!options.suspense;
596
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
561
597
  const query = {
562
598
  name: getName(operation, { type: "function", prefix: "use", suffix: "suspense" }),
563
599
  typeName: getName(operation, { type: "type" }),
@@ -582,13 +618,11 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
582
618
  file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
583
619
  schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
584
620
  };
585
- if (!isQuery || !isSuspense || typeof options.query === "boolean") {
621
+ if (!isQuery || isMutation || !isSuspense) {
586
622
  return null;
587
623
  }
588
624
  return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
589
625
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
590
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useSuspenseQuery", "queryOptions"], path: options.query.importPath }),
591
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "UseSuspenseQueryOptions", "UseSuspenseQueryResult"], path: options.query.importPath, isTypeOnly: true }),
592
626
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
593
627
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
594
628
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
@@ -609,54 +643,62 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
609
643
  }
610
644
  ),
611
645
  /* @__PURE__ */ jsxRuntime.jsx(
612
- chunkD5PFCZWQ_cjs.QueryKey,
646
+ chunkFYBD7BZP_cjs.QueryKey,
613
647
  {
614
648
  name: queryKey.name,
615
649
  typeName: queryKey.typeName,
616
650
  operation,
617
651
  pathParamsType: options.pathParamsType,
618
652
  typeSchemas: type.schemas,
619
- keysFn: options.query.key
653
+ transformer: options.queryKey
620
654
  }
621
655
  ),
622
656
  /* @__PURE__ */ jsxRuntime.jsx(
623
- chunkD5PFCZWQ_cjs.Client,
657
+ chunkFYBD7BZP_cjs.Client,
624
658
  {
625
659
  name: client.name,
626
660
  isExportable: false,
627
661
  isIndexable: false,
628
- baseURL: options.baseURL,
662
+ baseURL: options.client.baseURL,
629
663
  operation,
630
664
  typeSchemas: type.schemas,
631
665
  zodSchemas: zod.schemas,
632
666
  dataReturnType: options.client.dataReturnType,
667
+ paramsType: options.paramsType,
633
668
  pathParamsType: options.pathParamsType,
634
669
  parser: options.parser
635
670
  }
636
671
  ),
672
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
637
673
  /* @__PURE__ */ jsxRuntime.jsx(
638
- chunkD5PFCZWQ_cjs.QueryOptions,
674
+ chunkFYBD7BZP_cjs.QueryOptions,
639
675
  {
640
676
  name: queryOptions.name,
641
677
  clientName: client.name,
642
678
  queryKeyName: queryKey.name,
643
679
  typeSchemas: type.schemas,
680
+ paramsType: options.paramsType,
644
681
  pathParamsType: options.pathParamsType
645
682
  }
646
683
  ),
647
- /* @__PURE__ */ jsxRuntime.jsx(
648
- chunkD5PFCZWQ_cjs.SuspenseQuery,
649
- {
650
- name: query.name,
651
- queryOptionsName: queryOptions.name,
652
- typeSchemas: type.schemas,
653
- pathParamsType: options.pathParamsType,
654
- operation,
655
- dataReturnType: options.client.dataReturnType,
656
- queryKeyName: queryKey.name,
657
- queryKeyTypeName: queryKey.typeName
658
- }
659
- )
684
+ options.suspense && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
685
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useSuspenseQuery"], path: importPath }),
686
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "UseSuspenseQueryOptions", "UseSuspenseQueryResult"], path: importPath, isTypeOnly: true }),
687
+ /* @__PURE__ */ jsxRuntime.jsx(
688
+ chunkFYBD7BZP_cjs.SuspenseQuery,
689
+ {
690
+ name: query.name,
691
+ queryOptionsName: queryOptions.name,
692
+ typeSchemas: type.schemas,
693
+ paramsType: options.paramsType,
694
+ pathParamsType: options.pathParamsType,
695
+ operation,
696
+ dataReturnType: options.client.dataReturnType,
697
+ queryKeyName: queryKey.name,
698
+ queryKeyTypeName: queryKey.typeName
699
+ }
700
+ )
701
+ ] })
660
702
  ] });
661
703
  }
662
704
  });
@@ -665,5 +707,5 @@ exports.infiniteQueryGenerator = infiniteQueryGenerator;
665
707
  exports.mutationGenerator = mutationGenerator;
666
708
  exports.queryGenerator = queryGenerator;
667
709
  exports.suspenseQueryGenerator = suspenseQueryGenerator;
668
- //# sourceMappingURL=chunk-JKG4EZID.cjs.map
669
- //# sourceMappingURL=chunk-JKG4EZID.cjs.map
710
+ //# sourceMappingURL=chunk-WMQRQT7P.cjs.map
711
+ //# sourceMappingURL=chunk-WMQRQT7P.cjs.map