@kubb/plugin-react-query 4.15.0 → 4.15.2

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 (55) hide show
  1. package/dist/{components-CX83mklO.js → components-DVc9iach.js} +261 -218
  2. package/dist/components-DVc9iach.js.map +1 -0
  3. package/dist/{components-7ul5AP_u.cjs → components-YtTYHVwV.cjs} +261 -218
  4. package/dist/components-YtTYHVwV.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.js +1 -1
  7. package/dist/{generators-CNv1RI1y.cjs → generators-C6VGGGTj.cjs} +2 -2
  8. package/dist/{generators-CNv1RI1y.cjs.map → generators-C6VGGGTj.cjs.map} +1 -1
  9. package/dist/{generators-CVc1Qlnh.js → generators-DzaRYGiz.js} +2 -2
  10. package/dist/{generators-CVc1Qlnh.js.map → generators-DzaRYGiz.js.map} +1 -1
  11. package/dist/generators.cjs +1 -1
  12. package/dist/generators.js +1 -1
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.js +2 -2
  15. package/package.json +9 -9
  16. package/src/components/InfiniteQuery.tsx +35 -30
  17. package/src/components/InfiniteQueryOptions.tsx +38 -27
  18. package/src/components/Mutation.tsx +3 -1
  19. package/src/components/MutationOptions.tsx +2 -2
  20. package/src/components/Query.tsx +31 -23
  21. package/src/components/QueryKey.tsx +8 -6
  22. package/src/components/QueryOptions.tsx +48 -26
  23. package/src/components/SuspenseInfiniteQuery.tsx +31 -26
  24. package/src/components/SuspenseInfiniteQueryOptions.tsx +38 -27
  25. package/src/components/SuspenseQuery.tsx +35 -24
  26. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
  27. package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
  28. package/src/generators/__snapshots__/clientPostImportPath.ts +4 -2
  29. package/src/generators/__snapshots__/findByStatusAllOptional.ts +82 -0
  30. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +76 -0
  31. package/src/generators/__snapshots__/findByTags.ts +1 -1
  32. package/src/generators/__snapshots__/findByTagsObject.ts +1 -1
  33. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
  34. package/src/generators/__snapshots__/findByTagsTemplateString.ts +1 -1
  35. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +1 -1
  36. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +1 -1
  37. package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
  38. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +97 -0
  39. package/src/generators/__snapshots__/findInfiniteByTags.ts +1 -1
  40. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +1 -1
  41. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +1 -1
  42. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +1 -1
  43. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +79 -0
  44. package/src/generators/__snapshots__/findSuspenseByTags.ts +1 -1
  45. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +1 -1
  46. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +97 -0
  47. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +2 -1
  48. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +2 -1
  49. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +2 -1
  50. package/src/generators/__snapshots__/postAsQuery.ts +2 -2
  51. package/src/generators/__snapshots__/updatePetById.ts +4 -2
  52. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +4 -2
  53. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +4 -2
  54. package/dist/components-7ul5AP_u.cjs.map +0 -1
  55. package/dist/components-CX83mklO.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_generators = require('./generators-CNv1RI1y.cjs');
1
+ const require_generators = require('./generators-C6VGGGTj.cjs');
2
2
  let _kubb_core_utils = require("@kubb/core/utils");
3
3
  let _kubb_oas = require("@kubb/oas");
4
4
  let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
@@ -9,20 +9,20 @@ let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
9
9
  //#region src/components/QueryKey.tsx
10
10
  function getParams$10({ pathParamsType, paramsCasing, typeSchemas }) {
11
11
  return _kubb_react_fabric.FunctionParams.factory({
12
- pathParams: {
12
+ pathParams: typeSchemas.pathParams?.name ? {
13
13
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
14
14
  children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
15
15
  typed: true,
16
16
  casing: paramsCasing
17
17
  })
18
- },
18
+ } : void 0,
19
19
  data: typeSchemas.request?.name ? {
20
20
  type: typeSchemas.request?.name,
21
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
21
+ default: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema) ? "{}" : void 0
22
22
  } : void 0,
