@kubb/plugin-react-query 4.15.1 → 4.16.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 (50) hide show
  1. package/dist/{components-B6lqcqgn.js → components-DVc9iach.js} +259 -217
  2. package/dist/components-DVc9iach.js.map +1 -0
  3. package/dist/{components-6nRaAppd.cjs → components-YtTYHVwV.cjs} +259 -217
  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-CYoqgYAV.cjs → generators-C6VGGGTj.cjs} +2 -2
  8. package/dist/{generators-CYoqgYAV.cjs.map → generators-C6VGGGTj.cjs.map} +1 -1
  9. package/dist/{generators-cZao868O.js → generators-DzaRYGiz.js} +2 -2
  10. package/dist/{generators-cZao868O.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 +10 -10
  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/Query.tsx +31 -23
  20. package/src/components/QueryKey.tsx +8 -6
  21. package/src/components/QueryOptions.tsx +48 -26
  22. package/src/components/SuspenseInfiniteQuery.tsx +31 -26
  23. package/src/components/SuspenseInfiniteQueryOptions.tsx +38 -27
  24. package/src/components/SuspenseQuery.tsx +35 -24
  25. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
  26. package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
  27. package/src/generators/__snapshots__/findByStatusAllOptional.ts +82 -0
  28. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +76 -0
  29. package/src/generators/__snapshots__/findByTags.ts +1 -1
  30. package/src/generators/__snapshots__/findByTagsObject.ts +1 -1
  31. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
  32. package/src/generators/__snapshots__/findByTagsTemplateString.ts +1 -1
  33. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +1 -1
  34. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +1 -1
  35. package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
  36. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +97 -0
  37. package/src/generators/__snapshots__/findInfiniteByTags.ts +1 -1
  38. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +1 -1
  39. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +1 -1
  40. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +1 -1
  41. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +79 -0
  42. package/src/generators/__snapshots__/findSuspenseByTags.ts +1 -1
  43. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +1 -1
  44. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +97 -0
  45. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +2 -1
  46. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +2 -1
  47. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +2 -1
  48. package/src/generators/__snapshots__/postAsQuery.ts +2 -2
  49. package/dist/components-6nRaAppd.cjs.map +0 -1
  50. package/dist/components-B6lqcqgn.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_generators = require('./generators-CYoqgYAV.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,
@@ -600,11 +619,12 @@ MutationOptions.getParams = getParams$5;
600
619
  //#region src/components/Mutation.tsx
601
620
  function getParams$4({ paramsCasing, dataReturnType, typeSchemas }) {
602
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
+ });
603
626
  const TRequest = _kubb_react_fabric.FunctionParams.factory({
604
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
605
- typed: true,
606
- casing: paramsCasing
607
- }),
627
+ ...pathParams,
608
628
  data: typeSchemas.request?.name ? {
609
629
  type: typeSchemas.request?.name,
610
630
  optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
@@ -706,44 +726,49 @@ function Mutation({ name, mutationOptionsName, paramsCasing, pathParamsType, dat
706
726
  function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
707
727
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
708
728
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
709
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
710
- data: {
711
- mode: "object",
712
- children: {
713
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
714
- typed: true,
715
- casing: paramsCasing
716
- }),
717
- data: typeSchemas.request?.name ? {
718
- type: typeSchemas.request?.name,
719
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
720
- } : void 0,
721
- params: typeSchemas.queryParams?.name ? {
722
- type: typeSchemas.queryParams?.name,
723
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
724
- } : void 0,
725
- headers: typeSchemas.headerParams?.name ? {
726
- type: typeSchemas.headerParams?.name,
727
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
728
- } : void 0
729
- }
730
- },
731
- options: {
732
- 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: `
733
757
  {
734
758
  query?: Partial<QueryObserverOptions<${[
735
- TData,
736
- TError,
737
- "TData",
738
- "TQueryData",
739
- "TQueryKey"
740
- ].join(", ")}>> & { client?: QueryClient },
759
+ TData,
760
+ TError,
761
+ "TData",
762
+ "TQueryData",
763
+ "TQueryKey"
764
+ ].join(", ")}>> & { client?: QueryClient },
741
765
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
742
766
  }
743
767
  `,
744
- default: "{}"
745
- }
746
- });
768
+ default: "{}"
769
+ }
770
+ });
771
+ }
747
772
  return _kubb_react_fabric.FunctionParams.factory({
748
773
  pathParams: typeSchemas.pathParams?.name ? {
749
774
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -751,7 +776,7 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType,
751
776
  typed: true,
752
777
  casing: paramsCasing
753
778
  }),
754
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
779
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
755
780
  } : void 0,
