@kubb/plugin-react-query 3.10.10 → 3.10.12
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-7FLY2TRN.cjs → chunk-6GUCBOIJ.cjs} +50 -239
- package/dist/chunk-6GUCBOIJ.cjs.map +1 -0
- package/dist/{chunk-4264OHU6.js → chunk-CKDIZTX6.js} +30 -216
- package/dist/chunk-CKDIZTX6.js.map +1 -0
- package/dist/{chunk-H545W3VX.cjs → chunk-YUJPB55K.cjs} +34 -320
- package/dist/chunk-YUJPB55K.cjs.map +1 -0
- package/dist/{chunk-E5WUN7JM.js → chunk-Z2UH2EYS.js} +9 -291
- package/dist/chunk-Z2UH2EYS.js.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.d.cts +2 -1
- package/dist/components.d.ts +2 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +6 -6
- package/dist/generators.d.cts +2 -1
- package/dist/generators.d.ts +2 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/{types-dh-ZAXtR.d.cts → types-BdjqYAq1.d.cts} +3 -116
- package/dist/{types-dh-ZAXtR.d.ts → types-BdjqYAq1.d.ts} +3 -116
- package/package.json +12 -11
- package/dist/chunk-4264OHU6.js.map +0 -1
- package/dist/chunk-7FLY2TRN.cjs.map +0 -1
- package/dist/chunk-E5WUN7JM.js.map +0 -1
- package/dist/chunk-H545W3VX.cjs.map +0 -1
|
@@ -2,219 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('@kubb/react');
|
|
4
4
|
var oas = require('@kubb/oas');
|
|
5
|
-
var
|
|
6
|
-
var utils
|
|
5
|
+
var components = require('@kubb/plugin-client/components');
|
|
6
|
+
var utils = require('@kubb/plugin-oas/utils');
|
|
7
|
+
var utils$1 = require('@kubb/core/utils');
|
|
7
8
|
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
8
9
|
|
|
9
10
|
// src/components/Mutation.tsx
|
|
10
|
-
function getParams({
|
|
11
|
-
if (paramsType === "object") {
|
|
12
|
-
return react.FunctionParams.factory({
|
|
13
|
-
data: {
|
|
14
|
-
mode: "object",
|
|
15
|
-
children: {
|
|
16
|
-
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return react.FunctionParams.factory({
|
|
22
|
-
pathParams: typeSchemas.pathParams?.name ? {
|
|
23
|
-
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
24
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
25
|
-
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
26
|
-
} : void 0
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
30
|
-
const path = new utils.URLPath(operation.path, { casing: paramsCasing });
|
|
31
|
-
const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
32
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable, isIndexable, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { name, export: isExportable, params: params.toConstructor(), children: `return ${path.toTemplateString({ prefix: baseURL })} as const` }) });
|
|
33
|
-
}
|
|
34
|
-
Url.getParams = getParams;
|
|
35
|
-
function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }) {
|
|
36
|
-
if (paramsType === "object") {
|
|
37
|
-
return react.FunctionParams.factory({
|
|
38
|
-
data: {
|
|
39
|
-
mode: "object",
|
|
40
|
-
children: {
|
|
41
|
-
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
42
|
-
data: typeSchemas.request?.name ? {
|
|
43
|
-
type: typeSchemas.request?.name,
|
|
44
|
-
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
45
|
-
} : void 0,
|
|
46
|
-
params: typeSchemas.queryParams?.name ? {
|
|
47
|
-
type: typeSchemas.queryParams?.name,
|
|
48
|
-
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
49
|
-
} : void 0,
|
|
50
|
-
headers: typeSchemas.headerParams?.name ? {
|
|
51
|
-
type: typeSchemas.headerParams?.name,
|
|
52
|
-
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
53
|
-
} : void 0
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
config: isConfigurable ? {
|
|
57
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
58
|
-
default: "{}"
|
|
59
|
-
} : void 0
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return react.FunctionParams.factory({
|
|
63
|
-
pathParams: typeSchemas.pathParams?.name ? {
|
|
64
|
-
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
65
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
66
|
-
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
67
|
-
} : void 0,
|
|
68
|
-
data: typeSchemas.request?.name ? {
|
|
69
|
-
type: typeSchemas.request?.name,
|
|
70
|
-
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
71
|
-
} : void 0,
|
|
72
|
-
params: typeSchemas.queryParams?.name ? {
|
|
73
|
-
type: typeSchemas.queryParams?.name,
|
|
74
|
-
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
75
|
-
} : void 0,
|
|
76
|
-
headers: typeSchemas.headerParams?.name ? {
|
|
77
|
-
type: typeSchemas.headerParams?.name,
|
|
78
|
-
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
79
|
-
} : void 0,
|
|
80
|
-
config: isConfigurable ? {
|
|
81
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
82
|
-
default: "{}"
|
|
83
|
-
} : void 0
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function Client({
|
|
87
|
-
name,
|
|
88
|
-
isExportable = true,
|
|
89
|
-
isIndexable = true,
|
|
90
|
-
returnType,
|
|
91
|
-
typeSchemas,
|
|
92
|
-
baseURL,
|
|
93
|
-
dataReturnType,
|
|
94
|
-
parser,
|
|
95
|
-
zodSchemas,
|
|
96
|
-
paramsType,
|
|
97
|
-
paramsCasing,
|
|
98
|
-
pathParamsType,
|
|
99
|
-
operation,
|
|
100
|
-
urlName,
|
|
101
|
-
children,
|
|
102
|
-
isConfigurable = true
|
|
103
|
-
}) {
|
|
104
|
-
const path = new utils.URLPath(operation.path, { casing: paramsCasing });
|
|
105
|
-
const contentType = operation.getContentType();
|
|
106
|
-
const isFormData = contentType === "multipart/form-data";
|
|
107
|
-
const headers = [
|
|
108
|
-
contentType !== "application/json" ? `'Content-Type': '${contentType}'` : void 0,
|
|
109
|
-
typeSchemas.headerParams?.name ? "...headers" : void 0
|
|
110
|
-
].filter(Boolean);
|
|
111
|
-
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
112
|
-
const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || "unknown"].filter(Boolean);
|
|
113
|
-
const params = getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable });
|
|
114
|
-
const urlParams = Url.getParams({
|
|
115
|
-
paramsType,
|
|
116
|
-
paramsCasing,
|
|
117
|
-
pathParamsType,
|
|
118
|
-
typeSchemas
|
|
119
|
-
});
|
|
120
|
-
const clientParams = react.FunctionParams.factory({
|
|
121
|
-
config: {
|
|
122
|
-
mode: "object",
|
|
123
|
-
children: {
|
|
124
|
-
method: {
|
|
125
|
-
value: JSON.stringify(operation.method.toUpperCase())
|
|
126
|
-
},
|
|
127
|
-
url: {
|
|
128
|
-
value: urlName ? `${urlName}(${urlParams.toCall()}).toString()` : path.template
|
|
129
|
-
},
|
|
130
|
-
baseURL: baseURL && !urlName ? {
|
|
131
|
-
value: JSON.stringify(baseURL)
|
|
132
|
-
} : void 0,
|
|
133
|
-
params: typeSchemas.queryParams?.name ? {} : void 0,
|
|
134
|
-
data: typeSchemas.request?.name ? {
|
|
135
|
-
value: parser === "zod" && zodSchemas ? `${zodSchemas.request?.name}.parse(${isFormData ? "formData" : "data"})` : isFormData ? "formData" : void 0
|
|
136
|
-
} : void 0,
|
|
137
|
-
requestConfig: isConfigurable ? {
|
|
138
|
-
mode: "inlineSpread"
|
|
139
|
-
} : void 0,
|
|
140
|
-
headers: headers.length ? {
|
|
141
|
-
value: isConfigurable ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : `{ ${headers.join(", ")} }`
|
|
142
|
-
} : void 0
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
const formData = isFormData ? `
|
|
147
|
-
const formData = new FormData()
|
|
148
|
-
if(data) {
|
|
149
|
-
Object.keys(data).forEach((key) => {
|
|
150
|
-
const value = data[key as keyof typeof data];
|
|
151
|
-
if (typeof key === "string" && (typeof value === "string" || (value as Blob) instanceof Blob)) {
|
|
152
|
-
formData.append(key, value as unknown as string);
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
` : "";
|
|
157
|
-
const childrenElement = children ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
158
|
-
dataReturnType === "full" && parser === "zod" && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`,
|
|
159
|
-
dataReturnType === "data" && parser === "zod" && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`,
|
|
160
|
-
dataReturnType === "full" && parser === "client" && "return res",
|
|
161
|
-
dataReturnType === "data" && parser === "client" && "return res.data"
|
|
162
|
-
] });
|
|
163
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable, isIndexable, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
164
|
-
react.Function,
|
|
165
|
-
{
|
|
166
|
-
name,
|
|
167
|
-
async: true,
|
|
168
|
-
export: isExportable,
|
|
169
|
-
params: params.toConstructor(),
|
|
170
|
-
JSDoc: {
|
|
171
|
-
comments: utils$1.getComments(operation)
|
|
172
|
-
},
|
|
173
|
-
returnType,
|
|
174
|
-
children: [
|
|
175
|
-
isConfigurable ? "const { client:request = client, ...requestConfig } = config" : "",
|
|
176
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
178
|
-
formData,
|
|
179
|
-
isConfigurable ? `const res = await request<${generics.join(", ")}>(${clientParams.toCall()})` : `const res = await client<${generics.join(", ")}>(${clientParams.toCall()})`,
|
|
180
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
181
|
-
childrenElement
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
) });
|
|
185
|
-
}
|
|
186
|
-
Client.getParams = getParams2;
|
|
187
|
-
function Operations({ name, operations }) {
|
|
188
|
-
const operationsObject = {};
|
|
189
|
-
operations.forEach((operation) => {
|
|
190
|
-
operationsObject[operation.getOperationId()] = {
|
|
191
|
-
path: new utils.URLPath(operation.path).URL,
|
|
192
|
-
method: operation.method
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
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, void 0, 2) }) });
|
|
196
|
-
}
|
|
197
|
-
function getParams3({}) {
|
|
11
|
+
function getParams({}) {
|
|
198
12
|
return react.FunctionParams.factory({});
|
|
199
13
|
}
|
|
200
14
|
var getTransformer = ({ operation, casing }) => {
|
|
201
|
-
const path = new utils.URLPath(operation.path, { casing });
|
|
15
|
+
const path = new utils$1.URLPath(operation.path, { casing });
|
|
202
16
|
return [JSON.stringify({ url: path.path })].filter(Boolean);
|
|
203
17
|
};
|
|
204
18
|
function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }) {
|
|
205
|
-
const params =
|
|
19
|
+
const params = getParams({ });
|
|
206
20
|
const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing });
|
|
207
21
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
208
22
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
|
|
209
23
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
210
24
|
] });
|
|
211
25
|
}
|
|
212
|
-
MutationKey.getParams =
|
|
26
|
+
MutationKey.getParams = getParams;
|
|
213
27
|
MutationKey.getTransformer = getTransformer;
|
|
214
|
-
function
|
|
28
|
+
function getParams2({ paramsCasing, dataReturnType, typeSchemas }) {
|
|
215
29
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
216
30
|
const mutationParams = react.FunctionParams.factory({
|
|
217
|
-
...utils
|
|
31
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
218
32
|
data: typeSchemas.request?.name ? {
|
|
219
33
|
type: typeSchemas.request?.name,
|
|
220
34
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -258,12 +72,12 @@ function Mutation({
|
|
|
258
72
|
pathParamsType,
|
|
259
73
|
typeSchemas
|
|
260
74
|
});
|
|
261
|
-
const params =
|
|
75
|
+
const params = getParams2({
|
|
262
76
|
paramsCasing,
|
|
263
77
|
dataReturnType,
|
|
264
78
|
typeSchemas
|
|
265
79
|
});
|
|
266
|
-
const clientParams = Client.getParams({
|
|
80
|
+
const clientParams = components.Client.getParams({
|
|
267
81
|
paramsCasing,
|
|
268
82
|
paramsType,
|
|
269
83
|
typeSchemas,
|
|
@@ -271,7 +85,7 @@ function Mutation({
|
|
|
271
85
|
isConfigurable: true
|
|
272
86
|
});
|
|
273
87
|
const mutationParams = react.FunctionParams.factory({
|
|
274
|
-
...utils
|
|
88
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
275
89
|
data: typeSchemas.request?.name ? {
|
|
276
90
|
type: typeSchemas.request?.name,
|
|
277
91
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -312,7 +126,7 @@ function Mutation({
|
|
|
312
126
|
export: true,
|
|
313
127
|
params: params.toConstructor(),
|
|
314
128
|
JSDoc: {
|
|
315
|
-
comments: utils
|
|
129
|
+
comments: utils.getComments(operation)
|
|
316
130
|
},
|
|
317
131
|
generics: ["TContext"],
|
|
318
132
|
children: `
|
|
@@ -331,11 +145,11 @@ function Mutation({
|
|
|
331
145
|
}
|
|
332
146
|
) });
|
|
333
147
|
}
|
|
334
|
-
function
|
|
148
|
+
function getParams3({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
335
149
|
return react.FunctionParams.factory({
|
|
336
150
|
pathParams: {
|
|
337
151
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
338
|
-
children: utils
|
|
152
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
339
153
|
},
|
|
340
154
|
data: typeSchemas.request?.name ? {
|
|
341
155
|
type: typeSchemas.request?.name,
|
|
@@ -348,7 +162,7 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
348
162
|
});
|
|
349
163
|
}
|
|
350
164
|
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
351
|
-
const path = new utils.URLPath(operation.path, { casing });
|
|
165
|
+
const path = new utils$1.URLPath(operation.path, { casing });
|
|
352
166
|
const keys = [
|
|
353
167
|
path.toObject({
|
|
354
168
|
type: "path",
|
|
@@ -360,7 +174,7 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
|
360
174
|
return keys;
|
|
361
175
|
};
|
|
362
176
|
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
|
|
363
|
-
const params =
|
|
177
|
+
const params = getParams3({ pathParamsType, typeSchemas, paramsCasing });
|
|
364
178
|
const keys = transformer({
|
|
365
179
|
operation,
|
|
366
180
|
schemas: typeSchemas,
|
|
@@ -371,15 +185,15 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
371
185
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
372
186
|
] });
|
|
373
187
|
}
|
|
374
|
-
QueryKey.getParams =
|
|
188
|
+
QueryKey.getParams = getParams3;
|
|
375
189
|
QueryKey.getTransformer = getTransformer2;
|
|
376
|
-
function
|
|
190
|
+
function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
377
191
|
if (paramsType === "object") {
|
|
378
192
|
return react.FunctionParams.factory({
|
|
379
193
|
data: {
|
|
380
194
|
mode: "object",
|
|
381
195
|
children: {
|
|
382
|
-
...utils
|
|
196
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
383
197
|
data: typeSchemas.request?.name ? {
|
|
384
198
|
type: typeSchemas.request?.name,
|
|
385
199
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -403,7 +217,7 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
403
217
|
return react.FunctionParams.factory({
|
|
404
218
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
405
219
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
406
|
-
children: utils
|
|
220
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
407
221
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
408
222
|
} : void 0,
|
|
409
223
|
data: typeSchemas.request?.name ? {
|
|
@@ -425,10 +239,10 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
425
239
|
});
|
|
426
240
|
}
|
|
427
241
|
function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
|
|
428
|
-
const params =
|
|
242
|
+
const params = getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
429
243
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
430
244
|
const TError = typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error";
|
|
431
|
-
const clientParams = Client.getParams({
|
|
245
|
+
const clientParams = components.Client.getParams({
|
|
432
246
|
typeSchemas,
|
|
433
247
|
paramsCasing,
|
|
434
248
|
paramsType,
|
|
@@ -454,8 +268,8 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
454
268
|
})
|
|
455
269
|
` }) });
|
|
456
270
|
}
|
|
457
|
-
QueryOptions.getParams =
|
|
458
|
-
function
|
|
271
|
+
QueryOptions.getParams = getParams4;
|
|
272
|
+
function getParams5({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
459
273
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
460
274
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
461
275
|
if (paramsType === "object") {
|
|
@@ -463,7 +277,7 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
463
277
|
data: {
|
|
464
278
|
mode: "object",
|
|
465
279
|
children: {
|
|
466
|
-
...utils
|
|
280
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
467
281
|
data: typeSchemas.request?.name ? {
|
|
468
282
|
type: typeSchemas.request?.name,
|
|
469
283
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -492,7 +306,7 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
492
306
|
return react.FunctionParams.factory({
|
|
493
307
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
494
308
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
495
|
-
children: utils
|
|
309
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
496
310
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
497
311
|
} : void 0,
|
|
498
312
|
data: typeSchemas.request?.name ? {
|
|
@@ -545,7 +359,7 @@ function Query({
|
|
|
545
359
|
typeSchemas,
|
|
546
360
|
paramsCasing
|
|
547
361
|
});
|
|
548
|
-
const params =
|
|
362
|
+
const params = getParams5({
|
|
549
363
|
paramsCasing,
|
|
550
364
|
paramsType,
|
|
551
365
|
pathParamsType,
|
|
@@ -561,7 +375,7 @@ function Query({
|
|
|
561
375
|
generics: generics.join(", "),
|
|
562
376
|
params: params.toConstructor(),
|
|
563
377
|
JSDoc: {
|
|
564
|
-
comments: utils
|
|
378
|
+
comments: utils.getComments(operation)
|
|
565
379
|
},
|
|
566
380
|
children: `
|
|
567
381
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -580,14 +394,14 @@ function Query({
|
|
|
580
394
|
}
|
|
581
395
|
) });
|
|
582
396
|
}
|
|
583
|
-
Query.getParams =
|
|
584
|
-
function
|
|
397
|
+
Query.getParams = getParams5;
|
|
398
|
+
function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
585
399
|
if (paramsType === "object") {
|
|
586
400
|
return react.FunctionParams.factory({
|
|
587
401
|
data: {
|
|
588
402
|
mode: "object",
|
|
589
403
|
children: {
|
|
590
|
-
...utils
|
|
404
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
591
405
|
data: typeSchemas.request?.name ? {
|
|
592
406
|
type: typeSchemas.request?.name,
|
|
593
407
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -611,7 +425,7 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
611
425
|
return react.FunctionParams.factory({
|
|
612
426
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
613
427
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
614
|
-
children: utils
|
|
428
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
615
429
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
616
430
|
} : void 0,
|
|
617
431
|
data: typeSchemas.request?.name ? {
|
|
@@ -647,8 +461,8 @@ function InfiniteQueryOptions({
|
|
|
647
461
|
}) {
|
|
648
462
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
649
463
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
650
|
-
const params =
|
|
651
|
-
const clientParams = Client.getParams({
|
|
464
|
+
const params = getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
465
|
+
const clientParams = components.Client.getParams({
|
|
652
466
|
paramsCasing,
|
|
653
467
|
typeSchemas,
|
|
654
468
|
paramsType,
|
|
@@ -702,8 +516,8 @@ function InfiniteQueryOptions({
|
|
|
702
516
|
})
|
|
703
517
|
` }) });
|
|
704
518
|
}
|
|
705
|
-
InfiniteQueryOptions.getParams =
|
|
706
|
-
function
|
|
519
|
+
InfiniteQueryOptions.getParams = getParams6;
|
|
520
|
+
function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
707
521
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
708
522
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
709
523
|
if (paramsType === "object") {
|
|
@@ -711,7 +525,7 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
711
525
|
data: {
|
|
712
526
|
mode: "object",
|
|
713
527
|
children: {
|
|
714
|
-
...utils
|
|
528
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
715
529
|
data: typeSchemas.request?.name ? {
|
|
716
530
|
type: typeSchemas.request?.name,
|
|
717
531
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -740,7 +554,7 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
740
554
|
return react.FunctionParams.factory({
|
|
741
555
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
742
556
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
743
|
-
children: utils
|
|
557
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
744
558
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
745
559
|
} : void 0,
|
|
746
560
|
data: typeSchemas.request?.name ? {
|
|
@@ -793,7 +607,7 @@ function InfiniteQuery({
|
|
|
793
607
|
typeSchemas,
|
|
794
608
|
paramsCasing
|
|
795
609
|
});
|
|
796
|
-
const params =
|
|
610
|
+
const params = getParams7({
|
|
797
611
|
paramsCasing,
|
|
798
612
|
paramsType,
|
|
799
613
|
pathParamsType,
|
|
@@ -809,7 +623,7 @@ function InfiniteQuery({
|
|
|
809
623
|
generics: generics.join(", "),
|
|
810
624
|
params: params.toConstructor(),
|
|
811
625
|
JSDoc: {
|
|
812
|
-
comments: utils
|
|
626
|
+
comments: utils.getComments(operation)
|
|
813
627
|
},
|
|
814
628
|
children: `
|
|
815
629
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -828,8 +642,8 @@ function InfiniteQuery({
|
|
|
828
642
|
}
|
|
829
643
|
) });
|
|
830
644
|
}
|
|
831
|
-
InfiniteQuery.getParams =
|
|
832
|
-
function
|
|
645
|
+
InfiniteQuery.getParams = getParams7;
|
|
646
|
+
function getParams8({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
833
647
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
834
648
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
835
649
|
if (paramsType === "object") {
|
|
@@ -837,7 +651,7 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
837
651
|
data: {
|
|
838
652
|
mode: "object",
|
|
839
653
|
children: {
|
|
840
|
-
...utils
|
|
654
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
841
655
|
data: typeSchemas.request?.name ? {
|
|
842
656
|
type: typeSchemas.request?.name,
|
|
843
657
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -866,7 +680,7 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
866
680
|
return react.FunctionParams.factory({
|
|
867
681
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
868
682
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
869
|
-
children: utils
|
|
683
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
870
684
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
871
685
|
} : void 0,
|
|
872
686
|
data: typeSchemas.request?.name ? {
|
|
@@ -919,7 +733,7 @@ function SuspenseQuery({
|
|
|
919
733
|
pathParamsType,
|
|
920
734
|
typeSchemas
|
|
921
735
|
});
|
|
922
|
-
const params =
|
|
736
|
+
const params = getParams8({
|
|
923
737
|
paramsCasing,
|
|
924
738
|
paramsType,
|
|
925
739
|
pathParamsType,
|
|
@@ -935,7 +749,7 @@ function SuspenseQuery({
|
|
|
935
749
|
generics: generics.join(", "),
|
|
936
750
|
params: params.toConstructor(),
|
|
937
751
|
JSDoc: {
|
|
938
|
-
comments: utils
|
|
752
|
+
comments: utils.getComments(operation)
|
|
939
753
|
},
|
|
940
754
|
children: `
|
|
941
755
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -954,18 +768,15 @@ function SuspenseQuery({
|
|
|
954
768
|
}
|
|
955
769
|
) });
|
|
956
770
|
}
|
|
957
|
-
SuspenseQuery.getParams =
|
|
771
|
+
SuspenseQuery.getParams = getParams8;
|
|
958
772
|
|
|
959
|
-
exports.Client = Client;
|
|
960
773
|
exports.InfiniteQuery = InfiniteQuery;
|
|
961
774
|
exports.InfiniteQueryOptions = InfiniteQueryOptions;
|
|
962
775
|
exports.Mutation = Mutation;
|
|
963
776
|
exports.MutationKey = MutationKey;
|
|
964
|
-
exports.Operations = Operations;
|
|
965
777
|
exports.Query = Query;
|
|
966
778
|
exports.QueryKey = QueryKey;
|
|
967
779
|
exports.QueryOptions = QueryOptions;
|
|
968
780
|
exports.SuspenseQuery = SuspenseQuery;
|
|
969
|
-
|
|
970
|
-
//# sourceMappingURL=chunk-
|
|
971
|
-
//# sourceMappingURL=chunk-7FLY2TRN.cjs.map
|
|
781
|
+
//# sourceMappingURL=chunk-6GUCBOIJ.cjs.map
|
|
782
|
+
//# sourceMappingURL=chunk-6GUCBOIJ.cjs.map
|