@kubb/plugin-react-query 3.5.5 → 3.5.7
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-VC4S3P5L.js → chunk-CO3KLAV4.js} +10 -10
- package/dist/chunk-CO3KLAV4.js.map +1 -0
- package/dist/{chunk-K2SXRS7U.js → chunk-LVGRZJKZ.js} +85 -85
- package/dist/chunk-LVGRZJKZ.js.map +1 -0
- package/dist/{chunk-V7E7AGU4.cjs → chunk-ODTL4QSL.cjs} +85 -85
- package/dist/chunk-ODTL4QSL.cjs.map +1 -0
- package/dist/{chunk-BQFIDATQ.cjs → chunk-ZVI74AOG.cjs} +29 -29
- package/dist/chunk-ZVI74AOG.cjs.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.js +1 -1
- package/dist/generators.cjs +6 -6
- package/dist/generators.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/components/InfiniteQuery.tsx +2 -2
- package/src/components/InfiniteQueryOptions.tsx +6 -2
- package/src/components/Mutation.tsx +1 -1
- package/src/components/Query.tsx +2 -2
- package/src/components/QueryOptions.tsx +6 -2
- package/src/components/SuspenseQuery.tsx +2 -2
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +6 -2
- package/src/generators/__snapshots__/clientGetImportPath.ts +6 -2
- package/src/generators/__snapshots__/clientPostImportPath.ts +1 -1
- package/src/generators/__snapshots__/findByTags.ts +6 -2
- package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +6 -2
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +6 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +6 -2
- package/src/generators/__snapshots__/findInfiniteByTags.ts +2 -2
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +2 -2
- package/src/generators/__snapshots__/getPetIdCamelCase.ts +2 -2
- package/src/generators/__snapshots__/postAsQuery.ts +2 -2
- package/src/generators/__snapshots__/updatePetById.ts +1 -1
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -1
- package/src/generators/infiniteQueryGenerator.tsx +1 -1
- package/src/generators/mutationGenerator.tsx +1 -1
- package/src/generators/queryGenerator.tsx +1 -1
- package/src/generators/suspenseQueryGenerator.tsx +1 -1
- package/dist/chunk-BQFIDATQ.cjs.map +0 -1
- package/dist/chunk-K2SXRS7U.js.map +0 -1
- package/dist/chunk-V7E7AGU4.cjs.map +0 -1
- package/dist/chunk-VC4S3P5L.js.map +0 -1
|
@@ -23,7 +23,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
23
23
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
24
24
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
25
25
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
26
|
-
} :
|
|
26
|
+
} : undefined
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
@@ -42,15 +42,15 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
42
42
|
data: typeSchemas.request?.name ? {
|
|
43
43
|
type: typeSchemas.request?.name,
|
|
44
44
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
45
|
-
} :
|
|
45
|
+
} : undefined,
|
|
46
46
|
params: typeSchemas.queryParams?.name ? {
|
|
47
47
|
type: typeSchemas.queryParams?.name,
|
|
48
48
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
49
|
-
} :
|
|
49
|
+
} : undefined,
|
|
50
50
|
headers: typeSchemas.headerParams?.name ? {
|
|
51
51
|
type: typeSchemas.headerParams?.name,
|
|
52
52
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
53
|
-
} :
|
|
53
|
+
} : undefined
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
config: {
|
|
@@ -64,19 +64,19 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
64
64
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
65
65
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
66
66
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
67
|
-
} :
|
|
67
|
+
} : undefined,
|
|
68
68
|
data: typeSchemas.request?.name ? {
|
|
69
69
|
type: typeSchemas.request?.name,
|
|
70
70
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
71
|
-
} :
|
|
71
|
+
} : undefined,
|
|
72
72
|
params: typeSchemas.queryParams?.name ? {
|
|
73
73
|
type: typeSchemas.queryParams?.name,
|
|
74
74
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
75
|
-
} :
|
|
75
|
+
} : undefined,
|
|
76
76
|
headers: typeSchemas.headerParams?.name ? {
|
|
77
77
|
type: typeSchemas.headerParams?.name,
|
|
78
78
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
79
|
-
} :
|
|
79
|
+
} : undefined,
|
|
80
80
|
config: {
|
|
81
81
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
82
82
|
default: "{}"
|
|
@@ -102,8 +102,8 @@ function Client({
|
|
|
102
102
|
const contentType = operation.getContentType();
|
|
103
103
|
const isFormData = contentType === "multipart/form-data";
|
|
104
104
|
const headers = [
|
|
105
|
-
contentType !== "application/json" ? `'Content-Type': '${contentType}'` :
|
|
106
|
-
typeSchemas.headerParams?.name ? "...headers" :
|
|
105
|
+
contentType !== "application/json" ? `'Content-Type': '${contentType}'` : undefined,
|
|
106
|
+
typeSchemas.headerParams?.name ? "...headers" : undefined
|
|
107
107
|
].filter(Boolean);
|
|
108
108
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
109
109
|
const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || "unknown"].filter(Boolean);
|
|
@@ -126,14 +126,14 @@ function Client({
|
|
|
126
126
|
},
|
|
127
127
|
baseURL: baseURL && !urlName ? {
|
|
128
128
|
value: JSON.stringify(baseURL)
|
|
129
|
-
} :
|
|
130
|
-
params: typeSchemas.queryParams?.name ? {} :
|
|
129
|
+
} : undefined,
|
|
130
|
+
params: typeSchemas.queryParams?.name ? {} : undefined,
|
|
131
131
|
data: typeSchemas.request?.name ? {
|
|
132
|
-
value: isFormData ? "formData" :
|
|
133
|
-
} :
|
|
132
|
+
value: isFormData ? "formData" : undefined
|
|
133
|
+
} : undefined,
|
|
134
134
|
headers: headers.length ? {
|
|
135
|
-
value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` :
|
|
136
|
-
} :
|
|
135
|
+
value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : undefined
|
|
136
|
+
} : undefined,
|
|
137
137
|
requestConfig: {
|
|
138
138
|
mode: "inlineSpread"
|
|
139
139
|
}
|
|
@@ -185,7 +185,7 @@ function Operations({ name, operations }) {
|
|
|
185
185
|
method: operation.method
|
|
186
186
|
};
|
|
187
187
|
});
|
|
188
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject,
|
|
188
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject, undefined, 2) }) });
|
|
189
189
|
}
|
|
190
190
|
function getParams3({}) {
|
|
191
191
|
return react.FunctionParams.factory({});
|
|
@@ -211,25 +211,25 @@ function getParams4({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
|
211
211
|
data: typeSchemas.request?.name ? {
|
|
212
212
|
type: typeSchemas.request?.name,
|
|
213
213
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
214
|
-
} :
|
|
214
|
+
} : undefined,
|
|
215
215
|
params: typeSchemas.queryParams?.name ? {
|
|
216
216
|
type: typeSchemas.queryParams?.name,
|
|
217
217
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
218
|
-
} :
|
|
218
|
+
} : undefined,
|
|
219
219
|
headers: typeSchemas.headerParams?.name ? {
|
|
220
220
|
type: typeSchemas.headerParams?.name,
|
|
221
221
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
222
|
-
} :
|
|
222
|
+
} : undefined
|
|
223
223
|
});
|
|
224
224
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
225
225
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
226
|
-
const generics = [TData, TError, TRequest ? `{${TRequest}}` :
|
|
226
|
+
const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
|
|
227
227
|
return react.FunctionParams.factory({
|
|
228
228
|
options: {
|
|
229
229
|
type: `
|
|
230
230
|
{
|
|
231
231
|
mutation?: UseMutationOptions<${generics}>,
|
|
232
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
232
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"},
|
|
233
233
|
}
|
|
234
234
|
`,
|
|
235
235
|
default: "{}"
|
|
@@ -268,15 +268,15 @@ function Mutation({
|
|
|
268
268
|
data: typeSchemas.request?.name ? {
|
|
269
269
|
type: typeSchemas.request?.name,
|
|
270
270
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
271
|
-
} :
|
|
271
|
+
} : undefined,
|
|
272
272
|
params: typeSchemas.queryParams?.name ? {
|
|
273
273
|
type: typeSchemas.queryParams?.name,
|
|
274
274
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
275
|
-
} :
|
|
275
|
+
} : undefined,
|
|
276
276
|
headers: typeSchemas.headerParams?.name ? {
|
|
277
277
|
type: typeSchemas.headerParams?.name,
|
|
278
278
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
279
|
-
} :
|
|
279
|
+
} : undefined
|
|
280
280
|
});
|
|
281
281
|
const dataParams = react.FunctionParams.factory({
|
|
282
282
|
data: {
|
|
@@ -287,7 +287,7 @@ function Mutation({
|
|
|
287
287
|
if (value) {
|
|
288
288
|
acc[key] = {
|
|
289
289
|
...value,
|
|
290
|
-
type:
|
|
290
|
+
type: undefined
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
return acc;
|
|
@@ -297,7 +297,7 @@ function Mutation({
|
|
|
297
297
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
298
298
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
299
299
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
300
|
-
const generics = [TData, TError, TRequest ? `{${TRequest}}` :
|
|
300
|
+
const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
|
|
301
301
|
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
302
302
|
react.Function,
|
|
303
303
|
{
|
|
@@ -331,11 +331,11 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
331
331
|
data: typeSchemas.request?.name ? {
|
|
332
332
|
type: typeSchemas.request?.name,
|
|
333
333
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
334
|
-
} :
|
|
334
|
+
} : undefined,
|
|
335
335
|
params: typeSchemas.queryParams?.name ? {
|
|
336
336
|
type: typeSchemas.queryParams?.name,
|
|
337
337
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
338
|
-
} :
|
|
338
|
+
} : undefined
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
@@ -345,8 +345,8 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
|
345
345
|
type: "path",
|
|
346
346
|
stringify: true
|
|
347
347
|
}),
|
|
348
|
-
schemas.queryParams?.name ? "...(params ? [params] : [])" :
|
|
349
|
-
schemas.request?.name ? "...(data ? [data] : [])" :
|
|
348
|
+
schemas.queryParams?.name ? "...(params ? [params] : [])" : undefined,
|
|
349
|
+
schemas.request?.name ? "...(data ? [data] : [])" : undefined
|
|
350
350
|
].filter(Boolean);
|
|
351
351
|
return keys;
|
|
352
352
|
};
|
|
@@ -374,19 +374,19 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
374
374
|
data: typeSchemas.request?.name ? {
|
|
375
375
|
type: typeSchemas.request?.name,
|
|
376
376
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
377
|
-
} :
|
|
377
|
+
} : undefined,
|
|
378
378
|
params: typeSchemas.queryParams?.name ? {
|
|
379
379
|
type: typeSchemas.queryParams?.name,
|
|
380
380
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
381
|
-
} :
|
|
381
|
+
} : undefined,
|
|
382
382
|
headers: typeSchemas.headerParams?.name ? {
|
|
383
383
|
type: typeSchemas.headerParams?.name,
|
|
384
384
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
385
|
-
} :
|
|
385
|
+
} : undefined
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
388
|
config: {
|
|
389
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
389
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
390
390
|
default: "{}"
|
|
391
391
|
}
|
|
392
392
|
});
|
|
@@ -396,21 +396,21 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
396
396
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
397
397
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
398
398
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
399
|
-
} :
|
|
399
|
+
} : undefined,
|
|
400
400
|
data: typeSchemas.request?.name ? {
|
|
401
401
|
type: typeSchemas.request?.name,
|
|
402
402
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
403
|
-
} :
|
|
403
|
+
} : undefined,
|
|
404
404
|
params: typeSchemas.queryParams?.name ? {
|
|
405
405
|
type: typeSchemas.queryParams?.name,
|
|
406
406
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
407
|
-
} :
|
|
407
|
+
} : undefined,
|
|
408
408
|
headers: typeSchemas.headerParams?.name ? {
|
|
409
409
|
type: typeSchemas.headerParams?.name,
|
|
410
410
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
411
|
-
} :
|
|
411
|
+
} : undefined,
|
|
412
412
|
config: {
|
|
413
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
413
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
414
414
|
default: "{}"
|
|
415
415
|
}
|
|
416
416
|
});
|
|
@@ -430,7 +430,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
430
430
|
typeSchemas,
|
|
431
431
|
paramsCasing
|
|
432
432
|
});
|
|
433
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
433
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
434
434
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
435
435
|
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { name, export: true, params: params.toConstructor(), children: `
|
|
436
436
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
@@ -457,22 +457,22 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
457
457
|
data: typeSchemas.request?.name ? {
|
|
458
458
|
type: typeSchemas.request?.name,
|
|
459
459
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
460
|
-
} :
|
|
460
|
+
} : undefined,
|
|
461
461
|
params: typeSchemas.queryParams?.name ? {
|
|
462
462
|
type: typeSchemas.queryParams?.name,
|
|
463
463
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
464
|
-
} :
|
|
464
|
+
} : undefined,
|
|
465
465
|
headers: typeSchemas.headerParams?.name ? {
|
|
466
466
|
type: typeSchemas.headerParams?.name,
|
|
467
467
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
468
|
-
} :
|
|
468
|
+
} : undefined
|
|
469
469
|
}
|
|
470
470
|
},
|
|
471
471
|
options: {
|
|
472
472
|
type: `
|
|
473
473
|
{
|
|
474
474
|
query?: Partial<QueryObserverOptions<${[TData, TError, "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
475
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
475
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
476
476
|
}
|
|
477
477
|
`,
|
|
478
478
|
default: "{}"
|
|
@@ -484,24 +484,24 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
484
484
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
485
485
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
486
486
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
487
|
-
} :
|
|
487
|
+
} : undefined,
|
|
488
488
|
data: typeSchemas.request?.name ? {
|
|
489
489
|
type: typeSchemas.request?.name,
|
|
490
490
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
491
|
-
} :
|
|
491
|
+
} : undefined,
|
|
492
492
|
params: typeSchemas.queryParams?.name ? {
|
|
493
493
|
type: typeSchemas.queryParams?.name,
|
|
494
494
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
495
|
-
} :
|
|
495
|
+
} : undefined,
|
|
496
496
|
headers: typeSchemas.headerParams?.name ? {
|
|
497
497
|
type: typeSchemas.headerParams?.name,
|
|
498
498
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
499
|
-
} :
|
|
499
|
+
} : undefined,
|
|
500
500
|
options: {
|
|
501
501
|
type: `
|
|
502
502
|
{
|
|
503
503
|
query?: Partial<QueryObserverOptions<${[TData, TError, "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
504
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
504
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
505
505
|
}
|
|
506
506
|
`,
|
|
507
507
|
default: "{}"
|
|
@@ -581,19 +581,19 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
581
581
|
data: typeSchemas.request?.name ? {
|
|
582
582
|
type: typeSchemas.request?.name,
|
|
583
583
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
584
|
-
} :
|
|
584
|
+
} : undefined,
|
|
585
585
|
params: typeSchemas.queryParams?.name ? {
|
|
586
586
|
type: typeSchemas.queryParams?.name,
|
|
587
587
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
588
|
-
} :
|
|
588
|
+
} : undefined,
|
|
589
589
|
headers: typeSchemas.headerParams?.name ? {
|
|
590
590
|
type: typeSchemas.headerParams?.name,
|
|
591
591
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
592
|
-
} :
|
|
592
|
+
} : undefined
|
|
593
593
|
}
|
|
594
594
|
},
|
|
595
595
|
config: {
|
|
596
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
596
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
597
597
|
default: "{}"
|
|
598
598
|
}
|
|
599
599
|
});
|
|
@@ -603,21 +603,21 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
603
603
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
604
604
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
605
605
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
606
|
-
} :
|
|
606
|
+
} : undefined,
|
|
607
607
|
data: typeSchemas.request?.name ? {
|
|
608
608
|
type: typeSchemas.request?.name,
|
|
609
609
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
610
|
-
} :
|
|
610
|
+
} : undefined,
|
|
611
611
|
params: typeSchemas.queryParams?.name ? {
|
|
612
612
|
type: typeSchemas.queryParams?.name,
|
|
613
613
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
614
|
-
} :
|
|
614
|
+
} : undefined,
|
|
615
615
|
headers: typeSchemas.headerParams?.name ? {
|
|
616
616
|
type: typeSchemas.headerParams?.name,
|
|
617
617
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
618
|
-
} :
|
|
618
|
+
} : undefined,
|
|
619
619
|
config: {
|
|
620
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
620
|
+
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
621
621
|
default: "{}"
|
|
622
622
|
}
|
|
623
623
|
});
|
|
@@ -651,17 +651,17 @@ function InfiniteQueryOptions({
|
|
|
651
651
|
});
|
|
652
652
|
const queryOptions = [
|
|
653
653
|
`initialPageParam: ${typeof initialPageParam === "string" ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
654
|
-
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` :
|
|
655
|
-
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` :
|
|
656
|
-
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" :
|
|
657
|
-
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" :
|
|
658
|
-
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" :
|
|
654
|
+
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : undefined,
|
|
655
|
+
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : undefined,
|
|
656
|
+
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
657
|
+
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
658
|
+
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" : undefined
|
|
659
659
|
].filter(Boolean);
|
|
660
660
|
const infiniteOverrideParams = queryParam && typeSchemas.queryParams?.name ? `
|
|
661
661
|
if(params) {
|
|
662
662
|
params['${queryParam}'] = pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}']
|
|
663
663
|
}` : "";
|
|
664
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
664
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
665
665
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
666
666
|
if (infiniteOverrideParams) {
|
|
667
667
|
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { name, export: true, params: params.toConstructor(), children: `
|
|
@@ -704,22 +704,22 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
704
704
|
data: typeSchemas.request?.name ? {
|
|
705
705
|
type: typeSchemas.request?.name,
|
|
706
706
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
707
|
-
} :
|
|
707
|
+
} : undefined,
|
|
708
708
|
params: typeSchemas.queryParams?.name ? {
|
|
709
709
|
type: typeSchemas.queryParams?.name,
|
|
710
710
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
711
|
-
} :
|
|
711
|
+
} : undefined,
|
|
712
712
|
headers: typeSchemas.headerParams?.name ? {
|
|
713
713
|
type: typeSchemas.headerParams?.name,
|
|
714
714
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
715
|
-
} :
|
|
715
|
+
} : undefined
|
|
716
716
|
}
|
|
717
717
|
},
|
|
718
718
|
options: {
|
|
719
719
|
type: `
|
|
720
720
|
{
|
|
721
721
|
query?: Partial<InfiniteQueryObserverOptions<${[TData, TError, "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
722
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
722
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
723
723
|
}
|
|
724
724
|
`,
|
|
725
725
|
default: "{}"
|
|
@@ -731,24 +731,24 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
731
731
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
732
732
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
733
733
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
734
|
-
} :
|
|
734
|
+
} : undefined,
|
|
735
735
|
data: typeSchemas.request?.name ? {
|
|
736
736
|
type: typeSchemas.request?.name,
|
|
737
737
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
738
|
-
} :
|
|
738
|
+
} : undefined,
|
|
739
739
|
params: typeSchemas.queryParams?.name ? {
|
|
740
740
|
type: typeSchemas.queryParams?.name,
|
|
741
741
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
742
|
-
} :
|
|
742
|
+
} : undefined,
|
|
743
743
|
headers: typeSchemas.headerParams?.name ? {
|
|
744
744
|
type: typeSchemas.headerParams?.name,
|
|
745
745
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
746
|
-
} :
|
|
746
|
+
} : undefined,
|
|
747
747
|
options: {
|
|
748
748
|
type: `
|
|
749
749
|
{
|
|
750
750
|
query?: Partial<InfiniteQueryObserverOptions<${[TData, TError, "TData", "TQueryData", "TQueryKey"].join(", ")}>>,
|
|
751
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
751
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
752
752
|
}
|
|
753
753
|
`,
|
|
754
754
|
default: "{}"
|
|
@@ -830,22 +830,22 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
830
830
|
data: typeSchemas.request?.name ? {
|
|
831
831
|
type: typeSchemas.request?.name,
|
|
832
832
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
833
|
-
} :
|
|
833
|
+
} : undefined,
|
|
834
834
|
params: typeSchemas.queryParams?.name ? {
|
|
835
835
|
type: typeSchemas.queryParams?.name,
|
|
836
836
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
837
|
-
} :
|
|
837
|
+
} : undefined,
|
|
838
838
|
headers: typeSchemas.headerParams?.name ? {
|
|
839
839
|
type: typeSchemas.headerParams?.name,
|
|
840
840
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
841
|
-
} :
|
|
841
|
+
} : undefined
|
|
842
842
|
}
|
|
843
843
|
},
|
|
844
844
|
options: {
|
|
845
845
|
type: `
|
|
846
846
|
{
|
|
847
847
|
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, "TData", "TQueryKey"].join(", ")}>>,
|
|
848
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
848
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
849
849
|
}
|
|
850
850
|
`,
|
|
851
851
|
default: "{}"
|
|
@@ -857,24 +857,24 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
857
857
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
858
858
|
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
859
859
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
860
|
-
} :
|
|
860
|
+
} : undefined,
|
|
861
861
|
data: typeSchemas.request?.name ? {
|
|
862
862
|
type: typeSchemas.request?.name,
|
|
863
863
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
864
|
-
} :
|
|
864
|
+
} : undefined,
|
|
865
865
|
params: typeSchemas.queryParams?.name ? {
|
|
866
866
|
type: typeSchemas.queryParams?.name,
|
|
867
867
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
868
|
-
} :
|
|
868
|
+
} : undefined,
|
|
869
869
|
headers: typeSchemas.headerParams?.name ? {
|
|
870
870
|
type: typeSchemas.headerParams?.name,
|
|
871
871
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
872
|
-
} :
|
|
872
|
+
} : undefined,
|
|
873
873
|
options: {
|
|
874
874
|
type: `
|
|
875
875
|
{
|
|
876
876
|
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, "TData", "TQueryKey"].join(", ")}>>,
|
|
877
|
-
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}
|
|
877
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"}
|
|
878
878
|
}
|
|
879
879
|
`,
|
|
880
880
|
default: "{}"
|
|
@@ -956,5 +956,5 @@ exports.QueryKey = QueryKey;
|
|
|
956
956
|
exports.QueryOptions = QueryOptions;
|
|
957
957
|
exports.SuspenseQuery = SuspenseQuery;
|
|
958
958
|
exports.Url = Url;
|
|
959
|
-
//# sourceMappingURL=chunk-
|
|
960
|
-
//# sourceMappingURL=chunk-
|
|
959
|
+
//# sourceMappingURL=chunk-ODTL4QSL.cjs.map
|
|
960
|
+
//# sourceMappingURL=chunk-ODTL4QSL.cjs.map
|