@kubb/plugin-vue-query 3.5.6 → 3.5.8
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-EP2OLRIC.js +61 -61
- package/dist/chunk-EP2OLRIC.js.map +1 -1
- package/dist/{chunk-4DQ4Y3AQ.cjs → chunk-JECOVJ5B.cjs} +8 -7
- package/dist/chunk-JECOVJ5B.cjs.map +1 -0
- package/dist/{chunk-LKS7YI73.js → chunk-NNCMGCEQ.js} +8 -7
- package/dist/chunk-NNCMGCEQ.js.map +1 -0
- package/dist/chunk-ORYMG7R6.cjs +61 -61
- package/dist/chunk-ORYMG7R6.cjs.map +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +6 -5
- 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 +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{types-DKq2nW8w.d.cts → types-po5UxnrN.d.cts} +16 -1
- package/dist/{types-DKq2nW8w.d.ts → types-po5UxnrN.d.ts} +16 -1
- package/package.json +12 -12
- package/src/plugin.ts +2 -1
- package/src/types.ts +6 -1
- package/dist/chunk-4DQ4Y3AQ.cjs.map +0 -1
- package/dist/chunk-LKS7YI73.js.map +0 -1
package/dist/chunk-EP2OLRIC.js
CHANGED
|
@@ -21,7 +21,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
21
21
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
22
22
|
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
23
23
|
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
24
|
-
} :
|
|
24
|
+
} : undefined
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
@@ -40,15 +40,15 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
40
40
|
data: typeSchemas.request?.name ? {
|
|
41
41
|
type: typeSchemas.request?.name,
|
|
42
42
|
optional: isOptional(typeSchemas.request?.schema)
|
|
43
|
-
} :
|
|
43
|
+
} : undefined,
|
|
44
44
|
params: typeSchemas.queryParams?.name ? {
|
|
45
45
|
type: typeSchemas.queryParams?.name,
|
|
46
46
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
47
|
-
} :
|
|
47
|
+
} : undefined,
|
|
48
48
|
headers: typeSchemas.headerParams?.name ? {
|
|
49
49
|
type: typeSchemas.headerParams?.name,
|
|
50
50
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
51
|
-
} :
|
|
51
|
+
} : undefined
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
config: {
|
|
@@ -62,19 +62,19 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
62
62
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
63
63
|
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
64
64
|
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
65
|
-
} :
|
|
65
|
+
} : undefined,
|
|
66
66
|
data: typeSchemas.request?.name ? {
|
|
67
67
|
type: typeSchemas.request?.name,
|
|
68
68
|
optional: isOptional(typeSchemas.request?.schema)
|
|
69
|
-
} :
|
|
69
|
+
} : undefined,
|
|
70
70
|
params: typeSchemas.queryParams?.name ? {
|
|
71
71
|
type: typeSchemas.queryParams?.name,
|
|
72
72
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
73
|
-
} :
|
|
73
|
+
} : undefined,
|
|
74
74
|
headers: typeSchemas.headerParams?.name ? {
|
|
75
75
|
type: typeSchemas.headerParams?.name,
|
|
76
76
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
77
|
-
} :
|
|
77
|
+
} : undefined,
|
|
78
78
|
config: {
|
|
79
79
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
80
80
|
default: "{}"
|
|
@@ -100,8 +100,8 @@ function Client({
|
|
|
100
100
|
const contentType = operation.getContentType();
|
|
101
101
|
const isFormData = contentType === "multipart/form-data";
|
|
102
102
|
const headers = [
|
|
103
|
-
contentType !== "application/json" ? `'Content-Type': '${contentType}'` :
|
|
104
|
-
typeSchemas.headerParams?.name ? "...headers" :
|
|
103
|
+
contentType !== "application/json" ? `'Content-Type': '${contentType}'` : undefined,
|
|
104
|
+
typeSchemas.headerParams?.name ? "...headers" : undefined
|
|
105
105
|
].filter(Boolean);
|
|
106
106
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
107
107
|
const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || "unknown"].filter(Boolean);
|
|
@@ -124,14 +124,14 @@ function Client({
|
|
|
124
124
|
},
|
|
125
125
|
baseURL: baseURL && !urlName ? {
|
|
126
126
|
value: JSON.stringify(baseURL)
|
|
127
|
-
} :
|
|
128
|
-
params: typeSchemas.queryParams?.name ? {} :
|
|
127
|
+
} : undefined,
|
|
128
|
+
params: typeSchemas.queryParams?.name ? {} : undefined,
|
|
129
129
|
data: typeSchemas.request?.name ? {
|
|
130
|
-
value: isFormData ? "formData" :
|
|
131
|
-
} :
|
|
130
|
+
value: isFormData ? "formData" : undefined
|
|
131
|
+
} : undefined,
|
|
132
132
|
headers: headers.length ? {
|
|
133
|
-
value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` :
|
|
134
|
-
} :
|
|
133
|
+
value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : undefined
|
|
134
|
+
} : undefined,
|
|
135
135
|
requestConfig: {
|
|
136
136
|
mode: "inlineSpread"
|
|
137
137
|
}
|
|
@@ -183,7 +183,7 @@ function Operations({ name, operations }) {
|
|
|
183
183
|
method: operation.method
|
|
184
184
|
};
|
|
185
185
|
});
|
|
186
|
-
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject,
|
|
186
|
+
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject, undefined, 2) }) });
|
|
187
187
|
}
|
|
188
188
|
function getParams3({}) {
|
|
189
189
|
return FunctionParams.factory({});
|
|
@@ -219,22 +219,22 @@ function getParams4({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
|
219
219
|
data: typeSchemas.request?.name ? {
|
|
220
220
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
221
221
|
optional: isOptional(typeSchemas.request?.schema)
|
|
222
|
-
} :
|
|
222
|
+
} : undefined,
|
|
223
223
|
params: typeSchemas.queryParams?.name ? {
|
|
224
224
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
225
225
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
226
|
-
} :
|
|
226
|
+
} : undefined,
|
|
227
227
|
headers: typeSchemas.headerParams?.name ? {
|
|
228
228
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
229
229
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
230
|
-
} :
|
|
230
|
+
} : undefined
|
|
231
231
|
});
|
|
232
232
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
233
233
|
return FunctionParams.factory({
|
|
234
234
|
options: {
|
|
235
235
|
type: `
|
|
236
236
|
{
|
|
237
|
-
mutation?: MutationObserverOptions<${[TData, TError, TRequest ? `{${TRequest}}` :
|
|
237
|
+
mutation?: MutationObserverOptions<${[TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ")}>,
|
|
238
238
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"},
|
|
239
239
|
}
|
|
240
240
|
`,
|
|
@@ -274,15 +274,15 @@ function Mutation({
|
|
|
274
274
|
data: typeSchemas.request?.name ? {
|
|
275
275
|
type: typeSchemas.request?.name,
|
|
276
276
|
optional: isOptional(typeSchemas.request?.schema)
|
|
277
|
-
} :
|
|
277
|
+
} : undefined,
|
|
278
278
|
params: typeSchemas.queryParams?.name ? {
|
|
279
279
|
type: typeSchemas.queryParams?.name,
|
|
280
280
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
281
|
-
} :
|
|
281
|
+
} : undefined,
|
|
282
282
|
headers: typeSchemas.headerParams?.name ? {
|
|
283
283
|
type: typeSchemas.headerParams?.name,
|
|
284
284
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
285
|
-
} :
|
|
285
|
+
} : undefined
|
|
286
286
|
});
|
|
287
287
|
const dataParams = FunctionParams.factory({
|
|
288
288
|
data: {
|
|
@@ -293,7 +293,7 @@ function Mutation({
|
|
|
293
293
|
if (value) {
|
|
294
294
|
acc[key] = {
|
|
295
295
|
...value,
|
|
296
|
-
type:
|
|
296
|
+
type: undefined
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
return acc;
|
|
@@ -303,7 +303,7 @@ function Mutation({
|
|
|
303
303
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
304
304
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
305
305
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
306
|
-
const generics = [TData, TError, TRequest ? `{${TRequest}}` :
|
|
306
|
+
const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
|
|
307
307
|
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(
|
|
308
308
|
Function,
|
|
309
309
|
{
|
|
@@ -346,11 +346,11 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
346
346
|
data: typeSchemas.request?.name ? {
|
|
347
347
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
348
348
|
optional: isOptional(typeSchemas.request?.schema)
|
|
349
|
-
} :
|
|
349
|
+
} : undefined,
|
|
350
350
|
params: typeSchemas.queryParams?.name ? {
|
|
351
351
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
352
352
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
353
|
-
} :
|
|
353
|
+
} : undefined
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
@@ -360,8 +360,8 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
|
360
360
|
type: "path",
|
|
361
361
|
stringify: true
|
|
362
362
|
}),
|
|
363
|
-
schemas.queryParams?.name ? "...(params ? [params] : [])" :
|
|
364
|
-
schemas.request?.name ? "...(data ? [data] : [])" :
|
|
363
|
+
schemas.queryParams?.name ? "...(params ? [params] : [])" : undefined,
|
|
364
|
+
schemas.request?.name ? "...(data ? [data] : [])" : undefined
|
|
365
365
|
].filter(Boolean);
|
|
366
366
|
return keys;
|
|
367
367
|
};
|
|
@@ -398,15 +398,15 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
398
398
|
data: typeSchemas.request?.name ? {
|
|
399
399
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
400
400
|
optional: isOptional(typeSchemas.request?.schema)
|
|
401
|
-
} :
|
|
401
|
+
} : undefined,
|
|
402
402
|
params: typeSchemas.queryParams?.name ? {
|
|
403
403
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
404
404
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
405
|
-
} :
|
|
405
|
+
} : undefined,
|
|
406
406
|
headers: typeSchemas.headerParams?.name ? {
|
|
407
407
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
408
408
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
409
|
-
} :
|
|
409
|
+
} : undefined
|
|
410
410
|
}
|
|
411
411
|
},
|
|
412
412
|
config: {
|
|
@@ -433,15 +433,15 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
433
433
|
data: typeSchemas.request?.name ? {
|
|
434
434
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
435
435
|
optional: isOptional(typeSchemas.request?.schema)
|
|
436
|
-
} :
|
|
436
|
+
} : undefined,
|
|
437
437
|
params: typeSchemas.queryParams?.name ? {
|
|
438
438
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
439
439
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
440
|
-
} :
|
|
440
|
+
} : undefined,
|
|
441
441
|
headers: typeSchemas.headerParams?.name ? {
|
|
442
442
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
443
443
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
444
|
-
} :
|
|
444
|
+
} : undefined,
|
|
445
445
|
config: {
|
|
446
446
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
447
447
|
default: "{}"
|
|
@@ -463,7 +463,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
463
463
|
typeSchemas,
|
|
464
464
|
paramsCasing
|
|
465
465
|
});
|
|
466
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
466
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
467
467
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
468
468
|
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function, { name, export: true, params: params.toConstructor(), children: `
|
|
469
469
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
@@ -503,15 +503,15 @@ function getParams7({ paramsCasing, paramsType, pathParamsType, dataReturnType,
|
|
|
503
503
|
data: typeSchemas.request?.name ? {
|
|
504
504
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
505
505
|
optional: isOptional(typeSchemas.request?.schema)
|
|
506
|
-
} :
|
|
506
|
+
} : undefined,
|
|
507
507
|
params: typeSchemas.queryParams?.name ? {
|
|
508
508
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
509
509
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
510
|
-
} :
|
|
510
|
+
} : undefined,
|
|
511
511
|
headers: typeSchemas.headerParams?.name ? {
|
|
512
512
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
513
513
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
514
|
-
} :
|
|
514
|
+
} : undefined
|
|
515
515
|
}
|
|
516
516
|
},
|
|
517
517
|
options: {
|
|
@@ -543,15 +543,15 @@ function getParams7({ paramsCasing, paramsType, pathParamsType, dataReturnType,
|
|
|
543
543
|
data: typeSchemas.request?.name ? {
|
|
544
544
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
545
545
|
optional: isOptional(typeSchemas.request?.schema)
|
|
546
|
-
} :
|
|
546
|
+
} : undefined,
|
|
547
547
|
params: typeSchemas.queryParams?.name ? {
|
|
548
548
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
549
549
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
550
|
-
} :
|
|
550
|
+
} : undefined,
|
|
551
551
|
headers: typeSchemas.headerParams?.name ? {
|
|
552
552
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
553
553
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
554
|
-
} :
|
|
554
|
+
} : undefined,
|
|
555
555
|
options: {
|
|
556
556
|
type: `
|
|
557
557
|
{
|
|
@@ -645,15 +645,15 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
645
645
|
data: typeSchemas.request?.name ? {
|
|
646
646
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
647
647
|
optional: isOptional(typeSchemas.request?.schema)
|
|
648
|
-
} :
|
|
648
|
+
} : undefined,
|
|
649
649
|
params: typeSchemas.queryParams?.name ? {
|
|
650
650
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
651
651
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
652
|
-
} :
|
|
652
|
+
} : undefined,
|
|
653
653
|
headers: typeSchemas.headerParams?.name ? {
|
|
654
654
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
655
655
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
656
|
-
} :
|
|
656
|
+
} : undefined
|
|
657
657
|
}
|
|
658
658
|
},
|
|
659
659
|
config: {
|
|
@@ -680,15 +680,15 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
680
680
|
data: typeSchemas.request?.name ? {
|
|
681
681
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
682
682
|
optional: isOptional(typeSchemas.request?.schema)
|
|
683
|
-
} :
|
|
683
|
+
} : undefined,
|
|
684
684
|
params: typeSchemas.queryParams?.name ? {
|
|
685
685
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
686
686
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
687
|
-
} :
|
|
687
|
+
} : undefined,
|
|
688
688
|
headers: typeSchemas.headerParams?.name ? {
|
|
689
689
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
690
690
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
691
|
-
} :
|
|
691
|
+
} : undefined,
|
|
692
692
|
config: {
|
|
693
693
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
694
694
|
default: "{}"
|
|
@@ -724,17 +724,17 @@ function InfiniteQueryOptions({
|
|
|
724
724
|
});
|
|
725
725
|
const queryOptions = [
|
|
726
726
|
`initialPageParam: ${typeof initialPageParam === "string" ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
727
|
-
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` :
|
|
728
|
-
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` :
|
|
729
|
-
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" :
|
|
730
|
-
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" :
|
|
731
|
-
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" :
|
|
727
|
+
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : undefined,
|
|
728
|
+
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : undefined,
|
|
729
|
+
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
730
|
+
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
731
|
+
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" : undefined
|
|
732
732
|
].filter(Boolean);
|
|
733
733
|
const infiniteOverrideParams = queryParam && typeSchemas.queryParams?.name ? `
|
|
734
734
|
if(params) {
|
|
735
735
|
params['${queryParam}'] = pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}']
|
|
736
736
|
}` : "";
|
|
737
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
737
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
738
738
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
739
739
|
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function, { name, export: true, params: params.toConstructor(), children: `
|
|
740
740
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
@@ -772,15 +772,15 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
772
772
|
data: typeSchemas.request?.name ? {
|
|
773
773
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
774
774
|
optional: isOptional(typeSchemas.request?.schema)
|
|
775
|
-
} :
|
|
775
|
+
} : undefined,
|
|
776
776
|
params: typeSchemas.queryParams?.name ? {
|
|
777
777
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
778
778
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
779
|
-
} :
|
|
779
|
+
} : undefined,
|
|
780
780
|
headers: typeSchemas.headerParams?.name ? {
|
|
781
781
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
782
782
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
783
|
-
} :
|
|
783
|
+
} : undefined
|
|
784
784
|
}
|
|
785
785
|
},
|
|
786
786
|
options: {
|
|
@@ -812,15 +812,15 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
812
812
|
data: typeSchemas.request?.name ? {
|
|
813
813
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
814
814
|
optional: isOptional(typeSchemas.request?.schema)
|
|
815
|
-
} :
|
|
815
|
+
} : undefined,
|
|
816
816
|
params: typeSchemas.queryParams?.name ? {
|
|
817
817
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
818
818
|
optional: isOptional(typeSchemas.queryParams?.schema)
|
|
819
|
-
} :
|
|
819
|
+
} : undefined,
|
|
820
820
|
headers: typeSchemas.headerParams?.name ? {
|
|
821
821
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
822
822
|
optional: isOptional(typeSchemas.headerParams?.schema)
|
|
823
|
-
} :
|
|
823
|
+
} : undefined,
|
|
824
824
|
options: {
|
|
825
825
|
type: `
|
|
826
826
|
{
|