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