23
23
  params: typeSchemas.queryParams?.name ? {
24
24
  type: typeSchemas.queryParams?.name,
25
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
25
+ default: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema) ? "{}" : void 0
26
26
  } : void 0
27
27
  });
28
28
  }
@@ -76,33 +76,38 @@ QueryKey.getTransformer = getTransformer$1;
76
76
  //#endregion
77
77
  //#region src/components/QueryOptions.tsx
78
78
  function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
79
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
80
- data: {
81
- mode: "object",
82
- children: {
83
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
84
- typed: true,
85
- casing: paramsCasing
86
- }),
87
- data: typeSchemas.request?.name ? {
88
- type: typeSchemas.request?.name,
89
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
90
- } : void 0,
91
- params: typeSchemas.queryParams?.name ? {
92
- type: typeSchemas.queryParams?.name,
93
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
94
- } : void 0,
95
- headers: typeSchemas.headerParams?.name ? {
96
- type: typeSchemas.headerParams?.name,
97
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
98
- } : void 0
79
+ if (paramsType === "object") {
80
+ const children = {
81
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
82
+ typed: true,
83
+ casing: paramsCasing
84
+ }),
85
+ data: typeSchemas.request?.name ? {
86
+ type: typeSchemas.request?.name,
87
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
88
+ } : void 0,
89
+ params: typeSchemas.queryParams?.name ? {
90
+ type: typeSchemas.queryParams?.name,
91
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
92
+ } : void 0,
93
+ headers: typeSchemas.headerParams?.name ? {
94
+ type: typeSchemas.headerParams?.name,
95
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
96
+ } : void 0
97
+ };
98
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
99
+ return _kubb_react_fabric.FunctionParams.factory({
100
+ data: {
101
+ mode: "object",
102
+ children,
103
+ default: allChildrenAreOptional ? "{}" : void 0
104
+ },
105
+ config: {
106
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
107
+ default: "{}"
99
108
  }
100
- },
101
- config: {
102
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
103
- default: "{}"
104
- }
105
- });
109
+ });
110
+ }
106
111
  return _kubb_react_fabric.FunctionParams.factory({
107
112
  pathParams: typeSchemas.pathParams?.name ? {
108
113
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -110,7 +115,7 @@ function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas })
110
115
  typed: true,
111
116
  casing: paramsCasing
112
117
  }),
113
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
118
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
114
119
  } : void 0,
115
120
  data: typeSchemas.request?.name ? {
116
121
  type: typeSchemas.request?.name,
@@ -151,7 +156,9 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
151
156
  typeSchemas,
152
157
  paramsCasing
153
158
  });
154
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
159
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
160
+ return item && !item.optional && !item.default ? key : void 0;
161
+ }).filter(Boolean).join("&& ");
155
162
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
156
163
  return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
157
164
  name,
@@ -180,38 +187,43 @@ QueryOptions.getParams = getParams$9;
180
187
  //#endregion
181
188
  //#region src/components/InfiniteQuery.tsx
182
189
  function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
