@kubb/plugin-ts 5.0.0-alpha.1 → 5.0.0-alpha.10

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.
Files changed (41) hide show
  1. package/dist/{components-LmqJfxMv.js → components-CRu8IKY3.js} +19 -11
  2. package/dist/components-CRu8IKY3.js.map +1 -0
  3. package/dist/{components-9wydyqUx.cjs → components-DeNDKlzf.cjs} +144 -10
  4. package/dist/components-DeNDKlzf.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +1 -3
  7. package/dist/components.js +1 -1
  8. package/dist/generators.cjs +3 -2
  9. package/dist/generators.d.ts +60 -48
  10. package/dist/generators.js +2 -2
  11. package/dist/index.cjs +2 -1
  12. package/dist/index.d.ts +41 -2
  13. package/dist/index.js +2 -2
  14. package/dist/plugin-BZkBwnEA.js +1269 -0
  15. package/dist/plugin-BZkBwnEA.js.map +1 -0
  16. package/dist/plugin-Bunz1oGa.cjs +1322 -0
  17. package/dist/plugin-Bunz1oGa.cjs.map +1 -0
  18. package/dist/types-mSXmB8WU.d.ts +298 -0
  19. package/package.json +8 -8
  20. package/src/components/Type.tsx +0 -3
  21. package/src/components/v2/Enum.tsx +67 -0
  22. package/src/components/v2/Type.tsx +59 -0
  23. package/src/constants.ts +29 -0
  24. package/src/factory.ts +14 -16
  25. package/src/generators/index.ts +1 -0
  26. package/src/generators/typeGenerator.tsx +46 -48
  27. package/src/generators/v2/typeGenerator.tsx +167 -0
  28. package/src/generators/v2/utils.ts +140 -0
  29. package/src/index.ts +1 -0
  30. package/src/parser.ts +1 -8
  31. package/src/plugin.ts +64 -17
  32. package/src/printer.ts +238 -91
  33. package/src/resolverTs.ts +77 -0
  34. package/src/types.ts +144 -15
  35. package/dist/components-9wydyqUx.cjs.map +0 -1
  36. package/dist/components-LmqJfxMv.js.map +0 -1
  37. package/dist/plugin-BHE4J4aP.cjs +0 -508
  38. package/dist/plugin-BHE4J4aP.cjs.map +0 -1
  39. package/dist/plugin-DnKRpgGK.js +0 -476
  40. package/dist/plugin-DnKRpgGK.js.map +0 -1
  41. package/dist/types-BpeKGgCn.d.ts +0 -170
