@kubb/plugin-ts 4.19.2 → 4.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components-BgXQceYE.js.map +1 -1
- package/dist/components-ORNo_nJW.cjs.map +1 -1
- package/dist/components.d.cts +3 -3
- package/dist/components.d.ts +3 -3
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-C_985bgc.d.cts → types-D5kPiR9z.d.cts} +5 -5
- package/dist/{types-B3VHYzaa.d.ts → types-lBgQpKbj.d.ts} +5 -5
- package/package.json +7 -7
- package/src/components/Type.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-BgXQceYE.js","names":["modifiers","questionToken","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","name","schema","factory.createPropertySignature","factory.appendJSDocToNode","factory.createIndexSignature","factory.createTypeReferenceNode","factory.createIdentifier","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","name","factory.createEnumDeclaration"],"sources":["../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nexport function getUnknownType(unknownType: 'any' | 'unknown' | 'void' | undefined) {\n if (unknownType === 'any') {\n return keywordTypeNodes.any\n }\n if (unknownType === 'void') {\n return keywordTypeNodes.void\n }\n\n return keywordTypeNodes.unknown\n}\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n const isValid = isValidIdentifier(name)\n return isValid ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes, arrayType = 'array' }: { nodes: Array<ts.TypeNode>; arrayType?: 'array' | 'generic' }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n const node = nodes[0]\n if (!node) {\n return null\n }\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [node])\n }\n return factory.createArrayTypeNode(node)\n }\n\n // For union types (multiple nodes), respect arrayType preference\n const unionType = factory.createUnionTypeNode(nodes)\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [unionType])\n }\n // For array syntax with unions, we need parentheses: (string | number)[]\n return factory.createArrayTypeNode(factory.createParenthesizedType(unionType))\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // Use the node directly instead of spreading to avoid creating Unknown nodes\n // TypeScript's addSyntheticLeadingComment accepts the node as-is\n return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\n/**\n * Apply casing transformation to enum keys\n */\nfunction applyEnumKeyCasing(key: string, casing: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none' = 'none'): string {\n if (casing === 'none') {\n return key\n }\n if (casing === 'screamingSnakeCase') {\n return transformers.screamingSnakeCase(key)\n }\n if (casing === 'snakeCase') {\n return transformers.snakeCase(key)\n }\n if (casing === 'pascalCase') {\n return transformers.pascalCase(key)\n }\n if (casing === 'camelCase') {\n return transformers.camelCase(key)\n }\n return key\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n enumKeyCasing = 'none',\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n /**\n * Choose the casing for enum key names.\n * @default 'none'\n */\n enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal' || type === 'inlineLiteral') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n const casingKey = applyEnumKeyCasing(`${typeName}_${key}`, enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createPropertyAssignment(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n} as const\n\n/**\n * Converts a path like '/pet/{petId}/uploadImage' to a template literal type\n * like `/pet/${string}/uploadImage`\n */\nexport function createUrlTemplateType(path: string): ts.TypeNode {\n // If no parameters, return literal string type\n if (!path.includes('{')) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(path))\n }\n\n // Split path by parameter placeholders, e.g. '/pet/{petId}/upload' -> ['/pet/', 'petId', '/upload']\n const segments = path.split(/(\\{[^}]+\\})/)\n\n // Separate static parts from parameter placeholders\n const parts: string[] = []\n const parameterIndices: number[] = []\n\n segments.forEach((segment) => {\n if (segment.startsWith('{') && segment.endsWith('}')) {\n // This is a parameter placeholder\n parameterIndices.push(parts.length)\n parts.push(segment) // Will be replaced with ${string}\n } else if (segment) {\n // This is a static part\n parts.push(segment)\n }\n })\n\n // Build template literal type\n // Template literal structure: head + templateSpans[]\n // For '/pet/{petId}/upload': head = '/pet/', spans = [{ type: string, literal: '/upload' }]\n\n const head = ts.factory.createTemplateHead(parts[0] || '')\n const templateSpans: ts.TemplateLiteralTypeSpan[] = []\n\n parameterIndices.forEach((paramIndex, i) => {\n const isLast = i === parameterIndices.length - 1\n const nextPart = parts[paramIndex + 1] || ''\n\n const literal = isLast ? ts.factory.createTemplateTail(nextPart) : ts.factory.createTemplateMiddle(nextPart)\n\n templateSpans.push(ts.factory.createTemplateLiteralTypeSpan(keywordTypeNodes.string, literal))\n })\n\n return ts.factory.createTemplateLiteralType(head, templateSpans)\n}\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\nexport const createParenthesizedType = factory.createParenthesizedType\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\nexport const createIndexedAccessTypeNode = factory.createIndexedAccessTypeNode\nexport const createTypeOperatorNode = factory.createTypeOperatorNode\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\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[], arrayType?: 'array' | 'generic') => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes, arrayType })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\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 | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === '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: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\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: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: 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 interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'array'`\n */\n arrayType: 'array' | 'generic'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, `literal`, or `inlineLiteral` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * - `inlineLiteral`: inline enum values directly into the type (default in v5)\n * @default `'asConst'`\n * @note In Kubb v5, `inlineLiteral` becomes the default.\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n options.arrayType,\n )\n },\n enum(tree, options) {\n const { current } = tree\n\n // If enumType is 'inlineLiteral', generate the literal union inline instead of a type reference\n if (options.enumType === 'inlineLiteral') {\n const enumValues = current.args.items\n .map((item) => item.value)\n .filter((value): value is string | number | boolean => value !== undefined && value !== null)\n .map((value) => {\n const format = typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string'\n return typeKeywordMapper.const(value, format)\n })\n .filter(Boolean) as ts.TypeNode[]\n\n return typeKeywordMapper.union(enumValues)\n }\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob() {\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\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 const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return options.mapper[mappedName]\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 const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .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 propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : 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 let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n let additionalPropertiesType = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalPropertiesType = factory.createUnionDeclaration({\n nodes: [additionalPropertiesType, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n // When there are typed properties alongside additionalProperties, use 'unknown' type\n // for the index signature to avoid TS2411 errors (index signature type conflicts with property types).\n // This occurs commonly in QueryParams where some params are typed (enums, objects) and\n // others are dynamic (additionalProperties with explode=true).\n const hasTypedProperties = properties.length > 0\n const indexSignatureType = hasTypedProperties ? factory.keywordTypeNodes.unknown : additionalPropertiesType\n\n additionalProperties = factory.createIndexSignature(indexSignatureType)\n }\n\n let patternProperties: ts.TypeNode | ts.IndexSignatureDeclaration | undefined\n\n if (current.args?.patternProperties) {\n const allPatternSchemas = Object.values(current.args.patternProperties).flat()\n\n if (allPatternSchemas.length > 0) {\n patternProperties = allPatternSchemas\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = allPatternSchemas.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n patternProperties = factory.createUnionDeclaration({\n nodes: [patternProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n patternProperties = factory.createIndexSignature(patternProperties)\n }\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties, patternProperties].filter(Boolean))\n },\n datetime() {\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n tree,\n keysToOmit,\n schema,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumKeyCasing,\n mapper,\n description,\n}: Props): KubbNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n arrayType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n if (arrayType === 'generic') {\n type = factory.createTypeReferenceNode(factory.createIdentifier('Array'), [type])\n } else {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\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(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(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n 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 Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {safePrint(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'asPascalConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'asPascalConst', 'literal', undefined].includes(enumType)}\n >\n {safePrint(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {safePrint(...typeNodes)}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;AAKA,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MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,4CACG,qBACC,MAAM,KAAK,EAAE,cAAM,UAAU,UAAU,eACrC,4CACG,YACC,oBAAC,KAAK;EAAO,MAAMD;EAAM;EAAa;YACnC,UAAU,SAAS;GACR,EAGd,oBAAC,KAAK;EACJ,MAAM;EACN;EACA,cAAc;GAAC;GAAQ;GAAW;GAAiB;GAAa;GAAW;GAAU,CAAC,SAAS,SAAS;EACxG,YAAY;GAAC;GAAW;GAAiB;GAAW;GAAU,CAAC,SAAS,SAAS;YAEhF,UAAU,SAAS;GACR,IAEf,CACH,EACH,oBACC,oBAAC,KAAK;EAAO,MAAM;EAAW;EAAW;EAAa;YACnD,UAAU,GAAG,UAAU;GACZ,IAEf"}
|
|
1
|
+
{"version":3,"file":"components-BgXQceYE.js","names":["modifiers","questionToken","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","name","schema","factory.createPropertySignature","factory.appendJSDocToNode","factory.createIndexSignature","factory.createTypeReferenceNode","factory.createIdentifier","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","name","factory.createEnumDeclaration"],"sources":["../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nexport function getUnknownType(unknownType: 'any' | 'unknown' | 'void' | undefined) {\n if (unknownType === 'any') {\n return keywordTypeNodes.any\n }\n if (unknownType === 'void') {\n return keywordTypeNodes.void\n }\n\n return keywordTypeNodes.unknown\n}\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n const isValid = isValidIdentifier(name)\n return isValid ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes, arrayType = 'array' }: { nodes: Array<ts.TypeNode>; arrayType?: 'array' | 'generic' }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n const node = nodes[0]\n if (!node) {\n return null\n }\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [node])\n }\n return factory.createArrayTypeNode(node)\n }\n\n // For union types (multiple nodes), respect arrayType preference\n const unionType = factory.createUnionTypeNode(nodes)\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [unionType])\n }\n // For array syntax with unions, we need parentheses: (string | number)[]\n return factory.createArrayTypeNode(factory.createParenthesizedType(unionType))\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // Use the node directly instead of spreading to avoid creating Unknown nodes\n // TypeScript's addSyntheticLeadingComment accepts the node as-is\n return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\n/**\n * Apply casing transformation to enum keys\n */\nfunction applyEnumKeyCasing(key: string, casing: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none' = 'none'): string {\n if (casing === 'none') {\n return key\n }\n if (casing === 'screamingSnakeCase') {\n return transformers.screamingSnakeCase(key)\n }\n if (casing === 'snakeCase') {\n return transformers.snakeCase(key)\n }\n if (casing === 'pascalCase') {\n return transformers.pascalCase(key)\n }\n if (casing === 'camelCase') {\n return transformers.camelCase(key)\n }\n return key\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n enumKeyCasing = 'none',\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n /**\n * Choose the casing for enum key names.\n * @default 'none'\n */\n enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal' || type === 'inlineLiteral') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n const casingKey = applyEnumKeyCasing(`${typeName}_${key}`, enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createPropertyAssignment(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n} as const\n\n/**\n * Converts a path like '/pet/{petId}/uploadImage' to a template literal type\n * like `/pet/${string}/uploadImage`\n */\nexport function createUrlTemplateType(path: string): ts.TypeNode {\n // If no parameters, return literal string type\n if (!path.includes('{')) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(path))\n }\n\n // Split path by parameter placeholders, e.g. '/pet/{petId}/upload' -> ['/pet/', 'petId', '/upload']\n const segments = path.split(/(\\{[^}]+\\})/)\n\n // Separate static parts from parameter placeholders\n const parts: string[] = []\n const parameterIndices: number[] = []\n\n segments.forEach((segment) => {\n if (segment.startsWith('{') && segment.endsWith('}')) {\n // This is a parameter placeholder\n parameterIndices.push(parts.length)\n parts.push(segment) // Will be replaced with ${string}\n } else if (segment) {\n // This is a static part\n parts.push(segment)\n }\n })\n\n // Build template literal type\n // Template literal structure: head + templateSpans[]\n // For '/pet/{petId}/upload': head = '/pet/', spans = [{ type: string, literal: '/upload' }]\n\n const head = ts.factory.createTemplateHead(parts[0] || '')\n const templateSpans: ts.TemplateLiteralTypeSpan[] = []\n\n parameterIndices.forEach((paramIndex, i) => {\n const isLast = i === parameterIndices.length - 1\n const nextPart = parts[paramIndex + 1] || ''\n\n const literal = isLast ? ts.factory.createTemplateTail(nextPart) : ts.factory.createTemplateMiddle(nextPart)\n\n templateSpans.push(ts.factory.createTemplateLiteralTypeSpan(keywordTypeNodes.string, literal))\n })\n\n return ts.factory.createTemplateLiteralType(head, templateSpans)\n}\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\nexport const createParenthesizedType = factory.createParenthesizedType\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\nexport const createIndexedAccessTypeNode = factory.createIndexedAccessTypeNode\nexport const createTypeOperatorNode = factory.createTypeOperatorNode\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\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[], arrayType?: 'array' | 'generic') => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes, arrayType })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\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 | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === '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: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\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: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: 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 interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'array'`\n */\n arrayType: 'array' | 'generic'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, `literal`, or `inlineLiteral` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * - `inlineLiteral`: inline enum values directly into the type (default in v5)\n * @default `'asConst'`\n * @note In Kubb v5, `inlineLiteral` becomes the default.\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n options.arrayType,\n )\n },\n enum(tree, options) {\n const { current } = tree\n\n // If enumType is 'inlineLiteral', generate the literal union inline instead of a type reference\n if (options.enumType === 'inlineLiteral') {\n const enumValues = current.args.items\n .map((item) => item.value)\n .filter((value): value is string | number | boolean => value !== undefined && value !== null)\n .map((value) => {\n const format = typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string'\n return typeKeywordMapper.const(value, format)\n })\n .filter(Boolean) as ts.TypeNode[]\n\n return typeKeywordMapper.union(enumValues)\n }\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob() {\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\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 const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return options.mapper[mappedName]\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 const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .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 propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : 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 let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n let additionalPropertiesType = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalPropertiesType = factory.createUnionDeclaration({\n nodes: [additionalPropertiesType, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n // When there are typed properties alongside additionalProperties, use 'unknown' type\n // for the index signature to avoid TS2411 errors (index signature type conflicts with property types).\n // This occurs commonly in QueryParams where some params are typed (enums, objects) and\n // others are dynamic (additionalProperties with explode=true).\n const hasTypedProperties = properties.length > 0\n const indexSignatureType = hasTypedProperties ? factory.keywordTypeNodes.unknown : additionalPropertiesType\n\n additionalProperties = factory.createIndexSignature(indexSignatureType)\n }\n\n let patternProperties: ts.TypeNode | ts.IndexSignatureDeclaration | undefined\n\n if (current.args?.patternProperties) {\n const allPatternSchemas = Object.values(current.args.patternProperties).flat()\n\n if (allPatternSchemas.length > 0) {\n patternProperties = allPatternSchemas\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = allPatternSchemas.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n patternProperties = factory.createUnionDeclaration({\n nodes: [patternProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n patternProperties = factory.createIndexSignature(patternProperties)\n }\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties, patternProperties].filter(Boolean))\n },\n datetime() {\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n tree,\n keysToOmit,\n schema,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumKeyCasing,\n mapper,\n description,\n}: Props): FabricReactNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n arrayType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n if (arrayType === 'generic') {\n type = factory.createTypeReferenceNode(factory.createIdentifier('Array'), [type])\n } else {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\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(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(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n 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 Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {safePrint(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'asPascalConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'asPascalConst', 'literal', undefined].includes(enumType)}\n >\n {safePrint(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {safePrint(...typeNod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N;GACD,CAAC;AAEF,SAAO;GACL;GACA;GACA;GACA;GACD;GACD;CAGF,MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,4CACG,qBACC,MAAM,KAAK,EAAE,cAAM,UAAU,UAAU,eACrC,4CACG,YACC,oBAAC,KAAK;EAAO,MAAMD;EAAM;EAAa;YACnC,UAAU,SAAS;GACR,EAGd,oBAAC,KAAK;EACJ,MAAM;EACN;EACA,cAAc;GAAC;GAAQ;GAAW;GAAiB;GAAa;GAAW;GAAU,CAAC,SAAS,SAAS;EACxG,YAAY;GAAC;GAAW;GAAiB;GAAW;GAAU,CAAC,SAAS,SAAS;YAEhF,UAAU,SAAS;GACR,IAEf,CACH,EACH,oBACC,oBAAC,KAAK;EAAO,MAAM;EAAW;EAAW;EAAa;YACnD,UAAU,GAAG,UAAU;GACZ,IAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-ORNo_nJW.cjs","names":["ts","modifiers","questionToken","transformers","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","name","schema","schemaKeywords","factory.createPropertySignature","factory.appendJSDocToNode","transformers","factory.createIndexSignature","schemaKeywords","SchemaGenerator","factory.createTypeReferenceNode","factory.createIdentifier","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","transformers","name","factory.createEnumDeclaration","File"],"sources":["../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nexport function getUnknownType(unknownType: 'any' | 'unknown' | 'void' | undefined) {\n if (unknownType === 'any') {\n return keywordTypeNodes.any\n }\n if (unknownType === 'void') {\n return keywordTypeNodes.void\n }\n\n return keywordTypeNodes.unknown\n}\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n const isValid = isValidIdentifier(name)\n return isValid ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes, arrayType = 'array' }: { nodes: Array<ts.TypeNode>; arrayType?: 'array' | 'generic' }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n const node = nodes[0]\n if (!node) {\n return null\n }\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [node])\n }\n return factory.createArrayTypeNode(node)\n }\n\n // For union types (multiple nodes), respect arrayType preference\n const unionType = factory.createUnionTypeNode(nodes)\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [unionType])\n }\n // For array syntax with unions, we need parentheses: (string | number)[]\n return factory.createArrayTypeNode(factory.createParenthesizedType(unionType))\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // Use the node directly instead of spreading to avoid creating Unknown nodes\n // TypeScript's addSyntheticLeadingComment accepts the node as-is\n return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\n/**\n * Apply casing transformation to enum keys\n */\nfunction applyEnumKeyCasing(key: string, casing: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none' = 'none'): string {\n if (casing === 'none') {\n return key\n }\n if (casing === 'screamingSnakeCase') {\n return transformers.screamingSnakeCase(key)\n }\n if (casing === 'snakeCase') {\n return transformers.snakeCase(key)\n }\n if (casing === 'pascalCase') {\n return transformers.pascalCase(key)\n }\n if (casing === 'camelCase') {\n return transformers.camelCase(key)\n }\n return key\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n enumKeyCasing = 'none',\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n /**\n * Choose the casing for enum key names.\n * @default 'none'\n */\n enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal' || type === 'inlineLiteral') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n const casingKey = applyEnumKeyCasing(`${typeName}_${key}`, enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createPropertyAssignment(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n} as const\n\n/**\n * Converts a path like '/pet/{petId}/uploadImage' to a template literal type\n * like `/pet/${string}/uploadImage`\n */\nexport function createUrlTemplateType(path: string): ts.TypeNode {\n // If no parameters, return literal string type\n if (!path.includes('{')) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(path))\n }\n\n // Split path by parameter placeholders, e.g. '/pet/{petId}/upload' -> ['/pet/', 'petId', '/upload']\n const segments = path.split(/(\\{[^}]+\\})/)\n\n // Separate static parts from parameter placeholders\n const parts: string[] = []\n const parameterIndices: number[] = []\n\n segments.forEach((segment) => {\n if (segment.startsWith('{') && segment.endsWith('}')) {\n // This is a parameter placeholder\n parameterIndices.push(parts.length)\n parts.push(segment) // Will be replaced with ${string}\n } else if (segment) {\n // This is a static part\n parts.push(segment)\n }\n })\n\n // Build template literal type\n // Template literal structure: head + templateSpans[]\n // For '/pet/{petId}/upload': head = '/pet/', spans = [{ type: string, literal: '/upload' }]\n\n const head = ts.factory.createTemplateHead(parts[0] || '')\n const templateSpans: ts.TemplateLiteralTypeSpan[] = []\n\n parameterIndices.forEach((paramIndex, i) => {\n const isLast = i === parameterIndices.length - 1\n const nextPart = parts[paramIndex + 1] || ''\n\n const literal = isLast ? ts.factory.createTemplateTail(nextPart) : ts.factory.createTemplateMiddle(nextPart)\n\n templateSpans.push(ts.factory.createTemplateLiteralTypeSpan(keywordTypeNodes.string, literal))\n })\n\n return ts.factory.createTemplateLiteralType(head, templateSpans)\n}\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\nexport const createParenthesizedType = factory.createParenthesizedType\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\nexport const createIndexedAccessTypeNode = factory.createIndexedAccessTypeNode\nexport const createTypeOperatorNode = factory.createTypeOperatorNode\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\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[], arrayType?: 'array' | 'generic') => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes, arrayType })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\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 | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === '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: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\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: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: 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 interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'array'`\n */\n arrayType: 'array' | 'generic'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, `literal`, or `inlineLiteral` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * - `inlineLiteral`: inline enum values directly into the type (default in v5)\n * @default `'asConst'`\n * @note In Kubb v5, `inlineLiteral` becomes the default.\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n options.arrayType,\n )\n },\n enum(tree, options) {\n const { current } = tree\n\n // If enumType is 'inlineLiteral', generate the literal union inline instead of a type reference\n if (options.enumType === 'inlineLiteral') {\n const enumValues = current.args.items\n .map((item) => item.value)\n .filter((value): value is string | number | boolean => value !== undefined && value !== null)\n .map((value) => {\n const format = typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string'\n return typeKeywordMapper.const(value, format)\n })\n .filter(Boolean) as ts.TypeNode[]\n\n return typeKeywordMapper.union(enumValues)\n }\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob() {\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\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 const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return options.mapper[mappedName]\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 const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .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 propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : 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 let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n let additionalPropertiesType = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalPropertiesType = factory.createUnionDeclaration({\n nodes: [additionalPropertiesType, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n // When there are typed properties alongside additionalProperties, use 'unknown' type\n // for the index signature to avoid TS2411 errors (index signature type conflicts with property types).\n // This occurs commonly in QueryParams where some params are typed (enums, objects) and\n // others are dynamic (additionalProperties with explode=true).\n const hasTypedProperties = properties.length > 0\n const indexSignatureType = hasTypedProperties ? factory.keywordTypeNodes.unknown : additionalPropertiesType\n\n additionalProperties = factory.createIndexSignature(indexSignatureType)\n }\n\n let patternProperties: ts.TypeNode | ts.IndexSignatureDeclaration | undefined\n\n if (current.args?.patternProperties) {\n const allPatternSchemas = Object.values(current.args.patternProperties).flat()\n\n if (allPatternSchemas.length > 0) {\n patternProperties = allPatternSchemas\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = allPatternSchemas.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n patternProperties = factory.createUnionDeclaration({\n nodes: [patternProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n patternProperties = factory.createIndexSignature(patternProperties)\n }\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties, patternProperties].filter(Boolean))\n },\n datetime() {\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n tree,\n keysToOmit,\n schema,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumKeyCasing,\n mapper,\n description,\n}: Props): KubbNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n arrayType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n if (arrayType === 'generic') {\n type = factory.createTypeReferenceNode(factory.createIdentifier('Array'), [type])\n } else {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\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(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(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n 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 Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {safePrint(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'asPascalConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'asPascalConst', 'literal', undefined].includes(enumType)}\n >\n {safePrint(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {safePrint(...typeNodes)}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,EAAE,YAAY,YAAYA;AAIhC,MAAa,YAAY;CACvB,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC3D,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC5D;AAED,MAAa,aAAa,EACxB,OAAO,WAAW,WACnB;AAED,SAAgB,eAAe,aAAqD;AAClF,KAAI,gBAAgB,MAClB,QAAO,iBAAiB;AAE1B,KAAI,gBAAgB,OAClB,QAAO,iBAAiB;AAG1B,QAAO,iBAAiB;;AAE1B,SAAS,kBAAkB,KAAsB;AAC/C,KAAI,CAAC,IAAI,UAAU,IAAI,MAAM,KAAK,IAChC,QAAO;CAET,MAAM,OAAOA,mBAAG,wBAAwB,KAAKA,mBAAG,aAAa,OAAO;AAEpE,QAAO,CAAC,CAAC,QAAQ,KAAK,SAASA,mBAAG,WAAW,cAAcA,mBAAG,wBAAwB,KAAK,KAAiC,KAAK;;AAGnI,SAAS,aAAa,MAAiD;AACrE,KAAI,OAAO,SAAS,SAElB,QADgB,kBAAkB,KAAK,GACtB,QAAQ,iBAAiB,KAAK,GAAG,QAAQ,oBAAoB,KAAK;AAErF,QAAO;;AAGT,MAAM,gBAAgB,QAAQ,YAAYA,mBAAG,WAAW,cAAc;AAEtE,SAAgB,oBAAoB,OAAoC;AACtE,KAAI,CAAC,MACH;AAEF,KAAI,UAAU,KACZ,QAAO;AAET,QAAO;;AAGT,SAAgB,8BAA8B,EAAE,OAAO,mBAAiG;AACt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EACxI,MAAM,WAAW,aAAa,YAAY,GAAG,WAAW,KAAK,SAAS,OAAO,WAAW,KAAK;EAE7F,MAAM,CAAC,UAAU,YAAYE,sBAA8B;GACzD;GACA;GACA,OAAO,WAAW,KAAK,MACpB,KAAK,SAAU,KAAK,UAAU,SAAY,SAAY,CAACF,gCAAa,WAAW,KAAK,MAAM,UAAU,CAAC,EAAE,KAAK,MAAM,CAAE,CACpH,OAAO,QAAQ;GAClB,MAAM;GACN;GACD,CAAC;AAEF,SAAO;GACL;GACA;GACA;GACA;GACD;GACD;CAGF,MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,+GACG,qBACC,MAAM,KAAK,EAAE,cAAM,UAAU,UAAU,eACrC,+GACG,YACC,wDAACG,wBAAK;EAAO,MAAMF;EAAM;EAAa;gEACzB,SAAS;GACR,EAGd,wDAACE,wBAAK;EACJ,MAAM;EACN;EACA,cAAc;GAAC;GAAQ;GAAW;GAAiB;GAAa;GAAW;GAAU,CAAC,SAAS,SAAS;EACxG,YAAY;GAAC;GAAW;GAAiB;GAAW;GAAU,CAAC,SAAS,SAAS;gEAEtE,SAAS;GACR,IAEf,CACH,EACH,oBACC,wDAACA,wBAAK;EAAO,MAAM;EAAW;EAAW;EAAa;gEACzC,GAAG,UAAU;GACZ,IAEf"}
|
|
1
|
+
{"version":3,"file":"components-ORNo_nJW.cjs","names":["ts","modifiers","questionToken","transformers","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","name","schema","schemaKeywords","factory.createPropertySignature","factory.appendJSDocToNode","transformers","factory.createIndexSignature","schemaKeywords","SchemaGenerator","factory.createTypeReferenceNode","factory.createIdentifier","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","transformers","name","factory.createEnumDeclaration","File"],"sources":["../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nexport function getUnknownType(unknownType: 'any' | 'unknown' | 'void' | undefined) {\n if (unknownType === 'any') {\n return keywordTypeNodes.any\n }\n if (unknownType === 'void') {\n return keywordTypeNodes.void\n }\n\n return keywordTypeNodes.unknown\n}\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n const isValid = isValidIdentifier(name)\n return isValid ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes, arrayType = 'array' }: { nodes: Array<ts.TypeNode>; arrayType?: 'array' | 'generic' }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n const node = nodes[0]\n if (!node) {\n return null\n }\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [node])\n }\n return factory.createArrayTypeNode(node)\n }\n\n // For union types (multiple nodes), respect arrayType preference\n const unionType = factory.createUnionTypeNode(nodes)\n if (arrayType === 'generic') {\n return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [unionType])\n }\n // For array syntax with unions, we need parentheses: (string | number)[]\n return factory.createArrayTypeNode(factory.createParenthesizedType(unionType))\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // Use the node directly instead of spreading to avoid creating Unknown nodes\n // TypeScript's addSyntheticLeadingComment accepts the node as-is\n return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\n/**\n * Apply casing transformation to enum keys\n */\nfunction applyEnumKeyCasing(key: string, casing: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none' = 'none'): string {\n if (casing === 'none') {\n return key\n }\n if (casing === 'screamingSnakeCase') {\n return transformers.screamingSnakeCase(key)\n }\n if (casing === 'snakeCase') {\n return transformers.snakeCase(key)\n }\n if (casing === 'pascalCase') {\n return transformers.pascalCase(key)\n }\n if (casing === 'camelCase') {\n return transformers.camelCase(key)\n }\n return key\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n enumKeyCasing = 'none',\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n /**\n * Choose the casing for enum key names.\n * @default 'none'\n */\n enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal' || type === 'inlineLiteral') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n const casingKey = applyEnumKeyCasing(`${typeName}_${key}`, enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createEnumMember(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n return factory.createPropertyAssignment(propertyName(casingKey), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n} as const\n\n/**\n * Converts a path like '/pet/{petId}/uploadImage' to a template literal type\n * like `/pet/${string}/uploadImage`\n */\nexport function createUrlTemplateType(path: string): ts.TypeNode {\n // If no parameters, return literal string type\n if (!path.includes('{')) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(path))\n }\n\n // Split path by parameter placeholders, e.g. '/pet/{petId}/upload' -> ['/pet/', 'petId', '/upload']\n const segments = path.split(/(\\{[^}]+\\})/)\n\n // Separate static parts from parameter placeholders\n const parts: string[] = []\n const parameterIndices: number[] = []\n\n segments.forEach((segment) => {\n if (segment.startsWith('{') && segment.endsWith('}')) {\n // This is a parameter placeholder\n parameterIndices.push(parts.length)\n parts.push(segment) // Will be replaced with ${string}\n } else if (segment) {\n // This is a static part\n parts.push(segment)\n }\n })\n\n // Build template literal type\n // Template literal structure: head + templateSpans[]\n // For '/pet/{petId}/upload': head = '/pet/', spans = [{ type: string, literal: '/upload' }]\n\n const head = ts.factory.createTemplateHead(parts[0] || '')\n const templateSpans: ts.TemplateLiteralTypeSpan[] = []\n\n parameterIndices.forEach((paramIndex, i) => {\n const isLast = i === parameterIndices.length - 1\n const nextPart = parts[paramIndex + 1] || ''\n\n const literal = isLast ? ts.factory.createTemplateTail(nextPart) : ts.factory.createTemplateMiddle(nextPart)\n\n templateSpans.push(ts.factory.createTemplateLiteralTypeSpan(keywordTypeNodes.string, literal))\n })\n\n return ts.factory.createTemplateLiteralType(head, templateSpans)\n}\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\nexport const createParenthesizedType = factory.createParenthesizedType\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\nexport const createIndexedAccessTypeNode = factory.createIndexedAccessTypeNode\nexport const createTypeOperatorNode = factory.createTypeOperatorNode\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\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[], arrayType?: 'array' | 'generic') => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes, arrayType })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\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 | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === '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: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\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: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: 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 interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'array'`\n */\n arrayType: 'array' | 'generic'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, `literal`, or `inlineLiteral` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * - `inlineLiteral`: inline enum values directly into the type (default in v5)\n * @default `'asConst'`\n * @note In Kubb v5, `inlineLiteral` becomes the default.\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n options.arrayType,\n )\n },\n enum(tree, options) {\n const { current } = tree\n\n // If enumType is 'inlineLiteral', generate the literal union inline instead of a type reference\n if (options.enumType === 'inlineLiteral') {\n const enumValues = current.args.items\n .map((item) => item.value)\n .filter((value): value is string | number | boolean => value !== undefined && value !== null)\n .map((value) => {\n const format = typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string'\n return typeKeywordMapper.const(value, format)\n })\n .filter(Boolean) as ts.TypeNode[]\n\n return typeKeywordMapper.union(enumValues)\n }\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob() {\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\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 const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return options.mapper[mappedName]\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 const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .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 propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : 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 let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n let additionalPropertiesType = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalPropertiesType = factory.createUnionDeclaration({\n nodes: [additionalPropertiesType, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n // When there are typed properties alongside additionalProperties, use 'unknown' type\n // for the index signature to avoid TS2411 errors (index signature type conflicts with property types).\n // This occurs commonly in QueryParams where some params are typed (enums, objects) and\n // others are dynamic (additionalProperties with explode=true).\n const hasTypedProperties = properties.length > 0\n const indexSignatureType = hasTypedProperties ? factory.keywordTypeNodes.unknown : additionalPropertiesType\n\n additionalProperties = factory.createIndexSignature(indexSignatureType)\n }\n\n let patternProperties: ts.TypeNode | ts.IndexSignatureDeclaration | undefined\n\n if (current.args?.patternProperties) {\n const allPatternSchemas = Object.values(current.args.patternProperties).flat()\n\n if (allPatternSchemas.length > 0) {\n patternProperties = allPatternSchemas\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = allPatternSchemas.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n patternProperties = factory.createUnionDeclaration({\n nodes: [patternProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n patternProperties = factory.createIndexSignature(patternProperties)\n }\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties, patternProperties].filter(Boolean))\n },\n datetime() {\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n tree,\n keysToOmit,\n schema,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumKeyCasing,\n mapper,\n description,\n}: Props): FabricReactNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n arrayType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n if (arrayType === 'generic') {\n type = factory.createTypeReferenceNode(factory.createIdentifier('Array'), [type])\n } else {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\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(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(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n 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 Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {safePrint(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'asPascalConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'asPascalConst', 'literal', undefined].includes(enumType)}\n >\n {safePrint(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {safePrint(...typeNodes)}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,EAAE,YAAY,YAAYA;AAIhC,MAAa,YAAY;CACvB,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC3D,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC5D;AAED,MAAa,aAAa,EACxB,OAAO,WAAW,WACnB;AAED,SAAgB,eAAe,aAAqD;AAClF,KAAI,gBAAgB,MAClB,QAAO,iBAAiB;AAE1B,KAAI,gBAAgB,OAClB,QAAO,iBAAiB;AAG1B,QAAO,iBAAiB;;AAE1B,SAAS,kBAAkB,KAAsB;AAC/C,KAAI,CAAC,IAAI,UAAU,IAAI,MAAM,KAAK,IAChC,QAAO;CAET,MAAM,OAAOA,mBAAG,wBAAwB,KAAKA,mBAAG,aAAa,OAAO;AAEpE,QAAO,CAAC,CAAC,QAAQ,KAAK,SAASA,mBAAG,WAAW,cAAcA,mBAAG,wBAAwB,KAAK,KAAiC,KAAK;;AAGnI,SAAS,aAAa,MAAiD;AACrE,KAAI,OAAO,SAAS,SAElB,QADgB,kBAAkB,KAAK,G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O,UAAU,YAAY,OAAO,YAAY;GAChD,OAAO,UAAU,YAAY,OAAO,YAAY;GACjD;EACF,CAAC,CACH;CAED,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,YAAY,CAAC,CAAC,KAAK,eAAe;EAC1D,MAAMC,SAAO,aAAa,kBAAkBD,gCAAa,WAAW,WAAW,KAAK,KAAK,GAAGA,gCAAa,UAAU,WAAW,KAAK,KAAK;EACxI,MAAM,WAAW,aAAa,YAAY,GAAG,WAAW,KAAK,SAAS,OAAO,WAAW,KAAK;EAE7F,MAAM,CAAC,UAAU,YAAYE,sBAA8B;GACzD;GACA;GACA,OAAO,WAAW,KAAK,MACpB,KAAK,SAAU,KAAK,UAAU,SAAY,SAAY,CAACF,gCAAa,WAAW,KAAK,MAAM,UAAU,CAAC,EAAE,KAAK,MAAM,CAAE,CACpH,OAAO,QAAQ;GAClB,MAAM;GACN;GACD,CAAC;AAEF,SAAO;GACL;GACA;GACA;GACA;GACD;GACD;CAGF,MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,+GACG,qBACC,MAAM,KAAK,EAAE,cAAM,UAAU,UAAU,eACrC,+GACG,YACC,wDAACG,wBAAK;EAAO,MAAMF;EAAM;EAAa;gEACzB,SAAS;GACR,EAGd,wDAACE,wBAAK;EACJ,MAAM;EACN;EACA,cAAc;GAAC;GAAQ;GAAW;GAAiB;GAAa;GAAW;GAAU,CAAC,SAAS,SAAS;EACxG,YAAY;GAAC;GAAW;GAAiB;GAAW;GAAU,CAAC,SAAS,SAAS;gEAEtE,SAAS;GACR,IAEf,CACH,EACH,oBACC,wDAACA,wBAAK;EAAO,MAAM;EAAW;EAAW;EAAa;gEACzC,GAAG,UAAU;GACZ,IAEf"}
|
package/dist/components.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Schema, n as PluginTs, o as SchemaObject, s as __name } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { i as Schema, n as PluginTs, o as SchemaObject, s as __name } from "./types-D5kPiR9z.cjs";
|
|
2
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Type.d.ts
|
|
5
5
|
type Props = {
|
|
@@ -29,7 +29,7 @@ declare function Type({
|
|
|
29
29
|
enumKeyCasing,
|
|
30
30
|
mapper,
|
|
31
31
|
description
|
|
32
|
-
}: Props):
|
|
32
|
+
}: Props): FabricReactNode;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { Type };
|
|
35
35
|
//# sourceMappingURL=components.d.cts.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { i as Schema, n as PluginTs, o as SchemaObject } from "./types-
|
|
3
|
-
import {
|
|
2
|
+
import { i as Schema, n as PluginTs, o as SchemaObject } from "./types-lBgQpKbj.js";
|
|
3
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Type.d.ts
|
|
6
6
|
type Props = {
|
|
@@ -30,7 +30,7 @@ declare function Type({
|
|
|
30
30
|
enumKeyCasing,
|
|
31
31
|
mapper,
|
|
32
32
|
description
|
|
33
|
-
}: Props):
|
|
33
|
+
}: Props): FabricReactNode;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { Type };
|
|
36
36
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginTs, r as ReactGenerator, s as __name } from "./types-
|
|
1
|
+
import { n as PluginTs, r as ReactGenerator, s as __name } from "./types-D5kPiR9z.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/typeGenerator.d.ts
|
|
4
4
|
declare const typeGenerator: ReactGenerator<PluginTs>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginTs, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginTs, r as ReactGenerator } from "./types-lBgQpKbj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/typeGenerator.d.ts
|
|
5
5
|
declare const typeGenerator: ReactGenerator<PluginTs>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginTs, s as __name, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginTs, s as __name, t as Options } from "./types-D5kPiR9z.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginTsName = "plugin-ts";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { a as UserPluginWithLifeCycle, n as PluginTs, t as Options } from "./types-
|
|
2
|
+
import { a as UserPluginWithLifeCycle, n as PluginTs, t as Options } from "./types-lBgQpKbj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginTsName = "plugin-ts";
|
|
@@ -4,7 +4,7 @@ import { Operation } from "oas/operation";
|
|
|
4
4
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
5
5
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
6
6
|
import { Fabric } from "@kubb/react-fabric";
|
|
7
|
-
import {
|
|
7
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
8
8
|
import ts from "typescript";
|
|
9
9
|
|
|
10
10
|
//#region rolldown:runtime
|
|
@@ -1166,9 +1166,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1166
1166
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1167
1167
|
name: string;
|
|
1168
1168
|
type: 'react';
|
|
1169
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1170
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1171
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1169
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1170
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1171
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1172
1172
|
};
|
|
1173
1173
|
//#endregion
|
|
1174
1174
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1350,4 +1350,4 @@ type ResolvedOptions = {
|
|
|
1350
1350
|
type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1351
1351
|
//#endregion
|
|
1352
1352
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginTs as n, SchemaObject$1 as o, ReactGenerator as r, __name as s, Options as t };
|
|
1353
|
-
//# sourceMappingURL=types-
|
|
1353
|
+
//# sourceMappingURL=types-D5kPiR9z.d.cts.map
|
|
@@ -6,7 +6,7 @@ import BaseOas from "oas";
|
|
|
6
6
|
import { Operation } from "oas/operation";
|
|
7
7
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
8
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
|
-
import {
|
|
9
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
10
10
|
|
|
11
11
|
//#region ../oas/src/types.d.ts
|
|
12
12
|
type contentType = 'application/json' | (string & {});
|
|
@@ -1165,9 +1165,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1165
1165
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1166
1166
|
name: string;
|
|
1167
1167
|
type: 'react';
|
|
1168
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1169
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1170
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1168
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1169
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1170
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1171
1171
|
};
|
|
1172
1172
|
//#endregion
|
|
1173
1173
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1349,4 +1349,4 @@ type ResolvedOptions = {
|
|
|
1349
1349
|
type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1350
1350
|
//#endregion
|
|
1351
1351
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginTs as n, SchemaObject$1 as o, ReactGenerator as r, Options as t };
|
|
1352
|
-
//# sourceMappingURL=types-
|
|
1352
|
+
//# sourceMappingURL=types-lBgQpKbj.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.0",
|
|
4
4
|
"description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@kubb/fabric-core": "0.12.
|
|
68
|
-
"@kubb/react-fabric": "0.12.
|
|
67
|
+
"@kubb/fabric-core": "0.12.7",
|
|
68
|
+
"@kubb/react-fabric": "0.12.7",
|
|
69
69
|
"natural-orderby": "^5.0.0",
|
|
70
70
|
"remeda": "^2.33.4",
|
|
71
71
|
"typescript": "5.9.3",
|
|
72
|
-
"@kubb/
|
|
73
|
-
"@kubb/oas": "4.
|
|
74
|
-
"@kubb/
|
|
72
|
+
"@kubb/oas": "4.20.0",
|
|
73
|
+
"@kubb/plugin-oas": "4.20.0",
|
|
74
|
+
"@kubb/core": "4.20.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@kubb/react-fabric": "0.12.
|
|
77
|
+
"@kubb/react-fabric": "0.12.7",
|
|
78
78
|
"typescript": ">=5.9.0"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
package/src/components/Type.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { safePrint } from '@kubb/fabric-core/parsers/typescript'
|
|
|
3
3
|
import type { SchemaObject } from '@kubb/oas'
|
|
4
4
|
import { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'
|
|
5
5
|
import { File } from '@kubb/react-fabric'
|
|
6
|
-
import type {
|
|
6
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
7
7
|
import type ts from 'typescript'
|
|
8
8
|
import * as factory from '../factory.ts'
|
|
9
9
|
import { parse, typeKeywordMapper } from '../parser.ts'
|
|
@@ -37,7 +37,7 @@ export function Type({
|
|
|
37
37
|
enumKeyCasing,
|
|
38
38
|
mapper,
|
|
39
39
|
description,
|
|
40
|
-
}: Props):
|
|
40
|
+
}: Props): FabricReactNode {
|
|
41
41
|
const typeNodes: ts.Node[] = []
|
|
42
42
|
|
|
43
43
|
if (!tree.length) {
|