@kubb/plugin-ts 3.0.0-alpha.9 → 3.0.0-beta.1

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 (96) hide show
  1. package/README.md +14 -5
  2. package/dist/chunk-ERE4SAAA.js +303 -0
  3. package/dist/chunk-ERE4SAAA.js.map +1 -0
  4. package/dist/{chunk-PV5Q7I5O.cjs → chunk-NAVZH2YU.cjs} +185 -470
  5. package/dist/chunk-NAVZH2YU.cjs.map +1 -0
  6. package/dist/chunk-XKDPQUXZ.cjs +332 -0
  7. package/dist/chunk-XKDPQUXZ.cjs.map +1 -0
  8. package/dist/{chunk-UVAKTXUA.js → chunk-ZD6JQXPK.js} +86 -398
  9. package/dist/chunk-ZD6JQXPK.js.map +1 -0
  10. package/dist/components.cjs +11 -12
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +14 -44
  13. package/dist/components.d.ts +14 -44
  14. package/dist/components.js +2 -16
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +17 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +10 -0
  19. package/dist/generators.d.ts +10 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +12 -5
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +4 -123
  25. package/dist/index.d.ts +4 -123
  26. package/dist/index.js +3 -9
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-DoCOabdx.d.cts +98 -0
  29. package/dist/types-DoCOabdx.d.ts +98 -0
  30. package/package.json +21 -15
  31. package/src/components/OasType.tsx +3 -50
  32. package/src/components/{Schema.tsx → Type.tsx} +19 -54
  33. package/src/components/index.ts +1 -2
  34. package/src/generators/__snapshots__/bodyUploadFileApiAssetsPost.ts +6 -0
  35. package/src/generators/__snapshots__/catTypeAsConst.ts +11 -0
  36. package/src/generators/__snapshots__/createPet.ts +41 -0
  37. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +41 -0
  38. package/src/generators/__snapshots__/deletePet.ts +5 -0
  39. package/src/generators/__snapshots__/dogTypeAsConst.ts +11 -0
  40. package/src/generators/__snapshots__/enumAllOf.ts +10 -0
  41. package/src/generators/__snapshots__/enumArray.ts +19 -0
  42. package/src/generators/__snapshots__/enumInObject.ts +13 -0
  43. package/src/generators/__snapshots__/enumItems.ts +8 -0
  44. package/src/generators/__snapshots__/enumNames.ts +6 -0
  45. package/src/generators/__snapshots__/enumNamesConst.ts +6 -0
  46. package/src/generators/__snapshots__/enumNamesLiteral.ts +3 -0
  47. package/src/generators/__snapshots__/enumNamesPascalConst.ts +8 -0
  48. package/src/generators/__snapshots__/enumNamesType.ts +8 -0
  49. package/src/generators/__snapshots__/enumNullableMember.ts +8 -0
  50. package/src/generators/__snapshots__/enumNullableType.ts +8 -0
  51. package/src/generators/__snapshots__/enumString.ts +10 -0
  52. package/src/generators/__snapshots__/enumVarNamesType.ts +8 -0
  53. package/src/generators/__snapshots__/getPets.ts +27 -0
  54. package/src/generators/__snapshots__/mixedValueTypeConst.ts +9 -0
  55. package/src/generators/__snapshots__/nullConstNull.ts +7 -0
  56. package/src/generators/__snapshots__/numberValueConst.ts +9 -0
  57. package/src/generators/__snapshots__/petMapper.ts +15 -0
  58. package/src/generators/__snapshots__/petQuestionToken.ts +19 -0
  59. package/src/generators/__snapshots__/petQuestionTokenAndUndefined.ts +19 -0
  60. package/src/generators/__snapshots__/petUndefined.ts +19 -0
  61. package/src/generators/__snapshots__/pets.ts +14 -0
  62. package/src/generators/__snapshots__/petsStoreAdvancedDiscriminator.ts +31 -0
  63. package/src/generators/__snapshots__/petsStoreDiscriminator.ts +13 -0
  64. package/src/generators/__snapshots__/petsStoreRef.ts +1 -0
  65. package/src/generators/__snapshots__/plainDateDate.ts +1 -0
  66. package/src/generators/__snapshots__/plainDateString.ts +1 -0
  67. package/src/generators/__snapshots__/plainEmail.ts +1 -0
  68. package/src/generators/__snapshots__/plainFile.ts +1 -0
  69. package/src/generators/__snapshots__/plainTimeDate.ts +1 -0
  70. package/src/generators/__snapshots__/plainUuid.ts +1 -0
  71. package/src/generators/__snapshots__/readOnly.ts +20 -0
  72. package/src/{components/__snapshots__/Schema → generators/__snapshots__}/showPetById.ts +9 -9
  73. package/src/generators/__snapshots__/stringValueConst.ts +9 -0
  74. package/src/generators/index.ts +2 -0
  75. package/src/generators/oasGenerator.tsx +29 -0
  76. package/src/generators/typeGenerator.tsx +200 -0
  77. package/src/parser/index.ts +12 -3
  78. package/src/plugin.ts +26 -33
  79. package/src/types.ts +16 -52
  80. package/dist/chunk-PV5Q7I5O.cjs.map +0 -1
  81. package/dist/chunk-SEH6NUCX.cjs +0 -42
  82. package/dist/chunk-SEH6NUCX.cjs.map +0 -1
  83. package/dist/chunk-TTGZBH7H.js +0 -42
  84. package/dist/chunk-TTGZBH7H.js.map +0 -1
  85. package/dist/chunk-UVAKTXUA.js.map +0 -1
  86. package/dist/oas.cjs +0 -7
  87. package/dist/oas.cjs.map +0 -1
  88. package/dist/oas.d.cts +0 -1
  89. package/dist/oas.d.ts +0 -1
  90. package/dist/oas.js +0 -7
  91. package/dist/oas.js.map +0 -1
  92. package/src/OperationGenerator.tsx +0 -49
  93. package/src/SchemaGenerator.tsx +0 -31
  94. package/src/components/OperationSchema.tsx +0 -161
  95. package/src/components/__snapshots__/Schema/pets.ts +0 -27
  96. package/src/oas/index.ts +0 -1
