@kubb/swagger-ts 2.18.1 → 2.18.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.
- package/dist/{chunk-WYQP4IDG.cjs → chunk-H35DL3CM.cjs} +34 -34
- package/dist/chunk-H35DL3CM.cjs.map +1 -0
- package/dist/{chunk-ZOFIJQBL.js → chunk-NOXQZTV4.js} +12 -12
- package/dist/chunk-NOXQZTV4.js.map +1 -0
- package/dist/components.cjs +2 -2
- package/dist/components.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +11 -11
- package/src/OperationGenerator.tsx +3 -3
- package/src/SchemaGenerator.tsx +3 -3
- package/src/components/OasType.tsx +1 -1
- package/src/components/OperationSchema.tsx +4 -4
- package/src/plugin.ts +4 -4
- package/src/typeParser.ts +2 -2
- package/src/types.ts +1 -1
- package/dist/chunk-WYQP4IDG.cjs.map +0 -1
- package/dist/chunk-ZOFIJQBL.js.map +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/OasType.tsx
|
2
2
|
var _react = require('@kubb/react');
|
3
|
-
var _hooks = require('@kubb/
|
3
|
+
var _hooks = require('@kubb/plugin-oas/hooks');
|
4
4
|
var _jsxruntime = require('@kubb/react/jsx-runtime');
|
5
5
|
function Template({ name, typeName, api }) {
|
6
6
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
@@ -33,12 +33,12 @@ var _transformers = require('@kubb/core/transformers'); var _transformers2 = _in
|
|
33
33
|
var _parserts = require('@kubb/parser-ts');
|
34
34
|
var _factory = require('@kubb/parser-ts/factory'); var factory2 = _interopRequireWildcard(_factory); var factory = _interopRequireWildcard(_factory);
|
35
35
|
|
36
|
-
var _components = require('@kubb/
|
36
|
+
var _components = require('@kubb/plugin-oas/components');
|
37
37
|
|
38
38
|
|
39
39
|
// src/SchemaGenerator.tsx
|
40
40
|
|
41
|
-
var
|
41
|
+
var _pluginoas = require('@kubb/plugin-oas');
|
42
42
|
|
43
43
|
|
44
44
|
// src/plugin.ts
|
@@ -53,7 +53,7 @@ var _utils = require('@kubb/core/utils');
|
|
53
53
|
|
54
54
|
|
55
55
|
|
56
|
-
var OperationGenerator = class extends
|
56
|
+
var OperationGenerator = class extends _pluginoas.OperationGenerator {
|
57
57
|
async all(operations) {
|
58
58
|
const { oas, pluginManager, plugin, mode } = this.context;
|
59
59
|
const root = _react.createRoot.call(void 0, {
|
@@ -123,7 +123,7 @@ var pluginTs = _core.createPlugin.call(void 0, (options) => {
|
|
123
123
|
unknownType,
|
124
124
|
override
|
125
125
|
},
|
126
|
-
pre: [
|
126
|
+
pre: [_pluginoas.pluginOasName],
|
127
127
|
resolvePath(baseName, pathMode, options2) {
|
128
128
|
const root = _path2.default.resolve(this.config.root, this.config.output.path);
|
129
129
|
const mode = _nullishCoalesce(pathMode, () => ( _core.FileManager.getMode(_path2.default.resolve(root, output.path))));
|
@@ -150,7 +150,7 @@ var pluginTs = _core.createPlugin.call(void 0, (options) => {
|
|
150
150
|
return this.fileManager.write(source, writePath, { sanity: false });
|
151
151
|
},
|
152
152
|
async buildStart() {
|
153
|
-
const [swaggerPlugin] = _core.PluginManager.getDependedPlugins(this.plugins, [
|
153
|
+
const [swaggerPlugin] = _core.PluginManager.getDependedPlugins(this.plugins, [_pluginoas.pluginOasName]);
|
154
154
|
const oas = await swaggerPlugin.api.getOas();
|
155
155
|
const root = _path2.default.resolve(this.config.root, this.config.output.path);
|
156
156
|
const mode = _core.FileManager.getMode(_path2.default.resolve(root, output.path));
|
@@ -297,49 +297,49 @@ function parseTypeMeta(parent, current, options) {
|
|
297
297
|
if (!value) {
|
298
298
|
return void 0;
|
299
299
|
}
|
300
|
-
if (
|
300
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.union)) {
|
301
301
|
return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
|
302
302
|
}
|
303
|
-
if (
|
303
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.and)) {
|
304
304
|
return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
|
305
305
|
}
|
306
|
-
if (
|
306
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.array)) {
|
307
307
|
return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
|
308
308
|
}
|
309
|
-
if (
|
309
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.enum)) {
|
310
310
|
return typeKeywordMapper.enum(current.args.typeName);
|
311
311
|
}
|
312
|
-
if (
|
312
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.ref)) {
|
313
313
|
return typeKeywordMapper.ref(current.args.name);
|
314
314
|
}
|
315
|
-
if (
|
315
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.blob)) {
|
316
316
|
return value();
|
317
317
|
}
|
318
|
-
if (
|
318
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.tuple)) {
|
319
319
|
return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
|
320
320
|
}
|
321
|
-
if (
|
321
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.const)) {
|
322
322
|
return typeKeywordMapper.const(current.args.name, current.args.format);
|
323
323
|
}
|
324
|
-
if (
|
324
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.object)) {
|
325
325
|
const properties = Object.entries(_optionalChain([current, 'access', _6 => _6.args, 'optionalAccess', _7 => _7.properties]) || {}).filter((item) => {
|
326
326
|
const schemas = item[1];
|
327
327
|
return schemas && typeof schemas.map === "function";
|
328
328
|
}).map(([_name, schemas]) => {
|
329
329
|
let name = _name;
|
330
|
-
const nameSchema = schemas.find((schema) => schema.keyword ===
|
330
|
+
const nameSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.name);
|
331
331
|
if (nameSchema) {
|
332
332
|
name = nameSchema.args;
|
333
333
|
}
|
334
|
-
const isNullish = schemas.some((schema) => schema.keyword ===
|
335
|
-
const isNullable = schemas.some((schema) => schema.keyword ===
|
336
|
-
const isOptional = schemas.some((schema) => schema.keyword ===
|
337
|
-
const isReadonly = schemas.some((schema) => schema.keyword ===
|
338
|
-
const describeSchema = schemas.find((schema) => schema.keyword ===
|
339
|
-
const deprecatedSchema = schemas.find((schema) => schema.keyword ===
|
340
|
-
const defaultSchema = schemas.find((schema) => schema.keyword ===
|
341
|
-
const exampleSchema = schemas.find((schema) => schema.keyword ===
|
342
|
-
const schemaSchema = schemas.find((schema) => schema.keyword ===
|
334
|
+
const isNullish = schemas.some((schema) => schema.keyword === _pluginoas.schemaKeywords.nullish);
|
335
|
+
const isNullable = schemas.some((schema) => schema.keyword === _pluginoas.schemaKeywords.nullable);
|
336
|
+
const isOptional = schemas.some((schema) => schema.keyword === _pluginoas.schemaKeywords.optional);
|
337
|
+
const isReadonly = schemas.some((schema) => schema.keyword === _pluginoas.schemaKeywords.readOnly);
|
338
|
+
const describeSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.describe);
|
339
|
+
const deprecatedSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.deprecated);
|
340
|
+
const defaultSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.default);
|
341
|
+
const exampleSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.example);
|
342
|
+
const schemaSchema = schemas.find((schema) => schema.keyword === _pluginoas.schemaKeywords.schema);
|
343
343
|
let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0];
|
344
344
|
if (isNullable) {
|
345
345
|
type = factory.createUnionDeclaration({
|
@@ -378,13 +378,13 @@ function parseTypeMeta(parent, current, options) {
|
|
378
378
|
) : void 0;
|
379
379
|
return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
|
380
380
|
}
|
381
|
-
if (
|
381
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.datetime)) {
|
382
382
|
return typeKeywordMapper.datetime();
|
383
383
|
}
|
384
|
-
if (
|
384
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.date)) {
|
385
385
|
return typeKeywordMapper.date(current.args.type);
|
386
386
|
}
|
387
|
-
if (
|
387
|
+
if (_pluginoas.isKeyword.call(void 0, current, _pluginoas.schemaKeywords.time)) {
|
388
388
|
return typeKeywordMapper.time(current.args.type);
|
389
389
|
}
|
390
390
|
if (current.keyword in typeKeywordMapper) {
|
@@ -398,9 +398,9 @@ function typeParser(schemas, options) {
|
|
398
398
|
if (!schemas.length) {
|
399
399
|
return "";
|
400
400
|
}
|
401
|
-
const isNullish = schemas.some((item) => item.keyword ===
|
402
|
-
const isNullable = schemas.some((item) => item.keyword ===
|
403
|
-
const isOptional = schemas.some((item) => item.keyword ===
|
401
|
+
const isNullish = schemas.some((item) => item.keyword === _pluginoas.schemaKeywords.nullish);
|
402
|
+
const isNullable = schemas.some((item) => item.keyword === _pluginoas.schemaKeywords.nullable);
|
403
|
+
const isOptional = schemas.some((item) => item.keyword === _pluginoas.schemaKeywords.optional);
|
404
404
|
let type = schemas.map((schema) => parseTypeMeta(void 0, schema, options)).filter(Boolean).at(0) || typeKeywordMapper.undefined();
|
405
405
|
if (isNullable) {
|
406
406
|
type = factory.createUnionDeclaration({
|
@@ -426,7 +426,7 @@ function typeParser(schemas, options) {
|
|
426
426
|
nonNullable: true
|
427
427
|
}) : type
|
428
428
|
});
|
429
|
-
const enumSchemas =
|
429
|
+
const enumSchemas = _pluginoas.SchemaGenerator.deepSearch(schemas, _pluginoas.schemaKeywords.enum);
|
430
430
|
if (enumSchemas) {
|
431
431
|
enumSchemas.forEach((enumSchema) => {
|
432
432
|
extraNodes.push(
|
@@ -455,7 +455,7 @@ function typeParser(schemas, options) {
|
|
455
455
|
|
456
456
|
// src/SchemaGenerator.tsx
|
457
457
|
|
458
|
-
var SchemaGenerator = class extends
|
458
|
+
var SchemaGenerator = class extends _pluginoas.SchemaGenerator {
|
459
459
|
async schema(name, object) {
|
460
460
|
const { oas, pluginManager, mode, plugin, output } = this.context;
|
461
461
|
const root = _react.createRoot.call(void 0, {
|
@@ -580,4 +580,4 @@ OperationSchema.File = function({}) {
|
|
580
580
|
|
581
581
|
|
582
582
|
exports.OasType = OasType; exports.OperationSchema = OperationSchema; exports.pluginTsName = pluginTsName; exports.pluginTs = pluginTs;
|
583
|
-
//# sourceMappingURL=chunk-
|
583
|
+
//# sourceMappingURL=chunk-H35DL3CM.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/plugin.ts","../src/OperationGenerator.tsx","../src/typeParser.ts"],"names":["Template","transformers","print","factory","Par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K,KAACP,MAAK,QAAL,EACC,0BAAAO,KAACL,KAAI,OAAO,QAAX,EAAkB,SAAkB,GACvC;AAAA,SAJe,CAKjB;AAAA,EAEJ;AAEA,SACE,gBAAAK,KAACR,SAAA,EAAO,UAAS,cACf,0BAAAa,MAACZ,OAAA,EAAe,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,MAAM,KAAK,MAClE;AAAA,UAAM,IAAI,OAAO;AAAA,IAElB,gBAAAO,KAACP,MAAK,QAAL,EAAa,8BAAoB,aAAa,WAAW,OAAO,GAAE;AAAA,KACrE,GACF;AAEJ","sourcesContent":["import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/plugin-oas/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Parser, File, useApp } from '@kubb/react'\nimport { Oas, Schema } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype Props = {}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.response.name), undefined)\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.request.name), undefined)\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.pathParams.name), undefined)\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.queryParams.name), undefined)\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.headerParams.name), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n return factory.createTypeReferenceNode(factory.createIdentifier(error.name), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\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 function OperationSchema({}: Props): ReactNode {\n return <></>\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema: object, ...options }: OperationSchemaType, i: number) => {\n return (\n <Oas.Schema key={i} generator={generator} name={name} object={object}>\n {mode === 'split' && <Oas.Schema.Imports isTypeOnly />}\n <File.Source>\n <Oas.Schema.Source options={options} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema(factoryName, operation, schemas)}</File.Source>\n </File>\n </Parser>\n )\n}\n","import { App, createRoot } from '@kubb/react'\nimport { SchemaGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\n\nimport { pluginTsName } from './plugin.ts'\nimport { typeParser } from './typeParser.ts'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, object: SchemaObject): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, mode, plugin, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema generator={this} name={name} object={object}>\n <Oas.Schema.File isTypeOnly output={output} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext\n getSource(name: string, schemas: SchemaType[], { keysToOmit, description }: SchemaGeneratorBuildOptions = {}): string[] {\n const texts: string[] = []\n\n const resolvedName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n const resolvedTypeName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const typeOutput = typeParser(schemas, {\n name: resolvedName,\n typeName: resolvedTypeName,\n description,\n enumType: this.options.enumType || 'asConst',\n optionalType: this.options.optionalType,\n keysToOmit,\n })\n\n texts.push(typeOutput)\n\n return texts\n }\n /**\n * @deprecated only used for testing\n */\n\n buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] {\n const schemas = this.buildSchemas({ schema, name })\n\n return this.getSource(name, schemas, options)\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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' },\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 } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\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 },\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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.api.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.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { App, createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async get(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async post(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async put(): OperationMethodResult<FileMeta> {\n return null\n }\n async patch(): OperationMethodResult<FileMeta> {\n return null\n }\n async delete(): OperationMethodResult<FileMeta> {\n return null\n }\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: SchemaMapper\n}\n\nexport function parseTypeMeta(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([_name, schemas]) => {\n let name = _name\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n\n if (nameSchema) {\n name = nameSchema.args\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parseTypeMeta(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n\nexport function typeParser(schemas: Schema[], options: ParserOptions): string {\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!schemas.length) {\n return ''\n }\n\n const isNullish = schemas.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (schemas\n .map((schema) => parseTypeMeta(undefined, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: options.name,\n type: options.keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: options.keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(schemas, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: options.enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [options.description ? `@description ${transformers.jsStringEscape(options.description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// src/components/OasType.tsx
|
2
2
|
import { Parser, File, Type, useApp } from "@kubb/react";
|
3
|
-
import { useOas } from "@kubb/
|
3
|
+
import { useOas } from "@kubb/plugin-oas/hooks";
|
4
4
|
import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
|
5
5
|
function Template({ name, typeName, api }) {
|
6
6
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
@@ -33,25 +33,25 @@ import transformers2 from "@kubb/core/transformers";
|
|
33
33
|
import { print as print2 } from "@kubb/parser-ts";
|
34
34
|
import * as factory2 from "@kubb/parser-ts/factory";
|
35
35
|
import { Parser as Parser2, File as File2, useApp as useApp2 } from "@kubb/react";
|
36
|
-
import { Oas as Oas3 } from "@kubb/
|
37
|
-
import { useOas as useOas2, useOperation, useOperationManager } from "@kubb/
|
36
|
+
import { Oas as Oas3 } from "@kubb/plugin-oas/components";
|
37
|
+
import { useOas as useOas2, useOperation, useOperationManager } from "@kubb/plugin-oas/hooks";
|
38
38
|
|
39
39
|
// src/SchemaGenerator.tsx
|
40
40
|
import { App as App2, createRoot as createRoot2 } from "@kubb/react";
|
41
|
-
import { SchemaGenerator as Generator2 } from "@kubb/
|
42
|
-
import { Oas as Oas2 } from "@kubb/
|
41
|
+
import { SchemaGenerator as Generator2 } from "@kubb/plugin-oas";
|
42
|
+
import { Oas as Oas2 } from "@kubb/plugin-oas/components";
|
43
43
|
|
44
44
|
// src/plugin.ts
|
45
45
|
import path from "path";
|
46
46
|
import { FileManager, PluginManager, createPlugin } from "@kubb/core";
|
47
47
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
48
48
|
import { renderTemplate } from "@kubb/core/utils";
|
49
|
-
import {
|
49
|
+
import { pluginOasName } from "@kubb/plugin-oas";
|
50
50
|
|
51
51
|
// src/OperationGenerator.tsx
|
52
52
|
import { App, createRoot } from "@kubb/react";
|
53
|
-
import { OperationGenerator as Generator } from "@kubb/
|
54
|
-
import { Oas } from "@kubb/
|
53
|
+
import { OperationGenerator as Generator } from "@kubb/plugin-oas";
|
54
|
+
import { Oas } from "@kubb/plugin-oas/components";
|
55
55
|
import { jsx as jsx2 } from "@kubb/react/jsx-runtime";
|
56
56
|
var OperationGenerator = class extends Generator {
|
57
57
|
async all(operations) {
|
@@ -123,7 +123,7 @@ var pluginTs = createPlugin((options) => {
|
|
123
123
|
unknownType,
|
124
124
|
override
|
125
125
|
},
|
126
|
-
pre: [
|
126
|
+
pre: [pluginOasName],
|
127
127
|
resolvePath(baseName, pathMode, options2) {
|
128
128
|
const root = path.resolve(this.config.root, this.config.output.path);
|
129
129
|
const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
|
@@ -150,7 +150,7 @@ var pluginTs = createPlugin((options) => {
|
|
150
150
|
return this.fileManager.write(source, writePath, { sanity: false });
|
151
151
|
},
|
152
152
|
async buildStart() {
|
153
|
-
const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [
|
153
|
+
const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
|
154
154
|
const oas = await swaggerPlugin.api.getOas();
|
155
155
|
const root = path.resolve(this.config.root, this.config.output.path);
|
156
156
|
const mode = FileManager.getMode(path.resolve(root, output.path));
|
@@ -198,7 +198,7 @@ var pluginTs = createPlugin((options) => {
|
|
198
198
|
import transformers from "@kubb/core/transformers";
|
199
199
|
import { print } from "@kubb/parser-ts";
|
200
200
|
import * as factory from "@kubb/parser-ts/factory";
|
201
|
-
import { SchemaGenerator as SchemaGenerator2, isKeyword, schemaKeywords } from "@kubb/
|
201
|
+
import { SchemaGenerator as SchemaGenerator2, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
|
202
202
|
var typeKeywordMapper = {
|
203
203
|
any: () => factory.keywordTypeNodes.any,
|
204
204
|
unknown: () => factory.keywordTypeNodes.unknown,
|
@@ -580,4 +580,4 @@ export {
|
|
580
580
|
pluginTsName,
|
581
581
|
pluginTs
|
582
582
|
};
|
583
|
-
//# sourceMappingURL=chunk-
|
583
|
+
//# sourceMappingURL=chunk-NOXQZTV4.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/plugin.ts","../src/OperationGenerator.tsx","../src/typeParser.ts"],"sourcesContent":["import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/plugin-oas/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Parser, File, useApp } from '@kubb/react'\nimport { Oas, Schema } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype Props = {}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.response.name), undefined)\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.request.name), undefined)\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.pathParams.name), undefined)\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.queryParams.name), undefined)\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.headerParams.name), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n return factory.createTypeReferenceNode(factory.createIdentifier(error.name), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\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 function OperationSchema({}: Props): ReactNode {\n return <></>\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema: object, ...options }: OperationSchemaType, i: number) => {\n return (\n <Oas.Schema key={i} generator={generator} name={name} object={object}>\n {mode === 'split' && <Oas.Schema.Imports isTypeOnly />}\n <File.Source>\n <Oas.Schema.Source options={options} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema(factoryName, operation, schemas)}</File.Source>\n </File>\n </Parser>\n )\n}\n","import { App, createRoot } from '@kubb/react'\nimport { SchemaGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\n\nimport { pluginTsName } from './plugin.ts'\nimport { typeParser } from './typeParser.ts'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, object: SchemaObject): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, mode, plugin, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema generator={this} name={name} object={object}>\n <Oas.Schema.File isTypeOnly output={output} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext\n getSource(name: string, schemas: SchemaType[], { keysToOmit, description }: SchemaGeneratorBuildOptions = {}): string[] {\n const texts: string[] = []\n\n const resolvedName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n const resolvedTypeName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const typeOutput = typeParser(schemas, {\n name: resolvedName,\n typeName: resolvedTypeName,\n description,\n enumType: this.options.enumType || 'asConst',\n optionalType: this.options.optionalType,\n keysToOmit,\n })\n\n texts.push(typeOutput)\n\n return texts\n }\n /**\n * @deprecated only used for testing\n */\n\n buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] {\n const schemas = this.buildSchemas({ schema, name })\n\n return this.getSource(name, schemas, options)\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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' },\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 } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\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 },\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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.api.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.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { App, createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async get(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async post(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async put(): OperationMethodResult<FileMeta> {\n return null\n }\n async patch(): OperationMethodResult<FileMeta> {\n return null\n }\n async delete(): OperationMethodResult<FileMeta> {\n return null\n }\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: SchemaMapper\n}\n\nexport function parseTypeMeta(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([_name, schemas]) => {\n let name = _name\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n\n if (nameSchema) {\n name = nameSchema.args\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parseTypeMeta(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n\nexport function typeParser(schemas: Schema[], options: ParserOptions): string {\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!schemas.length) {\n return ''\n }\n\n const isNullish = schemas.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (schemas\n .map((schema) => parseTypeMeta(undefined, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: options.name,\n type: options.keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: options.keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(schemas, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: options.enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [options.description ? `@description ${transformers.jsStringEscape(options.description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n"],"mappings":";AAAA,SAAS,QAAQ,MAAM,MAAM,cAAc;AAC3C,SAAS,cAAc;AAiBnB,mBAEE,KAFF;AAFJ,SAAS,SAAS,EAAE,MAAM,UAAU,IAAI,GAA6B;AACnE,SACE,iCACG;AAAA,oBAAgB,IAAI,MAAM,KAAK,UAAU,KAAK,QAAW,CAAC,CAAC;AAAA,IAC5D,oBAAC,QAAG;AAAA,IACJ,oBAAC,QAAK,MAAM,UAAU,QAAM,MACzB,0BAAgB,IAAI,KACvB;AAAA,KACF;AAEJ;AAEA,IAAM,mBAAmB,EAAE,SAAS,SAAS;AAWtC,SAAS,QAAQ,EAAE,MAAM,UAAU,UAAAA,YAAW,iBAAiB,QAAQ,GAAqB;AACjG,QAAM,MAAM,OAAO;AAEnB,SAAO,oBAACA,WAAA,EAAS,MAAY,UAAoB,KAAK,IAAI,KAAK;AACjE;AAWA,QAAQ,OAAO,SAAU,EAAE,MAAM,UAAU,YAAY,iBAAiB,GAAyB;AAC/F,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ,EAAE,KAAK,UAAU;AAAA,EAC3B,IAAI,OAAiB;AACrB,QAAM,OAAO,cAAc,QAAQ,EAAE,MAAM,SAAS,OAAO,UAAU,CAAC;AAEtE,QAAMA,YAAW,UAAU;AAE3B,SACE,oBAAC,UAAO,UAAS,cACf,+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C,QAAQ,YAAY,QAAQ,aAAa,QAAQ,cAAc,QAAQ,aAAa,QAAQ,SAAS,QAAQ,QAAQ,EAAE,KAAK,EAAE,OAAO,OAAO;AAE3J,QAAM,UAAU,CAAC,EAAE,MAAM,QAAQ,QAAQ,GAAG,QAAQ,GAAwB,MAAc;AACxF,WACE,gBAAAJ,MAACK,KAAI,QAAJ,EAAmB,WAAsB,MAAY,QACnD;AAAA,eAAS,WAAW,gBAAAN,KAACM,KAAI,OAAO,SAAX,EAAmB,YAAU,MAAC;AAAA,MACpD,gBAAAN,KAACO,MAAK,QAAL,EACC,0BAAAP,KAACM,KAAI,OAAO,QAAX,EAAkB,SAAkB,GACvC;AAAA,SAJe,CAKjB;AAAA,EAEJ;AAEA,SACE,gBAAAN,KAACQ,SAAA,EAAO,UAAS,cACf,0BAAAP,MAACM,OAAA,EAAe,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,MAAM,KAAK,MAClE;AAAA,UAAM,IAAI,OAAO;AAAA,IAElB,gBAAAP,KAACO,MAAK,QAAL,EAAa,8BAAoB,aAAa,WAAW,OAAO,GAAE;AAAA,KACrE,GACF;AAEJ;","names":["Template","transformers","print","factory","Parser","File","useApp","Oas","useOas","App","createRoot","Generator","Oas","jsx","transformers","options","SchemaGenerator","node","jsx","Generator","createRoot","App","Oas","Fragment","jsx","jsxs","transformers","print","useApp","useOas","Oas","File","Parser"]}
|
package/dist/components.cjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
2
2
|
|
3
3
|
|
4
|
-
var
|
4
|
+
var _chunkH35DL3CMcjs = require('./chunk-H35DL3CM.cjs');
|
5
5
|
|
6
6
|
|
7
7
|
|
8
|
-
exports.OasType =
|
8
|
+
exports.OasType = _chunkH35DL3CMcjs.OasType; exports.OperationSchema = _chunkH35DL3CMcjs.OperationSchema;
|
9
9
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.js
CHANGED
package/dist/index.cjs
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
2
2
|
|
3
3
|
|
4
|
-
var
|
4
|
+
var _chunkH35DL3CMcjs = require('./chunk-H35DL3CM.cjs');
|
5
5
|
|
6
6
|
// src/index.ts
|
7
|
-
var definePluginDefault =
|
8
|
-
var definePlugin =
|
7
|
+
var definePluginDefault = _chunkH35DL3CMcjs.pluginTs;
|
8
|
+
var definePlugin = _chunkH35DL3CMcjs.pluginTs;
|
9
9
|
var src_default = definePluginDefault;
|
10
10
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
exports.default = src_default; exports.definePlugin = definePlugin; exports.pluginTs =
|
15
|
+
exports.default = src_default; exports.definePlugin = definePlugin; exports.pluginTs = _chunkH35DL3CMcjs.pluginTs; exports.pluginTsName = _chunkH35DL3CMcjs.pluginTsName;
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
2
2
|
import { PluginFactoryOptions, KubbFile, ResolveNameParams } from '@kubb/core';
|
3
|
-
import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/
|
3
|
+
import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
|
4
4
|
|
5
5
|
type Options = {
|
6
6
|
output?: {
|
@@ -112,15 +112,15 @@ declare module '@kubb/core' {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
declare const pluginTsName = "plugin-ts";
|
115
|
-
declare const pluginTs: (options
|
115
|
+
declare const pluginTs: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
116
116
|
|
117
117
|
/**
|
118
118
|
* @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead
|
119
119
|
*/
|
120
|
-
declare const definePluginDefault: (options
|
120
|
+
declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
121
121
|
/**
|
122
122
|
* @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead
|
123
123
|
*/
|
124
|
-
declare const definePlugin: (options
|
124
|
+
declare const definePlugin: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
125
125
|
|
126
126
|
export { type PluginTs, definePluginDefault as default, definePlugin, pluginTs, pluginTsName };
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
2
2
|
import { PluginFactoryOptions, KubbFile, ResolveNameParams } from '@kubb/core';
|
3
|
-
import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/
|
3
|
+
import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
|
4
4
|
|
5
5
|
type Options = {
|
6
6
|
output?: {
|
@@ -112,15 +112,15 @@ declare module '@kubb/core' {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
declare const pluginTsName = "plugin-ts";
|
115
|
-
declare const pluginTs: (options
|
115
|
+
declare const pluginTs: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
116
116
|
|
117
117
|
/**
|
118
118
|
* @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead
|
119
119
|
*/
|
120
|
-
declare const definePluginDefault: (options
|
120
|
+
declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
121
121
|
/**
|
122
122
|
* @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead
|
123
123
|
*/
|
124
|
-
declare const definePlugin: (options
|
124
|
+
declare const definePlugin: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
|
125
125
|
|
126
126
|
export { type PluginTs, definePluginDefault as default, definePlugin, pluginTs, pluginTsName };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kubb/swagger-ts",
|
3
|
-
"version": "2.18.
|
3
|
+
"version": "2.18.3",
|
4
4
|
"description": "Generator swagger-ts",
|
5
5
|
"keywords": [
|
6
6
|
"typescript",
|
@@ -56,24 +56,24 @@
|
|
56
56
|
"!/**/__tests__/**"
|
57
57
|
],
|
58
58
|
"dependencies": {
|
59
|
-
"@kubb/core": "2.18.
|
60
|
-
"@kubb/oas": "2.18.
|
61
|
-
"@kubb/
|
62
|
-
"@kubb/
|
63
|
-
"@kubb/
|
64
|
-
"@kubb/types": "2.18.
|
59
|
+
"@kubb/core": "2.18.3",
|
60
|
+
"@kubb/oas": "2.18.3",
|
61
|
+
"@kubb/parser-ts": "2.18.3",
|
62
|
+
"@kubb/react": "2.18.3",
|
63
|
+
"@kubb/plugin-oas": "2.18.3",
|
64
|
+
"@kubb/types": "2.18.3"
|
65
65
|
},
|
66
66
|
"devDependencies": {
|
67
67
|
"@types/react": "^18.3.1",
|
68
68
|
"prettier": "^3.2.5",
|
69
69
|
"react": "^18.3.1",
|
70
70
|
"tsup": "^8.0.2",
|
71
|
-
"@kubb/config-biome": "2.18.
|
72
|
-
"@kubb/config-ts": "2.18.
|
73
|
-
"@kubb/config-tsup": "2.18.
|
71
|
+
"@kubb/config-biome": "2.18.3",
|
72
|
+
"@kubb/config-ts": "2.18.3",
|
73
|
+
"@kubb/config-tsup": "2.18.3"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
76
|
-
"@kubb/react": "2.18.
|
76
|
+
"@kubb/react": "2.18.3"
|
77
77
|
},
|
78
78
|
"engines": {
|
79
79
|
"node": ">=18",
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { App, createRoot } from '@kubb/react'
|
2
|
-
import { OperationGenerator as Generator } from '@kubb/
|
3
|
-
import { Oas } from '@kubb/
|
2
|
+
import { OperationGenerator as Generator } from '@kubb/plugin-oas'
|
3
|
+
import { Oas } from '@kubb/plugin-oas/components'
|
4
4
|
|
5
5
|
import { OasType } from './components/OasType.tsx'
|
6
6
|
import { OperationSchema } from './components/OperationSchema.tsx'
|
7
7
|
|
8
8
|
import type { Operation } from '@kubb/oas'
|
9
|
-
import type { OperationMethodResult } from '@kubb/
|
9
|
+
import type { OperationMethodResult } from '@kubb/plugin-oas'
|
10
10
|
import type { FileMeta, PluginTs } from './types.ts'
|
11
11
|
|
12
12
|
export class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {
|
package/src/SchemaGenerator.tsx
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { App, createRoot } from '@kubb/react'
|
2
|
-
import { SchemaGenerator as Generator } from '@kubb/
|
3
|
-
import { Oas } from '@kubb/
|
2
|
+
import { SchemaGenerator as Generator } from '@kubb/plugin-oas'
|
3
|
+
import { Oas } from '@kubb/plugin-oas/components'
|
4
4
|
|
5
5
|
import { pluginTsName } from './plugin.ts'
|
6
6
|
import { typeParser } from './typeParser.ts'
|
7
7
|
|
8
8
|
import type { SchemaObject } from '@kubb/oas'
|
9
|
-
import type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/
|
9
|
+
import type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/plugin-oas'
|
10
10
|
import type { FileMeta, PluginTs } from './types.ts'
|
11
11
|
|
12
12
|
export class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {
|
@@ -2,16 +2,16 @@ import transformers from '@kubb/core/transformers'
|
|
2
2
|
import { print } from '@kubb/parser-ts'
|
3
3
|
import * as factory from '@kubb/parser-ts/factory'
|
4
4
|
import { Parser, File, useApp } from '@kubb/react'
|
5
|
-
import { Oas, Schema } from '@kubb/
|
6
|
-
import { useOas, useOperation, useOperationManager } from '@kubb/
|
5
|
+
import { Oas, Schema } from '@kubb/plugin-oas/components'
|
6
|
+
import { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
|
7
7
|
|
8
8
|
import { SchemaGenerator } from '../SchemaGenerator.tsx'
|
9
9
|
|
10
10
|
import type { KubbFile } from '@kubb/core'
|
11
11
|
import type { Operation } from '@kubb/oas'
|
12
12
|
import type { ts } from '@kubb/parser-ts'
|
13
|
-
import type { OperationSchema as OperationSchemaType } from '@kubb/
|
14
|
-
import type { OperationSchemas } from '@kubb/
|
13
|
+
import type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'
|
14
|
+
import type { OperationSchemas } from '@kubb/plugin-oas'
|
15
15
|
import type { ReactNode } from 'react'
|
16
16
|
import type { FileMeta, PluginTs } from '../types.ts'
|
17
17
|
|
package/src/plugin.ts
CHANGED
@@ -3,13 +3,13 @@ import path from 'node:path'
|
|
3
3
|
import { FileManager, PluginManager, createPlugin } from '@kubb/core'
|
4
4
|
import { camelCase, pascalCase } from '@kubb/core/transformers'
|
5
5
|
import { renderTemplate } from '@kubb/core/utils'
|
6
|
-
import {
|
6
|
+
import { pluginOasName } from '@kubb/plugin-oas'
|
7
7
|
|
8
8
|
import { OperationGenerator } from './OperationGenerator.tsx'
|
9
9
|
import { SchemaGenerator } from './SchemaGenerator.tsx'
|
10
10
|
|
11
11
|
import type { Plugin } from '@kubb/core'
|
12
|
-
import type {
|
12
|
+
import type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'
|
13
13
|
import type { PluginTs } from './types.ts'
|
14
14
|
|
15
15
|
export const pluginTsName = 'plugin-ts' satisfies PluginTs['name']
|
@@ -45,7 +45,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
45
45
|
unknownType,
|
46
46
|
override,
|
47
47
|
},
|
48
|
-
pre: [
|
48
|
+
pre: [pluginOasName],
|
49
49
|
resolvePath(baseName, pathMode, options) {
|
50
50
|
const root = path.resolve(this.config.root, this.config.output.path)
|
51
51
|
const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))
|
@@ -83,7 +83,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
83
83
|
return this.fileManager.write(source, writePath, { sanity: false })
|
84
84
|
},
|
85
85
|
async buildStart() {
|
86
|
-
const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [
|
86
|
+
const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])
|
87
87
|
|
88
88
|
const oas = await swaggerPlugin.api.getOas()
|
89
89
|
const root = path.resolve(this.config.root, this.config.output.path)
|
package/src/typeParser.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import transformers from '@kubb/core/transformers'
|
2
2
|
import { print } from '@kubb/parser-ts'
|
3
3
|
import * as factory from '@kubb/parser-ts/factory'
|
4
|
-
import { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/
|
4
|
+
import { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/plugin-oas'
|
5
5
|
|
6
6
|
import type { ts } from '@kubb/parser-ts'
|
7
|
-
import type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/
|
7
|
+
import type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'
|
8
8
|
|
9
9
|
export const typeKeywordMapper = {
|
10
10
|
any: () => factory.keywordTypeNodes.any,
|
package/src/types.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { KubbFile, Plugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
2
|
-
import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/
|
2
|
+
import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
|
3
3
|
|
4
4
|
export type Options = {
|
5
5
|
output?: {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/plugin.ts","../src/OperationGenerator.tsx","../src/typeParser.ts"],"names":["Template","transformers","print","factory","Parser","File","useApp","Oas","useOas","App","createRoot","Generator","jsx","options","SchemaGenerator","node","Fragment","jsxs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EAAkB,SAAkB,GACvC;AAAA,SAJe,CAKjB;AAAA,EAEJ;AAEA,SACE,gBAAAK,KAACR,SAAA,EAAO,UAAS,cACf,0BAAAa,MAACZ,OAAA,EAAe,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,MAAM,KAAK,MAClE;AAAA,UAAM,IAAI,OAAO;AAAA,IAElB,gBAAAO,KAACP,MAAK,QAAL,EAAa,8BAAoB,aAAa,WAAW,OAAO,GAAE;AAAA,KACrE,GACF;AAEJ","sourcesContent":["import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Parser, File, useApp } from '@kubb/react'\nimport { Oas, Schema } from '@kubb/swagger/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/swagger/hooks'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/swagger'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype Props = {}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.response.name), undefined)\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.request.name), undefined)\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.pathParams.name), undefined)\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.queryParams.name), undefined)\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.headerParams.name), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n return factory.createTypeReferenceNode(factory.createIdentifier(error.name), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\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 function OperationSchema({}: Props): ReactNode {\n return <></>\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema: object, ...options }: OperationSchemaType, i: number) => {\n return (\n <Oas.Schema key={i} generator={generator} name={name} object={object}>\n {mode === 'split' && <Oas.Schema.Imports isTypeOnly />}\n <File.Source>\n <Oas.Schema.Source options={options} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema(factoryName, operation, schemas)}</File.Source>\n </File>\n </Parser>\n )\n}\n","import { App, createRoot } from '@kubb/react'\nimport { SchemaGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { pluginTsName } from './plugin.ts'\nimport { typeParser } from './typeParser.ts'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/swagger'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, object: SchemaObject): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, mode, plugin, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema generator={this} name={name} object={object}>\n <Oas.Schema.File isTypeOnly output={output} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext\n getSource(name: string, schemas: SchemaType[], { keysToOmit, description }: SchemaGeneratorBuildOptions = {}): string[] {\n const texts: string[] = []\n\n const resolvedName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n const resolvedTypeName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const typeOutput = typeParser(schemas, {\n name: resolvedName,\n typeName: resolvedTypeName,\n description,\n enumType: this.options.enumType || 'asConst',\n optionalType: this.options.optionalType,\n keysToOmit,\n })\n\n texts.push(typeOutput)\n\n return texts\n }\n /**\n * @deprecated only used for testing\n */\n\n buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] {\n const schemas = this.buildSchemas({ schema, name })\n\n return this.getSource(name, schemas, options)\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginSwaggerName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginSwagger as SwaggerPluginOptions } from '@kubb/swagger'\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' },\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 } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\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 },\n pre: [pluginSwaggerName],\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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginSwaggerName])\n\n const oas = await swaggerPlugin.api.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.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { App, createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async get(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async post(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async put(): OperationMethodResult<FileMeta> {\n return null\n }\n async patch(): OperationMethodResult<FileMeta> {\n return null\n }\n async delete(): OperationMethodResult<FileMeta> {\n return null\n }\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/swagger'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/swagger'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: SchemaMapper\n}\n\nexport function parseTypeMeta(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([_name, schemas]) => {\n let name = _name\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n\n if (nameSchema) {\n name = nameSchema.args\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parseTypeMeta(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n\nexport function typeParser(schemas: Schema[], options: ParserOptions): string {\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!schemas.length) {\n return ''\n }\n\n const isNullish = schemas.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (schemas\n .map((schema) => parseTypeMeta(undefined, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: options.name,\n type: options.keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: options.keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(schemas, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: options.enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [options.description ? `@description ${transformers.jsStringEscape(options.description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/plugin.ts","../src/OperationGenerator.tsx","../src/typeParser.ts"],"sourcesContent":["import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Parser, File, useApp } from '@kubb/react'\nimport { Oas, Schema } from '@kubb/swagger/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/swagger/hooks'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/swagger'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype Props = {}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.response.name), undefined)\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.request.name), undefined)\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.pathParams.name), undefined)\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.queryParams.name), undefined)\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(schemas.headerParams.name), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n return factory.createTypeReferenceNode(factory.createIdentifier(error.name), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\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 function OperationSchema({}: Props): ReactNode {\n return <></>\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema: object, ...options }: OperationSchemaType, i: number) => {\n return (\n <Oas.Schema key={i} generator={generator} name={name} object={object}>\n {mode === 'split' && <Oas.Schema.Imports isTypeOnly />}\n <File.Source>\n <Oas.Schema.Source options={options} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema(factoryName, operation, schemas)}</File.Source>\n </File>\n </Parser>\n )\n}\n","import { App, createRoot } from '@kubb/react'\nimport { SchemaGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { pluginTsName } from './plugin.ts'\nimport { typeParser } from './typeParser.ts'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { SchemaGeneratorBuildOptions, SchemaMethodResult, Schema as SchemaType } from '@kubb/swagger'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, object: SchemaObject): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, mode, plugin, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema generator={this} name={name} object={object}>\n <Oas.Schema.File isTypeOnly output={output} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext\n getSource(name: string, schemas: SchemaType[], { keysToOmit, description }: SchemaGeneratorBuildOptions = {}): string[] {\n const texts: string[] = []\n\n const resolvedName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n const resolvedTypeName = this.context.pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const typeOutput = typeParser(schemas, {\n name: resolvedName,\n typeName: resolvedTypeName,\n description,\n enumType: this.options.enumType || 'asConst',\n optionalType: this.options.optionalType,\n keysToOmit,\n })\n\n texts.push(typeOutput)\n\n return texts\n }\n /**\n * @deprecated only used for testing\n */\n\n buildSource(name: string, schema: SchemaObject, options: SchemaGeneratorBuildOptions = {}): string[] {\n const schemas = this.buildSchemas({ schema, name })\n\n return this.getSource(name, schemas, options)\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginSwaggerName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginSwagger as SwaggerPluginOptions } from '@kubb/swagger'\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' },\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 } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\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 },\n pre: [pluginSwaggerName],\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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginSwaggerName])\n\n const oas = await swaggerPlugin.api.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.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { App, createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async get(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async post(): OperationMethodResult<FileMeta> {\n return null\n }\n\n async put(): OperationMethodResult<FileMeta> {\n return null\n }\n async patch(): OperationMethodResult<FileMeta> {\n return null\n }\n async delete(): OperationMethodResult<FileMeta> {\n return null\n }\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/swagger'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/swagger'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: SchemaMapper\n}\n\nexport function parseTypeMeta(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([_name, schemas]) => {\n let name = _name\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n\n if (nameSchema) {\n name = nameSchema.args\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parseTypeMeta(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n\nexport function typeParser(schemas: Schema[], options: ParserOptions): string {\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!schemas.length) {\n return ''\n }\n\n const isNullish = schemas.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (schemas\n .map((schema) => parseTypeMeta(undefined, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: options.name,\n type: options.keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: options.keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(schemas, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: options.enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [options.description ? `@description ${transformers.jsStringEscape(options.description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n"],"mappings":";AAAA,SAAS,QAAQ,MAAM,MAAM,cAAc;AAC3C,SAAS,cAAc;AAiBnB,mBAEE,KAFF;AAFJ,SAAS,SAAS,EAAE,MAAM,UAAU,IAAI,GAA6B;AACnE,SACE,iCACG;AAAA,oBAAgB,IAAI,MAAM,KAAK,UAAU,KAAK,QAAW,CAAC,CAAC;AAAA,IAC5D,oBAAC,QAAG;AAAA,IACJ,oBAAC,QAAK,MAAM,UAAU,QAAM,MACzB,0BAAgB,IAAI,KACvB;AAAA,KACF;AAEJ;AAEA,IAAM,mBAAmB,EAAE,SAAS,SAAS;AAWtC,SAAS,QAAQ,EAAE,MAAM,UAAU,UAAAA,YAAW,iBAAiB,QAAQ,GAAqB;AACjG,QAAM,MAAM,OAAO;AAEnB,SAAO,oBAACA,WAAA,EAAS,MAAY,UAAoB,KAAK,IAAI,KAAK;AACjE;AAWA,QAAQ,OAAO,SAAU,EAAE,MAAM,UAAU,YAAY,iBAAiB,GAAyB;AAC/F,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ,EAAE,KAAK,UAAU;AAAA,EAC3B,IAAI,OAAiB;AACrB,QAAM,OAAO,cAAc,QAAQ,EAAE,MAAM,SAAS,OAAO,UAAU,CAAC;AAEtE,QAAMA,YAAW,UAAU;AAE3B,SACE,oBAAC,UAAO,UAAS,cACf,+BAAC,QAAe,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,MAAM,KAAK,MACnE;AAAA,wBAAC,KAAK,QAAL,EAAY,MAAM,CAAC,OAAO,GAAG,MAAK,wBAAuB,YAAU,MAAC;AAAA,IACrE,oBAAC,KAAK,QAAL,EACC,8BAAC,WAAQ,UAAUA,W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,gBAAAJ,MAACK,KAAI,QAAJ,EAAmB,WAAsB,MAAY,QACnD;AAAA,eAAS,WAAW,gBAAAN,KAACM,KAAI,OAAO,SAAX,EAAmB,YAAU,MAAC;AAAA,MACpD,gBAAAN,KAACO,MAAK,QAAL,EACC,0BAAAP,KAACM,KAAI,OAAO,QAAX,EAAkB,SAAkB,GACvC;AAAA,SAJe,CAKjB;AAAA,EAEJ;AAEA,SACE,gBAAAN,KAACQ,SAAA,EAAO,UAAS,cACf,0BAAAP,MAACM,OAAA,EAAe,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,MAAM,KAAK,MAClE;AAAA,UAAM,IAAI,OAAO;AAAA,IAElB,gBAAAP,KAACO,MAAK,QAAL,EAAa,8BAAoB,aAAa,WAAW,OAAO,GAAE;AAAA,KACrE,GACF;AAEJ;","names":["Template","transformers","print","factory","Parser","File","useApp","Oas","useOas","App","createRoot","Generator","Oas","jsx","transformers","options","SchemaGenerator","node","jsx","Generator","createRoot","App","Oas","Fragment","jsx","jsxs","transformers","print","useApp","useOas","Oas","File","Parser"]}
|