@@ -1,508 +0,0 @@
1
- const require_components = require("./components-9wydyqUx.cjs");
2
- let node_path = require("node:path");
3
- node_path = require_components.__toESM(node_path);
4
- let _kubb_ast = require("@kubb/ast");
5
- let _kubb_core = require("@kubb/core");
6
- let _kubb_plugin_oas = require("@kubb/plugin-oas");
7
- let _kubb_core_hooks = require("@kubb/core/hooks");
8
- let _kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
9
- let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
10
- let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
11
- let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
12
- let _kubb_react_fabric = require("@kubb/react-fabric");
13
- let typescript = require("typescript");
14
- typescript = require_components.__toESM(typescript);
15
- let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
16
- //#region src/generators/typeGenerator.tsx
17
- function printCombinedSchema({ name, schemas, pluginManager }) {
18
- const properties = {};
19
- if (schemas.response) properties["response"] = require_components.createUnionDeclaration({ nodes: schemas.responses.map((res) => {
20
- const identifier = pluginManager.resolveName({
21
- name: res.name,
22
- pluginKey: [pluginTsName],
23
- type: "function"
24
- });
25
- return require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
26
- }) });
27
- if (schemas.request) {
28
- const identifier = pluginManager.resolveName({
29
- name: schemas.request.name,
30
- pluginKey: [pluginTsName],
31
- type: "function"
32
- });
33
- properties["request"] = require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
34
- }
35
- if (schemas.pathParams) {
36
- const identifier = pluginManager.resolveName({
37
- name: schemas.pathParams.name,
38
- pluginKey: [pluginTsName],
39
- type: "function"
40
- });
41
- properties["pathParams"] = require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
42
- }
43
- if (schemas.queryParams) {
44
- const identifier = pluginManager.resolveName({
45
- name: schemas.queryParams.name,
46
- pluginKey: [pluginTsName],
47
- type: "function"
48
- });
49
- properties["queryParams"] = require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
50
- }
51
- if (schemas.headerParams) {
52
- const identifier = pluginManager.resolveName({
53
- name: schemas.headerParams.name,
54
- pluginKey: [pluginTsName],
55
- type: "function"
56
- });
57
- properties["headerParams"] = require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
58
- }
59
- if (schemas.errors) properties["errors"] = require_components.createUnionDeclaration({ nodes: schemas.errors.map((error) => {
60
- const identifier = pluginManager.resolveName({
61
- name: error.name,
62
- pluginKey: [pluginTsName],
63
- type: "function"
64
- });
65
- return require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
66
- }) });
67
- return (0, _kubb_fabric_core_parsers_typescript.safePrint)(require_components.createTypeAliasDeclaration({
68
- name,
69
- type: require_components.createTypeLiteralNode(Object.keys(properties).map((key) => {
70
- const type = properties[key];
71
- if (!type) return;
72
- return require_components.createPropertySignature({
73
- name: require_components.pascalCase(key),
74
- type
75
- });
76
- }).filter(Boolean)),
77
- modifiers: [require_components.modifiers.export]
78
- }));
79
- }
80
- function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
81
- const name = pluginManager.resolveName({
82
- name: `${baseName} Request`,
83
- pluginKey: [pluginTsName],
84
- type: "type"
85
- });
86
- const results = [];
87
- const dataRequestProperties = [];
88
- if (schemas.request) {
89
- const identifier = pluginManager.resolveName({
90
- name: schemas.request.name,
91
- pluginKey: [pluginTsName],
92
- type: "type"
93
- });
94
- dataRequestProperties.push(require_components.createPropertySignature({
95
- name: "data",
96
- questionToken: true,
97
- type: require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0)
98
- }));
99
- } else dataRequestProperties.push(require_components.createPropertySignature({
100
- name: "data",
101
- questionToken: true,
102
- type: require_components.keywordTypeNodes.never
103
- }));
104
- if (schemas.pathParams) {
105
- const identifier = pluginManager.resolveName({
106
- name: schemas.pathParams.name,
107
- pluginKey: [pluginTsName],
108
- type: "type"
109
- });
110
- dataRequestProperties.push(require_components.createPropertySignature({
111
- name: "pathParams",
112
- type: require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0)
113
- }));
114
- } else dataRequestProperties.push(require_components.createPropertySignature({
115
- name: "pathParams",
116
- questionToken: true,
117
- type: require_components.keywordTypeNodes.never
118
- }));
119
- if (schemas.queryParams) {
120
- const identifier = pluginManager.resolveName({
121
- name: schemas.queryParams.name,
122
- pluginKey: [pluginTsName],
123
- type: "type"
124
- });
125
- dataRequestProperties.push(require_components.createPropertySignature({
126
- name: "queryParams",
127
- questionToken: true,
128
- type: require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0)
129
- }));
130
- } else dataRequestProperties.push(require_components.createPropertySignature({
131
- name: "queryParams",
132
- questionToken: true,
133
- type: require_components.keywordTypeNodes.never
134
- }));
135
- if (schemas.headerParams) {
136
- const identifier = pluginManager.resolveName({
137
- name: schemas.headerParams.name,
138
- pluginKey: [pluginTsName],
139
- type: "type"
140
- });
141
- dataRequestProperties.push(require_components.createPropertySignature({
142
- name: "headerParams",
143
- questionToken: true,
144
- type: require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0)
145
- }));
146
- } else dataRequestProperties.push(require_components.createPropertySignature({
147
- name: "headerParams",
148
- questionToken: true,
149
- type: require_components.keywordTypeNodes.never
150
- }));
151
- dataRequestProperties.push(require_components.createPropertySignature({
152
- name: "url",
153
- type: require_components.createUrlTemplateType(operation.path)
154
- }));
155
- const dataRequestNode = require_components.createTypeAliasDeclaration({
156
- name,
157
- type: require_components.createTypeLiteralNode(dataRequestProperties),
158
- modifiers: [require_components.modifiers.export]
159
- });
160
- results.push((0, _kubb_fabric_core_parsers_typescript.safePrint)(dataRequestNode));
161
- return results.join("\n\n");
162
- }
163
- function printResponseSchema({ baseName, schemas, pluginManager, unknownType }) {
164
- const results = [];
165
- const name = pluginManager.resolveName({
166
- name: `${baseName} ResponseData`,
167
- pluginKey: [pluginTsName],
168
- type: "type"
169
- });
170
- if (schemas.responses && schemas.responses.length > 0) {
171
- const responsesProperties = schemas.responses.map((res) => {
172
- const identifier = pluginManager.resolveName({
173
- name: res.name,
174
- pluginKey: [pluginTsName],
175
- type: "type"
176
- });
177
- return require_components.createPropertySignature({
178
- name: res.statusCode?.toString() ?? "default",
179
- type: require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0)
180
- });
181
- });
182
- const responsesNode = require_components.createTypeAliasDeclaration({
183
- name: `${baseName}Responses`,
184
- type: require_components.createTypeLiteralNode(responsesProperties),
185
- modifiers: [require_components.modifiers.export]
186
- });
187
- results.push((0, _kubb_fabric_core_parsers_typescript.safePrint)(responsesNode));
188
- const responseNode = require_components.createTypeAliasDeclaration({
189
- name,
190
- type: require_components.createIndexedAccessTypeNode(require_components.createTypeReferenceNode(require_components.createIdentifier(`${baseName}Responses`), void 0), require_components.createTypeOperatorNode(typescript.default.SyntaxKind.KeyOfKeyword, require_components.createTypeReferenceNode(require_components.createIdentifier(`${baseName}Responses`), void 0))),
191
- modifiers: [require_components.modifiers.export]
192
- });
193
- results.push((0, _kubb_fabric_core_parsers_typescript.safePrint)(responseNode));
194
- } else {
195
- const responseNode = require_components.createTypeAliasDeclaration({
196
- name,
197
- modifiers: [require_components.modifiers.export],
198
- type: require_components.getUnknownType(unknownType)
199
- });
200
- results.push((0, _kubb_fabric_core_parsers_typescript.safePrint)(responseNode));
201
- }
202
- return results.join("\n\n");
203
- }
204
- const typeGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
205
- name: "typescript",
206
- version: "1",
207
- Operation({ operation, generator, plugin }) {
208
- const { options, options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
209
- const mode = (0, _kubb_core_hooks.useMode)();
210
- const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
211
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
212
- const { getSchemas, getFile, getName, getGroup } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
213
- const schemaManager = (0, _kubb_plugin_oas_hooks.useSchemaManager)();
214
- const name = getName(operation, {
215
- type: "type",
216
- pluginKey: [pluginTsName]
217
- });
218
- const file = getFile(operation);
219
- const schemas = getSchemas(operation);
220
- const schemaGenerator = new _kubb_plugin_oas.SchemaGenerator(options, {
221
- fabric: generator.context.fabric,
222
- oas,
223
- events: generator.context.events,
224
- plugin,
225
- pluginManager,
226
- mode,
227
- override: options.override
228
- });
229
- const operationSchemas = [
230
- schemas.pathParams,
231
- schemas.queryParams,
232
- schemas.headerParams,
233
- schemas.statusCodes,
234
- schemas.request,
235
- schemas.response
236
- ].flat().filter(Boolean);
237
- const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }) => {
238
- const transformedSchema = paramsCasing && (0, _kubb_plugin_oas_utils.isParameterSchema)(name) ? (0, _kubb_plugin_oas_utils.applyParamsCasing)(schema, paramsCasing) : schema;
239
- const tree = schemaGenerator.parse({
240
- schema: transformedSchema,
241
- name,
242
- parentName: null
243
- });
244
- const imports = (0, _kubb_plugin_oas_utils.getImports)(tree);
245
- const group = options.operation ? getGroup(options.operation) : void 0;
246
- const type = {
247
- name: schemaManager.getName(name, { type: "type" }),
248
- typedName: schemaManager.getName(name, { type: "type" }),
249
- file: schemaManager.getFile(options.operationName || name, { group })
250
- };
251
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
252
- root: file.path,
253
- path: imp.path,
254
- name: imp.name,
255
- isTypeOnly: true
256
- }, [
257
- name,
258
- imp.name,
259
- imp.path,
260
- imp.isTypeOnly
261
- ].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
262
- name: type.name,
263
- typedName: type.typedName,
264
- description,
265
- tree,
266
- schema: transformedSchema,
267
- mapper,
268
- enumType,
269
- enumKeyCasing,
270
- optionalType,
271
- arrayType,
272
- keysToOmit,
273
- syntaxType
274
- })] });
275
- };
276
- const responseName = schemaManager.getName(schemas.response.name, { type: "type" });
277
- const combinedSchemaName = operation.method === "get" ? `${name}Query` : `${name}Mutation`;
278
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
279
- baseName: file.baseName,
280
- path: file.path,
281
- meta: file.meta,
282
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
283
- oas,
284
- output: plugin.options.output,
285
- config: pluginManager.config
286
- }),
287
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
288
- oas,
289
- output: plugin.options.output
290
- }),
291
- children: [operationSchemas.map(mapOperationSchema), generator.context.UNSTABLE_NAMING ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
292
- name: `${name}Request`,
293
- isExportable: true,
294
- isIndexable: true,
295
- isTypeOnly: true,
296
- children: printRequestSchema({
297
- baseName: name,
298
- operation,
299
- schemas,
300
- pluginManager
301
- })
302
- }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
303
- name: responseName,
304
- isExportable: true,
305
- isIndexable: true,
306
- isTypeOnly: true,
307
- children: printResponseSchema({
308
- baseName: name,
309
- schemas,
310
- pluginManager,
311
- unknownType
312
- })
313
- })] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
314
- name: combinedSchemaName,
315
- isExportable: true,
316
- isIndexable: true,
317
- isTypeOnly: true,
318
- children: printCombinedSchema({
319
- name: combinedSchemaName,
320
- schemas,
321
- pluginManager
322
- })
323
- })]
324
- });
325
- },
326
- Schema({ schema, plugin }) {
327
- const { options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output } } = plugin;
328
- const mode = (0, _kubb_core_hooks.useMode)();
329
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
330
- const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
331
- const { getName, getFile } = (0, _kubb_plugin_oas_hooks.useSchemaManager)();
332
- const imports = (0, _kubb_plugin_oas_utils.getImports)(schema.tree);
333
- const schemaFromTree = schema.tree.find((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.schema);
334
- let typedName = getName(schema.name, { type: "type" });
335
- if (["asConst", "asPascalConst"].includes(enumType) && schemaFromTree && (0, _kubb_plugin_oas.isKeyword)(schemaFromTree, _kubb_plugin_oas.schemaKeywords.enum)) typedName = typedName += "Key";
336
- const type = {
337
- name: getName(schema.name, { type: "function" }),
338
- typedName,
339
- file: getFile(schema.name)
340
- };
341
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
342
- baseName: type.file.baseName,
343
- path: type.file.path,
344
- meta: type.file.meta,
345
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
346
- oas,
347
- output,
348
- config: pluginManager.config
349
- }),
350
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
351
- oas,
352
- output
353
- }),
354
- children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
355
- root: type.file.path,
356
- path: imp.path,
357
- name: imp.name,
358
- isTypeOnly: true
359
- }, [
360
- schema.name,
361
- imp.path,
362
- imp.isTypeOnly
363
- ].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
364
- name: type.name,
365
- typedName: type.typedName,
366
- description: schema.value.description,
367
- tree: schema.tree,
368
- schema: schema.value,
369
- mapper,
370
- enumType,
371
- enumKeyCasing,
372
- optionalType,
373
- arrayType,
374
- syntaxType
375
- })]
376
- });
377
- }
378
- });
379
- //#endregion
380
- //#region src/plugin.ts
381
- const pluginTsName = "plugin-ts";
382
- const pluginTs = (0, _kubb_core.definePlugin)((options) => {
383
- const { output = {
384
- path: "types",
385
- barrelType: "named"
386
- }, group, exclude = [], include, override = [], enumType = "asConst", enumKeyCasing = "none", enumSuffix = "enum", dateType = "string", integerType = "number", unknownType = "any", optionalType = "questionToken", arrayType = "array", emptySchemaType = unknownType, syntaxType = "type", transformers = {}, mapper = {}, paramsCasing, generators = [typeGenerator].filter(Boolean), contentType, UNSTABLE_NAMING } = options;
387
- return {
388
- name: pluginTsName,
389
- options: {
390
- output,
391
- transformers,
392
- dateType,
393
- integerType,
394
- optionalType,
395
- arrayType,
396
- enumType,
397
- enumKeyCasing,
398
- enumSuffix,
399
- unknownType,
400
- emptySchemaType,
401
- syntaxType,
402
- group,
403
- override,
404
- mapper,
405
- paramsCasing,
406
- usedEnumNames: {}
407
- },
408
- pre: [_kubb_plugin_oas.pluginOasName],
409
- resolvePath(baseName, pathMode, options) {
410
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
411
- if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
412
- /**
413
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
414
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
415
- */
416
- return node_path.default.resolve(root, output.path);
417
- if (group && (options?.group?.path || options?.group?.tag)) {
418
- const groupName = group?.name ? group.name : (ctx) => {
419
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
420
- return `${require_components.camelCase(ctx.group)}Controller`;
421
- };
422
- return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
423
- }
424
- return node_path.default.resolve(root, output.path, baseName);
425
- },
426
- resolveName(name, type) {
427
- const resolvedName = require_components.pascalCase(name, { isFile: type === "file" });
428
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
429
- return resolvedName;
430
- },
431
- async install() {
432
- const { config, fabric, plugin } = this;
433
- const root = node_path.default.resolve(config.root, config.output.path);
434
- const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
435
- if (this.rootNode) {
436
- await this.openInStudio({ ast: true });
437
- await (0, _kubb_ast.walk)(this.rootNode, { async schema(schemaNode) {
438
- await generators.map(async (generator) => {
439
- if (generator.type === "react" && generator.version === "2") await (0, _kubb_plugin_oas.buildSchema)(schemaNode, {
440
- config,
441
- fabric,
442
- Component: generator.Schema,
443
- plugin,
444
- version: generator.version
445
- });
446
- });
447
- } }, { depth: "shallow" });
448
- return;
449
- }
450
- const oas = await this.getOas();
451
- const schemaFiles = await new _kubb_plugin_oas.SchemaGenerator(this.plugin.options, {
452
- fabric: this.fabric,
453
- oas,
454
- pluginManager: this.pluginManager,
455
- events: this.events,
456
- plugin: this.plugin,
457
- contentType,
458
- include: void 0,
459
- override,
460
- mode,
461
- output: output.path
462
- }).build(...generators);
463
- await this.upsertFile(...schemaFiles);
464
- const operationFiles = await new _kubb_plugin_oas.OperationGenerator(this.plugin.options, {
465
- fabric: this.fabric,
466
- oas,
467
- pluginManager: this.pluginManager,
468
- events: this.events,
469
- plugin: this.plugin,
470
- contentType,
471
- exclude,
472
- include,
473
- override,
474
- mode,
475
- UNSTABLE_NAMING
476
- }).build(...generators);
477
- await this.upsertFile(...operationFiles);
478
- const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
479
- type: output.barrelType ?? "named",
480
- root,
481
- output,
482
- meta: { pluginKey: this.plugin.key }
483
- });
484
- await this.upsertFile(...barrelFiles);
485
- }
486
- };
487
- });
488
- //#endregion
489
- Object.defineProperty(exports, "pluginTs", {
490
- enumerable: true,
491
- get: function() {
492
- return pluginTs;
493
- }
494
- });
495
- Object.defineProperty(exports, "pluginTsName", {
496
- enumerable: true,
497
- get: function() {
498
- return pluginTsName;
499
- }
500
- });
501
- Object.defineProperty(exports, "typeGenerator", {
502
- enumerable: true,
503
- get: function() {
504
- return typeGenerator;
505
- }
506
- });
507
-
508
- //# sourceMappingURL=plugin-BHE4J4aP.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-BHE4J4aP.cjs","names":["pascalCase","keywordTypeNodes","createUrlTemplateType","ts","getUnknownType","SchemaGenerator","File","Type","schemaKeywords","pluginOasName","path","camelCase","pascalCase","SchemaGenerator","OperationGenerator"],"sources":["../src/generators/typeGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport type { PluginManager } from '@kubb/core'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { Operation } from '@kubb/oas'\nimport { isKeyword, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport ts from 'typescript'\nimport { Type } from '../components'\nimport * as factory from '../factory.ts'\nimport { createUrlTemplateType, getUnknownType, keywordTypeNodes } from '../factory.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types'\n\nfunction printCombinedSchema({ name, schemas, pluginManager }: { name: string; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createUnionDeclaration({\n nodes: schemas.responses.map((res) => {\n const identifier = pluginManager.resolveName({\n name: res.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = pluginManager.resolveName({\n name: error.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return safePrint(namespaceNode)\n}\n\nfunction printRequestSchema({\n baseName,\n operation,\n schemas,\n pluginManager,\n}: {\n baseName: string\n operation: Operation\n schemas: OperationSchemas\n pluginManager: PluginManager\n}): string {\n const name = pluginManager.resolveName({\n name: `${baseName} Request`,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const results: string[] = []\n\n // Generate DataRequest type\n const dataRequestProperties: ts.PropertySignature[] = []\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'data',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'data',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add pathParams property\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'pathParams',\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'pathParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add queryParams property\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'queryParams',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'queryParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add headerParams property\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'headerParams',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'headerParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add url property with template literal type\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'url',\n type: createUrlTemplateType(operation.path),\n }),\n )\n\n const dataRequestNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(dataRequestProperties),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(dataRequestNode))\n\n return results.join('\\n\\n')\n}\n\nfunction printResponseSchema({\n baseName,\n schemas,\n pluginManager,\n unknownType,\n}: {\n baseName: string\n schemas: OperationSchemas\n pluginManager: PluginManager\n unknownType: PluginTs['resolvedOptions']['unknownType']\n}): string {\n const results: string[] = []\n\n const name = pluginManager.resolveName({\n name: `${baseName} ResponseData`,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n // Generate Responses type (mapping status codes to response types)\n if (schemas.responses && schemas.responses.length > 0) {\n const responsesProperties: ts.PropertySignature[] = schemas.responses.map((res) => {\n const identifier = pluginManager.resolveName({\n name: res.name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n return factory.createPropertySignature({\n name: res.statusCode?.toString() ?? 'default',\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n })\n })\n\n const responsesNode = factory.createTypeAliasDeclaration({\n name: `${baseName}Responses`,\n type: factory.createTypeLiteralNode(responsesProperties),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(responsesNode))\n\n // Generate Response type (union via indexed access)\n const responseNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createIndexedAccessTypeNode(\n factory.createTypeReferenceNode(factory.createIdentifier(`${baseName}Responses`), undefined),\n factory.createTypeOperatorNode(\n ts.SyntaxKind.KeyOfKeyword,\n factory.createTypeReferenceNode(factory.createIdentifier(`${baseName}Responses`), undefined),\n ),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(responseNode))\n } else {\n const responseNode = factory.createTypeAliasDeclaration({\n name,\n modifiers: [factory.modifiers.export],\n type: getUnknownType(unknownType),\n })\n\n results.push(safePrint(responseNode))\n }\n\n return results.join('\\n\\n')\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs, '1'>({\n name: 'typescript',\n version: '1',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const name = getName(operation, { type: 'type', pluginKey: [pluginTsName] })\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n events: generator.context.events,\n plugin,\n pluginManager,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation to pathParams, queryParams, and headerParams (not response)\n const shouldTransform = paramsCasing && isParameterSchema(name)\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const type = {\n name: schemaManager.getName(name, { type: 'type' }),\n typedName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(options.operationName || name, { group }),\n }\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[name, imp.name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n schema={transformedSchema}\n mapper={mapper}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n keysToOmit={keysToOmit}\n syntaxType={syntaxType}\n />\n </>\n )\n }\n\n const responseName = schemaManager.getName(schemas.response.name, {\n type: 'type',\n })\n const combinedSchemaName = operation.method === 'get' ? `${name}Query` : `${name}Mutation`\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {operationSchemas.map(mapOperationSchema)}\n\n {generator.context.UNSTABLE_NAMING ? (\n <>\n <File.Source name={`${name}Request`} isExportable isIndexable isTypeOnly>\n {printRequestSchema({ baseName: name, operation, schemas, pluginManager })}\n </File.Source>\n <File.Source name={responseName} isExportable isIndexable isTypeOnly>\n {printResponseSchema({ baseName: name, schemas, pluginManager, unknownType })}\n </File.Source>\n </>\n ) : (\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}\n </File.Source>\n )}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const {\n options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output },\n } = plugin\n const mode = useMode()\n\n const oas = useOas()\n const pluginManager = usePluginManager()\n\n const { getName, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema)\n\n let typedName = getName(schema.name, { type: 'type' })\n\n if (['asConst', 'asPascalConst'].includes(enumType) && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) {\n typedName = typedName += 'Key' //Suffix for avoiding collisions (https://github.com/kubb-labs/kubb/issues/1873)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName,\n file: getFile(schema.name),\n }\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[schema.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { walk } from '@kubb/ast'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { buildSchema, OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { typeGenerator } from './generators'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = definePlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumKeyCasing = 'none',\n enumSuffix = 'enum',\n dateType = 'string',\n integerType = 'number',\n unknownType = 'any',\n optionalType = 'questionToken',\n arrayType = 'array',\n emptySchemaType = unknownType,\n syntaxType = 'type',\n transformers = {},\n mapper = {},\n paramsCasing,\n generators = [typeGenerator].filter(Boolean),\n contentType,\n UNSTABLE_NAMING,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n integerType,\n optionalType,\n arrayType,\n enumType,\n enumKeyCasing,\n enumSuffix,\n unknownType,\n emptySchemaType,\n syntaxType,\n group,\n override,\n mapper,\n paramsCasing,\n usedEnumNames,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const { config, fabric, plugin } = this\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n if (this.rootNode) {\n await this.openInStudio({ ast: true })\n\n await walk(\n this.rootNode,\n {\n async schema(schemaNode) {\n const writeTasks = generators.map(async (generator) => {\n if (generator.type === 'react' && generator.version === '2') {\n await buildSchema(schemaNode, {\n config,\n fabric,\n Component: generator.Schema,\n plugin,\n version: generator.version,\n })\n }\n })\n\n await writeTasks\n },\n },\n { depth: 'shallow' },\n )\n\n return\n }\n\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n UNSTABLE_NAMING,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;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