package/README.md CHANGED
@@ -14,12 +14,8 @@
14
14
  [![Coverage][coverage-src]][coverage-href]
15
15
  [![License][license-src]][license-href]
16
16
 
17
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
18
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
19
- </p>
20
-
21
17
  <h4>
22
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
18
+ <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
23
19
  <span> · </span>
24
20
  <a href="https://kubb.dev/" target="_blank">Documentation</a>
25
21
  <span> · </span>
@@ -29,6 +25,19 @@
29
25
  </h4>
30
26
  </div>
31
27
 
28
+ ## Supporting Kubb
29
+
30
+ Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
31
+
32
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
33
+
34
+ <p align="center">
35
+ <a href="https://github.com/sponsors/stijnvanhulle">
36
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
37
+ </a>
38
+ </p>
39
+
40
+
32
41
  <!-- Badges -->
33
42
 
34
43
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-ts?flat&colorA=18181B&colorB=f58517
@@ -0,0 +1,303 @@
1
+ import { init_esm_shims, Type, OasType } from './chunk-ZD6JQXPK.js';
2
+ import transformers, { camelCase, pascalCase } from '@kubb/core/transformers';
3
+ import { print } from '@kubb/parser-ts';
4
+ import * as factory from '@kubb/parser-ts/factory';
5
+ import { pluginOasName, SchemaGenerator, OperationGenerator, createReactGenerator } from '@kubb/plugin-oas';
6
+ import { Oas } from '@kubb/plugin-oas/components';
7
+ import { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks';
8
+ import path from 'node:path';
9
+ import { createPlugin, FileManager, PluginManager } from '@kubb/core';
10
+ import '@kubb/core/utils';
11
+ import { useApp, File } from '@kubb/react';
12
+ import { jsxs, jsx } from '@kubb/react/jsx-runtime';
13
+
14
+ // src/generators/index.ts
15
+ init_esm_shims();
16
+
17
+ // src/generators/typeGenerator.tsx
18
+ init_esm_shims();
19
+
20
+ // src/index.ts
21
+ init_esm_shims();
22
+
23
+ // src/plugin.ts
24
+ init_esm_shims();
25
+ var pluginTsName = "plugin-ts";
26
+ var pluginTs = createPlugin((options) => {
27
+ const {
28
+ output = { path: "types", barrelType: "named" },
29
+ group,
30
+ exclude = [],
31
+ include,
32
+ override = [],
33
+ enumType = "asConst",
34
+ enumSuffix = "",
35
+ dateType = "string",
36
+ unknownType = "any",
37
+ optionalType = "questionToken",
38
+ transformers: transformers2 = {},
39
+ oasType = false,
40
+ mapper = {},
41
+ generators = [typeGenerator, oasType === "infer" ? oasGenerator : void 0].filter(Boolean)
42
+ } = options;
43
+ return {
44
+ name: pluginTsName,
45
+ options: {
46
+ output,
47
+ transformers: transformers2,
48
+ dateType,
49
+ optionalType,
50
+ oasType,
51
+ enumType,
52
+ enumSuffix,
53
+ // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey)
54
+ usedEnumNames: {},
55
+ unknownType,
56
+ override,
57
+ mapper
58
+ },
59
+ pre: [pluginOasName],
60
+ resolvePath(baseName, pathMode, options2) {
61
+ const root = path.resolve(this.config.root, this.config.output.path);
62
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
63
+ if (options2?.tag && group?.type === "tag") {
64
+ const groupName = group?.name ? group.name : (ctx) => `${ctx.group}Controller`;
65
+ return path.resolve(root, output.path, groupName({ group: camelCase(options2.tag) }), baseName);
66
+ }
67
+ if (mode === "single") {
68
+ return path.resolve(root, output.path);
69
+ }
70
+ return path.resolve(root, output.path, baseName);
71
+ },
72
+ resolveName(name, type) {
73
+ const resolvedName = pascalCase(name, { isFile: type === "file" });
74
+ if (type) {
75
+ return transformers2?.name?.(resolvedName, type) || resolvedName;
76
+ }
77
+ return resolvedName;
78
+ },
79
+ async buildStart() {
80
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
81
+ const oas = await swaggerPlugin.context.getOas();
82
+ const root = path.resolve(this.config.root, this.config.output.path);
83
+ const mode = FileManager.getMode(path.resolve(root, output.path));
84
+ const schemaGenerator = new SchemaGenerator(this.plugin.options, {
85
+ oas,
86
+ pluginManager: this.pluginManager,
87
+ plugin: this.plugin,
88
+ contentType: swaggerPlugin.context.contentType,
89
+ include: void 0,
90
+ override,
91
+ mode,
92
+ output: output.path
93
+ });
94
+ const schemaFiles = await schemaGenerator.build(...generators);
95
+ await this.addFile(...schemaFiles);
96
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
97
+ oas,
98
+ pluginManager: this.pluginManager,
99
+ plugin: this.plugin,
100
+ contentType: swaggerPlugin.context.contentType,
101
+ exclude,
102
+ include,
103
+ override,
104
+ mode
105
+ });
106
+ const operationFiles = await operationGenerator.build(...generators);
107
+ await this.addFile(...operationFiles);
108
+ const barrelFiles = await this.fileManager.getBarrelFiles({
109
+ type: output.barrelType ?? "named",
110
+ root,
111
+ output,
112
+ files: this.fileManager.files,
113
+ meta: {
114
+ pluginKey: this.plugin.key
115
+ },
116
+ logger: this.logger
117
+ });
118
+ await this.addFile(...barrelFiles);
119
+ }
120
+ };
121
+ });
122
+ function printCombinedSchema({ name, schemas, pluginManager }) {
123
+ const properties = {};
124
+ if (schemas.response) {
125
+ const identifier = pluginManager.resolveName({
126
+ name: schemas.response.name,
127
+ pluginKey: [pluginTsName],
128
+ type: "function"
129
+ });
130
+ properties["response"] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
131
+ }
132
+ if (schemas.request) {
133
+ const identifier = pluginManager.resolveName({
134
+ name: schemas.request.name,
135
+ pluginKey: [pluginTsName],
136
+ type: "function"
137
+ });
138
+ properties["request"] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
139
+ }
140
+ if (schemas.pathParams) {
141
+ const identifier = pluginManager.resolveName({
142
+ name: schemas.pathParams.name,
143
+ pluginKey: [pluginTsName],
144
+ type: "function"
145
+ });
146
+ properties["pathParams"] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
147
+ }
148
+ if (schemas.queryParams) {
149
+ const identifier = pluginManager.resolveName({
150
+ name: schemas.queryParams.name,
151
+ pluginKey: [pluginTsName],
152
+ type: "function"
153
+ });
154
+ properties["queryParams"] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
155
+ }
156
+ if (schemas.headerParams) {
157
+ const identifier = pluginManager.resolveName({
158
+ name: schemas.headerParams.name,
159
+ pluginKey: [pluginTsName],
160
+ type: "function"
161
+ });
162
+ properties["headerParams"] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
163
+ }
164
+ if (schemas.errors) {
165
+ properties["errors"] = factory.createUnionDeclaration({
166
+ nodes: schemas.errors.map((error) => {
167
+ const identifier = pluginManager.resolveName({
168
+ name: error.name,
169
+ pluginKey: [pluginTsName],
170
+ type: "function"
171
+ });
172
+ return factory.createTypeReferenceNode(factory.createIdentifier(identifier), void 0);
173
+ })
174
+ });
175
+ }
176
+ const namespaceNode = factory.createTypeAliasDeclaration({
177
+ name,
178
+ type: factory.createTypeLiteralNode(
179
+ Object.keys(properties).map((key) => {
180
+ const type = properties[key];
181
+ if (!type) {
182
+ return void 0;
183
+ }
184
+ return factory.createPropertySignature({
185
+ name: transformers.pascalCase(key),
186
+ type
187
+ });
188
+ }).filter(Boolean)
189
+ ),
190
+ modifiers: [factory.modifiers.export]
191
+ });
192
+ return print([namespaceNode]);
193
+ }
194
+ var typeGenerator = createReactGenerator({
195
+ name: "typescript",
196
+ Operation({ operation, options }) {
197
+ const { mapper, enumType, optionalType } = options;
198
+ const { plugin, pluginManager, mode } = useApp();
199
+ const oas = useOas();
200
+ const { getSchemas, getFile, getName } = useOperationManager();
201
+ const schemaManager = useSchemaManager();
202
+ const file = getFile(operation);
203
+ const schemas = getSchemas(operation);
204
+ const type = getName(operation, { type: "function", pluginKey: [pluginTsName] });
205
+ const combinedSchemaName = operation.method === "get" ? `${type}Query` : `${type}Mutation`;
206
+ const schemaGenerator = new SchemaGenerator(options, {
207
+ oas,
208
+ plugin,
209
+ pluginManager,
210
+ mode,
211
+ override: options.override
212
+ });
213
+ const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean);
214
+ const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options2 }, i) => {
215
+ const tree = schemaGenerator.parse({ schema, name });
216
+ const imports = schemaManager.getImports(tree);
217
+ const type2 = {
218
+ name: schemaManager.getName(name, { type: "type" }),
219
+ typedName: schemaManager.getName(name, { type: "type" }),
220
+ file: schemaManager.getFile(options2.operationName || name, { tag: options2.operation?.getTags()[0]?.name })
221
+ };
222
+ return /* @__PURE__ */ jsxs(Oas.Schema, { name, value: schema, tree, children: [
223
+ mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
224
+ /* @__PURE__ */ jsx(
225
+ Type,
226
+ {
227
+ name: type2.name,
228
+ typedName: type2.typedName,
229
+ description,
230
+ tree,
231
+ mapper,
232
+ enumType,
233
+ optionalType,
234
+ keysToOmit
235
+ }
236
+ )
237
+ ] }, i);
238
+ };
239
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.options.output?.banner, footer: plugin.options.output?.footer, children: [
240
+ operationSchemas.map(mapOperationSchema),
241
+ /* @__PURE__ */ jsx(File.Source, { name: combinedSchemaName, isExportable: true, isIndexable: true, isTypeOnly: true, children: printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager }) })
242
+ ] });
243
+ },
244
+ Schema({ schema, options }) {
245
+ const { mapper, enumType, optionalType } = options;
246
+ const {
247
+ mode,
248
+ plugin: {
249
+ options: { output }
250
+ }
251
+ } = useApp();
252
+ const { getName, getImports, getFile } = useSchemaManager();
253
+ const imports = getImports(schema.tree);
254
+ if (enumType === "asPascalConst") {
255
+ console.warn(`enumType '${enumType}' is deprecated`);
256
+ }
257
+ const type = {
258
+ name: getName(schema.name, { type: "function" }),
259
+ typedName: getName(schema.name, { type: "type" }),
260
+ file: getFile(schema.name)
261
+ };
262
+ return /* @__PURE__ */ jsxs(File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, banner: output?.banner, footer: output?.footer, children: [
263
+ mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
264
+ /* @__PURE__ */ jsx(
265
+ Type,
266
+ {
267
+ name: type.name,
268
+ typedName: type.typedName,
269
+ description: schema.value.description,
270
+ tree: schema.tree,
271
+ mapper,
272
+ enumType,
273
+ optionalType
274
+ }
275
+ )
276
+ ] });
277
+ }
278
+ });
279
+
280
+ // src/generators/oasGenerator.tsx
281
+ init_esm_shims();
282
+ var oasGenerator = createReactGenerator({
283
+ name: "oas",
284
+ Operations() {
285
+ const {
286
+ pluginManager,
287
+ plugin: {
288
+ options: { output },
289
+ key: pluginKey
290
+ }
291
+ } = useApp();
292
+ const oas = useOas();
293
+ const file = pluginManager.getFile({ name: "oas", extname: ".ts", pluginKey });
294
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
295
+ /* @__PURE__ */ jsx(File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
296
+ /* @__PURE__ */ jsx(OasType, { name: "oas", typeName: "Oas", api: oas.api })
297
+ ] });
298
+ }
299
+ });
300
+
301
+ export { oasGenerator, pluginTs, pluginTsName, typeGenerator };
302
+ //# sourceMappingURL=chunk-ERE4SAAA.js.map
303
+ //# sourceMappingURL=chunk-ERE4SAAA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generators/index.ts","../src/generators/typeGenerator.tsx","../src/index.ts","../src/plugin.ts","../src/generators/oasGenerator.tsx"],"names":["transformers","options","SchemaGenerator","type","createReactGenerator","useApp","useOas","jsxs","File","jsx"],"mappings":";;;;;;;;;;;;;;AAAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAYO,IAAM,YAAe,GAAA,YAAA;AAEf,IAAA,QAAA,GAAW,YAAuB,CAAA,CAAC,OAAY,K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AAAA,QACN,OAAA,EAAS,EAAE,MAAO,EAAA;AAAA,QAClB,GAAK,EAAA,SAAA;AAAA,OACP;AAAA,QACEC,MAAiB,EAAA,CAAA;AACrB,IAAA,MAAM,MAAMC,MAAO,EAAA,CAAA;AAEnB,IAAM,MAAA,IAAA,GAAO,cAAc,OAAQ,CAAA,EAAE,MAAM,KAAO,EAAA,OAAA,EAAS,KAAO,EAAA,SAAA,EAAW,CAAA,CAAA;AAE7E,IAAA,uBACEC,IAACC,CAAAA,IAAAA,EAAA,EAAK,QAAU,EAAA,IAAA,CAAK,UAAU,IAAM,EAAA,IAAA,CAAK,IAAM,EAAA,IAAA,EAAM,KAAK,IAAM,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,MAAA,EAAQ,QAAQ,MACvG,EAAA,QAAA,EAAA;AAAA,sBAAAC,GAAAA,CAACD,IAAK,CAAA,MAAA,EAAL,EAAY,IAAA,EAAM,CAAC,OAAO,CAAG,EAAA,IAAA,EAAK,WAAY,EAAA,UAAA,EAAU,IAAC,EAAA,CAAA;AAAA,sBAE1DC,IAAC,OAAQ,EAAA,EAAA,IAAA,EAAM,OAAO,QAAU,EAAA,KAAA,EAAO,GAAK,EAAA,GAAA,CAAI,GAAK,EAAA,CAAA;AAAA,KACvD,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,CAAC","file":"chunk-ERE4SAAA.js","sourcesContent":["export { typeGenerator } from './typeGenerator.tsx'\nexport { oasGenerator } from './oasGenerator.tsx'\n","import type { PluginManager } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { type OperationSchema as OperationSchemaType, type OperationSchemas, SchemaGenerator, createReactGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport type ts from 'typescript'\nimport { Type } from '../components'\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 const identifier = pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\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: transformers.pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print([namespaceNode])\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs>({\n name: 'typescript',\n Operation({ operation, options }) {\n const { mapper, enumType, optionalType } = options\n\n const { plugin, pluginManager, mode } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const type = getName(operation, { type: 'function', pluginKey: [pluginTsName] })\n const combinedSchemaName = operation.method === 'get' ? `${type}Query` : `${type}Mutation`\n const schemaGenerator = new SchemaGenerator(options, {\n oas,\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, i: number) => {\n // hack so Params can be optional when needed\n const tree = schemaGenerator.parse({ schema, name })\n const imports = schemaManager.getImports(tree)\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, { tag: options.operation?.getTags()[0]?.name }),\n }\n\n return (\n <Oas.Schema key={i} name={name} value={schema} tree={tree}>\n {mode === 'split' && imports.map((imp, index) => <File.Import key={index} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n keysToOmit={keysToOmit}\n />\n </Oas.Schema>\n )\n }\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={plugin.options.output?.banner} footer={plugin.options.output?.footer}>\n {operationSchemas.map(mapOperationSchema)}\n\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}\n </File.Source>\n </File>\n )\n },\n Schema({ schema, options }) {\n const { mapper, enumType, optionalType } = options\n const {\n mode,\n plugin: {\n options: { output },\n },\n } = useApp<PluginTs>()\n\n const { getName, getImports, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n\n if (enumType === 'asPascalConst') {\n console.warn(`enumType '${enumType}' is deprecated`)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n return (\n <File baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={output?.banner} footer={output?.footer}>\n {mode === 'split' && imports.map((imp, index) => <File.Import key={index} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={schema.value.description}\n tree={schema.tree}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n />\n </File>\n )\n },\n})\n","export { pluginTs, pluginTsName } from './plugin.ts'\nexport type { PluginTs } from './types.ts'\n","import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { oasGenerator, typeGenerator } from './generators'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = createPlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n mapper = {},\n generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean),\n } = options\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n optionalType,\n oasType,\n enumType,\n enumSuffix,\n // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n override,\n mapper,\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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\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 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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.addFile(...operationFiles)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { File, useApp } from '@kubb/react'\nimport { OasType } from '../components'\nimport type { PluginTs } from '../types.ts'\n\nexport const oasGenerator = createReactGenerator<PluginTs>({\n name: 'oas',\n Operations() {\n const {\n pluginManager,\n plugin: {\n options: { output },\n key: pluginKey,\n },\n } = useApp<PluginTs>()\n const oas = useOas()\n\n const file = pluginManager.getFile({ name: 'oas', extname: '.ts', pluginKey })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={output?.banner} footer={output?.footer}>\n <File.Import name={['Infer']} path=\"@kubb/oas\" isTypeOnly />\n\n <OasType name={'oas'} typeName={'Oas'} api={oas.api} />\n </File>\n )\n },\n})\n"]}