@kubb/plugin-client 4.8.1 → 4.9.0
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/{Operations-CWBBycN7.js → Operations-B6I1tCOx.js} +117 -3
- package/dist/Operations-B6I1tCOx.js.map +1 -0
- package/dist/{Operations-gqLBimA6.cjs → Operations-BVIrtQ0H.cjs} +121 -1
- package/dist/Operations-BVIrtQ0H.cjs.map +1 -0
- package/dist/components.cjs +2 -1
- package/dist/components.d.cts +53 -2
- package/dist/components.d.ts +53 -2
- package/dist/components.js +2 -2
- package/dist/generators-CsFgdAtO.js +424 -0
- package/dist/generators-CsFgdAtO.js.map +1 -0
- package/dist/{generators-BDkH5Y4W.cjs → generators-dDr1GP7q.cjs} +198 -2
- package/dist/generators-dDr1GP7q.cjs.map +1 -0
- package/dist/generators.cjs +3 -2
- package/dist/generators.d.cts +5 -2
- package/dist/generators.d.ts +5 -2
- package/dist/generators.js +3 -3
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/{types-CRHoY-hv.d.ts → types-DDd1VM_Z.d.ts} +9 -1
- package/dist/{types-DxXfO6iR.d.cts → types-MSth0FPg.d.cts} +9 -1
- package/package.json +6 -6
- package/src/components/ClassClient.tsx +235 -0
- package/src/components/index.ts +1 -0
- package/src/generators/__snapshots__/Pet.ts +186 -0
- package/src/generators/__snapshots__/Store.ts +109 -0
- package/src/generators/__snapshots__/User.ts +147 -0
- package/src/generators/classClientGenerator.tsx +231 -0
- package/src/generators/index.ts +1 -0
- package/src/plugin.ts +10 -2
- package/src/types.ts +8 -0
- package/dist/Operations-CWBBycN7.js.map +0 -1
- package/dist/Operations-gqLBimA6.cjs.map +0 -1
- package/dist/generators-BDkH5Y4W.cjs.map +0 -1
- package/dist/generators-CJTPFQ2P.js +0 -234
- package/dist/generators-CJTPFQ2P.js.map +0 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { i as Url, n as ClassClient, r as Client, t as Operations } from "./Operations-B6I1tCOx.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
4
|
+
import { pluginZodName } from "@kubb/plugin-zod";
|
|
5
|
+
import { usePluginManager } from "@kubb/core/hooks";
|
|
6
|
+
import { createReactGenerator } from "@kubb/plugin-oas/generators";
|
|
7
|
+
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
8
|
+
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
9
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
10
|
+
import { File, Function } from "@kubb/react-fabric";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
//#region src/generators/classClientGenerator.tsx
|
|
14
|
+
const classClientGenerator = createReactGenerator({
|
|
15
|
+
name: "classClient",
|
|
16
|
+
Operations({ operations, generator, plugin, config }) {
|
|
17
|
+
const { options, key: pluginKey } = plugin;
|
|
18
|
+
const pluginManager = usePluginManager();
|
|
19
|
+
const oas = useOas();
|
|
20
|
+
const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator);
|
|
21
|
+
function buildOperationData(operation) {
|
|
22
|
+
const type = {
|
|
23
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
24
|
+
schemas: getSchemas(operation, {
|
|
25
|
+
pluginKey: [pluginTsName],
|
|
26
|
+
type: "type"
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
const zod = {
|
|
30
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
31
|
+
schemas: getSchemas(operation, {
|
|
32
|
+
pluginKey: [pluginZodName],
|
|
33
|
+
type: "function"
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
operation,
|
|
38
|
+
name: getName(operation, { type: "function" }),
|
|
39
|
+
typeSchemas: type.schemas,
|
|
40
|
+
zodSchemas: zod.schemas,
|
|
41
|
+
typeFile: type.file,
|
|
42
|
+
zodFile: zod.file
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const controllers = operations.reduce((acc, operation) => {
|
|
46
|
+
const group = getGroup(operation);
|
|
47
|
+
const groupName = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag) : "Client";
|
|
48
|
+
if (!group?.tag && !options.group) {
|
|
49
|
+
const name = "ApiClient";
|
|
50
|
+
const file = pluginManager.getFile({
|
|
51
|
+
name,
|
|
52
|
+
extname: ".ts",
|
|
53
|
+
pluginKey
|
|
54
|
+
});
|
|
55
|
+
const operationData = buildOperationData(operation);
|
|
56
|
+
const previousFile = acc.find((item) => item.file.path === file.path);
|
|
57
|
+
if (previousFile) previousFile.operations.push(operationData);
|
|
58
|
+
else acc.push({
|
|
59
|
+
name,
|
|
60
|
+
file,
|
|
61
|
+
operations: [operationData]
|
|
62
|
+
});
|
|
63
|
+
} else if (group?.tag) {
|
|
64
|
+
const name = groupName;
|
|
65
|
+
const file = pluginManager.getFile({
|
|
66
|
+
name,
|
|
67
|
+
extname: ".ts",
|
|
68
|
+
pluginKey,
|
|
69
|
+
options: { group }
|
|
70
|
+
});
|
|
71
|
+
const operationData = buildOperationData(operation);
|
|
72
|
+
const previousFile = acc.find((item) => item.file.path === file.path);
|
|
73
|
+
if (previousFile) previousFile.operations.push(operationData);
|
|
74
|
+
else acc.push({
|
|
75
|
+
name,
|
|
76
|
+
file,
|
|
77
|
+
operations: [operationData]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return acc;
|
|
81
|
+
}, []);
|
|
82
|
+
function collectTypeImports(ops) {
|
|
83
|
+
const typeImportsByFile = /* @__PURE__ */ new Map();
|
|
84
|
+
const typeFilesByPath = /* @__PURE__ */ new Map();
|
|
85
|
+
ops.forEach((op) => {
|
|
86
|
+
const { typeSchemas, typeFile } = op;
|
|
87
|
+
if (!typeImportsByFile.has(typeFile.path)) typeImportsByFile.set(typeFile.path, /* @__PURE__ */ new Set());
|
|
88
|
+
const typeImports = typeImportsByFile.get(typeFile.path);
|
|
89
|
+
if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name);
|
|
90
|
+
if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name);
|
|
91
|
+
if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name);
|
|
92
|
+
if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name);
|
|
93
|
+
if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name);
|
|
94
|
+
typeSchemas.statusCodes?.forEach((item) => {
|
|
95
|
+
if (item?.name) typeImports.add(item.name);
|
|
96
|
+
});
|
|
97
|
+
typeFilesByPath.set(typeFile.path, typeFile);
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
typeImportsByFile,
|
|
101
|
+
typeFilesByPath
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function collectZodImports(ops) {
|
|
105
|
+
const zodImportsByFile = /* @__PURE__ */ new Map();
|
|
106
|
+
const zodFilesByPath = /* @__PURE__ */ new Map();
|
|
107
|
+
ops.forEach((op) => {
|
|
108
|
+
const { zodSchemas, zodFile } = op;
|
|
109
|
+
if (!zodImportsByFile.has(zodFile.path)) zodImportsByFile.set(zodFile.path, /* @__PURE__ */ new Set());
|
|
110
|
+
const zodImports = zodImportsByFile.get(zodFile.path);
|
|
111
|
+
if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name);
|
|
112
|
+
if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name);
|
|
113
|
+
zodFilesByPath.set(zodFile.path, zodFile);
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
zodImportsByFile,
|
|
117
|
+
zodFilesByPath
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return controllers.map(({ name, file, operations: ops }) => {
|
|
121
|
+
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops);
|
|
122
|
+
const { zodImportsByFile, zodFilesByPath } = options.parser === "zod" ? collectZodImports(ops) : {
|
|
123
|
+
zodImportsByFile: /* @__PURE__ */ new Map(),
|
|
124
|
+
zodFilesByPath: /* @__PURE__ */ new Map()
|
|
125
|
+
};
|
|
126
|
+
const hasFormData = ops.some((op) => op.operation.getContentType() === "multipart/form-data");
|
|
127
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
128
|
+
baseName: file.baseName,
|
|
129
|
+
path: file.path,
|
|
130
|
+
meta: file.meta,
|
|
131
|
+
banner: getBanner({
|
|
132
|
+
oas,
|
|
133
|
+
output: options.output,
|
|
134
|
+
config: pluginManager.config
|
|
135
|
+
}),
|
|
136
|
+
footer: getFooter({
|
|
137
|
+
oas,
|
|
138
|
+
output: options.output
|
|
139
|
+
}),
|
|
140
|
+
children: [
|
|
141
|
+
options.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
142
|
+
name: "fetch",
|
|
143
|
+
path: options.importPath
|
|
144
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
145
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
146
|
+
path: options.importPath,
|
|
147
|
+
isTypeOnly: true
|
|
148
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
149
|
+
name: ["fetch"],
|
|
150
|
+
root: file.path,
|
|
151
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
152
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
153
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
154
|
+
root: file.path,
|
|
155
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
156
|
+
isTypeOnly: true
|
|
157
|
+
})] }),
|
|
158
|
+
hasFormData && /* @__PURE__ */ jsx(File.Import, {
|
|
159
|
+
name: ["buildFormData"],
|
|
160
|
+
root: file.path,
|
|
161
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
162
|
+
}),
|
|
163
|
+
Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {
|
|
164
|
+
const typeFile = typeFilesByPath.get(filePath);
|
|
165
|
+
if (!typeFile) return null;
|
|
166
|
+
const importNames = Array.from(imports).filter(Boolean);
|
|
167
|
+
if (importNames.length === 0) return null;
|
|
168
|
+
return /* @__PURE__ */ jsx(File.Import, {
|
|
169
|
+
name: importNames,
|
|
170
|
+
root: file.path,
|
|
171
|
+
path: typeFile.path,
|
|
172
|
+
isTypeOnly: true
|
|
173
|
+
}, filePath);
|
|
174
|
+
}),
|
|
175
|
+
options.parser === "zod" && Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {
|
|
176
|
+
const zodFile = zodFilesByPath.get(filePath);
|
|
177
|
+
if (!zodFile) return null;
|
|
178
|
+
const importNames = Array.from(imports).filter(Boolean);
|
|
179
|
+
if (importNames.length === 0) return null;
|
|
180
|
+
return /* @__PURE__ */ jsx(File.Import, {
|
|
181
|
+
name: importNames,
|
|
182
|
+
root: file.path,
|
|
183
|
+
path: zodFile.path
|
|
184
|
+
}, filePath);
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsx(ClassClient, {
|
|
187
|
+
name,
|
|
188
|
+
operations: ops,
|
|
189
|
+
baseURL: options.baseURL,
|
|
190
|
+
dataReturnType: options.dataReturnType,
|
|
191
|
+
pathParamsType: options.pathParamsType,
|
|
192
|
+
paramsCasing: options.paramsCasing,
|
|
193
|
+
paramsType: options.paramsType,
|
|
194
|
+
parser: options.parser
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
}, file.path);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/generators/clientGenerator.tsx
|
|
204
|
+
const clientGenerator = createReactGenerator({
|
|
205
|
+
name: "client",
|
|
206
|
+
Operation({ config, plugin, operation, generator }) {
|
|
207
|
+
const pluginManager = usePluginManager();
|
|
208
|
+
const { options, options: { output, urlType } } = plugin;
|
|
209
|
+
const oas = useOas();
|
|
210
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
211
|
+
const client = {
|
|
212
|
+
name: getName(operation, { type: "function" }),
|
|
213
|
+
file: getFile(operation)
|
|
214
|
+
};
|
|
215
|
+
const url = {
|
|
216
|
+
name: getName(operation, {
|
|
217
|
+
type: "function",
|
|
218
|
+
suffix: "url",
|
|
219
|
+
prefix: "get"
|
|
220
|
+
}),
|
|
221
|
+
file: getFile(operation)
|
|
222
|
+
};
|
|
223
|
+
const type = {
|
|
224
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
225
|
+
schemas: getSchemas(operation, {
|
|
226
|
+
pluginKey: [pluginTsName],
|
|
227
|
+
type: "type"
|
|
228
|
+
})
|
|
229
|
+
};
|
|
230
|
+
const zod = {
|
|
231
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
232
|
+
schemas: getSchemas(operation, {
|
|
233
|
+
pluginKey: [pluginZodName],
|
|
234
|
+
type: "function"
|
|
235
|
+
})
|
|
236
|
+
};
|
|
237
|
+
const isFormData = operation.getContentType() === "multipart/form-data";
|
|
238
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
239
|
+
baseName: client.file.baseName,
|
|
240
|
+
path: client.file.path,
|
|
241
|
+
meta: client.file.meta,
|
|
242
|
+
banner: getBanner({
|
|
243
|
+
oas,
|
|
244
|
+
output,
|
|
245
|
+
config: pluginManager.config
|
|
246
|
+
}),
|
|
247
|
+
footer: getFooter({
|
|
248
|
+
oas,
|
|
249
|
+
output
|
|
250
|
+
}),
|
|
251
|
+
children: [
|
|
252
|
+
options.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
253
|
+
name: "fetch",
|
|
254
|
+
path: options.importPath
|
|
255
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
256
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
257
|
+
path: options.importPath,
|
|
258
|
+
isTypeOnly: true
|
|
259
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
260
|
+
name: ["fetch"],
|
|
261
|
+
root: client.file.path,
|
|
262
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
263
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
264
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
265
|
+
root: client.file.path,
|
|
266
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
267
|
+
isTypeOnly: true
|
|
268
|
+
})] }),
|
|
269
|
+
isFormData && type.schemas.request?.name && /* @__PURE__ */ jsx(File.Import, {
|
|
270
|
+
name: ["buildFormData"],
|
|
271
|
+
root: client.file.path,
|
|
272
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
273
|
+
}),
|
|
274
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
275
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
276
|
+
root: client.file.path,
|
|
277
|
+
path: zod.file.path
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
280
|
+
name: [
|
|
281
|
+
type.schemas.request?.name,
|
|
282
|
+
type.schemas.response.name,
|
|
283
|
+
type.schemas.pathParams?.name,
|
|
284
|
+
type.schemas.queryParams?.name,
|
|
285
|
+
type.schemas.headerParams?.name,
|
|
286
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
287
|
+
].filter(Boolean),
|
|
288
|
+
root: client.file.path,
|
|
289
|
+
path: type.file.path,
|
|
290
|
+
isTypeOnly: true
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ jsx(Url, {
|
|
293
|
+
name: url.name,
|
|
294
|
+
baseURL: options.baseURL,
|
|
295
|
+
pathParamsType: options.pathParamsType,
|
|
296
|
+
paramsCasing: options.paramsCasing,
|
|
297
|
+
paramsType: options.paramsType,
|
|
298
|
+
typeSchemas: type.schemas,
|
|
299
|
+
operation,
|
|
300
|
+
isIndexable: urlType === "export",
|
|
301
|
+
isExportable: urlType === "export"
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ jsx(Client, {
|
|
304
|
+
name: client.name,
|
|
305
|
+
urlName: url.name,
|
|
306
|
+
baseURL: options.baseURL,
|
|
307
|
+
dataReturnType: options.dataReturnType,
|
|
308
|
+
pathParamsType: options.pathParamsType,
|
|
309
|
+
paramsCasing: options.paramsCasing,
|
|
310
|
+
paramsType: options.paramsType,
|
|
311
|
+
typeSchemas: type.schemas,
|
|
312
|
+
operation,
|
|
313
|
+
parser: options.parser,
|
|
314
|
+
zodSchemas: zod.schemas
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/generators/groupedClientGenerator.tsx
|
|
323
|
+
const groupedClientGenerator = createReactGenerator({
|
|
324
|
+
name: "groupedClient",
|
|
325
|
+
Operations({ operations, generator, plugin }) {
|
|
326
|
+
const { options, key: pluginKey } = plugin;
|
|
327
|
+
const pluginManager = usePluginManager();
|
|
328
|
+
const oas = useOas();
|
|
329
|
+
const { getName, getFile, getGroup } = useOperationManager(generator);
|
|
330
|
+
return operations.reduce((acc, operation) => {
|
|
331
|
+
if (options.group?.type === "tag") {
|
|
332
|
+
const group = getGroup(operation);
|
|
333
|
+
const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : void 0;
|
|
334
|
+
if (!group?.tag || !name) return acc;
|
|
335
|
+
const file = pluginManager.getFile({
|
|
336
|
+
name,
|
|
337
|
+
extname: ".ts",
|
|
338
|
+
pluginKey,
|
|
339
|
+
options: { group }
|
|
340
|
+
});
|
|
341
|
+
const client = {
|
|
342
|
+
name: getName(operation, { type: "function" }),
|
|
343
|
+
file: getFile(operation)
|
|
344
|
+
};
|
|
345
|
+
const previousFile = acc.find((item) => item.file.path === file.path);
|
|
346
|
+
if (previousFile) previousFile.clients.push(client);
|
|
347
|
+
else acc.push({
|
|
348
|
+
name,
|
|
349
|
+
file,
|
|
350
|
+
clients: [client]
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
return acc;
|
|
354
|
+
}, []).map(({ name, file, clients }) => {
|
|
355
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
356
|
+
baseName: file.baseName,
|
|
357
|
+
path: file.path,
|
|
358
|
+
meta: file.meta,
|
|
359
|
+
banner: getBanner({
|
|
360
|
+
oas,
|
|
361
|
+
output: options.output,
|
|
362
|
+
config: pluginManager.config
|
|
363
|
+
}),
|
|
364
|
+
footer: getFooter({
|
|
365
|
+
oas,
|
|
366
|
+
output: options.output
|
|
367
|
+
}),
|
|
368
|
+
children: [clients.map((client) => /* @__PURE__ */ jsx(File.Import, {
|
|
369
|
+
name: [client.name],
|
|
370
|
+
root: file.path,
|
|
371
|
+
path: client.file.path
|
|
372
|
+
}, client.name)), /* @__PURE__ */ jsx(File.Source, {
|
|
373
|
+
name,
|
|
374
|
+
isExportable: true,
|
|
375
|
+
isIndexable: true,
|
|
376
|
+
children: /* @__PURE__ */ jsx(Function, {
|
|
377
|
+
export: true,
|
|
378
|
+
name,
|
|
379
|
+
children: `return { ${clients.map((client) => client.name).join(", ")} }`
|
|
380
|
+
})
|
|
381
|
+
})]
|
|
382
|
+
}, file.path);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/generators/operationsGenerator.tsx
|
|
389
|
+
const operationsGenerator = createReactGenerator({
|
|
390
|
+
name: "client",
|
|
391
|
+
Operations({ operations, plugin }) {
|
|
392
|
+
const { key: pluginKey, options: { output } } = plugin;
|
|
393
|
+
const pluginManager = usePluginManager();
|
|
394
|
+
const oas = useOas();
|
|
395
|
+
const name = "operations";
|
|
396
|
+
const file = pluginManager.getFile({
|
|
397
|
+
name,
|
|
398
|
+
extname: ".ts",
|
|
399
|
+
pluginKey
|
|
400
|
+
});
|
|
401
|
+
return /* @__PURE__ */ jsx(File, {
|
|
402
|
+
baseName: file.baseName,
|
|
403
|
+
path: file.path,
|
|
404
|
+
meta: file.meta,
|
|
405
|
+
banner: getBanner({
|
|
406
|
+
oas,
|
|
407
|
+
output,
|
|
408
|
+
config: pluginManager.config
|
|
409
|
+
}),
|
|
410
|
+
footer: getFooter({
|
|
411
|
+
oas,
|
|
412
|
+
output
|
|
413
|
+
}),
|
|
414
|
+
children: /* @__PURE__ */ jsx(Operations, {
|
|
415
|
+
name,
|
|
416
|
+
operations
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
//#endregion
|
|
423
|
+
export { classClientGenerator as i, groupedClientGenerator as n, clientGenerator as r, operationsGenerator as t };
|
|
424
|
+
//# sourceMappingURL=generators-CsFgdAtO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-CsFgdAtO.js","names":[],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { ClassClient } from '../components/ClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const classClientGenerator = createReactGenerator<PluginClient>({\n name: 'classClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={client.file.path} path={zod.file.path} />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;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