@kubb/plugin-react-query 3.0.0-beta.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{chunk-C2H3KPHM.cjs → chunk-EOG7AHFO.cjs} +276 -44
  2. package/dist/chunk-EOG7AHFO.cjs.map +1 -0
  3. package/dist/{chunk-Y3DM2P6L.js → chunk-EY5KE7R7.js} +276 -44
  4. package/dist/chunk-EY5KE7R7.js.map +1 -0
  5. package/dist/{chunk-3U5EOLDD.cjs → chunk-NBC6BPMV.cjs} +141 -110
  6. package/dist/chunk-NBC6BPMV.cjs.map +1 -0
  7. package/dist/{chunk-ES4YRHDI.js → chunk-NZKAIPYC.js} +130 -99
  8. package/dist/chunk-NZKAIPYC.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 +24 -24
  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 +23 -23
  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 -13
  26. package/src/components/InfiniteQuery.tsx +52 -5
  27. package/src/components/InfiniteQueryOptions.tsx +62 -7
  28. package/src/components/Mutation.tsx +9 -3
  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 +1 -1
  42. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +1 -1
  43. package/src/generators/__snapshots__/postAsQuery.ts +1 -1
  44. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
  45. package/src/generators/infiniteQueryGenerator.tsx +40 -28
  46. package/src/generators/mutationGenerator.tsx +25 -16
  47. package/src/generators/queryGenerator.tsx +24 -17
  48. package/src/generators/suspenseQueryGenerator.tsx +26 -16
  49. package/src/plugin.ts +23 -20
  50. package/src/types.ts +35 -15
  51. package/dist/chunk-3U5EOLDD.cjs.map +0 -1
  52. package/dist/chunk-C2H3KPHM.cjs.map +0 -1
  53. package/dist/chunk-ES4YRHDI.js.map +0 -1
  54. package/dist/chunk-Y3DM2P6L.js.map +0 -1
@@ -7,12 +7,40 @@ var utils$1 = require('@kubb/plugin-oas/utils');
7
7
  var jsxRuntime = require('@kubb/react/jsx-runtime');
8
8
 
9
9
  // src/components/Mutation.tsx