183
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
184
- data: {
185
- mode: "object",
186
- children: {
187
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
188
- typed: true,
189
- casing: paramsCasing
190
- }),
191
- data: typeSchemas.request?.name ? {
192
- type: typeSchemas.request?.name,
193
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
194
- } : void 0,
195
- params: typeSchemas.queryParams?.name ? {
196
- type: typeSchemas.queryParams?.name,
197
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
198
- } : void 0,
199
- headers: typeSchemas.headerParams?.name ? {
200
- type: typeSchemas.headerParams?.name,
201
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
202
- } : void 0
203
- }
204
- },
205
- options: {
206
- type: `
190
+ if (paramsType === "object") {
191
+ const children = {
192
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
193
+ typed: true,
194
+ casing: paramsCasing
195
+ }),
196
+ data: typeSchemas.request?.name ? {
197
+ type: typeSchemas.request?.name,
198
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
199
+ } : void 0,
200
+ params: typeSchemas.queryParams?.name ? {
201
+ type: typeSchemas.queryParams?.name,
202
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
203
+ } : void 0,
204
+ headers: typeSchemas.headerParams?.name ? {
205
+ type: typeSchemas.headerParams?.name,
206
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
207
+ } : void 0
208
+ };
209
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
210
+ return _kubb_react_fabric.FunctionParams.factory({
211
+ data: {
212
+ mode: "object",
213
+ children,
214
+ default: allChildrenAreOptional ? "{}" : void 0
215
+ },
216
+ options: {
217
+ type: `
207
218
  {
208
219
  query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
209
220
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
210
221
  }
211
222
  `,
212
- default: "{}"
213
- }
214
- });
223
+ default: "{}"
224
+ }
225
+ });
226
+ }
215
227
  return _kubb_react_fabric.FunctionParams.factory({
216
228
  pathParams: typeSchemas.pathParams?.name ? {
217
229
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -219,7 +231,7 @@ function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
219
231
  typed: true,
220
232
  casing: paramsCasing
221
233
  }),
222
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
234
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
223
235
  } : void 0,
224
236
  data: typeSchemas.request?.name ? {
225
237
  type: typeSchemas.request?.name,
@@ -315,33 +327,38 @@ InfiniteQuery.getParams = getParams$8;
315
327
  //#endregion
316
328
  //#region src/components/InfiniteQueryOptions.tsx
317
329
  function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
318
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
319
- data: {
320
- mode: "object",
321
- children: {
322
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
323
- typed: true,
324
- casing: paramsCasing
325
- }),
326
- data: typeSchemas.request?.name ? {
327
- type: typeSchemas.request?.name,
328
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
329
- } : void 0,
330
- params: typeSchemas.queryParams?.name ? {
331
- type: typeSchemas.queryParams?.name,
332
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
333
- } : void 0,
334
- headers: typeSchemas.headerParams?.name ? {
335
- type: typeSchemas.headerParams?.name,
336
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
337
- } : void 0
330
+ if (paramsType === "object") {
331
+ const children = {
332
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
333
+ typed: true,
334
+ casing: paramsCasing
335
+ }),
336
+ data: typeSchemas.request?.name ? {
337
+ type: typeSchemas.request?.name,
338
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
339
+ } : void 0,
340
+ params: typeSchemas.queryParams?.name ? {
341
+ type: typeSchemas.queryParams?.name,
342
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
343
+ } : void 0,
344
+ headers: typeSchemas.headerParams?.name ? {
345
+ type: typeSchemas.headerParams?.name,
346
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
347
+ } : void 0
348
+ };
349
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
350
+ return _kubb_react_fabric.FunctionParams.factory({
351
+ data: {
352
+ mode: "object",
353
+ children,
354
+ default: allChildrenAreOptional ? "{}" : void 0
355
+ },
356
+ config: {
357
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
358
+ default: "{}"
338
359
  }
339
- },
340
- config: {
341
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
342
- default: "{}"
343
- }
344
- });
360
+ });
361
+ }
345
362
  return _kubb_react_fabric.FunctionParams.factory({
346
363
  pathParams: typeSchemas.pathParams?.name ? {
347
364
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -349,7 +366,7 @@ function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas })
349
366
  typed: true,
350
367
  casing: paramsCasing
351
368
  }),
352
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
369
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
353
370
  } : void 0,
354
371
  data: typeSchemas.request?.name ? {
355
372
  type: typeSchemas.request?.name,
@@ -427,7 +444,9 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
427
444
  ...(params ?? {}),
428
445
  ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
429
446
  } as ${typeSchemas.queryParams?.name}` : "";
430
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
447
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
448
+ return item && !item.optional && !item.default ? key : void 0;
449
+ }).filter(Boolean).join("&& ");
431
450
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
432
451
  if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
433
452
  name,
