@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,5 +1,5 @@
1
1
  import { URLPath, getNestedAccessor } from "@kubb/core/utils";
2
- import { isOptional } from "@kubb/oas";
2
+ import { isAllOptional, isOptional } from "@kubb/oas";
3
3
  import { getComments, getPathParams } from "@kubb/plugin-oas/utils";
4
4
  import { File, Function, FunctionParams, Type } from "@kubb/react-fabric";
5
5
  import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
@@ -8,20 +8,20 @@ import { Client } from "@kubb/plugin-client/components";
8
8
  //#region src/components/QueryKey.tsx
9
9
  function getParams$10({ pathParamsType, paramsCasing, typeSchemas }) {
10
10
  return FunctionParams.factory({
11
- pathParams: {
11
+ pathParams: typeSchemas.pathParams?.name ? {
12
12
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
13
13
  children: getPathParams(typeSchemas.pathParams, {
14
14
  typed: true,
15
15
  casing: paramsCasing
16
16
  })
17
- },
17
+ } : void 0,
18
18
  data: typeSchemas.request?.name ? {
19
19
  type: typeSchemas.request?.name,
20
- optional: isOptional(typeSchemas.request?.schema)
20
+ default: isOptional(typeSchemas.request?.schema) ? "{}" : void 0
21
21
  } : void 0,
22
22
  params: typeSchemas.queryParams?.name ? {
23
23
  type: typeSchemas.queryParams?.name,
24
- optional: isOptional(typeSchemas.queryParams?.schema)
24
+ default: isOptional(typeSchemas.queryParams?.schema) ? "{}" : void 0
25
25
  } : void 0
26
26
  });
27
27
  }
@@ -75,33 +75,38 @@ QueryKey.getTransformer = getTransformer$1;
75
75
  //#endregion
76
76
  //#region src/components/QueryOptions.tsx
77
77
  function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
78
- if (paramsType === "object") return FunctionParams.factory({
79
- data: {
80
- mode: "object",
81
- children: {
82
- ...getPathParams(typeSchemas.pathParams, {
83
- typed: true,
84
- casing: paramsCasing
85
- }),
86
- data: typeSchemas.request?.name ? {
87
- type: typeSchemas.request?.name,
88
- optional: isOptional(typeSchemas.request?.schema)
89
- } : void 0,
90
- params: typeSchemas.queryParams?.name ? {
91
- type: typeSchemas.queryParams?.name,
92
- optional: isOptional(typeSchemas.queryParams?.schema)
93
- } : void 0,
94
- headers: typeSchemas.headerParams?.name ? {
95
- type: typeSchemas.headerParams?.name,
96
- optional: isOptional(typeSchemas.headerParams?.schema)
97
- } : void 0
78
+ if (paramsType === "object") {
79
+ const children = {
80
+ ...getPathParams(typeSchemas.pathParams, {
81
+ typed: true,
82
+ casing: paramsCasing
83
+ }),
84
+ data: typeSchemas.request?.name ? {
85
+ type: typeSchemas.request?.name,
86
+ optional: isOptional(typeSchemas.request?.schema)
87
+ } : void 0,
88
+ params: typeSchemas.queryParams?.name ? {
89
+ type: typeSchemas.queryParams?.name,
90
+ optional: isOptional(typeSchemas.queryParams?.schema)
91
+ } : void 0,
92
+ headers: typeSchemas.headerParams?.name ? {
93
+ type: typeSchemas.headerParams?.name,
94
+ optional: isOptional(typeSchemas.headerParams?.schema)
95
+ } : void 0
96
+ };
97
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
98
+ return FunctionParams.factory({
99
+ data: {
100
+ mode: "object",
101
+ children,
102
+ default: allChildrenAreOptional ? "{}" : void 0
103
+ },
104
+ config: {
105
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
106
+ default: "{}"
98
107
  }
99
- },
100
- config: {
101
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
102
- default: "{}"
103
- }
104
- });
108
+ });
109
+ }
105
110
  return FunctionParams.factory({
106
111
  pathParams: typeSchemas.pathParams?.name ? {
107
112
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -109,7 +114,7 @@ function getParams$9({ paramsType, paramsCasing, pathParamsType, typeSchemas })
109
114
  typed: true,
110
115
  casing: paramsCasing
111
116
  }),
112
- optional: isOptional(typeSchemas.pathParams?.schema)
117
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
113
118
  } : void 0,
114
119
  data: typeSchemas.request?.name ? {
115
120
  type: typeSchemas.request?.name,
@@ -150,7 +155,9 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
150
155
  typeSchemas,
151
156
  paramsCasing
152
157
  });