10
- function getParams({ pathParamsType, typeSchemas }) {
10
+ function getParams({ paramsType, pathParamsType, typeSchemas }) {
11
+ if (paramsType === "object") {
12
+ return react.FunctionParams.factory({
13
+ data: {
14
+ mode: "object",
15
+ children: {
16
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
17
+ data: typeSchemas.request?.name ? {
18
+ type: typeSchemas.request?.name,
19
+ optional: oas.isOptional(typeSchemas.request?.schema)
20
+ } : void 0,
21
+ params: typeSchemas.queryParams?.name ? {
22
+ type: typeSchemas.queryParams?.name,
23
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
24
+ } : void 0,
25
+ headers: typeSchemas.headerParams?.name ? {
26
+ type: typeSchemas.headerParams?.name,
27
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
28
+ } : void 0
29
+ }
30
+ },
31
+ config: {
32
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
33
+ default: "{}"
34
+ }
35
+ });
36
+ }
11
37
  return react.FunctionParams.factory({
12
- pathParams: {
38
+ pathParams: typeSchemas.pathParams?.name ? {
13
39
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
14
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
15
- },
40
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
41
+ type: typeSchemas.pathParams?.name,
42
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
43
+ } : void 0,
16
44
  data: typeSchemas.request?.name ? {
17
45
  type: typeSchemas.request?.name,
18
46
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -40,6 +68,7 @@ function Client({
40
68
  dataReturnType,
41
69
  parser,
42
70
  zodSchemas,
71
+ paramsType,
43
72
  pathParamsType,
44
73
  operation
45
74
  }) {
@@ -55,7 +84,7 @@ function Client({
55
84
  typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error",
56
85
  typeSchemas.request?.name || "unknown"
57
86
  ].filter(Boolean);
58
- const params = getParams({ pathParamsType, typeSchemas });
87
+ const params = getParams({ paramsType, pathParamsType, typeSchemas });
59
88
  const clientParams = react.FunctionParams.factory({
60
89
  config: {
61
90
  mode: "object",
@@ -129,16 +158,20 @@ function Operations({ name, operations }) {
129
158
  function getParams2({}) {
130
159
  return react.FunctionParams.factory({});
131
160
  }
132
- function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, keysFn = (name2) => name2 }) {
161
+ var getTransformer = ({ operation }) => {
133
162
  const path = new utils.URLPath(operation.path);
163
+ return [JSON.stringify({ url: path.path })].filter(Boolean);
164
+ };
165
+ function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }) {
134
166
  const params = getParams2({ pathParamsType, typeSchemas });
135
- const keys = [JSON.stringify({ url: path.path })].filter(Boolean);
167
+ const keys = transformer({ operation, schemas: typeSchemas });
136
168
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
137
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keysFn(keys).join(", ")}] as const` }) }),
169
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
138
170
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
139
171
  ] });
140
172
  }
141
173
  MutationKey.getParams = getParams2;
174
+ MutationKey.getTransformer = getTransformer;
142
175
  function getParams3({ dataReturnType, typeSchemas }) {
143
176
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
144
177
  const mutationParams = react.FunctionParams.factory({
@@ -157,7 +190,7 @@ function getParams3({ dataReturnType, typeSchemas }) {
157
190
  } : void 0
158
191
  });
159
192
  const TRequest = mutationParams.toConstructor({ valueAsType: true });
160
- const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", `{${TRequest}}`].join(", ");
193
+ const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
161
194
  return react.FunctionParams.factory({
162
195
  options: {
163
196
  type: `
@@ -170,7 +203,7 @@ function getParams3({ dataReturnType, typeSchemas }) {
170
203
  }
171
204
  });
172
205
  }
173
- function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
206
+ function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
174
207
  const mutationKeyParams = MutationKey.getParams({
175
208
  pathParamsType,
176
209
  typeSchemas
@@ -181,6 +214,7 @@ function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchema
181
214
  typeSchemas
182
215
  });
183
216
  const clientParams = Client.getParams({
217
+ paramsType,
184
218
  typeSchemas,
185
219
  pathParamsType
186
220
  });
@@ -217,7 +251,7 @@ function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchema
217
251
  });
218
252
  const TRequest = mutationParams.toConstructor({ valueAsType: true });
219
253
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
220
- const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", `{${TRequest}}`].join(", ");
254
+ const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
221
255
  return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(
222
256
  react.Function,
223
257
  {
@@ -258,29 +292,65 @@ function getParams4({ pathParamsType, typeSchemas }) {
258
292
  } : void 0
259
293
  });
260
294
  }
261
- function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, keysFn = (name2) => name2 }) {
295
+ var getTransformer2 = ({ operation, schemas }) => {
262
296
  const path = new utils.URLPath(operation.path);
263
- const params = getParams4({ pathParamsType, typeSchemas });
264
297
  const keys = [
265
298
  path.toObject({
266
299
  type: "path",
267
300
  stringify: true
268
301
  }),
269
- typeSchemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
270
- typeSchemas.request?.name ? "...(data ? [data] : [])" : void 0
302
+ schemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
303
+ schemas.request?.name ? "...(data ? [data] : [])" : void 0
271
304
  ].filter(Boolean);
305
+ return keys;
306
+ };
307
+ function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
308
+ const params = getParams4({ pathParamsType, typeSchemas });
309
+ const keys = transformer({
310
+ operation,
311
+ schemas: typeSchemas
312
+ });
272
313
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
273
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keysFn(keys).join(", ")}] as const` }) }),
314
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
274
315
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
275
316
  ] });
276
317
  }
277
318
  QueryKey.getParams = getParams4;
278
- function getParams5({ pathParamsType, typeSchemas }) {
319
+ QueryKey.getTransformer = getTransformer2;
320
+ function getParams5({ paramsType, pathParamsType, typeSchemas }) {
321
+ if (paramsType === "object") {
322
+ return react.FunctionParams.factory({
323
+ data: {
324
+ mode: "object",
325
+ children: {
326
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
327
+ data: typeSchemas.request?.name ? {
328
+ type: typeSchemas.request?.name,
329
+ optional: oas.isOptional(typeSchemas.request?.schema)
330
+ } : void 0,
331
+ params: typeSchemas.queryParams?.name ? {
332
+ type: typeSchemas.queryParams?.name,
333
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
334
+ } : void 0,
335
+ headers: typeSchemas.headerParams?.name ? {
336
+ type: typeSchemas.headerParams?.name,
337
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
338
+ } : void 0
339
+ }
340
+ },
341
+ config: {
342
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
343
+ default: "{}"
344
+ }
345
+ });
346
+ }
279
347
  return react.FunctionParams.factory({
280
- pathParams: {
348
+ pathParams: typeSchemas.pathParams?.name ? {
281
349
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
282
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
283
- },
350
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
351
+ type: typeSchemas.pathParams?.name,
352
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
353
+ } : void 0,
284
354
  data: typeSchemas.request?.name ? {
285
355
  type: typeSchemas.request?.name,
286
356
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -299,10 +369,11 @@ function getParams5({ pathParamsType, typeSchemas }) {
299
369
  }
300
370
  });
301
371
  }
302
- function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }) {
303
- const params = getParams5({ pathParamsType, typeSchemas });
372
+ function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }) {
373
+ const params = getParams5({ paramsType, pathParamsType, typeSchemas });
304
374
  const clientParams = Client.getParams({
305
375
  typeSchemas,
376
+ paramsType,
306
377
  pathParamsType
307
378
  });
308
379
  const queryKeyParams = QueryKey.getParams({
@@ -324,13 +395,46 @@ function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyN
324
395
  ` }) });
