@kubb/plugin-react-query 3.0.0-beta.9 → 3.0.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/{chunk-D5PFCZWQ.cjs → chunk-EOG7AHFO.cjs} +258 -40
- package/dist/chunk-EOG7AHFO.cjs.map +1 -0
- package/dist/{chunk-U35NELYJ.js → chunk-EY5KE7R7.js} +258 -40
- package/dist/chunk-EY5KE7R7.js.map +1 -0
- package/dist/{chunk-JKG4EZID.cjs → chunk-NBC6BPMV.cjs} +141 -110
- package/dist/chunk-NBC6BPMV.cjs.map +1 -0
- package/dist/{chunk-3OOSVEDM.js → chunk-NZKAIPYC.js} +130 -99
- package/dist/chunk-NZKAIPYC.js.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.d.cts +29 -16
- package/dist/components.d.ts +29 -16
- 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 +24 -24
- 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 +23 -23
- package/dist/index.js.map +1 -1
- package/dist/{types-LhwfnVo7.d.cts → types-IuxCCG1K.d.cts} +46 -16
- package/dist/{types-LhwfnVo7.d.ts → types-IuxCCG1K.d.ts} +46 -16
- package/package.json +12 -12
- package/src/components/InfiniteQuery.tsx +52 -5
- package/src/components/InfiniteQueryOptions.tsx +47 -6
- package/src/components/Mutation.tsx +3 -1
- package/src/components/MutationKey.tsx +11 -5
- package/src/components/Query.tsx +62 -6
- package/src/components/QueryKey.tsx +17 -7
- package/src/components/QueryOptions.tsx +47 -7
- package/src/components/SuspenseQuery.tsx +52 -5
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
- package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
- package/src/generators/__snapshots__/findByTags.ts +1 -1
- package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTags.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +1 -1
- package/src/generators/__snapshots__/postAsQuery.ts +1 -1
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
- package/src/generators/infiniteQueryGenerator.tsx +40 -28
- package/src/generators/mutationGenerator.tsx +25 -16
- package/src/generators/queryGenerator.tsx +24 -17
- package/src/generators/suspenseQueryGenerator.tsx +26 -16
- package/src/plugin.ts +23 -20
- package/src/types.ts +35 -15
- package/dist/chunk-3OOSVEDM.js.map +0 -1
- package/dist/chunk-D5PFCZWQ.cjs.map +0 -1
- package/dist/chunk-JKG4EZID.cjs.map +0 -1
- package/dist/chunk-U35NELYJ.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",
|
|
@@ -129,16 +158,20 @@ function Operations({ name, operations }) {
|
|
|
129
158
|
function getParams2({}) {
|
|
130
159
|
return react.FunctionParams.factory({});
|
|
131
160
|
}
|
|
132
|
-
|
|
161
|
+
var getTransformer = ({ operation }) => {
|
|
133
162
|
const path = new utils.URLPath(operation.path);
|
|
163
|
+
return [JSON.stringify({ url: path.path })].filter(Boolean);
|
|
164
|
+
};
|
|
165
|
+
function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
134
166
|
const params = getParams2({ pathParamsType, typeSchemas });
|
|
135
|
-
const keys =
|
|
167
|
+
const keys = transformer({ operation, schemas: typeSchemas });
|
|
136
168
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
|
|
138
170
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
139
171
|
] });
|
|
140
172
|
}
|
|
141
173
|
MutationKey.getParams = getParams2;
|
|
174
|
+
MutationKey.getTransformer = getTransformer;
|
|
142
175
|
function getParams3({ dataReturnType, typeSchemas }) {
|
|
143
176
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
144
177
|
const mutationParams = react.FunctionParams.factory({
|
|
@@ -170,7 +203,7 @@ function getParams3({ dataReturnType, typeSchemas }) {
|
|
|
170
203
|
}
|
|
171
204
|
});
|
|
172
205
|
}
|
|
173
|
-
function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
|
|
206
|
+
function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }) {
|
|
174
207
|
const mutationKeyParams = MutationKey.getParams({
|
|
175
208
|
pathParamsType,
|
|
176
209
|
typeSchemas
|
|
@@ -181,6 +214,7 @@ function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchema
|
|
|
181
214
|
typeSchemas
|
|
182
215
|
});
|
|
183
216
|
const clientParams = Client.getParams({
|
|
217
|
+
paramsType,
|
|
184
218
|
typeSchemas,
|
|
185
219
|
pathParamsType
|
|
186
220
|
});
|
|
@@ -258,29 +292,65 @@ function getParams4({ pathParamsType, typeSchemas }) {
|
|
|
258
292
|
} : void 0
|
|
259
293
|
});
|
|
260
294
|
}
|
|
261
|
-
|
|
295
|
+
var getTransformer2 = ({ operation, schemas }) => {
|
|
262
296
|
const path = new utils.URLPath(operation.path);
|
|
263
|
-
const params = getParams4({ pathParamsType, typeSchemas });
|
|
264
297
|
const keys = [
|
|
265
298
|
path.toObject({
|
|
266
299
|
type: "path",
|
|
267
300
|
stringify: true
|
|
268
301
|
}),
|
|
269
|
-
|
|
270
|
-
|
|
302
|
+
schemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
|
|
303
|
+
schemas.request?.name ? "...(data ? [data] : [])" : void 0
|
|
271
304
|
].filter(Boolean);
|
|
305
|
+
return keys;
|
|
306
|
+
};
|
|
307
|
+
function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
|
|
308
|
+
const params = getParams4({ pathParamsType, typeSchemas });
|
|
309
|
+
const keys = transformer({
|
|
310
|
+
operation,
|
|
311
|
+
schemas: typeSchemas
|
|
312
|
+
});
|
|
272
313
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
273
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${
|
|
314
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
|
|
274
315
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
275
316
|
] });
|
|
276
317
|
}
|
|
277
318
|
QueryKey.getParams = getParams4;
|
|
278
|
-
|
|
319
|
+
QueryKey.getTransformer = getTransformer2;
|
|
320
|
+
function getParams5({ paramsType, pathParamsType, typeSchemas }) {
|
|
321
|
+
if (paramsType === "object") {
|
|
322
|
+
return react.FunctionParams.factory({
|
|
323
|
+
data: {
|
|
324
|
+
mode: "object",
|
|
325
|
+
children: {
|
|
326
|
+
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
327
|
+
data: typeSchemas.request?.name ? {
|
|
328
|
+
type: typeSchemas.request?.name,
|
|
329
|
+
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
330
|
+
} : void 0,
|
|
331
|
+
params: typeSchemas.queryParams?.name ? {
|
|
332
|
+
type: typeSchemas.queryParams?.name,
|
|
333
|
+
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
334
|
+
} : void 0,
|
|
335
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
336
|
+
type: typeSchemas.headerParams?.name,
|
|
337
|
+
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
338
|
+
} : void 0
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
config: {
|
|
342
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
|
|
343
|
+
default: "{}"
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
279
347
|
return react.FunctionParams.factory({
|
|
280
|
-
pathParams: {
|
|
348
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
281
349
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
282
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
|
|
283
|
-
|
|
350
|
+
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
351
|
+
type: typeSchemas.pathParams?.name,
|
|
352
|
+
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
353
|
+
} : void 0,
|
|
284
354
|
data: typeSchemas.request?.name ? {
|
|
285
355
|
type: typeSchemas.request?.name,
|
|
286
356
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -299,10 +369,11 @@ function getParams5({ pathParamsType, typeSchemas }) {
|
|
|
299
369
|
}
|
|
300
370
|
});
|
|
301
371
|
}
|
|
302
|
-
function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }) {
|
|
303
|
-
const params = getParams5({ pathParamsType, typeSchemas });
|
|
372
|
+
function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }) {
|
|
373
|
+
const params = getParams5({ paramsType, pathParamsType, typeSchemas });
|
|
304
374
|
const clientParams = Client.getParams({
|
|
305
375
|
typeSchemas,
|
|
376
|
+
paramsType,
|
|
306
377
|
pathParamsType
|
|
307
378
|
});
|
|
308
379
|
const queryKeyParams = QueryKey.getParams({
|
|
@@ -324,13 +395,46 @@ function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyN
|
|
|
324
395
|
` }) });
|
|
325
396
|
}
|
|
326
397
|
QueryOptions.getParams = getParams5;
|
|
327
|
-
function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
398
|
+
function getParams6({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
328
399
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
400
|
+
if (paramsType === "object") {
|
|
401
|
+
return react.FunctionParams.factory({
|
|
402
|
+
data: {
|
|
403
|
+
mode: "object",
|
|
404
|
+
children: {
|
|
405
|
+
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
406
|
+
data: typeSchemas.request?.name ? {
|
|
407
|
+
type: typeSchemas.request?.name,
|
|
408
|
+
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
409
|
+
} : void 0,
|
|
410
|
+
params: typeSchemas.queryParams?.name ? {
|
|
411
|
+
type: typeSchemas.queryParams?.name,
|
|
412
|
+
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
413
|
+
} : void 0,
|
|
414
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
415
|
+
type: typeSchemas.headerParams?.name,
|
|
416
|
+
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
417
|
+
} : void 0
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
options: {
|
|
421
|
+
type: `
|
|
422
|
+
{
|
|
423
|
+
query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
424
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
425
|
+
}
|
|
426
|
+
`,
|
|
427
|
+
default: "{}"
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
329
431
|
return react.FunctionParams.factory({
|
|
330
|
-
pathParams: {
|
|
432
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
331
433
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
332
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
|
|
333
|
-
|
|
434
|
+
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
435
|
+
type: typeSchemas.pathParams?.name,
|
|
436
|
+
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
437
|
+
} : void 0,
|
|
334
438
|
data: typeSchemas.request?.name ? {
|
|
335
439
|
type: typeSchemas.request?.name,
|
|
336
440
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -354,7 +458,17 @@ function getParams6({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
|
354
458
|
}
|
|
355
459
|
});
|
|
356
460
|
}
|
|
357
|
-
function Query({
|
|
461
|
+
function Query({
|
|
462
|
+
name,
|
|
463
|
+
queryKeyTypeName,
|
|
464
|
+
queryOptionsName,
|
|
465
|
+
queryKeyName,
|
|
466
|
+
paramsType,
|
|
467
|
+
pathParamsType,
|
|
468
|
+
dataReturnType,
|
|
469
|
+
typeSchemas,
|
|
470
|
+
operation
|
|
471
|
+
}) {
|
|
358
472
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
359
473
|
const returnType = `UseQueryResult<${["TData", typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"].join(", ")}> & { queryKey: TQueryKey }`;
|
|
360
474
|
const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`];
|
|
@@ -363,10 +477,12 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
|
|
|
363
477
|
typeSchemas
|
|
364
478
|
});
|
|
365
479
|
const queryOptionsParams = QueryOptions.getParams({
|
|
480
|
+
paramsType,
|
|
366
481
|
pathParamsType,
|
|
367
482
|
typeSchemas
|
|
368
483
|
});
|
|
369
484
|
const params = getParams6({
|
|
485
|
+
paramsType,
|
|
370
486
|
pathParamsType,
|
|
371
487
|
dataReturnType,
|
|
372
488
|
typeSchemas
|
|
@@ -400,12 +516,40 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathPar
|
|
|
400
516
|
) });
|
|
401
517
|
}
|
|
402
518
|
Query.getParams = getParams6;
|
|
403
|
-
function getParams7({ pathParamsType, typeSchemas }) {
|
|
519
|
+
function getParams7({ paramsType, pathParamsType, typeSchemas }) {
|
|
520
|
+
if (paramsType === "object") {
|
|
521
|
+
return react.FunctionParams.factory({
|
|
522
|
+
data: {
|
|
523
|
+
mode: "object",
|
|
524
|
+
children: {
|
|
525
|
+
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
526
|
+
data: typeSchemas.request?.name ? {
|
|
527
|
+
type: typeSchemas.request?.name,
|
|
528
|
+
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
529
|
+
} : void 0,
|
|
530
|
+
params: typeSchemas.queryParams?.name ? {
|
|
531
|
+
type: typeSchemas.queryParams?.name,
|
|
532
|
+
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
533
|
+
} : void 0,
|
|
534
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
535
|
+
type: typeSchemas.headerParams?.name,
|
|
536
|
+
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
537
|
+
} : void 0
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
config: {
|
|
541
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>",
|
|
542
|
+
default: "{}"
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
404
546
|
return react.FunctionParams.factory({
|
|
405
|
-
pathParams: {
|
|
547
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
406
548
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
407
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
|
|
408
|
-
|
|
549
|
+
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
550
|
+
type: typeSchemas.pathParams?.name,
|
|
551
|
+
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
552
|
+
} : void 0,
|
|
409
553
|
data: typeSchemas.request?.name ? {
|
|
410
554
|
type: typeSchemas.request?.name,
|
|
411
555
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -430,14 +574,16 @@ function InfiniteQueryOptions({
|
|
|
430
574
|
initialPageParam,
|
|
431
575
|
cursorParam,
|
|
432
576
|
typeSchemas,
|
|
577
|
+
paramsType,
|
|
433
578
|
dataReturnType,
|
|
434
579
|
pathParamsType,
|
|
435
580
|
queryParam,
|
|
436
581
|
queryKeyName
|
|
437
582
|
}) {
|
|
438
|
-
const params = getParams7({ pathParamsType, typeSchemas });
|
|
583
|
+
const params = getParams7({ paramsType, pathParamsType, typeSchemas });
|
|
439
584
|
const clientParams = Client.getParams({
|
|
440
585
|
typeSchemas,
|
|
586
|
+
paramsType,
|
|
441
587
|
pathParamsType
|
|
442
588
|
});
|
|
443
589
|
const queryKeyParams = QueryKey.getParams({
|
|
@@ -487,13 +633,46 @@ function InfiniteQueryOptions({
|
|
|
487
633
|
] }) });
|
|
488
634
|
}
|
|
489
635
|
InfiniteQueryOptions.getParams = getParams7;
|
|
490
|
-
function getParams8({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
636
|
+
function getParams8({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
491
637
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
638
|
+
if (paramsType === "object") {
|
|
639
|
+
return react.FunctionParams.factory({
|
|
640
|
+
data: {
|
|
641
|
+
mode: "object",
|
|
642
|
+
children: {
|
|
643
|
+
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
644
|
+
data: typeSchemas.request?.name ? {
|
|
645
|
+
type: typeSchemas.request?.name,
|
|
646
|
+
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
647
|
+
} : void 0,
|
|
648
|
+
params: typeSchemas.queryParams?.name ? {
|
|
649
|
+
type: typeSchemas.queryParams?.name,
|
|
650
|
+
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
651
|
+
} : void 0,
|
|
652
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
653
|
+
type: typeSchemas.headerParams?.name,
|
|
654
|
+
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
655
|
+
} : void 0
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
options: {
|
|
659
|
+
type: `
|
|
660
|
+
{
|
|
661
|
+
query?: Partial<InfiniteQueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
662
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
663
|
+
}
|
|
664
|
+
`,
|
|
665
|
+
default: "{}"
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
}
|
|
492
669
|
return react.FunctionParams.factory({
|
|
493
|
-
pathParams: {
|
|
670
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
494
671
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
495
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
|
|
496
|
-
|
|
672
|
+
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
673
|
+
type: typeSchemas.pathParams?.name,
|
|
674
|
+
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
675
|
+
} : void 0,
|
|
497
676
|
data: typeSchemas.request?.name ? {
|
|
498
677
|
type: typeSchemas.request?.name,
|
|
499
678
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -522,6 +701,7 @@ function InfiniteQuery({
|
|
|
522
701
|
queryKeyTypeName,
|
|
523
702
|
queryOptionsName,
|
|
524
703
|
queryKeyName,
|
|
704
|
+
paramsType,
|
|
525
705
|
pathParamsType,
|
|
526
706
|
dataReturnType,
|
|
527
707
|
typeSchemas,
|
|
@@ -535,10 +715,12 @@ function InfiniteQuery({
|
|
|
535
715
|
typeSchemas
|
|
536
716
|
});
|
|
537
717
|
const queryOptionsParams = QueryOptions.getParams({
|
|
718
|
+
paramsType,
|
|
538
719
|
pathParamsType,
|
|
539
720
|
typeSchemas
|
|
540
721
|
});
|
|
541
722
|
const params = getParams8({
|
|
723
|
+
paramsType,
|
|
542
724
|
pathParamsType,
|
|
543
725
|
dataReturnType,
|
|
544
726
|
typeSchemas
|
|
@@ -572,13 +754,46 @@ function InfiniteQuery({
|
|
|
572
754
|
) });
|
|
573
755
|
}
|
|
574
756
|
InfiniteQuery.getParams = getParams8;
|
|
575
|
-
function getParams9({ pathParamsType, dataReturnType, typeSchemas }) {
|
|
757
|
+
function getParams9({ paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
576
758
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
759
|
+
if (paramsType === "object") {
|
|
760
|
+
return react.FunctionParams.factory({
|
|
761
|
+
data: {
|
|
762
|
+
mode: "object",
|
|
763
|
+
children: {
|
|
764
|
+
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
765
|
+
data: typeSchemas.request?.name ? {
|
|
766
|
+
type: typeSchemas.request?.name,
|
|
767
|
+
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
768
|
+
} : void 0,
|
|
769
|
+
params: typeSchemas.queryParams?.name ? {
|
|
770
|
+
type: typeSchemas.queryParams?.name,
|
|
771
|
+
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
772
|
+
} : void 0,
|
|
773
|
+
headers: typeSchemas.headerParams?.name ? {
|
|
774
|
+
type: typeSchemas.headerParams?.name,
|
|
775
|
+
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
776
|
+
} : void 0
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
options: {
|
|
780
|
+
type: `
|
|
781
|
+
{
|
|
782
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", "TData", "TQueryKey"].join(", ")}>>,
|
|
783
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : "Partial<RequestConfig>"}
|
|
784
|
+
}
|
|
785
|
+
`,
|
|
786
|
+
default: "{}"
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
577
790
|
return react.FunctionParams.factory({
|
|
578
|
-
pathParams: {
|
|
791
|
+
pathParams: typeSchemas.pathParams?.name ? {
|
|
579
792
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
580
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true })
|
|
581
|
-
|
|
793
|
+
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
794
|
+
type: typeSchemas.pathParams?.name,
|
|
795
|
+
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
796
|
+
} : void 0,
|
|
582
797
|
data: typeSchemas.request?.name ? {
|
|
583
798
|
type: typeSchemas.request?.name,
|
|
584
799
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -607,6 +822,7 @@ function SuspenseQuery({
|
|
|
607
822
|
queryKeyTypeName,
|
|
608
823
|
queryOptionsName,
|
|
609
824
|
queryKeyName,
|
|
825
|
+
paramsType,
|
|
610
826
|
pathParamsType,
|
|
611
827
|
dataReturnType,
|
|
612
828
|
typeSchemas,
|
|
@@ -620,10 +836,12 @@ function SuspenseQuery({
|
|
|
620
836
|
typeSchemas
|
|
621
837
|
});
|
|
622
838
|
const queryOptionsParams = QueryOptions.getParams({
|
|
839
|
+
paramsType,
|
|
623
840
|
pathParamsType,
|
|
624
841
|
typeSchemas
|
|
625
842
|
});
|
|
626
843
|
const params = getParams9({
|
|
844
|
+
paramsType,
|
|
627
845
|
pathParamsType,
|
|
628
846
|
dataReturnType,
|
|
629
847
|
typeSchemas
|
|
@@ -668,5 +886,5 @@ exports.Query = Query;
|
|
|
668
886
|
exports.QueryKey = QueryKey;
|
|
669
887
|
exports.QueryOptions = QueryOptions;
|
|
670
888
|
exports.SuspenseQuery = SuspenseQuery;
|
|
671
|
-
//# sourceMappingURL=chunk-
|
|
672
|
-
//# sourceMappingURL=chunk-
|
|
889
|
+
//# sourceMappingURL=chunk-EOG7AHFO.cjs.map
|
|
890
|
+
//# sourceMappingURL=chunk-EOG7AHFO.cjs.map
|