@kubb/plugin-react-query 4.15.0 → 4.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-CX83mklO.js → components-DVc9iach.js} +261 -218
- package/dist/components-DVc9iach.js.map +1 -0
- package/dist/{components-7ul5AP_u.cjs → components-YtTYHVwV.cjs} +261 -218
- package/dist/components-YtTYHVwV.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-CNv1RI1y.cjs → generators-C6VGGGTj.cjs} +2 -2
- package/dist/{generators-CNv1RI1y.cjs.map → generators-C6VGGGTj.cjs.map} +1 -1
- package/dist/{generators-CVc1Qlnh.js → generators-DzaRYGiz.js} +2 -2
- package/dist/{generators-CVc1Qlnh.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 +9 -9
- package/src/components/InfiniteQuery.tsx +35 -30
- package/src/components/InfiniteQueryOptions.tsx +38 -27
- package/src/components/Mutation.tsx +3 -1
- package/src/components/MutationOptions.tsx +2 -2
- 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__/clientPostImportPath.ts +4 -2
- 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/src/generators/__snapshots__/updatePetById.ts +4 -2
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +4 -2
- package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +4 -2
- package/dist/components-7ul5AP_u.cjs.map +0 -1
- package/dist/components-CX83mklO.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,
|
|
@@ -581,9 +600,10 @@ function MutationOptions({ name, clientName, dataReturnType, typeSchemas, params
|
|
|
581
600
|
name,
|
|
582
601
|
export: true,
|
|
583
602
|
params: params.toConstructor(),
|
|
603
|
+
generics: ["TContext = unknown"],
|
|
584
604
|
children: `
|
|
585
605
|
const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})
|
|
586
|
-
return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : "void"},
|
|
606
|
+
return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : "void"}, TContext>({
|
|
587
607
|
mutationKey,
|
|
588
608
|
mutationFn: async(${dataParams.toConstructor()}) => {
|
|
589
609
|
return ${clientName}(${clientParams.toCall()})
|
|
@@ -599,11 +619,12 @@ MutationOptions.getParams = getParams$5;
|
|
|
599
619
|
//#region src/components/Mutation.tsx
|
|
600
620
|
function getParams$4({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
601
621
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
622
|
+
const pathParams = (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
623
|
+
typed: true,
|
|
624
|
+
casing: paramsCasing
|
|
625
|
+
});
|
|
602
626
|
const TRequest = _kubb_react_fabric.FunctionParams.factory({
|
|
603
|
-
...
|
|
604
|
-
typed: true,
|
|
605
|
-
casing: paramsCasing
|
|
606
|
-
}),
|
|
627
|
+
...pathParams,
|
|
607
628
|
data: typeSchemas.request?.name ? {
|
|
608
629
|
type: typeSchemas.request?.name,
|
|
609
630
|
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
@@ -705,44 +726,49 @@ function Mutation({ name, mutationOptionsName, paramsCasing, pathParamsType, dat
|
|
|
705
726
|
function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
706
727
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
707
728
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
708
|
-
if (paramsType === "object")
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
729
|
+
if (paramsType === "object") {
|
|
730
|
+
const children = {
|
|
731
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
732
|
+
typed: true,
|
|
733
|
+
casing: paramsCasing
|
|
734
|
+
}),
|
|
735
|
+
data: typeSchemas.request?.name ? {
|
|
736
|
+
type: typeSchemas.request?.name,
|
|
737
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
738
|
+
} : void 0,
|
|
739
|
+
params: typeSchemas.queryParams?.name ? {
|
|
740
|
+
type: typeSchemas.queryParams?.name,
|
|
741
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
742
|
+
} : void 0,
|
|
743
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
744
|
+
type: typeSchemas.headerParams?.name,
|
|
745
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
746
|
+
} : void 0
|
|
747
|
+
};
|
|
748
|
+
const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
|
|
749
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
750
|
+
data: {
|
|
751
|
+
mode: "object",
|
|
752
|
+
children,
|
|
753
|
+
default: allChildrenAreOptional ? "{}" : void 0
|
|
754
|
+
},
|
|
755
|
+
options: {
|
|
756
|
+
type: `
|
|
732
757
|
{
|
|
733
758
|
query?: Partial<QueryObserverOptions<${[
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
759
|
+
TData,
|
|
760
|
+
TError,
|
|
761
|
+
"TData",
|
|
762
|
+
"TQueryData",
|
|
763
|
+
"TQueryKey"
|
|
764
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
740
765
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
|
|
741
766
|
}
|
|
742
767
|
`,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
768
|
+
default: "{}"
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
}
|
|
746
772
|
return _kubb_react_fabric.FunctionParams.factory({
|
|
747
773
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
748
774
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -750,7 +776,7 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
750
776
|
typed: true,
|
|
751
777
|
casing: paramsCasing
|
|
752
778
|
}),
|
|
753
|
-
|
|
779
|
+
default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
|
|
754
780
|
} : void 0,
|
|
755
781
|
data: typeSchemas.request?.name ? {
|
|
756
782
|
type: typeSchemas.request?.name,
|
|
@@ -842,38 +868,43 @@ Query.getParams = getParams$3;
|
|
|
842
868
|
//#endregion
|
|
843
869
|
//#region src/components/SuspenseInfiniteQuery.tsx
|
|
844
870
|
function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }) {
|
|
845
|
-
if (paramsType === "object")
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
871
|
+
if (paramsType === "object") {
|
|
872
|
+
const children = {
|
|
873
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
874
|
+
typed: true,
|
|
875
|
+
casing: paramsCasing
|
|
876
|
+
}),
|
|
877
|
+
data: typeSchemas.request?.name ? {
|
|
878
|
+
type: typeSchemas.request?.name,
|
|
879
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
880
|
+
} : void 0,
|
|
881
|
+
params: typeSchemas.queryParams?.name ? {
|
|
882
|
+
type: typeSchemas.queryParams?.name,
|
|
883
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
884
|
+
} : void 0,
|
|
885
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
886
|
+
type: typeSchemas.headerParams?.name,
|
|
887
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
888
|
+
} : void 0
|
|
889
|
+
};
|
|
890
|
+
const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
|
|
891
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
892
|
+
data: {
|
|
893
|
+
mode: "object",
|
|
894
|
+
children,
|
|
895
|
+
default: allChildrenAreOptional ? "{}" : void 0
|
|
896
|
+
},
|
|
897
|
+
options: {
|
|
898
|
+
type: `
|
|
869
899
|
{
|
|
870
900
|
query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },
|
|
871
901
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
|
|
872
902
|
}
|
|
873
903
|
`,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
904
|
+
default: "{}"
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
877
908
|
return _kubb_react_fabric.FunctionParams.factory({
|
|
878
909
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
879
910
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -881,7 +912,7 @@ function getParams$2({ paramsType, paramsCasing, pathParamsType, typeSchemas, pa
|
|
|
881
912
|
typed: true,
|
|
882
913
|
casing: paramsCasing
|
|
883
914
|
}),
|
|
884
|
-
|
|
915
|
+
default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
|
|
885
916
|
} : void 0,
|
|
886
917
|
data: typeSchemas.request?.name ? {
|
|
887
918
|
type: typeSchemas.request?.name,
|
|
@@ -977,33 +1008,38 @@ SuspenseInfiniteQuery.getParams = getParams$2;
|
|
|
977
1008
|
//#endregion
|
|
978
1009
|
//#region src/components/SuspenseInfiniteQueryOptions.tsx
|
|
979
1010
|
function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
980
|
-
if (paramsType === "object")
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1011
|
+
if (paramsType === "object") {
|
|
1012
|
+
const children = {
|
|
1013
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
1014
|
+
typed: true,
|
|
1015
|
+
casing: paramsCasing
|
|
1016
|
+
}),
|
|
1017
|
+
data: typeSchemas.request?.name ? {
|
|
1018
|
+
type: typeSchemas.request?.name,
|
|
1019
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
1020
|
+
} : void 0,
|
|
1021
|
+
params: typeSchemas.queryParams?.name ? {
|
|
1022
|
+
type: typeSchemas.queryParams?.name,
|
|
1023
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
1024
|
+
} : void 0,
|
|
1025
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
1026
|
+
type: typeSchemas.headerParams?.name,
|
|
1027
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
1028
|
+
} : void 0
|
|
1029
|
+
};
|
|
1030
|
+
const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
|
|
1031
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
1032
|
+
data: {
|
|
1033
|
+
mode: "object",
|
|
1034
|
+
children,
|
|
1035
|
+
default: allChildrenAreOptional ? "{}" : void 0
|
|
1036
|
+
},
|
|
1037
|
+
config: {
|
|
1038
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
|
|
1039
|
+
default: "{}"
|
|
1000
1040
|
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
|
|
1004
|
-
default: "{}"
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1007
1043
|
return _kubb_react_fabric.FunctionParams.factory({
|
|
1008
1044
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
1009
1045
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -1011,7 +1047,7 @@ function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
1011
1047
|
typed: true,
|
|
1012
1048
|
casing: paramsCasing
|
|
1013
1049
|
}),
|
|
1014
|
-
|
|
1050
|
+
default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
|
|
1015
1051
|
} : void 0,
|
|
1016
1052
|
data: typeSchemas.request?.name ? {
|
|
1017
1053
|
type: typeSchemas.request?.name,
|
|
@@ -1089,7 +1125,9 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
|
|
|
1089
1125
|
...(params ?? {}),
|
|
1090
1126
|
['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],
|
|
1091
1127
|
} as ${typeSchemas.queryParams?.name}` : "";
|
|
1092
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) =>
|
|
1128
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => {
|
|
1129
|
+
return item && !item.optional && !item.default ? key : void 0;
|
|
1130
|
+
}).filter(Boolean).join("&& ");
|
|
1093
1131
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
1094
1132
|
if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
1095
1133
|
name,
|
|
@@ -1144,43 +1182,48 @@ SuspenseInfiniteQueryOptions.getParams = getParams$1;
|
|
|
1144
1182
|
function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
1145
1183
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
1146
1184
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
1147
|
-
if (paramsType === "object")
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1185
|
+
if (paramsType === "object") {
|
|
1186
|
+
const children = {
|
|
1187
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
1188
|
+
typed: true,
|
|
1189
|
+
casing: paramsCasing
|
|
1190
|
+
}),
|
|
1191
|
+
data: typeSchemas.request?.name ? {
|
|
1192
|
+
type: typeSchemas.request?.name,
|
|
1193
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
1194
|
+
} : void 0,
|
|
1195
|
+
params: typeSchemas.queryParams?.name ? {
|
|
1196
|
+
type: typeSchemas.queryParams?.name,
|
|
1197
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
1198
|
+
} : void 0,
|
|
1199
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
1200
|
+
type: typeSchemas.headerParams?.name,
|
|
1201
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
1202
|
+
} : void 0
|
|
1203
|
+
};
|
|
1204
|
+
const allChildrenAreOptional = Object.values(children).every((child) => !child || child.optional);
|
|
1205
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
1206
|
+
data: {
|
|
1207
|
+
mode: "object",
|
|
1208
|
+
children,
|
|
1209
|
+
default: allChildrenAreOptional ? "{}" : void 0
|
|
1210
|
+
},
|
|
1211
|
+
options: {
|
|
1212
|
+
type: `
|
|
1171
1213
|
{
|
|
1172
1214
|
query?: Partial<UseSuspenseQueryOptions<${[
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1215
|
+
TData,
|
|
1216
|
+
TError,
|
|
1217
|
+
"TData",
|
|
1218
|
+
"TQueryKey"
|
|
1219
|
+
].join(", ")}>> & { client?: QueryClient },
|
|
1178
1220
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }"}
|
|
1179
1221
|
}
|
|
1180
1222
|
`,
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1223
|
+
default: "{}"
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1184
1227
|
return _kubb_react_fabric.FunctionParams.factory({
|
|
1185
1228
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
1186
1229
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
@@ -1188,7 +1231,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
1188
1231
|
typed: true,
|
|
1189
1232
|
casing: paramsCasing
|
|
1190
1233
|
}),
|
|
1191
|
-
|
|
1234
|
+
default: (0, _kubb_oas.isAllOptional)(typeSchemas.pathParams?.schema) ? "{}" : void 0
|
|
1192
1235
|
} : void 0,
|
|
1193
1236
|
data: typeSchemas.request?.name ? {
|
|
1194
1237
|
type: typeSchemas.request?.name,
|
|
@@ -1346,4 +1389,4 @@ Object.defineProperty(exports, 'SuspenseQuery', {
|
|
|
1346
1389
|
return SuspenseQuery;
|
|
1347
1390
|
}
|
|
1348
1391
|
});
|
|
1349
|
-
//# sourceMappingURL=components-
|
|
1392
|
+
//# sourceMappingURL=components-YtTYHVwV.cjs.map
|