@kubb/plugin-react-query 3.10.9 → 3.10.11
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-Z6CABIIO.cjs → chunk-6GUCBOIJ.cjs} +53 -241
- package/dist/chunk-6GUCBOIJ.cjs.map +1 -0
- package/dist/{chunk-B5HX4HGF.js → chunk-CKDIZTX6.js} +33 -218
- package/dist/chunk-CKDIZTX6.js.map +1 -0
- package/dist/{chunk-CPKMWQJJ.cjs → chunk-YUJPB55K.cjs} +34 -320
- package/dist/chunk-YUJPB55K.cjs.map +1 -0
- package/dist/{chunk-XYYHPHK6.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 +2 -2
- 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/src/components/Mutation.tsx +3 -2
- package/src/generators/__snapshots__/clientPostImportPath.ts +3 -2
- package/src/generators/__snapshots__/updatePetById.ts +3 -2
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +3 -2
- package/dist/chunk-B5HX4HGF.js.map +0 -1
- package/dist/chunk-CPKMWQJJ.cjs.map +0 -1
- package/dist/chunk-XYYHPHK6.js.map +0 -1
- package/dist/chunk-Z6CABIIO.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,12 +126,13 @@ 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: `
|
|
319
|
-
const { mutation
|
|
320
|
-
const
|
|
133
|
+
const { mutation = {}, client: config = {} } = options ?? {}
|
|
134
|
+
const { client: queryClient, ...mutationOptions } = mutation;
|
|
135
|
+
const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})
|
|
321
136
|
|
|
322
137
|
return useMutation<${generics}>({
|
|
323
138
|
mutationFn: async(${dataParams.toConstructor()}) => {
|
|
@@ -330,11 +145,11 @@ function Mutation({
|
|
|
330
145
|
}
|
|
331
146
|
) });
|
|
332
147
|
}
|
|
333
|
-
function
|
|
148
|
+
function getParams3({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
334
149
|
return react.FunctionParams.factory({
|
|
335
150
|
pathParams: {
|
|
336
151
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
337
|
-
children: utils
|
|
152
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
338
153
|
},
|
|
339
154
|
data: typeSchemas.request?.name ? {
|
|
340
155
|
type: typeSchemas.request?.name,
|
|
@@ -347,7 +162,7 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
347
162
|
});
|
|
348
163
|
}
|
|
349
164
|
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
350
|
-
const path = new utils.URLPath(operation.path, { casing });
|
|
165
|
+
const path = new utils$1.URLPath(operation.path, { casing });
|
|
351
166
|
const keys = [
|
|
352
167
|
path.toObject({
|
|
353
168
|
type: "path",
|
|
@@ -359,7 +174,7 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
|
359
174
|
return keys;
|
|
360
175
|
};
|
|
361
176
|
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
|
|
362
|
-
const params =
|
|
177
|
+
const params = getParams3({ pathParamsType, typeSchemas, paramsCasing });
|
|
363
178
|
const keys = transformer({
|
|
364
179
|
operation,
|
|
365
180
|
schemas: typeSchemas,
|
|
@@ -370,15 +185,15 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
370
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}>` }) })
|
|
371
186
|
] });
|
|
372
187
|
}
|
|
373
|
-
QueryKey.getParams =
|
|
188
|
+
QueryKey.getParams = getParams3;
|
|
374
189
|
QueryKey.getTransformer = getTransformer2;
|
|
375
|
-
function
|
|
190
|
+
function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
376
191
|
if (paramsType === "object") {
|
|
377
192
|
return react.FunctionParams.factory({
|
|
378
193
|
data: {
|
|
379
194
|
mode: "object",
|
|
380
195
|
children: {
|
|
381
|
-
...utils
|
|
196
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
382
197
|
data: typeSchemas.request?.name ? {
|
|
383
198
|
type: typeSchemas.request?.name,
|
|
384
199
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -402,7 +217,7 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
402
217
|
return react.FunctionParams.factory({
|
|
403
218
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
404
219
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
405
|
-
children: utils
|
|
220
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
406
221
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
407
222
|
} : void 0,
|
|
408
223
|
data: typeSchemas.request?.name ? {
|
|
@@ -424,10 +239,10 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
424
239
|
});
|
|
425
240
|
}
|
|
426
241
|
function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
|
|
427
|
-
const params =
|
|
242
|
+
const params = getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
428
243
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
429
244
|
const TError = typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error";
|
|
430
|
-
const clientParams = Client.getParams({
|
|
245
|
+
const clientParams = components.Client.getParams({
|
|
431
246
|
typeSchemas,
|
|
432
247
|
paramsCasing,
|
|
433
248
|
paramsType,
|
|
@@ -453,8 +268,8 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
|
|
|
453
268
|
})
|
|
454
269
|
` }) });
|
|
455
270
|
}
|
|
456
|
-
QueryOptions.getParams =
|
|
457
|
-
function
|
|
271
|
+
QueryOptions.getParams = getParams4;
|
|
272
|
+
function getParams5({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
458
273
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
459
274
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
460
275
|
if (paramsType === "object") {
|
|
@@ -462,7 +277,7 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
462
277
|
data: {
|
|
463
278
|
mode: "object",
|
|
464
279
|
children: {
|
|
465
|
-
...utils
|
|
280
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
466
281
|
data: typeSchemas.request?.name ? {
|
|
467
282
|
type: typeSchemas.request?.name,
|
|
468
283
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -491,7 +306,7 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
491
306
|
return react.FunctionParams.factory({
|
|
492
307
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
493
308
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
494
|
-
children: utils
|
|
309
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
495
310
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
496
311
|
} : void 0,
|
|
497
312
|
data: typeSchemas.request?.name ? {
|
|
@@ -544,7 +359,7 @@ function Query({
|
|
|
544
359
|
typeSchemas,
|
|
545
360
|
paramsCasing
|
|
546
361
|
});
|
|
547
|
-
const params =
|
|
362
|
+
const params = getParams5({
|
|
548
363
|
paramsCasing,
|
|
549
364
|
paramsType,
|
|
550
365
|
pathParamsType,
|
|
@@ -560,7 +375,7 @@ function Query({
|
|
|
560
375
|
generics: generics.join(", "),
|
|
561
376
|
params: params.toConstructor(),
|
|
562
377
|
JSDoc: {
|
|
563
|
-
comments: utils
|
|
378
|
+
comments: utils.getComments(operation)
|
|
564
379
|
},
|
|
565
380
|
children: `
|
|
566
381
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -579,14 +394,14 @@ function Query({
|
|
|
579
394
|
}
|
|
580
395
|
) });
|
|
581
396
|
}
|
|
582
|
-
Query.getParams =
|
|
583
|
-
function
|
|
397
|
+
Query.getParams = getParams5;
|
|
398
|
+
function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
584
399
|
if (paramsType === "object") {
|
|
585
400
|
return react.FunctionParams.factory({
|
|
586
401
|
data: {
|
|
587
402
|
mode: "object",
|
|
588
403
|
children: {
|
|
589
|
-
...utils
|
|
404
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
590
405
|
data: typeSchemas.request?.name ? {
|
|
591
406
|
type: typeSchemas.request?.name,
|
|
592
407
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -610,7 +425,7 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
610
425
|
return react.FunctionParams.factory({
|
|
611
426
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
612
427
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
613
|
-
children: utils
|
|
428
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
614
429
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
615
430
|
} : void 0,
|
|
616
431
|
data: typeSchemas.request?.name ? {
|
|
@@ -646,8 +461,8 @@ function InfiniteQueryOptions({
|
|
|
646
461
|
}) {
|
|
647
462
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
648
463
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
649
|
-
const params =
|
|
650
|
-
const clientParams = Client.getParams({
|
|
464
|
+
const params = getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
465
|
+
const clientParams = components.Client.getParams({
|
|
651
466
|
paramsCasing,
|
|
652
467
|
typeSchemas,
|
|
653
468
|
paramsType,
|
|
@@ -701,8 +516,8 @@ function InfiniteQueryOptions({
|
|
|
701
516
|
})
|
|
702
517
|
` }) });
|
|
703
518
|
}
|
|
704
|
-
InfiniteQueryOptions.getParams =
|
|
705
|
-
function
|
|
519
|
+
InfiniteQueryOptions.getParams = getParams6;
|
|
520
|
+
function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
706
521
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
707
522
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
708
523
|
if (paramsType === "object") {
|
|
@@ -710,7 +525,7 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
710
525
|
data: {
|
|
711
526
|
mode: "object",
|
|
712
527
|
children: {
|
|
713
|
-
...utils
|
|
528
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
714
529
|
data: typeSchemas.request?.name ? {
|
|
715
530
|
type: typeSchemas.request?.name,
|
|
716
531
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -739,7 +554,7 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
739
554
|
return react.FunctionParams.factory({
|
|
740
555
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
741
556
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
742
|
-
children: utils
|
|
557
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
743
558
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
744
559
|
} : void 0,
|
|
745
560
|
data: typeSchemas.request?.name ? {
|
|
@@ -792,7 +607,7 @@ function InfiniteQuery({
|
|
|
792
607
|
typeSchemas,
|
|
793
608
|
paramsCasing
|
|
794
609
|
});
|
|
795
|
-
const params =
|
|
610
|
+
const params = getParams7({
|
|
796
611
|
paramsCasing,
|
|
797
612
|
paramsType,
|
|
798
613
|
pathParamsType,
|
|
@@ -808,7 +623,7 @@ function InfiniteQuery({
|
|
|
808
623
|
generics: generics.join(", "),
|
|
809
624
|
params: params.toConstructor(),
|
|
810
625
|
JSDoc: {
|
|
811
|
-
comments: utils
|
|
626
|
+
comments: utils.getComments(operation)
|
|
812
627
|
},
|
|
813
628
|
children: `
|
|
814
629
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -827,8 +642,8 @@ function InfiniteQuery({
|
|
|
827
642
|
}
|
|
828
643
|
) });
|
|
829
644
|
}
|
|
830
|
-
InfiniteQuery.getParams =
|
|
831
|
-
function
|
|
645
|
+
InfiniteQuery.getParams = getParams7;
|
|
646
|
+
function getParams8({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
832
647
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
833
648
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
834
649
|
if (paramsType === "object") {
|
|
@@ -836,7 +651,7 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
836
651
|
data: {
|
|
837
652
|
mode: "object",
|
|
838
653
|
children: {
|
|
839
|
-
...utils
|
|
654
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
840
655
|
data: typeSchemas.request?.name ? {
|
|
841
656
|
type: typeSchemas.request?.name,
|
|
842
657
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -865,7 +680,7 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
865
680
|
return react.FunctionParams.factory({
|
|
866
681
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
867
682
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
868
|
-
children: utils
|
|
683
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
869
684
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
870
685
|
} : void 0,
|
|
871
686
|
data: typeSchemas.request?.name ? {
|
|
@@ -918,7 +733,7 @@ function SuspenseQuery({
|
|
|
918
733
|
pathParamsType,
|
|
919
734
|
typeSchemas
|
|
920
735
|
});
|
|
921
|
-
const params =
|
|
736
|
+
const params = getParams8({
|
|
922
737
|
paramsCasing,
|
|
923
738
|
paramsType,
|
|
924
739
|
pathParamsType,
|
|
@@ -934,7 +749,7 @@ function SuspenseQuery({
|
|
|
934
749
|
generics: generics.join(", "),
|
|
935
750
|
params: params.toConstructor(),
|
|
936
751
|
JSDoc: {
|
|
937
|
-
comments: utils
|
|
752
|
+
comments: utils.getComments(operation)
|
|
938
753
|
},
|
|
939
754
|
children: `
|
|
940
755
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -953,18 +768,15 @@ function SuspenseQuery({
|
|
|
953
768
|
}
|
|
954
769
|
) });
|
|
955
770
|
}
|
|
956
|
-
SuspenseQuery.getParams =
|
|
771
|
+
SuspenseQuery.getParams = getParams8;
|
|
957
772
|
|
|
958
|
-
exports.Client = Client;
|
|
959
773
|
exports.InfiniteQuery = InfiniteQuery;
|
|
960
774
|
exports.InfiniteQueryOptions = InfiniteQueryOptions;
|
|
961
775
|
exports.Mutation = Mutation;
|
|
962
776
|
exports.MutationKey = MutationKey;
|
|
963
|
-
exports.Operations = Operations;
|
|
964
777
|
exports.Query = Query;
|
|
965
778
|
exports.QueryKey = QueryKey;
|
|
966
779
|
exports.QueryOptions = QueryOptions;
|
|
967
780
|
exports.SuspenseQuery = SuspenseQuery;
|
|
968
|
-
|
|
969
|
-
//# sourceMappingURL=chunk-
|
|
970
|
-
//# sourceMappingURL=chunk-Z6CABIIO.cjs.map
|
|
781
|
+
//# sourceMappingURL=chunk-6GUCBOIJ.cjs.map
|
|
782
|
+
//# sourceMappingURL=chunk-6GUCBOIJ.cjs.map
|