@@ -581,9 +600,10 @@ function MutationOptions({ name, clientName, dataReturnType, typeSchemas, params
581
600
  name,
582
601
  export: true,
583
602
  params: params.toConstructor(),
603
+ generics: ["TContext = unknown"],
584
604
  children: `
585
605
  const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})
586
- return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : "void"}, typeof mutationKey>({
606
+ return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : "void"}, TContext>({
587
607
  mutationKey,
588
608
  mutationFn: async(${dataParams.toConstructor()}) => {
589
609
  return ${clientName}(${clientParams.toCall()})
@@ -599,11 +619,12 @@ MutationOptions.getParams = getParams$5;
599
619
  //#region src/components/Mutation.tsx
600
620
  function getParams$4({ paramsCasing, dataReturnType, typeSchemas }) {
601
621
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
622
+ const pathParams = (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
623
+ typed: true,
624
+ casing: paramsCasing
625
+ });
602
626
  const TRequest = _kubb_react_fabric.FunctionParams.factory({
603
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
604
- typed: true,
605
- casing: paramsCasing
606
- }),
627
+ ...pathParams,
607
628
  data: typeSchemas.request?.name ? {
608
629
  type: typeSchemas.request?.name,
609
630
  optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
@@ -705,44 +726,49 @@ function Mutation({ name, mutationOptionsName, paramsCasing, pathParamsType, dat
705
726
  function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
706
727
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
707
728
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
708
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
709
- data: {
710
- mode: "object",
711
- children: {
712
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
713
- typed: true,
714
- casing: paramsCasing
715
- }),
716
- data: typeSchemas.request?.name ? {
717
- type: typeSchemas.request?.name,
718
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
719
- } : void 0,
720
- params: typeSchemas.queryParams?.name ? {
721
- type: typeSchemas.queryParams?.name,
722
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
723
- } : void 0,
724
- headers: typeSchemas.headerParams?.name ? {
725
- type: typeSchemas.headerParams?.name,
726
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
727
- } : void 0
728
- }
729
- },
730
- options: {
731
- type: `
729
+ if (paramsType === "object") {
730
+ const children = {
731
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
732
+ typed: true,
733
+ casing: paramsCasing
734
+ }),
735
+ data: typeSchemas.request?.name ? {
736
+ type: typeSchemas.request?.name,
737
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
738
+ } : void 0,
739
+ params: typeSchemas.queryParams?.name ? {
740
+ type: typeSchemas.queryParams?.name,
741
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
742
+ } : void 0,
743
+ headers: typeSchemas.headerParams?.name ? {
744
+ type: typeSchemas.headerParams?.name,
745
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
746
+ } : void 0
747
+ };
748
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
749
+ return _kubb_react_fabric.FunctionParams.factory({
750
+ data: {
751
+ mode: "object",
752
+ children,
753
+ default: allChildrenAreOptional ? "{}" : void 0
754
+ },
755
+ options: {
756
+ type: `
732
757
  {
733
758
  query?: Partial<QueryObserverOptions<${[
734
- TData,
735
- TError,
736
- "TData",
737
- "TQueryData",
738
- "TQueryKey"
739
- ].join(", ")}>> & { client?: QueryClient },
759
+ TData,
760
+ TError,
761
+ "TData",
762
+ "TQueryData",
763
+ "TQueryKey"
764
+ ].join(", ")}>> & { client?: QueryClient },
740
765
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
741
766
  }
742
767
  `,
743
- default: "{}"
744
- }
745
- });
768
+ default: "{}"
769
+ }
770
+ });
771
+ }
746
772
  return _kubb_react_fabric.FunctionParams.factory({
747
773
  pathParams: typeSchemas.pathParams?.name ? {
748
774
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -750,7 +776,7 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType,
750
776
  typed: true,
751
777
  casing: paramsCasing
752
778
  }),
753
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
779
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
754
780
  } : void 0,
