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

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.
@@ -1,476 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- import { a as createTypeAliasDeclaration, c as createTypeReferenceNode, d as getUnknownType, f as keywordTypeNodes, h as pascalCase, i as createPropertySignature, l as createUnionDeclaration, m as camelCase, n as createIdentifier, o as createTypeLiteralNode, p as modifiers, r as createIndexedAccessTypeNode, s as createTypeOperatorNode, t as Type, u as createUrlTemplateType } from "./components-LmqJfxMv.js";
3
- import path from "node:path";
4
- import { walk } from "@kubb/ast";
5
- import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
6
- import { OperationGenerator, SchemaGenerator, buildSchema, isKeyword, pluginOasName, schemaKeywords } from "@kubb/plugin-oas";
7
- import { useMode, usePluginManager } from "@kubb/core/hooks";
8
- import { safePrint } from "@kubb/fabric-core/parsers/typescript";
9
- import { createReactGenerator } from "@kubb/plugin-oas/generators";
10
- import { useOas, useOperationManager, useSchemaManager } from "@kubb/plugin-oas/hooks";
11
- import { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from "@kubb/plugin-oas/utils";
12
- import { File } from "@kubb/react-fabric";
13
- import ts from "typescript";
14
- import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
15
- //#region src/generators/typeGenerator.tsx
16
- function printCombinedSchema({ name, schemas, pluginManager }) {
17
- const properties = {};
18
- if (schemas.response) properties["response"] = createUnionDeclaration({ nodes: schemas.responses.map((res) => {
19
- return createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
20
- name: res.name,
21
- pluginKey: [pluginTsName],
22
- type: "function"
23
- })), void 0);
24
- }) });
25
- if (schemas.request) properties["request"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
26
- name: schemas.request.name,
27
- pluginKey: [pluginTsName],
28
- type: "function"
29
- })), void 0);
30
- if (schemas.pathParams) properties["pathParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
31
- name: schemas.pathParams.name,
32
- pluginKey: [pluginTsName],
33
- type: "function"
34
- })), void 0);
35
- if (schemas.queryParams) properties["queryParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
36
- name: schemas.queryParams.name,
37
- pluginKey: [pluginTsName],
38
- type: "function"
39
- })), void 0);
40
- if (schemas.headerParams) properties["headerParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
41
- name: schemas.headerParams.name,
42
- pluginKey: [pluginTsName],
43
- type: "function"
44
- })), void 0);
45
- if (schemas.errors) properties["errors"] = createUnionDeclaration({ nodes: schemas.errors.map((error) => {
46
- return createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
47
- name: error.name,
48
- pluginKey: [pluginTsName],
49
- type: "function"
50
- })), void 0);
51
- }) });
52
- return safePrint(createTypeAliasDeclaration({
53
- name,
54
- type: createTypeLiteralNode(Object.keys(properties).map((key) => {
55
- const type = properties[key];
56
- if (!type) return;
57
- return createPropertySignature({
58
- name: pascalCase(key),
59
- type
60
- });
61
- }).filter(Boolean)),
62
- modifiers: [modifiers.export]
63
- }));
64
- }
65
- function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
66
- const name = pluginManager.resolveName({
67
- name: `${baseName} Request`,
68
- pluginKey: [pluginTsName],
69
- type: "type"
70
- });
71
- const results = [];
72
- const dataRequestProperties = [];
73
- if (schemas.request) {
74
- const identifier = pluginManager.resolveName({
75
- name: schemas.request.name,
76
- pluginKey: [pluginTsName],
77
- type: "type"
78
- });
79
- dataRequestProperties.push(createPropertySignature({
80
- name: "data",
81
- questionToken: true,
82
- type: createTypeReferenceNode(createIdentifier(identifier), void 0)
83
- }));
84
- } else dataRequestProperties.push(createPropertySignature({
85
- name: "data",
86
- questionToken: true,
87
- type: keywordTypeNodes.never
88
- }));
89
- if (schemas.pathParams) {
90
- const identifier = pluginManager.resolveName({
91
- name: schemas.pathParams.name,
92
- pluginKey: [pluginTsName],
93
- type: "type"
94
- });
95
- dataRequestProperties.push(createPropertySignature({
96
- name: "pathParams",
97
- type: createTypeReferenceNode(createIdentifier(identifier), void 0)
98
- }));
99
- } else dataRequestProperties.push(createPropertySignature({
100
- name: "pathParams",
101
- questionToken: true,
102
- type: keywordTypeNodes.never
103
- }));
104
- if (schemas.queryParams) {
105
- const identifier = pluginManager.resolveName({
106
- name: schemas.queryParams.name,
107
- pluginKey: [pluginTsName],
108
- type: "type"
109
- });
110
- dataRequestProperties.push(createPropertySignature({
111
- name: "queryParams",
112
- questionToken: true,
113
- type: createTypeReferenceNode(createIdentifier(identifier), void 0)
114
- }));
115
- } else dataRequestProperties.push(createPropertySignature({
116
- name: "queryParams",
117
- questionToken: true,
118
- type: keywordTypeNodes.never
119
- }));
120
- if (schemas.headerParams) {
121
- const identifier = pluginManager.resolveName({
122
- name: schemas.headerParams.name,
123
- pluginKey: [pluginTsName],
124
- type: "type"
125
- });
126
- dataRequestProperties.push(createPropertySignature({
127
- name: "headerParams",
128
- questionToken: true,
129
- type: createTypeReferenceNode(createIdentifier(identifier), void 0)
130
- }));
131
- } else dataRequestProperties.push(createPropertySignature({
132
- name: "headerParams",
133
- questionToken: true,
134
- type: keywordTypeNodes.never
135
- }));
136
- dataRequestProperties.push(createPropertySignature({
137
- name: "url",
138
- type: createUrlTemplateType(operation.path)
139
- }));
140
- const dataRequestNode = createTypeAliasDeclaration({
141
- name,
142
- type: createTypeLiteralNode(dataRequestProperties),
143
- modifiers: [modifiers.export]
144
- });
145
- results.push(safePrint(dataRequestNode));
146
- return results.join("\n\n");
147
- }
148
- function printResponseSchema({ baseName, schemas, pluginManager, unknownType }) {
149
- const results = [];
150
- const name = pluginManager.resolveName({
151
- name: `${baseName} ResponseData`,
152
- pluginKey: [pluginTsName],
153
- type: "type"
154
- });
155
- if (schemas.responses && schemas.responses.length > 0) {
156
- const responsesProperties = schemas.responses.map((res) => {
157
- const identifier = pluginManager.resolveName({
158
- name: res.name,
159
- pluginKey: [pluginTsName],
160
- type: "type"
161
- });
162
- return createPropertySignature({
163
- name: res.statusCode?.toString() ?? "default",
164
- type: createTypeReferenceNode(createIdentifier(identifier), void 0)
165
- });
166
- });
167
- const responsesNode = createTypeAliasDeclaration({
168
- name: `${baseName}Responses`,
169
- type: createTypeLiteralNode(responsesProperties),
170
- modifiers: [modifiers.export]
171
- });
172
- results.push(safePrint(responsesNode));
173
- const responseNode = createTypeAliasDeclaration({
174
- name,
175
- type: createIndexedAccessTypeNode(createTypeReferenceNode(createIdentifier(`${baseName}Responses`), void 0), createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, createTypeReferenceNode(createIdentifier(`${baseName}Responses`), void 0))),
176
- modifiers: [modifiers.export]
177
- });
178
- results.push(safePrint(responseNode));
179
- } else {
180
- const responseNode = createTypeAliasDeclaration({
181
- name,
182
- modifiers: [modifiers.export],
183
- type: getUnknownType(unknownType)
184
- });
185
- results.push(safePrint(responseNode));
186
- }
187
- return results.join("\n\n");
188
- }
189
- const typeGenerator = createReactGenerator({
190
- name: "typescript",
191
- version: "1",
192
- Operation({ operation, generator, plugin }) {
193
- const { options, options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
194
- const mode = useMode();
195
- const pluginManager = usePluginManager();
196
- const oas = useOas();
197
- const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator);
198
- const schemaManager = useSchemaManager();
199
- const name = getName(operation, {
200
- type: "type",
201
- pluginKey: [pluginTsName]
202
- });
203
- const file = getFile(operation);
204
- const schemas = getSchemas(operation);
205
- const schemaGenerator = new SchemaGenerator(options, {
206
- fabric: generator.context.fabric,
207
- oas,
208
- events: generator.context.events,
209
- plugin,
210
- pluginManager,
211
- mode,
212
- override: options.override
213
- });
214
- const operationSchemas = [
215
- schemas.pathParams,
216
- schemas.queryParams,
217
- schemas.headerParams,
218
- schemas.statusCodes,
219
- schemas.request,
220
- schemas.response
221
- ].flat().filter(Boolean);
222
- const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }) => {
223
- const transformedSchema = paramsCasing && isParameterSchema(name) ? applyParamsCasing(schema, paramsCasing) : schema;
224
- const tree = schemaGenerator.parse({
225
- schema: transformedSchema,
226
- name,
227
- parentName: null
228
- });
229
- const imports = getImports(tree);
230
- const group = options.operation ? getGroup(options.operation) : void 0;
231
- const type = {
232
- name: schemaManager.getName(name, { type: "type" }),
233
- typedName: schemaManager.getName(name, { type: "type" }),
234
- file: schemaManager.getFile(options.operationName || name, { group })
235
- };
236
- return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
237
- root: file.path,
238
- path: imp.path,
239
- name: imp.name,
240
- isTypeOnly: true
241
- }, [
242
- name,
243
- imp.name,
244
- imp.path,
245
- imp.isTypeOnly
246
- ].join("-"))), /* @__PURE__ */ jsx(Type, {
247
- name: type.name,
248
- typedName: type.typedName,
249
- description,
250
- tree,
251
- schema: transformedSchema,
252
- mapper,
253
- enumType,
254
- enumKeyCasing,
255
- optionalType,
256
- arrayType,
257
- keysToOmit,
258
- syntaxType
259
- })] });
260
- };
261
- const responseName = schemaManager.getName(schemas.response.name, { type: "type" });
262
- const combinedSchemaName = operation.method === "get" ? `${name}Query` : `${name}Mutation`;
263
- return /* @__PURE__ */ jsxs(File, {
264
- baseName: file.baseName,
265
- path: file.path,
266
- meta: file.meta,
267
- banner: getBanner({
268
- oas,
269
- output: plugin.options.output,
270
- config: pluginManager.config
271
- }),
272
- footer: getFooter({
273
- oas,
274
- output: plugin.options.output
275
- }),
276
- children: [operationSchemas.map(mapOperationSchema), generator.context.UNSTABLE_NAMING ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
277
- name: `${name}Request`,
278
- isExportable: true,
279
- isIndexable: true,
280
- isTypeOnly: true,
281
- children: printRequestSchema({
282
- baseName: name,
283
- operation,
284
- schemas,
285
- pluginManager
286
- })
287
- }), /* @__PURE__ */ jsx(File.Source, {
288
- name: responseName,
289
- isExportable: true,
290
- isIndexable: true,
291
- isTypeOnly: true,
292
- children: printResponseSchema({
293
- baseName: name,
294
- schemas,
295
- pluginManager,
296
- unknownType
297
- })
298
- })] }) : /* @__PURE__ */ jsx(File.Source, {
299
- name: combinedSchemaName,
300
- isExportable: true,
301
- isIndexable: true,
302
- isTypeOnly: true,
303
- children: printCombinedSchema({
304
- name: combinedSchemaName,
305
- schemas,
306
- pluginManager
307
- })
308
- })]
309
- });
310
- },
311
- Schema({ schema, plugin }) {
312
- const { options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output } } = plugin;
313
- const mode = useMode();
314
- const oas = useOas();
315
- const pluginManager = usePluginManager();
316
- const { getName, getFile } = useSchemaManager();
317
- const imports = getImports(schema.tree);
318
- const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema);
319
- let typedName = getName(schema.name, { type: "type" });
320
- if (["asConst", "asPascalConst"].includes(enumType) && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) typedName = typedName += "Key";
321
- const type = {
322
- name: getName(schema.name, { type: "function" }),
323
- typedName,
324
- file: getFile(schema.name)
325
- };
326
- return /* @__PURE__ */ jsxs(File, {
327
- baseName: type.file.baseName,
328
- path: type.file.path,
329
- meta: type.file.meta,
330
- banner: getBanner({
331
- oas,
332
- output,
333
- config: pluginManager.config
334
- }),
335
- footer: getFooter({
336
- oas,
337
- output
338
- }),
339
- children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
340
- root: type.file.path,
341
- path: imp.path,
342
- name: imp.name,
343
- isTypeOnly: true
344
- }, [
345
- schema.name,
346
- imp.path,
347
- imp.isTypeOnly
348
- ].join("-"))), /* @__PURE__ */ jsx(Type, {
349
- name: type.name,
350
- typedName: type.typedName,
351
- description: schema.value.description,
352
- tree: schema.tree,
353
- schema: schema.value,
354
- mapper,
355
- enumType,
356
- enumKeyCasing,
357
- optionalType,
358
- arrayType,
359
- syntaxType
360
- })]
361
- });
362
- }
363
- });
364
- //#endregion
365
- //#region src/plugin.ts
366
- const pluginTsName = "plugin-ts";
367
- const pluginTs = definePlugin((options) => {
368
- const { output = {
369
- path: "types",
370
- barrelType: "named"
371
- }, 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;
372
- return {
373
- name: pluginTsName,
374
- options: {
375
- output,
376
- transformers,
377
- dateType,
378
- integerType,
379
- optionalType,
380
- arrayType,
381
- enumType,
382
- enumKeyCasing,
383
- enumSuffix,
384
- unknownType,
385
- emptySchemaType,
386
- syntaxType,
387
- group,
388
- override,
389
- mapper,
390
- paramsCasing,
391
- usedEnumNames: {}
392
- },
393
- pre: [pluginOasName],
394
- resolvePath(baseName, pathMode, options) {
395
- const root = path.resolve(this.config.root, this.config.output.path);
396
- if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
397
- /**
398
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
399
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
400
- */
401
- return path.resolve(root, output.path);
402
- if (group && (options?.group?.path || options?.group?.tag)) {
403
- const groupName = group?.name ? group.name : (ctx) => {
404
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
405
- return `${camelCase(ctx.group)}Controller`;
406
- };
407
- return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
408
- }
409
- return path.resolve(root, output.path, baseName);
410
- },
411
- resolveName(name, type) {
412
- const resolvedName = pascalCase(name, { isFile: type === "file" });
413
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
414
- return resolvedName;
415
- },
416
- async install() {
417
- const { config, fabric, plugin } = this;
418
- const root = path.resolve(config.root, config.output.path);
419
- const mode = getMode(path.resolve(root, output.path));
420
- if (this.rootNode) {
421
- await this.openInStudio({ ast: true });
422
- await walk(this.rootNode, { async schema(schemaNode) {
423
- await generators.map(async (generator) => {
424
- if (generator.type === "react" && generator.version === "2") await buildSchema(schemaNode, {
425
- config,
426
- fabric,
427
- Component: generator.Schema,
428
- plugin,
429
- version: generator.version
430
- });
431
- });
432
- } }, { depth: "shallow" });
433
- return;
434
- }
435
- const oas = await this.getOas();
436
- const schemaFiles = await new SchemaGenerator(this.plugin.options, {
437
- fabric: this.fabric,
438
- oas,
439
- pluginManager: this.pluginManager,
440
- events: this.events,
441
- plugin: this.plugin,
442
- contentType,
443
- include: void 0,
444
- override,
445
- mode,
446
- output: output.path
447
- }).build(...generators);
448
- await this.upsertFile(...schemaFiles);
449
- const operationFiles = await new OperationGenerator(this.plugin.options, {
450
- fabric: this.fabric,
451
- oas,
452
- pluginManager: this.pluginManager,
453
- events: this.events,
454
- plugin: this.plugin,
455
- contentType,
456
- exclude,
457
- include,
458
- override,
459
- mode,
460
- UNSTABLE_NAMING
461
- }).build(...generators);
462
- await this.upsertFile(...operationFiles);
463
- const barrelFiles = await getBarrelFiles(this.fabric.files, {
464
- type: output.barrelType ?? "named",
465
- root,
466
- output,
467
- meta: { pluginKey: this.plugin.key }
468
- });
469
- await this.upsertFile(...barrelFiles);
470
- }
471
- };
472
- });
473
- //#endregion
474
- export { pluginTsName as n, typeGenerator as r, pluginTs as t };
475
-
476
- //# sourceMappingURL=plugin-DnKRpgGK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-DnKRpgGK.js","names":["factory.createUnionDeclaration","factory.createTypeReferenceNode","factory.createIdentifier","factory.createTypeAliasDeclaration","factory.createTypeLiteralNode","factory.createPropertySignature","factory.createIndexedAccessTypeNode","factory.createTypeOperatorNode"],"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":";;;;;;;;;;;;;;;AAiBA,SAAS,oBAAoB,EAAE,MAAM,SAAS,iBAAoG;CAChJ,MAAM,aAA0C,EAAE;AAElD,KAAI,QAAQ,SACV,YAAW,cAAcA,uBAA+B,EACtD,OAAO,QAAQ,UAAU,KAAK,QAAQ;AAOpC,SAAOC,wBAAgCC,iBANpB,cAAc,YAAY;GAC3C,MAAM,IAAI;GACV,WAAW,CAAC,aAAa;GACzB,MAAM;GACP,CAAC,CAEyE,EAAE,KAAA,EAAU;GACvF,EACH,CAAC;AAGJ,KAAI,QAAQ,QAMV,YAAW,aAAaD,wBAAgCC,iBALrC,cAAc,YAAY;EAC3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