@kubb/plugin-ts 5.0.0-alpha.7 → 5.0.0-alpha.9
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.d.ts +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +31 -2
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.ts +41 -2
- package/dist/index.js +2 -2
- package/dist/{plugin-DVhVzwDg.js → plugin-BZkBwnEA.js} +108 -71
- package/dist/plugin-BZkBwnEA.js.map +1 -0
- package/dist/{plugin-Cn85VLXR.cjs → plugin-Bunz1oGa.cjs} +112 -69
- package/dist/plugin-Bunz1oGa.cjs.map +1 -0
- package/dist/{types-CsvB6X5Y.d.ts → types-mSXmB8WU.d.ts} +134 -3
- package/package.json +5 -5
- package/src/constants.ts +5 -5
- package/src/generators/v2/typeGenerator.tsx +26 -30
- package/src/generators/v2/utils.ts +4 -4
- package/src/index.ts +1 -0
- package/src/plugin.ts +7 -6
- package/src/printer.ts +1 -1
- package/src/resolverTs.ts +77 -0
- package/src/types.ts +134 -2
- package/dist/plugin-Cn85VLXR.cjs.map +0 -1
- package/dist/plugin-DVhVzwDg.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-BZkBwnEA.js","names":["factory.createUnionDeclaration","factory.createTypeReferenceNode","factory.createIdentifier","factory.createTypeAliasDeclaration","factory.createTypeLiteralNode","factory.createPropertySignature","factory.createIndexedAccessTypeNode","factory.createTypeOperatorNode","typeGenerator","applyParamsCasing","Type","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createPrefixUnaryExpression","factory.createNumericLiteral","factory.createStringLiteral","factory.createTypeReferenceNode","factory.createIdentifier","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createUnionDeclaration","factory.createIndexSignature","factory.createUrlTemplateType","factory.createIntersectionDeclaration","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createPropertySignature","factory.appendJSDocToNode","factory.createTypeDeclaration","factory.createOmitDeclaration","factory.createEnumDeclaration","typeGenerator","typeGeneratorV2"],"sources":["../../../internals/utils/src/object.ts","../src/generators/typeGenerator.tsx","../src/constants.ts","../src/printer.ts","../src/components/v2/Enum.tsx","../src/components/v2/Type.tsx","../src/resolverTs.ts","../src/generators/v2/utils.ts","../src/generators/v2/typeGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Serializes plugin options for safe JSON transport.\n * Strips functions, symbols, and `undefined` values recursively.\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | undefined {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return undefined\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { pascalCase } from '@internals/utils'\nimport type { PluginDriver } from '@kubb/core'\nimport { useMode, usePluginDriver } from '@kubb/core/hooks'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport type { Operation } from '@kubb/oas'\nimport { isKeyword, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport ts from 'typescript'\nimport { Type } from '../components'\nimport * as factory from '../factory.ts'\nimport { createUrlTemplateType, getUnknownType, keywordTypeNodes } from '../factory.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types'\n\nfunction printCombinedSchema({ name, schemas, driver }: { name: string; schemas: OperationSchemas; driver: PluginDriver }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createUnionDeclaration({\n nodes: schemas.responses.map((res) => {\n const identifier = driver.resolveName({\n name: res.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n if (schemas.request) {\n const identifier = driver.resolveName({\n name: schemas.request.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = driver.resolveName({\n name: schemas.pathParams.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = driver.resolveName({\n name: schemas.queryParams.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = driver.resolveName({\n name: schemas.headerParams.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = driver.resolveName({\n name: error.name,\n pluginName: pluginTsName,\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return safePrint(namespaceNode)\n}\n\nfunction printRequestSchema({\n baseName,\n operation,\n schemas,\n driver,\n}: {\n baseName: string\n operation: Operation\n schemas: OperationSchemas\n driver: PluginDriver\n}): string {\n const name = driver.resolveName({\n name: `${baseName} Request`,\n pluginName: pluginTsName,\n type: 'type',\n })\n\n const results: string[] = []\n\n // Generate DataRequest type\n const dataRequestProperties: ts.PropertySignature[] = []\n\n if (schemas.request) {\n const identifier = driver.resolveName({\n name: schemas.request.name,\n pluginName: pluginTsName,\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'data',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'data',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add pathParams property\n if (schemas.pathParams) {\n const identifier = driver.resolveName({\n name: schemas.pathParams.name,\n pluginName: pluginTsName,\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'pathParams',\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'pathParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add queryParams property\n if (schemas.queryParams) {\n const identifier = driver.resolveName({\n name: schemas.queryParams.name,\n pluginName: pluginTsName,\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'queryParams',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'queryParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add headerParams property\n if (schemas.headerParams) {\n const identifier = driver.resolveName({\n name: schemas.headerParams.name,\n pluginName: pluginTsName,\n type: 'type',\n })\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'headerParams',\n questionToken: true,\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n }),\n )\n } else {\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'headerParams',\n questionToken: true,\n type: keywordTypeNodes.never,\n }),\n )\n }\n\n // Add url property with template literal type\n dataRequestProperties.push(\n factory.createPropertySignature({\n name: 'url',\n type: createUrlTemplateType(operation.path),\n }),\n )\n\n const dataRequestNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(dataRequestProperties),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(dataRequestNode))\n\n return results.join('\\n\\n')\n}\n\nfunction printResponseSchema({\n baseName,\n schemas,\n driver,\n unknownType,\n}: {\n baseName: string\n schemas: OperationSchemas\n driver: PluginDriver\n unknownType: PluginTs['resolvedOptions']['unknownType']\n}): string {\n const results: string[] = []\n\n const name = driver.resolveName({\n name: `${baseName} ResponseData`,\n pluginName: pluginTsName,\n type: 'type',\n })\n\n // Generate Responses type (mapping status codes to response types)\n if (schemas.responses && schemas.responses.length > 0) {\n const responsesProperties: ts.PropertySignature[] = schemas.responses.map((res) => {\n const identifier = driver.resolveName({\n name: res.name,\n pluginName: pluginTsName,\n type: 'type',\n })\n\n return factory.createPropertySignature({\n name: res.statusCode?.toString() ?? 'default',\n type: factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined),\n })\n })\n\n const responsesNode = factory.createTypeAliasDeclaration({\n name: `${baseName}Responses`,\n type: factory.createTypeLiteralNode(responsesProperties),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(responsesNode))\n\n // Generate Response type (union via indexed access)\n const responseNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createIndexedAccessTypeNode(\n factory.createTypeReferenceNode(factory.createIdentifier(`${baseName}Responses`), undefined),\n factory.createTypeOperatorNode(\n ts.SyntaxKind.KeyOfKeyword,\n factory.createTypeReferenceNode(factory.createIdentifier(`${baseName}Responses`), undefined),\n ),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n results.push(safePrint(responseNode))\n } else {\n const responseNode = factory.createTypeAliasDeclaration({\n name,\n modifiers: [factory.modifiers.export],\n type: getUnknownType(unknownType),\n })\n\n results.push(safePrint(responseNode))\n }\n\n return results.join('\\n\\n')\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs>({\n name: 'typescript',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing },\n } = plugin\n\n const mode = useMode()\n const driver = usePluginDriver()\n\n const oas = useOas()\n const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const name = getName(operation, { type: 'type', pluginName: pluginTsName })\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n events: generator.context.events,\n plugin,\n driver,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation to pathParams, queryParams, and headerParams (not response)\n const shouldTransform = paramsCasing && isParameterSchema(name)\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const type = {\n name: schemaManager.getName(name, { type: 'type' }),\n typedName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(options.operationName || name, { group }),\n }\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[name, imp.name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n schema={transformedSchema}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n keysToOmit={keysToOmit}\n syntaxType={syntaxType}\n />\n </>\n )\n }\n\n const responseName = schemaManager.getName(schemas.response.name, {\n type: 'type',\n })\n\n const combinedSchemaName = operation.method === 'get' ? `${name}Query` : `${name}Mutation`\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {operationSchemas.map(mapOperationSchema)}\n\n {generator.context.UNSTABLE_NAMING ? (\n <>\n <File.Source name={`${name}Request`} isExportable isIndexable isTypeOnly>\n {printRequestSchema({ baseName: name, operation, schemas, driver })}\n </File.Source>\n <File.Source name={responseName} isExportable isIndexable isTypeOnly>\n {printResponseSchema({ baseName: name, schemas, driver, unknownType })}\n </File.Source>\n </>\n ) : (\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, driver })}\n </File.Source>\n )}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const {\n options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output },\n } = plugin\n const mode = useMode()\n\n const oas = useOas()\n const driver = usePluginDriver()\n\n const { getName, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema)\n\n let typedName = getName(schema.name, { type: 'type' })\n\n if (['asConst', 'asPascalConst'].includes(enumType) && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) {\n typedName = typedName += 'Key' //Suffix for avoiding collisions (https://github.com/kubb-labs/kubb/issues/1873)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName,\n file: getFile(schema.name),\n }\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[schema.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import type { PluginTs } from './types.ts'\n\ntype OptionalType = PluginTs['resolvedOptions']['optionalType']\ntype EnumType = PluginTs['resolvedOptions']['enumType']\n\n/**\n * `optionalType` values that cause a property's type to include `| undefined`.\n */\nexport const OPTIONAL_ADDS_UNDEFINED = new Set<OptionalType>(['undefined', 'questionTokenAndUndefined'] as const)\n\n/**\n * `optionalType` values that render the property key with a `?` token.\n */\nexport const OPTIONAL_ADDS_QUESTION_TOKEN = new Set<OptionalType>(['questionToken', 'questionTokenAndUndefined'] as const)\n\n/**\n * `enumType` values that append a `Key` suffix to the generated enum type alias.\n */\nexport const ENUM_TYPES_WITH_KEY_SUFFIX = new Set<EnumType>(['asConst', 'asPascalConst'] as const)\n\n/**\n * `enumType` values that require a runtime value declaration (object, enum, or literal).\n */\nexport const ENUM_TYPES_WITH_RUNTIME_VALUE = new Set<EnumType | undefined>(['enum', 'asConst', 'asPascalConst', 'constEnum', 'literal', undefined] as const)\n\n/**\n * `enumType` values whose type declaration is type-only (no runtime value emitted for the type alias).\n */\nexport const ENUM_TYPES_WITH_TYPE_ONLY = new Set<EnumType | undefined>(['asConst', 'asPascalConst', 'literal', undefined] as const)\n","import { jsStringEscape, pascalCase, stringify } from '@internals/utils'\nimport { isPlainStringType } from '@kubb/ast'\nimport type { ArraySchemaNode, SchemaNode } from '@kubb/ast/types'\nimport type { PrinterFactoryOptions } from '@kubb/core'\nimport { definePrinter } from '@kubb/core'\nimport type ts from 'typescript'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, OPTIONAL_ADDS_QUESTION_TOKEN, OPTIONAL_ADDS_UNDEFINED } from './constants.ts'\nimport * as factory from './factory.ts'\nimport type { PluginTs } from './types.ts'\n\ntype TsOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: PluginTs['resolvedOptions']['optionalType']\n /**\n * @default `'array'`\n */\n arrayType: PluginTs['resolvedOptions']['arrayType']\n /**\n * @default `'inlineLiteral'`\n */\n enumType: PluginTs['resolvedOptions']['enumType']\n /**\n * Controls whether a `type` alias or `interface` declaration is emitted.\n * @default `'type'`\n */\n syntaxType?: PluginTs['resolvedOptions']['syntaxType']\n /**\n * When set, `printer.print(node)` produces a full `type Name = …` declaration.\n * When omitted, `printer.print(node)` returns the raw type node.\n */\n typeName?: string\n\n /**\n * JSDoc `@description` comment added to the generated type or interface declaration.\n */\n description?: string\n /**\n * Property keys to exclude from the generated type via `Omit<Type, Keys>`.\n * Forces type-alias syntax even when `syntaxType` is `'interface'`.\n */\n keysToOmit?: Array<string>\n}\n\n/**\n * TypeScript printer factory options: maps `SchemaNode` → `ts.TypeNode` (raw) or `ts.Node` (full declaration).\n */\ntype TsPrinter = PrinterFactoryOptions<'typescript', TsOptions, ts.TypeNode, ts.Node>\n\n/**\n * Converts a primitive const value to a TypeScript literal type node.\n * Handles negative numbers via a prefix unary expression.\n */\nfunction constToTypeNode(value: string | number | boolean, format: 'string' | 'number' | 'boolean'): ts.TypeNode | undefined {\n if (format === 'boolean') {\n return factory.createLiteralTypeNode(value === true ? factory.createTrue() : factory.createFalse())\n }\n if (format === 'number' && typeof value === 'number') {\n if (value < 0) {\n return factory.createLiteralTypeNode(factory.createPrefixUnaryExpression(factory.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value))))\n }\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value))\n }\n return factory.createLiteralTypeNode(factory.createStringLiteral(String(value)))\n}\n\n/**\n * Returns a `Date` reference type node when `representation` is `'date'`, otherwise falls back to `string`.\n */\nfunction dateOrStringNode(node: { representation?: string }): ts.TypeNode {\n return node.representation === 'date' ? factory.createTypeReferenceNode(factory.createIdentifier('Date')) : factory.keywordTypeNodes.string\n}\n\n/**\n * Maps an array of `SchemaNode`s through the printer, filtering out `null` and `undefined` results.\n */\nfunction buildMemberNodes(members: Array<SchemaNode> | undefined, print: (node: SchemaNode) => ts.TypeNode | null | undefined): Array<ts.TypeNode> {\n return (members ?? []).map(print).filter(Boolean)\n}\n\n/**\n * Builds a TypeScript tuple type node from an array schema's `items`,\n * applying min/max slice and optional/rest element rules.\n */\nfunction buildTupleNode(node: ArraySchemaNode, print: (node: SchemaNode) => ts.TypeNode | null | undefined): ts.TypeNode | undefined {\n let items = (node.items ?? []).map(print).filter(Boolean)\n\n const restNode = node.rest ? (print(node.rest) ?? undefined) : undefined\n const { min, max } = node\n\n if (max !== undefined) {\n items = items.slice(0, max)\n if (items.length < max && restNode) {\n items = [...items, ...Array(max - items.length).fill(restNode)]\n }\n }\n\n if (min !== undefined) {\n items = items.map((item, i) => (i >= min ? factory.createOptionalTypeNode(item) : item))\n }\n\n if (max === undefined && restNode) {\n items.push(factory.createRestTypeNode(factory.createArrayTypeNode(restNode)))\n }\n\n return factory.createTupleTypeNode(items)\n}\n\n/**\n * Applies `nullable` and optional/nullish `| undefined` union modifiers to a property's resolved base type.\n */\nfunction buildPropertyType(schema: SchemaNode, baseType: ts.TypeNode, optionalType: TsOptions['optionalType']): ts.TypeNode {\n const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(optionalType)\n\n let type = baseType\n\n if (schema.nullable) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n if ((schema.nullish || schema.optional) && addsUndefined) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n\n return type\n}\n\n/**\n * Collects JSDoc annotation strings (description, deprecated, min/max, pattern, default, example, type) for a schema node.\n */\nfunction buildPropertyJSDocComments(schema: SchemaNode): Array<string | undefined> {\n return [\n 'description' in schema && schema.description ? `@description ${jsStringEscape(schema.description)}` : undefined,\n 'deprecated' in schema && schema.deprecated ? '@deprecated' : undefined,\n 'min' in schema && schema.min !== undefined ? `@minLength ${schema.min}` : undefined,\n 'max' in schema && schema.max !== undefined ? `@maxLength ${schema.max}` : undefined,\n 'pattern' in schema && schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n 'default' in schema && schema.default !== undefined\n ? `@default ${'primitive' in schema && schema.primitive === 'string' ? stringify(schema.default as string) : schema.default}`\n : undefined,\n 'example' in schema && schema.example !== undefined ? `@example ${schema.example}` : undefined,\n 'primitive' in schema && schema.primitive\n ? [`@type ${schema.primitive || 'unknown'}`, 'optional' in schema && schema.optional ? ' | undefined' : undefined].filter(Boolean).join('')\n : undefined,\n ]\n}\n\n/**\n * Creates TypeScript index signatures for `additionalProperties` and `patternProperties` on an object schema node.\n */\nfunction buildIndexSignatures(\n node: { additionalProperties?: SchemaNode | boolean; patternProperties?: Record<string, SchemaNode> },\n propertyCount: number,\n print: (node: SchemaNode) => ts.TypeNode | null | undefined,\n): Array<ts.TypeElement> {\n const elements: Array<ts.TypeElement> = []\n\n if (node.additionalProperties && node.additionalProperties !== true) {\n const additionalType = print(node.additionalProperties) ?? factory.keywordTypeNodes.unknown\n\n elements.push(factory.createIndexSignature(propertyCount > 0 ? factory.keywordTypeNodes.unknown : additionalType))\n } else if (node.additionalProperties === true) {\n elements.push(factory.createIndexSignature(factory.keywordTypeNodes.unknown))\n }\n\n if (node.patternProperties) {\n const first = Object.values(node.patternProperties)[0]\n if (first) {\n let patternType = print(first) ?? factory.keywordTypeNodes.unknown\n\n if (first.nullable) {\n patternType = factory.createUnionDeclaration({ nodes: [patternType, factory.keywordTypeNodes.null] })\n }\n elements.push(factory.createIndexSignature(patternType))\n }\n }\n\n return elements\n}\n\n/**\n * TypeScript type printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST node into a TypeScript AST node:\n * - **`printer.print(node)`** — when `options.typeName` is set, returns a full\n * `type Name = …` or `interface Name { … }` declaration (`ts.Node`).\n * Without `typeName`, returns the raw `ts.TypeNode` for the schema.\n *\n * Dispatches on `node.type` to the appropriate handler in `nodes`. Options are closed\n * over per printer instance, so each call to `printerTs(options)` produces an independent printer.\n *\n * @example Raw type node (no `typeName`)\n * ```ts\n * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral' })\n * const typeNode = printer.print(schemaNode) // ts.TypeNode\n * ```\n *\n * @example Full declaration (with `typeName`)\n * ```ts\n * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral', typeName: 'MyType' })\n * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration\n * ```\n */\nexport const printerTs = definePrinter<TsPrinter>((options) => {\n const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(options.optionalType)\n\n return {\n name: 'typescript',\n options,\n nodes: {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n never: () => factory.keywordTypeNodes.never,\n boolean: () => factory.keywordTypeNodes.boolean,\n null: () => factory.keywordTypeNodes.null,\n blob: () => factory.createTypeReferenceNode('Blob', []),\n string: () => factory.keywordTypeNodes.string,\n uuid: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n url: (node) => {\n if (node.path) {\n return factory.createUrlTemplateType(node.path)\n }\n return factory.keywordTypeNodes.string\n },\n datetime: () => factory.keywordTypeNodes.string,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n bigint: () => factory.keywordTypeNodes.bigint,\n date: dateOrStringNode,\n time: dateOrStringNode,\n ref(node) {\n if (!node.name) {\n return undefined\n }\n return factory.createTypeReferenceNode(node.name, undefined)\n },\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n\n if (this.options.enumType === 'inlineLiteral' || !node.name) {\n const literalNodes = values\n .filter((v): v is string | number | boolean => v !== null)\n .map((value) => constToTypeNode(value, typeof value as 'string' | 'number' | 'boolean'))\n .filter(Boolean)\n\n return factory.createUnionDeclaration({ withParentheses: true, nodes: literalNodes }) ?? undefined\n }\n\n const resolvedName = pascalCase(node.name)\n const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) ? `${resolvedName}Key` : resolvedName\n\n return factory.createTypeReferenceNode(typeName, undefined)\n },\n union(node) {\n const members = node.members ?? []\n\n const hasStringLiteral = members.some((m) => m.type === 'enum' && (m.enumType === 'string' || m.primitive === 'string'))\n const hasPlainString = members.some((m) => isPlainStringType(m))\n\n if (hasStringLiteral && hasPlainString) {\n const memberNodes = members\n .map((m) => {\n if (isPlainStringType(m)) {\n return factory.createIntersectionDeclaration({\n nodes: [factory.keywordTypeNodes.string, factory.createTypeLiteralNode([])],\n withParentheses: true,\n })\n }\n\n return this.print(m)\n })\n .filter(Boolean)\n\n return factory.createUnionDeclaration({ withParentheses: true, nodes: memberNodes }) ?? undefined\n }\n\n return factory.createUnionDeclaration({ withParentheses: true, nodes: buildMemberNodes(members, this.print) }) ?? undefined\n },\n intersection(node) {\n return factory.createIntersectionDeclaration({ withParentheses: true, nodes: buildMemberNodes(node.members, this.print) }) ?? undefined\n },\n array(node) {\n const itemNodes = (node.items ?? []).map((item) => this.print(item)).filter(Boolean)\n\n return factory.createArrayDeclaration({ nodes: itemNodes, arrayType: this.options.arrayType }) ?? undefined\n },\n tuple(node) {\n return buildTupleNode(node, this.print)\n },\n object(node) {\n const { print, options } = this\n const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options.optionalType)\n\n const propertyNodes: Array<ts.TypeElement> = node.properties.map((prop) => {\n const baseType = print(prop.schema) ?? factory.keywordTypeNodes.unknown\n const type = buildPropertyType(prop.schema, baseType, options.optionalType)\n\n const propertyNode = factory.createPropertySignature({\n questionToken: prop.schema.optional || prop.schema.nullish ? addsQuestionToken : false,\n name: prop.name,\n type,\n readOnly: prop.schema.readOnly,\n })\n\n return factory.appendJSDocToNode({ node: propertyNode, comments: buildPropertyJSDocComments(prop.schema) })\n })\n\n const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, print)]\n\n if (!allElements.length) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(allElements)\n },\n },\n print(node) {\n let type = this.print(node)\n\n if (!type) {\n return undefined\n }\n\n // Apply top-level nullable / optional union modifiers.\n if (node.nullable) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n if ((node.nullish || node.optional) && addsUndefined) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n\n // Without typeName, return the type node as-is (no declaration wrapping).\n const { typeName, syntaxType = 'type', description, keysToOmit } = this.options\n if (!typeName) {\n return type\n }\n\n const useTypeGeneration = syntaxType === 'type' || type.kind === factory.syntaxKind.union || !!keysToOmit?.length\n\n return factory.createTypeDeclaration({\n name: typeName,\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 node?.title ? jsStringEscape(node.title) : undefined,\n description ? `@description ${jsStringEscape(description)}` : undefined,\n node?.deprecated ? '@deprecated' : undefined,\n node && 'min' in node && node.min !== undefined ? `@minLength ${node.min}` : undefined,\n node && 'max' in node && node.max !== undefined ? `@maxLength ${node.max}` : undefined,\n node && 'pattern' in node && node.pattern ? `@pattern ${node.pattern}` : undefined,\n node?.default ? `@default ${node.default}` : undefined,\n node?.example ? `@example ${node.example}` : undefined,\n ],\n })\n },\n }\n})\n","import { camelCase, pascalCase, trimQuotes } from '@internals/utils'\nimport type { EnumSchemaNode } from '@kubb/ast/types'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, ENUM_TYPES_WITH_RUNTIME_VALUE, ENUM_TYPES_WITH_TYPE_ONLY } from '../../constants.ts'\nimport * as factory from '../../factory.ts'\nimport type { PluginTs } from '../../types.ts'\n\ntype Props = {\n node: EnumSchemaNode\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n}\n\n/**\n * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.\n *\n * The raw `node.name` may be a YAML key such as `\"enumNames.Type\"` which is not a\n * valid TypeScript identifier. `pascalCase` normalizes it unconditionally; for inline enum\n * properties the adapter already emits a PascalCase+suffix name so `pascalCase` is a no-op.\n */\nexport function getEnumNames(node: EnumSchemaNode, enumType: PluginTs['resolvedOptions']['enumType']): { enumName: string; typeName: string } {\n const resolved = pascalCase(node.name!)\n const enumName = enumType === 'asPascalConst' ? resolved : camelCase(node.name!)\n const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? `${resolved}Key` : resolved\n\n return { enumName, typeName }\n}\n\n/**\n * Renders the enum declaration(s) for a single named `EnumSchemaNode`.\n *\n * Depending on `enumType` this may emit:\n * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias\n * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)\n * - A union literal type alias (`literal`)\n *\n * The emitted `File.Source` nodes carry the resolved names so that the barrel\n * index picks up the correct export identifiers.\n */\nexport function Enum({ node, enumType, enumKeyCasing }: Props): FabricReactNode {\n const { enumName, typeName } = getEnumNames(node, enumType)\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name: enumName,\n typeName,\n enums: (node.namedEnumValues?.map((v) => [trimQuotes(v.name.toString()), v.value]) ??\n node.enumValues?.filter((v): v is NonNullable<typeof v> => v !== null && v !== undefined).map((v) => [trimQuotes(v.toString()), v]) ??\n []) as unknown as Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return (\n <>\n {nameNode && (\n <File.Source name={enumName} isExportable isIndexable isTypeOnly={false}>\n {safePrint(nameNode)}\n </File.Source>\n )}\n <File.Source name={typeName} isIndexable isExportable={ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType)} isTypeOnly={ENUM_TYPES_WITH_TYPE_ONLY.has(enumType)}>\n {safePrint(typeNode)}\n </File.Source>\n </>\n )\n}\n","import { collect } from '@kubb/ast'\nimport type { EnumSchemaNode, SchemaNode } from '@kubb/ast/types'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { printerTs } from '../../printer.ts'\nimport type { PluginTs } from '../../types.ts'\nimport { Enum, getEnumNames } from './Enum.tsx'\n\ntype Props = {\n name: string\n typedName: string\n node: SchemaNode\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description }: Props): FabricReactNode {\n const resolvedDescription = description || node?.description\n const enumSchemaNodes = collect<EnumSchemaNode>(node, {\n schema(n): EnumSchemaNode | undefined {\n if (n.type === 'enum' && n.name) return n as EnumSchemaNode\n },\n })\n\n const printer = printerTs({ optionalType, arrayType, enumType, typeName: name, syntaxType, description: resolvedDescription, keysToOmit })\n const typeNode = printer.print(node)\n\n if (!typeNode) {\n return\n }\n\n const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node) => {\n return {\n node,\n ...getEnumNames(node, enumType),\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 && enums.map(({ node }) => <Enum node={node} enumType={enumType} enumKeyCasing={enumKeyCasing} />)}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {safePrint(typeNode)}\n </File.Source>\n )}\n </>\n )\n}\n","import { pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginTs } from './types.ts'\n\n/**\n * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution\n * helpers used by the plugin. Import this in other plugins to resolve the exact names and\n * paths that `plugin-ts` generates without hardcoding the conventions.\n *\n * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`\n * for identifiers/files and `pascalCase` for type names.\n *\n * @example\n * ```ts\n * import { resolver } from '@kubb/plugin-ts'\n *\n * resolver.default('list pets', 'type') // → 'ListPets'\n * resolver.resolveName('list pets status 200') // → 'listPetsStatus200'\n * resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'\n * resolver.resolvePathName('list pets', 'file') // → 'listPets'\n * ```\n */\nexport const resolverTs = defineResolver<PluginTs>(() => {\n return {\n default(name, type) {\n return pascalCase(name, { isFile: type === 'file' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolveTypedName(name) {\n return this.default(name, 'type')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveParamTypedName(node, param) {\n return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveName(`${node.operationId} Status ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n return this.resolveTypedName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveName(`${node.operationId} Data`)\n },\n resolveDataTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Data`)\n },\n resolveRequestConfigName(node) {\n return this.resolveName(`${node.operationId} RequestConfig`)\n },\n resolveRequestConfigTypedName(node) {\n return this.resolveTypedName(`${node.operationId} RequestConfig`)\n },\n resolveResponsesName(node) {\n return this.resolveName(`${node.operationId} Responses`)\n },\n resolveResponsesTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveName(`${node.operationId} Response`)\n },\n resolveResponseTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Response`)\n },\n resolveEnumKeyTypedName(node) {\n return `${this.resolveTypedName(node.name ?? '')}Key`\n },\n }\n})\n","import { pascalCase } from '@internals/utils'\nimport { createProperty, createSchema } from '@kubb/ast'\nimport type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'\n\ntype ResolveName = (opts: { name: string; type: 'type' | 'function' }) => string\n\ntype BuildParamsSchemaOptions = {\n params: Array<ParameterNode>\n operationId: string\n resolveName: ResolveName\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).\n * Each property is a `ref` schema pointing to the individually-resolved parameter type.\n * The ref name includes the parameter location so generated type names follow\n * the `<OperationId><Location><ParamName>` convention.\n */\nexport function buildParamsSchema({ params, operationId, resolveName }: BuildParamsSchemaOptions): SchemaNode {\n return createSchema({\n type: 'object',\n properties: params.map((param) =>\n createProperty({\n name: param.name,\n schema: createSchema({\n type: 'ref',\n name: resolveName({ name: `${operationId} ${pascalCase(param.in)} ${param.name}`, type: 'function' }),\n optional: !param.required,\n }),\n }),\n ),\n })\n}\n\ntype BuildOperationSchemaOptions = {\n node: OperationNode\n resolveName: ResolveName\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:\n * - `data` → request body ref (optional) or `never`\n * - `pathParams` → inline object of path param refs, or `never`\n * - `queryParams` → inline object of query param refs (optional), or `never`\n * - `headerParams` → inline object of header param refs (optional), or `never`\n * - `url` → Express-style template literal (plugin-ts extension, handled by printer)\n */\nexport function buildDataSchemaNode({ node, resolveName }: BuildOperationSchemaOptions): SchemaNode {\n const pathParams = node.parameters.filter((p) => p.in === 'path')\n const queryParams = node.parameters.filter((p) => p.in === 'query')\n const headerParams = node.parameters.filter((p) => p.in === 'header')\n\n return createSchema({\n type: 'object',\n deprecated: node.deprecated,\n properties: [\n createProperty({\n name: 'data',\n schema: node.requestBody\n ? createSchema({\n type: 'ref',\n name: resolveName({ name: `${node.operationId} Data`, type: 'function' }),\n optional: true,\n })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n schema:\n pathParams.length > 0\n ? buildParamsSchema({ params: pathParams, operationId: node.operationId, resolveName })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...buildParamsSchema({ params: queryParams, operationId: node.operationId, resolveName }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'headerParams',\n schema:\n headerParams.length > 0\n ? createSchema({ ...buildParamsSchema({ params: headerParams, operationId: node.operationId, resolveName }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'url',\n schema: createSchema({ type: 'url', path: node.path }),\n }),\n ],\n })\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.\n * Numeric status codes produce unquoted numeric keys (e.g. `200:`).\n * All responses are included; those without a schema are represented as a ref to a `never` type.\n */\nexport function buildResponsesSchemaNode({ node, resolveName }: BuildOperationSchemaOptions): SchemaNode | null {\n if (node.responses.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'object',\n properties: node.responses.map((res) =>\n createProperty({\n name: String(res.statusCode),\n schema: createSchema({\n type: 'ref',\n name: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'function' }),\n }),\n }),\n ),\n })\n}\n\n/**\n * Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.\n * Returns `null` when the operation has no responses with schemas.\n */\nexport function buildResponseUnionSchemaNode({ node, resolveName }: BuildOperationSchemaOptions): SchemaNode | null {\n const responsesWithSchema = node.responses.filter((res) => res.schema)\n\n if (responsesWithSchema.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'union',\n members: responsesWithSchema.map((res) =>\n createSchema({\n type: 'ref',\n name: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'function' }),\n }),\n ),\n })\n}\n","import { applyParamsCasing } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator } from '@kubb/core'\nimport { useKubb } from '@kubb/core/hooks'\nimport { File } from '@kubb/react-fabric'\nimport { Type } from '../../components/v2/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../../constants.ts'\nimport { resolverTs } from '../../resolverTs.ts'\nimport type { PluginTs } from '../../types'\nimport { buildDataSchemaNode, buildResponsesSchemaNode, buildResponseUnionSchemaNode } from './utils.ts'\n\nexport const typeGenerator = defineGenerator<PluginTs>({\n name: 'typescript',\n type: 'react',\n Operation({ node, adapter, options }) {\n const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group } = options\n const { mode, getFile, resolveName, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n const file = getFile({\n name: node.operationId,\n extname: '.ts',\n mode,\n options: {\n group: group ? (group.type === 'tag' ? { tag: node.tags[0] } : { path: node.path }) : undefined,\n },\n })\n const params = applyParamsCasing(node.parameters, paramsCasing)\n\n function renderSchemaType({\n node: schemaNode,\n name,\n typedName,\n description,\n }: {\n node: SchemaNode | null\n name: string\n typedName: string\n description?: string\n }) {\n if (!schemaNode) {\n return null\n }\n\n const imports = adapter.getImports(schemaNode, (schemaName) => ({\n name: resolveName({ name: schemaName, type: 'type' }),\n path: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={name}\n typedName={typedName}\n node={schemaNode}\n description={description}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n />\n </>\n )\n }\n\n const paramTypes = params.map((param) =>\n renderSchemaType({\n node: param.schema,\n name: resolverTs.resolveParamName(node, param),\n typedName: resolverTs.resolveParamTypedName(node, param),\n }),\n )\n\n const responseTypes = node.responses.map((res) =>\n renderSchemaType({\n node: res.schema,\n name: resolverTs.resolveResponseStatusName(node, res.statusCode),\n typedName: resolverTs.resolveResponseStatusTypedName(node, res.statusCode),\n description: res.description,\n }),\n )\n\n const requestType = node.requestBody\n ? renderSchemaType({\n node: node.requestBody,\n name: resolverTs.resolveDataName(node),\n typedName: resolverTs.resolveDataTypedName(node),\n description: node.requestBody.description,\n })\n : null\n\n const dataType = renderSchemaType({\n node: buildDataSchemaNode({ node: { ...node, parameters: params }, resolveName }),\n name: resolverTs.resolveRequestConfigName(node),\n typedName: resolverTs.resolveRequestConfigTypedName(node),\n })\n\n const responsesType = renderSchemaType({\n node: buildResponsesSchemaNode({ node, resolveName }),\n name: resolverTs.resolveResponsesName(node),\n typedName: resolverTs.resolveResponsesTypedName(node),\n })\n\n const responseType = renderSchemaType({\n node: buildResponseUnionSchemaNode({ node, resolveName }),\n name: resolverTs.resolveResponseName(node),\n typedName: resolverTs.resolveResponseTypedName(node),\n description: 'Union of all possible responses',\n })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {paramTypes}\n {responseTypes}\n {requestType}\n {dataType}\n {responsesType}\n {responseType}\n </File>\n )\n },\n Schema({ node, adapter, options }) {\n const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType } = options\n const { mode, resolveName, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n if (!node.name) {\n return\n }\n\n const imports = adapter.getImports(node, (schemaName) => ({\n name: resolveName({ name: schemaName, type: 'type' }),\n path: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n const isEnumSchema = node.type === 'enum'\n\n const typedName =\n ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolverTs.resolveEnumKeyTypedName(node) : resolverTs.resolveTypedName(node.name)\n\n const type = {\n name: resolverTs.resolveName(node.name),\n typedName,\n file: getFile({ name: node.name, extname: '.ts', mode }),\n } as const\n\n return (\n <File baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n node={node}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { walk } from '@kubb/ast'\nimport { createPlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { buildOperation, buildSchema, OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { typeGenerator, typeGeneratorV2 } from './generators'\nimport { resolverTs } from './resolverTs.ts'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = createPlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumKeyCasing = 'none',\n enumSuffix = 'enum',\n dateType = 'string',\n integerType = 'number',\n unknownType = 'any',\n optionalType = 'questionToken',\n arrayType = 'array',\n emptySchemaType = unknownType,\n syntaxType = 'type',\n transformers = {},\n paramsCasing,\n generators = [typeGenerator, typeGeneratorV2].filter(Boolean),\n contentType,\n UNSTABLE_NAMING,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n integerType,\n optionalType,\n arrayType,\n enumType,\n enumKeyCasing,\n enumSuffix,\n unknownType,\n emptySchemaType,\n syntaxType,\n group,\n override,\n paramsCasing,\n usedEnumNames,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = resolverTs.default(name, type)\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n if (adapter) {\n await openInStudio({ ast: true })\n\n await walk(\n rootNode,\n {\n async schema(schemaNode) {\n const writeTasks = generators.map(async (generator) => {\n if (generator.type === 'react' && generator.version === '2') {\n const options = resolverTs.resolveOptions(schemaNode, { options: plugin.options, exclude, include, override })\n\n if (options === null) {\n return\n }\n\n await buildSchema(schemaNode, {\n options,\n adapter,\n config,\n fabric,\n Component: generator.Schema,\n plugin,\n driver,\n mode,\n version: generator.version,\n })\n }\n })\n\n await Promise.all(writeTasks)\n },\n async operation(operationNode) {\n const writeTasks = generators.map(async (generator) => {\n if (generator.type === 'react' && generator.version === '2') {\n const options = resolverTs.resolveOptions(operationNode, { options: plugin.options, exclude, include, override })\n\n if (options === null) {\n return\n }\n\n await buildOperation(operationNode, {\n options,\n adapter,\n config,\n fabric,\n Component: generator.Operation,\n plugin,\n driver,\n mode,\n version: generator.version,\n })\n }\n })\n\n await Promise.all(writeTasks)\n },\n },\n { depth: 'shallow' },\n )\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n\n return\n }\n\n // v1 flow\n\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n UNSTABLE_NAMING,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASA,SAAgB,UAAU,OAAsD;AAC9E,KAAI,UAAU,KAAA,KAAa,UAAU,KAAM,QAAO;AAClD,QAAO,KAAK,UAAU,WAAW,MAAM,UAAU,CAAC,CAAC;;;;ACMrD,SAAS,oBAAoB,EAAE,MAAM,SAAS,UAAqF;CACjI,MAAM,aAA0C,EAAE;AAElD,KAAI,QAAQ,SACV,YAAW,cAAcA,uBAA+B,EACtD,OAAO,QAAQ,UAAU,KAAK,QAAQ;AAOpC,SAAOC,wBAAgCC,iBANpB,OAAO,YAAY;GACpC,MAAM,IAAI;GACV,YAAY;GACZ,MAAM;GACP,CAAC,CAEyE,EAAE,KAAA,EAAU;GACvF,EACH,CAAC;AAGJ,KAAI,QAAQ,QAMV,YAAW,aAAaD,wBAAgCC,iBALrC,OAAO,YAAY;EACpC,MAAM,QAAQ,QAAQ;EACtB,YAAY;EACZ,MAAM;EACP,CAAC,CAC0F,EAAE,KAAA,EAAU;AAG1G,KAAI,QAAQ,WAMV,YAAW,gBAAgBD,wBAAgCC,iBALxC,OAAO,YAAY;EACpC,MAAM,QAAQ,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K,OAAO,MACzB;KACF,CAAC;AAEF,UAAM,KAAK,WAAW,GAAG,YAAY;AAErC;;GAKF,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,cAAc,MAbI,IAAI,gBAAgB,KAAK,OAAO,SAAS;IAC/D,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA,SAAS,KAAA;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAgBrC,MAAM,iBAAiB,MAdI,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
@@ -574,7 +574,7 @@ const printerTs = (0, _kubb_core.definePrinter)((options) => {
|
|
|
574
574
|
},
|
|
575
575
|
union(node) {
|
|
576
576
|
const members = node.members ?? [];
|
|
577
|
-
const hasStringLiteral = members.some((m) => m.type === "enum" && m.enumType === "string");
|
|
577
|
+
const hasStringLiteral = members.some((m) => m.type === "enum" && (m.enumType === "string" || m.primitive === "string"));
|
|
578
578
|
const hasPlainString = members.some((m) => (0, _kubb_ast.isPlainStringType)(m));
|
|
579
579
|
if (hasStringLiteral && hasPlainString) {
|
|
580
580
|
const memberNodes = members.map((m) => {
|
|
@@ -751,6 +751,81 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
|
|
|
751
751
|
})] });
|
|
752
752
|
}
|
|
753
753
|
//#endregion
|
|
754
|
+
//#region src/resolverTs.ts
|
|
755
|
+
/**
|
|
756
|
+
* Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
|
|
757
|
+
* helpers used by the plugin. Import this in other plugins to resolve the exact names and
|
|
758
|
+
* paths that `plugin-ts` generates without hardcoding the conventions.
|
|
759
|
+
*
|
|
760
|
+
* The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
|
|
761
|
+
* for identifiers/files and `pascalCase` for type names.
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```ts
|
|
765
|
+
* import { resolver } from '@kubb/plugin-ts'
|
|
766
|
+
*
|
|
767
|
+
* resolver.default('list pets', 'type') // → 'ListPets'
|
|
768
|
+
* resolver.resolveName('list pets status 200') // → 'listPetsStatus200'
|
|
769
|
+
* resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'
|
|
770
|
+
* resolver.resolvePathName('list pets', 'file') // → 'listPets'
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
const resolverTs = (0, _kubb_core.defineResolver)(() => {
|
|
774
|
+
return {
|
|
775
|
+
default(name, type) {
|
|
776
|
+
return require_components.pascalCase(name, { isFile: type === "file" });
|
|
777
|
+
},
|
|
778
|
+
resolveName(name) {
|
|
779
|
+
return this.default(name, "function");
|
|
780
|
+
},
|
|
781
|
+
resolveTypedName(name) {
|
|
782
|
+
return this.default(name, "type");
|
|
783
|
+
},
|
|
784
|
+
resolvePathName(name, type) {
|
|
785
|
+
return this.default(name, type);
|
|
786
|
+
},
|
|
787
|
+
resolveParamName(node, param) {
|
|
788
|
+
return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
789
|
+
},
|
|
790
|
+
resolveParamTypedName(node, param) {
|
|
791
|
+
return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
792
|
+
},
|
|
793
|
+
resolveResponseStatusName(node, statusCode) {
|
|
794
|
+
return this.resolveName(`${node.operationId} Status ${statusCode}`);
|
|
795
|
+
},
|
|
796
|
+
resolveResponseStatusTypedName(node, statusCode) {
|
|
797
|
+
return this.resolveTypedName(`${node.operationId} Status ${statusCode}`);
|
|
798
|
+
},
|
|
799
|
+
resolveDataName(node) {
|
|
800
|
+
return this.resolveName(`${node.operationId} Data`);
|
|
801
|
+
},
|
|
802
|
+
resolveDataTypedName(node) {
|
|
803
|
+
return this.resolveTypedName(`${node.operationId} Data`);
|
|
804
|
+
},
|
|
805
|
+
resolveRequestConfigName(node) {
|
|
806
|
+
return this.resolveName(`${node.operationId} RequestConfig`);
|
|
807
|
+
},
|
|
808
|
+
resolveRequestConfigTypedName(node) {
|
|
809
|
+
return this.resolveTypedName(`${node.operationId} RequestConfig`);
|
|
810
|
+
},
|
|
811
|
+
resolveResponsesName(node) {
|
|
812
|
+
return this.resolveName(`${node.operationId} Responses`);
|
|
813
|
+
},
|
|
814
|
+
resolveResponsesTypedName(node) {
|
|
815
|
+
return this.resolveTypedName(`${node.operationId} Responses`);
|
|
816
|
+
},
|
|
817
|
+
resolveResponseName(node) {
|
|
818
|
+
return this.resolveName(`${node.operationId} Response`);
|
|
819
|
+
},
|
|
820
|
+
resolveResponseTypedName(node) {
|
|
821
|
+
return this.resolveTypedName(`${node.operationId} Response`);
|
|
822
|
+
},
|
|
823
|
+
resolveEnumKeyTypedName(node) {
|
|
824
|
+
return `${this.resolveTypedName(node.name ?? "")}Key`;
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
});
|
|
828
|
+
//#endregion
|
|
754
829
|
//#region src/generators/v2/utils.ts
|
|
755
830
|
/**
|
|
756
831
|
* Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).
|
|
@@ -788,6 +863,7 @@ function buildDataSchemaNode({ node, resolveName }) {
|
|
|
788
863
|
const headerParams = node.parameters.filter((p) => p.in === "header");
|
|
789
864
|
return (0, _kubb_ast.createSchema)({
|
|
790
865
|
type: "object",
|
|
866
|
+
deprecated: node.deprecated,
|
|
791
867
|
properties: [
|
|
792
868
|
(0, _kubb_ast.createProperty)({
|
|
793
869
|
name: "data",
|
|
@@ -855,13 +931,13 @@ function buildDataSchemaNode({ node, resolveName }) {
|
|
|
855
931
|
/**
|
|
856
932
|
* Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.
|
|
857
933
|
* Numeric status codes produce unquoted numeric keys (e.g. `200:`).
|
|
934
|
+
* All responses are included; those without a schema are represented as a ref to a `never` type.
|
|
858
935
|
*/
|
|
859
936
|
function buildResponsesSchemaNode({ node, resolveName }) {
|
|
860
|
-
|
|
861
|
-
if (responsesWithSchema.length === 0) return null;
|
|
937
|
+
if (node.responses.length === 0) return null;
|
|
862
938
|
return (0, _kubb_ast.createSchema)({
|
|
863
939
|
type: "object",
|
|
864
|
-
properties:
|
|
940
|
+
properties: node.responses.map((res) => (0, _kubb_ast.createProperty)({
|
|
865
941
|
name: String(res.statusCode),
|
|
866
942
|
schema: (0, _kubb_ast.createSchema)({
|
|
867
943
|
type: "ref",
|
|
@@ -898,7 +974,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
898
974
|
type: "react",
|
|
899
975
|
Operation({ node, adapter, options }) {
|
|
900
976
|
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group } = options;
|
|
901
|
-
const { mode, getFile, resolveName } = (0, _kubb_core_hooks.useKubb)();
|
|
977
|
+
const { mode, getFile, resolveName, resolveBanner, resolveFooter } = (0, _kubb_core_hooks.useKubb)();
|
|
902
978
|
const file = getFile({
|
|
903
979
|
name: node.operationId,
|
|
904
980
|
extname: ".ts",
|
|
@@ -942,37 +1018,19 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
942
1018
|
}
|
|
943
1019
|
const paramTypes = params.map((param) => renderSchemaType({
|
|
944
1020
|
node: param.schema,
|
|
945
|
-
name:
|
|
946
|
-
|
|
947
|
-
type: "function"
|
|
948
|
-
}),
|
|
949
|
-
typedName: resolveName({
|
|
950
|
-
name: `${node.operationId} ${require_components.pascalCase(param.in)} ${param.name}`,
|
|
951
|
-
type: "type"
|
|
952
|
-
})
|
|
1021
|
+
name: resolverTs.resolveParamName(node, param),
|
|
1022
|
+
typedName: resolverTs.resolveParamTypedName(node, param)
|
|
953
1023
|
}));
|
|
954
|
-
const responseTypes = node.responses.
|
|
1024
|
+
const responseTypes = node.responses.map((res) => renderSchemaType({
|
|
955
1025
|
node: res.schema,
|
|
956
|
-
name:
|
|
957
|
-
|
|
958
|
-
type: "function"
|
|
959
|
-
}),
|
|
960
|
-
typedName: resolveName({
|
|
961
|
-
name: `${node.operationId} Status ${res.statusCode}`,
|
|
962
|
-
type: "type"
|
|
963
|
-
}),
|
|
1026
|
+
name: resolverTs.resolveResponseStatusName(node, res.statusCode),
|
|
1027
|
+
typedName: resolverTs.resolveResponseStatusTypedName(node, res.statusCode),
|
|
964
1028
|
description: res.description
|
|
965
1029
|
}));
|
|
966
1030
|
const requestType = node.requestBody ? renderSchemaType({
|
|
967
1031
|
node: node.requestBody,
|
|
968
|
-
name:
|
|
969
|
-
|
|
970
|
-
type: "function"
|
|
971
|
-
}),
|
|
972
|
-
typedName: resolveName({
|
|
973
|
-
name: `${node.operationId} Data`,
|
|
974
|
-
type: "type"
|
|
975
|
-
}),
|
|
1032
|
+
name: resolverTs.resolveDataName(node),
|
|
1033
|
+
typedName: resolverTs.resolveDataTypedName(node),
|
|
976
1034
|
description: node.requestBody.description
|
|
977
1035
|
}) : null;
|
|
978
1036
|
const dataType = renderSchemaType({
|
|
@@ -983,48 +1041,32 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
983
1041
|
},
|
|
984
1042
|
resolveName
|
|
985
1043
|
}),
|
|
986
|
-
name:
|
|
987
|
-
|
|
988
|
-
type: "function"
|
|
989
|
-
}),
|
|
990
|
-
typedName: resolveName({
|
|
991
|
-
name: `${node.operationId} RequestConfig`,
|
|
992
|
-
type: "type"
|
|
993
|
-
})
|
|
1044
|
+
name: resolverTs.resolveRequestConfigName(node),
|
|
1045
|
+
typedName: resolverTs.resolveRequestConfigTypedName(node)
|
|
994
1046
|
});
|
|
995
1047
|
const responsesType = renderSchemaType({
|
|
996
1048
|
node: buildResponsesSchemaNode({
|
|
997
1049
|
node,
|
|
998
1050
|
resolveName
|
|
999
1051
|
}),
|
|
1000
|
-
name:
|
|
1001
|
-
|
|
1002
|
-
type: "function"
|
|
1003
|
-
}),
|
|
1004
|
-
typedName: resolveName({
|
|
1005
|
-
name: `${node.operationId} Responses`,
|
|
1006
|
-
type: "type"
|
|
1007
|
-
})
|
|
1052
|
+
name: resolverTs.resolveResponsesName(node),
|
|
1053
|
+
typedName: resolverTs.resolveResponsesTypedName(node)
|
|
1008
1054
|
});
|
|
1009
1055
|
const responseType = renderSchemaType({
|
|
1010
1056
|
node: buildResponseUnionSchemaNode({
|
|
1011
1057
|
node,
|
|
1012
1058
|
resolveName
|
|
1013
1059
|
}),
|
|
1014
|
-
name:
|
|
1015
|
-
|
|
1016
|
-
type: "function"
|
|
1017
|
-
}),
|
|
1018
|
-
typedName: resolveName({
|
|
1019
|
-
name: `${node.operationId} Response`,
|
|
1020
|
-
type: "type"
|
|
1021
|
-
}),
|
|
1060
|
+
name: resolverTs.resolveResponseName(node),
|
|
1061
|
+
typedName: resolverTs.resolveResponseTypedName(node),
|
|
1022
1062
|
description: "Union of all possible responses"
|
|
1023
1063
|
});
|
|
1024
1064
|
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
1025
1065
|
baseName: file.baseName,
|
|
1026
1066
|
path: file.path,
|
|
1027
1067
|
meta: file.meta,
|
|
1068
|
+
banner: resolveBanner(),
|
|
1069
|
+
footer: resolveFooter(),
|
|
1028
1070
|
children: [
|
|
1029
1071
|
paramTypes,
|
|
1030
1072
|
responseTypes,
|
|
@@ -1037,7 +1079,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1037
1079
|
},
|
|
1038
1080
|
Schema({ node, adapter, options }) {
|
|
1039
1081
|
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType } = options;
|
|
1040
|
-
const { mode, resolveName, getFile } = (0, _kubb_core_hooks.useKubb)();
|
|
1082
|
+
const { mode, resolveName, getFile, resolveBanner, resolveFooter } = (0, _kubb_core_hooks.useKubb)();
|
|
1041
1083
|
if (!node.name) return;
|
|
1042
1084
|
const imports = adapter.getImports(node, (schemaName) => ({
|
|
1043
1085
|
name: resolveName({
|
|
@@ -1051,16 +1093,9 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1051
1093
|
}).path
|
|
1052
1094
|
}));
|
|
1053
1095
|
const isEnumSchema = node.type === "enum";
|
|
1054
|
-
|
|
1055
|
-
name: node.name,
|
|
1056
|
-
type: "type"
|
|
1057
|
-
});
|
|
1058
|
-
if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema) typedName += "Key";
|
|
1096
|
+
const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolverTs.resolveEnumKeyTypedName(node) : resolverTs.resolveTypedName(node.name);
|
|
1059
1097
|
const type = {
|
|
1060
|
-
name: resolveName(
|
|
1061
|
-
name: node.name,
|
|
1062
|
-
type: "function"
|
|
1063
|
-
}),
|
|
1098
|
+
name: resolverTs.resolveName(node.name),
|
|
1064
1099
|
typedName,
|
|
1065
1100
|
file: getFile({
|
|
1066
1101
|
name: node.name,
|
|
@@ -1072,6 +1107,8 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1072
1107
|
baseName: type.file.baseName,
|
|
1073
1108
|
path: type.file.path,
|
|
1074
1109
|
meta: type.file.meta,
|
|
1110
|
+
banner: resolveBanner(),
|
|
1111
|
+
footer: resolveFooter(),
|
|
1075
1112
|
children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1076
1113
|
root: type.file.path,
|
|
1077
1114
|
path: imp.path,
|
|
@@ -1097,7 +1134,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1097
1134
|
//#endregion
|
|
1098
1135
|
//#region src/plugin.ts
|
|
1099
1136
|
const pluginTsName = "plugin-ts";
|
|
1100
|
-
const pluginTs = (0, _kubb_core.
|
|
1137
|
+
const pluginTs = (0, _kubb_core.createPlugin)((options) => {
|
|
1101
1138
|
const { output = {
|
|
1102
1139
|
path: "types",
|
|
1103
1140
|
barrelType: "named"
|
|
@@ -1141,7 +1178,7 @@ const pluginTs = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1141
1178
|
return node_path.default.resolve(root, output.path, baseName);
|
|
1142
1179
|
},
|
|
1143
1180
|
resolveName(name, type) {
|
|
1144
|
-
const resolvedName =
|
|
1181
|
+
const resolvedName = resolverTs.default(name, type);
|
|
1145
1182
|
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
1146
1183
|
return resolvedName;
|
|
1147
1184
|
},
|
|
@@ -1155,7 +1192,7 @@ const pluginTs = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1155
1192
|
async schema(schemaNode) {
|
|
1156
1193
|
const writeTasks = generators.map(async (generator) => {
|
|
1157
1194
|
if (generator.type === "react" && generator.version === "2") {
|
|
1158
|
-
const options =
|
|
1195
|
+
const options = resolverTs.resolveOptions(schemaNode, {
|
|
1159
1196
|
options: plugin.options,
|
|
1160
1197
|
exclude,
|
|
1161
1198
|
include,
|
|
@@ -1180,7 +1217,7 @@ const pluginTs = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1180
1217
|
async operation(operationNode) {
|
|
1181
1218
|
const writeTasks = generators.map(async (generator) => {
|
|
1182
1219
|
if (generator.type === "react" && generator.version === "2") {
|
|
1183
|
-
const options =
|
|
1220
|
+
const options = resolverTs.resolveOptions(operationNode, {
|
|
1184
1221
|
options: plugin.options,
|
|
1185
1222
|
exclude,
|
|
1186
1223
|
include,
|
|
@@ -1263,6 +1300,12 @@ Object.defineProperty(exports, "pluginTsName", {
|
|
|
1263
1300
|
return pluginTsName;
|
|
1264
1301
|
}
|
|
1265
1302
|
});
|
|
1303
|
+
Object.defineProperty(exports, "resolverTs", {
|
|
1304
|
+
enumerable: true,
|
|
1305
|
+
get: function() {
|
|
1306
|
+
return resolverTs;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1266
1309
|
Object.defineProperty(exports, "typeGenerator", {
|
|
1267
1310
|
enumerable: true,
|
|
1268
1311
|
get: function() {
|
|
@@ -1276,4 +1319,4 @@ Object.defineProperty(exports, "typeGenerator$1", {
|
|
|
1276
1319
|
}
|
|
1277
1320
|
});
|
|
1278
1321
|
|
|
1279
|
-
//# sourceMappingURL=plugin-
|
|
1322
|
+
//# sourceMappingURL=plugin-Bunz1oGa.cjs.map
|