@kubb/plugin-react-query 3.0.0-beta.1 → 3.0.0-beta.10
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/{chunk-37VO6QXJ.cjs → chunk-24SL7I66.cjs} +38 -24
- package/dist/chunk-24SL7I66.cjs.map +1 -0
- package/dist/{chunk-C2H3KPHM.cjs → chunk-BML6BZ4F.cjs} +256 -36
- package/dist/chunk-BML6BZ4F.cjs.map +1 -0
- package/dist/{chunk-Y3DM2P6L.js → chunk-JFIGHRBM.js} +256 -36
- package/dist/chunk-JFIGHRBM.js.map +1 -0
- package/dist/{chunk-IRW2Y3EC.js → chunk-LBVGJA4Q.js} +21 -7
- package/dist/chunk-LBVGJA4Q.js.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.d.cts +23 -12
- package/dist/components.d.ts +23 -12
- package/dist/components.js +1 -1
- package/dist/generators.cjs +6 -6
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-5pnOmDmM.d.cts → types-Dlwxp28D.d.cts} +33 -34
- package/dist/{types-5pnOmDmM.d.ts → types-Dlwxp28D.d.ts} +33 -34
- package/package.json +14 -14
- package/src/components/InfiniteQuery.tsx +52 -5
- package/src/components/InfiniteQueryOptions.tsx +62 -7
- package/src/components/Mutation.tsx +9 -3
- package/src/components/Query.tsx +62 -6
- package/src/components/QueryOptions.tsx +47 -7
- package/src/components/SuspenseQuery.tsx +52 -5
- package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
- package/src/generators/infiniteQueryGenerator.tsx +3 -1
- package/src/generators/mutationGenerator.tsx +2 -1
- package/src/generators/queryGenerator.tsx +3 -1
- package/src/generators/suspenseQueryGenerator.tsx +3 -0
- package/src/plugin.ts +3 -1
- package/src/types.ts +17 -21
- package/dist/chunk-37VO6QXJ.cjs.map +0 -1
- package/dist/chunk-C2H3KPHM.cjs.map +0 -1
- package/dist/chunk-IRW2Y3EC.js.map +0 -1
- package/dist/chunk-Y3DM2P6L.js.map +0 -1
|
@@ -5,12 +5,40 @@ import { getComments, getPathParams } from '@kubb/plugin-oas/utils';
|
|
|
5
5
|
import { jsx, jsxs, Fragment } from '@kubb/react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
// src/components/Mutation.tsx
|
|
8
|
-
function getParams({ pathParamsType, typeSchemas }) {
|
|
8
|
+
function getParams({ paramsType, pathParamsType, typeSchemas }) {
|
|
9
|
+
if (paramsType === "object") {
|
|
10
|
+
return FunctionParams.factory({
|
|
11
|
+
data: {
|
|
12
|
+
mode: "object",
|
|
13
|
+
children: {
|
|
14
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
15
|
+
data: typeSchemas.request?.name ? {
|
|
16
|
+
type: typeSchemas.request?.name,
|
|
17
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
18
|
+
} : void 0,
|
|
19
|
+
params: typeSchemas.queryParams?.name ? {
|
|
20
|
+
type: typeSchemas.queryParams?.name,
|
|
21
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
22
|
+
} : void 0,
|
|
23
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
24
|
+
type: typeSchemas.headerParams?.name,
|
|
25
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
26
|
+
} : void 0
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
config: {
|
|
30
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
|
|
31
|
+
default: "{}"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
9
35
|
return FunctionParams.factory({
|
|
10
|
-
pathParams: {
|
|
36
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
11
37
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
12
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
13
|
-
|
|
38
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
39
|
+
type: typeSchemas.pathParams?.name,
|
|
40
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
41
|
+
} : void 0,
|
|
14
42
|
data: typeSchemas.request?.name ? {
|
|
15
43
|
type: typeSchemas.request?.name,
|
|
16
44
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -38,6 +66,7 @@ function Client({
|
|
|
38
66
|
dataReturnType,
|
|
39
67
|
parser,
|
|
40
68
|
zodSchemas,
|
|
69
|
+
paramsType,
|
|
41
70
|
pathParamsType,
|
|
42
71
|
operation
|
|
43
72
|
}) {
|
|
@@ -53,7 +82,7 @@ function Client({
|
|
|
53
82
|
typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error",
|
|
54
83
|
typeSchemas.request?.name || "unknown"
|
|
55
84
|
].filter(Boolean);
|
|
56
|
-
const params = getParams({ pathParamsType, typeSchemas });
|
|
85
|
+
const params = getParams({ paramsType, pathParamsType, typeSchemas });
|
|
57
86
|
const clientParams = FunctionParams.factory({
|
|
58
87
|
config: {
|
|
59
88
|
mode: "object",
|
|
@@ -155,7 +184,7 @@ function getParams3({ dataReturnType, typeSchemas }) {
|
|
|
155
184
|
} : void 0
|
|
156
185
|
});
|
|
157
186
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
158
|
-
const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", `{${TRequest}}`].join(", ");
|
|
187
|
+
const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
|
|
159
188
|
return FunctionParams.factory({
|
|
160
189
|
options: {
|
|
161
190
|
type: `
|
|
@@ -168,7 +197,7 @@ function getParams3({ dataReturnType, typeSchemas }) {
|
|
|
168
197
|
}
|
|
169
198
|
});
|
|
170
199
|
}
|
|
171
|
-
function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
|
|
200
|
+
function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
|
|
172
201
|
const mutationKeyParams = MutationKey.getParams({
|
|
173
202
|
pathParamsType,
|
|
174
203
|
typeSchemas
|
|
@@ -179,6 +208,7 @@ function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchema
|
|
|
179
208
|
typeSchemas
|
|
180
209
|
});
|
|
181
210
|
const clientParams = Client.getParams({
|
|
211
|
+
paramsType,
|
|
182
212
|
typeSchemas,
|
|
183
213
|
pathParamsType
|
|
184
214
|
});
|
|
@@ -215,7 +245,7 @@ function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchema
|
|
|
215
245
|
});
|
|
216
246
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
217
247
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
218
|
-
const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", `{${TRequest}}`].join(", ");
|
|
248
|
+
const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
|
|
219
249
|
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(
|
|
220
250
|
Function,
|
|
221
251
|
{
|
|
@@ -273,12 +303,40 @@ function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, keys
|
|
|
273
303
|
] });
|
|
274
304
|
}
|
|
275
305
|
QueryKey.getParams = getParams4;
|
|
276
|
-
function getParams5({ pathParamsType, typeSchemas }) {
|
|
306
|
+
function getParams5({ paramsType, pathParamsType, typeSchemas }) {
|
|
307
|
+
if (paramsType === "object") {
|
|
308
|
+
return FunctionParams.factory({
|
|
309
|
+
data: {
|
|
310
|
+
mode: "object",
|
|
311
|
+
children: {
|
|
312
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
313
|
+
data: typeSchemas.request?.name ? {
|
|
314
|
+
type: typeSchemas.request?.name,
|
|
315
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
316
|
+
} : void 0,
|
|
317
|
+
params: typeSchemas.queryParams?.name ? {
|
|
318
|
+
type: typeSchemas.queryParams?.name,
|
|
319
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
320
|
+
} : void 0,
|
|
321
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
322
|
+
type: typeSchemas.headerParams?.name,
|
|
323
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
324
|
+
} : void 0
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
config: {
|
|
328
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
|
|
329
|
+
default: "{}"
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
277
333
|
return FunctionParams.factory({
|
|
278
|
-
pathParams: {
|
|
334
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
279
335
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
280
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
281
|
-
|
|
336
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
337
|
+
type: typeSchemas.pathParams?.name,
|
|
338
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
339
|
+
} : void 0,
|
|
282
340
|
data: typeSchemas.request?.name ? {
|
|
283
341
|
type: typeSchemas.request?.name,
|
|
284
342
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -297,10 +355,11 @@ function getParams5({ pathParamsType, typeSchemas }) {
|
|
|
297
355
|
}
|
|
298
356
|
});
|
|
299
357
|
}
|
|
300
|
-
function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }) {
|
|
301
|
-
const params = getParams5({ pathParamsType, typeSchemas });
|
|
358
|
+
function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }) {
|
|
359
|
+
const params = getParams5({ paramsType, pathParamsType, typeSchemas });
|
|
302
360
|
const clientParams = Client.getParams({
|
|
303
361
|
typeSchemas,
|
|
362
|
+
paramsType,
|
|
304
363
|
pathParamsType
|
|
305
364
|
});
|
|
306
365
|
const queryKeyParams = QueryKey.getParams({
|
|
@@ -322,13 +381,46 @@ function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyN
|
|
|
322
381
|
` }) });
|
|
323
382
|
}
|
|
324
383
|
QueryOptions.getParams = getParams5;
|
|
325
|
-
function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
384
|
+
function getParams6({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
326
385
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
386
|
+
if (paramsType === "object") {
|
|
387
|
+
return FunctionParams.factory({
|
|
388
|
+
data: {
|
|
389
|
+
mode: "object",
|
|
390
|
+
children: {
|
|
391
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
392
|
+
data: typeSchemas.request?.name ? {
|
|
393
|
+
type: typeSchemas.request?.name,
|
|
394
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
395
|
+
} : void 0,
|
|
396
|
+
params: typeSchemas.queryParams?.name ? {
|
|
397
|
+
type: typeSchemas.queryParams?.name,
|
|
398
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
399
|
+
} : void 0,
|
|
400
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
401
|
+
type: typeSchemas.headerParams?.name,
|
|
402
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
403
|
+
} : void 0
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
options: {
|
|
407
|
+
type: `
|
|
408
|
+
{
|
|
409
|
+
query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
410
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
411
|
+
}
|
|
412
|
+
`,
|
|
413
|
+
default: "{}"
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
327
417
|
return FunctionParams.factory({
|
|
328
|
-
pathParams: {
|
|
418
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
329
419
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
330
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
331
|
-
|
|
420
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
421
|
+
type: typeSchemas.pathParams?.name,
|
|
422
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
423
|
+
} : void 0,
|
|
332
424
|
data: typeSchemas.request?.name ? {
|
|
333
425
|
type: typeSchemas.request?.name,
|
|
334
426
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -352,7 +444,17 @@ function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
|
352
444
|
}
|
|
353
445
|
});
|
|
354
446
|
}
|
|
355
|
-
function Query({
|
|
447
|
+
function Query({
|
|
448
|
+
name,
|
|
449
|
+
queryKeyTypeName,
|
|
450
|
+
queryOptionsName,
|
|
451
|
+
queryKeyName,
|
|
452
|
+
paramsType,
|
|
453
|
+
pathParamsType,
|
|
454
|
+
dataReturnType,
|
|
455
|
+
typeSchemas,
|
|
456
|
+
operation
|
|
457
|
+
}) {
|
|
356
458
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
357
459
|
const returnType = `UseQueryResult<${["TData", typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"].join(", ")}> & { queryKey: TQueryKey }`;
|
|
358
460
|
const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`];
|
|
@@ -361,10 +463,12 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
|
|
|
361
463
|
typeSchemas
|
|
362
464
|
});
|
|
363
465
|
const queryOptionsParams = QueryOptions.getParams({
|
|
466
|
+
paramsType,
|
|
364
467
|
pathParamsType,
|
|
365
468
|
typeSchemas
|
|
366
469
|
});
|
|
367
470
|
const params = getParams6({
|
|
471
|
+
paramsType,
|
|
368
472
|
pathParamsType,
|
|
369
473
|
dataReturnType,
|
|
370
474
|
typeSchemas
|
|
@@ -398,12 +502,40 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
|
|
|
398
502
|
) });
|
|
399
503
|
}
|
|
400
504
|
Query.getParams = getParams6;
|
|
401
|
-
function getParams7({ pathParamsType, typeSchemas }) {
|
|
505
|
+
function getParams7({ paramsType, pathParamsType, typeSchemas }) {
|
|
506
|
+
if (paramsType === "object") {
|
|
507
|
+
return FunctionParams.factory({
|
|
508
|
+
data: {
|
|
509
|
+
mode: "object",
|
|
510
|
+
children: {
|
|
511
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
512
|
+
data: typeSchemas.request?.name ? {
|
|
513
|
+
type: typeSchemas.request?.name,
|
|
514
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
515
|
+
} : void 0,
|
|
516
|
+
params: typeSchemas.queryParams?.name ? {
|
|
517
|
+
type: typeSchemas.queryParams?.name,
|
|
518
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
519
|
+
} : void 0,
|
|
520
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
521
|
+
type: typeSchemas.headerParams?.name,
|
|
522
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
523
|
+
} : void 0
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
config: {
|
|
527
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
|
|
528
|
+
default: "{}"
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
402
532
|
return FunctionParams.factory({
|
|
403
|
-
pathParams: {
|
|
533
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
404
534
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
405
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
406
|
-
|
|
535
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
536
|
+
type: typeSchemas.pathParams?.name,
|
|
537
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
538
|
+
} : void 0,
|
|
407
539
|
data: typeSchemas.request?.name ? {
|
|
408
540
|
type: typeSchemas.request?.name,
|
|
409
541
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -428,14 +560,16 @@ function InfiniteQueryOptions({
|
|
|
428
560
|
initialPageParam,
|
|
429
561
|
cursorParam,
|
|
430
562
|
typeSchemas,
|
|
563
|
+
paramsType,
|
|
431
564
|
dataReturnType,
|
|
432
565
|
pathParamsType,
|
|
433
566
|
queryParam,
|
|
434
567
|
queryKeyName
|
|
435
568
|
}) {
|
|
436
|
-
const params = getParams7({ pathParamsType, typeSchemas });
|
|
569
|
+
const params = getParams7({ paramsType, pathParamsType, typeSchemas });
|
|
437
570
|
const clientParams = Client.getParams({
|
|
438
571
|
typeSchemas,
|
|
572
|
+
paramsType,
|
|
439
573
|
pathParamsType
|
|
440
574
|
});
|
|
441
575
|
const queryKeyParams = QueryKey.getParams({
|
|
@@ -456,7 +590,8 @@ function InfiniteQueryOptions({
|
|
|
456
590
|
}` : "";
|
|
457
591
|
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
|
|
458
592
|
const enabledText = enabled ? `enabled: !!(${enabled})` : "";
|
|
459
|
-
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */
|
|
593
|
+
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxs(Function, { name, export: true, params: params.toConstructor(), children: [
|
|
594
|
+
infiniteOverrideParams && `
|
|
460
595
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
461
596
|
return infiniteQueryOptions({
|
|
462
597
|
${enabledText}
|
|
@@ -468,16 +603,62 @@ function InfiniteQueryOptions({
|
|
|
468
603
|
},
|
|
469
604
|
${queryOptions.join("\n")}
|
|
470
605
|
})
|
|
471
|
-
|
|
606
|
+
`,
|
|
607
|
+
!infiniteOverrideParams && `
|
|
608
|
+
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
609
|
+
return infiniteQueryOptions({
|
|
610
|
+
${enabledText}
|
|
611
|
+
queryKey,
|
|
612
|
+
queryFn: async ({ signal }) => {
|
|
613
|
+
config.signal = signal
|
|
614
|
+
return ${clientName}(${clientParams.toCall()})
|
|
615
|
+
},
|
|
616
|
+
${queryOptions.join("\n")}
|
|
617
|
+
})
|
|
618
|
+
`
|
|
619
|
+
] }) });
|
|
472
620
|
}
|
|
473
621
|
InfiniteQueryOptions.getParams = getParams7;
|
|
474
|
-
function getParams8({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
622
|
+
function getParams8({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
475
623
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
624
|
+
if (paramsType === "object") {
|
|
625
|
+
return FunctionParams.factory({
|
|
626
|
+
data: {
|
|
627
|
+
mode: "object",
|
|
628
|
+
children: {
|
|
629
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
630
|
+
data: typeSchemas.request?.name ? {
|
|
631
|
+
type: typeSchemas.request?.name,
|
|
632
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
633
|
+
} : void 0,
|
|
634
|
+
params: typeSchemas.queryParams?.name ? {
|
|
635
|
+
type: typeSchemas.queryParams?.name,
|
|
636
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
637
|
+
} : void 0,
|
|
638
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
639
|
+
type: typeSchemas.headerParams?.name,
|
|
640
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
641
|
+
} : void 0
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
options: {
|
|
645
|
+
type: `
|
|
646
|
+
{
|
|
647
|
+
query?: Partial<InfiniteQueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
648
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
649
|
+
}
|
|
650
|
+
`,
|
|
651
|
+
default: "{}"
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
}
|
|
476
655
|
return FunctionParams.factory({
|
|
477
|
-
pathParams: {
|
|
656
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
478
657
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
479
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
480
|
-
|
|
658
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
659
|
+
type: typeSchemas.pathParams?.name,
|
|
660
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
661
|
+
} : void 0,
|
|
481
662
|
data: typeSchemas.request?.name ? {
|
|
482
663
|
type: typeSchemas.request?.name,
|
|
483
664
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -506,6 +687,7 @@ function InfiniteQuery({
|
|
|
506
687
|
queryKeyTypeName,
|
|
507
688
|
queryOptionsName,
|
|
508
689
|
queryKeyName,
|
|
690
|
+
paramsType,
|
|
509
691
|
pathParamsType,
|
|
510
692
|
dataReturnType,
|
|
511
693
|
typeSchemas,
|
|
@@ -519,10 +701,12 @@ function InfiniteQuery({
|
|
|
519
701
|
typeSchemas
|
|
520
702
|
});
|
|
521
703
|
const queryOptionsParams = QueryOptions.getParams({
|
|
704
|
+
paramsType,
|
|
522
705
|
pathParamsType,
|
|
523
706
|
typeSchemas
|
|
524
707
|
});
|
|
525
708
|
const params = getParams8({
|
|
709
|
+
paramsType,
|
|
526
710
|
pathParamsType,
|
|
527
711
|
dataReturnType,
|
|
528
712
|
typeSchemas
|
|
@@ -556,13 +740,46 @@ function InfiniteQuery({
|
|
|
556
740
|
) });
|
|
557
741
|
}
|
|
558
742
|
InfiniteQuery.getParams = getParams8;
|
|
559
|
-
function getParams9({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
743
|
+
function getParams9({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
560
744
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
745
|
+
if (paramsType === "object") {
|
|
746
|
+
return FunctionParams.factory({
|
|
747
|
+
data: {
|
|
748
|
+
mode: "object",
|
|
749
|
+
children: {
|
|
750
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
751
|
+
data: typeSchemas.request?.name ? {
|
|
752
|
+
type: typeSchemas.request?.name,
|
|
753
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
754
|
+
} : void 0,
|
|
755
|
+
params: typeSchemas.queryParams?.name ? {
|
|
756
|
+
type: typeSchemas.queryParams?.name,
|
|
757
|
+
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
758
|
+
} : void 0,
|
|
759
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
760
|
+
type: typeSchemas.headerParams?.name,
|
|
761
|
+
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
762
|
+
} : void 0
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
options: {
|
|
766
|
+
type: `
|
|
767
|
+
{
|
|
768
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryKey"].join(", ")}>>,
|
|
769
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
770
|
+
}
|
|
771
|
+
`,
|
|
772
|
+
default: "{}"
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
561
776
|
return FunctionParams.factory({
|
|
562
|
-
pathParams: {
|
|
777
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
563
778
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
564
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
565
|
-
|
|
779
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
780
|
+
type: typeSchemas.pathParams?.name,
|
|
781
|
+
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
782
|
+
} : void 0,
|
|
566
783
|
data: typeSchemas.request?.name ? {
|
|
567
784
|
type: typeSchemas.request?.name,
|
|
568
785
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -591,6 +808,7 @@ function SuspenseQuery({
|
|
|
591
808
|
queryKeyTypeName,
|
|
592
809
|
queryOptionsName,
|
|
593
810
|
queryKeyName,
|
|
811
|
+
paramsType,
|
|
594
812
|
pathParamsType,
|
|
595
813
|
dataReturnType,
|
|
596
814
|
typeSchemas,
|
|
@@ -604,10 +822,12 @@ function SuspenseQuery({
|
|
|
604
822
|
typeSchemas
|
|
605
823
|
});
|
|
606
824
|
const queryOptionsParams = QueryOptions.getParams({
|
|
825
|
+
paramsType,
|
|
607
826
|
pathParamsType,
|
|
608
827
|
typeSchemas
|
|
609
828
|
});
|
|
610
829
|
const params = getParams9({
|
|
830
|
+
paramsType,
|
|
611
831
|
pathParamsType,
|
|
612
832
|
dataReturnType,
|
|
613
833
|
typeSchemas
|
|
@@ -643,5 +863,5 @@ function SuspenseQuery({
|
|
|
643
863
|
SuspenseQuery.getParams = getParams9;
|
|
644
864
|
|
|
645
865
|
export { Client, InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, Operations, Query, QueryKey, QueryOptions, SuspenseQuery };
|
|
646
|
-
//# sourceMappingURL=chunk-
|
|
647
|
-
//# sourceMappingURL=chunk-
|
|
866
|
+
//# sourceMappingURL=chunk-JFIGHRBM.js.map
|
|
867
|
+
//# sourceMappingURL=chunk-JFIGHRBM.js.map
|