755
781
  data: typeSchemas.request?.name ? {
756
782
  type: typeSchemas.request?.name,
@@ -842,38 +868,43 @@ Query.getParams = getParams$3;
842
868
  //#endregion
843
869
  //#region src/components/SuspenseInfiniteQuery.tsx
844
870
  function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
845
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
846
- data: {
847
- mode: "object",
848
- children: {
849
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
850
- typed: true,
851
- casing: paramsCasing
852
- }),
853
- data: typeSchemas.request?.name ? {
854
- type: typeSchemas.request?.name,
855
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
856
- } : void 0,
857
- params: typeSchemas.queryParams?.name ? {
858
- type: typeSchemas.queryParams?.name,
859
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
860
- } : void 0,
861
- headers: typeSchemas.headerParams?.name ? {
862
- type: typeSchemas.headerParams?.name,
863
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
864
- } : void 0
865
- }
866
- },
867
- options: {
868
- type: `
871
+ if (paramsType === "object") {
872
+ const children = {
873
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
874
+ typed: true,
875
+ casing: paramsCasing
876
+ }),
877
+ data: typeSchemas.request?.name ? {
878
+ type: typeSchemas.request?.name,
879
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
880
+ } : void 0,
881
+ params: typeSchemas.queryParams?.name ? {
882
+ type: typeSchemas.queryParams?.name,
883
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
884
+ } : void 0,
885
+ headers: typeSchemas.headerParams?.name ? {
886
+ type: typeSchemas.headerParams?.name,
887
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
888
+ } : void 0
889
+ };
890
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
891
+ return _kubb_react_fabric.FunctionParams.factory({
892
+ data: {
893
+ mode: "object",
894
+ children,
895
+ default: allChildrenAreOptional ? "{}" : void 0
896
+ },
897
+ options: {
898
+ type: `
869
899
  {
870
900
  query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
871
901
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
872
902
  }
873
903
  `,
874
- default: "{}"
875
- }
876
- });
904
+ default: "{}"
905
+ }
906
+ });
907
+ }
877
908
  return _kubb_react_fabric.FunctionParams.factory({
878
909
  pathParams: typeSchemas.pathParams?.name ? {
879
910
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -881,7 +912,7 @@ function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
881
912
  typed: true,
882
913
  casing: paramsCasing
883
914
  }),
884
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
915
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
885
916
  } : void 0,
886
917
  data: typeSchemas.request?.name ? {
887
918
  type: typeSchemas.request?.name,
@@ -977,33 +1008,38 @@ SuspenseInfiniteQuery.getParams = getParams$2;
977
1008
  //#endregion
978
1009
  //#region src/components/SuspenseInfiniteQueryOptions.tsx
979
1010
  function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
980
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
981
- data: {
982
- mode: "object",
983
- children: {
984
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
985
- typed: true,
986
- casing: paramsCasing
987
- }),
988
- data: typeSchemas.request?.name ? {
989
- type: typeSchemas.request?.name,
990
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
991
- } : void 0,
992
- params: typeSchemas.queryParams?.name ? {
993
- type: typeSchemas.queryParams?.name,
994
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
995
- } : void 0,
996
- headers: typeSchemas.headerParams?.name ? {
997
- type: typeSchemas.headerParams?.name,
998
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
999
- } : void 0
1011
+ if (paramsType === "object") {
1012
+ const children = {
1013
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
1014
+ typed: true,
1015
+ casing: paramsCasing
1016
+ }),
1017
+ data: typeSchemas.request?.name ? {
1018
+ type: typeSchemas.request?.name,
1019
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
1020
+ } : void 0,
1021
+ params: typeSchemas.queryParams?.name ? {
1022
+ type: typeSchemas.queryParams?.name,
1023
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
1024
+ } : void 0,
1025
+ headers: typeSchemas.headerParams?.name ? {
1026
+ type: typeSchemas.headerParams?.name,
1027
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
1028
+ } : void 0
1029
+ };
1030
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
1031
+ return _kubb_react_fabric.FunctionParams.factory({
1032
+ data: {
1033
+ mode: "object",
1034
+ children,
1035
+ default: allChildrenAreOptional ? "{}" : void 0
1036
+ },
1037
+ config: {
1038
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
1039
+ default: "{}"
1000
1040
  }
1001
- },
1002
- config: {
1003
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
1004
- default: "{}"
1005
- }
1006
- });
1041
+ });
1042
+ }
1007
1043
  return _kubb_react_fabric.FunctionParams.factory({
1008
1044
  pathParams: typeSchemas.pathParams?.name ? {
1009
1045
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1011,7 +1047,7 @@ function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas })
1011
1047
  typed: true,
1012
1048
  casing: paramsCasing
1013
1049
  }),
1014
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
1050
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
1015
1051
  } : void 0,
1016
1052
  data: typeSchemas.request?.name ? {
1017
1053
  type: typeSchemas.request?.name,
@@ -1089,7 +1125,9 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
1089
1125
  ...(params ?? {}),
1090
1126
  ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
1091
1127
  } as ${typeSchemas.queryParams?.name}` : "";
1092
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
1128
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
1129
+ return item && !item.optional && !item.default ? key : void 0;
1130
+ }).filter(Boolean).join("&& ");
1093
1131
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
1094
1132
  if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
