@kubb/plugin-vue-query 3.5.6 → 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-4DQ4Y3AQ.cjs +3 -3
- package/dist/chunk-4DQ4Y3AQ.cjs.map +1 -1
- package/dist/chunk-EP2OLRIC.js +61 -61
- package/dist/chunk-EP2OLRIC.js.map +1 -1
- package/dist/chunk-LKS7YI73.js +3 -3
- package/dist/chunk-LKS7YI73.js.map +1 -1
- package/dist/chunk-ORYMG7R6.cjs +61 -61
- package/dist/chunk-ORYMG7R6.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/chunk-ORYMG7R6.cjs
CHANGED
|
@@ -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({});
|
|
@@ -221,22 +221,22 @@ function getParams4({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
|
221
221
|
data: typeSchemas.request?.name ? {
|
|
222
222
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
223
223
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
224
|
-
} :
|
|
224
|
+
} : undefined,
|
|
225
225
|
params: typeSchemas.queryParams?.name ? {
|
|
226
226
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
227
227
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
228
|
-
} :
|
|
228
|
+
} : undefined,
|
|
229
229
|
headers: typeSchemas.headerParams?.name ? {
|
|
230
230
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
231
231
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
232
|
-
} :
|
|
232
|
+
} : undefined
|
|
233
233
|
});
|
|
234
234
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
235
235
|
return react.FunctionParams.factory({
|
|
236
236
|
options: {
|
|
237
237
|
type: `
|
|
238
238
|
{
|
|
239
|
-
mutation?: MutationObserverOptions<${[TData, TError, TRequest ? `{${TRequest}}` :
|
|
239
|
+
mutation?: MutationObserverOptions<${[TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ")}>,
|
|
240
240
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }"},
|
|
241
241
|
}
|
|
242
242
|
`,
|
|
@@ -276,15 +276,15 @@ function Mutation({
|
|
|
276
276
|
data: typeSchemas.request?.name ? {
|
|
277
277
|
type: typeSchemas.request?.name,
|
|
278
278
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
279
|
-
} :
|
|
279
|
+
} : undefined,
|
|
280
280
|
params: typeSchemas.queryParams?.name ? {
|
|
281
281
|
type: typeSchemas.queryParams?.name,
|
|
282
282
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
283
|
-
} :
|
|
283
|
+
} : undefined,
|
|
284
284
|
headers: typeSchemas.headerParams?.name ? {
|
|
285
285
|
type: typeSchemas.headerParams?.name,
|
|
286
286
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
287
|
-
} :
|
|
287
|
+
} : undefined
|
|
288
288
|
});
|
|
289
289
|
const dataParams = react.FunctionParams.factory({
|
|
290
290
|
data: {
|
|
@@ -295,7 +295,7 @@ function Mutation({
|
|
|
295
295
|
if (value) {
|
|
296
296
|
acc[key] = {
|
|
297
297
|
...value,
|
|
298
|
-
type:
|
|
298
|
+
type: undefined
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
return acc;
|
|
@@ -305,7 +305,7 @@ function Mutation({
|
|
|
305
305
|
const TRequest = mutationParams.toConstructor({ valueAsType: true });
|
|
306
306
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
307
307
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
308
|
-
const generics = [TData, TError, TRequest ? `{${TRequest}}` :
|
|
308
|
+
const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
|
|
309
309
|
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
310
|
react.Function,
|
|
311
311
|
{
|
|
@@ -348,11 +348,11 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
348
348
|
data: typeSchemas.request?.name ? {
|
|
349
349
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
350
350
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
351
|
-
} :
|
|
351
|
+
} : undefined,
|
|
352
352
|
params: typeSchemas.queryParams?.name ? {
|
|
353
353
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
354
354
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
355
|
-
} :
|
|
355
|
+
} : undefined
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
@@ -362,8 +362,8 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
|
362
362
|
type: "path",
|
|
363
363
|
stringify: true
|
|
364
364
|
}),
|
|
365
|
-
schemas.queryParams?.name ? "...(params ? [params] : [])" :
|
|
366
|
-
schemas.request?.name ? "...(data ? [data] : [])" :
|
|
365
|
+
schemas.queryParams?.name ? "...(params ? [params] : [])" : undefined,
|
|
366
|
+
schemas.request?.name ? "...(data ? [data] : [])" : undefined
|
|
367
367
|
].filter(Boolean);
|
|
368
368
|
return keys;
|
|
369
369
|
};
|
|
@@ -400,15 +400,15 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
400
400
|
data: typeSchemas.request?.name ? {
|
|
401
401
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
402
402
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
403
|
-
} :
|
|
403
|
+
} : undefined,
|
|
404
404
|
params: typeSchemas.queryParams?.name ? {
|
|
405
405
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
406
406
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
407
|
-
} :
|
|
407
|
+
} : undefined,
|
|
408
408
|
headers: typeSchemas.headerParams?.name ? {
|
|
409
409
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
410
410
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
411
|
-
} :
|
|
411
|
+
} : undefined
|
|
412
412
|
}
|
|
413
413
|
},
|
|
414
414
|
config: {
|
|
@@ -435,15 +435,15 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
435
435
|
data: typeSchemas.request?.name ? {
|
|
436
436
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
437
437
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
438
|
-
} :
|
|
438
|
+
} : undefined,
|
|
439
439
|
params: typeSchemas.queryParams?.name ? {
|
|
440
440
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
441
441
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
442
|
-
} :
|
|
442
|
+
} : undefined,
|
|
443
443
|
headers: typeSchemas.headerParams?.name ? {
|
|
444
444
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
445
445
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
446
|
-
} :
|
|
446
|
+
} : undefined,
|
|
447
447
|
config: {
|
|
448
448
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
449
449
|
default: "{}"
|
|
@@ -465,7 +465,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
465
465
|
typeSchemas,
|
|
466
466
|
paramsCasing
|
|
467
467
|
});
|
|
468
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
468
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
469
469
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
470
470
|
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: `
|
|
471
471
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
@@ -505,15 +505,15 @@ function getParams7({ paramsCasing, paramsType, pathParamsType, dataReturnType,
|
|
|
505
505
|
data: typeSchemas.request?.name ? {
|
|
506
506
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
507
507
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
508
|
-
} :
|
|
508
|
+
} : undefined,
|
|
509
509
|
params: typeSchemas.queryParams?.name ? {
|
|
510
510
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
511
511
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
512
|
-
} :
|
|
512
|
+
} : undefined,
|
|
513
513
|
headers: typeSchemas.headerParams?.name ? {
|
|
514
514
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
515
515
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
516
|
-
} :
|
|
516
|
+
} : undefined
|
|
517
517
|
}
|
|
518
518
|
},
|
|
519
519
|
options: {
|
|
@@ -545,15 +545,15 @@ function getParams7({ paramsCasing, paramsType, pathParamsType, dataReturnType,
|
|
|
545
545
|
data: typeSchemas.request?.name ? {
|
|
546
546
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
547
547
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
548
|
-
} :
|
|
548
|
+
} : undefined,
|
|
549
549
|
params: typeSchemas.queryParams?.name ? {
|
|
550
550
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
551
551
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
552
|
-
} :
|
|
552
|
+
} : undefined,
|
|
553
553
|
headers: typeSchemas.headerParams?.name ? {
|
|
554
554
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
555
555
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
556
|
-
} :
|
|
556
|
+
} : undefined,
|
|
557
557
|
options: {
|
|
558
558
|
type: `
|
|
559
559
|
{
|
|
@@ -647,15 +647,15 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
647
647
|
data: typeSchemas.request?.name ? {
|
|
648
648
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
649
649
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
650
|
-
} :
|
|
650
|
+
} : undefined,
|
|
651
651
|
params: typeSchemas.queryParams?.name ? {
|
|
652
652
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
653
653
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
654
|
-
} :
|
|
654
|
+
} : undefined,
|
|
655
655
|
headers: typeSchemas.headerParams?.name ? {
|
|
656
656
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
657
657
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
658
|
-
} :
|
|
658
|
+
} : undefined
|
|
659
659
|
}
|
|
660
660
|
},
|
|
661
661
|
config: {
|
|
@@ -682,15 +682,15 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
682
682
|
data: typeSchemas.request?.name ? {
|
|
683
683
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
684
684
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
685
|
-
} :
|
|
685
|
+
} : undefined,
|
|
686
686
|
params: typeSchemas.queryParams?.name ? {
|
|
687
687
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
688
688
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
689
|
-
} :
|
|
689
|
+
} : undefined,
|
|
690
690
|
headers: typeSchemas.headerParams?.name ? {
|
|
691
691
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
692
692
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
693
|
-
} :
|
|
693
|
+
} : undefined,
|
|
694
694
|
config: {
|
|
695
695
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
696
696
|
default: "{}"
|
|
@@ -726,17 +726,17 @@ function InfiniteQueryOptions({
|
|
|
726
726
|
});
|
|
727
727
|
const queryOptions = [
|
|
728
728
|
`initialPageParam: ${typeof initialPageParam === "string" ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
729
|
-
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` :
|
|
730
|
-
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` :
|
|
731
|
-
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" :
|
|
732
|
-
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" :
|
|
733
|
-
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" :
|
|
729
|
+
cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : undefined,
|
|
730
|
+
cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : undefined,
|
|
731
|
+
!cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
732
|
+
!cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" : undefined,
|
|
733
|
+
!cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" : undefined
|
|
734
734
|
].filter(Boolean);
|
|
735
735
|
const infiniteOverrideParams = queryParam && typeSchemas.queryParams?.name ? `
|
|
736
736
|
if(params) {
|
|
737
737
|
params['${queryParam}'] = pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}']
|
|
738
738
|
}` : "";
|
|
739
|
-
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key :
|
|
739
|
+
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
|
|
740
740
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
741
741
|
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: `
|
|
742
742
|
const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
|
|
@@ -774,15 +774,15 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
774
774
|
data: typeSchemas.request?.name ? {
|
|
775
775
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
776
776
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
777
|
-
} :
|
|
777
|
+
} : undefined,
|
|
778
778
|
params: typeSchemas.queryParams?.name ? {
|
|
779
779
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
780
780
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
781
|
-
} :
|
|
781
|
+
} : undefined,
|
|
782
782
|
headers: typeSchemas.headerParams?.name ? {
|
|
783
783
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
784
784
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
785
|
-
} :
|
|
785
|
+
} : undefined
|
|
786
786
|
}
|
|
787
787
|
},
|
|
788
788
|
options: {
|
|
@@ -814,15 +814,15 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
814
814
|
data: typeSchemas.request?.name ? {
|
|
815
815
|
type: `MaybeRef<${typeSchemas.request?.name}>`,
|
|
816
816
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
817
|
-
} :
|
|
817
|
+
} : undefined,
|
|
818
818
|
params: typeSchemas.queryParams?.name ? {
|
|
819
819
|
type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
|
|
820
820
|
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
821
|
-
} :
|
|
821
|
+
} : undefined,
|
|
822
822
|
headers: typeSchemas.headerParams?.name ? {
|
|
823
823
|
type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
|
|
824
824
|
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
825
|
-
} :
|
|
825
|
+
} : undefined,
|
|
826
826
|
options: {
|
|
827
827
|
type: `
|
|
828
828
|
{
|