153
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
158
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
159
+ return item && !item.optional && !item.default ? key : void 0;
160
+ }).filter(Boolean).join("&& ");
154
161
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
155
162
  return /* @__PURE__ */ jsx(File.Source, {
156
163
  name,
@@ -179,38 +186,43 @@ QueryOptions.getParams = getParams$9;
179
186
  //#endregion
180
187
  //#region src/components/InfiniteQuery.tsx
181
188
  function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
182
- if (paramsType === "object") return FunctionParams.factory({
183
- data: {
184
- mode: "object",
185
- children: {
186
- ...getPathParams(typeSchemas.pathParams, {
187
- typed: true,
188
- casing: paramsCasing
189
- }),
190
- data: typeSchemas.request?.name ? {
191
- type: typeSchemas.request?.name,
192
- optional: isOptional(typeSchemas.request?.schema)
193
- } : void 0,
194
- params: typeSchemas.queryParams?.name ? {
195
- type: typeSchemas.queryParams?.name,
196
- optional: isOptional(typeSchemas.queryParams?.schema)
197
- } : void 0,
198
- headers: typeSchemas.headerParams?.name ? {
199
- type: typeSchemas.headerParams?.name,
200
- optional: isOptional(typeSchemas.headerParams?.schema)
201
- } : void 0
202
- }
203
- },
204
- options: {
205
- type: `
189
+ if (paramsType === "object") {
190
+ const children = {
191
+ ...getPathParams(typeSchemas.pathParams, {
192
+ typed: true,
193
+ casing: paramsCasing
194
+ }),
195
+ data: typeSchemas.request?.name ? {
196
+ type: typeSchemas.request?.name,
197
+ optional: isOptional(typeSchemas.request?.schema)
198
+ } : void 0,
199
+ params: typeSchemas.queryParams?.name ? {
200
+ type: typeSchemas.queryParams?.name,
201
+ optional: isOptional(typeSchemas.queryParams?.schema)
202
+ } : void 0,
203
+ headers: typeSchemas.headerParams?.name ? {
204
+ type: typeSchemas.headerParams?.name,
205
+ optional: isOptional(typeSchemas.headerParams?.schema)
206
+ } : void 0
207
+ };
208
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
209
+ return FunctionParams.factory({
210
+ data: {
211
+ mode: "object",
212
+ children,
213
+ default: allChildrenAreOptional ? "{}" : void 0
214
+ },
215
+ options: {
216
+ type: `
206
217
  {
207
218
  query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
208
219
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
209
220
  }
210
221
  `,
211
- default: "{}"
212
- }
213
- });
222
+ default: "{}"
223
+ }
224
+ });
225
+ }
214
226
  return FunctionParams.factory({
215
227
  pathParams: typeSchemas.pathParams?.name ? {
216
228
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -218,7 +230,7 @@ function getParams$8({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
218
230
  typed: true,
219
231
  casing: paramsCasing
220
232
  }),
221
- optional: isOptional(typeSchemas.pathParams?.schema)
233
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
222
234
  } : void 0,
223
235
  data: typeSchemas.request?.name ? {
224
236
  type: typeSchemas.request?.name,
@@ -314,33 +326,38 @@ InfiniteQuery.getParams = getParams$8;
314
326
  //#endregion
315
327
  //#region src/components/InfiniteQueryOptions.tsx
316
328
  function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
317
- if (paramsType === "object") return FunctionParams.factory({
318
- data: {
319
- mode: "object",
320
- children: {
321
- ...getPathParams(typeSchemas.pathParams, {
322
- typed: true,
323
- casing: paramsCasing
324
- }),
325
- data: typeSchemas.request?.name ? {
326
- type: typeSchemas.request?.name,
327
- optional: isOptional(typeSchemas.request?.schema)
328
- } : void 0,
329
- params: typeSchemas.queryParams?.name ? {
330
- type: typeSchemas.queryParams?.name,
331
- optional: isOptional(typeSchemas.queryParams?.schema)
332
- } : void 0,
333
- headers: typeSchemas.headerParams?.name ? {
334
- type: typeSchemas.headerParams?.name,
335
- optional: isOptional(typeSchemas.headerParams?.schema)
336
- } : void 0
329
+ if (paramsType === "object") {
330
+ const children = {
331
+ ...getPathParams(typeSchemas.pathParams, {
332
+ typed: true,
333
+ casing: paramsCasing
334
+ }),
335
+ data: typeSchemas.request?.name ? {
336
+ type: typeSchemas.request?.name,
337
+ optional: isOptional(typeSchemas.request?.schema)
338
+ } : void 0,
339
+ params: typeSchemas.queryParams?.name ? {
340
+ type: typeSchemas.queryParams?.name,
341
+ optional: isOptional(typeSchemas.queryParams?.schema)
342
+ } : void 0,
343
+ headers: typeSchemas.headerParams?.name ? {
344
+ type: typeSchemas.headerParams?.name,
345
+ optional: isOptional(typeSchemas.headerParams?.schema)
346
+ } : void 0
347
+ };
348
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
349
+ return FunctionParams.factory({
350
+ data: {
351
+ mode: "object",
352
+ children,
353
+ default: allChildrenAreOptional ? "{}" : void 0
354
+ },
355
+ config: {
356
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
357
+ default: "{}"
337
358
  }
338
- },
339
- config: {
340
- type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
341
- default: "{}"
342
- }
343
- });
359
+ });
360
+ }
344
361
  return FunctionParams.factory({
345
362
  pathParams: typeSchemas.pathParams?.name ? {
346
363
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -348,7 +365,7 @@ function getParams$7({ paramsType, paramsCasing, pathParamsType, typeSchemas })
348
365
  typed: true,
349
366
  casing: paramsCasing
350
367
  }),
351
- optional: isOptional(typeSchemas.pathParams?.schema)
368
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
352
369
  } : void 0,
353
370
  data: typeSchemas.request?.name ? {
354
371
  type: typeSchemas.request?.name,
@@ -426,7 +443,9 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
426
443
  ...(params ?? {}),
427
444
  ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
428
445
  } as ${typeSchemas.queryParams?.name}` : "";
429
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
446
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
447
+ return item && !item.optional && !item.default ? key : void 0;
448
+ }).filter(Boolean).join("&& ");
430
449
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
431
450
  if (infiniteOverrideParams) return /* @__PURE__ */ jsx(File.Source, {
432
451
  name,
@@ -599,11 +618,12 @@ MutationOptions.getParams = getParams$5;
599
618
  //#region src/components/Mutation.tsx
600
619
  function getParams$4({ paramsCasing, dataReturnType, typeSchemas }) {
601
620
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
621
+ const pathParams = getPathParams(typeSchemas.pathParams, {
622
+ typed: true,
623
+ casing: paramsCasing
624
+ });
602
625
  const TRequest = FunctionParams.factory({
603
- ...getPathParams(typeSchemas.pathParams, {
604
- typed: true,
605
- casing: paramsCasing
606
- }),
626
+ ...pathParams,
607
627
  data: typeSchemas.request?.name ? {
608
628
  type: typeSchemas.request?.name,
609
629
  optional: isOptional(typeSchemas.request?.schema)
@@ -705,44 +725,49 @@ function Mutation({ name, mutationOptionsName, paramsCasing, pathParamsType, dat
705
725
  function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
706
726
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
707
727
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
708
- if (paramsType === "object") return FunctionParams.factory({
709
- data: {
710
- mode: "object",
711
- children: {
712
- ...getPathParams(typeSchemas.pathParams, {
713
- typed: true,
714
- casing: paramsCasing
715
- }),
716
- data: typeSchemas.request?.name ? {
717
- type: typeSchemas.request?.name,
718
- optional: isOptional(typeSchemas.request?.schema)
719
- } : void 0,
720
- params: typeSchemas.queryParams?.name ? {
721
- type: typeSchemas.queryParams?.name,
722
- optional: isOptional(typeSchemas.queryParams?.schema)
723
- } : void 0,
724
- headers: typeSchemas.headerParams?.name ? {
725
- type: typeSchemas.headerParams?.name,
726
- optional: isOptional(typeSchemas.headerParams?.schema)
727
- } : void 0
728
- }
729
- },
730
- options: {
731
- type: `
728
+ if (paramsType === "object") {
729
+ const children = {
730
+ ...getPathParams(typeSchemas.pathParams, {
731
+ typed: true,
732
+ casing: paramsCasing
733
+ }),
734
+ data: typeSchemas.request?.name ? {
735
+ type: typeSchemas.request?.name,
736
+ optional: isOptional(typeSchemas.request?.schema)
737
+ } : void 0,
738
+ params: typeSchemas.queryParams?.name ? {
739
+ type: typeSchemas.queryParams?.name,
740
+ optional: isOptional(typeSchemas.queryParams?.schema)
741
+ } : void 0,
742
+ headers: typeSchemas.headerParams?.name ? {
743
+ type: typeSchemas.headerParams?.name,
744
+ optional: isOptional(typeSchemas.headerParams?.schema)
745
+ } : void 0
746
+ };
747
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
748
+ return FunctionParams.factory({
749
+ data: {
750
+ mode: "object",
751
+ children,
752
+ default: allChildrenAreOptional ? "{}" : void 0
753
+ },
754
+ options: {
755
+ type: `
732
756
  {
733
757
  query?: Partial<QueryObserverOptions<${[
734
- TData,
735
- TError,
736
- "TData",
737
- "TQueryData",
738
- "TQueryKey"
739
- ].join(", ")}>> & { client?: QueryClient },
758
+ TData,
759
+ TError,
760
+ "TData",
761
+ "TQueryData",
762
+ "TQueryKey"
763
+ ].join(", ")}>> & { client?: QueryClient },
740
764
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
741
765
  }
742
766
  `,
743
- default: "{}"
744
- }
745
- });
767
+ default: "{}"
768
+ }
769
+ });
770
+ }
746
771
  return FunctionParams.factory({
747
772
  pathParams: typeSchemas.pathParams?.name ? {
748
773
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -750,7 +775,7 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType,
750
775
  typed: true,
751
776
  casing: paramsCasing
752
777
  }),
753
- optional: isOptional(typeSchemas.pathParams?.schema)
778
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
754
779
  } : void 0,
755
780
  data: typeSchemas.request?.name ? {
756
781
  type: typeSchemas.request?.name,
@@ -842,38 +867,43 @@ Query.getParams = getParams$3;
842
867
  //#endregion
843
868
  //#region src/components/SuspenseInfiniteQuery.tsx
844
869
  function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
845
- if (paramsType === "object") return FunctionParams.factory({
846
- data: {
847
- mode: "object",
848
- children: {
849
- ...getPathParams(typeSchemas.pathParams, {
850
- typed: true,
851
- casing: paramsCasing
852
- }),
853
- data: typeSchemas.request?.name ? {
854
- type: typeSchemas.request?.name,
855
- optional: isOptional(typeSchemas.request?.schema)
856
- } : void 0,
857
- params: typeSchemas.queryParams?.name ? {
858
- type: typeSchemas.queryParams?.name,
859
- optional: isOptional(typeSchemas.queryParams?.schema)
860
- } : void 0,
861
- headers: typeSchemas.headerParams?.name ? {
862
- type: typeSchemas.headerParams?.name,
863
- optional: isOptional(typeSchemas.headerParams?.schema)
864
- } : void 0
865
- }
866
- },
867
- options: {
868
- type: `
870
+ if (paramsType === "object") {
871
+ const children = {
872
+ ...getPathParams(typeSchemas.pathParams, {
873
+ typed: true,
874
+ casing: paramsCasing
875
+ }),
876
+ data: typeSchemas.request?.name ? {
877
+ type: typeSchemas.request?.name,
878
+ optional: isOptional(typeSchemas.request?.schema)
879
+ } : void 0,
880
+ params: typeSchemas.queryParams?.name ? {
881
+ type: typeSchemas.queryParams?.name,
882
+ optional: isOptional(typeSchemas.queryParams?.schema)
883
+ } : void 0,
884
+ headers: typeSchemas.headerParams?.name ? {
885
+ type: typeSchemas.headerParams?.name,
886
+ optional: isOptional(typeSchemas.headerParams?.schema)
887
+ } : void 0
888
+ };
889
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
890
+ return FunctionParams.factory({
891
+ data: {
892
+ mode: "object",
893
+ children,
894
+ default: allChildrenAreOptional ? "{}" : void 0
895
+ },
896
+ options: {
897
+ type: `
869
898
  {
870
899
  query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
871
900
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
872
901
  }
873
902
  `,
874
- default: "{}"
875
- }
876
- });
903
+ default: "{}"
904
+ }
905
+ });
906
+ }
877
907
  return FunctionParams.factory({
878
908
  pathParams: typeSchemas.pathParams?.name ? {
879
909
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -881,7 +911,7 @@ function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
881
911
  typed: true,
882
912
  casing: paramsCasing
883
913
  }),
884
- optional: isOptional(typeSchemas.pathParams?.schema)
914
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
885
915
  } : void 0,
886
916
  data: typeSchemas.request?.name ? {
887
917
  type: typeSchemas.request?.name,
@@ -977,33 +1007,38 @@ SuspenseInfiniteQuery.getParams = getParams$2;
977
1007
  //#endregion
978
1008
  //#region src/components/SuspenseInfiniteQueryOptions.tsx
979
1009
  function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
980
- if (paramsType === "object") return FunctionParams.factory({
981
- data: {
982
- mode: "object",
983
- children: {
984
- ...getPathParams(typeSchemas.pathParams, {
985
- typed: true,
986
- casing: paramsCasing
987
- }),
988
- data: typeSchemas.request?.name ? {
989
- type: typeSchemas.request?.name,
990
- optional: isOptional(typeSchemas.request?.schema)
991
- } : void 0,
992
- params: typeSchemas.queryParams?.name ? {
993
- type: typeSchemas.queryParams?.name,
994
- optional: isOptional(typeSchemas.queryParams?.schema)
995
- } : void 0,
996
- headers: typeSchemas.headerParams?.name ? {
997
- type: typeSchemas.headerParams?.name,
998
- optional: isOptional(typeSchemas.headerParams?.schema)
999
- } : void 0
1010
+ if (paramsType === "object") {
1011
+ const children = {
1012
+ ...getPathParams(typeSchemas.pathParams, {
1013
+ typed: true,
1014
+ casing: paramsCasing
1015
+ }),
1016
+ data: typeSchemas.request?.name ? {
1017
+ type: typeSchemas.request?.name,
1018
+ optional: isOptional(typeSchemas.request?.schema)
1019
+ } : void 0,
1020
+ params: typeSchemas.queryParams?.name ? {
1021
+ type: typeSchemas.queryParams?.name,
1022
+ optional: isOptional(typeSchemas.queryParams?.schema)
1023
+ } : void 0,
1024
+ headers: typeSchemas.headerParams?.name ? {
1025
+ type: typeSchemas.headerParams?.name,
1026
+ optional: isOptional(typeSchemas.headerParams?.schema)
1027
+ } : void 0
1028
+ };
1029
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
1030
+ return FunctionParams.factory({
1031
+ data: {
1032
+ mode: "object",
1033
+ children,
1034
+ default: allChildrenAreOptional ? "{}" : void 0
1035
+ },
1036
+ config: {
1037
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
1038
+ default: "{}"
1000
1039
  }
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
- });
1040
+ });
1041
+ }
1007
1042
  return FunctionParams.factory({
1008
1043
  pathParams: typeSchemas.pathParams?.name ? {
1009
1044
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1011,7 +1046,7 @@ function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas })
1011
1046
  typed: true,
1012
1047
  casing: paramsCasing
1013
1048
  }),
1014
- optional: isOptional(typeSchemas.pathParams?.schema)
1049
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
1015
1050
  } : void 0,
1016
1051
  data: typeSchemas.request?.name ? {
1017
1052
  type: typeSchemas.request?.name,
@@ -1089,7 +1124,9 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
1089
1124
  ...(params ?? {}),
1090
1125
  ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
1091
1126
  } as ${typeSchemas.queryParams?.name}` : "";
1092
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
1127
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
1128
+ return item && !item.optional && !item.default ? key : void 0;
1129
+ }).filter(Boolean).join("&& ");
1093
1130
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
1094
1131
  if (infiniteOverrideParams) return /* @__PURE__ */ jsx(File.Source, {
1095
1132
  name,
@@ -1144,43 +1181,48 @@ SuspenseInfiniteQueryOptions.getParams = getParams$1;
1144
1181
  function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
1145
1182
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
1146
1183
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
1147
- if (paramsType === "object") return FunctionParams.factory({
1148
- data: {
1149
- mode: "object",
1150
- children: {
1151
- ...getPathParams(typeSchemas.pathParams, {
1152
- typed: true,
1153
- casing: paramsCasing
1154
- }),
1155
- data: typeSchemas.request?.name ? {
1156
- type: typeSchemas.request?.name,
1157
- optional: isOptional(typeSchemas.request?.schema)
1158
- } : void 0,
1159
- params: typeSchemas.queryParams?.name ? {
1160
- type: typeSchemas.queryParams?.name,
1161
- optional: isOptional(typeSchemas.queryParams?.schema)
1162
- } : void 0,
1163
- headers: typeSchemas.headerParams?.name ? {
1164
- type: typeSchemas.headerParams?.name,
1165
- optional: isOptional(typeSchemas.headerParams?.schema)
1166
- } : void 0
1167
- }
1168
- },
1169
- options: {
1170
- type: `
1184
+ if (paramsType === "object") {
1185
+ const children = {
1186
+ ...getPathParams(typeSchemas.pathParams, {
1187
+ typed: true,
1188
+ casing: paramsCasing
1189
+ }),
1190
+ data: typeSchemas.request?.name ? {
1191
+ type: typeSchemas.request?.name,
1192
+ optional: isOptional(typeSchemas.request?.schema)
1193
+ } : void 0,
1194
+ params: typeSchemas.queryParams?.name ? {
1195
+ type: typeSchemas.queryParams?.name,
1196
+ optional: isOptional(typeSchemas.queryParams?.schema)
1197
+ } : void 0,
1198
+ headers: typeSchemas.headerParams?.name ? {
1199
+ type: typeSchemas.headerParams?.name,
1200
+ optional: isOptional(typeSchemas.headerParams?.schema)
1201
+ } : void 0
1202
+ };
1203
+ const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
1204
+ return FunctionParams.factory({
1205
+ data: {
1206
+ mode: "object",
1207
+ children,
1208
+ default: allChildrenAreOptional ? "{}" : void 0
1209
+ },
1210
+ options: {
1211
+ type: `
1171
1212
  {
1172
1213
  query?: Partial<UseSuspenseQueryOptions<${[
1173
- TData,
1174
- TError,
1175
- "TData",
1176
- "TQueryKey"
1177
- ].join(", ")}>> & { client?: QueryClient },
1214
+ TData,
1215
+ TError,
1216
+ "TData",
1217
+ "TQueryKey"
1218
+ ].join(", ")}>> & { client?: QueryClient },
1178
1219
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
1179
1220
  }
1180
1221
  `,
1181
- default: "{}"
1182
- }
1183
- });
1222
+ default: "{}"
1223
+ }
1224
+ });
1225
+ }
1184
1226
  return FunctionParams.factory({
1185
1227
  pathParams: typeSchemas.pathParams?.name ? {
1186
1228
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
@@ -1188,7 +1230,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
1188
1230
  typed: true,
1189
1231
  casing: paramsCasing
1190
1232
  }),
1191
- optional: isOptional(typeSchemas.pathParams?.schema)
1233
+ default: isAllOptional(typeSchemas.pathParams?.schema) ? "{}" : void 0
1192
1234
  } : void 0,
1193
1235
  data: typeSchemas.request?.name ? {
1194
1236
  type: typeSchemas.request?.name,
@@ -1281,4 +1323,4 @@ SuspenseQuery.getParams = getParams;
1281
1323
 
1282
1324
  //#endregion
1283
1325
  export { Mutation as a, InfiniteQueryOptions as c, QueryKey as d, Query as i, InfiniteQuery as l, SuspenseInfiniteQueryOptions as n, MutationOptions as o, SuspenseInfiniteQuery as r, MutationKey as s, SuspenseQuery as t, QueryOptions as u };
1284
- //# sourceMappingURL=components-B6lqcqgn.js.map
1326
+ //# sourceMappingURL=components-DVc9iach.js.map