1095
1133
  name,
@@ -1144,43 +1182,48 @@ SuspenseInfiniteQueryOptions.getParams = getParams$1;
1144
1182
  function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
1145
1183
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
1146
1184
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
1147
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
1148
- data: {
1149
- mode: "object",
1150
- children: {
1151
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
1152
- typed: true,
1153
- casing: paramsCasing
1154
- }),
1155
- data: typeSchemas.request?.name ? {
1156
- type: typeSchemas.request?.name,
1157
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
1158
- } : void 0,
1159
- params: typeSchemas.queryParams?.name ? {
1160
- type: typeSchemas.queryParams?.name,
1161
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
1162
- } : void 0,
1163
- headers: typeSchemas.headerParams?.name ? {
1164
- type: typeSchemas.headerParams?.name,
1165
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
1166
- } : void 0
1167
- }
1168
- },
1169
- options: {
1170
- type: `
1185
+ if (paramsType === "object") {
1186
+ const children = {
1187
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
1188
+ typed: true,
1189
+ casing: paramsCasing
1190
+ }),
1191
+ data: typeSchemas.request?.name ? {
1192
+ type: typeSchemas.request?.name,
1193
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
1194
+ } : void 0,
1195
+ params: typeSchemas.queryParams?.name ? {
1196
+ type: typeSchemas.queryParams?.name,
1197
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
1198
+ } : void 0,
1199
+ headers: typeSchemas.headerParams?.name ? {
1200
+ type: typeSchemas.headerParams?.name,
1201
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
1202
+ } : void 0
1203
+ };
1204
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
1205
+ return _kubb_react_fabric.FunctionParams.factory({
1206
+ data: {
1207
+ mode: "object",
1208
+ children,
1209
+ default: allChildrenAreOptional ? "{}" : void 0
1210
+ },
1211
+ options: {
1212
+ type: `
1171
1213
  {
1172
1214
  query?: Partial<UseSuspenseQueryOptions<${[
1173
- TData,
1174
- TError,
1175
- "TData",
1176
- "TQueryKey"
1177
- ].join(", ")}>> & { client?: QueryClient },
1215
+ TData,
1216
+ TError,
1217
+ "TData",
1218
+ "TQueryKey"
1219
+ ].join(", ")}>> & { client?: QueryClient },
1178
1220
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
1179
1221
  }
1180
1222
  `,
1181
- default: "{}"
1182
- }
1183
- });
1223
+ default: "{}"
1224
+ }
1225
+ });
1226
+ }
1184
1227
  return _kubb_react_fabric.FunctionParams.factory({
1185
1228
  pathParams: typeSchemas.pathParams?.name ? {
1186
1229
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1188,7 +1231,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
1188
1231
  typed: true,
1189
1232
  casing: paramsCasing
1190
1233
  }),
1191
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
1234
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
1192
1235
  } : void 0,
1193
1236
  data: typeSchemas.request?.name ? {
1194
1237
  type: typeSchemas.request?.name,
@@ -1346,4 +1389,4 @@ Object.defineProperty(exports, 'SuspenseQuery', {
1346
1389
  return SuspenseQuery;
1347
1390
  }
1348
1391
  });
1349
- //# sourceMappingURL=components-7ul5AP_u.cjs.map
1392
+ //# sourceMappingURL=components-YtTYHVwV.cjs.map