325
396
  }
326
397
  QueryOptions.getParams = getParams5;
327
- function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
398
+ function getParams6({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
328
399
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
400
+ if (paramsType === "object") {
401
+ return react.FunctionParams.factory({
402
+ data: {
403
+ mode: "object",
404
+ children: {
405
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
406
+ data: typeSchemas.request?.name ? {
407
+ type: typeSchemas.request?.name,
408
+ optional: oas.isOptional(typeSchemas.request?.schema)
409
+ } : void 0,
410
+ params: typeSchemas.queryParams?.name ? {
411
+ type: typeSchemas.queryParams?.name,
412
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
413
+ } : void 0,
414
+ headers: typeSchemas.headerParams?.name ? {
415
+ type: typeSchemas.headerParams?.name,
416
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
417
+ } : void 0
418
+ }
419
+ },
420
+ options: {
421
+ type: `
422
+ {
423
+ query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
424
+ client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
425
+ }
426
+ `,
427
+ default: "{}"
428
+ }
429
+ });
430
+ }
329
431
  return react.FunctionParams.factory({
330
- pathParams: {
432
+ pathParams: typeSchemas.pathParams?.name ? {
331
433
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
332
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
333
- },
434
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
435
+ type: typeSchemas.pathParams?.name,
436
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
437
+ } : void 0,
334
438
  data: typeSchemas.request?.name ? {
335
439
  type: typeSchemas.request?.name,
336
440
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -354,7 +458,17 @@ function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
354
458
  }
355
459
  });
356
460
  }
357
- function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }) {
461
+ function Query({
462
+ name,
463
+ queryKeyTypeName,
464
+ queryOptionsName,
465
+ queryKeyName,
466
+ paramsType,
467
+ pathParamsType,
468
+ dataReturnType,
469
+ typeSchemas,
470
+ operation
471
+ }) {
358
472
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
359
473
  const returnType = `UseQueryResult<${["TData", typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"].join(", ")}> & { queryKey: TQueryKey }`;
360
474
  const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`];
@@ -363,10 +477,12 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
363
477
  typeSchemas
364
478
  });
365
479
  const queryOptionsParams = QueryOptions.getParams({
480
+ paramsType,
366
481
  pathParamsType,
367
482
  typeSchemas
368
483
  });
369
484
  const params = getParams6({
485
+ paramsType,
370
486
  pathParamsType,
371
487
  dataReturnType,
372
488
  typeSchemas
@@ -400,12 +516,40 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
400
516
  ) });
401
517
  }
402
518
  Query.getParams = getParams6;
403
- function getParams7({ pathParamsType, typeSchemas }) {
519
+ function getParams7({ paramsType, pathParamsType, typeSchemas }) {
520
+ if (paramsType === "object") {
521
+ return react.FunctionParams.factory({
522
+ data: {
523
+ mode: "object",
524
+ children: {
525
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
526
+ data: typeSchemas.request?.name ? {
527
+ type: typeSchemas.request?.name,
528
+ optional: oas.isOptional(typeSchemas.request?.schema)
529
+ } : void 0,
530
+ params: typeSchemas.queryParams?.name ? {
531
+ type: typeSchemas.queryParams?.name,
532
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
533
+ } : void 0,
534
+ headers: typeSchemas.headerParams?.name ? {
535
+ type: typeSchemas.headerParams?.name,
536
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
537
+ } : void 0
538
+ }
539
+ },
540
+ config: {
541
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
542
+ default: "{}"
543
+ }
544
+ });
545
+ }
404
546
  return react.FunctionParams.factory({
405
- pathParams: {
547
+ pathParams: typeSchemas.pathParams?.name ? {
406
548
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
407
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
408
- },
549
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
550
+ type: typeSchemas.pathParams?.name,
551
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
552
+ } : void 0,
409
553
  data: typeSchemas.request?.name ? {
410
554
  type: typeSchemas.request?.name,
411
555
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -430,14 +574,16 @@ function InfiniteQueryOptions({
430
574
  initialPageParam,
431
575
  cursorParam,
432
576
  typeSchemas,
577
+ paramsType,
433
578
  dataReturnType,
434
579
  pathParamsType,
435
580
  queryParam,
436
581
  queryKeyName
437
582
  }) {
438
- const params = getParams7({ pathParamsType, typeSchemas });
583
+ const params = getParams7({ paramsType, pathParamsType, typeSchemas });
439
584
  const clientParams = Client.getParams({
440
585
  typeSchemas,
586
+ paramsType,
441
587
  pathParamsType
442
588
  });
443
589
  const queryKeyParams = QueryKey.getParams({
@@ -458,7 +604,8 @@ function InfiniteQueryOptions({
458
604
  }` : "";
459
605
  const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
460
606
  const enabledText = enabled ? `enabled: !!(${enabled})` : "";
461
- return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { name, export: true, params: params.toConstructor(), children: `
607
+ return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsxs(react.Function, { name, export: true, params: params.toConstructor(), children: [
608
+ infiniteOverrideParams && `
462
609
  const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
463
610
  return infiniteQueryOptions({
464
611
  ${enabledText}
@@ -470,16 +617,62 @@ function InfiniteQueryOptions({
470
617
  },
471
618
  ${queryOptions.join("\n")}
472
619
  })
473
- ` }) });
620
+ `,
621
+ !infiniteOverrideParams && `
622
+ const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
623
+ return infiniteQueryOptions({
624
+ ${enabledText}
625
+ queryKey,
626
+ queryFn: async ({ signal }) => {
627
+ config.signal = signal
628
+ return ${clientName}(${clientParams.toCall()})
629
+ },
630
+ ${queryOptions.join("\n")}
631
+ })
632
+ `
633
+ ] }) });
474
634
  }
