@kubb/plugin-vue-query 4.12.2 → 4.12.4
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/{components-SMmSlG37.cjs → components-CpE5cSDx.cjs} +97 -97
- package/dist/{components-SMmSlG37.cjs.map → components-CpE5cSDx.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/{generators-M5BAqtv4.cjs → generators-BSkCG7hV.cjs} +119 -119
- package/dist/{generators-M5BAqtv4.cjs.map → generators-BSkCG7hV.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const require_generators = require('./generators-
|
|
2
|
-
let
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
1
|
+
const require_generators = require('./generators-BSkCG7hV.cjs');
|
|
2
|
+
let _kubb_core_utils = require("@kubb/core/utils");
|
|
3
|
+
let _kubb_oas = require("@kubb/oas");
|
|
4
|
+
let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
5
|
+
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
6
|
+
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
7
|
+
let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
8
8
|
|
|
9
9
|
//#region src/components/QueryKey.tsx
|
|
10
10
|
function getParams$6({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
11
|
-
return
|
|
11
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
12
12
|
pathParams: {
|
|
13
13
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
14
|
-
children: (0,
|
|
14
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
15
15
|
typed: true,
|
|
16
16
|
casing: paramsCasing,
|
|
17
17
|
override(item) {
|
|
@@ -24,17 +24,17 @@ function getParams$6({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
24
24
|
},
|
|
25
25
|
data: typeSchemas.request?.name ? {
|
|
26
26
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
27
|
-
optional: (0,
|
|
27
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
28
28
|
} : void 0,
|
|
29
29
|
params: typeSchemas.queryParams?.name ? {
|
|
30
30
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
31
|
-
optional: (0,
|
|
31
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
32
32
|
} : void 0
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
const getTransformer$1 = ({ operation, schemas, casing }) => {
|
|
36
36
|
return [
|
|
37
|
-
new
|
|
37
|
+
new _kubb_core_utils.URLPath(operation.path, { casing }).toObject({
|
|
38
38
|
type: "path",
|
|
39
39
|
stringify: true
|
|
40
40
|
}),
|
|
@@ -53,23 +53,23 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
53
53
|
schemas: typeSchemas,
|
|
54
54
|
casing: paramsCasing
|
|
55
55
|
});
|
|
56
|
-
return /* @__PURE__ */ (0,
|
|
56
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
57
57
|
name,
|
|
58
58
|
isExportable: true,
|
|
59
59
|
isIndexable: true,
|
|
60
|
-
children: /* @__PURE__ */ (0,
|
|
60
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function.Arrow, {
|
|
61
61
|
name,
|
|
62
62
|
export: true,
|
|
63
63
|
params: params.toConstructor(),
|
|
64
64
|
singleLine: true,
|
|
65
65
|
children: `[${keys.join(", ")}] as const`
|
|
66
66
|
})
|
|
67
|
-
}), /* @__PURE__ */ (0,
|
|
67
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
68
68
|
name: typeName,
|
|
69
69
|
isExportable: true,
|
|
70
70
|
isIndexable: true,
|
|
71
71
|
isTypeOnly: true,
|
|
72
|
-
children: /* @__PURE__ */ (0,
|
|
72
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
|
|
73
73
|
name: typeName,
|
|
74
74
|
export: true,
|
|
75
75
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -82,11 +82,11 @@ QueryKey.getTransformer = getTransformer$1;
|
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/components/QueryOptions.tsx
|
|
84
84
|
function getParams$5({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
85
|
-
if (paramsType === "object") return
|
|
85
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
|
|
86
86
|
data: {
|
|
87
87
|
mode: "object",
|
|
88
88
|
children: {
|
|
89
|
-
...(0,
|
|
89
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
90
90
|
typed: true,
|
|
91
91
|
casing: paramsCasing,
|
|
92
92
|
override(item) {
|
|
@@ -98,15 +98,15 @@ function getParams$5({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
98
98
|
}),
|
|
99
99
|
data: typeSchemas.request?.name ? {
|
|
100
100
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
101
|
-
optional: (0,
|
|
101
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
102
102
|
} : void 0,
|
|
103
103
|
params: typeSchemas.queryParams?.name ? {
|
|
104
104
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
105
|
-
optional: (0,
|
|
105
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
106
106
|
} : void 0,
|
|
107
107
|
headers: typeSchemas.headerParams?.name ? {
|
|
108
108
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
109
|
-
optional: (0,
|
|
109
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
110
110
|
} : void 0
|
|
111
111
|
}
|
|
112
112
|
},
|
|
@@ -115,11 +115,11 @@ function getParams$5({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
115
115
|
default: "{}"
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
|
-
return
|
|
118
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
119
119
|
pathParams: {
|
|
120
120
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
121
|
-
optional: (0,
|
|
122
|
-
children: (0,
|
|
121
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema),
|
|
122
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
123
123
|
typed: true,
|
|
124
124
|
casing: paramsCasing,
|
|
125
125
|
override(item) {
|
|
@@ -132,15 +132,15 @@ function getParams$5({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
132
132
|
},
|
|
133
133
|
data: typeSchemas.request?.name ? {
|
|
134
134
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
135
|
-
optional: (0,
|
|
135
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
136
136
|
} : void 0,
|
|
137
137
|
params: typeSchemas.queryParams?.name ? {
|
|
138
138
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
139
|
-
optional: (0,
|
|
139
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
140
140
|
} : void 0,
|
|
141
141
|
headers: typeSchemas.headerParams?.name ? {
|
|
142
142
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
143
|
-
optional: (0,
|
|
143
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
144
144
|
} : void 0,
|
|
145
145
|
config: {
|
|
146
146
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
|
|
@@ -157,7 +157,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
157
157
|
pathParamsType,
|
|
158
158
|
typeSchemas
|
|
159
159
|
});
|
|
160
|
-
const clientParams =
|
|
160
|
+
const clientParams = _kubb_plugin_client_components.Client.getParams({
|
|
161
161
|
paramsType,
|
|
162
162
|
paramsCasing,
|
|
163
163
|
typeSchemas,
|
|
@@ -171,11 +171,11 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
171
171
|
});
|
|
172
172
|
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? `${key}` : void 0).filter(Boolean).join(" && ");
|
|
173
173
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
174
|
-
return /* @__PURE__ */ (0,
|
|
174
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
175
175
|
name,
|
|
176
176
|
isExportable: true,
|
|
177
177
|
isIndexable: true,
|
|
178
|
-
children: /* @__PURE__ */ (0,
|
|
178
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
179
179
|
name,
|
|
180
180
|
export: true,
|
|
181
181
|
params: params.toConstructor(),
|
|
@@ -202,11 +202,11 @@ QueryOptions.getParams = getParams$5;
|
|
|
202
202
|
function getParams$4({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
203
203
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
204
204
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
205
|
-
if (paramsType === "object") return
|
|
205
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
|
|
206
206
|
data: {
|
|
207
207
|
mode: "object",
|
|
208
208
|
children: {
|
|
209
|
-
...(0,
|
|
209
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
210
210
|
typed: true,
|
|
211
211
|
casing: paramsCasing,
|
|
212
212
|
override(item) {
|
|
@@ -218,15 +218,15 @@ function getParams$4({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
218
218
|
}),
|
|
219
219
|
data: typeSchemas.request?.name ? {
|
|
220
220
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
221
|
-
optional: (0,
|
|
221
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
222
222
|
} : void 0,
|
|
223
223
|
params: typeSchemas.queryParams?.name ? {
|
|
224
224
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
225
|
-
optional: (0,
|
|
225
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
226
226
|
} : void 0,
|
|
227
227
|
headers: typeSchemas.headerParams?.name ? {
|
|
228
228
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
229
|
-
optional: (0,
|
|
229
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
230
230
|
} : void 0
|
|
231
231
|
}
|
|
232
232
|
},
|
|
@@ -246,11 +246,11 @@ function getParams$4({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
246
246
|
default: "{}"
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
|
-
return
|
|
249
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
250
250
|
pathParams: {
|
|
251
251
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
252
|
-
optional: (0,
|
|
253
|
-
children: (0,
|
|
252
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema),
|
|
253
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
254
254
|
typed: true,
|
|
255
255
|
casing: paramsCasing,
|
|
256
256
|
override(item) {
|
|
@@ -263,15 +263,15 @@ function getParams$4({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
263
263
|
},
|
|
264
264
|
data: typeSchemas.request?.name ? {
|
|
265
265
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
266
|
-
optional: (0,
|
|
266
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
267
267
|
} : void 0,
|
|
268
268
|
params: typeSchemas.queryParams?.name ? {
|
|
269
269
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
270
|
-
optional: (0,
|
|
270
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
271
271
|
} : void 0,
|
|
272
272
|
headers: typeSchemas.headerParams?.name ? {
|
|
273
273
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
274
|
-
optional: (0,
|
|
274
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
275
275
|
} : void 0,
|
|
276
276
|
options: {
|
|
277
277
|
type: `
|
|
@@ -318,16 +318,16 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
|
|
|
318
318
|
typeSchemas
|
|
319
319
|
});
|
|
320
320
|
const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`;
|
|
321
|
-
return /* @__PURE__ */ (0,
|
|
321
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
322
322
|
name,
|
|
323
323
|
isExportable: true,
|
|
324
324
|
isIndexable: true,
|
|
325
|
-
children: /* @__PURE__ */ (0,
|
|
325
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
326
326
|
name,
|
|
327
327
|
export: true,
|
|
328
328
|
generics: generics.join(", "),
|
|
329
329
|
params: params.toConstructor(),
|
|
330
|
-
JSDoc: { comments: (0,
|
|
330
|
+
JSDoc: { comments: (0, _kubb_plugin_oas_utils.getComments)(operation) },
|
|
331
331
|
children: `
|
|
332
332
|
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
333
333
|
const { client: queryClient, ...queryOptions } = queryConfig
|
|
@@ -351,11 +351,11 @@ InfiniteQuery.getParams = getParams$4;
|
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region src/components/InfiniteQueryOptions.tsx
|
|
353
353
|
function getParams$3({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
354
|
-
if (paramsType === "object") return
|
|
354
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
|
|
355
355
|
data: {
|
|
356
356
|
mode: "object",
|
|
357
357
|
children: {
|
|
358
|
-
...(0,
|
|
358
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
359
359
|
typed: true,
|
|
360
360
|
casing: paramsCasing,
|
|
361
361
|
override(item) {
|
|
@@ -367,15 +367,15 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
367
367
|
}),
|
|
368
368
|
data: typeSchemas.request?.name ? {
|
|
369
369
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
370
|
-
optional: (0,
|
|
370
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
371
371
|
} : void 0,
|
|
372
372
|
params: typeSchemas.queryParams?.name ? {
|
|
373
373
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
374
|
-
optional: (0,
|
|
374
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
375
375
|
} : void 0,
|
|
376
376
|
headers: typeSchemas.headerParams?.name ? {
|
|
377
377
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
378
|
-
optional: (0,
|
|
378
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
379
379
|
} : void 0
|
|
380
380
|
}
|
|
381
381
|
},
|
|
@@ -384,11 +384,11 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
384
384
|
default: "{}"
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
|
-
return
|
|
387
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
388
388
|
pathParams: {
|
|
389
389
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
390
|
-
optional: (0,
|
|
391
|
-
children: (0,
|
|
390
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema),
|
|
391
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
392
392
|
typed: true,
|
|
393
393
|
casing: paramsCasing,
|
|
394
394
|
override(item) {
|
|
@@ -401,15 +401,15 @@ function getParams$3({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
|
401
401
|
},
|
|
402
402
|
data: typeSchemas.request?.name ? {
|
|
403
403
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
404
|
-
optional: (0,
|
|
404
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
405
405
|
} : void 0,
|
|
406
406
|
params: typeSchemas.queryParams?.name ? {
|
|
407
407
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
408
|
-
optional: (0,
|
|
408
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
409
409
|
} : void 0,
|
|
410
410
|
headers: typeSchemas.headerParams?.name ? {
|
|
411
411
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
412
|
-
optional: (0,
|
|
412
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
413
413
|
} : void 0,
|
|
414
414
|
config: {
|
|
415
415
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
|
|
@@ -426,7 +426,7 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
426
426
|
pathParamsType,
|
|
427
427
|
typeSchemas
|
|
428
428
|
});
|
|
429
|
-
const clientParams =
|
|
429
|
+
const clientParams = _kubb_plugin_client_components.Client.getParams({
|
|
430
430
|
paramsType,
|
|
431
431
|
paramsCasing,
|
|
432
432
|
typeSchemas,
|
|
@@ -443,11 +443,11 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
443
443
|
let getPreviousPageParamExpr;
|
|
444
444
|
if (hasNewParams) {
|
|
445
445
|
if (nextParam) {
|
|
446
|
-
const accessor = (0,
|
|
446
|
+
const accessor = (0, _kubb_core_utils.getNestedAccessor)(nextParam, "lastPage");
|
|
447
447
|
if (accessor) getNextPageParamExpr = `getNextPageParam: (lastPage) => ${accessor}`;
|
|
448
448
|
}
|
|
449
449
|
if (previousParam) {
|
|
450
|
-
const accessor = (0,
|
|
450
|
+
const accessor = (0, _kubb_core_utils.getNestedAccessor)(previousParam, "firstPage");
|
|
451
451
|
if (accessor) getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`;
|
|
452
452
|
}
|
|
453
453
|
} else if (cursorParam) {
|
|
@@ -470,11 +470,11 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
470
470
|
params['${queryParam}'] = pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}']` : "";
|
|
471
471
|
const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? `${key}` : void 0).filter(Boolean).join(" && ");
|
|
472
472
|
const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
|
|
473
|
-
return /* @__PURE__ */ (0,
|
|
473
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
474
474
|
name,
|
|
475
475
|
isExportable: true,
|
|
476
476
|
isIndexable: true,
|
|
477
|
-
children: /* @__PURE__ */ (0,
|
|
477
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
478
478
|
name,
|
|
479
479
|
export: true,
|
|
480
480
|
params: params.toConstructor(),
|
|
@@ -501,10 +501,10 @@ InfiniteQueryOptions.getParams = getParams$3;
|
|
|
501
501
|
//#endregion
|
|
502
502
|
//#region src/components/MutationKey.tsx
|
|
503
503
|
function getParams$2({}) {
|
|
504
|
-
return
|
|
504
|
+
return _kubb_react_fabric.FunctionParams.factory({});
|
|
505
505
|
}
|
|
506
506
|
const getTransformer = ({ operation, casing }) => {
|
|
507
|
-
return [`{ url: '${new
|
|
507
|
+
return [`{ url: '${new _kubb_core_utils.URLPath(operation.path, { casing }).toURLPath()}' }`];
|
|
508
508
|
};
|
|
509
509
|
function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
510
510
|
const params = getParams$2({
|
|
@@ -516,23 +516,23 @@ function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operatio
|
|
|
516
516
|
schemas: typeSchemas,
|
|
517
517
|
casing: paramsCasing
|
|
518
518
|
});
|
|
519
|
-
return /* @__PURE__ */ (0,
|
|
519
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
520
520
|
name,
|
|
521
521
|
isExportable: true,
|
|
522
522
|
isIndexable: true,
|
|
523
|
-
children: /* @__PURE__ */ (0,
|
|
523
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function.Arrow, {
|
|
524
524
|
name,
|
|
525
525
|
export: true,
|
|
526
526
|
params: params.toConstructor(),
|
|
527
527
|
singleLine: true,
|
|
528
528
|
children: `[${keys.join(", ")}] as const`
|
|
529
529
|
})
|
|
530
|
-
}), /* @__PURE__ */ (0,
|
|
530
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
531
531
|
name: typeName,
|
|
532
532
|
isExportable: true,
|
|
533
533
|
isIndexable: true,
|
|
534
534
|
isTypeOnly: true,
|
|
535
|
-
children: /* @__PURE__ */ (0,
|
|
535
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
|
|
536
536
|
name: typeName,
|
|
537
537
|
export: true,
|
|
538
538
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -547,8 +547,8 @@ MutationKey.getTransformer = getTransformer;
|
|
|
547
547
|
function getParams$1({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
548
548
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
549
549
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
550
|
-
const TRequest =
|
|
551
|
-
...(0,
|
|
550
|
+
const TRequest = _kubb_react_fabric.FunctionParams.factory({
|
|
551
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
552
552
|
typed: true,
|
|
553
553
|
casing: paramsCasing,
|
|
554
554
|
override(item) {
|
|
@@ -560,18 +560,18 @@ function getParams$1({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
|
560
560
|
}),
|
|
561
561
|
data: typeSchemas.request?.name ? {
|
|
562
562
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
563
|
-
optional: (0,
|
|
563
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
564
564
|
} : void 0,
|
|
565
565
|
params: typeSchemas.queryParams?.name ? {
|
|
566
566
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
567
|
-
optional: (0,
|
|
567
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
568
568
|
} : void 0,
|
|
569
569
|
headers: typeSchemas.headerParams?.name ? {
|
|
570
570
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
571
|
-
optional: (0,
|
|
571
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
572
572
|
} : void 0
|
|
573
573
|
}).toConstructor();
|
|
574
|
-
return
|
|
574
|
+
return _kubb_react_fabric.FunctionParams.factory({ options: {
|
|
575
575
|
type: `
|
|
576
576
|
{
|
|
577
577
|
mutation?: MutationObserverOptions<${[
|
|
@@ -597,32 +597,32 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
597
597
|
dataReturnType,
|
|
598
598
|
typeSchemas
|
|
599
599
|
});
|
|
600
|
-
const clientParams =
|
|
600
|
+
const clientParams = _kubb_plugin_client_components.Client.getParams({
|
|
601
601
|
paramsCasing,
|
|
602
602
|
paramsType,
|
|
603
603
|
typeSchemas,
|
|
604
604
|
pathParamsType,
|
|
605
605
|
isConfigurable: true
|
|
606
606
|
});
|
|
607
|
-
const mutationParams =
|
|
608
|
-
...(0,
|
|
607
|
+
const mutationParams = _kubb_react_fabric.FunctionParams.factory({
|
|
608
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
609
609
|
typed: true,
|
|
610
610
|
casing: paramsCasing
|
|
611
611
|
}),
|
|
612
612
|
data: typeSchemas.request?.name ? {
|
|
613
613
|
type: typeSchemas.request?.name,
|
|
614
|
-
optional: (0,
|
|
614
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
615
615
|
} : void 0,
|
|
616
616
|
params: typeSchemas.queryParams?.name ? {
|
|
617
617
|
type: typeSchemas.queryParams?.name,
|
|
618
|
-
optional: (0,
|
|
618
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
619
619
|
} : void 0,
|
|
620
620
|
headers: typeSchemas.headerParams?.name ? {
|
|
621
621
|
type: typeSchemas.headerParams?.name,
|
|
622
|
-
optional: (0,
|
|
622
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
623
623
|
} : void 0
|
|
624
624
|
});
|
|
625
|
-
const dataParams =
|
|
625
|
+
const dataParams = _kubb_react_fabric.FunctionParams.factory({ data: {
|
|
626
626
|
mode: "object",
|
|
627
627
|
children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {
|
|
628
628
|
if (value) acc[key] = {
|
|
@@ -639,15 +639,15 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
639
639
|
TRequest ? `{${TRequest}}` : "void",
|
|
640
640
|
"TContext"
|
|
641
641
|
].join(", ");
|
|
642
|
-
return /* @__PURE__ */ (0,
|
|
642
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
643
643
|
name,
|
|
644
644
|
isExportable: true,
|
|
645
645
|
isIndexable: true,
|
|
646
|
-
children: /* @__PURE__ */ (0,
|
|
646
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
647
647
|
name,
|
|
648
648
|
export: true,
|
|
649
649
|
params: params.toConstructor(),
|
|
650
|
-
JSDoc: { comments: (0,
|
|
650
|
+
JSDoc: { comments: (0, _kubb_plugin_oas_utils.getComments)(operation) },
|
|
651
651
|
generics: ["TContext"],
|
|
652
652
|
children: `
|
|
653
653
|
const { mutation = {}, client: config = {} } = options ?? {}
|
|
@@ -671,11 +671,11 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
|
|
|
671
671
|
function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, typeSchemas }) {
|
|
672
672
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
673
673
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
674
|
-
if (paramsType === "object") return
|
|
674
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
|
|
675
675
|
data: {
|
|
676
676
|
mode: "object",
|
|
677
677
|
children: {
|
|
678
|
-
...(0,
|
|
678
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
679
679
|
typed: true,
|
|
680
680
|
casing: paramsCasing,
|
|
681
681
|
override(item) {
|
|
@@ -687,15 +687,15 @@ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, t
|
|
|
687
687
|
}),
|
|
688
688
|
data: typeSchemas.request?.name ? {
|
|
689
689
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
690
|
-
optional: (0,
|
|
690
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
691
691
|
} : void 0,
|
|
692
692
|
params: typeSchemas.queryParams?.name ? {
|
|
693
693
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
694
|
-
optional: (0,
|
|
694
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
695
695
|
} : void 0,
|
|
696
696
|
headers: typeSchemas.headerParams?.name ? {
|
|
697
697
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
698
|
-
optional: (0,
|
|
698
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
699
699
|
} : void 0
|
|
700
700
|
}
|
|
701
701
|
},
|
|
@@ -715,11 +715,11 @@ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, t
|
|
|
715
715
|
default: "{}"
|
|
716
716
|
}
|
|
717
717
|
});
|
|
718
|
-
return
|
|
718
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
719
719
|
pathParams: {
|
|
720
720
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
721
|
-
optional: (0,
|
|
722
|
-
children: (0,
|
|
721
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema),
|
|
722
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
723
723
|
typed: true,
|
|
724
724
|
casing: paramsCasing,
|
|
725
725
|
override(item) {
|
|
@@ -732,15 +732,15 @@ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, t
|
|
|
732
732
|
},
|
|
733
733
|
data: typeSchemas.request?.name ? {
|
|
734
734
|
type: `MaybeRefOrGetter<${typeSchemas.request?.name}>`,
|
|
735
|
-
optional: (0,
|
|
735
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
736
736
|
} : void 0,
|
|
737
737
|
params: typeSchemas.queryParams?.name ? {
|
|
738
738
|
type: `MaybeRefOrGetter<${typeSchemas.queryParams?.name}>`,
|
|
739
|
-
optional: (0,
|
|
739
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
740
740
|
} : void 0,
|
|
741
741
|
headers: typeSchemas.headerParams?.name ? {
|
|
742
742
|
type: `MaybeRefOrGetter<${typeSchemas.headerParams?.name}>`,
|
|
743
|
-
optional: (0,
|
|
743
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
744
744
|
} : void 0,
|
|
745
745
|
options: {
|
|
746
746
|
type: `
|
|
@@ -787,16 +787,16 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
|
|
|
787
787
|
typeSchemas
|
|
788
788
|
});
|
|
789
789
|
const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`;
|
|
790
|
-
return /* @__PURE__ */ (0,
|
|
790
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
791
791
|
name,
|
|
792
792
|
isExportable: true,
|
|
793
793
|
isIndexable: true,
|
|
794
|
-
children: /* @__PURE__ */ (0,
|
|
794
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
795
795
|
name,
|
|
796
796
|
export: true,
|
|
797
797
|
generics: generics.join(", "),
|
|
798
798
|
params: params.toConstructor(),
|
|
799
|
-
JSDoc: { comments: (0,
|
|
799
|
+
JSDoc: { comments: (0, _kubb_plugin_oas_utils.getComments)(operation) },
|
|
800
800
|
children: `
|
|
801
801
|
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
802
802
|
const { client: queryClient, ...queryOptions } = queryConfig
|
|
@@ -860,4 +860,4 @@ Object.defineProperty(exports, 'QueryOptions', {
|
|
|
860
860
|
return QueryOptions;
|
|
861
861
|
}
|
|
862
862
|
});
|
|
863
|
-
//# sourceMappingURL=components-
|
|
863
|
+
//# sourceMappingURL=components-CpE5cSDx.cjs.map
|