756
781
  data: typeSchemas.request?.name ? {
757
782
  type: typeSchemas.request?.name,
@@ -843,38 +868,43 @@ Query.getParams = getParams$3;
843
868
  //#endregion
844
869
  //#region src/components/SuspenseInfiniteQuery.tsx
845
870
  function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
846
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
847
- data: {
848
- mode: "object",
849
- children: {
850
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
851
- typed: true,
852
- casing: paramsCasing
853
- }),
854
- data: typeSchemas.request?.name ? {
855
- type: typeSchemas.request?.name,
856
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
857
- } : void 0,
858
- params: typeSchemas.queryParams?.name ? {
859
- type: typeSchemas.queryParams?.name,
860
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
861
- } : void 0,
862
- headers: typeSchemas.headerParams?.name ? {
863
- type: typeSchemas.headerParams?.name,
864
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
865
- } : void 0
866
- }
867
- },
868
- options: {
869
- 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: `
870
899
  {
871
900
  query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
872
901
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
873
902
  }
874
903
  `,
875
- default: "{}"
876
- }
877
- });
904
+ default: "{}"
905
+ }
906
+ });
907
+ }
878
908
  return _kubb_react_fabric.FunctionParams.factory({
879
909
  pathParams: typeSchemas.pathParams?.name ? {
880
910
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -882,7 +912,7 @@ function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
882
912
  typed: true,
883
913
  casing: paramsCasing
884
914
  }),
885
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
915
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
886
916
  } : void 0,
887
917
  data: typeSchemas.request?.name ? {
888
918
  type: typeSchemas.request?.name,
@@ -978,33 +1008,38 @@ SuspenseInfiniteQuery.getParams = getParams$2;
978
1008
  //#endregion
979
1009
  //#region src/components/SuspenseInfiniteQueryOptions.tsx
980
1010
  function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
981
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
982
- data: {
983
- mode: "object",
984
- children: {
985
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
986
- typed: true,
987
- casing: paramsCasing
988
- }),
989
- data: typeSchemas.request?.name ? {
990
- type: typeSchemas.request?.name,
991
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
992
- } : void 0,
993
- params: typeSchemas.queryParams?.name ? {
994
- type: typeSchemas.queryParams?.name,
995
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
996
- } : void 0,
997
- headers: typeSchemas.headerParams?.name ? {
998
- type: typeSchemas.headerParams?.name,
999
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
1000
- } : 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: "{}"
1001
1040
  }
1002
- },
1003
- config: {
1004
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
1005
- default: "{}"
1006
- }
1007
- });
1041
+ });
1042
+ }
1008
1043
  return _kubb_react_fabric.FunctionParams.factory({
1009
1044
  pathParams: typeSchemas.pathParams?.name ? {
1010
1045
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1012,7 +1047,7 @@ function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas })
1012
1047
  typed: true,
1013
1048
  casing: paramsCasing
1014
1049
  }),
1015
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
1050
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
1016
1051
  } : void 0,
1017
1052
  data: typeSchemas.request?.name ? {
1018
1053
  type: typeSchemas.request?.name,
@@ -1090,7 +1125,9 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
1090
1125
  ...(params ?? {}),
1091
1126
  ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
1092
1127
  } as ${typeSchemas.queryParams?.name}` : "";
1093
- 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("&& ");
1094
1131
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
1095
1132
  if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
1096
1133
  name,
@@ -1145,43 +1182,48 @@ SuspenseInfiniteQueryOptions.getParams = getParams$1;
1145
1182
  function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
1146
1183
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
1147
1184
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
1148
- if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
1149
- data: {
1150
- mode: "object",
1151
- children: {
1152
- ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
1153
- typed: true,
1154
- casing: paramsCasing
1155
- }),
1156
- data: typeSchemas.request?.name ? {
1157
- type: typeSchemas.request?.name,
1158
- optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
1159
- } : void 0,
1160
- params: typeSchemas.queryParams?.name ? {
1161
- type: typeSchemas.queryParams?.name,
1162
- optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
1163
- } : void 0,
1164
- headers: typeSchemas.headerParams?.name ? {
1165
- type: typeSchemas.headerParams?.name,
1166
- optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
1167
- } : void 0
1168
- }
1169
- },
1170
- options: {
1171
- 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: `
1172
1213
  {
1173
1214
  query?: Partial<UseSuspenseQueryOptions<${[
1174
- TData,
1175
- TError,
1176
- "TData",
1177
- "TQueryKey"
1178
- ].join(", ")}>> & { client?: QueryClient },
1215
+ TData,
1216
+ TError,
1217
+ "TData",
1218
+ "TQueryKey"
1219
+ ].join(", ")}>> & { client?: QueryClient },
1179
1220
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
1180
1221
  }
1181
1222
  `,
1182
- default: "{}"
1183
- }
1184
- });
1223
+ default: "{}"
1224
+ }
1225
+ });
1226
+ }
1185
1227
  return _kubb_react_fabric.FunctionParams.factory({
1186
1228
  pathParams: typeSchemas.pathParams?.name ? {
1187
1229
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1189,7 +1231,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
1189
1231
  typed: true,
1190
1232
  casing: paramsCasing
1191
1233
  }),
1192
- optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
1234
+ default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
1193
1235
  } : void 0,
1194
1236
  data: typeSchemas.request?.name ? {
1195
1237
  type: typeSchemas.request?.name,
@@ -1347,4 +1389,4 @@ Object.defineProperty(exports, 'SuspenseQuery', {
1347
1389
  return SuspenseQuery;
1348
1390
  }
1349
1391
  });
1350
- //# sourceMappingURL=components-6nRaAppd.cjs.map
1392
+ //# sourceMappingURL=components-YtTYHVwV.cjs.map