475
635
  InfiniteQueryOptions.getParams = getParams7;
476
- function getParams8({ pathParamsType, dataReturnType, typeSchemas }) {
636
+ function getParams8({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
477
637
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
638
+ if (paramsType === "object") {
639
+ return react.FunctionParams.factory({
640
+ data: {
641
+ mode: "object",
642
+ children: {
643
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
644
+ data: typeSchemas.request?.name ? {
645
+ type: typeSchemas.request?.name,
646
+ optional: oas.isOptional(typeSchemas.request?.schema)
647
+ } : void 0,
648
+ params: typeSchemas.queryParams?.name ? {
649
+ type: typeSchemas.queryParams?.name,
650
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
651
+ } : void 0,
652
+ headers: typeSchemas.headerParams?.name ? {
653
+ type: typeSchemas.headerParams?.name,
654
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
655
+ } : void 0
656
+ }
657
+ },
658
+ options: {
659
+ type: `
660
+ {
661
+ query?: Partial<InfiniteQueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
662
+ client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
663
+ }
664
+ `,
665
+ default: "{}"
666
+ }
667
+ });
668
+ }
478
669
  return react.FunctionParams.factory({
479
- pathParams: {
670
+ pathParams: typeSchemas.pathParams?.name ? {
480
671
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
481
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
482
- },
672
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
673
+ type: typeSchemas.pathParams?.name,
674
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
675
+ } : void 0,
483
676
  data: typeSchemas.request?.name ? {
484
677
  type: typeSchemas.request?.name,
485
678
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -508,6 +701,7 @@ function InfiniteQuery({
508
701
  queryKeyTypeName,
509
702
  queryOptionsName,
510
703
  queryKeyName,
704
+ paramsType,
511
705
  pathParamsType,
512
706
  dataReturnType,
513
707
  typeSchemas,
@@ -521,10 +715,12 @@ function InfiniteQuery({
521
715
  typeSchemas
522
716
  });
523
717
  const queryOptionsParams = QueryOptions.getParams({
718
+ paramsType,
524
719
  pathParamsType,
525
720
  typeSchemas
526
721
  });
527
722
  const params = getParams8({
723
+ paramsType,
528
724
  pathParamsType,
529
725
  dataReturnType,
530
726
  typeSchemas
@@ -558,13 +754,46 @@ function InfiniteQuery({
558
754
  ) });
559
755
  }
560
756
  InfiniteQuery.getParams = getParams8;
561
- function getParams9({ pathParamsType, dataReturnType, typeSchemas }) {
757
+ function getParams9({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
562
758
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
759
+ if (paramsType === "object") {
760
+ return react.FunctionParams.factory({
761
+ data: {
762
+ mode: "object",
763
+ children: {
764
+ ...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
765
+ data: typeSchemas.request?.name ? {
766
+ type: typeSchemas.request?.name,
767
+ optional: oas.isOptional(typeSchemas.request?.schema)
768
+ } : void 0,
769
+ params: typeSchemas.queryParams?.name ? {
770
+ type: typeSchemas.queryParams?.name,
771
+ optional: oas.isOptional(typeSchemas.queryParams?.schema)
772
+ } : void 0,
773
+ headers: typeSchemas.headerParams?.name ? {
774
+ type: typeSchemas.headerParams?.name,
775
+ optional: oas.isOptional(typeSchemas.headerParams?.schema)
776
+ } : void 0
777
+ }
778
+ },
779
+ options: {
780
+ type: `
781
+ {
782
+ query?: Partial<UseSuspenseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryKey"].join(", ")}>>,
783
+ client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
784
+ }
785
+ `,
786
+ default: "{}"
787
+ }
788
+ });
789
+ }
563
790
  return react.FunctionParams.factory({
564
- pathParams: {
791
+ pathParams: typeSchemas.pathParams?.name ? {
565
792
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
566
- children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
567
- },
793
+ children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
794
+ type: typeSchemas.pathParams?.name,
795
+ optional: oas.isOptional(typeSchemas.pathParams?.schema)
796
+ } : void 0,
568
797
  data: typeSchemas.request?.name ? {
569
798
  type: typeSchemas.request?.name,
570
799
  optional: oas.isOptional(typeSchemas.request?.schema)
@@ -593,6 +822,7 @@ function SuspenseQuery({
593
822
  queryKeyTypeName,
594
823
  queryOptionsName,
595
824
  queryKeyName,
825
+ paramsType,
596
826
  pathParamsType,
597
827
  dataReturnType,
598
828
  typeSchemas,
@@ -606,10 +836,12 @@ function SuspenseQuery({
606
836
  typeSchemas
607
837
  });
608
838
  const queryOptionsParams = QueryOptions.getParams({
839
+ paramsType,
609
840
  pathParamsType,
610
841
  typeSchemas
611
842
  });
612
843
  const params = getParams9({
844
+ paramsType,
613
845
  pathParamsType,
614
846
  dataReturnType,
615
847
  typeSchemas
@@ -654,5 +886,5 @@ exports.Query = Query;
654
886
  exports.QueryKey = QueryKey;
655
887
  exports.QueryOptions = QueryOptions;
656
888
  exports.SuspenseQuery = SuspenseQuery;
657
- //# sourceMappingURL=chunk-C2H3KPHM.cjs.map
658
- //# sourceMappingURL=chunk-C2H3KPHM.cjs.map
889
+ //# sourceMappingURL=chunk-EOG7AHFO.cjs.map
890
+ //# sourceMappingURL=chunk-EOG7AHFO.cjs.map