@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.
- package/dist/{components-B6lqcqgn.js → components-DVc9iach.js} +259 -217
- package/dist/components-DVc9iach.js.map +1 -0
- package/dist/{components-6nRaAppd.cjs → components-YtTYHVwV.cjs} +259 -217
- package/dist/components-YtTYHVwV.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-CYoqgYAV.cjs → generators-C6VGGGTj.cjs} +2 -2
- package/dist/{generators-CYoqgYAV.cjs.map → generators-C6VGGGTj.cjs.map} +1 -1
- package/dist/{generators-cZao868O.js → generators-DzaRYGiz.js} +2 -2
- package/dist/{generators-cZao868O.js.map → generators-DzaRYGiz.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/package.json +10 -10
- package/src/components/InfiniteQuery.tsx +35 -30
- package/src/components/InfiniteQueryOptions.tsx +38 -27
- package/src/components/Mutation.tsx +3 -1
- package/src/components/Query.tsx +31 -23
- package/src/components/QueryKey.tsx +8 -6
- package/src/components/QueryOptions.tsx +48 -26
- package/src/components/SuspenseInfiniteQuery.tsx +31 -26
- package/src/components/SuspenseInfiniteQueryOptions.tsx +38 -27
- package/src/components/SuspenseQuery.tsx +35 -24
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
- package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
- package/src/generators/__snapshots__/findByStatusAllOptional.ts +82 -0
- package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +76 -0
- package/src/generators/__snapshots__/findByTags.ts +1 -1
- package/src/generators/__snapshots__/findByTagsObject.ts +1 -1
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +97 -0
- package/src/generators/__snapshots__/findInfiniteByTags.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +1 -1
- package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +79 -0
- package/src/generators/__snapshots__/findSuspenseByTags.ts +1 -1
- package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +1 -1
- package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +97 -0
- package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +2 -1
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +2 -1
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +2 -1
- package/src/generators/__snapshots__/postAsQuery.ts +2 -2
- package/dist/components-6nRaAppd.cjs.map +0 -1
- package/dist/components-B6lqcqgn.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_generators = require('./generators-
|
|
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
|
-
|
|
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
|
-
|
|
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")
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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]) =>
|
|
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")
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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")
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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]) =>
|
|
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
|
-
...
|
|
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")
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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")
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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")
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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]) =>
|
|
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")
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
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
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
1392
|
+
//# sourceMappingURL=components-YtTYHVwV.cjs.map
|