@kubb/plugin-swr 3.0.0-alpha.9 → 3.0.0-beta.2
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/README.md +14 -5
- package/dist/chunk-4EGGCGSE.js +217 -0
- package/dist/chunk-4EGGCGSE.js.map +1 -0
- package/dist/chunk-H23WKEYP.js +243 -0
- package/dist/chunk-H23WKEYP.js.map +1 -0
- package/dist/chunk-JWGWABV5.cjs +249 -0
- package/dist/chunk-JWGWABV5.cjs.map +1 -0
- package/dist/chunk-PTOQHHST.cjs +220 -0
- package/dist/chunk-PTOQHHST.cjs.map +1 -0
- package/dist/components.cjs +23 -6
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +88 -6
- package/dist/components.d.ts +88 -6
- package/dist/components.js +2 -10
- package/dist/components.js.map +1 -1
- package/dist/generators.cjs +17 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.d.cts +11 -0
- package/dist/generators.d.ts +11 -0
- package/dist/generators.js +4 -0
- package/dist/generators.js.map +1 -0
- package/dist/index.cjs +93 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +77 -114
- package/dist/index.js.map +1 -1
- package/dist/types-DaH2Sc1M.d.cts +103 -0
- package/dist/types-DaH2Sc1M.d.ts +103 -0
- package/package.json +23 -17
- package/src/components/Mutation.tsx +93 -227
- package/src/components/MutationKey.tsx +48 -0
- package/src/components/Query.tsx +93 -259
- package/src/components/QueryKey.tsx +73 -0
- package/src/components/QueryOptions.tsx +54 -177
- package/src/components/index.ts +2 -0
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +43 -0
- package/src/generators/__snapshots__/clientGetImportPath.ts +43 -0
- package/src/generators/__snapshots__/clientPostImportPath.ts +32 -0
- package/src/generators/__snapshots__/findByTags.ts +43 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +43 -0
- package/src/generators/__snapshots__/findByTagsWithZod.ts +43 -0
- package/src/generators/__snapshots__/getAsMutation.ts +34 -0
- package/src/generators/__snapshots__/postAsQuery.ts +41 -0
- package/src/generators/__snapshots__/updatePetById.ts +32 -0
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +36 -0
- package/src/generators/index.ts +2 -0
- package/src/generators/mutationGenerator.tsx +109 -0
- package/src/generators/queryGenerator.tsx +114 -0
- package/src/plugin.ts +71 -52
- package/src/types.ts +62 -78
- package/dist/chunk-TGLXUPN4.cjs +0 -536
- package/dist/chunk-TGLXUPN4.cjs.map +0 -1
- package/dist/chunk-XWXMQJD6.js +0 -536
- package/dist/chunk-XWXMQJD6.js.map +0 -1
- package/dist/index-B3C-JOIU.d.cts +0 -299
- package/dist/index-B3C-JOIU.d.ts +0 -299
- package/src/OperationGenerator.tsx +0 -75
- package/src/components/SchemaType.tsx +0 -63
- package/src/components/__snapshots__/Mutation/Pets.ts +0 -46
- package/src/components/__snapshots__/Query/showPetById.ts +0 -59
package/dist/chunk-XWXMQJD6.js
DELETED
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
// src/components/Mutation.tsx
|
|
2
|
-
import transformers from "@kubb/core/transformers";
|
|
3
|
-
import { FunctionParams, URLPath } from "@kubb/core/utils";
|
|
4
|
-
import { File as File2, Function, useApp as useApp2 } from "@kubb/react";
|
|
5
|
-
import { pluginTsName as pluginTsName2 } from "@kubb/plugin-ts";
|
|
6
|
-
import { useOperation as useOperation2, useOperationManager as useOperationManager2 } from "@kubb/plugin-oas/hooks";
|
|
7
|
-
import { getASTParams, getComments } from "@kubb/plugin-oas/utils";
|
|
8
|
-
|
|
9
|
-
// src/components/SchemaType.tsx
|
|
10
|
-
import { File, Type, useApp } from "@kubb/react";
|
|
11
|
-
import { useOperation, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
12
|
-
import { pluginTsName } from "@kubb/plugin-ts";
|
|
13
|
-
import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
14
|
-
function SchemaType({ factory }) {
|
|
15
|
-
const {
|
|
16
|
-
plugin: {
|
|
17
|
-
options: { dataReturnType }
|
|
18
|
-
}
|
|
19
|
-
} = useApp();
|
|
20
|
-
const { getSchemas } = useOperationManager();
|
|
21
|
-
const operation = useOperation();
|
|
22
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: "type" });
|
|
23
|
-
const [TData, TError, TRequest, TPathParams, TQueryParams, THeaderParams, TResponse] = [
|
|
24
|
-
schemas.response.name,
|
|
25
|
-
schemas.errors?.map((item) => item.name).join(" | ") || "never",
|
|
26
|
-
schemas.request?.name || "never",
|
|
27
|
-
schemas.pathParams?.name || "never",
|
|
28
|
-
schemas.queryParams?.name || "never",
|
|
29
|
-
schemas.headerParams?.name || "never",
|
|
30
|
-
schemas.response.name
|
|
31
|
-
];
|
|
32
|
-
const clientType = `${factory.name}Client`;
|
|
33
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
-
/* @__PURE__ */ jsx(File.Source, { name: clientType, isTypeOnly: true, children: /* @__PURE__ */ jsx(Type, { name: clientType, children: `typeof client<${TResponse}, ${TError}, ${TRequest}>` }) }),
|
|
35
|
-
/* @__PURE__ */ jsx(File.Source, { name: factory.name, isTypeOnly: true, children: /* @__PURE__ */ jsx(Type, { name: factory.name, children: `
|
|
36
|
-
{
|
|
37
|
-
data: ${TData}
|
|
38
|
-
error: ${TError}
|
|
39
|
-
request: ${TRequest}
|
|
40
|
-
pathParams: ${TPathParams}
|
|
41
|
-
queryParams: ${TQueryParams}
|
|
42
|
-
headerParams: ${THeaderParams}
|
|
43
|
-
response: ${dataReturnType === "data" ? TData : `Awaited<ReturnType<${clientType}>>`}
|
|
44
|
-
client: {
|
|
45
|
-
parameters: Partial<Parameters<${clientType}>[0]>
|
|
46
|
-
return: Awaited<ReturnType<${clientType}>>
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
` }) })
|
|
50
|
-
] });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// src/components/Mutation.tsx
|
|
54
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "@kubb/react/jsx-runtime";
|
|
55
|
-
function Template({ name, generics, returnType, params, JSDoc, client, hook, dataReturnType }) {
|
|
56
|
-
const clientOptions = [
|
|
57
|
-
`method: "${client.method}"`,
|
|
58
|
-
"url",
|
|
59
|
-
client.withQueryParams ? "params" : void 0,
|
|
60
|
-
client.withData ? "data" : void 0,
|
|
61
|
-
client.withHeaders ? "headers: { ...headers, ...clientOptions.headers }" : void 0,
|
|
62
|
-
"...clientOptions"
|
|
63
|
-
].filter(Boolean);
|
|
64
|
-
const resolvedClientOptions = `${transformers.createIndent(4)}${clientOptions.join(`,
|
|
65
|
-
${transformers.createIndent(4)}`)}`;
|
|
66
|
-
if (client.withQueryParams) {
|
|
67
|
-
return /* @__PURE__ */ jsx2(File2.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx2(Function, { export: true, name, generics, returnType, params, JSDoc, children: `
|
|
68
|
-
const { mutation: mutationOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}
|
|
69
|
-
|
|
70
|
-
const url = ${client.path.template} as const
|
|
71
|
-
return ${hook.name}<${hook.generics}>(
|
|
72
|
-
shouldFetch ? [url, params]: null,
|
|
73
|
-
async (_url${client.withData ? ", { arg: data }" : ""}) => {
|
|
74
|
-
const res = await client<${client.generics}>({
|
|
75
|
-
${resolvedClientOptions}
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
return ${dataReturnType === "data" ? "res.data" : "res"}
|
|
79
|
-
},
|
|
80
|
-
mutationOptions
|
|
81
|
-
)
|
|
82
|
-
` }) });
|
|
83
|
-
}
|
|
84
|
-
return /* @__PURE__ */ jsx2(File2.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx2(Function, { export: true, name, generics, returnType, params, JSDoc, children: `
|
|
85
|
-
const { mutation: mutationOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}
|
|
86
|
-
|
|
87
|
-
const url = ${client.path.template} as const
|
|
88
|
-
return ${hook.name}<${hook.generics}>(
|
|
89
|
-
shouldFetch ? url : null,
|
|
90
|
-
async (_url${client.withData ? ", { arg: data }" : ""}) => {
|
|
91
|
-
const res = await client<${client.generics}>({
|
|
92
|
-
${resolvedClientOptions}
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
return ${dataReturnType === "data" ? "res.data" : "res"}
|
|
96
|
-
},
|
|
97
|
-
mutationOptions
|
|
98
|
-
)
|
|
99
|
-
` }) });
|
|
100
|
-
}
|
|
101
|
-
var defaultTemplates = {
|
|
102
|
-
default: Template
|
|
103
|
-
};
|
|
104
|
-
function Mutation({ factory, Template: Template4 = defaultTemplates.default }) {
|
|
105
|
-
const {
|
|
106
|
-
plugin: {
|
|
107
|
-
options: { dataReturnType }
|
|
108
|
-
}
|
|
109
|
-
} = useApp2();
|
|
110
|
-
const { getSchemas, getName } = useOperationManager2();
|
|
111
|
-
const operation = useOperation2();
|
|
112
|
-
const name = getName(operation, { type: "function" });
|
|
113
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName2], type: "type" });
|
|
114
|
-
const params = new FunctionParams();
|
|
115
|
-
const client = {
|
|
116
|
-
method: operation.method,
|
|
117
|
-
path: new URLPath(operation.path),
|
|
118
|
-
generics: [`${factory.name}["data"]`, `${factory.name}["error"]`, schemas.request?.name ? `${factory.name}["request"]` : ""].filter(Boolean).join(", "),
|
|
119
|
-
withQueryParams: !!schemas.queryParams?.name,
|
|
120
|
-
withData: !!schemas.request?.name,
|
|
121
|
-
withPathParams: !!schemas.pathParams?.name,
|
|
122
|
-
withHeaders: !!schemas.headerParams?.name
|
|
123
|
-
};
|
|
124
|
-
const resultGenerics = [`${factory.name}["response"]`, `${factory.name}["error"]`];
|
|
125
|
-
params.add([
|
|
126
|
-
...getASTParams(schemas.pathParams, { typed: true }),
|
|
127
|
-
{
|
|
128
|
-
name: "params",
|
|
129
|
-
type: `${factory.name}['queryParams']`,
|
|
130
|
-
enabled: client.withQueryParams,
|
|
131
|
-
required: false
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "headers",
|
|
135
|
-
type: `${factory.name}['headerParams']`,
|
|
136
|
-
enabled: client.withHeaders,
|
|
137
|
-
required: false
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "options",
|
|
141
|
-
required: false,
|
|
142
|
-
type: `{
|
|
143
|
-
mutation?: SWRMutationConfiguration<${resultGenerics.join(", ")}>,
|
|
144
|
-
client?: ${factory.name}['client']['parameters'],
|
|
145
|
-
shouldFetch?: boolean,
|
|
146
|
-
}`,
|
|
147
|
-
default: "{}"
|
|
148
|
-
}
|
|
149
|
-
]);
|
|
150
|
-
const hook = {
|
|
151
|
-
name: "useSWRMutation",
|
|
152
|
-
generics: [...resultGenerics, client.withQueryParams ? "[typeof url, typeof params] | null" : "typeof url | null"].join(", ")
|
|
153
|
-
};
|
|
154
|
-
return /* @__PURE__ */ jsx2(
|
|
155
|
-
Template4,
|
|
156
|
-
{
|
|
157
|
-
name,
|
|
158
|
-
JSDoc: { comments: getComments(operation) },
|
|
159
|
-
client,
|
|
160
|
-
hook,
|
|
161
|
-
params: params.toString(),
|
|
162
|
-
returnType: `SWRMutationResponse<${resultGenerics.join(", ")}>`,
|
|
163
|
-
dataReturnType
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
Mutation.File = function({ templates = defaultTemplates }) {
|
|
168
|
-
const {
|
|
169
|
-
plugin: {
|
|
170
|
-
options: {
|
|
171
|
-
extName,
|
|
172
|
-
client: { importPath }
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
} = useApp2();
|
|
176
|
-
const { getSchemas, getFile, getName } = useOperationManager2();
|
|
177
|
-
const operation = useOperation2();
|
|
178
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName2], type: "type" });
|
|
179
|
-
const file = getFile(operation);
|
|
180
|
-
const fileType = getFile(operation, { pluginKey: [pluginTsName2] });
|
|
181
|
-
const factoryName = getName(operation, { type: "type" });
|
|
182
|
-
const Template4 = templates.default;
|
|
183
|
-
const factory = {
|
|
184
|
-
name: factoryName
|
|
185
|
-
};
|
|
186
|
-
return /* @__PURE__ */ jsxs2(File2, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
187
|
-
/* @__PURE__ */ jsx2(File2.Import, { name: "useSWRMutation", path: "swr/mutation" }),
|
|
188
|
-
/* @__PURE__ */ jsx2(File2.Import, { name: ["SWRMutationConfiguration", "SWRMutationResponse"], path: "swr/mutation", isTypeOnly: true }),
|
|
189
|
-
/* @__PURE__ */ jsx2(File2.Import, { name: "client", path: importPath }),
|
|
190
|
-
/* @__PURE__ */ jsx2(File2.Import, { name: ["ResponseConfig"], path: importPath, isTypeOnly: true }),
|
|
191
|
-
/* @__PURE__ */ jsx2(
|
|
192
|
-
File2.Import,
|
|
193
|
-
{
|
|
194
|
-
name: [
|
|
195
|
-
schemas.request?.name,
|
|
196
|
-
schemas.response.name,
|
|
197
|
-
schemas.pathParams?.name,
|
|
198
|
-
schemas.queryParams?.name,
|
|
199
|
-
schemas.headerParams?.name,
|
|
200
|
-
...schemas.errors?.map((error) => error.name) || []
|
|
201
|
-
].filter(Boolean),
|
|
202
|
-
root: file.path,
|
|
203
|
-
path: fileType.path,
|
|
204
|
-
isTypeOnly: true
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ jsx2(SchemaType, { factory }),
|
|
208
|
-
/* @__PURE__ */ jsx2(Mutation, { Template: Template4, factory })
|
|
209
|
-
] });
|
|
210
|
-
};
|
|
211
|
-
Mutation.templates = defaultTemplates;
|
|
212
|
-
|
|
213
|
-
// src/components/Query.tsx
|
|
214
|
-
import { FunctionParams as FunctionParams3, URLPath as URLPath3 } from "@kubb/core/utils";
|
|
215
|
-
import { useOperation as useOperation4, useOperationManager as useOperationManager4 } from "@kubb/plugin-oas/hooks";
|
|
216
|
-
import { getASTParams as getASTParams3, getComments as getComments2 } from "@kubb/plugin-oas/utils";
|
|
217
|
-
import { pluginTsName as pluginTsName4 } from "@kubb/plugin-ts";
|
|
218
|
-
import { pluginZodName as pluginZodName2 } from "@kubb/plugin-zod";
|
|
219
|
-
import { File as File4, Function as Function3, useApp as useApp4 } from "@kubb/react";
|
|
220
|
-
|
|
221
|
-
// src/components/QueryOptions.tsx
|
|
222
|
-
import transformers2 from "@kubb/core/transformers";
|
|
223
|
-
import { FunctionParams as FunctionParams2, URLPath as URLPath2 } from "@kubb/core/utils";
|
|
224
|
-
import { useOperation as useOperation3, useOperationManager as useOperationManager3 } from "@kubb/plugin-oas/hooks";
|
|
225
|
-
import { getASTParams as getASTParams2 } from "@kubb/plugin-oas/utils";
|
|
226
|
-
import { Function as Function2, File as File3, useApp as useApp3 } from "@kubb/react";
|
|
227
|
-
import { pluginZodName } from "@kubb/plugin-zod";
|
|
228
|
-
import { pluginTsName as pluginTsName3 } from "@kubb/plugin-ts";
|
|
229
|
-
import { jsx as jsx3 } from "@kubb/react/jsx-runtime";
|
|
230
|
-
function Template2({ name, params, generics, returnType, JSDoc, client, dataReturnType, parser }) {
|
|
231
|
-
const isFormData = client.contentType === "multipart/form-data";
|
|
232
|
-
const headers = [
|
|
233
|
-
client.contentType !== "application/json" ? `'Content-Type': '${client.contentType}'` : void 0,
|
|
234
|
-
client.withHeaders ? "...headers" : void 0
|
|
235
|
-
].filter(Boolean).join(", ");
|
|
236
|
-
const clientOptions = [
|
|
237
|
-
`method: "${client.method}"`,
|
|
238
|
-
`url: ${client.path.template}`,
|
|
239
|
-
client.withQueryParams ? "params" : void 0,
|
|
240
|
-
client.withData && !isFormData ? "data" : void 0,
|
|
241
|
-
client.withData && isFormData ? "data: formData" : void 0,
|
|
242
|
-
headers.length ? `headers: { ${headers}, ...options.headers }` : void 0,
|
|
243
|
-
"...options"
|
|
244
|
-
].filter(Boolean);
|
|
245
|
-
const resolvedClientOptions = `${transformers2.createIndent(4)}${clientOptions.join(`,
|
|
246
|
-
${transformers2.createIndent(4)}`)}`;
|
|
247
|
-
let returnRes = parser ? `return ${parser}(res.data)` : "return res.data";
|
|
248
|
-
if (dataReturnType === "full") {
|
|
249
|
-
returnRes = parser ? `return {...res, data: ${parser}(res.data)}` : "return res";
|
|
250
|
-
}
|
|
251
|
-
const formData = isFormData ? `
|
|
252
|
-
const formData = new FormData()
|
|
253
|
-
if(data) {
|
|
254
|
-
Object.keys(data).forEach((key) => {
|
|
255
|
-
const value = data[key];
|
|
256
|
-
if (typeof key === "string" && (typeof value === "string" || value instanceof Blob)) {
|
|
257
|
-
formData.append(key, value);
|
|
258
|
-
}
|
|
259
|
-
})
|
|
260
|
-
}
|
|
261
|
-
` : void 0;
|
|
262
|
-
return /* @__PURE__ */ jsx3(File3.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx3(Function2, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
263
|
-
return {
|
|
264
|
-
fetcher: async () => {
|
|
265
|
-
${formData || ""}
|
|
266
|
-
const res = await client<${client.generics}>({
|
|
267
|
-
${resolvedClientOptions}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
${returnRes}
|
|
271
|
-
},
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
` }) });
|
|
275
|
-
}
|
|
276
|
-
var defaultTemplates2 = {
|
|
277
|
-
default: Template2
|
|
278
|
-
};
|
|
279
|
-
function QueryOptions({ factory, dataReturnType, Template: Template4 = defaultTemplates2.default }) {
|
|
280
|
-
const {
|
|
281
|
-
pluginManager,
|
|
282
|
-
plugin: {
|
|
283
|
-
key: pluginKey,
|
|
284
|
-
options: { parser }
|
|
285
|
-
}
|
|
286
|
-
} = useApp3();
|
|
287
|
-
const { getSchemas } = useOperationManager3();
|
|
288
|
-
const operation = useOperation3();
|
|
289
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName3], type: "type" });
|
|
290
|
-
const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName], type: "function" });
|
|
291
|
-
const name = pluginManager.resolveName({
|
|
292
|
-
name: `${factory.name}QueryOptions`,
|
|
293
|
-
pluginKey
|
|
294
|
-
});
|
|
295
|
-
const contentType = operation.getContentType();
|
|
296
|
-
const generics = new FunctionParams2();
|
|
297
|
-
const params = new FunctionParams2();
|
|
298
|
-
const clientGenerics = ["TData", `${factory.name}['error']`];
|
|
299
|
-
const resultGenerics = ["TData", `${factory.name}['error']`];
|
|
300
|
-
generics.add([{ type: "TData", default: `${factory.name}['response']` }]);
|
|
301
|
-
params.add([
|
|
302
|
-
...getASTParams2(schemas.pathParams, { typed: true }),
|
|
303
|
-
{
|
|
304
|
-
name: "params",
|
|
305
|
-
type: `${factory.name}['queryParams']`,
|
|
306
|
-
enabled: !!schemas.queryParams?.name,
|
|
307
|
-
required: false
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: "headers",
|
|
311
|
-
type: `${factory.name}['headerParams']`,
|
|
312
|
-
enabled: !!schemas.headerParams?.name,
|
|
313
|
-
required: false
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
name: "options",
|
|
317
|
-
type: `${factory.name}['client']['parameters']`,
|
|
318
|
-
default: "{}"
|
|
319
|
-
}
|
|
320
|
-
]);
|
|
321
|
-
const client = {
|
|
322
|
-
withQueryParams: !!schemas.queryParams?.name,
|
|
323
|
-
withData: !!schemas.request?.name,
|
|
324
|
-
withPathParams: !!schemas.pathParams?.name,
|
|
325
|
-
withHeaders: !!schemas.headerParams?.name,
|
|
326
|
-
method: operation.method,
|
|
327
|
-
path: new URLPath2(operation.path),
|
|
328
|
-
generics: clientGenerics.join(", "),
|
|
329
|
-
contentType
|
|
330
|
-
};
|
|
331
|
-
return /* @__PURE__ */ jsx3(
|
|
332
|
-
Template4,
|
|
333
|
-
{
|
|
334
|
-
name,
|
|
335
|
-
params: params.toString(),
|
|
336
|
-
generics: generics.toString(),
|
|
337
|
-
returnType: `SWRConfiguration<${resultGenerics.join(", ")}>`,
|
|
338
|
-
client,
|
|
339
|
-
dataReturnType,
|
|
340
|
-
parser: parser === "zod" ? `${zodSchemas.response.name}.parse` : void 0
|
|
341
|
-
}
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
QueryOptions.templates = defaultTemplates2;
|
|
345
|
-
|
|
346
|
-
// src/components/Query.tsx
|
|
347
|
-
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "@kubb/react/jsx-runtime";
|
|
348
|
-
function Template3({ name, generics, returnType, params, JSDoc, hook, client }) {
|
|
349
|
-
if (client.withQueryParams) {
|
|
350
|
-
return /* @__PURE__ */ jsx4(File4.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx4(Function3, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
351
|
-
const { query: queryOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}
|
|
352
|
-
|
|
353
|
-
const url = ${client.path.template}
|
|
354
|
-
const query = ${hook.name}<${hook.generics}>(
|
|
355
|
-
shouldFetch ? [url, params]: null,
|
|
356
|
-
{
|
|
357
|
-
...${hook.queryOptions},
|
|
358
|
-
...queryOptions
|
|
359
|
-
}
|
|
360
|
-
)
|
|
361
|
-
|
|
362
|
-
return query
|
|
363
|
-
` }) });
|
|
364
|
-
}
|
|
365
|
-
return /* @__PURE__ */ jsx4(File4.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx4(Function3, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
366
|
-
const { query: queryOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}
|
|
367
|
-
|
|
368
|
-
const url = ${client.path.template}
|
|
369
|
-
const query = ${hook.name}<${hook.generics}>(
|
|
370
|
-
shouldFetch ? url : null,
|
|
371
|
-
{
|
|
372
|
-
...${hook.queryOptions},
|
|
373
|
-
...queryOptions
|
|
374
|
-
}
|
|
375
|
-
)
|
|
376
|
-
|
|
377
|
-
return query
|
|
378
|
-
` }) });
|
|
379
|
-
}
|
|
380
|
-
var defaultTemplates3 = {
|
|
381
|
-
default: Template3
|
|
382
|
-
};
|
|
383
|
-
function Query({ factory, Template: Template4 = defaultTemplates3.default, QueryOptionsTemplate = QueryOptions.templates.default }) {
|
|
384
|
-
const {
|
|
385
|
-
pluginManager,
|
|
386
|
-
plugin: {
|
|
387
|
-
key: pluginKey,
|
|
388
|
-
options: { dataReturnType }
|
|
389
|
-
}
|
|
390
|
-
} = useApp4();
|
|
391
|
-
const operation = useOperation4();
|
|
392
|
-
const { getSchemas, getName } = useOperationManager4();
|
|
393
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName4], type: "type" });
|
|
394
|
-
const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName2], type: "function" });
|
|
395
|
-
const name = getName(operation, { type: "function" });
|
|
396
|
-
const queryOptionsName = pluginManager.resolveName({
|
|
397
|
-
name: `${factory.name}QueryOptions`,
|
|
398
|
-
pluginKey
|
|
399
|
-
});
|
|
400
|
-
const generics = new FunctionParams3();
|
|
401
|
-
const params = new FunctionParams3();
|
|
402
|
-
const queryParams = new FunctionParams3();
|
|
403
|
-
const client = {
|
|
404
|
-
method: operation.method,
|
|
405
|
-
path: new URLPath3(operation.path),
|
|
406
|
-
withQueryParams: !!schemas.queryParams?.name,
|
|
407
|
-
withData: !!schemas.request?.name,
|
|
408
|
-
withPathParams: !!schemas.pathParams?.name,
|
|
409
|
-
withHeaders: !!schemas.headerParams?.name
|
|
410
|
-
};
|
|
411
|
-
const resultGenerics = ["TData", `${factory.name}["error"]`];
|
|
412
|
-
generics.add([{ type: "TData", default: `${factory.name}["response"]` }]);
|
|
413
|
-
const queryOptionsGenerics = ["TData"];
|
|
414
|
-
params.add([
|
|
415
|
-
...getASTParams3(schemas.pathParams, { typed: true }),
|
|
416
|
-
{
|
|
417
|
-
name: "params",
|
|
418
|
-
type: `${factory.name}['queryParams']`,
|
|
419
|
-
enabled: client.withQueryParams,
|
|
420
|
-
required: false
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
name: "headers",
|
|
424
|
-
type: `${factory.name}['headerParams']`,
|
|
425
|
-
enabled: client.withHeaders,
|
|
426
|
-
required: false
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: "options",
|
|
430
|
-
required: false,
|
|
431
|
-
type: `{
|
|
432
|
-
query?: SWRConfiguration<${resultGenerics.join(", ")}>,
|
|
433
|
-
client?: ${factory.name}['client']['parameters'],
|
|
434
|
-
shouldFetch?: boolean,
|
|
435
|
-
}`,
|
|
436
|
-
default: "{}"
|
|
437
|
-
}
|
|
438
|
-
]);
|
|
439
|
-
queryParams.add([
|
|
440
|
-
...getASTParams3(schemas.pathParams, { typed: false }),
|
|
441
|
-
{
|
|
442
|
-
name: "params",
|
|
443
|
-
enabled: client.withQueryParams,
|
|
444
|
-
required: false
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
name: "headers",
|
|
448
|
-
enabled: client.withHeaders,
|
|
449
|
-
required: false
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
name: "clientOptions",
|
|
453
|
-
required: false
|
|
454
|
-
}
|
|
455
|
-
]);
|
|
456
|
-
const hook = {
|
|
457
|
-
name: "useSWR",
|
|
458
|
-
generics: [...resultGenerics, client.withQueryParams ? "[typeof url, typeof params] | null" : "typeof url | null"].join(", "),
|
|
459
|
-
queryOptions: `${queryOptionsName}<${queryOptionsGenerics.join(", ")}>(${queryParams.toString()})`
|
|
460
|
-
};
|
|
461
|
-
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
462
|
-
/* @__PURE__ */ jsx4(QueryOptions, { factory, Template: QueryOptionsTemplate, dataReturnType }),
|
|
463
|
-
/* @__PURE__ */ jsx4(
|
|
464
|
-
Template4,
|
|
465
|
-
{
|
|
466
|
-
name,
|
|
467
|
-
generics: generics.toString(),
|
|
468
|
-
JSDoc: { comments: getComments2(operation) },
|
|
469
|
-
client,
|
|
470
|
-
hook,
|
|
471
|
-
params: params.toString(),
|
|
472
|
-
returnType: `SWRResponse<${resultGenerics.join(", ")}>`
|
|
473
|
-
}
|
|
474
|
-
)
|
|
475
|
-
] });
|
|
476
|
-
}
|
|
477
|
-
Query.File = function({ templates }) {
|
|
478
|
-
const {
|
|
479
|
-
pluginManager,
|
|
480
|
-
plugin: {
|
|
481
|
-
options: {
|
|
482
|
-
extName,
|
|
483
|
-
client: { importPath },
|
|
484
|
-
parser
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
} = useApp4();
|
|
488
|
-
const { getSchemas, getFile, getName } = useOperationManager4();
|
|
489
|
-
const operation = useOperation4();
|
|
490
|
-
const file = getFile(operation);
|
|
491
|
-
const schemas = getSchemas(operation, { pluginKey: [pluginTsName4], type: "type" });
|
|
492
|
-
const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName2], type: "function" });
|
|
493
|
-
const fileType = getFile(operation, { pluginKey: [pluginTsName4] });
|
|
494
|
-
const fileZodSchemas = getFile(operation, {
|
|
495
|
-
pluginKey: [pluginZodName2]
|
|
496
|
-
});
|
|
497
|
-
const factoryName = getName(operation, { type: "type" });
|
|
498
|
-
const Template4 = templates?.query.default || defaultTemplates3.default;
|
|
499
|
-
const QueryOptionsTemplate = templates?.queryOptions.default || QueryOptions.templates.default;
|
|
500
|
-
const factory = {
|
|
501
|
-
name: factoryName
|
|
502
|
-
};
|
|
503
|
-
return /* @__PURE__ */ jsxs3(File4, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
504
|
-
parser === "zod" && /* @__PURE__ */ jsx4(File4.Import, { name: [zodSchemas.response.name], root: file.path, path: fileZodSchemas.path }),
|
|
505
|
-
/* @__PURE__ */ jsx4(File4.Import, { name: "useSWR", path: "swr" }),
|
|
506
|
-
/* @__PURE__ */ jsx4(File4.Import, { name: ["SWRConfiguration", "SWRResponse"], path: "swr", isTypeOnly: true }),
|
|
507
|
-
/* @__PURE__ */ jsx4(File4.Import, { name: "client", path: importPath }),
|
|
508
|
-
/* @__PURE__ */ jsx4(File4.Import, { name: ["ResponseConfig"], path: importPath, isTypeOnly: true }),
|
|
509
|
-
/* @__PURE__ */ jsx4(
|
|
510
|
-
File4.Import,
|
|
511
|
-
{
|
|
512
|
-
name: [
|
|
513
|
-
schemas.request?.name,
|
|
514
|
-
schemas.response.name,
|
|
515
|
-
schemas.pathParams?.name,
|
|
516
|
-
schemas.queryParams?.name,
|
|
517
|
-
schemas.headerParams?.name,
|
|
518
|
-
...schemas.statusCodes?.map((item) => item.name) || []
|
|
519
|
-
].filter(Boolean),
|
|
520
|
-
root: file.path,
|
|
521
|
-
path: fileType.path,
|
|
522
|
-
isTypeOnly: true
|
|
523
|
-
}
|
|
524
|
-
),
|
|
525
|
-
/* @__PURE__ */ jsx4(SchemaType, { factory }),
|
|
526
|
-
/* @__PURE__ */ jsx4(Query, { factory, Template: Template4, QueryOptionsTemplate })
|
|
527
|
-
] });
|
|
528
|
-
};
|
|
529
|
-
Query.templates = defaultTemplates3;
|
|
530
|
-
|
|
531
|
-
export {
|
|
532
|
-
Mutation,
|
|
533
|
-
QueryOptions,
|
|
534
|
-
Query
|
|
535
|
-
};
|
|
536
|
-
//# sourceMappingURL=chunk-XWXMQJD6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Mutation.tsx","../src/components/SchemaType.tsx","../src/components/Query.tsx","../src/components/QueryOptions.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { FunctionParams, URLPath } from '@kubb/core/utils'\nimport { File, Function, useApp } from '@kubb/react'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getASTParams, getComments } from '@kubb/plugin-oas/utils'\n\nimport { SchemaType } from './SchemaType.tsx'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginSwr } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Parameters/options/props that need to be used\n */\n params: string\n /**\n * Generics that needs to be added for TypeScript\n */\n generics?: string\n /**\n * ReturnType(see async for adding Promise type)\n */\n returnType?: string\n /**\n * Options for JSdocs\n */\n JSDoc?: {\n comments: string[]\n }\n hook: {\n name: string\n generics?: string\n }\n client: {\n method: HttpMethod\n generics: string\n withQueryParams: boolean\n withPathParams: boolean\n withData: boolean\n withHeaders: boolean\n path: URLPath\n }\n dataReturnType: NonNullable<PluginSwr['options']['dataReturnType']>\n}\n\nfunction Template({ name, generics, returnType, params, JSDoc, client, hook, dataReturnType }: TemplateProps): ReactNode {\n const clientOptions = [\n `method: \"${client.method}\"`,\n 'url',\n client.withQueryParams ? 'params' : undefined,\n client.withData ? 'data' : undefined,\n client.withHeaders ? 'headers: { ...headers, ...clientOptions.headers }' : undefined,\n '...clientOptions',\n ].filter(Boolean)\n\n const resolvedClientOptions = `${transformers.createIndent(4)}${clientOptions.join(`,\\n${transformers.createIndent(4)}`)}`\n if (client.withQueryParams) {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name} generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>\n {`\n const { mutation: mutationOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}\n\n const url = ${client.path.template} as const\n return ${hook.name}<${hook.generics}>(\n shouldFetch ? [url, params]: null,\n async (_url${client.withData ? ', { arg: data }' : ''}) => {\n const res = await client<${client.generics}>({\n ${resolvedClientOptions}\n })\n\n return ${dataReturnType === 'data' ? 'res.data' : 'res'}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name} generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>\n {`\n const { mutation: mutationOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}\n\n const url = ${client.path.template} as const\n return ${hook.name}<${hook.generics}>(\n shouldFetch ? url : null,\n async (_url${client.withData ? ', { arg: data }' : ''}) => {\n const res = await client<${client.generics}>({\n ${resolvedClientOptions}\n })\n\n return ${dataReturnType === 'data' ? 'res.data' : 'res'}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n )\n}\n\nconst defaultTemplates = {\n default: Template,\n} as const\n\ntype Props = {\n factory: {\n name: string\n }\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<TemplateProps>\n}\n\nexport function Mutation({ factory, Template = defaultTemplates.default }: Props): ReactNode {\n const {\n plugin: {\n options: { dataReturnType },\n },\n } = useApp<PluginSwr>()\n const { getSchemas, getName } = useOperationManager()\n const operation = useOperation()\n\n const name = getName(operation, { type: 'function' })\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n\n const params = new FunctionParams()\n const client = {\n method: operation.method,\n path: new URLPath(operation.path),\n generics: [`${factory.name}[\"data\"]`, `${factory.name}[\"error\"]`, schemas.request?.name ? `${factory.name}[\"request\"]` : ''].filter(Boolean).join(', '),\n withQueryParams: !!schemas.queryParams?.name,\n withData: !!schemas.request?.name,\n withPathParams: !!schemas.pathParams?.name,\n withHeaders: !!schemas.headerParams?.name,\n }\n\n const resultGenerics = [`${factory.name}[\"response\"]`, `${factory.name}[\"error\"]`]\n\n params.add([\n ...getASTParams(schemas.pathParams, { typed: true }),\n {\n name: 'params',\n type: `${factory.name}['queryParams']`,\n enabled: client.withQueryParams,\n required: false,\n },\n {\n name: 'headers',\n type: `${factory.name}['headerParams']`,\n enabled: client.withHeaders,\n required: false,\n },\n {\n name: 'options',\n required: false,\n type: `{\n mutation?: SWRMutationConfiguration<${resultGenerics.join(', ')}>,\n client?: ${factory.name}['client']['parameters'],\n shouldFetch?: boolean,\n }`,\n default: '{}',\n },\n ])\n\n const hook = {\n name: 'useSWRMutation',\n generics: [...resultGenerics, client.withQueryParams ? '[typeof url, typeof params] | null' : 'typeof url | null'].join(', '),\n }\n\n return (\n <Template\n name={name}\n JSDoc={{ comments: getComments(operation) }}\n client={client}\n hook={hook}\n params={params.toString()}\n returnType={`SWRMutationResponse<${resultGenerics.join(', ')}>`}\n dataReturnType={dataReturnType}\n />\n )\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nMutation.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {\n const {\n plugin: {\n options: {\n extName,\n client: { importPath },\n },\n },\n } = useApp<PluginSwr>()\n\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n const file = getFile(operation)\n const fileType = getFile(operation, { pluginKey: [pluginTsName] })\n const factoryName = getName(operation, { type: 'type' })\n\n const Template = templates.default\n const factory = {\n name: factoryName,\n }\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name=\"useSWRMutation\" path=\"swr/mutation\" />\n <File.Import name={['SWRMutationConfiguration', 'SWRMutationResponse']} path=\"swr/mutation\" isTypeOnly />\n <File.Import name={'client'} path={importPath} />\n <File.Import name={['ResponseConfig']} path={importPath} isTypeOnly />\n <File.Import\n name={[\n schemas.request?.name,\n schemas.response.name,\n schemas.pathParams?.name,\n schemas.queryParams?.name,\n schemas.headerParams?.name,\n ...(schemas.errors?.map((error) => error.name) || []),\n ].filter(Boolean)}\n root={file.path}\n path={fileType.path}\n isTypeOnly\n />\n\n <SchemaType factory={factory} />\n <Mutation Template={Template} factory={factory} />\n </File>\n )\n}\n\nMutation.templates = defaultTemplates\n","import { File, Type, useApp } from '@kubb/react'\n\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\n\ntype Props = {\n factory: {\n name: string\n }\n}\n\nexport function SchemaType({ factory }: Props): ReactNode {\n const {\n plugin: {\n options: { dataReturnType },\n },\n } = useApp<PluginSwr>()\n const { getSchemas } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n\n const [TData, TError, TRequest, TPathParams, TQueryParams, THeaderParams, TResponse] = [\n schemas.response.name,\n schemas.errors?.map((item) => item.name).join(' | ') || 'never',\n schemas.request?.name || 'never',\n schemas.pathParams?.name || 'never',\n schemas.queryParams?.name || 'never',\n schemas.headerParams?.name || 'never',\n schemas.response.name,\n ]\n\n const clientType = `${factory.name}Client`\n\n return (\n <>\n <File.Source name={clientType} isTypeOnly>\n <Type name={clientType}>{`typeof client<${TResponse}, ${TError}, ${TRequest}>`}</Type>\n </File.Source>\n <File.Source name={factory.name} isTypeOnly>\n <Type name={factory.name}>\n {`\n {\n data: ${TData}\n error: ${TError}\n request: ${TRequest}\n pathParams: ${TPathParams}\n queryParams: ${TQueryParams}\n headerParams: ${THeaderParams}\n response: ${dataReturnType === 'data' ? TData : `Awaited<ReturnType<${clientType}>>`}\n client: {\n parameters: Partial<Parameters<${clientType}>[0]>\n return: Awaited<ReturnType<${clientType}>>\n }\n }\n `}\n </Type>\n </File.Source>\n </>\n )\n}\n","import { FunctionParams, URLPath } from '@kubb/core/utils'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getASTParams, getComments } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, Function, useApp } from '@kubb/react'\n\nimport { QueryOptions } from './QueryOptions.tsx'\nimport { SchemaType } from './SchemaType.tsx'\n\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginSwr } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Parameters/options/props that need to be used\n */\n params: string\n /**\n * Generics that needs to be added for TypeScript\n */\n generics?: string\n /**\n * ReturnType(see async for adding Promise type)\n */\n returnType?: string\n /**\n * Options for JSdocs\n */\n JSDoc?: {\n comments: string[]\n }\n hook: {\n name: string\n generics?: string\n queryOptions: string\n }\n client: {\n path: URLPath\n withQueryParams: boolean\n }\n}\n\nfunction Template({ name, generics, returnType, params, JSDoc, hook, client }: TemplateProps): ReactNode {\n if (client.withQueryParams) {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>\n {`\n const { query: queryOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}\n\n const url = ${client.path.template}\n const query = ${hook.name}<${hook.generics}>(\n shouldFetch ? [url, params]: null,\n {\n ...${hook.queryOptions},\n ...queryOptions\n }\n )\n\n return query\n `}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>\n {`\n const { query: queryOptions, client: clientOptions = {}, shouldFetch = true } = options ?? {}\n\n const url = ${client.path.template}\n const query = ${hook.name}<${hook.generics}>(\n shouldFetch ? url : null,\n {\n ...${hook.queryOptions},\n ...queryOptions\n }\n )\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nconst defaultTemplates = {\n default: Template,\n} as const\n\ntype Props = {\n factory: {\n name: string\n }\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<TemplateProps>\n /**\n * This will make it possible to override the default behaviour.\n */\n QueryOptionsTemplate?: React.ComponentType<React.ComponentProps<typeof QueryOptions.templates.default>>\n}\n\nexport function Query({ factory, Template = defaultTemplates.default, QueryOptionsTemplate = QueryOptions.templates.default }: Props): ReactNode {\n const {\n pluginManager,\n plugin: {\n key: pluginKey,\n options: { dataReturnType },\n },\n } = useApp<PluginSwr>()\n\n const operation = useOperation()\n const { getSchemas, getName } = useOperationManager()\n\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' })\n\n const name = getName(operation, { type: 'function' })\n\n const queryOptionsName = pluginManager.resolveName({\n name: `${factory.name}QueryOptions`,\n pluginKey,\n })\n const generics = new FunctionParams()\n const params = new FunctionParams()\n const queryParams = new FunctionParams()\n const client = {\n method: operation.method,\n path: new URLPath(operation.path),\n withQueryParams: !!schemas.queryParams?.name,\n withData: !!schemas.request?.name,\n withPathParams: !!schemas.pathParams?.name,\n withHeaders: !!schemas.headerParams?.name,\n }\n\n const resultGenerics = ['TData', `${factory.name}[\"error\"]`]\n\n generics.add([{ type: 'TData', default: `${factory.name}[\"response\"]` }])\n\n const queryOptionsGenerics = ['TData']\n\n params.add([\n ...getASTParams(schemas.pathParams, { typed: true }),\n {\n name: 'params',\n type: `${factory.name}['queryParams']`,\n enabled: client.withQueryParams,\n required: false,\n },\n {\n name: 'headers',\n type: `${factory.name}['headerParams']`,\n enabled: client.withHeaders,\n required: false,\n },\n {\n name: 'options',\n required: false,\n type: `{\n query?: SWRConfiguration<${resultGenerics.join(', ')}>,\n client?: ${factory.name}['client']['parameters'],\n shouldFetch?: boolean,\n }`,\n default: '{}',\n },\n ])\n\n queryParams.add([\n ...getASTParams(schemas.pathParams, { typed: false }),\n {\n name: 'params',\n enabled: client.withQueryParams,\n required: false,\n },\n {\n name: 'headers',\n enabled: client.withHeaders,\n required: false,\n },\n {\n name: 'clientOptions',\n required: false,\n },\n ])\n\n const hook = {\n name: 'useSWR',\n generics: [...resultGenerics, client.withQueryParams ? '[typeof url, typeof params] | null' : 'typeof url | null'].join(', '),\n queryOptions: `${queryOptionsName}<${queryOptionsGenerics.join(', ')}>(${queryParams.toString()})`,\n }\n\n return (\n <>\n <QueryOptions factory={factory} Template={QueryOptionsTemplate} dataReturnType={dataReturnType} />\n <Template\n name={name}\n generics={generics.toString()}\n JSDoc={{ comments: getComments(operation) }}\n client={client}\n hook={hook}\n params={params.toString()}\n returnType={`SWRResponse<${resultGenerics.join(', ')}>`}\n />\n </>\n )\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: {\n query: typeof defaultTemplates\n queryOptions: typeof QueryOptions.templates\n }\n}\n\nQuery.File = function ({ templates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: {\n options: {\n extName,\n client: { importPath },\n parser,\n },\n },\n } = useApp<PluginSwr>()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' })\n const fileType = getFile(operation, { pluginKey: [pluginTsName] })\n const fileZodSchemas = getFile(operation, {\n pluginKey: [pluginZodName],\n })\n\n const factoryName = getName(operation, { type: 'type' })\n\n const Template = templates?.query.default || defaultTemplates.default\n const QueryOptionsTemplate = templates?.queryOptions.default || QueryOptions.templates.default\n const factory = {\n name: factoryName,\n }\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {parser === 'zod' && <File.Import name={[zodSchemas.response.name]} root={file.path} path={fileZodSchemas.path} />}\n <File.Import name=\"useSWR\" path=\"swr\" />\n <File.Import name={['SWRConfiguration', 'SWRResponse']} path=\"swr\" isTypeOnly />\n <File.Import name={'client'} path={importPath} />\n <File.Import name={['ResponseConfig']} path={importPath} isTypeOnly />\n <File.Import\n name={[\n schemas.request?.name,\n schemas.response.name,\n schemas.pathParams?.name,\n schemas.queryParams?.name,\n schemas.headerParams?.name,\n ...(schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={file.path}\n path={fileType.path}\n isTypeOnly\n />\n\n <SchemaType factory={factory} />\n <Query factory={factory} Template={Template} QueryOptionsTemplate={QueryOptionsTemplate} />\n </File>\n )\n}\n\nQuery.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { FunctionParams, URLPath } from '@kubb/core/utils'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getASTParams } from '@kubb/plugin-oas/utils'\nimport { Function, File, useApp } from '@kubb/react'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Parameters/options/props that need to be used\n */\n params: string\n /**\n * Generics that needs to be added for TypeScript\n */\n generics?: string\n /**\n * ReturnType(see async for adding Promise type)\n */\n returnType?: string\n /**\n * Options for JSdocs\n */\n JSDoc?: {\n comments: string[]\n }\n client: {\n generics: string\n method: HttpMethod\n path: URLPath\n withQueryParams: boolean\n withPathParams: boolean\n withData: boolean\n withHeaders: boolean\n contentType: string\n }\n dataReturnType: NonNullable<PluginSwr['options']['dataReturnType']>\n parser: string | undefined\n}\n\nfunction Template({ name, params, generics, returnType, JSDoc, client, dataReturnType, parser }: TemplateProps): ReactNode {\n const isFormData = client.contentType === 'multipart/form-data'\n const headers = [\n client.contentType !== 'application/json' ? `'Content-Type': '${client.contentType}'` : undefined,\n client.withHeaders ? '...headers' : undefined,\n ]\n .filter(Boolean)\n .join(', ')\n\n const clientOptions = [\n `method: \"${client.method}\"`,\n `url: ${client.path.template}`,\n client.withQueryParams ? 'params' : undefined,\n client.withData && !isFormData ? 'data' : undefined,\n client.withData && isFormData ? 'data: formData' : undefined,\n headers.length ? `headers: { ${headers}, ...options.headers }` : undefined,\n '...options',\n ].filter(Boolean)\n\n const resolvedClientOptions = `${transformers.createIndent(4)}${clientOptions.join(`,\\n${transformers.createIndent(4)}`)}`\n\n let returnRes = parser ? `return ${parser}(res.data)` : 'return res.data'\n\n if (dataReturnType === 'full') {\n returnRes = parser ? `return {...res, data: ${parser}(res.data)}` : 'return res'\n }\n\n const formData = isFormData\n ? `\n const formData = new FormData()\n if(data) {\n Object.keys(data).forEach((key) => {\n const value = data[key];\n if (typeof key === \"string\" && (typeof value === \"string\" || value instanceof Blob)) {\n formData.append(key, value);\n }\n })\n }\n `\n : undefined\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>\n {`\n return {\n fetcher: async () => {\n ${formData || ''}\n const res = await client<${client.generics}>({\n ${resolvedClientOptions}\n })\n\n ${returnRes}\n },\n }\n\n `}\n </Function>\n </File.Source>\n )\n}\n\nconst defaultTemplates = {\n default: Template,\n} as const\n\ntype Props = {\n factory: {\n name: string\n }\n dataReturnType: NonNullable<PluginSwr['options']['dataReturnType']>\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<TemplateProps>\n}\n\nexport function QueryOptions({ factory, dataReturnType, Template = defaultTemplates.default }: Props): ReactNode {\n const {\n pluginManager,\n plugin: {\n key: pluginKey,\n options: { parser },\n },\n } = useApp<PluginSwr>()\n const { getSchemas } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })\n const zodSchemas = getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' })\n const name = pluginManager.resolveName({\n name: `${factory.name}QueryOptions`,\n pluginKey,\n })\n const contentType = operation.getContentType()\n\n const generics = new FunctionParams()\n const params = new FunctionParams()\n\n const clientGenerics = ['TData', `${factory.name}['error']`]\n const resultGenerics = ['TData', `${factory.name}['error']`]\n\n generics.add([{ type: 'TData', default: `${factory.name}['response']` }])\n\n params.add([\n ...getASTParams(schemas.pathParams, { typed: true }),\n {\n name: 'params',\n type: `${factory.name}['queryParams']`,\n enabled: !!schemas.queryParams?.name,\n required: false,\n },\n {\n name: 'headers',\n type: `${factory.name}['headerParams']`,\n enabled: !!schemas.headerParams?.name,\n required: false,\n },\n {\n name: 'options',\n type: `${factory.name}['client']['parameters']`,\n default: '{}',\n },\n ])\n\n const client = {\n withQueryParams: !!schemas.queryParams?.name,\n withData: !!schemas.request?.name,\n withPathParams: !!schemas.pathParams?.name,\n withHeaders: !!schemas.headerParams?.name,\n method: operation.method,\n path: new URLPath(operation.path),\n generics: clientGenerics.join(', '),\n contentType,\n }\n\n return (\n <Template\n name={name}\n params={params.toString()}\n generics={generics.toString()}\n returnType={`SWRConfiguration<${resultGenerics.join(', ')}>`}\n client={client}\n dataReturnType={dataReturnType}\n parser={parser === 'zod' ? `${zodSchemas.response.name}.parse` : undefined}\n />\n )\n}\n\nQueryOptions.templates = defaultTemplates\n"],"mappings":";AAAA,OAAO,kBAAkB;AACzB,SAAS,gBAAgB,eAAe;AACxC,SAAS,QAAAA,OAAM,UAAU,UAAAC,eAAc;AACvC,SAAS,gBAAAC,qBAAoB;AAC7B,SAAS,gBAAAC,eAAc,uBAAAC,4BAA2B;AAClD,SAAS,cAAc,mBAAmB;;;ACL1C,SAAS,MAAM,MAAM,cAAc;AAEnC,SAAS,cAAc,2BAA2B;AAClD,SAAS,oBAAoB;AAkCzB,mBAEI,KAFJ;AAxBG,SAAS,WAAW,EAAE,QAAQ,GAAqB;AACxD,QAAM;AAAA,IACJ,QAAQ;AAAA,MACN,SAAS,EAAE,eAAe;AAAA,IAC5B;AAAA,EACF,IAAI,OAAkB;AACtB,QAAM,EAAE,WAAW,IAAI,oBAAoB;AAC3C,QAAM,YAAY,aAAa;AAE/B,QAAM,UAAU,WAAW,WAAW,EAAE,WAAW,CAAC,YAAY,GAAG,MAAM,OAAO,CAAC;AAEjF,QAAM,CAAC,OAAO,QAAQ,UAAU,aAAa,cAAc,eAAe,SAAS,IAAI;AAAA,IACrF,QAAQ,SAAS;AAAA,IACjB,QAAQ,QAAQ,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,KAAK,KAAK,KAAK;AAAA,IACxD,QAAQ,SAAS,QAAQ;AAAA,IACzB,QAAQ,YAAY,QAAQ;AAAA,IAC5B,QAAQ,aAAa,QAAQ;AAAA,IAC7B,QAAQ,cAAc,QAAQ;AAAA,IAC9B,QAAQ,SAAS;AAAA,EACnB;AAEA,QAAM,aAAa,GAAG,QAAQ,IAAI;AAElC,SACE,iCACE;AAAA,wBAAC,KAAK,QAAL,EAAY,MAAM,YAAY,YAAU,MACvC,8BAAC,QAAK,MAAM,YAAa,2BAAiB,SAAS,KAAK,MAAM,KAAK,QAAQ,KAA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AAAH;AAAA,MAACG,MAAK;AAAA,MAAL;AAAA,QACC,MAAM;AAAA,UACJ,QAAQ,SAAS;AAAA,UACjB,QAAQ,SAAS;AAAA,UACjB,QAAQ,YAAY;AAAA,UACpB,QAAQ,aAAa;AAAA,UACrB,QAAQ,cAAc;AAAA,UACtB,GAAI,QAAQ,aAAa,IAAI,CAAC,SAAS,KAAK,IAAI,KAAK,CAAC;AAAA,QACxD,EAAE,OAAO,OAAO;AAAA,QAChB,MAAM,KAAK;AAAA,QACX,MAAM,SAAS;AAAA,QACf,YAAU;AAAA;AAAA,IACZ;AAAA,IAEA,gBAAAH,KAAC,cAAW,SAAkB;AAAA,IAC9B,gBAAAA,KAAC,SAAM,SAAkB,UAAUE,WAAU,sBAA4C;AAAA,KAC3F;AAEJ;AAEA,MAAM,YAAYG;","names":["File","useApp","pluginTsName","useOperation","useOperationManager","jsx","jsxs","File","Template","useApp","useOperationManager","useOperation","pluginTsName","FunctionParams","URLPath","useOperation","useOperationManager","getASTParams","getComments","pluginTsName","pluginZodName","File","Function","useApp","transformers","FunctionParams","URLPath","useOperation","useOperationManager","getASTParams","Function","File","useApp","pluginTsName","jsx","Template","defaultTemplates","Fragment","jsx","jsxs","Template","File","Function","defaultTemplates","useApp","useOperation","useOperationManager","pluginTsName","pluginZodName","FunctionParams","URLPath","getASTParams","getComments"]}
|