@trapi/metadata 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["arrayLiteral","readDecoratorName","modelTypeDeclaration","stringifyFlatted","parseFlatted","joinFilePath"],"sources":["../src/core/error/base.ts","../src/core/error/config.ts","../src/core/error/config-codes.ts","../src/core/error/generator.ts","../src/core/error/generator-codes.ts","../src/core/error/parameter-codes.ts","../src/core/error/parameter.ts","../src/core/error/resolver.ts","../src/core/error/validator.ts","../src/core/error/validator-codes.ts","../src/adapters/typescript/js-doc/constants.ts","../src/core/utils/array.ts","../src/core/utils/object.ts","../src/core/utils/path-normalize.ts","../src/adapters/typescript/js-doc/utils.ts","../src/adapters/typescript/js-doc/module.ts","../src/adapters/typescript/initializer.ts","../src/adapters/decorator/typescript/utils.ts","../src/adapters/decorator/typescript/module.ts","../src/adapters/decorator/orchestrator/module.ts","../src/adapters/typescript/validator/module.ts","../src/adapters/typescript/resolver/extension/module.ts","../src/adapters/typescript/resolver/sub/array.ts","../src/adapters/typescript/resolver/sub/base.ts","../src/adapters/typescript/resolver/utils.ts","../src/adapters/typescript/resolver/sub/indexed-access.ts","../src/adapters/typescript/resolver/sub/intersection.ts","../src/adapters/typescript/resolver/sub/literal.ts","../src/adapters/typescript/resolver/sub/mapped.ts","../src/adapters/typescript/resolver/sub/object-literal.ts","../src/adapters/typescript/resolver/sub/primitive.ts","../src/adapters/typescript/resolver/sub/reference.ts","../src/adapters/typescript/resolver/sub/tuple.ts","../src/adapters/typescript/resolver/sub/type-operator.ts","../src/adapters/typescript/resolver/sub/union.ts","../src/adapters/typescript/resolver/module.ts","../src/adapters/typescript/resolver/cache.ts","../src/adapters/typescript/node-utils/module.ts","../src/adapters/filesystem/source-files.ts","../src/adapters/filesystem/tsconfig/module.ts","../src/adapters/cache/constants.ts","../src/adapters/cache/utils.ts","../src/adapters/cache/client.ts","../src/app/generator/parameter/module.ts","../src/app/generator/method/module.ts","../src/app/generator/controller/module.ts","../src/app/generator/metadata/module.ts","../src/app/generate.ts"],"sourcesContent":["/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BaseError } from '@ebec/core';\n\nexport class MetadataError extends BaseError {\n\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { MetadataError } from './base';\n\nexport class ConfigError extends MetadataError {\n\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ConfigErrorCode = {\n TSCONFIG_MALFORMED: 'CONFIG_TSCONFIG_MALFORMED',\n PRESET_NOT_FOUND: 'CONFIG_PRESET_NOT_FOUND',\n PRESET_MISSING: 'CONFIG_PRESET_MISSING',\n} as const;\nexport type ConfigErrorCode = typeof ConfigErrorCode[keyof typeof ConfigErrorCode];\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isBaseError } from '@ebec/core';\nimport { MetadataError } from './base';\n\nexport class GeneratorError extends MetadataError {\n\n}\n\nexport function isGeneratorError(input: unknown): input is GeneratorError & { code: string } {\n if (!isBaseError(input)) {\n return false;\n }\n\n return typeof input.code === 'string';\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const GeneratorErrorCode = {\n CONTROLLER_NO_SOURCE_FILE: 'GENERATOR_CONTROLLER_NO_SOURCE_FILE',\n CONTROLLER_NO_NAME: 'GENERATOR_CONTROLLER_NO_NAME',\n PARAMETER_GENERATION_FAILED: 'GENERATOR_PARAMETER_GENERATION_FAILED',\n BODY_PARAMETER_DUPLICATE: 'GENERATOR_BODY_PARAMETER_DUPLICATE',\n BODY_FORM_CONFLICT: 'GENERATOR_BODY_FORM_CONFLICT',\n STRICT_UNMATCHED_DECORATORS: 'GENERATOR_STRICT_UNMATCHED_DECORATORS',\n} as const;\nexport type GeneratorErrorCode = typeof GeneratorErrorCode[keyof typeof GeneratorErrorCode];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterErrorCode = {\n TYPE_UNSUPPORTED: 'PARAMETER_TYPE_UNSUPPORTED',\n METHOD_UNSUPPORTED: 'PARAMETER_METHOD_UNSUPPORTED',\n PATH_MISMATCH: 'PARAMETER_PATH_MISMATCH',\n SCOPE_REQUIRED: 'PARAMETER_SCOPE_REQUIRED',\n INVALID_EXAMPLE: 'PARAMETER_INVALID_EXAMPLE',\n} as const;\nexport type ParameterErrorCode = typeof ParameterErrorCode[keyof typeof ParameterErrorCode];\n","/*\n * Copyright (c) 2022-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\nimport { isClassDeclaration, isMethodDeclaration } from 'typescript';\nimport type { Node } from 'typescript';\nimport type { BaseType } from '@trapi/core';\nimport { ParameterErrorCode } from './parameter-codes';\nimport { MetadataError } from './base';\n\ntype UnsupportedTypeContext = {\n decoratorName: string,\n propertyName: string,\n type: BaseType,\n node?: Node\n};\n\ntype UnsupportedMethodContext = {\n decoratorName: string,\n propertyName: string,\n method: string,\n node?: Node\n};\n\ntype PathMatchInvalidContext = {\n decoratorName: string,\n propertyName: string,\n path: string,\n node?: Node\n};\n\ntype ScopeRequiredContext = {\n decoratorName: string,\n node?: Node\n};\n\nexport class ParameterError extends MetadataError {\n static typeUnsupported(context: UnsupportedTypeContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not support '${context.type.typeName}' type${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.TYPE_UNSUPPORTED,\n });\n }\n\n static methodUnsupported(context: UnsupportedMethodContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not support method '${context.method}'${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.METHOD_UNSUPPORTED,\n });\n }\n\n static invalidPathMatch(context: PathMatchInvalidContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not exist in path '${context.path}'${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.PATH_MISMATCH,\n });\n }\n\n static scopeRequired(context: ScopeRequiredContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}() requires a scope argument${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.SCOPE_REQUIRED,\n });\n }\n\n static invalidExampleSchema() {\n return new ParameterError({\n message: 'The @example JSDoc tag contains invalid JSON.',\n code: ParameterErrorCode.INVALID_EXAMPLE,\n });\n }\n\n public static getCurrentLocation(node: Node) {\n const parts : string[] = [];\n\n if (isMethodDeclaration(node.parent)) {\n parts.push(node.parent.name.getText());\n\n if (isClassDeclaration(node.parent.parent) && node.parent.parent.name) {\n parts.unshift(node.parent.parent.name.text);\n }\n }\n\n return parts.join('.');\n }\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { normalize } from 'node:path';\nimport { isBaseError } from '@ebec/core';\nimport type { Node, TypeNode } from 'typescript';\nimport { MetadataError } from './base';\n\nexport class ResolverError extends MetadataError {\n public readonly file?: string;\n\n public readonly line?: number;\n\n constructor(\n message: string,\n node?: Node | TypeNode,\n options?: boolean | { onlyCurrent?: boolean, cause?: unknown },\n ) {\n const opts = typeof options === 'boolean' ? { onlyCurrent: options } : options;\n const onlyCurrent = opts?.onlyCurrent ?? false;\n\n const parts: string[] = [message];\n let file: string | undefined;\n let line: number | undefined;\n\n if (node) {\n const location = prettyLocationOfNode(node);\n if (location) {\n parts.push(location.text);\n file = location.file;\n line = location.line;\n }\n\n parts.push(prettyTroubleCause(node, onlyCurrent));\n }\n\n super({\n message: parts.join('\\n'),\n cause: opts?.cause,\n });\n\n this.file = file;\n this.line = line;\n }\n}\n\nexport function isResolverError(input: unknown): input is ResolverError {\n if (!isBaseError(input)) {\n return false;\n }\n\n return 'file' in input && 'line' in input;\n}\n\nexport function prettyLocationOfNode(node: Node | TypeNode): {\n text: string,\n file: string,\n line?: number,\n} | undefined {\n try {\n const sourceFile = node.getSourceFile();\n if (!sourceFile) return undefined;\n\n const token = node.getFirstToken() || node.parent?.getFirstToken();\n const start = token ? sourceFile.getLineAndCharacterOfPosition(token.getStart()).line + 1 : undefined;\n const end = token ? sourceFile.getLineAndCharacterOfPosition(token.getEnd()).line + 1 : undefined;\n\n const normalizedFile = normalize(sourceFile.fileName);\n const startSuffix = start ? `:${start}` : '';\n const endSuffix = end ? `:${end}` : '';\n\n return {\n text: `At: ${normalizedFile}${startSuffix}${endSuffix}.`,\n file: sourceFile.fileName,\n line: start,\n };\n } catch {\n return undefined;\n }\n}\n\nexport function prettyTroubleCause(node: Node | TypeNode, onlyCurrent = false) {\n try {\n let name: string;\n if (onlyCurrent || !node.parent) {\n name = node.pos !== -1 ? node.getText() : (node as any).name.text;\n } else {\n name = node.parent.pos !== -1 ? node.parent.getText() : (node as any).parent.name.text;\n }\n\n return `This was caused by '${name}'`;\n } catch {\n return 'This was caused by an unknown node';\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { MetadataError } from './base';\n\nexport class ValidatorError extends MetadataError {\n\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ValidatorErrorCode = {\n EXPECTED_NUMBER: 'VALIDATOR_EXPECTED_NUMBER',\n EXPECTED_DATE: 'VALIDATOR_EXPECTED_DATE',\n EXPECTED_STRING: 'VALIDATOR_EXPECTED_STRING',\n} as const;\nexport type ValidatorErrorCode = typeof ValidatorErrorCode[keyof typeof ValidatorErrorCode];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum JSDocTagName {\n ABSTRACT = 'abstract',\n ACCESS = 'access',\n ALIAS = 'alias',\n ASYNC = 'async',\n /**\n * Alias for @extends\n */\n AUGMENTS = 'augments',\n AUTHOR = 'author',\n\n // todo: ... add missing\n\n DEFAULT = 'default',\n DEPRECATED = 'deprecated',\n DESCRIPTION = 'description',\n EXAMPLE = 'example',\n\n FORMAT = 'format',\n\n IGNORE = 'ignore',\n\n SUMMARY = 'summary',\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function isStringArray(input: unknown) : input is string[] {\n if (!Array.isArray(input)) {\n return false;\n }\n\n for (const element of input) {\n if (typeof element !== 'string') {\n return false;\n }\n }\n\n return true;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function hasOwnProperty<Y extends PropertyKey>(obj: unknown, prop: Y): obj is Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function normalizePath(str: string) : string {\n // remove slashes\n str = str.replace(/^[/\\\\\\s]+|[/\\\\\\s]+$/g, '');\n\n str = str.replace(/([^:]\\/)\\/+/g, '$1');\n\n return str;\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from 'locter';\nimport type { JSDocComment, NodeArray } from 'typescript';\n\nexport function transformJSDocComment(\n input?: string | NodeArray<JSDocComment>,\n) : string | undefined {\n if (typeof input === 'string') {\n return input;\n }\n\n if (!input || input.length === 0) {\n return undefined;\n }\n\n const comment = input[0];\n if (typeof comment === 'string') {\n return comment;\n }\n\n if (\n isObject(comment) &&\n typeof comment.text === 'string'\n ) {\n return comment.text;\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Identifier, \n JSDoc, \n JSDocTag, \n Node,\n} from 'typescript';\nimport { SyntaxKind, isJSDocParameterTag } from 'typescript';\nimport { MetadataError } from '../../../core/error';\nimport { hasOwnProperty } from '../../../core/utils';\nimport type { JSDocTagName } from './constants';\nimport { transformJSDocComment } from './utils';\n\n// -----------------------------------------\n// Description\n// -----------------------------------------\nexport function getJSDocDescription(node: Node, index?: number) : string | undefined {\n const jsDoc = getJSDoc(node, index);\n if (!jsDoc) {\n return undefined;\n }\n\n return transformJSDocComment(jsDoc.comment);\n}\n\n// -----------------------------------------\n// Tag\n// -----------------------------------------\n\nexport function getJSDoc(node: Node, index?: number) : undefined | JSDoc {\n if (!hasOwnProperty(node, 'jsDoc')) {\n return undefined;\n }\n\n const jsDoc : JSDoc[] | undefined = (node as any).jsDoc as JSDoc[];\n\n if (!jsDoc || !Array.isArray(jsDoc) || !jsDoc.length) {\n return undefined;\n }\n\n index = index ?? 0;\n return jsDoc.length > index && index >= 0 ? jsDoc[index] : undefined; // jsDoc[0] else case\n}\n\nexport function getJSDocTags(\n node: Node,\n isMatching?:\n | `${JSDocTagName}` |\n `${JSDocTagName}`[] |\n (string & {}) |\n (string & {})[] |\n ((tag: JSDocTag) => boolean),\n) : JSDocTag[] {\n const jsDoc = getJSDoc(node);\n if (typeof jsDoc === 'undefined') {\n return [];\n }\n\n const jsDocTags : JSDocTag[] = jsDoc.tags as unknown as JSDocTag[];\n\n if (typeof jsDocTags === 'undefined') {\n return [];\n }\n\n if (typeof isMatching === 'undefined') {\n return jsDocTags;\n }\n\n if (typeof isMatching === 'function') {\n return jsDocTags.filter(isMatching);\n }\n\n const tagNames : string[] = Array.isArray(isMatching) ? isMatching : [isMatching];\n\n return jsDocTags.filter((tag) => tagNames.includes(tag.tagName.text));\n}\n\nexport function hasJSDocTag(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}` | (string & {})) : boolean {\n const tags : JSDocTag[] = getJSDocTags(node, tagName);\n\n return !(!tags || !tags.length);\n}\n\n// -----------------------------------------\n// Tag Comment(s)\n// -----------------------------------------\n\nexport function getJSDocTagComment(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}`) : undefined | string {\n const tags : JSDocTag[] = getJSDocTags(node, tagName);\n const first = tags[0];\n if (!first || typeof first.comment !== 'string') {\n return undefined;\n }\n return first.comment;\n}\n\n// -----------------------------------------\n// Tag Names\n// -----------------------------------------\n\nexport function getJSDocTagNames(node: Node, requireTagName = false) : string[] {\n let tags: JSDocTag[];\n\n /* istanbul ignore next */\n if (node.kind === SyntaxKind.Parameter) {\n const parameterName = ((node as any).name as Identifier).text;\n tags = getJSDocTags(node.parent as any, (tag) => {\n if (isJSDocParameterTag(tag)) {\n return false;\n } if (tag.comment === undefined) {\n throw new MetadataError(`Orphan tag: @${String(tag.tagName.text || tag.tagName.escapedText)} must be followed by a parameter name.`);\n }\n return typeof tag.comment === 'string' ? tag.comment.startsWith(parameterName) : false;\n });\n } else {\n tags = getJSDocTags(node as any, (tag) => (requireTagName ? tag.comment !== undefined : true));\n }\n\n return tags.map((tag) => tag.tagName.text);\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { SyntaxKind, isImportSpecifier } from 'typescript';\nimport type {\n ArrayLiteralExpression,\n Declaration,\n Expression,\n HasInitializer,\n Identifier,\n ImportSpecifier,\n NewExpression,\n Node,\n NumericLiteral,\n ObjectLiteralExpression,\n PrefixUnaryExpression,\n StringLiteral,\n Symbol as TsSymbol,\n TypeChecker,\n} from 'typescript';\nimport { MetadataError } from '../../core/error';\nimport type { Type } from '@trapi/core';\nimport { hasOwnProperty } from '../../core/utils/object';\n\nexport function getInitializerValue(\n initializer?: Expression,\n typeChecker?: TypeChecker,\n type?: Type,\n) : unknown {\n if (!initializer) {\n return undefined;\n }\n\n switch (initializer.kind) {\n case SyntaxKind.ArrayLiteralExpression: {\n const arrayLiteral = initializer as ArrayLiteralExpression;\n return arrayLiteral.elements.map((element) => getInitializerValue(element, typeChecker));\n }\n case SyntaxKind.StringLiteral:\n case SyntaxKind.NoSubstitutionTemplateLiteral:\n return (initializer as StringLiteral).text;\n case SyntaxKind.TrueKeyword:\n return true;\n case SyntaxKind.FalseKeyword:\n return false;\n case SyntaxKind.PrefixUnaryExpression: {\n const prefixUnary = initializer as PrefixUnaryExpression;\n switch (prefixUnary.operator) {\n case SyntaxKind.PlusToken:\n return Number((prefixUnary.operand as NumericLiteral).text);\n case SyntaxKind.MinusToken:\n return Number(`-${(prefixUnary.operand as NumericLiteral).text}`);\n default:\n throw new MetadataError(`Unsupported prefix operator token: ${prefixUnary.operator}`);\n }\n }\n case SyntaxKind.NumberKeyword:\n case SyntaxKind.FirstLiteralToken:\n return Number((initializer as NumericLiteral).text);\n case SyntaxKind.NewExpression: {\n const newExpression = initializer as NewExpression;\n const ident = newExpression.expression as Identifier;\n\n if (ident.text === 'Date') {\n let date = new Date();\n if (newExpression.arguments) {\n const newArguments = newExpression.arguments.filter((args) => args.kind !== undefined);\n const argsValue = newArguments.map((args) => getInitializerValue(args, typeChecker));\n if (argsValue.length > 0) {\n date = new Date(argsValue as any);\n }\n }\n const dateString = date.toISOString();\n if (type && type.typeName === 'date') {\n return dateString.split('T')[0];\n }\n\n return dateString;\n }\n\n return undefined;\n }\n case SyntaxKind.NullKeyword: {\n return null;\n }\n case SyntaxKind.ObjectLiteralExpression: {\n const objectLiteral = initializer as ObjectLiteralExpression;\n const nestedObject: any = {};\n objectLiteral.properties.forEach((p: any) => {\n nestedObject[p.name.text] = getInitializerValue(p.initializer, typeChecker);\n });\n return nestedObject;\n }\n case SyntaxKind.ImportSpecifier: {\n if (typeof typeChecker === 'undefined') {\n return undefined;\n }\n\n const importSpecifier = (initializer as any) as ImportSpecifier;\n const importSymbol = typeChecker.getSymbolAtLocation(importSpecifier.name);\n if (!importSymbol) {\n return undefined;\n }\n\n const aliasedSymbol = typeChecker.getAliasedSymbol(importSymbol);\n const declarations = aliasedSymbol.getDeclarations();\n const declaration = declarations && declarations.length > 0 ? declarations[0] : undefined;\n return getInitializerValue(extractInitializer(declaration), typeChecker);\n }\n default: {\n if (typeof initializer === 'undefined') {\n return undefined;\n }\n if (\n typeof initializer.parent === 'undefined' ||\n typeof typeChecker === 'undefined'\n ) {\n if (hasOwnProperty(initializer, 'text')) {\n return initializer.text;\n }\n\n return undefined;\n }\n\n const symbol = typeChecker.getSymbolAtLocation(initializer);\n if (!symbol) {\n return undefined;\n }\n return getInitializerValue(\n extractInitializer(symbol.valueDeclaration) || extractInitializer(extractImportSpecifier(symbol)),\n typeChecker,\n );\n }\n }\n}\n\nexport const hasInitializer = (\n node: Node,\n): node is HasInitializer => Object.prototype.hasOwnProperty.call(node, 'initializer');\nconst extractInitializer = (\n valueDeclaration?: Declaration,\n) => (valueDeclaration && hasInitializer(valueDeclaration) && (valueDeclaration.initializer as Expression)) || undefined;\nconst extractImportSpecifier = (\n symbol?: TsSymbol,\n) => {\n const declaration = symbol?.declarations?.[0];\n return declaration && isImportSpecifier(declaration) ? declaration : undefined;\n};\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n canHaveDecorators,\n getDecorators,\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isNoSubstitutionTemplateLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPrefixUnaryExpression,\n isPropertyAccessExpression,\n isStringLiteral,\n} from 'typescript';\nimport type {\n Expression,\n Node,\n TypeChecker,\n} from 'typescript';\nimport { getInitializerValue } from '../../typescript/initializer';\nimport type { DecoratorArgument } from '@trapi/core';\n\nexport type RawDecorator = {\n name: string;\n arguments: DecoratorArgument[];\n};\n\n/**\n * Enumerate decorators on a TS node and classify their argument values without\n * going through the registry. Used by read-side consumers (type resolver,\n * extension extraction) that only need decorator names + argument values.\n */\nexport function readNodeDecorators(node: Node, typeChecker?: TypeChecker): RawDecorator[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n const decorators = getDecorators(node);\n if (!decorators || decorators.length === 0) {\n return [];\n }\n\n const output: RawDecorator[] = [];\n for (const decorator of decorators) {\n const { expression } = decorator;\n let name: string | undefined;\n let argumentExpressions: readonly Expression[] = [];\n\n if (isCallExpression(expression)) {\n argumentExpressions = expression.arguments;\n name = readDecoratorName(expression.expression);\n } else {\n name = readDecoratorName(expression);\n }\n\n if (!name) {\n continue;\n }\n\n output.push({\n name,\n arguments: argumentExpressions.map((a) => buildDecoratorArgument(a, typeChecker)),\n });\n }\n return output;\n}\n\nexport function findDecoratorByName(\n node: Node,\n name: string,\n typeChecker?: TypeChecker,\n): RawDecorator | undefined {\n return readNodeDecorators(node, typeChecker).find((d) => d.name === name);\n}\n\nexport function findDecoratorsByName(\n node: Node,\n name: string,\n typeChecker?: TypeChecker,\n): RawDecorator[] {\n return readNodeDecorators(node, typeChecker).filter((d) => d.name === name);\n}\n\nexport function hasDecoratorNamed(node: Node, name: string, typeChecker?: TypeChecker): boolean {\n return readNodeDecorators(node, typeChecker).some((d) => d.name === name);\n}\n\nfunction readDecoratorName(expression: Node): string | undefined {\n if (isIdentifier(expression)) {\n return expression.text;\n }\n if (isPropertyAccessExpression(expression)) {\n return expression.name.text;\n }\n return undefined;\n}\n\nexport function buildDecoratorArgument(\n expr: Expression,\n typeChecker?: TypeChecker,\n): DecoratorArgument {\n if (\n isStringLiteral(expr) ||\n isNumericLiteral(expr) ||\n isNoSubstitutionTemplateLiteral(expr)\n ) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.TrueKeyword) {\n return { raw: true, kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.FalseKeyword) {\n return { raw: false, kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.NullKeyword) {\n return { raw: null, kind: 'literal' };\n }\n\n if (\n isPrefixUnaryExpression(expr) &&\n (expr.operator === SyntaxKind.PlusToken || expr.operator === SyntaxKind.MinusToken) &&\n isNumericLiteral(expr.operand)\n ) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'literal' };\n }\n\n if (isObjectLiteralExpression(expr)) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'object' };\n }\n\n if (isArrayLiteralExpression(expr)) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'array' };\n }\n\n if (isIdentifier(expr) || isPropertyAccessExpression(expr)) {\n const value = getInitializerValue(expr, typeChecker);\n if (typeof value !== 'undefined') {\n return { raw: value, kind: 'identifier' };\n }\n return { raw: undefined, kind: 'unresolvable' };\n }\n\n return { raw: undefined, kind: 'unresolvable' };\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n canHaveDecorators,\n getDecorators,\n isCallExpression,\n isIdentifier,\n isJSDocParameterTag,\n isJSDocPropertyTag,\n isJSDocReturnTag,\n isJSDocThisTag,\n isJSDocTypeTag,\n isPropertyAccessExpression,\n isQualifiedName,\n} from 'typescript';\nimport type {\n Decorator,\n EntityName,\n Expression,\n JSDocTag,\n Node,\n TypeNode,\n} from 'typescript';\nimport { getJSDocTags } from '../../typescript/js-doc';\nimport { transformJSDocComment } from '../../typescript/js-doc/utils';\nimport type {\n DecoratorArgument,\n DecoratorSource,\n DecoratorTypeArgument,\n JsDocSource,\n} from '@trapi/core';\nimport type { DecoratorSourceBuilderOptions, JsDocSourceBuilderOptions } from './types';\nimport { buildDecoratorArgument } from './utils';\n\n// -----------------------------------------------------------------------------\n// Decorator sources\n// -----------------------------------------------------------------------------\n\nexport function buildDecoratorSources(\n node: Node,\n options: DecoratorSourceBuilderOptions,\n): DecoratorSource[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n\n const decorators = getDecorators(node);\n if (!decorators || decorators.length === 0) {\n return [];\n }\n\n const output: DecoratorSource[] = [];\n for (const decorator of decorators) {\n const source = buildDecoratorSource(decorator, options);\n if (source) {\n output.push(source);\n }\n }\n return output;\n}\n\nfunction buildDecoratorSource(\n decorator: Decorator,\n options: DecoratorSourceBuilderOptions,\n): DecoratorSource | undefined {\n const { expression } = decorator;\n\n let name: string | undefined;\n let argumentExpressions: readonly Expression[] = [];\n let typeArgumentNodes: readonly TypeNode[] = [];\n\n if (isCallExpression(expression)) {\n argumentExpressions = expression.arguments;\n typeArgumentNodes = expression.typeArguments ?? [];\n name = readDecoratorName(expression.expression);\n } else {\n name = readDecoratorName(expression);\n }\n\n if (!name) {\n return undefined;\n }\n\n const decoratorArguments: DecoratorArgument[] = argumentExpressions.map(\n (arg) => buildDecoratorArgument(arg, options.typeChecker),\n );\n\n const decoratorTypeArguments: DecoratorTypeArgument[] = typeArgumentNodes.map(\n (typeNode) => ({ resolve: () => options.resolveTypeNode(typeNode) }),\n );\n\n const sourceFile = decorator.getSourceFile();\n const location = sourceFile ? {\n file: sourceFile.fileName,\n line: sourceFile.getLineAndCharacterOfPosition(decorator.getStart()).line + 1,\n } : undefined;\n\n return {\n name,\n arguments: decoratorArguments,\n typeArguments: decoratorTypeArguments,\n target: options.target,\n host: options.host,\n location,\n };\n}\n\nfunction readDecoratorName(expression: Node): string | undefined {\n if (isIdentifier(expression)) {\n return expression.text;\n }\n if (isPropertyAccessExpression(expression)) {\n return expression.name.text;\n }\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// JSDoc sources\n// -----------------------------------------------------------------------------\n\nexport function buildJsDocSources(\n node: Node,\n options: JsDocSourceBuilderOptions,\n): JsDocSource[] {\n const tags = getJSDocTags(node);\n if (tags.length === 0) {\n return [];\n }\n\n const output: JsDocSource[] = [];\n for (const tag of tags) {\n output.push(buildJsDocSource(tag, options));\n }\n return output;\n}\n\nfunction buildJsDocSource(\n tag: JSDocTag,\n options: JsDocSourceBuilderOptions,\n): JsDocSource {\n const tagName = tag.tagName.text;\n const text = transformJSDocComment(tag.comment);\n\n let parameterName: string | undefined;\n let typeNode: TypeNode | undefined;\n\n if (isJSDocParameterTag(tag) || isJSDocPropertyTag(tag)) {\n if (tag.name) {\n parameterName = readEntityName(tag.name);\n }\n typeNode = tag.typeExpression?.type;\n } else if (\n isJSDocReturnTag(tag) ||\n isJSDocTypeTag(tag) ||\n isJSDocThisTag(tag)\n ) {\n typeNode = tag.typeExpression?.type;\n }\n\n const source: JsDocSource = {\n tag: tagName,\n target: options.target,\n host: options.host,\n };\n\n if (typeof text !== 'undefined') {\n source.text = text;\n }\n\n if (typeof parameterName !== 'undefined') {\n source.parameterName = parameterName;\n }\n\n if (typeNode) {\n const capturedTypeNode = typeNode;\n source.typeExpression = { resolve: () => options.resolveTypeNode(capturedTypeNode) };\n }\n\n return source;\n}\n\nfunction readEntityName(name: EntityName): string | undefined {\n if (isIdentifier(name)) {\n return name.text;\n }\n if (isQualifiedName(name)) {\n const left = readEntityName(name.left);\n return left ? `${left}.${name.right.text}` : name.right.text;\n }\n return undefined;\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n matches,\n matchesJsDoc,\n} from '@trapi/core';\nimport type {\n DecoratorSource,\n HandlerContext,\n JsDocHandlerContext,\n JsDocMatch,\n JsDocSource,\n Match,\n} from '@trapi/core';\nimport { buildDecoratorSources, buildJsDocSources } from '../typescript';\nimport type { ApplyHandlersOptions } from './types';\n\ntype DecoratorHandlerLike<D> = {\n match: Match;\n apply: (ctx: HandlerContext, draft: D) => void;\n};\n\ntype JsDocHandlerLike<D> = {\n match: JsDocMatch;\n apply: (ctx: JsDocHandlerContext, draft: D) => void;\n};\n\nexport function buildHandlerContext(\n source: DecoratorSource,\n options: ApplyHandlersOptions,\n): HandlerContext {\n return {\n host: source.host,\n argument: (i) => source.arguments[i],\n arguments: () => source.arguments,\n typeArgument: (i) => source.typeArguments[i],\n typeArguments: () => source.typeArguments,\n parameterType: options.parameterType ?? (() => undefined),\n };\n}\n\nexport function buildJsDocHandlerContext(\n source: JsDocSource,\n options: ApplyHandlersOptions,\n): JsDocHandlerContext {\n return {\n host: source.host,\n source,\n parameterType: options.parameterType ?? (() => undefined),\n };\n}\n\nexport function applyDecoratorHandlers<D>(\n node: Node,\n handlers: DecoratorHandlerLike<D>[],\n draft: D,\n options: ApplyHandlersOptions,\n): void {\n if (handlers.length === 0 && !options.onUnmatchedDecorator) {\n return;\n }\n const sources = buildDecoratorSources(node, options);\n if (sources.length === 0) {\n return;\n }\n for (const source of sources) {\n let matched = 0;\n for (const handler of handlers) {\n if (matches(handler.match, source)) {\n handler.apply(buildHandlerContext(source, options), draft);\n matched += 1;\n }\n }\n if (matched === 0 && options.onUnmatchedDecorator) {\n // Prefer the decorator's own AST line if `buildDecoratorSources`\n // populated it; fall back to the host node's line otherwise.\n let file: string;\n let line: number;\n if (source.location) {\n file = source.location.file;\n line = source.location.line;\n } else {\n const sourceFile = node.getSourceFile();\n file = sourceFile.fileName;\n line = sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1;\n }\n options.onUnmatchedDecorator(\n {\n name: source.name,\n target: source.target,\n host: source.host,\n file,\n line,\n },\n source,\n );\n }\n }\n}\n\nexport function applyJsDocHandlers<D>(\n node: Node,\n handlers: JsDocHandlerLike<D>[],\n draft: D,\n options: ApplyHandlersOptions,\n): void {\n if (handlers.length === 0) {\n return;\n }\n const sources = buildJsDocSources(node, options);\n if (sources.length === 0) {\n return;\n }\n for (const source of sources) {\n for (const handler of handlers) {\n if (matchesJsDoc(handler.match, source)) {\n handler.apply(buildJsDocHandlerContext(source, options), draft);\n }\n }\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ParameterDeclaration, \n PropertyDeclaration, \n PropertySignature, \n TypeAliasDeclaration,\n} from 'typescript';\nimport type { Validator } from '@trapi/core';\nimport { ValidatorName } from '@trapi/core';\nimport { ValidatorError } from '../../../core/error/validator';\nimport { getJSDocTags, transformJSDocComment } from '../js-doc';\nimport { ValidatorErrorCode } from '../../../core/error/validator-codes';\n\nexport function getDeclarationValidators(\n declaration: PropertyDeclaration | TypeAliasDeclaration | PropertySignature | ParameterDeclaration,\n name?: string,\n): Record<string, Validator> {\n if (!declaration.parent) {\n return {};\n }\n\n const getCommentValue = (comment?: string) => comment && comment.split(' ')[0];\n\n const parameterTags = getSupportedParameterTags();\n const tags = getJSDocTags(declaration.parent, (tag) => {\n const { comment } = tag;\n if (!comment) {\n return false;\n }\n\n const text = transformJSDocComment(comment);\n const commentValue = getCommentValue(text);\n\n return parameterTags.some((value) => {\n if (value !== tag.tagName.text) {\n return false;\n }\n\n return !(name && name !== commentValue);\n });\n });\n\n function getErrorMsg(comment?: string, isValue = true) : string | undefined {\n if (!comment) {\n return undefined;\n }\n if (isValue) {\n const indexOf = comment.indexOf(' ');\n if (indexOf > 0) {\n return comment.substring(indexOf + 1);\n }\n return undefined;\n }\n\n return comment;\n }\n\n const validators : Record<string, Validator> = {};\n\n for (const tag of tags) {\n if (!tag.comment) {\n continue;\n }\n\n const name = tag.tagName.text;\n\n const rawComment = transformJSDocComment(tag.comment);\n if (!rawComment) {\n continue;\n }\n const comment = rawComment.substring(rawComment.indexOf(' ') + 1).trim();\n\n const value = getCommentValue(comment);\n\n switch (name) {\n case ValidatorName.UNIQUE_ITEMS:\n validators[name] = {\n message: getErrorMsg(comment, false),\n value: undefined,\n };\n break;\n case ValidatorName.MINIMUM:\n case ValidatorName.MAXIMUM:\n case ValidatorName.MIN_ITEMS:\n case ValidatorName.MAX_ITEMS:\n case ValidatorName.MIN_LENGTH:\n case ValidatorName.MAX_LENGTH:\n {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n throw new ValidatorError({\n message: `@${name} validator expects a numeric value, got '${value}'.`,\n code: ValidatorErrorCode.EXPECTED_NUMBER,\n });\n }\n validators[name] = {\n message: getErrorMsg(comment),\n value: parsed,\n };\n }\n break;\n case ValidatorName.MIN_DATE:\n case ValidatorName.MAX_DATE:\n if (typeof value !== 'string') {\n throw new ValidatorError({\n message: `@${name} validator expects a date string, got '${typeof value}'.`,\n code: ValidatorErrorCode.EXPECTED_DATE,\n });\n }\n\n validators[name] = {\n message: getErrorMsg(comment),\n value,\n };\n break;\n case ValidatorName.PATTERN:\n if (typeof value !== 'string') {\n throw new ValidatorError({\n message: `@${name} validator expects a string pattern, got '${value}'.`,\n code: ValidatorErrorCode.EXPECTED_STRING,\n });\n }\n\n validators[name] = {\n message: getErrorMsg(comment),\n value: removeSurroundingQuotes(value),\n };\n break;\n default:\n if (name.toLowerCase().startsWith('is')) {\n const errorMsg = getErrorMsg(comment, false);\n if (errorMsg) {\n validators[name] = {\n message: errorMsg,\n value: undefined,\n };\n }\n }\n break;\n }\n }\n\n return validators;\n}\n\nfunction getSupportedParameterTags() {\n return [\n 'isString',\n 'isBoolean',\n 'isInt',\n 'isLong',\n 'isFloat',\n 'isDouble',\n 'isDate',\n 'isDateTime',\n\n 'minItems',\n 'maxItems',\n 'uniqueItems',\n 'minLength',\n 'maxLength',\n 'pattern',\n 'minimum',\n 'maximum',\n 'minDate',\n 'maxDate',\n ];\n}\n\nfunction removeSurroundingQuotes(str: string) {\n if (str.startsWith('`') && str.endsWith('`')) {\n return str.substring(1, str.length - 1);\n }\n if (str.startsWith('```') && str.endsWith('```')) {\n return str.substring(3, str.length - 3);\n }\n return str;\n}\n","/*\n * Copyright (c) 2023-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n isExtensionMarker,\n namesForMarker,\n} from '@trapi/core';\nimport type { Extension, Registry } from '@trapi/core';\nimport { findDecoratorsByName } from '../../../decorator';\n\nexport function getNodeExtensions(node: Node, registry: Registry) : Extension[] {\n const names = namesForMarker(registry, isExtensionMarker);\n if (names.size === 0) {\n return [];\n }\n\n const output : Extension[] = [];\n for (const name of names) {\n const decorators = findDecoratorsByName(node, name);\n for (const decorator of decorators) {\n const keyArg = decorator.arguments[0];\n const valueArg = decorator.arguments[1];\n if (!keyArg || keyArg.kind !== 'literal' || typeof keyArg.raw !== 'string') {\n continue;\n }\n if (!valueArg || valueArg.kind === 'unresolvable' || typeof valueArg.raw === 'undefined') {\n continue;\n }\n output.push({ key: keyArg.raw, value: valueArg.raw as never });\n }\n }\n return output;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isArrayTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { ArrayType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveArrayType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isArrayTypeNode(typeNode)) {\n return undefined;\n }\n\n return {\n typeName: TypeName.ARRAY,\n elementType: ctx.resolveType(\n typeNode.elementType,\n ctx.parentNode,\n ctx.context,\n ),\n } as ArrayType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n SyntaxKind,\n canHaveModifiers,\n getModifiers,\n} from 'typescript';\n\n\nexport class ResolverBase {\n protected hasPublicModifier(node: Node) {\n if (!canHaveModifiers(node)) {\n return true;\n }\n\n const modifiers = getModifiers(node);\n if (!modifiers) {\n return true;\n }\n\n return modifiers.every(\n (modifier) => modifier.kind !== SyntaxKind.ProtectedKeyword && modifier.kind !== SyntaxKind.PrivateKeyword,\n );\n }\n\n protected hasStaticModifier(node: Node) {\n if (!canHaveModifiers(node)) {\n return false;\n }\n\n const modifiers = getModifiers(node);\n\n return modifiers && modifiers.some((modifier) => modifier.kind === SyntaxKind.StaticKeyword);\n }\n\n protected isAccessibleParameter(node: Node) {\n // No modifiers\n if (!canHaveModifiers(node)) {\n return false;\n }\n\n const modifiers = getModifiers(node);\n if (!modifiers) {\n return false;\n }\n\n // public || public readonly\n if (modifiers.some((modifier) => modifier.kind === SyntaxKind.PublicKeyword)) {\n return true;\n }\n\n // readonly, not private readonly, not public readonly\n const isReadonly = modifiers.some((modifier) => modifier.kind === SyntaxKind.ReadonlyKeyword);\n const isProtectedOrPrivate = modifiers.some(\n (modifier) => modifier.kind === SyntaxKind.ProtectedKeyword ||\n modifier.kind === SyntaxKind.PrivateKeyword,\n );\n\n return isReadonly && !isProtectedOrPrivate;\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\nimport type {\n Node,\n TypeChecker,\n TypeNode,\n} from 'typescript';\nimport { SyntaxKind, displayPartsToString } from 'typescript';\nimport { hasOwnProperty } from '../../../core/utils';\nimport { ResolverError } from '../../../core/error/resolver';\n\nexport function getNodeDescription(\n node: Node,\n typeChecker: TypeChecker,\n) {\n if (!hasOwnProperty(node, 'name')) {\n return undefined;\n }\n\n const symbol = typeChecker.getSymbolAtLocation(node.name as Node);\n if (!symbol) {\n return undefined;\n }\n\n /**\n * TODO: Workaround for what seems like a bug in the compiler\n * Warrants more investigation and possibly a PR against typescript\n */\n if (node.kind === SyntaxKind.Parameter) {\n // TypeScript won't parse jsdoc if the flag is 4, i.e. 'Property'\n symbol.flags = 0;\n }\n\n const comments = symbol.getDocumentationComment(typeChecker);\n if (comments.length) {\n return displayPartsToString(comments);\n }\n\n return undefined;\n}\n\nexport function toTypeNodeOrFail(\n typeChecker: TypeChecker,\n ...args: Parameters<TypeChecker['typeToTypeNode']>\n) : TypeNode {\n const output = typeChecker.typeToTypeNode(...args);\n if (typeof output === 'undefined') {\n throw new ResolverError('Type could not be transformed to TypeNode.');\n }\n\n return output;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n isIndexedAccessTypeNode,\n isLiteralTypeNode,\n isNumericLiteral,\n isStringLiteral,\n} from 'typescript';\nimport type { HasType, Node, TypeNode } from 'typescript';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type { Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveIndexedAccessType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isIndexedAccessTypeNode(typeNode)) {\n return undefined;\n }\n\n // Variant 1: T[number] or T[string]\n if (\n typeNode.indexType.kind === SyntaxKind.NumberKeyword ||\n typeNode.indexType.kind === SyntaxKind.StringKeyword\n ) {\n const numberIndexType = typeNode.indexType.kind === SyntaxKind.NumberKeyword;\n const objectType = ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType);\n const type = numberIndexType ? objectType.getNumberIndexType() : objectType.getStringIndexType();\n if (type === undefined) {\n throw new ResolverError(\n `Could not determine ${numberIndexType ? 'number' : 'string'} index on ${ctx.typeChecker.typeToString(objectType)}`,\n typeNode,\n );\n }\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, type, undefined, undefined),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n // Variant 2: T['key'] or T[0]\n if (\n isLiteralTypeNode(typeNode.indexType) &&\n (\n isStringLiteral(typeNode.indexType.literal) ||\n isNumericLiteral(typeNode.indexType.literal)\n )\n ) {\n const hasType = (node: Node | undefined): node is HasType => node !== undefined &&\n Object.prototype.hasOwnProperty.call(node, 'type');\n\n const symbol = ctx.typeChecker.getPropertyOfType(\n ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType),\n typeNode.indexType.literal.text,\n );\n\n if (symbol === undefined) {\n throw new ResolverError(\n `Could not determine the keys on ${ctx.typeChecker.typeToString(ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType))}`,\n typeNode,\n );\n }\n\n if (hasType(symbol.valueDeclaration) && symbol.valueDeclaration.type) {\n return ctx.resolveType(\n symbol.valueDeclaration.type,\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n const declaration = ctx.typeChecker.getTypeOfSymbolAtLocation(symbol, typeNode.objectType);\n try {\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, declaration, undefined, undefined),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n } catch (err) {\n throw new ResolverError(\n `Could not determine the keys on ${ctx.typeChecker.typeToString(declaration)}`,\n typeNode,\n { cause: err },\n );\n }\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isIntersectionTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { IntersectionType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveIntersectionType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isIntersectionTypeNode(typeNode)) {\n return undefined;\n }\n\n const members = typeNode.types.map(\n (type) => ctx.resolveType(type, ctx.parentNode, ctx.context),\n );\n\n return {\n typeName: TypeName.INTERSECTION,\n members,\n } as IntersectionType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n isFunctionTypeNode,\n isLiteralTypeNode,\n isParenthesizedTypeNode,\n} from 'typescript';\nimport type {\n LiteralExpression,\n LiteralTypeNode,\n StringLiteralType,\n TypeNode,\n} from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n AnyType,\n EnumType,\n Type,\n} from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveLiteralType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (typeNode.kind === SyntaxKind.NullKeyword) {\n return {\n typeName: TypeName.ENUM,\n members: [null],\n } as EnumType;\n }\n\n if (\n typeNode.kind === SyntaxKind.AnyKeyword ||\n typeNode.kind === SyntaxKind.UnknownKeyword\n ) {\n return { typeName: TypeName.ANY } as AnyType;\n }\n\n if (isLiteralTypeNode(typeNode)) {\n return {\n typeName: TypeName.ENUM,\n members: [getLiteralValue(typeNode)],\n } as EnumType;\n }\n\n if (typeNode.kind === SyntaxKind.TemplateLiteralType) {\n const type = ctx.typeChecker.getTypeFromTypeNode(ctx.referencer || typeNode);\n if (type.isUnion() && type.types.every((t) => t.isStringLiteral())) {\n return {\n typeName: TypeName.ENUM,\n members: type.types.map(\n (t: StringLiteralType) => t.value,\n ),\n } as EnumType;\n }\n\n throw new ResolverError(\n `Could not resolve type: ${ctx.typeChecker.typeToString(ctx.typeChecker.getTypeFromTypeNode(typeNode), typeNode)}`,\n typeNode,\n );\n }\n\n if (isParenthesizedTypeNode(typeNode)) {\n return ctx.resolveType(\n typeNode.type,\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n if (\n typeNode.kind === SyntaxKind.ObjectKeyword ||\n isFunctionTypeNode(typeNode)\n ) {\n return { typeName: TypeName.OBJECT };\n }\n\n return undefined;\n}\n\nexport function getLiteralValue(typeNode: LiteralTypeNode): string | number | boolean | null {\n let value: boolean | number | string | null;\n switch (typeNode.literal.kind) {\n case SyntaxKind.TrueKeyword:\n value = true;\n break;\n case SyntaxKind.FalseKeyword:\n value = false;\n break;\n case SyntaxKind.StringLiteral:\n value = typeNode.literal.text;\n break;\n case SyntaxKind.NumericLiteral:\n value = Number.parseFloat(typeNode.literal.text);\n break;\n case SyntaxKind.NullKeyword:\n value = null;\n break;\n default:\n if (Object.prototype.hasOwnProperty.call(typeNode.literal, 'text')) {\n value = (typeNode.literal as LiteralExpression).text;\n } else {\n throw new ResolverError(\n `Couldn't resolve literal node: ${typeNode.literal.getText()}`,\n typeNode.literal,\n );\n }\n }\n return value;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n NodeBuilderFlags,\n SymbolFlags,\n SyntaxKind,\n factory,\n isMappedTypeNode,\n isParameter,\n isPropertyDeclaration,\n isPropertySignature,\n} from 'typescript';\nimport type {\n Declaration,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n Symbol as TsSymbol,\n TypeNode,\n} from 'typescript';\nimport { JSDocTagName } from '../../js-doc';\nimport { TypeName } from '@trapi/core';\nimport type { ResolverProperty, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveMappedType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isMappedTypeNode(typeNode) || !ctx.referencer) {\n return undefined;\n }\n\n const type = ctx.typeChecker.getTypeFromTypeNode(ctx.referencer);\n const mappedTypeNode = typeNode;\n const { typeChecker } = ctx;\n\n const getDeclaration = (prop: TsSymbol) => prop.declarations && (prop.declarations[0] as Declaration | undefined);\n\n const isIgnored = (prop: TsSymbol) => {\n const declaration = getDeclaration(prop);\n const tagNames = prop.getJsDocTags();\n const tagNameIndex = tagNames.findIndex((tag) => tag.name === JSDocTagName.IGNORE);\n if (tagNameIndex >= 0) {\n return true;\n }\n return (\n !!declaration &&\n !isPropertyDeclaration(declaration) &&\n !isPropertySignature(declaration) &&\n !isParameter(declaration)\n );\n };\n\n const properties: ResolverProperty[] = type\n .getProperties()\n .filter((property) => !isIgnored(property))\n .map((property) => {\n const declaration = getDeclaration(property) as\n PropertySignature |\n PropertyDeclaration |\n ParameterDeclaration |\n undefined;\n\n // Normalize +? (PlusToken) to ? (QuestionToken) so property helpers treat it as optional\n const overrideToken = mappedTypeNode.questionToken?.kind === SyntaxKind.PlusToken ?\n factory.createToken(SyntaxKind.QuestionToken) :\n mappedTypeNode.questionToken;\n\n if (declaration && isPropertySignature(declaration)) {\n return { ...ctx.propertyFromSignature(declaration, overrideToken), name: property.getName() };\n }\n if (declaration && (isPropertyDeclaration(declaration) || isParameter(declaration))) {\n return { ...ctx.propertyFromDeclaration(declaration, overrideToken), name: property.getName() };\n }\n\n let required = (property.flags & SymbolFlags.Optional) === 0;\n\n const typeNode2 = toTypeNodeOrFail(\n typeChecker,\n typeChecker.getTypeOfSymbolAtLocation(property, typeNode),\n undefined,\n NodeBuilderFlags.NoTruncation,\n );\n if (mappedTypeNode.questionToken && mappedTypeNode.questionToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (\n mappedTypeNode.questionToken &&\n (\n mappedTypeNode.questionToken.kind === SyntaxKind.QuestionToken ||\n mappedTypeNode.questionToken.kind === SyntaxKind.PlusToken\n )\n ) {\n required = false;\n }\n\n return {\n name: property.getName(),\n required,\n deprecated: false,\n type: ctx.resolveType(typeNode2, typeNode, ctx.context, ctx.referencer),\n validators: {},\n };\n });\n\n return {\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties,\n };\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n isIdentifier,\n isIndexSignatureDeclaration,\n isNumericLiteral,\n isPropertySignature,\n isStringLiteral,\n isTypeLiteralNode,\n} from 'typescript';\nimport type {\n IndexSignatureDeclaration,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n TypeNode,\n} from 'typescript';\nimport {\n JSDocTagName,\n getJSDocTagComment,\n hasJSDocTag,\n} from '../../js-doc';\nimport { getDeclarationValidators } from '../../validator';\nimport { TypeName, isStringType } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n NestedObjectLiteralType,\n ResolverProperty,\n Type,\n} from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveObjectLiteralType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTypeLiteralNode(typeNode)) {\n return undefined;\n }\n\n const properties: ResolverProperty[] = typeNode.members\n .filter((member) => isPropertySignature(member))\n .reduce((res, propertySignature: PropertySignature) => {\n if (!propertySignature.type) {\n throw new ResolverError('No valid type found for property declaration.', propertySignature);\n }\n\n const type = ctx.resolveType(\n propertySignature.type,\n propertySignature,\n ctx.context,\n );\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertySignature, JSDocTagName.DEPRECATED),\n example: ctx.getNodeExample(propertySignature),\n extensions: ctx.getNodeExtensions(propertySignature),\n default: getJSDocTagComment(propertySignature, JSDocTagName.DEFAULT),\n description: ctx.getNodeDescription(propertySignature),\n format: getNodeFormat(propertySignature),\n name: getPropertyName(propertySignature),\n required: !propertySignature.questionToken,\n type,\n validators: getDeclarationValidators(propertySignature) || {},\n };\n\n return [property, ...res];\n }, [] as ResolverProperty[]);\n\n const indexMember = typeNode.members.find(\n (member) => isIndexSignatureDeclaration(member),\n );\n let additionalType: Type | undefined;\n\n if (indexMember) {\n const indexSignatureDeclaration = indexMember as IndexSignatureDeclaration;\n const indexType = ctx.resolveType(\n indexSignatureDeclaration.parameters[0]!.type as TypeNode,\n ctx.parentNode,\n ctx.context,\n );\n\n if (!isStringType(indexType)) {\n throw new ResolverError('Only string indexes are supported.', typeNode);\n }\n\n additionalType = ctx.resolveType(\n indexSignatureDeclaration.type,\n ctx.parentNode,\n ctx.context,\n );\n }\n\n return {\n additionalProperties: indexMember && additionalType,\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties,\n } as NestedObjectLiteralType;\n}\n\nfunction getNodeFormat(\n node: PropertySignature | PropertyDeclaration | ParameterDeclaration,\n) {\n return getJSDocTagComment(node, JSDocTagName.FORMAT);\n}\n\nfunction getPropertyName(node: PropertySignature): string {\n if (isIdentifier(node.name)) {\n return node.name.text;\n }\n\n if (isStringLiteral(node.name) || isNumericLiteral(node.name)) {\n return node.name.text;\n }\n\n return node.name.getText();\n}\n","/*\n * Copyright (c) 2025-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node, TypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport {\n NumericKind,\n TypeName,\n namesForMarker,\n numericMarkerKind,\n tagsForMarker,\n} from '@trapi/core';\nimport type { \n NeverType, \n PrimitiveType, \n Registry, \n ResolverMarker, \n VoidType, \n} from '@trapi/core';\nimport { hasDecoratorNamed } from '../../../decorator';\nimport { getJSDocTagNames } from '../../js-doc';\n\nconst NUMERIC_KIND_TO_TYPE_NAME: Record<string, string> = {\n [NumericKind.Int]: TypeName.INTEGER,\n [NumericKind.Long]: TypeName.LONG,\n [NumericKind.Float]: TypeName.FLOAT,\n [NumericKind.Double]: TypeName.DOUBLE,\n};\n\nexport class PrimitiveResolver {\n protected registry: Registry;\n\n constructor(registry: Registry) {\n this.registry = registry;\n }\n\n resolve(node: TypeNode, parentNode?: Node) : PrimitiveType | NeverType | VoidType | undefined {\n const resolved = this.resolveSyntaxKind(node.kind);\n if (resolved) {\n if (resolved === 'string') {\n return { typeName: TypeName.STRING };\n }\n\n if (resolved === 'void') {\n return { typeName: TypeName.VOID };\n }\n\n if (resolved === 'boolean') {\n return { typeName: TypeName.BOOLEAN };\n }\n\n if (resolved === 'undefined') {\n return { typeName: TypeName.UNDEFINED };\n }\n\n if (resolved === 'null') {\n // todo: check\n return undefined;\n }\n\n if (resolved === 'never') {\n return { typeName: TypeName.NEVER };\n }\n\n if (resolved === 'bigint') {\n return { typeName: TypeName.BIGINT };\n }\n\n if (resolved === 'number') {\n if (!parentNode) {\n return { typeName: TypeName.DOUBLE };\n }\n\n // For each numeric kind: check decorator handlers first (preset\n // may rename `@IsInt`), then JSDoc handlers (preset may rename\n // `@isInt`). Both lookups use the registry markers.\n const presentJsDocTags = new Set(\n getJSDocTagNames(parentNode).map((tag) => tag.toLowerCase()),\n );\n for (const kind of [NumericKind.Int, NumericKind.Long, NumericKind.Float, NumericKind.Double] as const) {\n const matchKind = (m: ResolverMarker) => numericMarkerKind(m) === kind;\n\n const decoratorNames = namesForMarker(this.registry, matchKind);\n for (const name of decoratorNames) {\n if (hasDecoratorNamed(parentNode, name)) {\n return { typeName: NUMERIC_KIND_TO_TYPE_NAME[kind] } as PrimitiveType;\n }\n }\n\n const jsDocTags = tagsForMarker(this.registry, matchKind);\n for (const tag of jsDocTags) {\n if (presentJsDocTags.has(tag.toLowerCase())) {\n return { typeName: NUMERIC_KIND_TO_TYPE_NAME[kind] } as PrimitiveType;\n }\n }\n }\n\n return { typeName: TypeName.DOUBLE };\n }\n }\n\n return undefined;\n }\n\n resolveSyntaxKind(syntaxKind: SyntaxKind) {\n switch (syntaxKind) {\n case SyntaxKind.StringKeyword:\n return 'string';\n case SyntaxKind.BooleanKeyword:\n return 'boolean';\n case SyntaxKind.VoidKeyword:\n return 'void';\n case SyntaxKind.UndefinedKeyword:\n return 'undefined';\n case SyntaxKind.NullKeyword:\n return 'null';\n case SyntaxKind.NumberKeyword:\n return 'number';\n case SyntaxKind.BigIntKeyword:\n return 'bigint';\n case SyntaxKind.NeverKeyword:\n return 'never';\n default:\n return undefined;\n }\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EnumDeclaration, EnumMember, TypeChecker } from 'typescript';\nimport { JSDocTagName, hasJSDocTag } from '../../js-doc';\nimport { TypeName } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n RefEnumType,\n RefObjectType,\n ReferenceType,\n Type,\n} from '@trapi/core';\nimport { getNodeDescription } from '../utils';\nimport { ResolverBase } from './base';\n\nexport class ReferenceResolver extends ResolverBase {\n protected typeChecker : TypeChecker;\n\n constructor(typeChecker: TypeChecker) {\n super();\n\n this.typeChecker = typeChecker;\n }\n\n public merge(referenceTypes: ReferenceType[]): ReferenceType {\n if (referenceTypes.length === 1) {\n return referenceTypes[0]!;\n }\n\n if (referenceTypes.every((refType) => refType.refName === TypeName.REF_ENUM)) {\n return this.mergeManyRefEnums(referenceTypes as RefEnumType[]);\n }\n\n if (referenceTypes.every((refType) => refType.refName === TypeName.REF_OBJECT)) {\n return this.mergeManyRefObjects(referenceTypes as RefObjectType[]);\n }\n\n throw new ResolverError(\n `These resolved type merge rules are not defined: ${JSON.stringify(referenceTypes)}`,\n );\n }\n\n public mergeManyRefEnums(many: RefEnumType[]): RefEnumType {\n let merged = this.mergeRefEnums(many[0]!, many[1]!);\n for (let i = 2; i < many.length; ++i) {\n merged = this.mergeRefEnums(merged, many[i]!);\n }\n\n return merged;\n }\n\n public mergeRefEnums(first: RefEnumType, second: RefEnumType): RefEnumType {\n let description : string | undefined;\n if (first.description || second.description) {\n if (!first.description) {\n description = second.description;\n } else if (!second.description) {\n description = first.description;\n } else {\n description = `${first.description}\\n${second.description}`;\n }\n }\n\n return {\n typeName: TypeName.REF_ENUM,\n example: first.example || second.example,\n description,\n members: [\n ...(first.members || []),\n ...(second.members || []),\n ],\n memberNames: [\n ...(first.memberNames || []),\n ...(second.memberNames || []),\n ],\n refName: first.refName,\n deprecated: first.deprecated || second.deprecated,\n };\n }\n\n public mergeManyRefObjects(many: RefObjectType[]) {\n let merged = this.mergeRefObject(many[0]!, many[1]!);\n for (let i = 2; i < many.length; ++i) {\n merged = this.mergeRefObject(merged, many[i]!);\n }\n return merged;\n }\n\n public mergeRefObject(first: RefObjectType, second: RefObjectType) : RefObjectType {\n let description : string | undefined;\n if (first.description || second.description) {\n if (!first.description) {\n description = second.description;\n } else if (!second.description) {\n description = first.description;\n } else {\n description = `${first.description}\\n${second.description}`;\n }\n }\n\n const properties = [\n ...first.properties,\n ...second.properties.filter((prop) => first.properties.every((firstProp) => firstProp.name !== prop.name)),\n ];\n\n let additionalProperties : Type | undefined;\n if (first.additionalProperties || second.additionalProperties) {\n if (!first.additionalProperties) {\n additionalProperties = second.additionalProperties;\n } else if (!second.additionalProperties) {\n additionalProperties = first.additionalProperties;\n } else {\n additionalProperties = {\n typeName: TypeName.UNION,\n members: [first.additionalProperties, second.additionalProperties],\n };\n }\n }\n\n return {\n typeName: TypeName.REF_OBJECT,\n description,\n properties,\n additionalProperties,\n refName: first.refName,\n deprecated: first.deprecated || second.deprecated,\n example: first.example || second.example,\n };\n }\n\n transformEnum(declaration: EnumDeclaration, enumName: string) : RefEnumType {\n const isNotUndefined = <T>(item: T): item is Exclude<T, undefined> => item !== undefined;\n\n const enums = declaration.members.map(this.typeChecker.getConstantValue.bind(this.typeChecker)).filter(isNotUndefined);\n const enumNames = declaration.members.map((e) => e.name.getText()).filter(isNotUndefined);\n\n return {\n typeName: TypeName.REF_ENUM,\n description: getNodeDescription(declaration, this.typeChecker),\n members: enums as string[],\n memberNames: enumNames,\n refName: enumName,\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n };\n }\n\n transformEnumMember(declaration: EnumMember, enumName: string) : RefEnumType {\n return {\n typeName: TypeName.REF_ENUM,\n refName: enumName,\n members: [this.typeChecker.getConstantValue(declaration)!],\n memberNames: [declaration.name.getText()],\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n };\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isNamedTupleMember, isTupleTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { TupleType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveTupleType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTupleTypeNode(typeNode)) {\n return undefined;\n }\n\n const elements = typeNode.elements.map((element) => {\n const isNamed = isNamedTupleMember(element);\n const actualType = isNamed ? element.type : element;\n return {\n type: ctx.resolveType(actualType, ctx.parentNode, ctx.context),\n ...(isNamed && { name: element.name.text }),\n };\n });\n\n return {\n typeName: TypeName.TUPLE,\n elements,\n } as TupleType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { NodeBuilderFlags, SyntaxKind, isTypeOperatorNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type { Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveTypeOperatorType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTypeOperatorNode(typeNode)) {\n return undefined;\n }\n\n if (typeNode.operator === SyntaxKind.KeyOfKeyword) {\n const type = ctx.typeChecker.getTypeFromTypeNode(typeNode);\n try {\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, type, undefined, NodeBuilderFlags.NoTruncation),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n } catch (err) {\n const indexedTypeName = ctx.typeChecker.typeToString(\n ctx.typeChecker.getTypeFromTypeNode(typeNode.type),\n );\n throw new ResolverError(\n `Could not determine the keys on ${indexedTypeName}`,\n typeNode,\n { cause: err },\n );\n }\n }\n\n if (typeNode.operator === SyntaxKind.ReadonlyKeyword) {\n return ctx.resolveType(typeNode.type, typeNode, ctx.context, ctx.referencer);\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isUnionTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { Type, UnionType } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveUnionType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isUnionTypeNode(typeNode)) {\n return undefined;\n }\n\n const members = typeNode.types.map(\n (type) => ctx.resolveType(type, ctx.parentNode, ctx.context),\n );\n\n return {\n typeName: TypeName.UNION,\n members,\n } as UnionType;\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n NodeBuilderFlags,\n SymbolFlags,\n SyntaxKind,\n isConditionalTypeNode,\n isConstructorDeclaration,\n isEnumDeclaration,\n isEnumMember,\n isExpressionWithTypeArguments,\n isIdentifier,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isMethodDeclaration,\n isMethodSignature,\n isPropertySignature,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n} from 'typescript';\nimport type {\n ClassDeclaration,\n ClassElement,\n ConstructorDeclaration,\n Declaration,\n EntityName,\n EnumDeclaration,\n EnumMember,\n ExpressionWithTypeArguments,\n Identifier,\n IndexSignatureDeclaration,\n InterfaceDeclaration,\n Node,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n Symbol as TsSymbol,\n TypeAliasDeclaration,\n TypeElement,\n TypeNode,\n TypeReferenceNode,\n TypeReferenceType,\n} from 'typescript';\nimport {\n TypeName,\n UtilityTypeName,\n isDeprecatedMarker,\n isRefAliasType,\n isRefObjectType,\n namesForMarker,\n tagsForMarker,\n} from '@trapi/core';\nimport type {\n BufferType,\n DateTimeType,\n DateType,\n Extension,\n NestedObjectLiteralType,\n ReferenceType,\n ResolverProperty,\n Type,\n} from '@trapi/core';\nimport { hasDecoratorNamed } from '../../decorator';\nimport type { IReferenceTypeRegistry, IResolverContext } from '../../../core/metadata/types';\nimport {\n JSDocTagName,\n getJSDocTagComment,\n getJSDocTagNames,\n hasJSDocTag,\n} from '../js-doc';\nimport { getDeclarationValidators } from '../validator';\nimport { getInitializerValue } from '../initializer';\nimport { ResolverError } from '../../../core/error/resolver';\nimport { getNodeExtensions } from './extension';\nimport {\n PrimitiveResolver,\n ReferenceResolver,\n ResolverBase,\n resolveArrayType,\n resolveIndexedAccessType,\n resolveIntersectionType,\n resolveLiteralType,\n resolveMappedType,\n resolveObjectLiteralType,\n resolveTupleType,\n resolveTypeOperatorType,\n resolveUnionType,\n} from './sub';\nimport { getLiteralValue } from './sub/literal';\nimport type {\n OverrideToken,\n SubResolverContext,\n TypeNodeResolverContext,\n UsableDeclaration,\n} from './types';\nimport { getNodeDescription } from './utils';\n\nexport class TypeNodeResolver extends ResolverBase {\n private static readonly MAX_DEPTH = 50;\n\n private readonly typeNode : TypeNode;\n\n private readonly current: IResolverContext & IReferenceTypeRegistry;\n\n private readonly parentNode?: Node;\n\n private context: TypeNodeResolverContext;\n\n private readonly referencer : TypeNode | undefined;\n\n private readonly depth: number;\n\n private readonly primitiveResolver : PrimitiveResolver;\n\n private readonly referenceResolver : ReferenceResolver;\n\n constructor(\n typeNode: TypeNode,\n current: IResolverContext & IReferenceTypeRegistry,\n parentNode?: Node,\n context?: TypeNodeResolverContext,\n referencer?: TypeNode,\n depth?: number,\n ) {\n super();\n\n this.typeNode = typeNode;\n this.current = current;\n this.parentNode = parentNode;\n this.context = context || {};\n this.referencer = referencer;\n this.depth = depth ?? 0;\n\n this.primitiveResolver = new PrimitiveResolver(current.registry);\n this.referenceResolver = new ReferenceResolver(current.typeChecker);\n }\n\n /**\n * @deprecated Use resolverCache.clear() on the context instead.\n * Kept for backward compatibility — no-ops since cache is now instance-scoped.\n */\n public static clearCache() {\n // Cache is now instance-scoped via IResolverContext.resolverCache.\n // This method is a no-op for backward compatibility.\n }\n\n public resolve(): Type {\n if (this.depth > TypeNodeResolver.MAX_DEPTH) {\n throw new ResolverError(\n `Type resolution exceeded maximum depth of ${TypeNodeResolver.MAX_DEPTH}. This usually indicates deeply nested or circular generics.`,\n this.typeNode,\n );\n }\n\n const ctx = this.createSubResolverContext();\n\n const result = this.primitiveResolver.resolve(this.typeNode, this.parentNode) ??\n resolveLiteralType(this.typeNode, ctx) ??\n resolveArrayType(this.typeNode, ctx) ??\n resolveUnionType(this.typeNode, ctx) ??\n resolveIntersectionType(this.typeNode, ctx) ??\n resolveObjectLiteralType(this.typeNode, ctx) ??\n resolveTupleType(this.typeNode, ctx) ??\n resolveMappedType(this.typeNode, ctx) ??\n this.resolveConditionalType() ??\n resolveTypeOperatorType(this.typeNode, ctx) ??\n resolveIndexedAccessType(this.typeNode, ctx) ??\n this.resolveTypeReference();\n\n if (!result) {\n this.throwUnknownType();\n }\n\n return result;\n }\n\n private createSubResolverContext(): SubResolverContext {\n return {\n typeChecker: this.current.typeChecker,\n current: this.current,\n parentNode: this.parentNode,\n context: this.context,\n referencer: this.referencer,\n resolveType: (typeNode, parentNode, context, referencer) => (\n this.resolveNestedType(typeNode, parentNode, context, referencer)\n ),\n propertyFromSignature: (sig, overrideToken) => this.propertyFromSignature(sig, overrideToken),\n propertyFromDeclaration: (decl, overrideToken) => (\n this.propertyFromDeclaration(decl, overrideToken)\n ),\n getNodeDescription: (node) => this.getNodeDescription(node),\n getNodeExample: (node) => this.getNodeExample(node),\n getNodeExtensions: (node) => this.getNodeExtensions(node),\n };\n }\n\n private resolveNestedType(\n typeNode: TypeNode,\n parentNode?: Node,\n context?: TypeNodeResolverContext,\n referencer?: TypeNode,\n ): Type {\n return new TypeNodeResolver(\n typeNode,\n this.current,\n parentNode,\n context,\n referencer,\n this.depth + 1,\n ).resolve();\n }\n\n private throwUnknownType(): never {\n throw new ResolverError(`Unknown type: ${SyntaxKind[this.typeNode.kind]}`, this.typeNode);\n }\n\n // ------------------------------------------------------------------\n // Conditional type resolution (kept inline — deeply coupled to reference handling)\n // ------------------------------------------------------------------\n\n private resolveConditionalType(): Type | undefined {\n if (!isConditionalTypeNode(this.typeNode)) {\n return undefined;\n }\n\n // When inside a generic type alias (context has entries) and we\n // have a usage-site node (referencer), resolve via the referencer\n // so the checker evaluates with concrete type arguments (#782).\n if (Object.keys(this.context).length > 0 && this.referencer) {\n return this.resolveTypeViaChecker(this.referencer);\n }\n\n // Delegate conditional type evaluation to the TypeScript type\n // checker. The checker can evaluate any conditional directly,\n // including complex patterns like `typeof globalThis extends\n // { onmessage: any } ? {} : X` from @types/node (#753).\n return this.resolveTypeViaChecker(this.typeNode);\n }\n\n // ------------------------------------------------------------------\n // Type reference resolution (kept inline — deeply coupled to caching/utility types)\n // ------------------------------------------------------------------\n\n private resolveTypeReference(): Type | undefined {\n if (this.typeNode.kind !== SyntaxKind.TypeReference) {\n return undefined;\n }\n\n const typeReference = this.typeNode as TypeReferenceNode;\n\n if (typeReference.typeName.kind === SyntaxKind.Identifier) {\n if (\n typeReference.typeName.text === 'Record' &&\n typeReference.typeArguments &&\n typeReference.typeArguments[1]\n ) {\n return {\n additionalProperties: this.resolveNestedType(\n typeReference.typeArguments[1],\n this.parentNode,\n this.context,\n ),\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties: [],\n } as NestedObjectLiteralType;\n }\n\n const specialReference = TypeNodeResolver.resolveSpecialReference(typeReference.typeName);\n if (typeof specialReference !== 'undefined') {\n return specialReference;\n }\n\n if (typeReference.typeName.text === 'Date') {\n return this.getDateType(this.parentNode);\n }\n\n if (\n typeReference.typeName.text === 'Buffer' ||\n typeReference.typeName.text === 'Readable'\n ) {\n return { typeName: TypeName.BUFFER };\n }\n\n if (\n typeReference.typeName.text === 'Array' &&\n typeReference.typeArguments?.[0]\n ) {\n return {\n typeName: TypeName.ARRAY,\n elementType: this.resolveNestedType(\n typeReference.typeArguments[0],\n this.parentNode,\n this.context,\n ),\n };\n }\n\n if (\n typeReference.typeName.text === 'Promise' &&\n typeReference.typeArguments?.length === 1 &&\n typeReference.typeArguments[0]\n ) {\n return this.resolveNestedType(\n typeReference.typeArguments[0],\n this.parentNode,\n this.context,\n );\n }\n\n if (typeReference.typeName.text === 'String') {\n return { typeName: TypeName.STRING };\n }\n\n const contextual = this.context[typeReference.typeName.text];\n if (contextual) {\n return this.resolveNestedType(\n contextual,\n this.parentNode,\n this.context,\n );\n }\n\n if (TypeNodeResolver.isCheckerResolvableUtilityType(typeReference.typeName.text)) {\n return this.resolveUtilityTypeViaChecker(typeReference);\n }\n }\n\n try {\n const referenceType = this.getReferenceType(typeReference);\n\n this.current.addReferenceType(referenceType);\n return referenceType;\n } catch (err) {\n // When the model declaration walker fails (e.g. for global types\n // like Headers, Request, Response from @types/node that use\n // complex declaration patterns — #753), fall back to the checker.\n // If the checker also fails, re-throw the original error.\n try {\n return this.resolveTypeViaChecker(typeReference);\n } catch {\n throw err;\n }\n }\n }\n\n // ------------------------------------------------------------------------\n // Utility Type(s)\n // ------------------------------------------------------------------------\n\n private static readonly CHECKER_RESOLVABLE_UTILITY_TYPES: ReadonlySet<string> = new Set([\n UtilityTypeName.NON_NULLABLE,\n UtilityTypeName.OMIT,\n UtilityTypeName.PARTIAL,\n UtilityTypeName.READONLY,\n UtilityTypeName.REQUIRED,\n UtilityTypeName.PICK,\n UtilityTypeName.EXTRACT,\n UtilityTypeName.EXCLUDE,\n UtilityTypeName.RETURN_TYPE,\n UtilityTypeName.PARAMETERS,\n UtilityTypeName.AWAITED,\n UtilityTypeName.INSTANCE_TYPE,\n UtilityTypeName.CONSTRUCTOR_PARAMETERS,\n ]);\n\n private static isCheckerResolvableUtilityType(name: string): boolean {\n return TypeNodeResolver.CHECKER_RESOLVABLE_UTILITY_TYPES.has(name);\n }\n\n private resolveUtilityTypeViaChecker(typeReference: TypeReferenceNode): Type {\n // When type arguments reference unbound type parameters from our\n // context (e.g. `Awaited<T>` inside `type Box<T> = Awaited<T>`),\n // the checker can't resolve them from the declaration-site node.\n // Use the referencer (usage-site node like `Box<Promise<Foo>>`)\n // which the checker CAN resolve with concrete type arguments.\n if (this.hasUnboundContextArgs(typeReference) && this.referencer) {\n return this.resolveTypeViaChecker(this.referencer);\n }\n\n return this.resolveTypeViaChecker(typeReference);\n }\n\n /**\n * Shared checker delegation: resolves a type node by letting the TS\n * type checker evaluate it, converting back to a TypeNode, and\n * recursively resolving the result.\n */\n private resolveTypeViaChecker(typeNode: TypeNode): Type {\n const type = this.current.typeChecker.getTypeFromTypeNode(typeNode);\n // InTypeAlias prevents the node builder from emitting type alias\n // references (which could cause circular resolution when the utility\n // type is used inside a type alias declaration).\n const resolvedTypeNode = this.current.typeChecker.typeToTypeNode(\n type,\n undefined,\n NodeBuilderFlags.NoTruncation | NodeBuilderFlags.InTypeAlias,\n );\n\n // typeToTypeNode returns undefined for some edge cases (e.g. empty\n // tuples from Parameters<> of a no-arg function). Fall back to an\n // empty tuple type.\n if (!resolvedTypeNode) {\n return { typeName: TypeName.TUPLE, elements: [] };\n }\n\n return this.resolveNestedType(\n resolvedTypeNode,\n this.parentNode,\n this.context,\n );\n }\n\n /**\n * Check if a type reference has type arguments that reference unbound\n * type parameters from this.context (e.g. `Awaited<T>` where T is a\n * generic parameter mapped in context).\n */\n private hasUnboundContextArgs(typeReference: TypeReferenceNode): boolean {\n if (!typeReference.typeArguments || Object.keys(this.context).length === 0) {\n return false;\n }\n\n return typeReference.typeArguments.some((arg) =>\n isTypeReferenceNode(arg) &&\n isIdentifier(arg.typeName) &&\n arg.typeName.text in this.context);\n }\n\n private static resolveSpecialReference(node: Identifier) : Type | undefined {\n switch (node.text) {\n case 'Buffer':\n case 'DownloadBinaryData':\n case 'DownloadResource':\n return { typeName: TypeName.BUFFER } as BufferType;\n default:\n return undefined;\n }\n }\n\n private getDateType(parentNode?: Node): DateType | DateTimeType {\n if (!parentNode) {\n return { typeName: TypeName.DATETIME };\n }\n const tags = getJSDocTagNames(parentNode).filter((name) => ['isDate', 'isDateTime'].includes(name));\n\n if (tags.length === 0) {\n return { typeName: TypeName.DATETIME };\n }\n\n switch (tags[0]) {\n case 'isDate':\n return { typeName: TypeName.DATE };\n default:\n return { typeName: TypeName.DATETIME };\n }\n }\n\n private static getDesignatedModels<T extends Node>(nodes: T[], _typeName: string): T[] {\n return nodes;\n }\n\n private getReferenceType(node: TypeReferenceType): ReferenceType {\n let type: EntityName;\n if (isTypeReferenceNode(node)) {\n type = node.typeName;\n } else if (isExpressionWithTypeArguments(node)) {\n type = node.expression as EntityName;\n } else {\n throw new ResolverError('Can\\'t resolve reference type.');\n }\n\n // Can't invoke getText on Synthetic Nodes\n let resolvableName = node.pos !== -1 ? node.getText() : (type as Identifier).text;\n if (node.pos === -1 && 'typeArguments' in node && Array.isArray(node.typeArguments)) {\n // Add typeArguments for Synthetic nodes (e.g. Record<> in TestClassModel.indexedResponse)\n const argumentsString = node.typeArguments\n .map((arg) => {\n if (isLiteralTypeNode(arg)) {\n return `'${String(getLiteralValue(arg))}'`;\n }\n const resolvedType = this.primitiveResolver.resolveSyntaxKind(arg.kind);\n if (\n typeof resolvedType === 'undefined'\n ) { return 'any'; }\n return resolvedType;\n });\n\n resolvableName += `<${argumentsString.join(', ')}>`;\n }\n\n const name = this.contextualizedName(resolvableName);\n\n this.typeArgumentsToContext(node, type, this.context);\n\n try {\n const existingType = this.current.resolverCache.getCachedType(name);\n if (existingType) {\n return existingType;\n }\n\n if (this.current.resolverCache.isInProgress(name)) {\n return this.createCircularDependencyResolver(name);\n }\n\n this.current.resolverCache.markInProgress(name);\n\n try {\n const refName = TypeNodeResolver.getRefTypeName(name);\n const declarations = this.getModelTypeDeclarations(type);\n const referenceTypes: ReferenceType[] = [];\n for (const declaration of declarations) {\n if (isTypeAliasDeclaration(declaration)) {\n referenceTypes.push(\n this.getTypeAliasReference(\n declaration,\n name,\n node,\n ),\n );\n } else if (isEnumDeclaration(declaration)) {\n referenceTypes.push(this.referenceResolver.transformEnum(declaration, refName));\n } else if (isEnumMember(declaration)) {\n referenceTypes.push(this.referenceResolver.transformEnumMember(declaration, refName));\n } else {\n // todo: dont cast handle property-signature\n referenceTypes.push(\n this.getModelReference(\n declaration as InterfaceDeclaration,\n name,\n ),\n );\n }\n }\n\n const referenceType = this.referenceResolver.merge(referenceTypes);\n\n this.current.resolverCache.setCachedType(name, referenceType);\n return referenceType;\n } finally {\n this.current.resolverCache.clearInProgress(name);\n }\n } catch (err) {\n throw new ResolverError(\n `There was a problem resolving type of '${name}'.`,\n node,\n { cause: err },\n );\n }\n }\n\n private getTypeAliasReference(\n declaration: TypeAliasDeclaration,\n name: string,\n referencer: TypeReferenceType,\n ): ReferenceType {\n const refName = TypeNodeResolver.getRefTypeName(name);\n\n if (declaration.type.kind === SyntaxKind.TypeReference) {\n const innerRef = declaration.type as TypeReferenceNode;\n // Record<K,V> and checker-resolvable utility types (Pick, Omit, etc.)\n // should not go through getReferenceType — resolveNestedType handles\n // them correctly via resolveTypeReference.\n const innerName = isIdentifier(innerRef.typeName) ? innerRef.typeName.text : undefined;\n const skipReferenceType = innerName === UtilityTypeName.RECORD ||\n (innerName !== undefined && TypeNodeResolver.isCheckerResolvableUtilityType(innerName));\n\n if (!skipReferenceType) {\n const referenceType = this.getReferenceType(innerRef);\n if (referenceType.refName === refName) {\n return referenceType;\n }\n }\n }\n\n const type = this.resolveNestedType(\n declaration.type,\n declaration,\n this.context,\n this.referencer || referencer,\n );\n\n const example = this.getNodeExample(declaration);\n\n return {\n typeName: TypeName.REF_ALIAS,\n default: getJSDocTagComment(declaration, JSDocTagName.DEFAULT),\n description: this.getNodeDescription(declaration),\n refName,\n format: TypeNodeResolver.getNodeFormat(declaration),\n type,\n validators: getDeclarationValidators(declaration) || {},\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n ...(example && { example }),\n };\n }\n\n private getModelReference(\n modelType: InterfaceDeclaration | ClassDeclaration,\n name: string,\n ) : ReferenceType {\n const example = this.getNodeExample(modelType);\n const description = this.getNodeDescription(modelType);\n const deprecatedDecoratorNames = namesForMarker(this.current.registry, isDeprecatedMarker);\n const deprecatedJsDocTags = tagsForMarker(this.current.registry, isDeprecatedMarker);\n const deprecated : boolean = [...deprecatedJsDocTags].some((tag) => hasJSDocTag(modelType, tag)) ||\n [...deprecatedDecoratorNames].some((name) => hasDecoratorNamed(modelType, name));\n\n // Handle toJSON methods\n if (!modelType.name) {\n throw new ResolverError('Can\\'t get Symbol from anonymous class', modelType);\n }\n const type = this.current.typeChecker.getTypeAtLocation(modelType.name);\n const toJSON = this.current.typeChecker.getPropertyOfType(type, 'toJSON');\n if (\n toJSON &&\n toJSON.valueDeclaration &&\n (\n isMethodDeclaration(toJSON.valueDeclaration) ||\n isMethodSignature(toJSON.valueDeclaration)\n )\n ) {\n let nodeType = toJSON.valueDeclaration.type;\n if (!nodeType) {\n const signature = this.current.typeChecker.getSignatureFromDeclaration(toJSON.valueDeclaration);\n if (signature) {\n const implicitType = this.current.typeChecker.getReturnTypeOfSignature(signature);\n nodeType = this.current.typeChecker.typeToTypeNode(implicitType, undefined, NodeBuilderFlags.NoTruncation) as TypeNode;\n } else {\n throw new ResolverError('Can\\'t get signature from toJson value declaration', modelType);\n }\n }\n\n return {\n refName: `${TypeNodeResolver.getRefTypeName(name)}Alias`,\n typeName: TypeName.REF_ALIAS,\n description,\n type: this.resolveNestedType(nodeType),\n deprecated,\n validators: {},\n ...(example && { example }),\n };\n }\n\n const properties = this.getModelProperties(modelType);\n const additionalProperties = this.getModelAdditionalProperties(modelType);\n const inheritedProperties = this.getModelInheritedProperties(modelType) || [];\n\n const referenceType: ReferenceType & { properties: ResolverProperty[] } = {\n additionalProperties,\n typeName: TypeName.REF_OBJECT,\n description,\n properties: inheritedProperties,\n refName: TypeNodeResolver.getRefTypeName(name),\n deprecated,\n ...(example && { example }),\n };\n\n referenceType.properties = referenceType.properties.concat(properties);\n\n return referenceType;\n }\n\n private static getRefTypeName(name: string): string {\n const sanitized = name\n // Structural characters → temporary placeholders\n .replace(/[<>]/g, '_')\n .replace(/[{}]/g, '_')\n .replace(/\\s+/g, '')\n // Delimiter characters → semantic names\n .replace(/,/g, '.')\n .replace(/'([^']*)'/g, '$1')\n .replace(/\"([^\"]*)\"/g, '$1')\n .replace(/&/g, '-and-')\n .replace(/\\|/g, '-or-')\n .replace(/\\[\\]/g, '-array')\n .replace(/([a-z]+):([a-z]+)/gi, '$1-$2')\n .replace(/;/g, '--')\n .replace(/([a-z]+)\\[([a-z]+)]/gi, '$1-at-$2')\n // Strip temporary placeholders (keep hyphens for semantic separators)\n .replace(/_/g, '');\n\n return encodeURIComponent(sanitized);\n }\n\n private contextualizedName(name: string): string {\n return Object.entries(\n this.context,\n ).reduce((acc, [key, entry]) => acc\n .replace(new RegExp(`<\\\\s*([^>]*\\\\s)*\\\\s*(${key})(\\\\s[^>]*)*\\\\s*>`, 'g'), `<$1${entry.getText()}$3>`)\n .replace(new RegExp(`<\\\\s*([^,]*\\\\s)*\\\\s*(${key})(\\\\s[^,]*)*\\\\s*,`, 'g'), `<$1${entry.getText()}$3,`)\n .replace(new RegExp(`,\\\\s*([^>]*\\\\s)*\\\\s*(${key})(\\\\s[^>]*)*\\\\s*>`, 'g'), `,$1${entry.getText()}$3>`)\n .replace(new RegExp(`<\\\\s*([^<]*\\\\s)*\\\\s*(${key})(\\\\s[^<]*)*\\\\s*<`, 'g'), `<$1${entry.getText()}$3<`), name);\n }\n\n private createCircularDependencyResolver(refName: string) {\n const referenceType : ReferenceType = {\n deprecated: false,\n properties: [],\n typeName: TypeName.REF_OBJECT,\n refName,\n };\n\n this.current.registerDependencyResolver((referenceTypes) => {\n const realReferenceType : ReferenceType | undefined = referenceTypes[refName];\n if (!realReferenceType) {\n return;\n }\n\n referenceType.description = realReferenceType.description;\n if (realReferenceType.typeName === 'refObject' && referenceType.typeName === 'refObject') {\n referenceType.properties = realReferenceType.properties;\n }\n referenceType.typeName = realReferenceType.typeName as `${TypeName.REF_OBJECT}`;\n referenceType.refName = realReferenceType.refName;\n });\n\n return referenceType;\n }\n\n private static nodeIsUsable(node: Node) : node is UsableDeclaration {\n switch (node.kind) {\n case SyntaxKind.InterfaceDeclaration:\n case SyntaxKind.ClassDeclaration:\n case SyntaxKind.TypeAliasDeclaration:\n case SyntaxKind.EnumDeclaration:\n case SyntaxKind.EnumMember:\n return true;\n default:\n return false;\n }\n }\n\n private getModelTypeDeclarations(type: EntityName) {\n let typeName = type.kind === SyntaxKind.Identifier ? type.text : type.right.text;\n\n let symbol : TsSymbol | undefined = this.getSymbolAtLocation(type);\n if (!symbol && type.kind === SyntaxKind.QualifiedName) {\n const fullEnumSymbol = this.getSymbolAtLocation(type.left);\n symbol = fullEnumSymbol.exports?.get(typeName as any);\n }\n\n if (!symbol) {\n throw new ResolverError(\n `No symbol found for referenced type ${typeName}.`,\n );\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n throw new ResolverError(\n `No declarations found for referenced type ${typeName}.`,\n );\n }\n\n if (symbol.escapedName !== typeName && symbol.escapedName !== 'default') {\n typeName = symbol.escapedName as string;\n }\n\n let modelTypes = declarations.filter((node) => {\n if (!TypeNodeResolver.nodeIsUsable(node) || !this.current.isExportedNode(node)) {\n return false;\n }\n\n const modelTypeDeclaration = node as UsableDeclaration;\n return (modelTypeDeclaration.name as Identifier)?.text === typeName;\n });\n\n if (!modelTypes.length) {\n throw new ResolverError(\n `No matching model found for referenced type ${typeName}. If ${typeName} comes from a dependency, please create an interface in your own code that has the same structure. The compiler can not utilize interfaces from external dependencies.`,\n );\n }\n\n if (modelTypes.length > 1) {\n // remove types that are from typescript e.g. 'Account'\n modelTypes = modelTypes.filter((modelType) => modelType.getSourceFile()\n .fileName.replace(/\\\\/g, '/').toLowerCase().indexOf('node_modules/typescript') <= -1);\n\n modelTypes = TypeNodeResolver.getDesignatedModels(modelTypes, typeName);\n }\n\n return modelTypes;\n }\n\n private getModelTypeDeclaration(type: EntityName) : UsableDeclaration {\n let typeName = type.kind === SyntaxKind.Identifier ? type.text : type.right.text;\n\n const symbol = this.getSymbolAtLocation(type);\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n throw new ResolverError(\n `No models found for referenced type ${typeName}.`,\n );\n }\n\n if (symbol.escapedName !== typeName && symbol.escapedName !== 'default') {\n typeName = symbol.escapedName as string;\n }\n\n let modelTypes = declarations.filter((node) => {\n if (!TypeNodeResolver.nodeIsUsable(node) || !this.current.isExportedNode(node)) {\n return false;\n }\n\n const modelTypeDeclaration = node as UsableDeclaration;\n return (modelTypeDeclaration.name as Identifier)?.text === typeName;\n });\n\n if (!modelTypes.length) {\n throw new ResolverError(\n `No matching model found for referenced type ${typeName}. If ${typeName} comes from a dependency, please create an interface in your own code that has the same structure. The compiler can not utilize interfaces from external dependencies.`,\n );\n }\n\n if (modelTypes.length > 1) {\n // remove types that are from typescript e.g. 'Account'\n modelTypes = modelTypes.filter((modelType) => modelType.getSourceFile()\n .fileName.replace(/\\\\/g, '/').toLowerCase().indexOf('node_modules/typescript') <= -1);\n\n modelTypes = TypeNodeResolver.getDesignatedModels(modelTypes, typeName);\n }\n if (modelTypes.length > 1) {\n const conflicts = modelTypes.map((modelType) => modelType.getSourceFile().fileName).join('\"; \"');\n throw new ResolverError(\n `Multiple matching models found for referenced type ${typeName}; please make model names unique. Conflicts found: \"${conflicts}\".`,\n );\n }\n\n return modelTypes[0] as UsableDeclaration;\n }\n\n private hasFlag(type: TsSymbol | Declaration, flag: number) {\n return (type.flags & flag) === flag;\n }\n\n private getSymbolAtLocation(type: Node) : TsSymbol {\n const symbol = this.current.typeChecker.getSymbolAtLocation(type) || ((type as any).symbol as TsSymbol);\n // resolve alias if it is an alias, otherwise take symbol directly\n return (\n symbol &&\n this.hasFlag(symbol, SymbolFlags.Alias) &&\n this.current.typeChecker.getAliasedSymbol(symbol)\n ) || symbol;\n }\n\n private getModelProperties(\n node: InterfaceDeclaration | ClassDeclaration,\n overrideToken?: OverrideToken,\n ) : ResolverProperty[] {\n const isIgnored = (e: TypeElement | ClassElement) => hasJSDocTag(e, JSDocTagName.IGNORE);\n\n // Interface model\n if (isInterfaceDeclaration(node)) {\n return node.members\n .filter(\n (member) => !isIgnored(member) &&\n isPropertySignature(member),\n ).map(\n (member) => this.propertyFromSignature(member as PropertySignature, overrideToken),\n );\n }\n\n // Class model\n const properties = node.members\n .filter((member) => !isIgnored(member) &&\n member.kind === SyntaxKind.PropertyDeclaration &&\n !this.hasStaticModifier(member) &&\n this.hasPublicModifier(member)) as Array<PropertyDeclaration | ParameterDeclaration>;\n\n const classConstructor = node.members.find(\n (member) => isConstructorDeclaration(member),\n ) as ConstructorDeclaration;\n\n if (classConstructor && classConstructor.parameters) {\n const constructorProperties = classConstructor.parameters.filter((parameter) => this.isAccessibleParameter(parameter));\n\n properties.push(...constructorProperties);\n }\n\n return properties.map((property) => this.propertyFromDeclaration(property, overrideToken));\n }\n\n private propertyFromSignature(propertySignature: PropertySignature, overrideToken?: OverrideToken) {\n const identifier = propertySignature.name as Identifier;\n\n if (!propertySignature.type) {\n throw new ResolverError('No valid type found for property declaration.');\n }\n\n let required = !propertySignature.questionToken;\n if (overrideToken && overrideToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (overrideToken && overrideToken.kind === SyntaxKind.QuestionToken) {\n required = false;\n }\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertySignature, JSDocTagName.DEPRECATED),\n default: getJSDocTagComment(propertySignature, JSDocTagName.DEFAULT),\n description: this.getNodeDescription(propertySignature),\n example: this.getNodeExample(propertySignature),\n extensions: this.getNodeExtensions(propertySignature),\n format: TypeNodeResolver.getNodeFormat(propertySignature),\n name: identifier.text,\n required,\n type: this.resolveNestedType(\n propertySignature.type,\n propertySignature.type.parent,\n this.context,\n propertySignature.type,\n ),\n validators: getDeclarationValidators(propertySignature) || {},\n };\n return property;\n }\n\n private propertyFromDeclaration(\n propertyDeclaration: PropertyDeclaration | ParameterDeclaration,\n overrideToken?: OverrideToken,\n ) {\n const identifier = propertyDeclaration.name as Identifier;\n let typeNode = propertyDeclaration.type;\n\n if (!typeNode) {\n const tsType = this.current.typeChecker.getTypeAtLocation(propertyDeclaration);\n typeNode = this.current.typeChecker.typeToTypeNode(tsType, undefined, NodeBuilderFlags.NoTruncation);\n }\n\n if (!typeNode) {\n throw new ResolverError('No valid type found for property declaration.');\n }\n\n const type = this.resolveNestedType(typeNode, propertyDeclaration, this.context, typeNode);\n\n let required = !propertyDeclaration.questionToken && !propertyDeclaration.initializer;\n if (overrideToken && overrideToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (overrideToken && overrideToken.kind === SyntaxKind.QuestionToken) {\n required = false;\n }\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertyDeclaration, JSDocTagName.DEPRECATED),\n default: getInitializerValue(propertyDeclaration.initializer, this.current.typeChecker),\n description: this.getNodeDescription(propertyDeclaration),\n example: this.getNodeExample(propertyDeclaration),\n extensions: this.getNodeExtensions(propertyDeclaration),\n format: TypeNodeResolver.getNodeFormat(propertyDeclaration),\n name: identifier.text,\n required,\n type,\n validators: getDeclarationValidators(propertyDeclaration) || {},\n };\n return property;\n }\n\n private getModelAdditionalProperties(node: UsableDeclaration) {\n if (node.kind === SyntaxKind.InterfaceDeclaration) {\n const indexMember = node.members.find((member) => member.kind === SyntaxKind.IndexSignature);\n if (!indexMember) {\n return undefined;\n }\n\n const indexSignatureDeclaration = indexMember as IndexSignatureDeclaration;\n const indexType = this.resolveNestedType(\n indexSignatureDeclaration.parameters[0]!.type as TypeNode,\n this.parentNode,\n this.context,\n );\n\n if (indexType.typeName !== 'string') {\n throw new ResolverError('Only string indexers are supported.', this.typeNode);\n }\n\n return this.resolveNestedType(indexSignatureDeclaration.type, this.parentNode, this.context);\n }\n\n return undefined;\n }\n\n private typeArgumentsToContext(\n type: TypeReferenceNode | ExpressionWithTypeArguments,\n targetEntity: EntityName,\n context: TypeNodeResolverContext,\n ): TypeNodeResolverContext {\n // this.context = {};\n\n const declaration = this.getModelTypeDeclaration(targetEntity);\n if (typeof declaration === 'undefined' || !('typeParameters' in declaration)) {\n return context;\n }\n\n const { typeParameters } = declaration;\n\n if (typeParameters) {\n for (const [index, typeParameter] of typeParameters.entries()) {\n const typeArg = type.typeArguments && type.typeArguments[index];\n let resolvedType: TypeNode;\n\n // Argument may be a forward reference from context\n const contextual = typeArg && isTypeReferenceNode(typeArg) && isIdentifier(typeArg.typeName) ?\n context[typeArg.typeName.text] :\n undefined;\n if (contextual) {\n resolvedType = contextual;\n } else if (typeArg) {\n resolvedType = typeArg;\n } else if (typeParameter.default) {\n resolvedType = typeParameter.default;\n } else {\n throw new ResolverError(`Could not find a value for type parameter ${typeParameter.name.text}`, type);\n }\n\n this.context = {\n ...this.context,\n [typeParameter.name.text]: resolvedType,\n };\n }\n }\n return context;\n }\n\n private getModelInheritedProperties(\n modelTypeDeclaration: Exclude<UsableDeclaration, PropertySignature | TypeAliasDeclaration | EnumMember>,\n ): ResolverProperty[] {\n let properties: ResolverProperty[] = [];\n\n const { heritageClauses } = modelTypeDeclaration;\n if (!heritageClauses) {\n return properties;\n }\n\n heritageClauses.forEach((clause) => {\n if (!clause.types) {\n return;\n }\n\n clause.types.forEach((t) => {\n const baseEntityName = t.expression as EntityName;\n\n // create subContext\n const resetCtx = this.typeArgumentsToContext(t, baseEntityName, this.context);\n\n const referenceType = this.getReferenceType(t);\n if (referenceType) {\n if (isRefAliasType(referenceType)) {\n let type: Type = referenceType;\n while (isRefAliasType(type)) {\n type = type.type;\n }\n\n if (type.typeName === TypeName.REF_OBJECT) {\n properties = [...properties, ...type.properties];\n } else if (type.typeName === TypeName.NESTED_OBJECT_LITERAL) {\n properties = [...properties, ...type.properties];\n }\n }\n\n if (isRefObjectType(referenceType)) {\n referenceType.properties.forEach((property) => properties.push(property));\n }\n }\n\n // reset subContext\n this.context = resetCtx;\n });\n });\n\n return properties;\n }\n\n private getNodeDescription(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) {\n return getNodeDescription(node, this.current.typeChecker);\n }\n\n private static getNodeFormat(\n node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration,\n ) {\n return getJSDocTagComment(node, JSDocTagName.FORMAT);\n }\n\n private getNodeExample(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) {\n const example = getJSDocTagComment(node, JSDocTagName.EXAMPLE);\n\n if (example) {\n try {\n return JSON.parse(example);\n } catch {\n return example;\n }\n }\n\n return undefined;\n }\n\n protected getNodeExtensions(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) : Extension[] {\n return getNodeExtensions(node, this.current.registry);\n }\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { IResolverCache, ReferenceType } from '@trapi/core';\n\nexport class ResolverCache implements IResolverCache {\n private referenceTypes = new Map<string, ReferenceType>();\n\n private inProgressTypes = new Set<string>();\n\n getCachedType(name: string): ReferenceType | undefined {\n return this.referenceTypes.get(name);\n }\n\n setCachedType(name: string, type: ReferenceType): void {\n this.referenceTypes.set(name, type);\n }\n\n isInProgress(name: string): boolean {\n return this.inProgressTypes.has(name);\n }\n\n markInProgress(name: string): void {\n this.inProgressTypes.add(name);\n }\n\n clearInProgress(name: string): void {\n this.inProgressTypes.delete(name);\n }\n\n clear(): void {\n this.referenceTypes.clear();\n this.inProgressTypes.clear();\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n canHaveDecorators,\n getDecorators,\n isCallExpression,\n isNumericLiteral,\n isStringLiteral,\n} from 'typescript';\nimport type { NodeDecorator } from './types';\n\n/**\n * Get Decorators for a specific node.\n *\n * @param node\n * @param isMatching\n */\nexport function getNodeDecorators(\n node: Node,\n isMatching?: (data: NodeDecorator) => boolean,\n): NodeDecorator[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n\n const decorators = getDecorators(node);\n\n if (typeof decorators === 'undefined') {\n return [];\n }\n\n const items = decorators\n .map((d) => {\n const result: any = {\n arguments: [],\n typeArguments: [],\n };\n\n let x: any = d.expression;\n\n if (isCallExpression(x)) {\n if (x.arguments) {\n result.arguments = x.arguments.map((argument: any) => {\n if (isStringLiteral(argument) || isNumericLiteral(argument)) {\n return argument.text;\n }\n return argument;\n });\n }\n\n if (x.typeArguments) {\n result.typeArguments = x.typeArguments;\n }\n\n x = x.expression;\n }\n\n result.text = x.text || x.name.text;\n\n return result as NodeDecorator;\n });\n\n return typeof isMatching === 'undefined' ? items : items.filter(isMatching);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { LocatorInfo } from 'locter';\nimport { buildFilePath, locateMany } from 'locter';\nimport type { EntryPoint } from '../../core/config';\n\nexport async function scanSourceFiles(input: EntryPoint) : Promise<string[]> {\n const sources = Array.isArray(input) ? input : [input];\n const result: Set<string> = new Set<string>();\n\n const promises : Promise<LocatorInfo[]>[] = [];\n\n for (const source of sources) {\n if (typeof source === 'string') {\n promises.push(locateMany(source));\n } else {\n promises.push(locateMany(source.pattern, { cwd: source.cwd }));\n }\n }\n\n const groupMatches = await Promise.all(promises);\n const matches = groupMatches.flat();\n\n for (const match of matches) {\n result.add(buildFilePath(match));\n }\n\n return Array.from(result);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject, load } from 'locter';\nimport { ConfigErrorCode } from '../../../core/error/config-codes';\nimport { ConfigError } from '../../../core/error/config';\nimport process from 'node:process';\nimport path from 'node:path';\nimport { convertCompilerOptionsFromJson } from 'typescript';\nimport type { TsConfig, TsconfigLoadContext } from './types';\n\nexport async function loadTSConfig(\n context: TsconfigLoadContext = {},\n) : Promise<TsConfig> {\n let fileName : string;\n let filePath : string;\n const cwd = context.cwd || process.cwd();\n\n if (typeof context.name === 'string') {\n if (path.isAbsolute(context.name)) {\n filePath = context.name;\n } else {\n filePath = path.resolve(cwd, context.name);\n }\n\n fileName = path.basename(filePath);\n } else {\n fileName = 'tsconfig.json';\n filePath = path.join(cwd, fileName);\n }\n\n const content = await load(filePath);\n if (!isObject(content)) {\n throw new ConfigError({\n message: `The tsconfig file '${filePath}' is malformed.`,\n code: ConfigErrorCode.TSCONFIG_MALFORMED,\n });\n }\n\n if (typeof content.compilerOptions !== 'undefined') {\n const { options: compilerOptions } = convertCompilerOptionsFromJson(\n content.compilerOptions,\n cwd,\n fileName,\n );\n\n content.compilerOptions = compilerOptions;\n }\n\n return content;\n}\n\nexport async function softLoadTsconfig(\n context: TsconfigLoadContext = {},\n) : Promise<TsConfig> {\n try {\n return await loadTSConfig(context);\n } catch {\n return {};\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Bump whenever the on-disk cache shape changes incompatibly\n * (Metadata, Controller, Method, Parameter, resolver type nodes,\n * or the cache wrapper itself). Old cache files with a different\n * version are rejected on read.\n */\nexport const CACHE_SCHEMA_VERSION = '3';\n\nexport const CACHE_FILE_PREFIX = '.trapi-metadata-';\nexport const CACHE_FILE_SUFFIX = '.json';\n\n/** 7 days. */\nexport const CACHE_DEFAULT_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { tmpdir } from 'node:os';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\nimport process from 'node:process';\nimport type { CompilerOptions } from 'typescript';\nimport type { Registry } from '@trapi/core';\nimport { CACHE_DEFAULT_MAX_AGE_MS } from './constants';\nimport type { CacheOptions, CacheOptionsInput } from './types';\n\nexport function buildCacheOptions(input?: string | boolean | CacheOptionsInput) : CacheOptions {\n if (typeof input === 'string') {\n input = {\n enabled: true,\n directoryPath: input,\n };\n }\n\n if (typeof input === 'boolean') {\n input = { enabled: input };\n }\n\n input = input || {};\n\n let directoryPath = tmpdir();\n if (typeof input.directoryPath === 'string') {\n directoryPath = path.isAbsolute(input.directoryPath) ?\n input.directoryPath :\n path.join(process.cwd(), input.directoryPath);\n }\n\n return {\n fileName: input.fileName,\n directoryPath,\n enabled: input.enabled ?? true,\n maxAgeMs: normalizeMaxAgeMs(input.maxAgeMs),\n };\n}\n\nfunction normalizeMaxAgeMs(input: number | undefined): number {\n if (typeof input !== 'number' || !Number.isFinite(input) || input < 0) {\n // NaN, Infinity, negative, or absent → fall back to the default.\n // Only `0` (explicit disable) and positive finite values are honored.\n return CACHE_DEFAULT_MAX_AGE_MS;\n }\n return input;\n}\n\n// -----------------------------------------------------------------------------\n// Cache key composition\n// -----------------------------------------------------------------------------\n\nexport type CacheKeyParts = {\n schemaVersion: string;\n sourceFilesHash: string;\n compilerOptionsHash: string;\n registryHash: string;\n presetName?: string;\n};\n\n/**\n * Combines all key contributors into a single sha256 hex string. The order is\n * stable; each part is null-separated to avoid concatenation ambiguity.\n */\nexport function composeCacheKey(parts: CacheKeyParts): string {\n const hash = crypto.createHash('sha256');\n hash.update(parts.schemaVersion);\n hash.update('\\0');\n hash.update(parts.sourceFilesHash);\n hash.update('\\0');\n hash.update(parts.compilerOptionsHash);\n hash.update('\\0');\n hash.update(parts.registryHash);\n hash.update('\\0');\n hash.update(parts.presetName ?? '');\n return hash.digest('hex');\n}\n\n/**\n * Hash a stable JSON projection of `compilerOptions`. Sorting keys keeps the\n * output deterministic regardless of declaration order in tsconfig.json.\n */\nexport function hashCompilerOptions(options?: CompilerOptions): string {\n const hash = crypto.createHash('sha256');\n hash.update(stableStringify(options ?? {}));\n return hash.digest('hex');\n}\n\n/**\n * Hash the resolved registry's structural shape. Catches structural changes\n * (handler added/removed/renamed, marker changed, replaces policy changed)\n * AND most logic changes via `apply.toString()`. Misses changes that are\n * purely captured-variable shifts in factory-built handlers — acceptable\n * trade-off for catching local preset edits.\n */\nexport function hashRegistry(registry: Registry): string {\n const hash = crypto.createHash('sha256');\n const kinds = [\n 'controllers',\n 'methods',\n 'parameters',\n 'controllerJsDoc',\n 'methodJsDoc',\n 'parameterJsDoc',\n ] as const;\n for (const kind of kinds) {\n hash.update(kind);\n hash.update('\\0');\n const handlers = registry[kind] ?? [];\n for (const handler of handlers) {\n hash.update(stableStringify(handler.match));\n hash.update('\\0');\n hash.update(stableStringify(handler.marker ?? null));\n hash.update('\\0');\n hash.update(String(handler.replaces ?? ''));\n hash.update('\\0');\n hash.update(handler.apply.toString());\n hash.update('\\0');\n }\n hash.update('\\x01');\n }\n return hash.digest('hex');\n}\n\n/**\n * JSON.stringify with sorted object keys at every level. Functions and\n * undefined are omitted as usual; that's fine for the inputs we hash here.\n */\nfunction stableStringify(value: unknown): string {\n return JSON.stringify(value, (_key, val) => {\n if (val && typeof val === 'object' && !Array.isArray(val)) {\n const sorted: Record<string, unknown> = {};\n for (const k of Object.keys(val as Record<string, unknown>).sort()) {\n sorted[k] = (val as Record<string, unknown>)[k];\n }\n return sorted;\n }\n return val;\n });\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { parse as parseFlatted, stringify as stringifyFlatted } from 'flatted';\nimport { buildFilePath as joinFilePath, locateMany } from 'locter';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\nimport {\n CACHE_FILE_PREFIX,\n CACHE_FILE_SUFFIX,\n CACHE_SCHEMA_VERSION,\n} from './constants';\nimport { buildCacheOptions } from './utils';\nimport type {\n CacheData,\n CacheOptions,\n CacheOptionsInput,\n ICacheClient,\n} from './types';\n\nexport class CacheClient implements ICacheClient {\n private readonly options: CacheOptions;\n\n constructor(input?: string | boolean | CacheOptionsInput) {\n this.options = buildCacheOptions(input);\n }\n\n // -------------------------------------------------------------------------\n\n async save(data: CacheData): Promise<string | undefined> {\n if (!this.options.enabled) {\n return undefined;\n }\n\n await this.ensureDirectory();\n\n const filePath = this.resolveFilePath(data.cacheKey);\n // `flatted` is cycle-safe — it encodes self-references and back-edges\n // as integer indices into a flat array. Well-formed metadata uses\n // `refName` strings for cross-references and contains no cycles, but\n // we use `flatted` defensively so a future regression cannot crash\n // serialization or silently corrupt the cached graph.\n const payload = stringifyFlatted(data);\n\n // Atomic write: rename is atomic on POSIX, so concurrent generators\n // either see the previous file or the new one — never a half-written\n // truncation.\n const tmpPath = `${filePath}.${process.pid}.${crypto.randomBytes(6).toString('hex')}.tmp`;\n\n try {\n await fs.promises.writeFile(tmpPath, payload);\n await fs.promises.rename(tmpPath, filePath);\n } catch (err) {\n // Best-effort cleanup of the temp file if rename failed.\n try {\n await fs.promises.unlink(tmpPath);\n } catch {\n // ignore\n }\n throw err;\n }\n\n // Opportunistic eviction. Errors are ignored — eviction is a\n // housekeeping concern, not a correctness one.\n this.evict().catch((): void => undefined);\n\n return filePath;\n }\n\n async get(cacheKey: string): Promise<CacheData | undefined> {\n if (!this.options.enabled) {\n return undefined;\n }\n\n const filePath = this.resolveFilePath(cacheKey);\n\n let content: string;\n try {\n content = await fs.promises.readFile(filePath, { encoding: 'utf-8' });\n } catch {\n return undefined;\n }\n\n let cache: CacheData;\n try {\n cache = parseFlatted(content) as CacheData;\n } catch {\n // Corrupt file — drop it so the next save can replace cleanly.\n await fs.promises.unlink(filePath).catch((): void => undefined);\n return undefined;\n }\n\n if (\n !cache ||\n cache.cacheKey !== cacheKey ||\n cache.schemaVersion !== CACHE_SCHEMA_VERSION\n ) {\n return undefined;\n }\n\n return cache;\n }\n\n // -------------------------------------------------------------------------\n\n /**\n * Prune cache files older than `maxAgeMs`. No-op when disabled or when\n * `maxAgeMs <= 0`. Each unlink is best-effort — a concurrent generator\n * may have already removed the file.\n */\n async evict(): Promise<void> {\n if (!this.options.enabled || this.options.maxAgeMs <= 0) {\n return;\n }\n\n const pattern = this.options.fileName ?? `${CACHE_FILE_PREFIX}*${CACHE_FILE_SUFFIX}`;\n\n let entries: Awaited<ReturnType<typeof locateMany>>;\n try {\n entries = await locateMany(pattern, { cwd: this.options.directoryPath });\n } catch {\n return;\n }\n\n const cutoff = Date.now() - this.options.maxAgeMs;\n\n await Promise.all(entries.map(async (entry) => {\n const filePath = joinFilePath(entry);\n try {\n const stat = await fs.promises.stat(filePath);\n if (stat.mtimeMs < cutoff) {\n await fs.promises.unlink(filePath);\n }\n } catch {\n // ignore — file may have been removed by another process\n }\n }));\n }\n\n // -------------------------------------------------------------------------\n\n private resolveFilePath(cacheKey: string): string {\n // The internal pipeline always passes a sha256 hex digest, but the\n // public `ICacheClient` accepts any string. Reject anything that\n // could break out of `directoryPath` via `path.join`'s normalization\n // (`../`, absolute paths, embedded separators, NUL bytes).\n if (!CACHE_KEY_PATTERN.test(cacheKey)) {\n throw new Error(`Invalid cacheKey: must match ${CACHE_KEY_PATTERN}`);\n }\n const fileName = this.options.fileName ??\n `${CACHE_FILE_PREFIX}${cacheKey}${CACHE_FILE_SUFFIX}`;\n return path.join(this.options.directoryPath, fileName);\n }\n\n private async ensureDirectory(): Promise<void> {\n // Don't memoize — the directory may be removed externally (temp\n // cleanup, another process) at any time. `mkdir(recursive: true)`\n // is a no-op when the directory already exists, so re-running it\n // on every save is cheap and self-healing.\n await fs.promises.mkdir(this.options.directoryPath, { recursive: true });\n }\n}\n\n// Hex digest from sha256 (64 chars) is the canonical caller, but allow\n// any printable ASCII without separators / dots up to a sane length so\n// custom callers (and the suffix-bearing tmp path) keep working.\nconst CACHE_KEY_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from 'locter';\nimport { NodeBuilderFlags, displayPartsToString, isIdentifier } from 'typescript';\nimport type { ParameterDeclaration } from 'typescript';\nimport {\n CollectionFormat,\n ParamKind,\n ParameterSource,\n TypeName,\n isArrayType,\n isNestedObjectLiteralType,\n isRefEnumType,\n isRefObjectType,\n isUnionType,\n newParameterDraft,\n} from '@trapi/core';\nimport type {\n ArrayParameter,\n BaseType,\n Extension,\n IParameterGenerator,\n NestedObjectLiteralType,\n Parameter,\n ParameterDraft,\n RefObjectType,\n Type,\n} from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { getInitializerValue } from '../../../adapters/typescript/initializer';\nimport { getDeclarationValidators } from '../../../adapters/typescript/validator';\nimport {\n JSDocTagName,\n getJSDocTags,\n hasJSDocTag,\n transformJSDocComment,\n} from '../../../adapters/typescript/js-doc';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport { ParameterError } from '../../../core/error/parameter';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\n\nconst BODY_SUPPORTED_METHODS = new Set(['delete', 'post', 'put', 'patch', 'get']);\n\nconst SUPPORTED_LEAF_TYPES = new Set<string>([\n TypeName.STRING,\n TypeName.INTEGER,\n TypeName.LONG,\n TypeName.FLOAT,\n TypeName.DOUBLE,\n TypeName.DATE,\n TypeName.DATETIME,\n TypeName.BUFFER,\n TypeName.BOOLEAN,\n TypeName.ENUM,\n]);\n\nexport class ParameterGenerator implements IParameterGenerator {\n private readonly parameter: ParameterDeclaration;\n\n private readonly method: string;\n\n private readonly paths: string[];\n\n private readonly current: IGeneratorContext;\n\n constructor(\n parameter: ParameterDeclaration,\n method: string,\n paths: string[],\n current: IGeneratorContext,\n ) {\n this.parameter = parameter;\n this.method = method;\n this.paths = paths.length === 0 ? [''] : paths;\n this.current = current;\n }\n\n public generate(): Parameter[] {\n const parameterName = this.getParameterName();\n const draft = newParameterDraft({ parameterName });\n\n const options = this.applyOptions(parameterName);\n applyDecoratorHandlers(this.parameter, this.current.registry.parameters, draft, options);\n applyJsDocHandlers(this.parameter, this.current.registry.parameterJsDoc, draft, options);\n\n // TS-resolved type\n const type = this.resolveType();\n draft.type = type;\n\n // Description from TS symbol's documentation comment.\n const description = this.getDescription();\n if (description) {\n draft.description = description;\n }\n\n // Deprecation: handler may have set it; otherwise check JSDoc on parameter.\n if (draft.deprecated === undefined && hasJSDocTag(this.parameter, JSDocTagName.DEPRECATED)) {\n draft.deprecated = true;\n }\n\n // Default value from TS initializer.\n const defaultValue = getInitializerValue(this.parameter.initializer, this.current.typeChecker, type);\n if (defaultValue !== undefined) {\n draft.default = defaultValue;\n }\n\n // Required: TS optionality and presence of initializer.\n draft.required = !this.parameter.questionToken && !this.parameter.initializer;\n\n // Examples from method-level JSDoc @example tags scoped to this parameter.\n const { examples, exampleLabels } = this.getJsDocExamples(parameterName);\n if (examples) {\n draft.examples = examples.map((value) => ({ value }));\n draft.exampleLabels = (exampleLabels ?? []).filter((l): l is string => l !== undefined);\n }\n\n // Declaration-level validators (e.g., @MaxLength annotations on the parameter).\n Object.assign(draft.validators, getDeclarationValidators(this.parameter, parameterName));\n\n // Apply default `in` if no handler claimed.\n if (!draft.in) {\n if (!BODY_SUPPORTED_METHODS.has(this.method)) {\n throw ParameterError.methodUnsupported({\n decoratorName: 'Body',\n propertyName: parameterName,\n method: this.method,\n node: this.parameter,\n });\n }\n draft.in = ParamKind.Body;\n }\n\n // Body validation requires the method to support a body.\n if ((draft.in === ParamKind.Body || draft.in === ParamKind.BodyProp) &&\n !BODY_SUPPORTED_METHODS.has(this.method)) {\n throw ParameterError.methodUnsupported({\n decoratorName: 'Body',\n propertyName: draft.name,\n method: this.method,\n node: this.parameter,\n });\n }\n\n return this.finalize(draft, type, parameterName, examples, exampleLabels);\n }\n\n private finalize(\n draft: ParameterDraft,\n type: Type,\n parameterName: string,\n examples: unknown[] | undefined,\n exampleLabels: Array<string | undefined> | undefined,\n ): Parameter[] {\n const kind = draft.in!;\n const wrappedExamples = examples ? examples.map((value) => ({ value })) : undefined;\n const filteredLabels = exampleLabels?.filter((l): l is string => l !== undefined);\n\n // Object decomposition for kinds that can carry an object payload.\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.PATH) &&\n (isNestedObjectLiteralType(type) || isRefObjectType(type))) {\n const decomposed = this.decomposeObject(type, {\n in: kind === ParameterSource.QUERY ? ParameterSource.QUERY_PROP : ParameterSource.PATH,\n examples: wrappedExamples,\n exampleLabels: filteredLabels,\n extensions: draft.extensions,\n });\n if (kind === ParameterSource.PATH) {\n this.validatePathDecomposition(decomposed);\n }\n return decomposed;\n }\n\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.QUERY_PROP) &&\n isArrayType(type)) {\n if (!this.isLeafTypeSupported(type.elementType)) {\n throw ParameterError.typeUnsupported({\n decoratorName: kind === ParameterSource.QUERY ? 'Query' : 'QueryProp',\n propertyName: draft.name,\n type: type.elementType,\n node: this.parameter,\n });\n }\n const arrayParameter: ArrayParameter = {\n ...this.draftToParameter(draft),\n collectionFormat: draft.collectionFormat ?? CollectionFormat.MULTI,\n type,\n };\n return [arrayParameter];\n }\n\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.QUERY_PROP) &&\n !this.isLeafOrEnumOrUnion(type)) {\n throw ParameterError.typeUnsupported({\n decoratorName: kind === ParameterSource.QUERY ? 'Query' : 'QueryProp',\n propertyName: draft.name,\n type,\n node: this.parameter,\n });\n }\n\n if (kind === ParameterSource.PATH) {\n this.validatePathName(draft.name, parameterName);\n }\n\n return [this.draftToParameter(draft)];\n }\n\n private draftToParameter(draft: ParameterDraft): Parameter {\n return {\n allowEmptyValue: draft.allowEmptyValue,\n collectionFormat: draft.collectionFormat,\n default: draft.default,\n description: draft.description,\n examples: draft.examples.length > 0 ? draft.examples : undefined,\n exampleLabels: draft.exampleLabels.length > 0 ? draft.exampleLabels : undefined,\n extensions: draft.extensions,\n in: draft.in!,\n maxItems: draft.maxItems,\n minItems: draft.minItems,\n name: draft.name,\n parameterName: draft.parameterName,\n required: draft.required,\n type: draft.type!,\n deprecated: draft.deprecated,\n validators: draft.validators,\n };\n }\n\n private decomposeObject(\n type: NestedObjectLiteralType | RefObjectType,\n details: {\n in: `${ParameterSource}`;\n examples: { value: unknown }[] | undefined;\n exampleLabels: string[] | undefined;\n extensions: Extension[];\n },\n ): Parameter[] {\n if (type.properties.length === 0) {\n return [];\n }\n\n const parameterName = this.getParameterName();\n const initializerValue = getInitializerValue(this.parameter.initializer, this.current.typeChecker, type);\n const description = this.getDescription();\n const isParamOptional = !!this.parameter.questionToken;\n const isParamDeprecated = hasJSDocTag(this.parameter, JSDocTagName.DEPRECATED);\n\n const output: Parameter[] = [];\n for (const property of type.properties) {\n let propertyDefaultValue = property.default;\n if (typeof propertyDefaultValue === 'undefined' && isObject(initializerValue)) {\n propertyDefaultValue = (initializerValue as Record<string, unknown>)[property.name];\n }\n\n const required = isParamOptional ? false : property.required;\n\n output.push({\n extensions: [...details.extensions],\n in: details.in,\n examples: details.examples,\n exampleLabels: details.exampleLabels,\n default: propertyDefaultValue,\n description: property.description || description,\n name: property.name,\n parameterName,\n required,\n type: property.type,\n deprecated: property.deprecated || isParamDeprecated,\n validators: {},\n });\n }\n return output;\n }\n\n private pathContainsParam(name: string): boolean {\n // Match `{name}` literally — curly braces are their own boundaries.\n // For `:name`, require a word boundary after the name so `:id` doesn't\n // match `:id2` (substring), but it still matches when path-to-regexp\n // modifiers/constraints follow the name (`:id?`, `:id*`, `:id(\\\\d+)`).\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const colonPattern = new RegExp(`:${escaped}\\\\b`);\n const bracePattern = `{${name}}`;\n for (const p of this.paths) {\n if (p.includes(bracePattern) || colonPattern.test(p)) {\n return true;\n }\n }\n return false;\n }\n\n private validatePathDecomposition(decomposed: Parameter[]): void {\n for (const element of decomposed) {\n if (!this.pathContainsParam(element.name)) {\n throw ParameterError.invalidPathMatch({\n decoratorName: 'Path',\n propertyName: element.name,\n path: this.paths.join(' | '),\n node: this.parameter,\n });\n }\n }\n }\n\n private validatePathName(name: string, parameterName: string): void {\n const candidate = name || parameterName;\n if (!this.pathContainsParam(candidate)) {\n throw ParameterError.invalidPathMatch({\n decoratorName: 'Path',\n propertyName: candidate,\n path: this.paths.join(' | '),\n node: this.parameter,\n });\n }\n }\n\n private isLeafTypeSupported(type: BaseType): boolean {\n return SUPPORTED_LEAF_TYPES.has(type.typeName);\n }\n\n private isLeafOrEnumOrUnion(type: Type): boolean {\n return SUPPORTED_LEAF_TYPES.has(type.typeName) ||\n isRefEnumType(type) ||\n isUnionType(type);\n }\n\n private resolveType(): Type {\n let typeNode = this.parameter.type;\n if (!typeNode) {\n const t = this.current.typeChecker.getTypeAtLocation(this.parameter);\n typeNode = this.current.typeChecker.typeToTypeNode(\n t,\n undefined,\n NodeBuilderFlags.NoTruncation,\n );\n }\n if (!typeNode) {\n throw new ParameterError({ message: `Could not resolve type for parameter '${this.getParameterName()}'.` });\n }\n return new TypeNodeResolver(typeNode, this.current, this.parameter).resolve();\n }\n\n private getParameterName(): string {\n if (!isIdentifier(this.parameter.name)) {\n throw new ParameterError({ message: 'Destructured parameters are not supported. Use a simple identifier name.' });\n }\n return this.parameter.name.text;\n }\n\n private getDescription(): string {\n const symbol = this.current.typeChecker.getSymbolAtLocation(this.parameter.name);\n if (symbol) {\n const comments = symbol.getDocumentationComment(this.current.typeChecker);\n if (comments.length > 0) {\n return displayPartsToString(comments);\n }\n }\n return '';\n }\n\n private getJsDocExamples(parameterName: string): {\n examples: unknown[] | undefined;\n exampleLabels: Array<string | undefined> | undefined;\n } {\n const exampleLabels: Array<string | undefined> = [];\n const tags = getJSDocTags(this.parameter.parent, (tag) => {\n const comment = transformJSDocComment(tag.comment);\n const isExample = (tag.tagName.text === JSDocTagName.EXAMPLE ||\n tag.tagName.escapedText === JSDocTagName.EXAMPLE) &&\n !!comment && comment.startsWith(parameterName);\n\n if (isExample && comment) {\n const head = comment.split(' ')[0] ?? '';\n const hasExampleLabel = head.indexOf('.') > 0;\n exampleLabels.push(hasExampleLabel ?\n head.split('.').slice(1).join('.') :\n undefined);\n }\n return isExample ?? false;\n });\n\n const examples = tags.map((tag) => (\n transformJSDocComment(tag.comment) || '')\n .replace(`${transformJSDocComment(tag.comment)?.split(' ')[0] || ''}`, '')\n .replace(/\\r/g, ''));\n\n if (examples.length === 0) {\n return { examples: undefined, exampleLabels: undefined };\n }\n\n try {\n return {\n examples: examples.map((example) => JSON.parse(example)),\n exampleLabels,\n };\n } catch {\n throw ParameterError.invalidExampleSchema();\n }\n }\n\n private applyOptions(parameterName: string): ApplyHandlersOptions {\n return {\n target: 'parameter',\n host: { name: parameterName, parentName: this.method },\n resolveTypeNode: (n) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n parameterType: () => this.parameter.type ?\n new TypeNodeResolver(this.parameter.type, this.current).resolve() :\n undefined,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n}\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport path from 'node:path';\nimport { NodeBuilderFlags } from 'typescript';\nimport type {\n ClassDeclaration,\n Identifier,\n MethodDeclaration,\n TypeNode,\n} from 'typescript';\nimport {\n ParameterSource,\n isVoidType,\n newMethodDraft,\n} from '@trapi/core';\nimport type {\n BaseType,\n Example,\n Method,\n Parameter,\n Response,\n} from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { GeneratorError } from '../../../core/error/generator';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport {\n JSDocTagName,\n getJSDocDescription,\n getJSDocTagComment,\n} from '../../../adapters/typescript/js-doc';\nimport { normalizePath } from '../../../core/utils';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\nimport { ParameterGenerator } from '../parameter';\n\nexport class MethodGenerator {\n protected readonly node: MethodDeclaration;\n\n protected readonly current: IGeneratorContext;\n\n constructor(node: MethodDeclaration, current: IGeneratorContext) {\n this.node = node;\n this.current = current;\n }\n\n public getMethodName(): string {\n const identifier = this.node.name as Identifier;\n return identifier.text;\n }\n\n public generate(controllerPaths: string[]): Method | null {\n const name = this.getMethodName();\n const draft = newMethodDraft({ name });\n\n const options = this.applyOptions();\n applyDecoratorHandlers(this.node, this.current.registry.methods, draft, options);\n applyJsDocHandlers(this.node, this.current.registry.methodJsDoc, draft, options);\n\n // Not a route method (no HTTP verb decorator matched).\n if (!draft.verb) {\n return null;\n }\n\n // Skip hidden methods entirely (matches v1 behaviour for class member iteration).\n if (draft.hidden) {\n return null;\n }\n\n // Resolve return type.\n const returnType = this.resolveReturnType();\n\n // Build responses: handler-supplied first, then a derived default that\n // carries any handler-contributed default-response examples.\n const defaultResponse = buildDefaultResponse(returnType, draft.defaultResponseExamples);\n const responses = mergeDefaultResponse(draft.responses, defaultResponse);\n\n // Walk parameters.\n const parameters = this.buildParameters(controllerPaths, draft.path, draft.verb);\n\n // Description from leading JSDoc comment (no v2 handler covers this since it\n // isn't a tagged value).\n const description = getJSDocDescription(this.node) ?? draft.description;\n const summary = draft.summary ?? getJSDocTagComment(this.node, JSDocTagName.SUMMARY);\n\n return {\n consumes: draft.consumes,\n deprecated: draft.deprecated ?? false,\n description: description ?? '',\n extensions: draft.extensions,\n hidden: draft.hidden,\n method: draft.verb,\n name,\n path: normalizePath(draft.path),\n produces: draft.produces,\n responses,\n security: draft.security,\n summary,\n tags: draft.tags,\n type: returnType,\n parameters,\n };\n }\n\n private applyOptions(): ApplyHandlersOptions {\n const parentName = (this.node.parent as ClassDeclaration).name?.text;\n return {\n target: 'method',\n host: { name: this.getMethodName(), parentName },\n resolveTypeNode: (n: TypeNode) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n\n private resolveReturnType(): BaseType {\n let nodeType = this.node.type;\n if (!nodeType) {\n const { typeChecker } = this.current;\n const signature = typeChecker.getSignatureFromDeclaration(this.node);\n if (!signature) {\n throw new GeneratorError({ message: 'Could not resolve method signature.' });\n }\n const implicitType = typeChecker.getReturnTypeOfSignature(signature);\n nodeType = typeChecker.typeToTypeNode(implicitType, undefined, NodeBuilderFlags.NoTruncation) as TypeNode;\n }\n return new TypeNodeResolver(nodeType, this.current).resolve();\n }\n\n private buildParameters(\n controllerPaths: string[],\n methodPath: string,\n verb: string,\n ): Parameter[] {\n const controllerId = (this.node.parent as ClassDeclaration).name as Identifier;\n const methodId = this.node.name as Identifier;\n // Build the union of every (controllerPath × methodPath) combination so\n // path-parameter validation accepts a parameter that's present in any\n // mount (a controller can mount at /roles AND /realms/:id/roles).\n const fullPaths = (controllerPaths.length === 0 ? [''] : controllerPaths)\n .map((cp) => path.posix.join('/', cp, methodPath));\n\n const output: Parameter[] = [];\n let bodyParameterCount = 0;\n let formParameterCount = 0;\n\n for (const [i, declaration] of this.node.parameters.entries()) {\n try {\n const generator = new ParameterGenerator(\n declaration,\n verb,\n fullPaths,\n this.current,\n );\n\n const parameters = generator.generate();\n\n for (const parameter of parameters) {\n if (parameter.in === ParameterSource.BODY) {\n bodyParameterCount += 1;\n }\n if (parameter.in === ParameterSource.FORM_DATA) {\n formParameterCount += 1;\n }\n if (parameter.in !== ParameterSource.CONTEXT) {\n output.push(parameter);\n }\n }\n } catch (e) {\n const causeMsg = e instanceof Error ? `: ${e.message}` : '';\n throw new GeneratorError({\n message: `Parameter generation failed for '${controllerId.text}.${methodId.text}' argument index ${i}${causeMsg}`,\n code: GeneratorErrorCode.PARAMETER_GENERATION_FAILED,\n cause: e,\n });\n }\n }\n\n if (bodyParameterCount > 1) {\n throw new GeneratorError({\n message: `Only one body parameter allowed in '${controllerId.text}.${methodId.text}' method.`,\n code: GeneratorErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n if (bodyParameterCount > 0 && formParameterCount > 0) {\n throw new GeneratorError({\n message: `Cannot mix body and form parameters in '${controllerId.text}.${methodId.text}' method.`,\n code: GeneratorErrorCode.BODY_FORM_CONFLICT,\n });\n }\n\n return output;\n }\n}\n\nfunction buildDefaultResponse(returnType: BaseType, examples: Example[]): Response {\n const isVoid = isVoidType(returnType);\n return {\n description: isVoid ? 'No content' : 'Ok',\n examples,\n schema: returnType,\n status: isVoid ? '204' : '200',\n name: isVoid ? '204' : '200',\n };\n}\n\nfunction mergeDefaultResponse(handlerResponses: Response[], defaultResponse: Response): Response[] {\n if (handlerResponses.length === 0) {\n return [defaultResponse];\n }\n const target = handlerResponses.find((r) => r.status === defaultResponse.status);\n if (target) {\n if (defaultResponse.examples && defaultResponse.examples.length > 0 &&\n (!target.examples || target.examples.length === 0)) {\n target.examples = defaultResponse.examples;\n }\n return handlerResponses;\n }\n return [...handlerResponses, defaultResponse];\n}\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ClassDeclaration, \n Expression, \n MethodDeclaration, \n TypeNode,\n} from 'typescript';\nimport {\n SymbolFlags,\n SyntaxKind,\n isClassDeclaration,\n isMethodDeclaration,\n} from 'typescript';\nimport { newControllerDraft } from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport { isResolverError } from '../../../core/error/resolver';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { GeneratorError, isGeneratorError } from '../../../core/error/generator';\nimport { normalizePath } from '../../../core/utils';\nimport type { Controller, IControllerGenerator, Method } from '@trapi/core';\nimport { MethodGenerator } from '../method';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\n\nexport class ControllerGenerator implements IControllerGenerator {\n protected readonly node: ClassDeclaration;\n\n protected readonly current: IGeneratorContext;\n\n constructor(node: ClassDeclaration, current: IGeneratorContext) {\n this.node = node;\n this.current = current;\n }\n\n public isValid(): boolean {\n // Whether a class is a controller depends on whether any registry handler\n // matches one of its decorators (e.g. `@Controller`). Resolving that\n // requires running handler dispatch — which `generate()` does — so\n // `isValid()` only screens out unnamed classes here. `generate()` returns\n // `null` when no controller handler claimed the node.\n return !!this.node.name;\n }\n\n public generate(): Controller | null {\n if (!this.node.parent) {\n throw new GeneratorError({\n message: 'Controller node doesn\\'t have a valid parent source file.',\n code: GeneratorErrorCode.CONTROLLER_NO_SOURCE_FILE,\n });\n }\n if (!this.node.name) {\n throw new GeneratorError({\n message: 'Controller node doesn\\'t have a valid name.',\n code: GeneratorErrorCode.CONTROLLER_NO_NAME,\n });\n }\n\n const sourceFile = this.node.parent.getSourceFile();\n const draft = newControllerDraft({\n name: this.node.name.text,\n location: sourceFile.fileName,\n });\n\n const options = this.applyOptions();\n applyDecoratorHandlers(this.node, this.current.registry.controllers, draft, options);\n applyJsDocHandlers(this.node, this.current.registry.controllerJsDoc, draft, options);\n\n // A class is a controller iff a controller-target handler claimed it\n // (convention: the Controller handler sets `draft.paths` to a non-undefined value).\n if (draft.paths === undefined) {\n return null;\n }\n\n // Normalize and dedupe — a user passing `@Controller(['/roles', '/roles'])`\n // (or paths that collide after normalization) shouldn't produce duplicate\n // OpenAPI path keys downstream.\n const normalized = (draft.paths.length === 0 ? [''] : draft.paths).map(normalizePath);\n const paths = [...new Set(normalized)];\n const methods = this.buildMethods(paths);\n\n return {\n consumes: draft.consumes,\n deprecated: draft.deprecated,\n extensions: draft.extensions,\n hidden: draft.hidden,\n location: draft.location,\n name: draft.name,\n paths,\n produces: draft.produces,\n responses: draft.responses,\n security: draft.security,\n tags: draft.tags,\n methods,\n };\n }\n\n private applyOptions(): ApplyHandlersOptions {\n return {\n target: 'class',\n host: { name: this.node.name!.text },\n resolveTypeNode: (n: TypeNode) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n\n protected buildMethods(controllerPaths: string[]): Method[] {\n const set = new Set<string>();\n const output: Method[] = [];\n\n // Process own methods first\n for (const member of this.node.members) {\n if (!isMethodDeclaration(member)) {\n continue;\n }\n\n const generator = new MethodGenerator(member, this.current);\n const methodName = generator.getMethodName();\n if (set.has(methodName)) {\n continue;\n }\n\n const method = generator.generate(controllerPaths);\n if (!method) {\n continue;\n }\n set.add(methodName);\n output.push(method);\n }\n\n // Then process inherited methods from base classes\n const inheritedMethods = this.collectInheritedMethodDeclarations(this.node);\n for (const node of inheritedMethods) {\n const generator = new MethodGenerator(node, this.current);\n const methodName = generator.getMethodName();\n if (set.has(methodName)) {\n continue;\n }\n\n try {\n const method = generator.generate(controllerPaths);\n if (!method) {\n continue;\n }\n set.add(methodName);\n output.push(method);\n } catch (error: unknown) {\n // Skip inherited methods that fail due to unresolvable generic\n // type parameters (e.g., return type T or parameter type T from\n // generic base classes). Rethrow everything else.\n if (\n isResolverError(error) ||\n (isGeneratorError(error) &&\n error.code === GeneratorErrorCode.PARAMETER_GENERATION_FAILED)\n ) {\n continue;\n }\n\n throw error;\n }\n }\n\n return output;\n }\n\n private collectInheritedMethodDeclarations(node: ClassDeclaration): MethodDeclaration[] {\n const methods: MethodDeclaration[] = [];\n\n if (!node.heritageClauses) {\n return methods;\n }\n\n for (const clause of node.heritageClauses) {\n if (clause.token !== SyntaxKind.ExtendsKeyword) {\n continue;\n }\n\n for (const type of clause.types) {\n const baseDeclaration = this.resolveBaseClassDeclaration(type.expression);\n if (!baseDeclaration) {\n continue;\n }\n\n // Collect direct methods from the base class\n for (const member of baseDeclaration.members) {\n if (isMethodDeclaration(member)) {\n methods.push(member);\n }\n }\n\n // Recurse to pick up the full inheritance chain\n methods.push(...this.collectInheritedMethodDeclarations(baseDeclaration));\n }\n }\n\n return methods;\n }\n\n private resolveBaseClassDeclaration(expression: Expression): ClassDeclaration | undefined {\n let symbol = this.current.typeChecker.getSymbolAtLocation(expression);\n if (!symbol) {\n return undefined;\n }\n\n // Follow import aliases to the original declaration\n if (symbol.flags & SymbolFlags.Alias) {\n symbol = this.current.typeChecker.getAliasedSymbol(symbol);\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n return undefined;\n }\n\n const declaration = declarations[0];\n if (declaration && isClassDeclaration(declaration)) {\n return declaration;\n }\n\n return undefined;\n }\n}\n","/*\n * Copyright (c) 2022-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport crypto from 'node:crypto';\nimport { minimatch } from 'minimatch';\nimport type {\n Node,\n Program,\n SourceFile,\n TypeChecker,\n} from 'typescript';\nimport {\n NodeFlags,\n createProgram,\n forEachChild,\n isClassDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n} from 'typescript';\nimport {\n CACHE_SCHEMA_VERSION,\n CacheClient,\n composeCacheKey,\n hashCompilerOptions,\n hashRegistry,\n} from '../../../adapters/cache';\nimport type { MetadataGeneratorOptions } from '../../../core/config';\nimport type {\n Controller,\n DependencyResolver,\n Metadata,\n ReferenceType,\n ReferenceTypes,\n Registry, \n UnmatchedDecoratorReport, \n} from '@trapi/core';\nimport {\n createRegistry,\n loadRegistry,\n loadRegistryByName,\n mergeRegistries,\n resolvePresetByName,\n} from '@trapi/core';\nimport { ConfigError } from '../../../core/error/config';\nimport { ConfigErrorCode } from '../../../core/error/config-codes';\nimport { GeneratorError } from '../../../core/error/generator';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { ResolverCache } from '../../../adapters/typescript/resolver/cache';\nimport { ControllerGenerator } from '../controller';\nimport type {\n IGeneratorContext,\n IMetadataGenerator,\n MetadataGeneratorContext,\n} from '../../../core/metadata/types';\n\nexport class MetadataGenerator implements IGeneratorContext, IMetadataGenerator {\n public readonly nodes : Node[];\n\n public readonly typeChecker: TypeChecker;\n\n public registry: Registry;\n\n public readonly resolverCache: ResolverCache;\n\n public readonly config: MetadataGeneratorOptions;\n\n private readonly program: Program;\n\n private cache : CacheClient;\n\n private controllers: Controller[] = [];\n\n private referenceTypes: ReferenceTypes = {};\n\n private circularDependencyResolvers = new Array<DependencyResolver>();\n\n private unmatchedDecorators: Map<string, UnmatchedDecoratorReport[]> = new Map();\n\n // -------------------------------------------------------------------------\n\n constructor(context: MetadataGeneratorContext) {\n this.nodes = [];\n this.config = context.options;\n\n this.cache = new CacheClient(context.options.cache);\n this.registry = createRegistry();\n this.resolverCache = new ResolverCache();\n\n this.program = createProgram(\n context.sourceFiles,\n context.compilerOptions || {},\n );\n this.typeChecker = this.program.getTypeChecker();\n }\n\n // -------------------------------------------------------------------------\n\n async generate(): Promise<Metadata> {\n const sourceFilesHash : string = this.buildNodesFromSourceFiles();\n\n // Load the preset upfront so its resolved registry can contribute to\n // the cache key. Otherwise edits to a local preset (or upgrades that\n // share a name) would silently serve stale metadata.\n let presetRegistry: Registry | undefined;\n let presetName: string | undefined;\n if (typeof this.config.preset === 'string') {\n presetName = this.config.preset;\n presetRegistry = await loadRegistryByName(this.config.preset);\n } else if (this.config.preset) {\n presetName = this.config.preset.name;\n presetRegistry = await loadRegistry(this.config.preset, { resolver: resolvePresetByName });\n }\n\n if (presetRegistry && this.config.registry) {\n this.registry = mergeRegistries(presetRegistry, this.config.registry);\n } else if (presetRegistry) {\n this.registry = presetRegistry;\n } else if (this.config.registry) {\n this.registry = this.config.registry;\n }\n\n const cacheKey = composeCacheKey({\n schemaVersion: CACHE_SCHEMA_VERSION,\n sourceFilesHash,\n compilerOptionsHash: hashCompilerOptions(this.program.getCompilerOptions()),\n registryHash: hashRegistry(this.registry),\n presetName,\n });\n\n // Strict reporting requires handler dispatch to actually run. A cache hit\n // would skip it and silently swallow unmatched-decorator reports.\n const bypassCache = !!(this.config.strict || this.config.onUnmatchedDecorator);\n\n let cache = bypassCache ?\n undefined :\n await this.cache.get(cacheKey);\n\n if (!cache) {\n this.buildControllers();\n\n this.assertPresetProducedControllers();\n\n this.circularDependencyResolvers.forEach((resolve) => resolve(this.referenceTypes));\n\n cache = {\n controllers: this.controllers,\n referenceTypes: this.referenceTypes,\n cacheKey,\n schemaVersion: CACHE_SCHEMA_VERSION,\n };\n\n if (!bypassCache) {\n await this.cache.save(cache);\n }\n }\n\n if (this.config.strict || this.config.onUnmatchedDecorator) {\n this.dispatchUnmatchedDecoratorReports();\n }\n\n return {\n controllers: cache.controllers,\n referenceTypes: cache.referenceTypes,\n };\n }\n\n private assertPresetProducedControllers(): void {\n if (this.config.preset || this.config.registry || this.controllers.length > 0) {\n return;\n }\n // Only fault a missing preset when we actually scanned source files —\n // an empty entry point is a different misconfiguration that shouldn't\n // surface as a preset error.\n if (this.nodes.length === 0) {\n return;\n }\n throw new ConfigError({\n message: 'No preset or registry configured and no controllers detected. Provide `preset: \\'@trapi/preset-decorators-express\\'` (or another preset), or pass an inline `registry`, so handlers can match your decorators.',\n code: ConfigErrorCode.PRESET_MISSING,\n });\n }\n\n public reportUnmatchedDecorator(report: UnmatchedDecoratorReport): void {\n const key = `${report.target}:${report.name}`;\n const existing = this.unmatchedDecorators.get(key);\n if (existing) {\n existing.push(report);\n return;\n }\n this.unmatchedDecorators.set(key, [report]);\n }\n\n private dispatchUnmatchedDecoratorReports(): void {\n if (this.unmatchedDecorators.size === 0) {\n return;\n }\n\n const flat: UnmatchedDecoratorReport[] = [];\n for (const reports of this.unmatchedDecorators.values()) {\n flat.push(...reports);\n }\n\n // User-supplied callback short-circuits the default warn/throw path.\n if (this.config.onUnmatchedDecorator) {\n this.config.onUnmatchedDecorator(flat);\n return;\n }\n\n const summary = this.formatUnmatchedSummary();\n\n if (this.config.strict === 'throw') {\n throw new GeneratorError({\n message: summary,\n code: GeneratorErrorCode.STRICT_UNMATCHED_DECORATORS,\n });\n }\n\n // eslint-disable-next-line no-console\n console.warn(summary);\n }\n\n private formatUnmatchedSummary(): string {\n const lines: string[] = ['[trapi] strict mode: decorators with no matching handler:'];\n for (const reports of this.unmatchedDecorators.values()) {\n const first = reports[0];\n if (!first) {\n continue;\n }\n const occurrences = reports.length;\n const location = `${first.file}:${first.line}`;\n const suffix = occurrences > 1 ?\n ` (${occurrences} occurrences; first at ${location})` :\n ` (${location})`;\n lines.push(` - @${first.name} on ${first.target} '${first.host.name}'${suffix}`);\n }\n return lines.join('\\n');\n }\n\n protected buildNodesFromSourceFiles() : string {\n const hash = crypto.createHash('sha256');\n\n this.program.getSourceFiles().forEach((sf: SourceFile) => {\n if (\n this.isIgnoredPath(sf.fileName) &&\n !this.isAllowedPath(sf.fileName)\n ) {\n return;\n }\n\n // Hash the file path alongside its contents so that renames or\n // reordered identical files invalidate the cache. The null byte is\n // a safe separator since it cannot appear in a path or source.\n hash.update(sf.fileName);\n hash.update('\\0');\n hash.update(sf.text);\n hash.update('\\0');\n\n forEachChild(sf, (node: any) => {\n if (isModuleDeclaration(node)) {\n /**\n * For some reason unknown to me, TS resolves both `declare module` and `namespace` to\n * the same kind (`ModuleDeclaration`). In order to figure out whether it's one or the other,\n * we check the node flags. They tell us whether it is a namespace or not.\n */\n\n // tslint:disable-next-line:no-bitwise\n if ((node.flags & NodeFlags.Namespace) === 0 && node.body && isModuleBlock(node.body)) {\n node.body.statements.forEach((statement) => {\n this.nodes.push(statement);\n });\n return;\n }\n }\n\n this.nodes.push(node);\n });\n });\n\n return hash.digest('hex');\n }\n\n // -------------------------------------------------------------------------\n\n /**\n * Check if the source file path is in the ignored path list.\n *\n * @param filePath\n * @protected\n */\n protected isIgnoredPath(filePath: string) : boolean {\n if (typeof this.config.ignore === 'undefined') {\n return false;\n }\n\n return this.config.ignore.some((item) => minimatch(filePath, item));\n }\n\n /**\n * Check if the source file path is in the ignored path list.\n *\n * @param filePath\n * @protected\n */\n protected isAllowedPath(filePath: string) {\n if (typeof this.config.allow === 'undefined') {\n return false;\n }\n\n return this.config.allow.some((item) => minimatch(filePath, item));\n }\n\n // -------------------------------------------------------------------------\n\n public isExportedNode(_node: Node) {\n return true;\n }\n\n // -------------------------------------------------------------------------\n\n public addReferenceType(referenceType: ReferenceType) {\n if (!referenceType.refName) {\n return;\n }\n\n this.referenceTypes[referenceType.refName] = referenceType;\n }\n\n public getReferenceType(refName: string) {\n return this.referenceTypes[refName];\n }\n\n public registerDependencyResolver(callback: DependencyResolver) {\n this.circularDependencyResolvers.push(callback);\n }\n\n private buildControllers() : void {\n this.controllers = [];\n\n for (const node of this.nodes) {\n if (!isClassDeclaration(node)) {\n continue;\n }\n\n const generator = new ControllerGenerator(node, this);\n if (!generator.isValid()) {\n continue;\n }\n\n const controller = generator.generate();\n if (controller) {\n this.controllers.push(controller);\n }\n }\n }\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { CompilerOptions } from 'typescript';\nimport type { MetadataGenerateOptions } from '../core/config';\nimport type { Metadata } from '@trapi/core';\nimport { MetadataGenerator } from './generator/metadata';\nimport { scanSourceFiles } from '../adapters/filesystem';\nimport { softLoadTsconfig } from '../adapters/filesystem/tsconfig';\n\nexport async function generateMetadata(\n options: MetadataGenerateOptions,\n) : Promise<Metadata> {\n let compilerOptions : CompilerOptions | undefined;\n\n if (options.tsconfig) {\n let { tsconfig } = options;\n if (typeof tsconfig === 'string') {\n tsconfig = await softLoadTsconfig({ name: tsconfig });\n compilerOptions = tsconfig.compilerOptions;\n } else {\n compilerOptions = tsconfig.compilerOptions || {};\n }\n }\n\n const sourceFiles = await scanSourceFiles(options.entryPoint);\n\n const generator = new MetadataGenerator({\n sourceFiles,\n compilerOptions,\n options,\n });\n\n return generator.generate();\n}\n"],"mappings":";;;;;;;;;;;;AASA,IAAa,gBAAb,cAAmC,UAAU,CAE7C;;;ACFA,IAAa,cAAb,cAAiC,cAAc,CAE/C;;;ACJA,MAAa,kBAAkB;CAC3B,oBAAoB;CACpB,kBAAkB;CAClB,gBAAgB;AACpB;;;ACDA,IAAa,iBAAb,cAAoC,cAAc,CAElD;AAEA,SAAgB,iBAAiB,OAA4D;CACzF,IAAI,CAAC,YAAY,KAAK,GAClB,OAAO;CAGX,OAAO,OAAO,MAAM,SAAS;AACjC;;;ACbA,MAAa,qBAAqB;CAC9B,2BAA2B;CAC3B,oBAAoB;CACpB,6BAA6B;CAC7B,0BAA0B;CAC1B,oBAAoB;CACpB,6BAA6B;AACjC;;;ACPA,MAAa,qBAAqB;CAC9B,kBAAkB;CAClB,oBAAoB;CACpB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;AACrB;;;ACyBA,IAAa,iBAAb,MAAa,uBAAuB,cAAc;CAC9C,OAAO,gBAAgB,SAAiC;EACpD,MAAM,WAAW,QAAQ,OAAO,eAAe,mBAAmB,QAAQ,IAAI,IAAI,KAAA;EAClF,OAAO,IAAI,eAAe;GACtB,SAAS,IAAI,QAAQ,cAAc,IAAI,QAAQ,aAAa,uBAAuB,QAAQ,KAAK,SAAS,QAAQ,WAAW,OAAO,aAAa,GAAG;GACnJ,MAAM,mBAAmB;EAC7B,CAAC;CACL;CAEA,OAAO,kBAAkB,SAAmC;EACxD,MAAM,WAAW,QAAQ,OAAO,eAAe,mBAAmB,QAAQ,IAAI,IAAI,KAAA;EAClF,OAAO,IA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AAiB,EAAE,MAAM,SAAS,CAAC;GACpD,kBAAkB,SAAS;EAC/B,OACI,kBAAkB,SAAS,mBAAmB,CAAC;CAEvD;CAUA,OAAO,IANe,kBAAkB;EACpC,aAAA,MAHsB,gBAAgB,QAAQ,UAAU;EAIxD;EACA;CACJ,CAEe,EAAE,SAAS;AAC9B"}
1
+ {"version":3,"file":"index.mjs","names":["arrayLiteral","readDecoratorName","modelTypeDeclaration","stringifyFlatted","parseFlatted","joinFilePath"],"sources":["../src/core/error/base.ts","../src/core/error/config.ts","../src/core/error/config-codes.ts","../src/core/error/generator.ts","../src/core/error/generator-codes.ts","../src/core/error/parameter-codes.ts","../src/core/error/parameter.ts","../src/core/error/resolver.ts","../src/core/error/validator.ts","../src/core/error/validator-codes.ts","../src/adapters/typescript/js-doc/constants.ts","../src/core/utils/array.ts","../src/core/utils/object.ts","../src/core/utils/path-normalize.ts","../src/adapters/typescript/js-doc/utils.ts","../src/adapters/typescript/js-doc/module.ts","../src/adapters/typescript/initializer.ts","../src/adapters/decorator/typescript/utils.ts","../src/adapters/decorator/typescript/module.ts","../src/adapters/decorator/orchestrator/module.ts","../src/adapters/typescript/validator/module.ts","../src/adapters/typescript/resolver/extension/module.ts","../src/adapters/typescript/resolver/sub/array.ts","../src/adapters/typescript/resolver/sub/base.ts","../src/adapters/typescript/resolver/utils.ts","../src/adapters/typescript/resolver/sub/indexed-access.ts","../src/adapters/typescript/resolver/sub/intersection.ts","../src/adapters/typescript/resolver/sub/literal.ts","../src/adapters/typescript/resolver/sub/mapped.ts","../src/adapters/typescript/resolver/sub/object-literal.ts","../src/adapters/typescript/resolver/sub/primitive.ts","../src/adapters/typescript/resolver/sub/reference.ts","../src/adapters/typescript/resolver/sub/tuple.ts","../src/adapters/typescript/resolver/sub/type-operator.ts","../src/adapters/typescript/resolver/sub/union.ts","../src/adapters/typescript/resolver/module.ts","../src/adapters/typescript/resolver/cache.ts","../src/adapters/typescript/node-utils/module.ts","../src/adapters/filesystem/source-files.ts","../src/adapters/filesystem/tsconfig/module.ts","../src/adapters/cache/constants.ts","../src/adapters/cache/utils.ts","../src/adapters/cache/client.ts","../src/app/generator/parameter/module.ts","../src/app/generator/method/module.ts","../src/app/generator/controller/module.ts","../src/app/generator/metadata/module.ts","../src/app/generate.ts"],"sourcesContent":["/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BaseError } from '@ebec/core';\n\nexport class MetadataError extends BaseError {\n\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { MetadataError } from './base';\n\nexport class ConfigError extends MetadataError {\n\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ConfigErrorCode = {\n TSCONFIG_MALFORMED: 'CONFIG_TSCONFIG_MALFORMED',\n PRESET_NOT_FOUND: 'CONFIG_PRESET_NOT_FOUND',\n PRESET_MISSING: 'CONFIG_PRESET_MISSING',\n} as const;\nexport type ConfigErrorCode = typeof ConfigErrorCode[keyof typeof ConfigErrorCode];\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isBaseError } from '@ebec/core';\nimport { MetadataError } from './base';\n\nexport class GeneratorError extends MetadataError {\n\n}\n\nexport function isGeneratorError(input: unknown): input is GeneratorError & { code: string } {\n if (!isBaseError(input)) {\n return false;\n }\n\n return typeof input.code === 'string';\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const GeneratorErrorCode = {\n CONTROLLER_NO_SOURCE_FILE: 'GENERATOR_CONTROLLER_NO_SOURCE_FILE',\n CONTROLLER_NO_NAME: 'GENERATOR_CONTROLLER_NO_NAME',\n PARAMETER_GENERATION_FAILED: 'GENERATOR_PARAMETER_GENERATION_FAILED',\n BODY_PARAMETER_DUPLICATE: 'GENERATOR_BODY_PARAMETER_DUPLICATE',\n BODY_FORM_CONFLICT: 'GENERATOR_BODY_FORM_CONFLICT',\n STRICT_UNMATCHED_DECORATORS: 'GENERATOR_STRICT_UNMATCHED_DECORATORS',\n} as const;\nexport type GeneratorErrorCode = typeof GeneratorErrorCode[keyof typeof GeneratorErrorCode];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterErrorCode = {\n TYPE_UNSUPPORTED: 'PARAMETER_TYPE_UNSUPPORTED',\n METHOD_UNSUPPORTED: 'PARAMETER_METHOD_UNSUPPORTED',\n PATH_MISMATCH: 'PARAMETER_PATH_MISMATCH',\n SCOPE_REQUIRED: 'PARAMETER_SCOPE_REQUIRED',\n INVALID_EXAMPLE: 'PARAMETER_INVALID_EXAMPLE',\n} as const;\nexport type ParameterErrorCode = typeof ParameterErrorCode[keyof typeof ParameterErrorCode];\n","/*\n * Copyright (c) 2022-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\nimport { isClassDeclaration, isMethodDeclaration } from 'typescript';\nimport type { Node } from 'typescript';\nimport type { BaseType } from '@trapi/core';\nimport { ParameterErrorCode } from './parameter-codes';\nimport { MetadataError } from './base';\n\ntype UnsupportedTypeContext = {\n decoratorName: string,\n propertyName: string,\n type: BaseType,\n node?: Node\n};\n\ntype UnsupportedMethodContext = {\n decoratorName: string,\n propertyName: string,\n method: string,\n node?: Node\n};\n\ntype PathMatchInvalidContext = {\n decoratorName: string,\n propertyName: string,\n path: string,\n node?: Node\n};\n\ntype ScopeRequiredContext = {\n decoratorName: string,\n node?: Node\n};\n\nexport class ParameterError extends MetadataError {\n static typeUnsupported(context: UnsupportedTypeContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not support '${context.type.typeName}' type${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.TYPE_UNSUPPORTED,\n });\n }\n\n static methodUnsupported(context: UnsupportedMethodContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not support method '${context.method}'${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.METHOD_UNSUPPORTED,\n });\n }\n\n static invalidPathMatch(context: PathMatchInvalidContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}('${context.propertyName}') does not exist in path '${context.path}'${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.PATH_MISMATCH,\n });\n }\n\n static scopeRequired(context: ScopeRequiredContext) {\n const location = context.node ? ParameterError.getCurrentLocation(context.node) : undefined;\n return new ParameterError({\n message: `@${context.decoratorName}() requires a scope argument${location ? ` at ${location}` : ''}.`,\n code: ParameterErrorCode.SCOPE_REQUIRED,\n });\n }\n\n static invalidExampleSchema() {\n return new ParameterError({\n message: 'The @example JSDoc tag contains invalid JSON.',\n code: ParameterErrorCode.INVALID_EXAMPLE,\n });\n }\n\n public static getCurrentLocation(node: Node) {\n const parts : string[] = [];\n\n if (isMethodDeclaration(node.parent)) {\n parts.push(node.parent.name.getText());\n\n if (isClassDeclaration(node.parent.parent) && node.parent.parent.name) {\n parts.unshift(node.parent.parent.name.text);\n }\n }\n\n return parts.join('.');\n }\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { normalize } from 'node:path';\nimport { isBaseError } from '@ebec/core';\nimport type { Node, TypeNode } from 'typescript';\nimport { MetadataError } from './base';\n\nexport class ResolverError extends MetadataError {\n public readonly file?: string;\n\n public readonly line?: number;\n\n constructor(\n message: string,\n node?: Node | TypeNode,\n options?: boolean | { onlyCurrent?: boolean, cause?: unknown },\n ) {\n const opts = typeof options === 'boolean' ? { onlyCurrent: options } : options;\n const onlyCurrent = opts?.onlyCurrent ?? false;\n\n const parts: string[] = [message];\n let file: string | undefined;\n let line: number | undefined;\n\n if (node) {\n const location = prettyLocationOfNode(node);\n if (location) {\n parts.push(location.text);\n file = location.file;\n line = location.line;\n }\n\n parts.push(prettyTroubleCause(node, onlyCurrent));\n }\n\n super({\n message: parts.join('\\n'),\n cause: opts?.cause,\n });\n\n this.file = file;\n this.line = line;\n }\n}\n\nexport function isResolverError(input: unknown): input is ResolverError {\n if (!isBaseError(input)) {\n return false;\n }\n\n return 'file' in input && 'line' in input;\n}\n\nexport function prettyLocationOfNode(node: Node | TypeNode): {\n text: string,\n file: string,\n line?: number,\n} | undefined {\n try {\n const sourceFile = node.getSourceFile();\n if (!sourceFile) return undefined;\n\n const token = node.getFirstToken() || node.parent?.getFirstToken();\n const start = token ? sourceFile.getLineAndCharacterOfPosition(token.getStart()).line + 1 : undefined;\n const end = token ? sourceFile.getLineAndCharacterOfPosition(token.getEnd()).line + 1 : undefined;\n\n const normalizedFile = normalize(sourceFile.fileName);\n const startSuffix = start ? `:${start}` : '';\n const endSuffix = end ? `:${end}` : '';\n\n return {\n text: `At: ${normalizedFile}${startSuffix}${endSuffix}.`,\n file: sourceFile.fileName,\n line: start,\n };\n } catch {\n return undefined;\n }\n}\n\nexport function prettyTroubleCause(node: Node | TypeNode, onlyCurrent = false) {\n try {\n let name: string;\n if (onlyCurrent || !node.parent) {\n name = node.pos !== -1 ? node.getText() : (node as any).name.text;\n } else {\n name = node.parent.pos !== -1 ? node.parent.getText() : (node as any).parent.name.text;\n }\n\n return `This was caused by '${name}'`;\n } catch {\n return 'This was caused by an unknown node';\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { MetadataError } from './base';\n\nexport class ValidatorError extends MetadataError {\n\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ValidatorErrorCode = {\n EXPECTED_NUMBER: 'VALIDATOR_EXPECTED_NUMBER',\n EXPECTED_DATE: 'VALIDATOR_EXPECTED_DATE',\n EXPECTED_STRING: 'VALIDATOR_EXPECTED_STRING',\n} as const;\nexport type ValidatorErrorCode = typeof ValidatorErrorCode[keyof typeof ValidatorErrorCode];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum JSDocTagName {\n ABSTRACT = 'abstract',\n ACCESS = 'access',\n ALIAS = 'alias',\n ASYNC = 'async',\n /**\n * Alias for @extends\n */\n AUGMENTS = 'augments',\n AUTHOR = 'author',\n\n // todo: ... add missing\n\n DEFAULT = 'default',\n DEPRECATED = 'deprecated',\n DESCRIPTION = 'description',\n EXAMPLE = 'example',\n\n FORMAT = 'format',\n\n IGNORE = 'ignore',\n\n SUMMARY = 'summary',\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function isStringArray(input: unknown) : input is string[] {\n if (!Array.isArray(input)) {\n return false;\n }\n\n for (const element of input) {\n if (typeof element !== 'string') {\n return false;\n }\n }\n\n return true;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function hasOwnProperty<Y extends PropertyKey>(obj: unknown, prop: Y): obj is Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function normalizePath(str: string) : string {\n // remove slashes\n str = str.replace(/^[/\\\\\\s]+|[/\\\\\\s]+$/g, '');\n\n str = str.replace(/([^:]\\/)\\/+/g, '$1');\n\n return str;\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from 'smob';\nimport type { JSDocComment, NodeArray } from 'typescript';\n\nexport function transformJSDocComment(\n input?: string | NodeArray<JSDocComment>,\n) : string | undefined {\n if (typeof input === 'string') {\n return input;\n }\n\n if (!input || input.length === 0) {\n return undefined;\n }\n\n const comment = input[0];\n if (typeof comment === 'string') {\n return comment;\n }\n\n if (\n isObject(comment) &&\n typeof comment.text === 'string'\n ) {\n return comment.text;\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Identifier, \n JSDoc, \n JSDocTag, \n Node,\n} from 'typescript';\nimport { SyntaxKind, isJSDocParameterTag } from 'typescript';\nimport { MetadataError } from '../../../core/error';\nimport { hasOwnProperty } from '../../../core/utils';\nimport type { JSDocTagName } from './constants';\nimport { transformJSDocComment } from './utils';\n\n// -----------------------------------------\n// Description\n// -----------------------------------------\nexport function getJSDocDescription(node: Node, index?: number) : string | undefined {\n const jsDoc = getJSDoc(node, index);\n if (!jsDoc) {\n return undefined;\n }\n\n return transformJSDocComment(jsDoc.comment);\n}\n\n// -----------------------------------------\n// Tag\n// -----------------------------------------\n\nexport function getJSDoc(node: Node, index?: number) : undefined | JSDoc {\n if (!hasOwnProperty(node, 'jsDoc')) {\n return undefined;\n }\n\n const jsDoc : JSDoc[] | undefined = (node as any).jsDoc as JSDoc[];\n\n if (!jsDoc || !Array.isArray(jsDoc) || !jsDoc.length) {\n return undefined;\n }\n\n index = index ?? 0;\n return jsDoc.length > index && index >= 0 ? jsDoc[index] : undefined; // jsDoc[0] else case\n}\n\nexport function getJSDocTags(\n node: Node,\n isMatching?:\n | `${JSDocTagName}` |\n `${JSDocTagName}`[] |\n (string & {}) |\n (string & {})[] |\n ((tag: JSDocTag) => boolean),\n) : JSDocTag[] {\n const jsDoc = getJSDoc(node);\n if (typeof jsDoc === 'undefined') {\n return [];\n }\n\n const jsDocTags : JSDocTag[] = jsDoc.tags as unknown as JSDocTag[];\n\n if (typeof jsDocTags === 'undefined') {\n return [];\n }\n\n if (typeof isMatching === 'undefined') {\n return jsDocTags;\n }\n\n if (typeof isMatching === 'function') {\n return jsDocTags.filter(isMatching);\n }\n\n const tagNames : string[] = Array.isArray(isMatching) ? isMatching : [isMatching];\n\n return jsDocTags.filter((tag) => tagNames.includes(tag.tagName.text));\n}\n\nexport function hasJSDocTag(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}` | (string & {})) : boolean {\n const tags : JSDocTag[] = getJSDocTags(node, tagName);\n\n return !(!tags || !tags.length);\n}\n\n// -----------------------------------------\n// Tag Comment(s)\n// -----------------------------------------\n\nexport function getJSDocTagComment(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}`) : undefined | string {\n const tags : JSDocTag[] = getJSDocTags(node, tagName);\n const first = tags[0];\n if (!first || typeof first.comment !== 'string') {\n return undefined;\n }\n return first.comment;\n}\n\n// -----------------------------------------\n// Tag Names\n// -----------------------------------------\n\nexport function getJSDocTagNames(node: Node, requireTagName = false) : string[] {\n let tags: JSDocTag[];\n\n /* istanbul ignore next */\n if (node.kind === SyntaxKind.Parameter) {\n const parameterName = ((node as any).name as Identifier).text;\n tags = getJSDocTags(node.parent as any, (tag) => {\n if (isJSDocParameterTag(tag)) {\n return false;\n } if (tag.comment === undefined) {\n throw new MetadataError(`Orphan tag: @${String(tag.tagName.text || tag.tagName.escapedText)} must be followed by a parameter name.`);\n }\n return typeof tag.comment === 'string' ? tag.comment.startsWith(parameterName) : false;\n });\n } else {\n tags = getJSDocTags(node as any, (tag) => (requireTagName ? tag.comment !== undefined : true));\n }\n\n return tags.map((tag) => tag.tagName.text);\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { SyntaxKind, isImportSpecifier } from 'typescript';\nimport type {\n ArrayLiteralExpression,\n Declaration,\n Expression,\n HasInitializer,\n Identifier,\n ImportSpecifier,\n NewExpression,\n Node,\n NumericLiteral,\n ObjectLiteralExpression,\n PrefixUnaryExpression,\n StringLiteral,\n Symbol as TsSymbol,\n TypeChecker,\n} from 'typescript';\nimport { MetadataError } from '../../core/error';\nimport type { Type } from '@trapi/core';\nimport { hasOwnProperty } from '../../core/utils/object';\n\nexport function getInitializerValue(\n initializer?: Expression,\n typeChecker?: TypeChecker,\n type?: Type,\n) : unknown {\n if (!initializer) {\n return undefined;\n }\n\n switch (initializer.kind) {\n case SyntaxKind.ArrayLiteralExpression: {\n const arrayLiteral = initializer as ArrayLiteralExpression;\n return arrayLiteral.elements.map((element) => getInitializerValue(element, typeChecker));\n }\n case SyntaxKind.StringLiteral:\n case SyntaxKind.NoSubstitutionTemplateLiteral:\n return (initializer as StringLiteral).text;\n case SyntaxKind.TrueKeyword:\n return true;\n case SyntaxKind.FalseKeyword:\n return false;\n case SyntaxKind.PrefixUnaryExpression: {\n const prefixUnary = initializer as PrefixUnaryExpression;\n switch (prefixUnary.operator) {\n case SyntaxKind.PlusToken:\n return Number((prefixUnary.operand as NumericLiteral).text);\n case SyntaxKind.MinusToken:\n return Number(`-${(prefixUnary.operand as NumericLiteral).text}`);\n default:\n throw new MetadataError(`Unsupported prefix operator token: ${prefixUnary.operator}`);\n }\n }\n case SyntaxKind.NumberKeyword:\n case SyntaxKind.FirstLiteralToken:\n return Number((initializer as NumericLiteral).text);\n case SyntaxKind.NewExpression: {\n const newExpression = initializer as NewExpression;\n const ident = newExpression.expression as Identifier;\n\n if (ident.text === 'Date') {\n let date = new Date();\n if (newExpression.arguments) {\n const newArguments = newExpression.arguments.filter((args) => args.kind !== undefined);\n const argsValue = newArguments.map((args) => getInitializerValue(args, typeChecker));\n if (argsValue.length > 0) {\n date = new Date(argsValue as any);\n }\n }\n const dateString = date.toISOString();\n if (type && type.typeName === 'date') {\n return dateString.split('T')[0];\n }\n\n return dateString;\n }\n\n return undefined;\n }\n case SyntaxKind.NullKeyword: {\n return null;\n }\n case SyntaxKind.ObjectLiteralExpression: {\n const objectLiteral = initializer as ObjectLiteralExpression;\n const nestedObject: any = {};\n objectLiteral.properties.forEach((p: any) => {\n nestedObject[p.name.text] = getInitializerValue(p.initializer, typeChecker);\n });\n return nestedObject;\n }\n case SyntaxKind.ImportSpecifier: {\n if (typeof typeChecker === 'undefined') {\n return undefined;\n }\n\n const importSpecifier = (initializer as any) as ImportSpecifier;\n const importSymbol = typeChecker.getSymbolAtLocation(importSpecifier.name);\n if (!importSymbol) {\n return undefined;\n }\n\n const aliasedSymbol = typeChecker.getAliasedSymbol(importSymbol);\n const declarations = aliasedSymbol.getDeclarations();\n const declaration = declarations && declarations.length > 0 ? declarations[0] : undefined;\n return getInitializerValue(extractInitializer(declaration), typeChecker);\n }\n default: {\n if (typeof initializer === 'undefined') {\n return undefined;\n }\n if (\n typeof initializer.parent === 'undefined' ||\n typeof typeChecker === 'undefined'\n ) {\n if (hasOwnProperty(initializer, 'text')) {\n return initializer.text;\n }\n\n return undefined;\n }\n\n const symbol = typeChecker.getSymbolAtLocation(initializer);\n if (!symbol) {\n return undefined;\n }\n return getInitializerValue(\n extractInitializer(symbol.valueDeclaration) || extractInitializer(extractImportSpecifier(symbol)),\n typeChecker,\n );\n }\n }\n}\n\nexport const hasInitializer = (\n node: Node,\n): node is HasInitializer => Object.prototype.hasOwnProperty.call(node, 'initializer');\nconst extractInitializer = (\n valueDeclaration?: Declaration,\n) => (valueDeclaration && hasInitializer(valueDeclaration) && (valueDeclaration.initializer as Expression)) || undefined;\nconst extractImportSpecifier = (\n symbol?: TsSymbol,\n) => {\n const declaration = symbol?.declarations?.[0];\n return declaration && isImportSpecifier(declaration) ? declaration : undefined;\n};\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n canHaveDecorators,\n getDecorators,\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isNoSubstitutionTemplateLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPrefixUnaryExpression,\n isPropertyAccessExpression,\n isStringLiteral,\n} from 'typescript';\nimport type {\n Expression,\n Node,\n TypeChecker,\n} from 'typescript';\nimport { getInitializerValue } from '../../typescript/initializer';\nimport type { DecoratorArgument } from '@trapi/core';\n\nexport type RawDecorator = {\n name: string;\n arguments: DecoratorArgument[];\n};\n\n/**\n * Enumerate decorators on a TS node and classify their argument values without\n * going through the registry. Used by read-side consumers (type resolver,\n * extension extraction) that only need decorator names + argument values.\n */\nexport function readNodeDecorators(node: Node, typeChecker?: TypeChecker): RawDecorator[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n const decorators = getDecorators(node);\n if (!decorators || decorators.length === 0) {\n return [];\n }\n\n const output: RawDecorator[] = [];\n for (const decorator of decorators) {\n const { expression } = decorator;\n let name: string | undefined;\n let argumentExpressions: readonly Expression[] = [];\n\n if (isCallExpression(expression)) {\n argumentExpressions = expression.arguments;\n name = readDecoratorName(expression.expression);\n } else {\n name = readDecoratorName(expression);\n }\n\n if (!name) {\n continue;\n }\n\n output.push({\n name,\n arguments: argumentExpressions.map((a) => buildDecoratorArgument(a, typeChecker)),\n });\n }\n return output;\n}\n\nexport function findDecoratorByName(\n node: Node,\n name: string,\n typeChecker?: TypeChecker,\n): RawDecorator | undefined {\n return readNodeDecorators(node, typeChecker).find((d) => d.name === name);\n}\n\nexport function findDecoratorsByName(\n node: Node,\n name: string,\n typeChecker?: TypeChecker,\n): RawDecorator[] {\n return readNodeDecorators(node, typeChecker).filter((d) => d.name === name);\n}\n\nexport function hasDecoratorNamed(node: Node, name: string, typeChecker?: TypeChecker): boolean {\n return readNodeDecorators(node, typeChecker).some((d) => d.name === name);\n}\n\nfunction readDecoratorName(expression: Node): string | undefined {\n if (isIdentifier(expression)) {\n return expression.text;\n }\n if (isPropertyAccessExpression(expression)) {\n return expression.name.text;\n }\n return undefined;\n}\n\nexport function buildDecoratorArgument(\n expr: Expression,\n typeChecker?: TypeChecker,\n): DecoratorArgument {\n if (\n isStringLiteral(expr) ||\n isNumericLiteral(expr) ||\n isNoSubstitutionTemplateLiteral(expr)\n ) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.TrueKeyword) {\n return { raw: true, kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.FalseKeyword) {\n return { raw: false, kind: 'literal' };\n }\n\n if (expr.kind === SyntaxKind.NullKeyword) {\n return { raw: null, kind: 'literal' };\n }\n\n if (\n isPrefixUnaryExpression(expr) &&\n (expr.operator === SyntaxKind.PlusToken || expr.operator === SyntaxKind.MinusToken) &&\n isNumericLiteral(expr.operand)\n ) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'literal' };\n }\n\n if (isObjectLiteralExpression(expr)) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'object' };\n }\n\n if (isArrayLiteralExpression(expr)) {\n return { raw: getInitializerValue(expr, typeChecker), kind: 'array' };\n }\n\n if (isIdentifier(expr) || isPropertyAccessExpression(expr)) {\n const value = getInitializerValue(expr, typeChecker);\n if (typeof value !== 'undefined') {\n return { raw: value, kind: 'identifier' };\n }\n return { raw: undefined, kind: 'unresolvable' };\n }\n\n return { raw: undefined, kind: 'unresolvable' };\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n canHaveDecorators,\n getDecorators,\n isCallExpression,\n isIdentifier,\n isJSDocParameterTag,\n isJSDocPropertyTag,\n isJSDocReturnTag,\n isJSDocThisTag,\n isJSDocTypeTag,\n isPropertyAccessExpression,\n isQualifiedName,\n} from 'typescript';\nimport type {\n Decorator,\n EntityName,\n Expression,\n JSDocTag,\n Node,\n TypeNode,\n} from 'typescript';\nimport { getJSDocTags } from '../../typescript/js-doc';\nimport { transformJSDocComment } from '../../typescript/js-doc/utils';\nimport type {\n DecoratorArgument,\n DecoratorSource,\n DecoratorTypeArgument,\n JsDocSource,\n} from '@trapi/core';\nimport type { DecoratorSourceBuilderOptions, JsDocSourceBuilderOptions } from './types';\nimport { buildDecoratorArgument } from './utils';\n\n// -----------------------------------------------------------------------------\n// Decorator sources\n// -----------------------------------------------------------------------------\n\nexport function buildDecoratorSources(\n node: Node,\n options: DecoratorSourceBuilderOptions,\n): DecoratorSource[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n\n const decorators = getDecorators(node);\n if (!decorators || decorators.length === 0) {\n return [];\n }\n\n const output: DecoratorSource[] = [];\n for (const decorator of decorators) {\n const source = buildDecoratorSource(decorator, options);\n if (source) {\n output.push(source);\n }\n }\n return output;\n}\n\nfunction buildDecoratorSource(\n decorator: Decorator,\n options: DecoratorSourceBuilderOptions,\n): DecoratorSource | undefined {\n const { expression } = decorator;\n\n let name: string | undefined;\n let argumentExpressions: readonly Expression[] = [];\n let typeArgumentNodes: readonly TypeNode[] = [];\n\n if (isCallExpression(expression)) {\n argumentExpressions = expression.arguments;\n typeArgumentNodes = expression.typeArguments ?? [];\n name = readDecoratorName(expression.expression);\n } else {\n name = readDecoratorName(expression);\n }\n\n if (!name) {\n return undefined;\n }\n\n const decoratorArguments: DecoratorArgument[] = argumentExpressions.map(\n (arg) => buildDecoratorArgument(arg, options.typeChecker),\n );\n\n const decoratorTypeArguments: DecoratorTypeArgument[] = typeArgumentNodes.map(\n (typeNode) => ({ resolve: () => options.resolveTypeNode(typeNode) }),\n );\n\n const sourceFile = decorator.getSourceFile();\n const location = sourceFile ? {\n file: sourceFile.fileName,\n line: sourceFile.getLineAndCharacterOfPosition(decorator.getStart()).line + 1,\n } : undefined;\n\n return {\n name,\n arguments: decoratorArguments,\n typeArguments: decoratorTypeArguments,\n target: options.target,\n host: options.host,\n location,\n };\n}\n\nfunction readDecoratorName(expression: Node): string | undefined {\n if (isIdentifier(expression)) {\n return expression.text;\n }\n if (isPropertyAccessExpression(expression)) {\n return expression.name.text;\n }\n return undefined;\n}\n\n// -----------------------------------------------------------------------------\n// JSDoc sources\n// -----------------------------------------------------------------------------\n\nexport function buildJsDocSources(\n node: Node,\n options: JsDocSourceBuilderOptions,\n): JsDocSource[] {\n const tags = getJSDocTags(node);\n if (tags.length === 0) {\n return [];\n }\n\n const output: JsDocSource[] = [];\n for (const tag of tags) {\n output.push(buildJsDocSource(tag, options));\n }\n return output;\n}\n\nfunction buildJsDocSource(\n tag: JSDocTag,\n options: JsDocSourceBuilderOptions,\n): JsDocSource {\n const tagName = tag.tagName.text;\n const text = transformJSDocComment(tag.comment);\n\n let parameterName: string | undefined;\n let typeNode: TypeNode | undefined;\n\n if (isJSDocParameterTag(tag) || isJSDocPropertyTag(tag)) {\n if (tag.name) {\n parameterName = readEntityName(tag.name);\n }\n typeNode = tag.typeExpression?.type;\n } else if (\n isJSDocReturnTag(tag) ||\n isJSDocTypeTag(tag) ||\n isJSDocThisTag(tag)\n ) {\n typeNode = tag.typeExpression?.type;\n }\n\n const source: JsDocSource = {\n tag: tagName,\n target: options.target,\n host: options.host,\n };\n\n if (typeof text !== 'undefined') {\n source.text = text;\n }\n\n if (typeof parameterName !== 'undefined') {\n source.parameterName = parameterName;\n }\n\n if (typeNode) {\n const capturedTypeNode = typeNode;\n source.typeExpression = { resolve: () => options.resolveTypeNode(capturedTypeNode) };\n }\n\n return source;\n}\n\nfunction readEntityName(name: EntityName): string | undefined {\n if (isIdentifier(name)) {\n return name.text;\n }\n if (isQualifiedName(name)) {\n const left = readEntityName(name.left);\n return left ? `${left}.${name.right.text}` : name.right.text;\n }\n return undefined;\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n matches,\n matchesJsDoc,\n} from '@trapi/core';\nimport type {\n DecoratorSource,\n HandlerContext,\n JsDocHandlerContext,\n JsDocMatch,\n JsDocSource,\n Match,\n} from '@trapi/core';\nimport { buildDecoratorSources, buildJsDocSources } from '../typescript';\nimport type { ApplyHandlersOptions } from './types';\n\ntype DecoratorHandlerLike<D> = {\n match: Match;\n apply: (ctx: HandlerContext, draft: D) => void;\n};\n\ntype JsDocHandlerLike<D> = {\n match: JsDocMatch;\n apply: (ctx: JsDocHandlerContext, draft: D) => void;\n};\n\nexport function buildHandlerContext(\n source: DecoratorSource,\n options: ApplyHandlersOptions,\n): HandlerContext {\n return {\n host: source.host,\n argument: (i) => source.arguments[i],\n arguments: () => source.arguments,\n typeArgument: (i) => source.typeArguments[i],\n typeArguments: () => source.typeArguments,\n parameterType: options.parameterType ?? (() => undefined),\n };\n}\n\nexport function buildJsDocHandlerContext(\n source: JsDocSource,\n options: ApplyHandlersOptions,\n): JsDocHandlerContext {\n return {\n host: source.host,\n source,\n parameterType: options.parameterType ?? (() => undefined),\n };\n}\n\nexport function applyDecoratorHandlers<D>(\n node: Node,\n handlers: DecoratorHandlerLike<D>[],\n draft: D,\n options: ApplyHandlersOptions,\n): void {\n if (handlers.length === 0 && !options.onUnmatchedDecorator) {\n return;\n }\n const sources = buildDecoratorSources(node, options);\n if (sources.length === 0) {\n return;\n }\n for (const source of sources) {\n let matched = 0;\n for (const handler of handlers) {\n if (matches(handler.match, source)) {\n handler.apply(buildHandlerContext(source, options), draft);\n matched += 1;\n }\n }\n if (matched === 0 && options.onUnmatchedDecorator) {\n // Prefer the decorator's own AST line if `buildDecoratorSources`\n // populated it; fall back to the host node's line otherwise.\n let file: string;\n let line: number;\n if (source.location) {\n file = source.location.file;\n line = source.location.line;\n } else {\n const sourceFile = node.getSourceFile();\n file = sourceFile.fileName;\n line = sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1;\n }\n options.onUnmatchedDecorator(\n {\n name: source.name,\n target: source.target,\n host: source.host,\n file,\n line,\n },\n source,\n );\n }\n }\n}\n\nexport function applyJsDocHandlers<D>(\n node: Node,\n handlers: JsDocHandlerLike<D>[],\n draft: D,\n options: ApplyHandlersOptions,\n): void {\n if (handlers.length === 0) {\n return;\n }\n const sources = buildJsDocSources(node, options);\n if (sources.length === 0) {\n return;\n }\n for (const source of sources) {\n for (const handler of handlers) {\n if (matchesJsDoc(handler.match, source)) {\n handler.apply(buildJsDocHandlerContext(source, options), draft);\n }\n }\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ParameterDeclaration, \n PropertyDeclaration, \n PropertySignature, \n TypeAliasDeclaration,\n} from 'typescript';\nimport type { Validator } from '@trapi/core';\nimport { ValidatorName } from '@trapi/core';\nimport { ValidatorError } from '../../../core/error/validator';\nimport { getJSDocTags, transformJSDocComment } from '../js-doc';\nimport { ValidatorErrorCode } from '../../../core/error/validator-codes';\n\nexport function getDeclarationValidators(\n declaration: PropertyDeclaration | TypeAliasDeclaration | PropertySignature | ParameterDeclaration,\n name?: string,\n): Record<string, Validator> {\n if (!declaration.parent) {\n return {};\n }\n\n const getCommentValue = (comment?: string) => comment && comment.split(' ')[0];\n\n const parameterTags = getSupportedParameterTags();\n const tags = getJSDocTags(declaration.parent, (tag) => {\n const { comment } = tag;\n if (!comment) {\n return false;\n }\n\n const text = transformJSDocComment(comment);\n const commentValue = getCommentValue(text);\n\n return parameterTags.some((value) => {\n if (value !== tag.tagName.text) {\n return false;\n }\n\n return !(name && name !== commentValue);\n });\n });\n\n function getErrorMsg(comment?: string, isValue = true) : string | undefined {\n if (!comment) {\n return undefined;\n }\n if (isValue) {\n const indexOf = comment.indexOf(' ');\n if (indexOf > 0) {\n return comment.substring(indexOf + 1);\n }\n return undefined;\n }\n\n return comment;\n }\n\n const validators : Record<string, Validator> = {};\n\n for (const tag of tags) {\n if (!tag.comment) {\n continue;\n }\n\n const name = tag.tagName.text;\n\n const rawComment = transformJSDocComment(tag.comment);\n if (!rawComment) {\n continue;\n }\n const comment = rawComment.substring(rawComment.indexOf(' ') + 1).trim();\n\n const value = getCommentValue(comment);\n\n switch (name) {\n case ValidatorName.UNIQUE_ITEMS:\n validators[name] = {\n message: getErrorMsg(comment, false),\n value: undefined,\n };\n break;\n case ValidatorName.MINIMUM:\n case ValidatorName.MAXIMUM:\n case ValidatorName.MIN_ITEMS:\n case ValidatorName.MAX_ITEMS:\n case ValidatorName.MIN_LENGTH:\n case ValidatorName.MAX_LENGTH:\n {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n throw new ValidatorError({\n message: `@${name} validator expects a numeric value, got '${value}'.`,\n code: ValidatorErrorCode.EXPECTED_NUMBER,\n });\n }\n validators[name] = {\n message: getErrorMsg(comment),\n value: parsed,\n };\n }\n break;\n case ValidatorName.MIN_DATE:\n case ValidatorName.MAX_DATE:\n if (typeof value !== 'string') {\n throw new ValidatorError({\n message: `@${name} validator expects a date string, got '${typeof value}'.`,\n code: ValidatorErrorCode.EXPECTED_DATE,\n });\n }\n\n validators[name] = {\n message: getErrorMsg(comment),\n value,\n };\n break;\n case ValidatorName.PATTERN:\n if (typeof value !== 'string') {\n throw new ValidatorError({\n message: `@${name} validator expects a string pattern, got '${value}'.`,\n code: ValidatorErrorCode.EXPECTED_STRING,\n });\n }\n\n validators[name] = {\n message: getErrorMsg(comment),\n value: removeSurroundingQuotes(value),\n };\n break;\n default:\n if (name.toLowerCase().startsWith('is')) {\n const errorMsg = getErrorMsg(comment, false);\n if (errorMsg) {\n validators[name] = {\n message: errorMsg,\n value: undefined,\n };\n }\n }\n break;\n }\n }\n\n return validators;\n}\n\nfunction getSupportedParameterTags() {\n return [\n 'isString',\n 'isBoolean',\n 'isInt',\n 'isLong',\n 'isFloat',\n 'isDouble',\n 'isDate',\n 'isDateTime',\n\n 'minItems',\n 'maxItems',\n 'uniqueItems',\n 'minLength',\n 'maxLength',\n 'pattern',\n 'minimum',\n 'maximum',\n 'minDate',\n 'maxDate',\n ];\n}\n\nfunction removeSurroundingQuotes(str: string) {\n if (str.startsWith('`') && str.endsWith('`')) {\n return str.substring(1, str.length - 1);\n }\n if (str.startsWith('```') && str.endsWith('```')) {\n return str.substring(3, str.length - 3);\n }\n return str;\n}\n","/*\n * Copyright (c) 2023-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n isExtensionMarker,\n namesForMarker,\n} from '@trapi/core';\nimport type { Extension, Registry } from '@trapi/core';\nimport { findDecoratorsByName } from '../../../decorator';\n\nexport function getNodeExtensions(node: Node, registry: Registry) : Extension[] {\n const names = namesForMarker(registry, isExtensionMarker);\n if (names.size === 0) {\n return [];\n }\n\n const output : Extension[] = [];\n for (const name of names) {\n const decorators = findDecoratorsByName(node, name);\n for (const decorator of decorators) {\n const keyArg = decorator.arguments[0];\n const valueArg = decorator.arguments[1];\n if (!keyArg || keyArg.kind !== 'literal' || typeof keyArg.raw !== 'string') {\n continue;\n }\n if (!valueArg || valueArg.kind === 'unresolvable' || typeof valueArg.raw === 'undefined') {\n continue;\n }\n output.push({ key: keyArg.raw, value: valueArg.raw as never });\n }\n }\n return output;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isArrayTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { ArrayType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveArrayType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isArrayTypeNode(typeNode)) {\n return undefined;\n }\n\n return {\n typeName: TypeName.ARRAY,\n elementType: ctx.resolveType(\n typeNode.elementType,\n ctx.parentNode,\n ctx.context,\n ),\n } as ArrayType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n SyntaxKind,\n canHaveModifiers,\n getModifiers,\n} from 'typescript';\n\n\nexport class ResolverBase {\n protected hasPublicModifier(node: Node) {\n if (!canHaveModifiers(node)) {\n return true;\n }\n\n const modifiers = getModifiers(node);\n if (!modifiers) {\n return true;\n }\n\n return modifiers.every(\n (modifier) => modifier.kind !== SyntaxKind.ProtectedKeyword && modifier.kind !== SyntaxKind.PrivateKeyword,\n );\n }\n\n protected hasStaticModifier(node: Node) {\n if (!canHaveModifiers(node)) {\n return false;\n }\n\n const modifiers = getModifiers(node);\n\n return modifiers && modifiers.some((modifier) => modifier.kind === SyntaxKind.StaticKeyword);\n }\n\n protected isAccessibleParameter(node: Node) {\n // No modifiers\n if (!canHaveModifiers(node)) {\n return false;\n }\n\n const modifiers = getModifiers(node);\n if (!modifiers) {\n return false;\n }\n\n // public || public readonly\n if (modifiers.some((modifier) => modifier.kind === SyntaxKind.PublicKeyword)) {\n return true;\n }\n\n // readonly, not private readonly, not public readonly\n const isReadonly = modifiers.some((modifier) => modifier.kind === SyntaxKind.ReadonlyKeyword);\n const isProtectedOrPrivate = modifiers.some(\n (modifier) => modifier.kind === SyntaxKind.ProtectedKeyword ||\n modifier.kind === SyntaxKind.PrivateKeyword,\n );\n\n return isReadonly && !isProtectedOrPrivate;\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\nimport type {\n Node,\n TypeChecker,\n TypeNode,\n} from 'typescript';\nimport { SyntaxKind, displayPartsToString } from 'typescript';\nimport { hasOwnProperty } from '../../../core/utils';\nimport { ResolverError } from '../../../core/error/resolver';\n\nexport function getNodeDescription(\n node: Node,\n typeChecker: TypeChecker,\n) {\n if (!hasOwnProperty(node, 'name')) {\n return undefined;\n }\n\n const symbol = typeChecker.getSymbolAtLocation(node.name as Node);\n if (!symbol) {\n return undefined;\n }\n\n /**\n * TODO: Workaround for what seems like a bug in the compiler\n * Warrants more investigation and possibly a PR against typescript\n */\n if (node.kind === SyntaxKind.Parameter) {\n // TypeScript won't parse jsdoc if the flag is 4, i.e. 'Property'\n symbol.flags = 0;\n }\n\n const comments = symbol.getDocumentationComment(typeChecker);\n if (comments.length) {\n return displayPartsToString(comments);\n }\n\n return undefined;\n}\n\nexport function toTypeNodeOrFail(\n typeChecker: TypeChecker,\n ...args: Parameters<TypeChecker['typeToTypeNode']>\n) : TypeNode {\n const output = typeChecker.typeToTypeNode(...args);\n if (typeof output === 'undefined') {\n throw new ResolverError('Type could not be transformed to TypeNode.');\n }\n\n return output;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n isIndexedAccessTypeNode,\n isLiteralTypeNode,\n isNumericLiteral,\n isStringLiteral,\n} from 'typescript';\nimport type { HasType, Node, TypeNode } from 'typescript';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type { Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveIndexedAccessType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isIndexedAccessTypeNode(typeNode)) {\n return undefined;\n }\n\n // Variant 1: T[number] or T[string]\n if (\n typeNode.indexType.kind === SyntaxKind.NumberKeyword ||\n typeNode.indexType.kind === SyntaxKind.StringKeyword\n ) {\n const numberIndexType = typeNode.indexType.kind === SyntaxKind.NumberKeyword;\n const objectType = ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType);\n const type = numberIndexType ? objectType.getNumberIndexType() : objectType.getStringIndexType();\n if (type === undefined) {\n throw new ResolverError(\n `Could not determine ${numberIndexType ? 'number' : 'string'} index on ${ctx.typeChecker.typeToString(objectType)}`,\n typeNode,\n );\n }\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, type, undefined, undefined),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n // Variant 2: T['key'] or T[0]\n if (\n isLiteralTypeNode(typeNode.indexType) &&\n (\n isStringLiteral(typeNode.indexType.literal) ||\n isNumericLiteral(typeNode.indexType.literal)\n )\n ) {\n const hasType = (node: Node | undefined): node is HasType => node !== undefined &&\n Object.prototype.hasOwnProperty.call(node, 'type');\n\n const symbol = ctx.typeChecker.getPropertyOfType(\n ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType),\n typeNode.indexType.literal.text,\n );\n\n if (symbol === undefined) {\n throw new ResolverError(\n `Could not determine the keys on ${ctx.typeChecker.typeToString(ctx.typeChecker.getTypeFromTypeNode(typeNode.objectType))}`,\n typeNode,\n );\n }\n\n if (hasType(symbol.valueDeclaration) && symbol.valueDeclaration.type) {\n return ctx.resolveType(\n symbol.valueDeclaration.type,\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n const declaration = ctx.typeChecker.getTypeOfSymbolAtLocation(symbol, typeNode.objectType);\n try {\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, declaration, undefined, undefined),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n } catch (err) {\n throw new ResolverError(\n `Could not determine the keys on ${ctx.typeChecker.typeToString(declaration)}`,\n typeNode,\n { cause: err },\n );\n }\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isIntersectionTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { IntersectionType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveIntersectionType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isIntersectionTypeNode(typeNode)) {\n return undefined;\n }\n\n const members = typeNode.types.map(\n (type) => ctx.resolveType(type, ctx.parentNode, ctx.context),\n );\n\n return {\n typeName: TypeName.INTERSECTION,\n members,\n } as IntersectionType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n SyntaxKind,\n isFunctionTypeNode,\n isLiteralTypeNode,\n isParenthesizedTypeNode,\n} from 'typescript';\nimport type {\n LiteralExpression,\n LiteralTypeNode,\n StringLiteralType,\n TypeNode,\n} from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n AnyType,\n EnumType,\n Type,\n} from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveLiteralType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (typeNode.kind === SyntaxKind.NullKeyword) {\n return {\n typeName: TypeName.ENUM,\n members: [null],\n } as EnumType;\n }\n\n if (\n typeNode.kind === SyntaxKind.AnyKeyword ||\n typeNode.kind === SyntaxKind.UnknownKeyword\n ) {\n return { typeName: TypeName.ANY } as AnyType;\n }\n\n if (isLiteralTypeNode(typeNode)) {\n return {\n typeName: TypeName.ENUM,\n members: [getLiteralValue(typeNode)],\n } as EnumType;\n }\n\n if (typeNode.kind === SyntaxKind.TemplateLiteralType) {\n const type = ctx.typeChecker.getTypeFromTypeNode(ctx.referencer || typeNode);\n if (type.isUnion() && type.types.every((t) => t.isStringLiteral())) {\n return {\n typeName: TypeName.ENUM,\n members: type.types.map(\n (t: StringLiteralType) => t.value,\n ),\n } as EnumType;\n }\n\n throw new ResolverError(\n `Could not resolve type: ${ctx.typeChecker.typeToString(ctx.typeChecker.getTypeFromTypeNode(typeNode), typeNode)}`,\n typeNode,\n );\n }\n\n if (isParenthesizedTypeNode(typeNode)) {\n return ctx.resolveType(\n typeNode.type,\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n }\n\n if (\n typeNode.kind === SyntaxKind.ObjectKeyword ||\n isFunctionTypeNode(typeNode)\n ) {\n return { typeName: TypeName.OBJECT };\n }\n\n return undefined;\n}\n\nexport function getLiteralValue(typeNode: LiteralTypeNode): string | number | boolean | null {\n let value: boolean | number | string | null;\n switch (typeNode.literal.kind) {\n case SyntaxKind.TrueKeyword:\n value = true;\n break;\n case SyntaxKind.FalseKeyword:\n value = false;\n break;\n case SyntaxKind.StringLiteral:\n value = typeNode.literal.text;\n break;\n case SyntaxKind.NumericLiteral:\n value = Number.parseFloat(typeNode.literal.text);\n break;\n case SyntaxKind.NullKeyword:\n value = null;\n break;\n default:\n if (Object.prototype.hasOwnProperty.call(typeNode.literal, 'text')) {\n value = (typeNode.literal as LiteralExpression).text;\n } else {\n throw new ResolverError(\n `Couldn't resolve literal node: ${typeNode.literal.getText()}`,\n typeNode.literal,\n );\n }\n }\n return value;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n NodeBuilderFlags,\n SymbolFlags,\n SyntaxKind,\n factory,\n isMappedTypeNode,\n isParameter,\n isPropertyDeclaration,\n isPropertySignature,\n} from 'typescript';\nimport type {\n Declaration,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n Symbol as TsSymbol,\n TypeNode,\n} from 'typescript';\nimport { JSDocTagName } from '../../js-doc';\nimport { TypeName } from '@trapi/core';\nimport type { ResolverProperty, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveMappedType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isMappedTypeNode(typeNode) || !ctx.referencer) {\n return undefined;\n }\n\n const type = ctx.typeChecker.getTypeFromTypeNode(ctx.referencer);\n const mappedTypeNode = typeNode;\n const { typeChecker } = ctx;\n\n const getDeclaration = (prop: TsSymbol) => prop.declarations && (prop.declarations[0] as Declaration | undefined);\n\n const isIgnored = (prop: TsSymbol) => {\n const declaration = getDeclaration(prop);\n const tagNames = prop.getJsDocTags();\n const tagNameIndex = tagNames.findIndex((tag) => tag.name === JSDocTagName.IGNORE);\n if (tagNameIndex >= 0) {\n return true;\n }\n return (\n !!declaration &&\n !isPropertyDeclaration(declaration) &&\n !isPropertySignature(declaration) &&\n !isParameter(declaration)\n );\n };\n\n const properties: ResolverProperty[] = type\n .getProperties()\n .filter((property) => !isIgnored(property))\n .map((property) => {\n const declaration = getDeclaration(property) as\n PropertySignature |\n PropertyDeclaration |\n ParameterDeclaration |\n undefined;\n\n // Normalize +? (PlusToken) to ? (QuestionToken) so property helpers treat it as optional\n const overrideToken = mappedTypeNode.questionToken?.kind === SyntaxKind.PlusToken ?\n factory.createToken(SyntaxKind.QuestionToken) :\n mappedTypeNode.questionToken;\n\n if (declaration && isPropertySignature(declaration)) {\n return { ...ctx.propertyFromSignature(declaration, overrideToken), name: property.getName() };\n }\n if (declaration && (isPropertyDeclaration(declaration) || isParameter(declaration))) {\n return { ...ctx.propertyFromDeclaration(declaration, overrideToken), name: property.getName() };\n }\n\n let required = (property.flags & SymbolFlags.Optional) === 0;\n\n const typeNode2 = toTypeNodeOrFail(\n typeChecker,\n typeChecker.getTypeOfSymbolAtLocation(property, typeNode),\n undefined,\n NodeBuilderFlags.NoTruncation,\n );\n if (mappedTypeNode.questionToken && mappedTypeNode.questionToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (\n mappedTypeNode.questionToken &&\n (\n mappedTypeNode.questionToken.kind === SyntaxKind.QuestionToken ||\n mappedTypeNode.questionToken.kind === SyntaxKind.PlusToken\n )\n ) {\n required = false;\n }\n\n return {\n name: property.getName(),\n required,\n deprecated: false,\n type: ctx.resolveType(typeNode2, typeNode, ctx.context, ctx.referencer),\n validators: {},\n };\n });\n\n return {\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties,\n };\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n isIdentifier,\n isIndexSignatureDeclaration,\n isNumericLiteral,\n isPropertySignature,\n isStringLiteral,\n isTypeLiteralNode,\n} from 'typescript';\nimport type {\n IndexSignatureDeclaration,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n TypeNode,\n} from 'typescript';\nimport {\n JSDocTagName,\n getJSDocTagComment,\n hasJSDocTag,\n} from '../../js-doc';\nimport { getDeclarationValidators } from '../../validator';\nimport { TypeName, isStringType } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n NestedObjectLiteralType,\n ResolverProperty,\n Type,\n} from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveObjectLiteralType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTypeLiteralNode(typeNode)) {\n return undefined;\n }\n\n const properties: ResolverProperty[] = typeNode.members\n .filter((member) => isPropertySignature(member))\n .reduce((res, propertySignature: PropertySignature) => {\n if (!propertySignature.type) {\n throw new ResolverError('No valid type found for property declaration.', propertySignature);\n }\n\n const type = ctx.resolveType(\n propertySignature.type,\n propertySignature,\n ctx.context,\n );\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertySignature, JSDocTagName.DEPRECATED),\n example: ctx.getNodeExample(propertySignature),\n extensions: ctx.getNodeExtensions(propertySignature),\n default: getJSDocTagComment(propertySignature, JSDocTagName.DEFAULT),\n description: ctx.getNodeDescription(propertySignature),\n format: getNodeFormat(propertySignature),\n name: getPropertyName(propertySignature),\n required: !propertySignature.questionToken,\n type,\n validators: getDeclarationValidators(propertySignature) || {},\n };\n\n return [property, ...res];\n }, [] as ResolverProperty[]);\n\n const indexMember = typeNode.members.find(\n (member) => isIndexSignatureDeclaration(member),\n );\n let additionalType: Type | undefined;\n\n if (indexMember) {\n const indexSignatureDeclaration = indexMember as IndexSignatureDeclaration;\n const indexType = ctx.resolveType(\n indexSignatureDeclaration.parameters[0]!.type as TypeNode,\n ctx.parentNode,\n ctx.context,\n );\n\n if (!isStringType(indexType)) {\n throw new ResolverError('Only string indexes are supported.', typeNode);\n }\n\n additionalType = ctx.resolveType(\n indexSignatureDeclaration.type,\n ctx.parentNode,\n ctx.context,\n );\n }\n\n return {\n additionalProperties: indexMember && additionalType,\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties,\n } as NestedObjectLiteralType;\n}\n\nfunction getNodeFormat(\n node: PropertySignature | PropertyDeclaration | ParameterDeclaration,\n) {\n return getJSDocTagComment(node, JSDocTagName.FORMAT);\n}\n\nfunction getPropertyName(node: PropertySignature): string {\n if (isIdentifier(node.name)) {\n return node.name.text;\n }\n\n if (isStringLiteral(node.name) || isNumericLiteral(node.name)) {\n return node.name.text;\n }\n\n return node.name.getText();\n}\n","/*\n * Copyright (c) 2025-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node, TypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport {\n NumericKind,\n TypeName,\n namesForMarker,\n numericMarkerKind,\n tagsForMarker,\n} from '@trapi/core';\nimport type { \n NeverType, \n PrimitiveType, \n Registry, \n ResolverMarker, \n VoidType, \n} from '@trapi/core';\nimport { hasDecoratorNamed } from '../../../decorator';\nimport { getJSDocTagNames } from '../../js-doc';\n\nconst NUMERIC_KIND_TO_TYPE_NAME: Record<string, string> = {\n [NumericKind.Int]: TypeName.INTEGER,\n [NumericKind.Long]: TypeName.LONG,\n [NumericKind.Float]: TypeName.FLOAT,\n [NumericKind.Double]: TypeName.DOUBLE,\n};\n\nexport class PrimitiveResolver {\n protected registry: Registry;\n\n constructor(registry: Registry) {\n this.registry = registry;\n }\n\n resolve(node: TypeNode, parentNode?: Node) : PrimitiveType | NeverType | VoidType | undefined {\n const resolved = this.resolveSyntaxKind(node.kind);\n if (resolved) {\n if (resolved === 'string') {\n return { typeName: TypeName.STRING };\n }\n\n if (resolved === 'void') {\n return { typeName: TypeName.VOID };\n }\n\n if (resolved === 'boolean') {\n return { typeName: TypeName.BOOLEAN };\n }\n\n if (resolved === 'undefined') {\n return { typeName: TypeName.UNDEFINED };\n }\n\n if (resolved === 'null') {\n // todo: check\n return undefined;\n }\n\n if (resolved === 'never') {\n return { typeName: TypeName.NEVER };\n }\n\n if (resolved === 'bigint') {\n return { typeName: TypeName.BIGINT };\n }\n\n if (resolved === 'number') {\n if (!parentNode) {\n return { typeName: TypeName.DOUBLE };\n }\n\n // For each numeric kind: check decorator handlers first (preset\n // may rename `@IsInt`), then JSDoc handlers (preset may rename\n // `@isInt`). Both lookups use the registry markers.\n const presentJsDocTags = new Set(\n getJSDocTagNames(parentNode).map((tag) => tag.toLowerCase()),\n );\n for (const kind of [NumericKind.Int, NumericKind.Long, NumericKind.Float, NumericKind.Double] as const) {\n const matchKind = (m: ResolverMarker) => numericMarkerKind(m) === kind;\n\n const decoratorNames = namesForMarker(this.registry, matchKind);\n for (const name of decoratorNames) {\n if (hasDecoratorNamed(parentNode, name)) {\n return { typeName: NUMERIC_KIND_TO_TYPE_NAME[kind] } as PrimitiveType;\n }\n }\n\n const jsDocTags = tagsForMarker(this.registry, matchKind);\n for (const tag of jsDocTags) {\n if (presentJsDocTags.has(tag.toLowerCase())) {\n return { typeName: NUMERIC_KIND_TO_TYPE_NAME[kind] } as PrimitiveType;\n }\n }\n }\n\n return { typeName: TypeName.DOUBLE };\n }\n }\n\n return undefined;\n }\n\n resolveSyntaxKind(syntaxKind: SyntaxKind) {\n switch (syntaxKind) {\n case SyntaxKind.StringKeyword:\n return 'string';\n case SyntaxKind.BooleanKeyword:\n return 'boolean';\n case SyntaxKind.VoidKeyword:\n return 'void';\n case SyntaxKind.UndefinedKeyword:\n return 'undefined';\n case SyntaxKind.NullKeyword:\n return 'null';\n case SyntaxKind.NumberKeyword:\n return 'number';\n case SyntaxKind.BigIntKeyword:\n return 'bigint';\n case SyntaxKind.NeverKeyword:\n return 'never';\n default:\n return undefined;\n }\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EnumDeclaration, EnumMember, TypeChecker } from 'typescript';\nimport { JSDocTagName, hasJSDocTag } from '../../js-doc';\nimport { TypeName } from '@trapi/core';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type {\n RefEnumType,\n RefObjectType,\n ReferenceType,\n Type,\n} from '@trapi/core';\nimport { getNodeDescription } from '../utils';\nimport { ResolverBase } from './base';\n\nexport class ReferenceResolver extends ResolverBase {\n protected typeChecker : TypeChecker;\n\n constructor(typeChecker: TypeChecker) {\n super();\n\n this.typeChecker = typeChecker;\n }\n\n public merge(referenceTypes: ReferenceType[]): ReferenceType {\n if (referenceTypes.length === 1) {\n return referenceTypes[0]!;\n }\n\n if (referenceTypes.every((refType) => refType.refName === TypeName.REF_ENUM)) {\n return this.mergeManyRefEnums(referenceTypes as RefEnumType[]);\n }\n\n if (referenceTypes.every((refType) => refType.refName === TypeName.REF_OBJECT)) {\n return this.mergeManyRefObjects(referenceTypes as RefObjectType[]);\n }\n\n throw new ResolverError(\n `These resolved type merge rules are not defined: ${JSON.stringify(referenceTypes)}`,\n );\n }\n\n public mergeManyRefEnums(many: RefEnumType[]): RefEnumType {\n let merged = this.mergeRefEnums(many[0]!, many[1]!);\n for (let i = 2; i < many.length; ++i) {\n merged = this.mergeRefEnums(merged, many[i]!);\n }\n\n return merged;\n }\n\n public mergeRefEnums(first: RefEnumType, second: RefEnumType): RefEnumType {\n let description : string | undefined;\n if (first.description || second.description) {\n if (!first.description) {\n description = second.description;\n } else if (!second.description) {\n description = first.description;\n } else {\n description = `${first.description}\\n${second.description}`;\n }\n }\n\n return {\n typeName: TypeName.REF_ENUM,\n example: first.example || second.example,\n description,\n members: [\n ...(first.members || []),\n ...(second.members || []),\n ],\n memberNames: [\n ...(first.memberNames || []),\n ...(second.memberNames || []),\n ],\n refName: first.refName,\n deprecated: first.deprecated || second.deprecated,\n };\n }\n\n public mergeManyRefObjects(many: RefObjectType[]) {\n let merged = this.mergeRefObject(many[0]!, many[1]!);\n for (let i = 2; i < many.length; ++i) {\n merged = this.mergeRefObject(merged, many[i]!);\n }\n return merged;\n }\n\n public mergeRefObject(first: RefObjectType, second: RefObjectType) : RefObjectType {\n let description : string | undefined;\n if (first.description || second.description) {\n if (!first.description) {\n description = second.description;\n } else if (!second.description) {\n description = first.description;\n } else {\n description = `${first.description}\\n${second.description}`;\n }\n }\n\n const properties = [\n ...first.properties,\n ...second.properties.filter((prop) => first.properties.every((firstProp) => firstProp.name !== prop.name)),\n ];\n\n let additionalProperties : Type | undefined;\n if (first.additionalProperties || second.additionalProperties) {\n if (!first.additionalProperties) {\n additionalProperties = second.additionalProperties;\n } else if (!second.additionalProperties) {\n additionalProperties = first.additionalProperties;\n } else {\n additionalProperties = {\n typeName: TypeName.UNION,\n members: [first.additionalProperties, second.additionalProperties],\n };\n }\n }\n\n return {\n typeName: TypeName.REF_OBJECT,\n description,\n properties,\n additionalProperties,\n refName: first.refName,\n deprecated: first.deprecated || second.deprecated,\n example: first.example || second.example,\n };\n }\n\n transformEnum(declaration: EnumDeclaration, enumName: string) : RefEnumType {\n const isNotUndefined = <T>(item: T): item is Exclude<T, undefined> => item !== undefined;\n\n const enums = declaration.members.map(this.typeChecker.getConstantValue.bind(this.typeChecker)).filter(isNotUndefined);\n const enumNames = declaration.members.map((e) => e.name.getText()).filter(isNotUndefined);\n\n return {\n typeName: TypeName.REF_ENUM,\n description: getNodeDescription(declaration, this.typeChecker),\n members: enums as string[],\n memberNames: enumNames,\n refName: enumName,\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n };\n }\n\n transformEnumMember(declaration: EnumMember, enumName: string) : RefEnumType {\n return {\n typeName: TypeName.REF_ENUM,\n refName: enumName,\n members: [this.typeChecker.getConstantValue(declaration)!],\n memberNames: [declaration.name.getText()],\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n };\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isNamedTupleMember, isTupleTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { TupleType, Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveTupleType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTupleTypeNode(typeNode)) {\n return undefined;\n }\n\n const elements = typeNode.elements.map((element) => {\n const isNamed = isNamedTupleMember(element);\n const actualType = isNamed ? element.type : element;\n return {\n type: ctx.resolveType(actualType, ctx.parentNode, ctx.context),\n ...(isNamed && { name: element.name.text }),\n };\n });\n\n return {\n typeName: TypeName.TUPLE,\n elements,\n } as TupleType;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { NodeBuilderFlags, SyntaxKind, isTypeOperatorNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { ResolverError } from '../../../../core/error/resolver';\nimport type { Type } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\nimport { toTypeNodeOrFail } from '../utils';\n\nexport function resolveTypeOperatorType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isTypeOperatorNode(typeNode)) {\n return undefined;\n }\n\n if (typeNode.operator === SyntaxKind.KeyOfKeyword) {\n const type = ctx.typeChecker.getTypeFromTypeNode(typeNode);\n try {\n return ctx.resolveType(\n toTypeNodeOrFail(ctx.typeChecker, type, undefined, NodeBuilderFlags.NoTruncation),\n typeNode,\n ctx.context,\n ctx.referencer,\n );\n } catch (err) {\n const indexedTypeName = ctx.typeChecker.typeToString(\n ctx.typeChecker.getTypeFromTypeNode(typeNode.type),\n );\n throw new ResolverError(\n `Could not determine the keys on ${indexedTypeName}`,\n typeNode,\n { cause: err },\n );\n }\n }\n\n if (typeNode.operator === SyntaxKind.ReadonlyKeyword) {\n return ctx.resolveType(typeNode.type, typeNode, ctx.context, ctx.referencer);\n }\n\n return undefined;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isUnionTypeNode } from 'typescript';\nimport type { TypeNode } from 'typescript';\nimport { TypeName } from '@trapi/core';\nimport type { Type, UnionType } from '@trapi/core';\nimport type { SubResolverContext } from '../types';\n\nexport function resolveUnionType(\n typeNode: TypeNode,\n ctx: SubResolverContext,\n): Type | undefined {\n if (!isUnionTypeNode(typeNode)) {\n return undefined;\n }\n\n const members = typeNode.types.map(\n (type) => ctx.resolveType(type, ctx.parentNode, ctx.context),\n );\n\n return {\n typeName: TypeName.UNION,\n members,\n } as UnionType;\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n NodeBuilderFlags,\n SymbolFlags,\n SyntaxKind,\n isConditionalTypeNode,\n isConstructorDeclaration,\n isEnumDeclaration,\n isEnumMember,\n isExpressionWithTypeArguments,\n isIdentifier,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isMethodDeclaration,\n isMethodSignature,\n isPropertySignature,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n} from 'typescript';\nimport type {\n ClassDeclaration,\n ClassElement,\n ConstructorDeclaration,\n Declaration,\n EntityName,\n EnumDeclaration,\n EnumMember,\n ExpressionWithTypeArguments,\n Identifier,\n IndexSignatureDeclaration,\n InterfaceDeclaration,\n Node,\n ParameterDeclaration,\n PropertyDeclaration,\n PropertySignature,\n Symbol as TsSymbol,\n TypeAliasDeclaration,\n TypeElement,\n TypeNode,\n TypeReferenceNode,\n TypeReferenceType,\n} from 'typescript';\nimport {\n TypeName,\n UtilityTypeName,\n isDeprecatedMarker,\n isRefAliasType,\n isRefObjectType,\n namesForMarker,\n tagsForMarker,\n} from '@trapi/core';\nimport type {\n BufferType,\n DateTimeType,\n DateType,\n Extension,\n NestedObjectLiteralType,\n ReferenceType,\n ResolverProperty,\n Type,\n} from '@trapi/core';\nimport { hasDecoratorNamed } from '../../decorator';\nimport type { IReferenceTypeRegistry, IResolverContext } from '../../../core/metadata/types';\nimport {\n JSDocTagName,\n getJSDocTagComment,\n getJSDocTagNames,\n hasJSDocTag,\n} from '../js-doc';\nimport { getDeclarationValidators } from '../validator';\nimport { getInitializerValue } from '../initializer';\nimport { ResolverError } from '../../../core/error/resolver';\nimport { getNodeExtensions } from './extension';\nimport {\n PrimitiveResolver,\n ReferenceResolver,\n ResolverBase,\n resolveArrayType,\n resolveIndexedAccessType,\n resolveIntersectionType,\n resolveLiteralType,\n resolveMappedType,\n resolveObjectLiteralType,\n resolveTupleType,\n resolveTypeOperatorType,\n resolveUnionType,\n} from './sub';\nimport { getLiteralValue } from './sub/literal';\nimport type {\n OverrideToken,\n SubResolverContext,\n TypeNodeResolverContext,\n UsableDeclaration,\n} from './types';\nimport { getNodeDescription } from './utils';\n\nexport class TypeNodeResolver extends ResolverBase {\n private static readonly MAX_DEPTH = 50;\n\n private readonly typeNode : TypeNode;\n\n private readonly current: IResolverContext & IReferenceTypeRegistry;\n\n private readonly parentNode?: Node;\n\n private context: TypeNodeResolverContext;\n\n private readonly referencer : TypeNode | undefined;\n\n private readonly depth: number;\n\n private readonly primitiveResolver : PrimitiveResolver;\n\n private readonly referenceResolver : ReferenceResolver;\n\n constructor(\n typeNode: TypeNode,\n current: IResolverContext & IReferenceTypeRegistry,\n parentNode?: Node,\n context?: TypeNodeResolverContext,\n referencer?: TypeNode,\n depth?: number,\n ) {\n super();\n\n this.typeNode = typeNode;\n this.current = current;\n this.parentNode = parentNode;\n this.context = context || {};\n this.referencer = referencer;\n this.depth = depth ?? 0;\n\n this.primitiveResolver = new PrimitiveResolver(current.registry);\n this.referenceResolver = new ReferenceResolver(current.typeChecker);\n }\n\n /**\n * @deprecated Use resolverCache.clear() on the context instead.\n * Kept for backward compatibility — no-ops since cache is now instance-scoped.\n */\n public static clearCache() {\n // Cache is now instance-scoped via IResolverContext.resolverCache.\n // This method is a no-op for backward compatibility.\n }\n\n public resolve(): Type {\n if (this.depth > TypeNodeResolver.MAX_DEPTH) {\n throw new ResolverError(\n `Type resolution exceeded maximum depth of ${TypeNodeResolver.MAX_DEPTH}. This usually indicates deeply nested or circular generics.`,\n this.typeNode,\n );\n }\n\n const ctx = this.createSubResolverContext();\n\n const result = this.primitiveResolver.resolve(this.typeNode, this.parentNode) ??\n resolveLiteralType(this.typeNode, ctx) ??\n resolveArrayType(this.typeNode, ctx) ??\n resolveUnionType(this.typeNode, ctx) ??\n resolveIntersectionType(this.typeNode, ctx) ??\n resolveObjectLiteralType(this.typeNode, ctx) ??\n resolveTupleType(this.typeNode, ctx) ??\n resolveMappedType(this.typeNode, ctx) ??\n this.resolveConditionalType() ??\n resolveTypeOperatorType(this.typeNode, ctx) ??\n resolveIndexedAccessType(this.typeNode, ctx) ??\n this.resolveTypeReference();\n\n if (!result) {\n this.throwUnknownType();\n }\n\n return result;\n }\n\n private createSubResolverContext(): SubResolverContext {\n return {\n typeChecker: this.current.typeChecker,\n current: this.current,\n parentNode: this.parentNode,\n context: this.context,\n referencer: this.referencer,\n resolveType: (typeNode, parentNode, context, referencer) => (\n this.resolveNestedType(typeNode, parentNode, context, referencer)\n ),\n propertyFromSignature: (sig, overrideToken) => this.propertyFromSignature(sig, overrideToken),\n propertyFromDeclaration: (decl, overrideToken) => (\n this.propertyFromDeclaration(decl, overrideToken)\n ),\n getNodeDescription: (node) => this.getNodeDescription(node),\n getNodeExample: (node) => this.getNodeExample(node),\n getNodeExtensions: (node) => this.getNodeExtensions(node),\n };\n }\n\n private resolveNestedType(\n typeNode: TypeNode,\n parentNode?: Node,\n context?: TypeNodeResolverContext,\n referencer?: TypeNode,\n ): Type {\n return new TypeNodeResolver(\n typeNode,\n this.current,\n parentNode,\n context,\n referencer,\n this.depth + 1,\n ).resolve();\n }\n\n private throwUnknownType(): never {\n throw new ResolverError(`Unknown type: ${SyntaxKind[this.typeNode.kind]}`, this.typeNode);\n }\n\n // ------------------------------------------------------------------\n // Conditional type resolution (kept inline — deeply coupled to reference handling)\n // ------------------------------------------------------------------\n\n private resolveConditionalType(): Type | undefined {\n if (!isConditionalTypeNode(this.typeNode)) {\n return undefined;\n }\n\n // When inside a generic type alias (context has entries) and we\n // have a usage-site node (referencer), resolve via the referencer\n // so the checker evaluates with concrete type arguments (#782).\n if (Object.keys(this.context).length > 0 && this.referencer) {\n return this.resolveTypeViaChecker(this.referencer);\n }\n\n // Delegate conditional type evaluation to the TypeScript type\n // checker. The checker can evaluate any conditional directly,\n // including complex patterns like `typeof globalThis extends\n // { onmessage: any } ? {} : X` from @types/node (#753).\n return this.resolveTypeViaChecker(this.typeNode);\n }\n\n // ------------------------------------------------------------------\n // Type reference resolution (kept inline — deeply coupled to caching/utility types)\n // ------------------------------------------------------------------\n\n private resolveTypeReference(): Type | undefined {\n if (this.typeNode.kind !== SyntaxKind.TypeReference) {\n return undefined;\n }\n\n const typeReference = this.typeNode as TypeReferenceNode;\n\n if (typeReference.typeName.kind === SyntaxKind.Identifier) {\n if (\n typeReference.typeName.text === 'Record' &&\n typeReference.typeArguments &&\n typeReference.typeArguments[1]\n ) {\n return {\n additionalProperties: this.resolveNestedType(\n typeReference.typeArguments[1],\n this.parentNode,\n this.context,\n ),\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties: [],\n } as NestedObjectLiteralType;\n }\n\n const specialReference = TypeNodeResolver.resolveSpecialReference(typeReference.typeName);\n if (typeof specialReference !== 'undefined') {\n return specialReference;\n }\n\n if (typeReference.typeName.text === 'Date') {\n return this.getDateType(this.parentNode);\n }\n\n if (\n typeReference.typeName.text === 'Buffer' ||\n typeReference.typeName.text === 'Readable'\n ) {\n return { typeName: TypeName.BUFFER };\n }\n\n if (\n typeReference.typeName.text === 'Array' &&\n typeReference.typeArguments?.[0]\n ) {\n return {\n typeName: TypeName.ARRAY,\n elementType: this.resolveNestedType(\n typeReference.typeArguments[0],\n this.parentNode,\n this.context,\n ),\n };\n }\n\n if (\n typeReference.typeName.text === 'Promise' &&\n typeReference.typeArguments?.length === 1 &&\n typeReference.typeArguments[0]\n ) {\n return this.resolveNestedType(\n typeReference.typeArguments[0],\n this.parentNode,\n this.context,\n );\n }\n\n if (typeReference.typeName.text === 'String') {\n return { typeName: TypeName.STRING };\n }\n\n const contextual = this.context[typeReference.typeName.text];\n if (contextual) {\n return this.resolveNestedType(\n contextual,\n this.parentNode,\n this.context,\n );\n }\n\n if (TypeNodeResolver.isCheckerResolvableUtilityType(typeReference.typeName.text)) {\n return this.resolveUtilityTypeViaChecker(typeReference);\n }\n }\n\n try {\n const referenceType = this.getReferenceType(typeReference);\n\n this.current.addReferenceType(referenceType);\n return referenceType;\n } catch (err) {\n // When the model declaration walker fails (e.g. for global types\n // like Headers, Request, Response from @types/node that use\n // complex declaration patterns — #753), fall back to the checker.\n // If the checker also fails, re-throw the original error.\n try {\n return this.resolveTypeViaChecker(typeReference);\n } catch {\n throw err;\n }\n }\n }\n\n // ------------------------------------------------------------------------\n // Utility Type(s)\n // ------------------------------------------------------------------------\n\n private static readonly CHECKER_RESOLVABLE_UTILITY_TYPES: ReadonlySet<string> = new Set([\n UtilityTypeName.NON_NULLABLE,\n UtilityTypeName.OMIT,\n UtilityTypeName.PARTIAL,\n UtilityTypeName.READONLY,\n UtilityTypeName.REQUIRED,\n UtilityTypeName.PICK,\n UtilityTypeName.EXTRACT,\n UtilityTypeName.EXCLUDE,\n UtilityTypeName.RETURN_TYPE,\n UtilityTypeName.PARAMETERS,\n UtilityTypeName.AWAITED,\n UtilityTypeName.INSTANCE_TYPE,\n UtilityTypeName.CONSTRUCTOR_PARAMETERS,\n ]);\n\n private static isCheckerResolvableUtilityType(name: string): boolean {\n return TypeNodeResolver.CHECKER_RESOLVABLE_UTILITY_TYPES.has(name);\n }\n\n private resolveUtilityTypeViaChecker(typeReference: TypeReferenceNode): Type {\n // When type arguments reference unbound type parameters from our\n // context (e.g. `Awaited<T>` inside `type Box<T> = Awaited<T>`),\n // the checker can't resolve them from the declaration-site node.\n // Use the referencer (usage-site node like `Box<Promise<Foo>>`)\n // which the checker CAN resolve with concrete type arguments.\n if (this.hasUnboundContextArgs(typeReference) && this.referencer) {\n return this.resolveTypeViaChecker(this.referencer);\n }\n\n return this.resolveTypeViaChecker(typeReference);\n }\n\n /**\n * Shared checker delegation: resolves a type node by letting the TS\n * type checker evaluate it, converting back to a TypeNode, and\n * recursively resolving the result.\n */\n private resolveTypeViaChecker(typeNode: TypeNode): Type {\n const type = this.current.typeChecker.getTypeFromTypeNode(typeNode);\n // InTypeAlias prevents the node builder from emitting type alias\n // references (which could cause circular resolution when the utility\n // type is used inside a type alias declaration).\n const resolvedTypeNode = this.current.typeChecker.typeToTypeNode(\n type,\n undefined,\n NodeBuilderFlags.NoTruncation | NodeBuilderFlags.InTypeAlias,\n );\n\n // typeToTypeNode returns undefined for some edge cases (e.g. empty\n // tuples from Parameters<> of a no-arg function). Fall back to an\n // empty tuple type.\n if (!resolvedTypeNode) {\n return { typeName: TypeName.TUPLE, elements: [] };\n }\n\n return this.resolveNestedType(\n resolvedTypeNode,\n this.parentNode,\n this.context,\n );\n }\n\n /**\n * Check if a type reference has type arguments that reference unbound\n * type parameters from this.context (e.g. `Awaited<T>` where T is a\n * generic parameter mapped in context).\n */\n private hasUnboundContextArgs(typeReference: TypeReferenceNode): boolean {\n if (!typeReference.typeArguments || Object.keys(this.context).length === 0) {\n return false;\n }\n\n return typeReference.typeArguments.some((arg) =>\n isTypeReferenceNode(arg) &&\n isIdentifier(arg.typeName) &&\n arg.typeName.text in this.context);\n }\n\n private static resolveSpecialReference(node: Identifier) : Type | undefined {\n switch (node.text) {\n case 'Buffer':\n case 'DownloadBinaryData':\n case 'DownloadResource':\n return { typeName: TypeName.BUFFER } as BufferType;\n default:\n return undefined;\n }\n }\n\n private getDateType(parentNode?: Node): DateType | DateTimeType {\n if (!parentNode) {\n return { typeName: TypeName.DATETIME };\n }\n const tags = getJSDocTagNames(parentNode).filter((name) => ['isDate', 'isDateTime'].includes(name));\n\n if (tags.length === 0) {\n return { typeName: TypeName.DATETIME };\n }\n\n switch (tags[0]) {\n case 'isDate':\n return { typeName: TypeName.DATE };\n default:\n return { typeName: TypeName.DATETIME };\n }\n }\n\n private static getDesignatedModels<T extends Node>(nodes: T[], _typeName: string): T[] {\n return nodes;\n }\n\n private getReferenceType(node: TypeReferenceType): ReferenceType {\n let type: EntityName;\n if (isTypeReferenceNode(node)) {\n type = node.typeName;\n } else if (isExpressionWithTypeArguments(node)) {\n type = node.expression as EntityName;\n } else {\n throw new ResolverError('Can\\'t resolve reference type.');\n }\n\n // Can't invoke getText on Synthetic Nodes\n let resolvableName = node.pos !== -1 ? node.getText() : (type as Identifier).text;\n if (node.pos === -1 && 'typeArguments' in node && Array.isArray(node.typeArguments)) {\n // Add typeArguments for Synthetic nodes (e.g. Record<> in TestClassModel.indexedResponse)\n const argumentsString = node.typeArguments\n .map((arg) => {\n if (isLiteralTypeNode(arg)) {\n return `'${String(getLiteralValue(arg))}'`;\n }\n const resolvedType = this.primitiveResolver.resolveSyntaxKind(arg.kind);\n if (\n typeof resolvedType === 'undefined'\n ) { return 'any'; }\n return resolvedType;\n });\n\n resolvableName += `<${argumentsString.join(', ')}>`;\n }\n\n const name = this.contextualizedName(resolvableName);\n\n this.typeArgumentsToContext(node, type, this.context);\n\n try {\n const existingType = this.current.resolverCache.getCachedType(name);\n if (existingType) {\n return existingType;\n }\n\n if (this.current.resolverCache.isInProgress(name)) {\n return this.createCircularDependencyResolver(name);\n }\n\n this.current.resolverCache.markInProgress(name);\n\n try {\n const refName = TypeNodeResolver.getRefTypeName(name);\n const declarations = this.getModelTypeDeclarations(type);\n const referenceTypes: ReferenceType[] = [];\n for (const declaration of declarations) {\n if (isTypeAliasDeclaration(declaration)) {\n referenceTypes.push(\n this.getTypeAliasReference(\n declaration,\n name,\n node,\n ),\n );\n } else if (isEnumDeclaration(declaration)) {\n referenceTypes.push(this.referenceResolver.transformEnum(declaration, refName));\n } else if (isEnumMember(declaration)) {\n referenceTypes.push(this.referenceResolver.transformEnumMember(declaration, refName));\n } else {\n // todo: dont cast handle property-signature\n referenceTypes.push(\n this.getModelReference(\n declaration as InterfaceDeclaration,\n name,\n ),\n );\n }\n }\n\n const referenceType = this.referenceResolver.merge(referenceTypes);\n\n this.current.resolverCache.setCachedType(name, referenceType);\n return referenceType;\n } finally {\n this.current.resolverCache.clearInProgress(name);\n }\n } catch (err) {\n throw new ResolverError(\n `There was a problem resolving type of '${name}'.`,\n node,\n { cause: err },\n );\n }\n }\n\n private getTypeAliasReference(\n declaration: TypeAliasDeclaration,\n name: string,\n referencer: TypeReferenceType,\n ): ReferenceType {\n const refName = TypeNodeResolver.getRefTypeName(name);\n\n if (declaration.type.kind === SyntaxKind.TypeReference) {\n const innerRef = declaration.type as TypeReferenceNode;\n // Record<K,V> and checker-resolvable utility types (Pick, Omit, etc.)\n // should not go through getReferenceType — resolveNestedType handles\n // them correctly via resolveTypeReference.\n const innerName = isIdentifier(innerRef.typeName) ? innerRef.typeName.text : undefined;\n const skipReferenceType = innerName === UtilityTypeName.RECORD ||\n (innerName !== undefined && TypeNodeResolver.isCheckerResolvableUtilityType(innerName));\n\n if (!skipReferenceType) {\n const referenceType = this.getReferenceType(innerRef);\n if (referenceType.refName === refName) {\n return referenceType;\n }\n }\n }\n\n const type = this.resolveNestedType(\n declaration.type,\n declaration,\n this.context,\n this.referencer || referencer,\n );\n\n const example = this.getNodeExample(declaration);\n\n return {\n typeName: TypeName.REF_ALIAS,\n default: getJSDocTagComment(declaration, JSDocTagName.DEFAULT),\n description: this.getNodeDescription(declaration),\n refName,\n format: TypeNodeResolver.getNodeFormat(declaration),\n type,\n validators: getDeclarationValidators(declaration) || {},\n deprecated: hasJSDocTag(declaration, JSDocTagName.DEPRECATED),\n ...(example && { example }),\n };\n }\n\n private getModelReference(\n modelType: InterfaceDeclaration | ClassDeclaration,\n name: string,\n ) : ReferenceType {\n const example = this.getNodeExample(modelType);\n const description = this.getNodeDescription(modelType);\n const deprecatedDecoratorNames = namesForMarker(this.current.registry, isDeprecatedMarker);\n const deprecatedJsDocTags = tagsForMarker(this.current.registry, isDeprecatedMarker);\n const deprecated : boolean = [...deprecatedJsDocTags].some((tag) => hasJSDocTag(modelType, tag)) ||\n [...deprecatedDecoratorNames].some((name) => hasDecoratorNamed(modelType, name));\n\n // Handle toJSON methods\n if (!modelType.name) {\n throw new ResolverError('Can\\'t get Symbol from anonymous class', modelType);\n }\n const type = this.current.typeChecker.getTypeAtLocation(modelType.name);\n const toJSON = this.current.typeChecker.getPropertyOfType(type, 'toJSON');\n if (\n toJSON &&\n toJSON.valueDeclaration &&\n (\n isMethodDeclaration(toJSON.valueDeclaration) ||\n isMethodSignature(toJSON.valueDeclaration)\n )\n ) {\n let nodeType = toJSON.valueDeclaration.type;\n if (!nodeType) {\n const signature = this.current.typeChecker.getSignatureFromDeclaration(toJSON.valueDeclaration);\n if (signature) {\n const implicitType = this.current.typeChecker.getReturnTypeOfSignature(signature);\n nodeType = this.current.typeChecker.typeToTypeNode(implicitType, undefined, NodeBuilderFlags.NoTruncation) as TypeNode;\n } else {\n throw new ResolverError('Can\\'t get signature from toJson value declaration', modelType);\n }\n }\n\n return {\n refName: `${TypeNodeResolver.getRefTypeName(name)}Alias`,\n typeName: TypeName.REF_ALIAS,\n description,\n type: this.resolveNestedType(nodeType),\n deprecated,\n validators: {},\n ...(example && { example }),\n };\n }\n\n const properties = this.getModelProperties(modelType);\n const additionalProperties = this.getModelAdditionalProperties(modelType);\n const inheritedProperties = this.getModelInheritedProperties(modelType) || [];\n\n const referenceType: ReferenceType & { properties: ResolverProperty[] } = {\n additionalProperties,\n typeName: TypeName.REF_OBJECT,\n description,\n properties: inheritedProperties,\n refName: TypeNodeResolver.getRefTypeName(name),\n deprecated,\n ...(example && { example }),\n };\n\n referenceType.properties = referenceType.properties.concat(properties);\n\n return referenceType;\n }\n\n private static getRefTypeName(name: string): string {\n const sanitized = name\n // Structural characters → temporary placeholders\n .replace(/[<>]/g, '_')\n .replace(/[{}]/g, '_')\n .replace(/\\s+/g, '')\n // Delimiter characters → semantic names\n .replace(/,/g, '.')\n .replace(/'([^']*)'/g, '$1')\n .replace(/\"([^\"]*)\"/g, '$1')\n .replace(/&/g, '-and-')\n .replace(/\\|/g, '-or-')\n .replace(/\\[\\]/g, '-array')\n .replace(/([a-z]+):([a-z]+)/gi, '$1-$2')\n .replace(/;/g, '--')\n .replace(/([a-z]+)\\[([a-z]+)]/gi, '$1-at-$2')\n // Strip temporary placeholders (keep hyphens for semantic separators)\n .replace(/_/g, '');\n\n return encodeURIComponent(sanitized);\n }\n\n private contextualizedName(name: string): string {\n return Object.entries(\n this.context,\n ).reduce((acc, [key, entry]) => acc\n .replace(new RegExp(`<\\\\s*([^>]*\\\\s)*\\\\s*(${key})(\\\\s[^>]*)*\\\\s*>`, 'g'), `<$1${entry.getText()}$3>`)\n .replace(new RegExp(`<\\\\s*([^,]*\\\\s)*\\\\s*(${key})(\\\\s[^,]*)*\\\\s*,`, 'g'), `<$1${entry.getText()}$3,`)\n .replace(new RegExp(`,\\\\s*([^>]*\\\\s)*\\\\s*(${key})(\\\\s[^>]*)*\\\\s*>`, 'g'), `,$1${entry.getText()}$3>`)\n .replace(new RegExp(`<\\\\s*([^<]*\\\\s)*\\\\s*(${key})(\\\\s[^<]*)*\\\\s*<`, 'g'), `<$1${entry.getText()}$3<`), name);\n }\n\n private createCircularDependencyResolver(refName: string) {\n const referenceType : ReferenceType = {\n deprecated: false,\n properties: [],\n typeName: TypeName.REF_OBJECT,\n refName,\n };\n\n this.current.registerDependencyResolver((referenceTypes) => {\n const realReferenceType : ReferenceType | undefined = referenceTypes[refName];\n if (!realReferenceType) {\n return;\n }\n\n referenceType.description = realReferenceType.description;\n if (realReferenceType.typeName === 'refObject' && referenceType.typeName === 'refObject') {\n referenceType.properties = realReferenceType.properties;\n }\n referenceType.typeName = realReferenceType.typeName as `${TypeName.REF_OBJECT}`;\n referenceType.refName = realReferenceType.refName;\n });\n\n return referenceType;\n }\n\n private static nodeIsUsable(node: Node) : node is UsableDeclaration {\n switch (node.kind) {\n case SyntaxKind.InterfaceDeclaration:\n case SyntaxKind.ClassDeclaration:\n case SyntaxKind.TypeAliasDeclaration:\n case SyntaxKind.EnumDeclaration:\n case SyntaxKind.EnumMember:\n return true;\n default:\n return false;\n }\n }\n\n private getModelTypeDeclarations(type: EntityName) {\n let typeName = type.kind === SyntaxKind.Identifier ? type.text : type.right.text;\n\n let symbol : TsSymbol | undefined = this.getSymbolAtLocation(type);\n if (!symbol && type.kind === SyntaxKind.QualifiedName) {\n const fullEnumSymbol = this.getSymbolAtLocation(type.left);\n symbol = fullEnumSymbol.exports?.get(typeName as any);\n }\n\n if (!symbol) {\n throw new ResolverError(\n `No symbol found for referenced type ${typeName}.`,\n );\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n throw new ResolverError(\n `No declarations found for referenced type ${typeName}.`,\n );\n }\n\n if (symbol.escapedName !== typeName && symbol.escapedName !== 'default') {\n typeName = symbol.escapedName as string;\n }\n\n let modelTypes = declarations.filter((node) => {\n if (!TypeNodeResolver.nodeIsUsable(node) || !this.current.isExportedNode(node)) {\n return false;\n }\n\n const modelTypeDeclaration = node as UsableDeclaration;\n return (modelTypeDeclaration.name as Identifier)?.text === typeName;\n });\n\n if (!modelTypes.length) {\n throw new ResolverError(\n `No matching model found for referenced type ${typeName}. If ${typeName} comes from a dependency, please create an interface in your own code that has the same structure. The compiler can not utilize interfaces from external dependencies.`,\n );\n }\n\n if (modelTypes.length > 1) {\n // remove types that are from typescript e.g. 'Account'\n modelTypes = modelTypes.filter((modelType) => modelType.getSourceFile()\n .fileName.replace(/\\\\/g, '/').toLowerCase().indexOf('node_modules/typescript') <= -1);\n\n modelTypes = TypeNodeResolver.getDesignatedModels(modelTypes, typeName);\n }\n\n return modelTypes;\n }\n\n private getModelTypeDeclaration(type: EntityName) : UsableDeclaration {\n let typeName = type.kind === SyntaxKind.Identifier ? type.text : type.right.text;\n\n const symbol = this.getSymbolAtLocation(type);\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n throw new ResolverError(\n `No models found for referenced type ${typeName}.`,\n );\n }\n\n if (symbol.escapedName !== typeName && symbol.escapedName !== 'default') {\n typeName = symbol.escapedName as string;\n }\n\n let modelTypes = declarations.filter((node) => {\n if (!TypeNodeResolver.nodeIsUsable(node) || !this.current.isExportedNode(node)) {\n return false;\n }\n\n const modelTypeDeclaration = node as UsableDeclaration;\n return (modelTypeDeclaration.name as Identifier)?.text === typeName;\n });\n\n if (!modelTypes.length) {\n throw new ResolverError(\n `No matching model found for referenced type ${typeName}. If ${typeName} comes from a dependency, please create an interface in your own code that has the same structure. The compiler can not utilize interfaces from external dependencies.`,\n );\n }\n\n if (modelTypes.length > 1) {\n // remove types that are from typescript e.g. 'Account'\n modelTypes = modelTypes.filter((modelType) => modelType.getSourceFile()\n .fileName.replace(/\\\\/g, '/').toLowerCase().indexOf('node_modules/typescript') <= -1);\n\n modelTypes = TypeNodeResolver.getDesignatedModels(modelTypes, typeName);\n }\n if (modelTypes.length > 1) {\n const conflicts = modelTypes.map((modelType) => modelType.getSourceFile().fileName).join('\"; \"');\n throw new ResolverError(\n `Multiple matching models found for referenced type ${typeName}; please make model names unique. Conflicts found: \"${conflicts}\".`,\n );\n }\n\n return modelTypes[0] as UsableDeclaration;\n }\n\n private hasFlag(type: TsSymbol | Declaration, flag: number) {\n return (type.flags & flag) === flag;\n }\n\n private getSymbolAtLocation(type: Node) : TsSymbol {\n const symbol = this.current.typeChecker.getSymbolAtLocation(type) || ((type as any).symbol as TsSymbol);\n // resolve alias if it is an alias, otherwise take symbol directly\n return (\n symbol &&\n this.hasFlag(symbol, SymbolFlags.Alias) &&\n this.current.typeChecker.getAliasedSymbol(symbol)\n ) || symbol;\n }\n\n private getModelProperties(\n node: InterfaceDeclaration | ClassDeclaration,\n overrideToken?: OverrideToken,\n ) : ResolverProperty[] {\n const isIgnored = (e: TypeElement | ClassElement) => hasJSDocTag(e, JSDocTagName.IGNORE);\n\n // Interface model\n if (isInterfaceDeclaration(node)) {\n return node.members\n .filter(\n (member) => !isIgnored(member) &&\n isPropertySignature(member),\n ).map(\n (member) => this.propertyFromSignature(member as PropertySignature, overrideToken),\n );\n }\n\n // Class model\n const properties = node.members\n .filter((member) => !isIgnored(member) &&\n member.kind === SyntaxKind.PropertyDeclaration &&\n !this.hasStaticModifier(member) &&\n this.hasPublicModifier(member)) as Array<PropertyDeclaration | ParameterDeclaration>;\n\n const classConstructor = node.members.find(\n (member) => isConstructorDeclaration(member),\n ) as ConstructorDeclaration;\n\n if (classConstructor && classConstructor.parameters) {\n const constructorProperties = classConstructor.parameters.filter((parameter) => this.isAccessibleParameter(parameter));\n\n properties.push(...constructorProperties);\n }\n\n return properties.map((property) => this.propertyFromDeclaration(property, overrideToken));\n }\n\n private propertyFromSignature(propertySignature: PropertySignature, overrideToken?: OverrideToken) {\n const identifier = propertySignature.name as Identifier;\n\n if (!propertySignature.type) {\n throw new ResolverError('No valid type found for property declaration.');\n }\n\n let required = !propertySignature.questionToken;\n if (overrideToken && overrideToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (overrideToken && overrideToken.kind === SyntaxKind.QuestionToken) {\n required = false;\n }\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertySignature, JSDocTagName.DEPRECATED),\n default: getJSDocTagComment(propertySignature, JSDocTagName.DEFAULT),\n description: this.getNodeDescription(propertySignature),\n example: this.getNodeExample(propertySignature),\n extensions: this.getNodeExtensions(propertySignature),\n format: TypeNodeResolver.getNodeFormat(propertySignature),\n name: identifier.text,\n required,\n type: this.resolveNestedType(\n propertySignature.type,\n propertySignature.type.parent,\n this.context,\n propertySignature.type,\n ),\n validators: getDeclarationValidators(propertySignature) || {},\n };\n return property;\n }\n\n private propertyFromDeclaration(\n propertyDeclaration: PropertyDeclaration | ParameterDeclaration,\n overrideToken?: OverrideToken,\n ) {\n const identifier = propertyDeclaration.name as Identifier;\n let typeNode = propertyDeclaration.type;\n\n if (!typeNode) {\n const tsType = this.current.typeChecker.getTypeAtLocation(propertyDeclaration);\n typeNode = this.current.typeChecker.typeToTypeNode(tsType, undefined, NodeBuilderFlags.NoTruncation);\n }\n\n if (!typeNode) {\n throw new ResolverError('No valid type found for property declaration.');\n }\n\n const type = this.resolveNestedType(typeNode, propertyDeclaration, this.context, typeNode);\n\n let required = !propertyDeclaration.questionToken && !propertyDeclaration.initializer;\n if (overrideToken && overrideToken.kind === SyntaxKind.MinusToken) {\n required = true;\n } else if (overrideToken && overrideToken.kind === SyntaxKind.QuestionToken) {\n required = false;\n }\n\n const property: ResolverProperty = {\n deprecated: hasJSDocTag(propertyDeclaration, JSDocTagName.DEPRECATED),\n default: getInitializerValue(propertyDeclaration.initializer, this.current.typeChecker),\n description: this.getNodeDescription(propertyDeclaration),\n example: this.getNodeExample(propertyDeclaration),\n extensions: this.getNodeExtensions(propertyDeclaration),\n format: TypeNodeResolver.getNodeFormat(propertyDeclaration),\n name: identifier.text,\n required,\n type,\n validators: getDeclarationValidators(propertyDeclaration) || {},\n };\n return property;\n }\n\n private getModelAdditionalProperties(node: UsableDeclaration) {\n if (node.kind === SyntaxKind.InterfaceDeclaration) {\n const indexMember = node.members.find((member) => member.kind === SyntaxKind.IndexSignature);\n if (!indexMember) {\n return undefined;\n }\n\n const indexSignatureDeclaration = indexMember as IndexSignatureDeclaration;\n const indexType = this.resolveNestedType(\n indexSignatureDeclaration.parameters[0]!.type as TypeNode,\n this.parentNode,\n this.context,\n );\n\n if (indexType.typeName !== 'string') {\n throw new ResolverError('Only string indexers are supported.', this.typeNode);\n }\n\n return this.resolveNestedType(indexSignatureDeclaration.type, this.parentNode, this.context);\n }\n\n return undefined;\n }\n\n private typeArgumentsToContext(\n type: TypeReferenceNode | ExpressionWithTypeArguments,\n targetEntity: EntityName,\n context: TypeNodeResolverContext,\n ): TypeNodeResolverContext {\n // this.context = {};\n\n const declaration = this.getModelTypeDeclaration(targetEntity);\n if (typeof declaration === 'undefined' || !('typeParameters' in declaration)) {\n return context;\n }\n\n const { typeParameters } = declaration;\n\n if (typeParameters) {\n for (const [index, typeParameter] of typeParameters.entries()) {\n const typeArg = type.typeArguments && type.typeArguments[index];\n let resolvedType: TypeNode;\n\n // Argument may be a forward reference from context\n const contextual = typeArg && isTypeReferenceNode(typeArg) && isIdentifier(typeArg.typeName) ?\n context[typeArg.typeName.text] :\n undefined;\n if (contextual) {\n resolvedType = contextual;\n } else if (typeArg) {\n resolvedType = typeArg;\n } else if (typeParameter.default) {\n resolvedType = typeParameter.default;\n } else {\n throw new ResolverError(`Could not find a value for type parameter ${typeParameter.name.text}`, type);\n }\n\n this.context = {\n ...this.context,\n [typeParameter.name.text]: resolvedType,\n };\n }\n }\n return context;\n }\n\n private getModelInheritedProperties(\n modelTypeDeclaration: Exclude<UsableDeclaration, PropertySignature | TypeAliasDeclaration | EnumMember>,\n ): ResolverProperty[] {\n let properties: ResolverProperty[] = [];\n\n const { heritageClauses } = modelTypeDeclaration;\n if (!heritageClauses) {\n return properties;\n }\n\n heritageClauses.forEach((clause) => {\n if (!clause.types) {\n return;\n }\n\n clause.types.forEach((t) => {\n const baseEntityName = t.expression as EntityName;\n\n // create subContext\n const resetCtx = this.typeArgumentsToContext(t, baseEntityName, this.context);\n\n const referenceType = this.getReferenceType(t);\n if (referenceType) {\n if (isRefAliasType(referenceType)) {\n let type: Type = referenceType;\n while (isRefAliasType(type)) {\n type = type.type;\n }\n\n if (type.typeName === TypeName.REF_OBJECT) {\n properties = [...properties, ...type.properties];\n } else if (type.typeName === TypeName.NESTED_OBJECT_LITERAL) {\n properties = [...properties, ...type.properties];\n }\n }\n\n if (isRefObjectType(referenceType)) {\n referenceType.properties.forEach((property) => properties.push(property));\n }\n }\n\n // reset subContext\n this.context = resetCtx;\n });\n });\n\n return properties;\n }\n\n private getNodeDescription(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) {\n return getNodeDescription(node, this.current.typeChecker);\n }\n\n private static getNodeFormat(\n node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration,\n ) {\n return getJSDocTagComment(node, JSDocTagName.FORMAT);\n }\n\n private getNodeExample(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) {\n const example = getJSDocTagComment(node, JSDocTagName.EXAMPLE);\n\n if (example) {\n try {\n return JSON.parse(example);\n } catch {\n return example;\n }\n }\n\n return undefined;\n }\n\n protected getNodeExtensions(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration) : Extension[] {\n return getNodeExtensions(node, this.current.registry);\n }\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { IResolverCache, ReferenceType } from '@trapi/core';\n\nexport class ResolverCache implements IResolverCache {\n private referenceTypes = new Map<string, ReferenceType>();\n\n private inProgressTypes = new Set<string>();\n\n getCachedType(name: string): ReferenceType | undefined {\n return this.referenceTypes.get(name);\n }\n\n setCachedType(name: string, type: ReferenceType): void {\n this.referenceTypes.set(name, type);\n }\n\n isInProgress(name: string): boolean {\n return this.inProgressTypes.has(name);\n }\n\n markInProgress(name: string): void {\n this.inProgressTypes.add(name);\n }\n\n clearInProgress(name: string): void {\n this.inProgressTypes.delete(name);\n }\n\n clear(): void {\n this.referenceTypes.clear();\n this.inProgressTypes.clear();\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Node } from 'typescript';\nimport {\n canHaveDecorators,\n getDecorators,\n isCallExpression,\n isNumericLiteral,\n isStringLiteral,\n} from 'typescript';\nimport type { NodeDecorator } from './types';\n\n/**\n * Get Decorators for a specific node.\n *\n * @param node\n * @param isMatching\n */\nexport function getNodeDecorators(\n node: Node,\n isMatching?: (data: NodeDecorator) => boolean,\n): NodeDecorator[] {\n if (!canHaveDecorators(node)) {\n return [];\n }\n\n const decorators = getDecorators(node);\n\n if (typeof decorators === 'undefined') {\n return [];\n }\n\n const items = decorators\n .map((d) => {\n const result: any = {\n arguments: [],\n typeArguments: [],\n };\n\n let x: any = d.expression;\n\n if (isCallExpression(x)) {\n if (x.arguments) {\n result.arguments = x.arguments.map((argument: any) => {\n if (isStringLiteral(argument) || isNumericLiteral(argument)) {\n return argument.text;\n }\n return argument;\n });\n }\n\n if (x.typeArguments) {\n result.typeArguments = x.typeArguments;\n }\n\n x = x.expression;\n }\n\n result.text = x.text || x.name.text;\n\n return result as NodeDecorator;\n });\n\n return typeof isMatching === 'undefined' ? items : items.filter(isMatching);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { LocatorInfo } from 'locter';\nimport { buildFilePath, locateMany } from 'locter';\nimport type { EntryPoint } from '../../core/config';\n\nexport async function scanSourceFiles(input: EntryPoint) : Promise<string[]> {\n const sources = Array.isArray(input) ? input : [input];\n const result: Set<string> = new Set<string>();\n\n const promises : Promise<LocatorInfo[]>[] = [];\n\n for (const source of sources) {\n if (typeof source === 'string') {\n promises.push(locateMany(source));\n } else {\n promises.push(locateMany(source.pattern, { cwd: source.cwd }));\n }\n }\n\n const groupMatches = await Promise.all(promises);\n const matches = groupMatches.flat();\n\n for (const match of matches) {\n result.add(buildFilePath(match));\n }\n\n return Array.from(result);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { read } from 'locter';\nimport { isObject } from 'smob';\nimport { ConfigErrorCode } from '../../../core/error/config-codes';\nimport { ConfigError } from '../../../core/error/config';\nimport process from 'node:process';\nimport path from 'node:path';\nimport { convertCompilerOptionsFromJson } from 'typescript';\nimport type { TsConfig, TsconfigLoadContext } from './types';\n\nexport async function loadTSConfig(\n context: TsconfigLoadContext = {},\n) : Promise<TsConfig> {\n let fileName : string;\n let filePath : string;\n const cwd = context.cwd || process.cwd();\n\n if (typeof context.name === 'string') {\n if (path.isAbsolute(context.name)) {\n filePath = context.name;\n } else {\n filePath = path.resolve(cwd, context.name);\n }\n\n fileName = path.basename(filePath);\n } else {\n fileName = 'tsconfig.json';\n filePath = path.join(cwd, fileName);\n }\n\n // read() returns the raw parsed value for data formats —\n // mutable, so compilerOptions can be reassigned below\n const content = await read(filePath);\n if (!isObject(content)) {\n throw new ConfigError({\n message: `The tsconfig file '${filePath}' is malformed.`,\n code: ConfigErrorCode.TSCONFIG_MALFORMED,\n });\n }\n\n if (typeof content.compilerOptions !== 'undefined') {\n const { options: compilerOptions } = convertCompilerOptionsFromJson(\n content.compilerOptions,\n cwd,\n fileName,\n );\n\n content.compilerOptions = compilerOptions;\n }\n\n return content;\n}\n\nexport async function softLoadTsconfig(\n context: TsconfigLoadContext = {},\n) : Promise<TsConfig> {\n try {\n return await loadTSConfig(context);\n } catch {\n return {};\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Bump whenever the on-disk cache shape changes incompatibly\n * (Metadata, Controller, Method, Parameter, resolver type nodes,\n * or the cache wrapper itself). Old cache files with a different\n * version are rejected on read.\n */\nexport const CACHE_SCHEMA_VERSION = '3';\n\nexport const CACHE_FILE_PREFIX = '.trapi-metadata-';\nexport const CACHE_FILE_SUFFIX = '.json';\n\n/** 7 days. */\nexport const CACHE_DEFAULT_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { tmpdir } from 'node:os';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\nimport process from 'node:process';\nimport type { CompilerOptions } from 'typescript';\nimport type { Registry } from '@trapi/core';\nimport { CACHE_DEFAULT_MAX_AGE_MS } from './constants';\nimport type { CacheOptions, CacheOptionsInput } from './types';\n\nexport function buildCacheOptions(input?: string | boolean | CacheOptionsInput) : CacheOptions {\n if (typeof input === 'string') {\n input = {\n enabled: true,\n directoryPath: input,\n };\n }\n\n if (typeof input === 'boolean') {\n input = { enabled: input };\n }\n\n input = input || {};\n\n let directoryPath = tmpdir();\n if (typeof input.directoryPath === 'string') {\n directoryPath = path.isAbsolute(input.directoryPath) ?\n input.directoryPath :\n path.join(process.cwd(), input.directoryPath);\n }\n\n return {\n fileName: input.fileName,\n directoryPath,\n enabled: input.enabled ?? true,\n maxAgeMs: normalizeMaxAgeMs(input.maxAgeMs),\n };\n}\n\nfunction normalizeMaxAgeMs(input: number | undefined): number {\n if (typeof input !== 'number' || !Number.isFinite(input) || input < 0) {\n // NaN, Infinity, negative, or absent → fall back to the default.\n // Only `0` (explicit disable) and positive finite values are honored.\n return CACHE_DEFAULT_MAX_AGE_MS;\n }\n return input;\n}\n\n// -----------------------------------------------------------------------------\n// Cache key composition\n// -----------------------------------------------------------------------------\n\nexport type CacheKeyParts = {\n schemaVersion: string;\n sourceFilesHash: string;\n compilerOptionsHash: string;\n registryHash: string;\n presetName?: string;\n};\n\n/**\n * Combines all key contributors into a single sha256 hex string. The order is\n * stable; each part is null-separated to avoid concatenation ambiguity.\n */\nexport function composeCacheKey(parts: CacheKeyParts): string {\n const hash = crypto.createHash('sha256');\n hash.update(parts.schemaVersion);\n hash.update('\\0');\n hash.update(parts.sourceFilesHash);\n hash.update('\\0');\n hash.update(parts.compilerOptionsHash);\n hash.update('\\0');\n hash.update(parts.registryHash);\n hash.update('\\0');\n hash.update(parts.presetName ?? '');\n return hash.digest('hex');\n}\n\n/**\n * Hash a stable JSON projection of `compilerOptions`. Sorting keys keeps the\n * output deterministic regardless of declaration order in tsconfig.json.\n */\nexport function hashCompilerOptions(options?: CompilerOptions): string {\n const hash = crypto.createHash('sha256');\n hash.update(stableStringify(options ?? {}));\n return hash.digest('hex');\n}\n\n/**\n * Hash the resolved registry's structural shape. Catches structural changes\n * (handler added/removed/renamed, marker changed, replaces policy changed)\n * AND most logic changes via `apply.toString()`. Misses changes that are\n * purely captured-variable shifts in factory-built handlers — acceptable\n * trade-off for catching local preset edits.\n */\nexport function hashRegistry(registry: Registry): string {\n const hash = crypto.createHash('sha256');\n const kinds = [\n 'controllers',\n 'methods',\n 'parameters',\n 'controllerJsDoc',\n 'methodJsDoc',\n 'parameterJsDoc',\n ] as const;\n for (const kind of kinds) {\n hash.update(kind);\n hash.update('\\0');\n const handlers = registry[kind] ?? [];\n for (const handler of handlers) {\n hash.update(stableStringify(handler.match));\n hash.update('\\0');\n hash.update(stableStringify(handler.marker ?? null));\n hash.update('\\0');\n hash.update(String(handler.replaces ?? ''));\n hash.update('\\0');\n hash.update(handler.apply.toString());\n hash.update('\\0');\n }\n hash.update('\\x01');\n }\n return hash.digest('hex');\n}\n\n/**\n * JSON.stringify with sorted object keys at every level. Functions and\n * undefined are omitted as usual; that's fine for the inputs we hash here.\n */\nfunction stableStringify(value: unknown): string {\n return JSON.stringify(value, (_key, val) => {\n if (val && typeof val === 'object' && !Array.isArray(val)) {\n const sorted: Record<string, unknown> = {};\n for (const k of Object.keys(val as Record<string, unknown>).sort()) {\n sorted[k] = (val as Record<string, unknown>)[k];\n }\n return sorted;\n }\n return val;\n });\n}\n","/*\n * Copyright (c) 2021.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { parse as parseFlatted, stringify as stringifyFlatted } from 'flatted';\nimport { buildFilePath as joinFilePath, locateMany } from 'locter';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\nimport {\n CACHE_FILE_PREFIX,\n CACHE_FILE_SUFFIX,\n CACHE_SCHEMA_VERSION,\n} from './constants';\nimport { buildCacheOptions } from './utils';\nimport type {\n CacheData,\n CacheOptions,\n CacheOptionsInput,\n ICacheClient,\n} from './types';\n\nexport class CacheClient implements ICacheClient {\n private readonly options: CacheOptions;\n\n constructor(input?: string | boolean | CacheOptionsInput) {\n this.options = buildCacheOptions(input);\n }\n\n // -------------------------------------------------------------------------\n\n async save(data: CacheData): Promise<string | undefined> {\n if (!this.options.enabled) {\n return undefined;\n }\n\n await this.ensureDirectory();\n\n const filePath = this.resolveFilePath(data.cacheKey);\n // `flatted` is cycle-safe — it encodes self-references and back-edges\n // as integer indices into a flat array. Well-formed metadata uses\n // `refName` strings for cross-references and contains no cycles, but\n // we use `flatted` defensively so a future regression cannot crash\n // serialization or silently corrupt the cached graph.\n const payload = stringifyFlatted(data);\n\n // Atomic write: rename is atomic on POSIX, so concurrent generators\n // either see the previous file or the new one — never a half-written\n // truncation.\n const tmpPath = `${filePath}.${process.pid}.${crypto.randomBytes(6).toString('hex')}.tmp`;\n\n try {\n await fs.promises.writeFile(tmpPath, payload);\n await fs.promises.rename(tmpPath, filePath);\n } catch (err) {\n // Best-effort cleanup of the temp file if rename failed.\n try {\n await fs.promises.unlink(tmpPath);\n } catch {\n // ignore\n }\n throw err;\n }\n\n // Opportunistic eviction. Errors are ignored — eviction is a\n // housekeeping concern, not a correctness one.\n this.evict().catch((): void => undefined);\n\n return filePath;\n }\n\n async get(cacheKey: string): Promise<CacheData | undefined> {\n if (!this.options.enabled) {\n return undefined;\n }\n\n const filePath = this.resolveFilePath(cacheKey);\n\n let content: string;\n try {\n content = await fs.promises.readFile(filePath, { encoding: 'utf-8' });\n } catch {\n return undefined;\n }\n\n let cache: CacheData;\n try {\n cache = parseFlatted(content) as CacheData;\n } catch {\n // Corrupt file — drop it so the next save can replace cleanly.\n await fs.promises.unlink(filePath).catch((): void => undefined);\n return undefined;\n }\n\n if (\n !cache ||\n cache.cacheKey !== cacheKey ||\n cache.schemaVersion !== CACHE_SCHEMA_VERSION\n ) {\n return undefined;\n }\n\n return cache;\n }\n\n // -------------------------------------------------------------------------\n\n /**\n * Prune cache files older than `maxAgeMs`. No-op when disabled or when\n * `maxAgeMs <= 0`. Each unlink is best-effort — a concurrent generator\n * may have already removed the file.\n */\n async evict(): Promise<void> {\n if (!this.options.enabled || this.options.maxAgeMs <= 0) {\n return;\n }\n\n const pattern = this.options.fileName ?? `${CACHE_FILE_PREFIX}*${CACHE_FILE_SUFFIX}`;\n\n let entries: Awaited<ReturnType<typeof locateMany>>;\n try {\n entries = await locateMany(pattern, { cwd: this.options.directoryPath });\n } catch {\n return;\n }\n\n const cutoff = Date.now() - this.options.maxAgeMs;\n\n await Promise.all(entries.map(async (entry) => {\n const filePath = joinFilePath(entry);\n try {\n const stat = await fs.promises.stat(filePath);\n if (stat.mtimeMs < cutoff) {\n await fs.promises.unlink(filePath);\n }\n } catch {\n // ignore — file may have been removed by another process\n }\n }));\n }\n\n // -------------------------------------------------------------------------\n\n private resolveFilePath(cacheKey: string): string {\n // The internal pipeline always passes a sha256 hex digest, but the\n // public `ICacheClient` accepts any string. Reject anything that\n // could break out of `directoryPath` via `path.join`'s normalization\n // (`../`, absolute paths, embedded separators, NUL bytes).\n if (!CACHE_KEY_PATTERN.test(cacheKey)) {\n throw new Error(`Invalid cacheKey: must match ${CACHE_KEY_PATTERN}`);\n }\n const fileName = this.options.fileName ??\n `${CACHE_FILE_PREFIX}${cacheKey}${CACHE_FILE_SUFFIX}`;\n return path.join(this.options.directoryPath, fileName);\n }\n\n private async ensureDirectory(): Promise<void> {\n // Don't memoize — the directory may be removed externally (temp\n // cleanup, another process) at any time. `mkdir(recursive: true)`\n // is a no-op when the directory already exists, so re-running it\n // on every save is cheap and self-healing.\n await fs.promises.mkdir(this.options.directoryPath, { recursive: true });\n }\n}\n\n// Hex digest from sha256 (64 chars) is the canonical caller, but allow\n// any printable ASCII without separators / dots up to a sane length so\n// custom callers (and the suffix-bearing tmp path) keep working.\nconst CACHE_KEY_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from 'smob';\nimport { NodeBuilderFlags, displayPartsToString, isIdentifier } from 'typescript';\nimport type { ParameterDeclaration } from 'typescript';\nimport {\n CollectionFormat,\n ParamKind,\n ParameterSource,\n TypeName,\n isArrayType,\n isNestedObjectLiteralType,\n isRefEnumType,\n isRefObjectType,\n isUnionType,\n newParameterDraft,\n} from '@trapi/core';\nimport type {\n ArrayParameter,\n BaseType,\n Extension,\n IParameterGenerator,\n NestedObjectLiteralType,\n Parameter,\n ParameterDraft,\n RefObjectType,\n Type,\n} from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { getInitializerValue } from '../../../adapters/typescript/initializer';\nimport { getDeclarationValidators } from '../../../adapters/typescript/validator';\nimport {\n JSDocTagName,\n getJSDocTags,\n hasJSDocTag,\n transformJSDocComment,\n} from '../../../adapters/typescript/js-doc';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport { ParameterError } from '../../../core/error/parameter';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\n\nconst BODY_SUPPORTED_METHODS = new Set(['delete', 'post', 'put', 'patch', 'get']);\n\nconst SUPPORTED_LEAF_TYPES = new Set<string>([\n TypeName.STRING,\n TypeName.INTEGER,\n TypeName.LONG,\n TypeName.FLOAT,\n TypeName.DOUBLE,\n TypeName.DATE,\n TypeName.DATETIME,\n TypeName.BUFFER,\n TypeName.BOOLEAN,\n TypeName.ENUM,\n]);\n\nexport class ParameterGenerator implements IParameterGenerator {\n private readonly parameter: ParameterDeclaration;\n\n private readonly method: string;\n\n private readonly paths: string[];\n\n private readonly current: IGeneratorContext;\n\n constructor(\n parameter: ParameterDeclaration,\n method: string,\n paths: string[],\n current: IGeneratorContext,\n ) {\n this.parameter = parameter;\n this.method = method;\n this.paths = paths.length === 0 ? [''] : paths;\n this.current = current;\n }\n\n public generate(): Parameter[] {\n const parameterName = this.getParameterName();\n const draft = newParameterDraft({ parameterName });\n\n const options = this.applyOptions(parameterName);\n applyDecoratorHandlers(this.parameter, this.current.registry.parameters, draft, options);\n applyJsDocHandlers(this.parameter, this.current.registry.parameterJsDoc, draft, options);\n\n // TS-resolved type\n const type = this.resolveType();\n draft.type = type;\n\n // Description from TS symbol's documentation comment.\n const description = this.getDescription();\n if (description) {\n draft.description = description;\n }\n\n // Deprecation: handler may have set it; otherwise check JSDoc on parameter.\n if (draft.deprecated === undefined && hasJSDocTag(this.parameter, JSDocTagName.DEPRECATED)) {\n draft.deprecated = true;\n }\n\n // Default value from TS initializer.\n const defaultValue = getInitializerValue(this.parameter.initializer, this.current.typeChecker, type);\n if (defaultValue !== undefined) {\n draft.default = defaultValue;\n }\n\n // Required: TS optionality and presence of initializer.\n draft.required = !this.parameter.questionToken && !this.parameter.initializer;\n\n // Examples from method-level JSDoc @example tags scoped to this parameter.\n const { examples, exampleLabels } = this.getJsDocExamples(parameterName);\n if (examples) {\n draft.examples = examples.map((value) => ({ value }));\n draft.exampleLabels = (exampleLabels ?? []).filter((l): l is string => l !== undefined);\n }\n\n // Declaration-level validators (e.g., @MaxLength annotations on the parameter).\n Object.assign(draft.validators, getDeclarationValidators(this.parameter, parameterName));\n\n // Apply default `in` if no handler claimed.\n if (!draft.in) {\n if (!BODY_SUPPORTED_METHODS.has(this.method)) {\n throw ParameterError.methodUnsupported({\n decoratorName: 'Body',\n propertyName: parameterName,\n method: this.method,\n node: this.parameter,\n });\n }\n draft.in = ParamKind.Body;\n }\n\n // Body validation requires the method to support a body.\n if ((draft.in === ParamKind.Body || draft.in === ParamKind.BodyProp) &&\n !BODY_SUPPORTED_METHODS.has(this.method)) {\n throw ParameterError.methodUnsupported({\n decoratorName: 'Body',\n propertyName: draft.name,\n method: this.method,\n node: this.parameter,\n });\n }\n\n return this.finalize(draft, type, parameterName, examples, exampleLabels);\n }\n\n private finalize(\n draft: ParameterDraft,\n type: Type,\n parameterName: string,\n examples: unknown[] | undefined,\n exampleLabels: Array<string | undefined> | undefined,\n ): Parameter[] {\n const kind = draft.in!;\n const wrappedExamples = examples ? examples.map((value) => ({ value })) : undefined;\n const filteredLabels = exampleLabels?.filter((l): l is string => l !== undefined);\n\n // Object decomposition for kinds that can carry an object payload.\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.PATH) &&\n (isNestedObjectLiteralType(type) || isRefObjectType(type))) {\n const decomposed = this.decomposeObject(type, {\n in: kind === ParameterSource.QUERY ? ParameterSource.QUERY_PROP : ParameterSource.PATH,\n examples: wrappedExamples,\n exampleLabels: filteredLabels,\n extensions: draft.extensions,\n });\n if (kind === ParameterSource.PATH) {\n this.validatePathDecomposition(decomposed);\n }\n return decomposed;\n }\n\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.QUERY_PROP) &&\n isArrayType(type)) {\n if (!this.isLeafTypeSupported(type.elementType)) {\n throw ParameterError.typeUnsupported({\n decoratorName: kind === ParameterSource.QUERY ? 'Query' : 'QueryProp',\n propertyName: draft.name,\n type: type.elementType,\n node: this.parameter,\n });\n }\n const arrayParameter: ArrayParameter = {\n ...this.draftToParameter(draft),\n collectionFormat: draft.collectionFormat ?? CollectionFormat.MULTI,\n type,\n };\n return [arrayParameter];\n }\n\n if ((kind === ParameterSource.QUERY || kind === ParameterSource.QUERY_PROP) &&\n !this.isLeafOrEnumOrUnion(type)) {\n throw ParameterError.typeUnsupported({\n decoratorName: kind === ParameterSource.QUERY ? 'Query' : 'QueryProp',\n propertyName: draft.name,\n type,\n node: this.parameter,\n });\n }\n\n if (kind === ParameterSource.PATH) {\n this.validatePathName(draft.name, parameterName);\n }\n\n return [this.draftToParameter(draft)];\n }\n\n private draftToParameter(draft: ParameterDraft): Parameter {\n return {\n allowEmptyValue: draft.allowEmptyValue,\n collectionFormat: draft.collectionFormat,\n default: draft.default,\n description: draft.description,\n examples: draft.examples.length > 0 ? draft.examples : undefined,\n exampleLabels: draft.exampleLabels.length > 0 ? draft.exampleLabels : undefined,\n extensions: draft.extensions,\n in: draft.in!,\n maxItems: draft.maxItems,\n minItems: draft.minItems,\n name: draft.name,\n parameterName: draft.parameterName,\n required: draft.required,\n type: draft.type!,\n deprecated: draft.deprecated,\n validators: draft.validators,\n };\n }\n\n private decomposeObject(\n type: NestedObjectLiteralType | RefObjectType,\n details: {\n in: `${ParameterSource}`;\n examples: { value: unknown }[] | undefined;\n exampleLabels: string[] | undefined;\n extensions: Extension[];\n },\n ): Parameter[] {\n if (type.properties.length === 0) {\n return [];\n }\n\n const parameterName = this.getParameterName();\n const initializerValue = getInitializerValue(this.parameter.initializer, this.current.typeChecker, type);\n const description = this.getDescription();\n const isParamOptional = !!this.parameter.questionToken;\n const isParamDeprecated = hasJSDocTag(this.parameter, JSDocTagName.DEPRECATED);\n\n const output: Parameter[] = [];\n for (const property of type.properties) {\n let propertyDefaultValue = property.default;\n if (typeof propertyDefaultValue === 'undefined' && isObject(initializerValue)) {\n propertyDefaultValue = (initializerValue as Record<string, unknown>)[property.name];\n }\n\n const required = isParamOptional ? false : property.required;\n\n output.push({\n extensions: [...details.extensions],\n in: details.in,\n examples: details.examples,\n exampleLabels: details.exampleLabels,\n default: propertyDefaultValue,\n description: property.description || description,\n name: property.name,\n parameterName,\n required,\n type: property.type,\n deprecated: property.deprecated || isParamDeprecated,\n validators: {},\n });\n }\n return output;\n }\n\n private pathContainsParam(name: string): boolean {\n // Match `{name}` literally — curly braces are their own boundaries.\n // For `:name`, require a word boundary after the name so `:id` doesn't\n // match `:id2` (substring), but it still matches when path-to-regexp\n // modifiers/constraints follow the name (`:id?`, `:id*`, `:id(\\\\d+)`).\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const colonPattern = new RegExp(`:${escaped}\\\\b`);\n const bracePattern = `{${name}}`;\n for (const p of this.paths) {\n if (p.includes(bracePattern) || colonPattern.test(p)) {\n return true;\n }\n }\n return false;\n }\n\n private validatePathDecomposition(decomposed: Parameter[]): void {\n for (const element of decomposed) {\n if (!this.pathContainsParam(element.name)) {\n throw ParameterError.invalidPathMatch({\n decoratorName: 'Path',\n propertyName: element.name,\n path: this.paths.join(' | '),\n node: this.parameter,\n });\n }\n }\n }\n\n private validatePathName(name: string, parameterName: string): void {\n const candidate = name || parameterName;\n if (!this.pathContainsParam(candidate)) {\n throw ParameterError.invalidPathMatch({\n decoratorName: 'Path',\n propertyName: candidate,\n path: this.paths.join(' | '),\n node: this.parameter,\n });\n }\n }\n\n private isLeafTypeSupported(type: BaseType): boolean {\n return SUPPORTED_LEAF_TYPES.has(type.typeName);\n }\n\n private isLeafOrEnumOrUnion(type: Type): boolean {\n return SUPPORTED_LEAF_TYPES.has(type.typeName) ||\n isRefEnumType(type) ||\n isUnionType(type);\n }\n\n private resolveType(): Type {\n let typeNode = this.parameter.type;\n if (!typeNode) {\n const t = this.current.typeChecker.getTypeAtLocation(this.parameter);\n typeNode = this.current.typeChecker.typeToTypeNode(\n t,\n undefined,\n NodeBuilderFlags.NoTruncation,\n );\n }\n if (!typeNode) {\n throw new ParameterError({ message: `Could not resolve type for parameter '${this.getParameterName()}'.` });\n }\n return new TypeNodeResolver(typeNode, this.current, this.parameter).resolve();\n }\n\n private getParameterName(): string {\n if (!isIdentifier(this.parameter.name)) {\n throw new ParameterError({ message: 'Destructured parameters are not supported. Use a simple identifier name.' });\n }\n return this.parameter.name.text;\n }\n\n private getDescription(): string {\n const symbol = this.current.typeChecker.getSymbolAtLocation(this.parameter.name);\n if (symbol) {\n const comments = symbol.getDocumentationComment(this.current.typeChecker);\n if (comments.length > 0) {\n return displayPartsToString(comments);\n }\n }\n return '';\n }\n\n private getJsDocExamples(parameterName: string): {\n examples: unknown[] | undefined;\n exampleLabels: Array<string | undefined> | undefined;\n } {\n const exampleLabels: Array<string | undefined> = [];\n const tags = getJSDocTags(this.parameter.parent, (tag) => {\n const comment = transformJSDocComment(tag.comment);\n const isExample = (tag.tagName.text === JSDocTagName.EXAMPLE ||\n tag.tagName.escapedText === JSDocTagName.EXAMPLE) &&\n !!comment && comment.startsWith(parameterName);\n\n if (isExample && comment) {\n const head = comment.split(' ')[0] ?? '';\n const hasExampleLabel = head.indexOf('.') > 0;\n exampleLabels.push(hasExampleLabel ?\n head.split('.').slice(1).join('.') :\n undefined);\n }\n return isExample ?? false;\n });\n\n const examples = tags.map((tag) => (\n transformJSDocComment(tag.comment) || '')\n .replace(`${transformJSDocComment(tag.comment)?.split(' ')[0] || ''}`, '')\n .replace(/\\r/g, ''));\n\n if (examples.length === 0) {\n return { examples: undefined, exampleLabels: undefined };\n }\n\n try {\n return {\n examples: examples.map((example) => JSON.parse(example)),\n exampleLabels,\n };\n } catch {\n throw ParameterError.invalidExampleSchema();\n }\n }\n\n private applyOptions(parameterName: string): ApplyHandlersOptions {\n return {\n target: 'parameter',\n host: { name: parameterName, parentName: this.method },\n resolveTypeNode: (n) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n parameterType: () => this.parameter.type ?\n new TypeNodeResolver(this.parameter.type, this.current).resolve() :\n undefined,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n}\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport path from 'node:path';\nimport { NodeBuilderFlags } from 'typescript';\nimport type {\n ClassDeclaration,\n Identifier,\n MethodDeclaration,\n TypeNode,\n} from 'typescript';\nimport {\n ParameterSource,\n isVoidType,\n newMethodDraft,\n} from '@trapi/core';\nimport type {\n BaseType,\n Example,\n Method,\n Parameter,\n Response,\n} from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { GeneratorError } from '../../../core/error/generator';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport {\n JSDocTagName,\n getJSDocDescription,\n getJSDocTagComment,\n} from '../../../adapters/typescript/js-doc';\nimport { normalizePath } from '../../../core/utils';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\nimport { ParameterGenerator } from '../parameter';\n\nexport class MethodGenerator {\n protected readonly node: MethodDeclaration;\n\n protected readonly current: IGeneratorContext;\n\n constructor(node: MethodDeclaration, current: IGeneratorContext) {\n this.node = node;\n this.current = current;\n }\n\n public getMethodName(): string {\n const identifier = this.node.name as Identifier;\n return identifier.text;\n }\n\n public generate(controllerPaths: string[]): Method | null {\n const name = this.getMethodName();\n const draft = newMethodDraft({ name });\n\n const options = this.applyOptions();\n applyDecoratorHandlers(this.node, this.current.registry.methods, draft, options);\n applyJsDocHandlers(this.node, this.current.registry.methodJsDoc, draft, options);\n\n // Not a route method (no HTTP verb decorator matched).\n if (!draft.verb) {\n return null;\n }\n\n // Skip hidden methods entirely (matches v1 behaviour for class member iteration).\n if (draft.hidden) {\n return null;\n }\n\n // Resolve return type.\n const returnType = this.resolveReturnType();\n\n // Build responses: handler-supplied first, then a derived default that\n // carries any handler-contributed default-response examples.\n const defaultResponse = buildDefaultResponse(returnType, draft.defaultResponseExamples);\n const responses = mergeDefaultResponse(draft.responses, defaultResponse);\n\n // Walk parameters.\n const parameters = this.buildParameters(controllerPaths, draft.path, draft.verb);\n\n // Description from leading JSDoc comment (no v2 handler covers this since it\n // isn't a tagged value).\n const description = getJSDocDescription(this.node) ?? draft.description;\n const summary = draft.summary ?? getJSDocTagComment(this.node, JSDocTagName.SUMMARY);\n\n return {\n consumes: draft.consumes,\n deprecated: draft.deprecated ?? false,\n description: description ?? '',\n extensions: draft.extensions,\n hidden: draft.hidden,\n method: draft.verb,\n name,\n path: normalizePath(draft.path),\n produces: draft.produces,\n responses,\n security: draft.security,\n summary,\n tags: draft.tags,\n type: returnType,\n parameters,\n };\n }\n\n private applyOptions(): ApplyHandlersOptions {\n const parentName = (this.node.parent as ClassDeclaration).name?.text;\n return {\n target: 'method',\n host: { name: this.getMethodName(), parentName },\n resolveTypeNode: (n: TypeNode) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n\n private resolveReturnType(): BaseType {\n let nodeType = this.node.type;\n if (!nodeType) {\n const { typeChecker } = this.current;\n const signature = typeChecker.getSignatureFromDeclaration(this.node);\n if (!signature) {\n throw new GeneratorError({ message: 'Could not resolve method signature.' });\n }\n const implicitType = typeChecker.getReturnTypeOfSignature(signature);\n nodeType = typeChecker.typeToTypeNode(implicitType, undefined, NodeBuilderFlags.NoTruncation) as TypeNode;\n }\n return new TypeNodeResolver(nodeType, this.current).resolve();\n }\n\n private buildParameters(\n controllerPaths: string[],\n methodPath: string,\n verb: string,\n ): Parameter[] {\n const controllerId = (this.node.parent as ClassDeclaration).name as Identifier;\n const methodId = this.node.name as Identifier;\n // Build the union of every (controllerPath × methodPath) combination so\n // path-parameter validation accepts a parameter that's present in any\n // mount (a controller can mount at /roles AND /realms/:id/roles).\n const fullPaths = (controllerPaths.length === 0 ? [''] : controllerPaths)\n .map((cp) => path.posix.join('/', cp, methodPath));\n\n const output: Parameter[] = [];\n let bodyParameterCount = 0;\n let formParameterCount = 0;\n\n for (const [i, declaration] of this.node.parameters.entries()) {\n try {\n const generator = new ParameterGenerator(\n declaration,\n verb,\n fullPaths,\n this.current,\n );\n\n const parameters = generator.generate();\n\n for (const parameter of parameters) {\n if (parameter.in === ParameterSource.BODY) {\n bodyParameterCount += 1;\n }\n if (parameter.in === ParameterSource.FORM_DATA) {\n formParameterCount += 1;\n }\n if (parameter.in !== ParameterSource.CONTEXT) {\n output.push(parameter);\n }\n }\n } catch (e) {\n const causeMsg = e instanceof Error ? `: ${e.message}` : '';\n throw new GeneratorError({\n message: `Parameter generation failed for '${controllerId.text}.${methodId.text}' argument index ${i}${causeMsg}`,\n code: GeneratorErrorCode.PARAMETER_GENERATION_FAILED,\n cause: e,\n });\n }\n }\n\n if (bodyParameterCount > 1) {\n throw new GeneratorError({\n message: `Only one body parameter allowed in '${controllerId.text}.${methodId.text}' method.`,\n code: GeneratorErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n if (bodyParameterCount > 0 && formParameterCount > 0) {\n throw new GeneratorError({\n message: `Cannot mix body and form parameters in '${controllerId.text}.${methodId.text}' method.`,\n code: GeneratorErrorCode.BODY_FORM_CONFLICT,\n });\n }\n\n return output;\n }\n}\n\nfunction buildDefaultResponse(returnType: BaseType, examples: Example[]): Response {\n const isVoid = isVoidType(returnType);\n return {\n description: isVoid ? 'No content' : 'Ok',\n examples,\n schema: returnType,\n status: isVoid ? '204' : '200',\n name: isVoid ? '204' : '200',\n };\n}\n\nfunction mergeDefaultResponse(handlerResponses: Response[], defaultResponse: Response): Response[] {\n if (handlerResponses.length === 0) {\n return [defaultResponse];\n }\n const target = handlerResponses.find((r) => r.status === defaultResponse.status);\n if (target) {\n if (defaultResponse.examples && defaultResponse.examples.length > 0 &&\n (!target.examples || target.examples.length === 0)) {\n target.examples = defaultResponse.examples;\n }\n return handlerResponses;\n }\n return [...handlerResponses, defaultResponse];\n}\n","/*\n * Copyright (c) 2021-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ClassDeclaration, \n Expression, \n MethodDeclaration, \n TypeNode,\n} from 'typescript';\nimport {\n SymbolFlags,\n SyntaxKind,\n isClassDeclaration,\n isMethodDeclaration,\n} from 'typescript';\nimport { newControllerDraft } from '@trapi/core';\nimport {\n type ApplyHandlersOptions,\n applyDecoratorHandlers,\n applyJsDocHandlers,\n} from '../../../adapters/decorator';\nimport { TypeNodeResolver } from '../../../adapters/typescript/resolver';\nimport { isResolverError } from '../../../core/error/resolver';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { GeneratorError, isGeneratorError } from '../../../core/error/generator';\nimport { normalizePath } from '../../../core/utils';\nimport type { Controller, IControllerGenerator, Method } from '@trapi/core';\nimport { MethodGenerator } from '../method';\nimport type { IGeneratorContext } from '../../../core/metadata/types';\n\nexport class ControllerGenerator implements IControllerGenerator {\n protected readonly node: ClassDeclaration;\n\n protected readonly current: IGeneratorContext;\n\n constructor(node: ClassDeclaration, current: IGeneratorContext) {\n this.node = node;\n this.current = current;\n }\n\n public isValid(): boolean {\n // Whether a class is a controller depends on whether any registry handler\n // matches one of its decorators (e.g. `@Controller`). Resolving that\n // requires running handler dispatch — which `generate()` does — so\n // `isValid()` only screens out unnamed classes here. `generate()` returns\n // `null` when no controller handler claimed the node.\n return !!this.node.name;\n }\n\n public generate(): Controller | null {\n if (!this.node.parent) {\n throw new GeneratorError({\n message: 'Controller node doesn\\'t have a valid parent source file.',\n code: GeneratorErrorCode.CONTROLLER_NO_SOURCE_FILE,\n });\n }\n if (!this.node.name) {\n throw new GeneratorError({\n message: 'Controller node doesn\\'t have a valid name.',\n code: GeneratorErrorCode.CONTROLLER_NO_NAME,\n });\n }\n\n const sourceFile = this.node.parent.getSourceFile();\n const draft = newControllerDraft({\n name: this.node.name.text,\n location: sourceFile.fileName,\n });\n\n const options = this.applyOptions();\n applyDecoratorHandlers(this.node, this.current.registry.controllers, draft, options);\n applyJsDocHandlers(this.node, this.current.registry.controllerJsDoc, draft, options);\n\n // A class is a controller iff a controller-target handler claimed it\n // (convention: the Controller handler sets `draft.paths` to a non-undefined value).\n if (draft.paths === undefined) {\n return null;\n }\n\n // Normalize and dedupe — a user passing `@Controller(['/roles', '/roles'])`\n // (or paths that collide after normalization) shouldn't produce duplicate\n // OpenAPI path keys downstream.\n const normalized = (draft.paths.length === 0 ? [''] : draft.paths).map(normalizePath);\n const paths = [...new Set(normalized)];\n const methods = this.buildMethods(paths);\n\n return {\n consumes: draft.consumes,\n deprecated: draft.deprecated,\n extensions: draft.extensions,\n hidden: draft.hidden,\n location: draft.location,\n name: draft.name,\n paths,\n produces: draft.produces,\n responses: draft.responses,\n security: draft.security,\n tags: draft.tags,\n methods,\n };\n }\n\n private applyOptions(): ApplyHandlersOptions {\n return {\n target: 'class',\n host: { name: this.node.name!.text },\n resolveTypeNode: (n: TypeNode) => new TypeNodeResolver(n, this.current).resolve(),\n typeChecker: this.current.typeChecker,\n onUnmatchedDecorator: (this.current.config.strict || this.current.config.onUnmatchedDecorator) ?\n (report) => this.current.reportUnmatchedDecorator?.(report) :\n undefined,\n };\n }\n\n protected buildMethods(controllerPaths: string[]): Method[] {\n const set = new Set<string>();\n const output: Method[] = [];\n\n // Process own methods first\n for (const member of this.node.members) {\n if (!isMethodDeclaration(member)) {\n continue;\n }\n\n const generator = new MethodGenerator(member, this.current);\n const methodName = generator.getMethodName();\n if (set.has(methodName)) {\n continue;\n }\n\n const method = generator.generate(controllerPaths);\n if (!method) {\n continue;\n }\n set.add(methodName);\n output.push(method);\n }\n\n // Then process inherited methods from base classes\n const inheritedMethods = this.collectInheritedMethodDeclarations(this.node);\n for (const node of inheritedMethods) {\n const generator = new MethodGenerator(node, this.current);\n const methodName = generator.getMethodName();\n if (set.has(methodName)) {\n continue;\n }\n\n try {\n const method = generator.generate(controllerPaths);\n if (!method) {\n continue;\n }\n set.add(methodName);\n output.push(method);\n } catch (error: unknown) {\n // Skip inherited methods that fail due to unresolvable generic\n // type parameters (e.g., return type T or parameter type T from\n // generic base classes). Rethrow everything else.\n if (\n isResolverError(error) ||\n (isGeneratorError(error) &&\n error.code === GeneratorErrorCode.PARAMETER_GENERATION_FAILED)\n ) {\n continue;\n }\n\n throw error;\n }\n }\n\n return output;\n }\n\n private collectInheritedMethodDeclarations(node: ClassDeclaration): MethodDeclaration[] {\n const methods: MethodDeclaration[] = [];\n\n if (!node.heritageClauses) {\n return methods;\n }\n\n for (const clause of node.heritageClauses) {\n if (clause.token !== SyntaxKind.ExtendsKeyword) {\n continue;\n }\n\n for (const type of clause.types) {\n const baseDeclaration = this.resolveBaseClassDeclaration(type.expression);\n if (!baseDeclaration) {\n continue;\n }\n\n // Collect direct methods from the base class\n for (const member of baseDeclaration.members) {\n if (isMethodDeclaration(member)) {\n methods.push(member);\n }\n }\n\n // Recurse to pick up the full inheritance chain\n methods.push(...this.collectInheritedMethodDeclarations(baseDeclaration));\n }\n }\n\n return methods;\n }\n\n private resolveBaseClassDeclaration(expression: Expression): ClassDeclaration | undefined {\n let symbol = this.current.typeChecker.getSymbolAtLocation(expression);\n if (!symbol) {\n return undefined;\n }\n\n // Follow import aliases to the original declaration\n if (symbol.flags & SymbolFlags.Alias) {\n symbol = this.current.typeChecker.getAliasedSymbol(symbol);\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) {\n return undefined;\n }\n\n const declaration = declarations[0];\n if (declaration && isClassDeclaration(declaration)) {\n return declaration;\n }\n\n return undefined;\n }\n}\n","/*\n * Copyright (c) 2022-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport crypto from 'node:crypto';\nimport { minimatch } from 'minimatch';\nimport type {\n Node,\n Program,\n SourceFile,\n TypeChecker,\n} from 'typescript';\nimport {\n NodeFlags,\n createProgram,\n forEachChild,\n isClassDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n} from 'typescript';\nimport {\n CACHE_SCHEMA_VERSION,\n CacheClient,\n composeCacheKey,\n hashCompilerOptions,\n hashRegistry,\n} from '../../../adapters/cache';\nimport type { MetadataGeneratorOptions } from '../../../core/config';\nimport type {\n Controller,\n DependencyResolver,\n Metadata,\n ReferenceType,\n ReferenceTypes,\n Registry, \n UnmatchedDecoratorReport, \n} from '@trapi/core';\nimport {\n createRegistry,\n loadRegistry,\n loadRegistryByName,\n mergeRegistries,\n resolvePresetByName,\n} from '@trapi/core';\nimport { ConfigError } from '../../../core/error/config';\nimport { ConfigErrorCode } from '../../../core/error/config-codes';\nimport { GeneratorError } from '../../../core/error/generator';\nimport { GeneratorErrorCode } from '../../../core/error/generator-codes';\nimport { ResolverCache } from '../../../adapters/typescript/resolver/cache';\nimport { ControllerGenerator } from '../controller';\nimport type {\n IGeneratorContext,\n IMetadataGenerator,\n MetadataGeneratorContext,\n} from '../../../core/metadata/types';\n\nexport class MetadataGenerator implements IGeneratorContext, IMetadataGenerator {\n public readonly nodes : Node[];\n\n public readonly typeChecker: TypeChecker;\n\n public registry: Registry;\n\n public readonly resolverCache: ResolverCache;\n\n public readonly config: MetadataGeneratorOptions;\n\n private readonly program: Program;\n\n private cache : CacheClient;\n\n private controllers: Controller[] = [];\n\n private referenceTypes: ReferenceTypes = {};\n\n private circularDependencyResolvers = new Array<DependencyResolver>();\n\n private unmatchedDecorators: Map<string, UnmatchedDecoratorReport[]> = new Map();\n\n // -------------------------------------------------------------------------\n\n constructor(context: MetadataGeneratorContext) {\n this.nodes = [];\n this.config = context.options;\n\n this.cache = new CacheClient(context.options.cache);\n this.registry = createRegistry();\n this.resolverCache = new ResolverCache();\n\n this.program = createProgram(\n context.sourceFiles,\n context.compilerOptions || {},\n );\n this.typeChecker = this.program.getTypeChecker();\n }\n\n // -------------------------------------------------------------------------\n\n async generate(): Promise<Metadata> {\n const sourceFilesHash : string = this.buildNodesFromSourceFiles();\n\n // Load the preset upfront so its resolved registry can contribute to\n // the cache key. Otherwise edits to a local preset (or upgrades that\n // share a name) would silently serve stale metadata.\n let presetRegistry: Registry | undefined;\n let presetName: string | undefined;\n if (typeof this.config.preset === 'string') {\n presetName = this.config.preset;\n presetRegistry = await loadRegistryByName(this.config.preset);\n } else if (this.config.preset) {\n presetName = this.config.preset.name;\n presetRegistry = await loadRegistry(this.config.preset, { resolver: resolvePresetByName });\n }\n\n if (presetRegistry && this.config.registry) {\n this.registry = mergeRegistries(presetRegistry, this.config.registry);\n } else if (presetRegistry) {\n this.registry = presetRegistry;\n } else if (this.config.registry) {\n this.registry = this.config.registry;\n }\n\n const cacheKey = composeCacheKey({\n schemaVersion: CACHE_SCHEMA_VERSION,\n sourceFilesHash,\n compilerOptionsHash: hashCompilerOptions(this.program.getCompilerOptions()),\n registryHash: hashRegistry(this.registry),\n presetName,\n });\n\n // Strict reporting requires handler dispatch to actually run. A cache hit\n // would skip it and silently swallow unmatched-decorator reports.\n const bypassCache = !!(this.config.strict || this.config.onUnmatchedDecorator);\n\n let cache = bypassCache ?\n undefined :\n await this.cache.get(cacheKey);\n\n if (!cache) {\n this.buildControllers();\n\n this.assertPresetProducedControllers();\n\n this.circularDependencyResolvers.forEach((resolve) => resolve(this.referenceTypes));\n\n cache = {\n controllers: this.controllers,\n referenceTypes: this.referenceTypes,\n cacheKey,\n schemaVersion: CACHE_SCHEMA_VERSION,\n };\n\n if (!bypassCache) {\n await this.cache.save(cache);\n }\n }\n\n if (this.config.strict || this.config.onUnmatchedDecorator) {\n this.dispatchUnmatchedDecoratorReports();\n }\n\n return {\n controllers: cache.controllers,\n referenceTypes: cache.referenceTypes,\n };\n }\n\n private assertPresetProducedControllers(): void {\n if (this.config.preset || this.config.registry || this.controllers.length > 0) {\n return;\n }\n // Only fault a missing preset when we actually scanned source files —\n // an empty entry point is a different misconfiguration that shouldn't\n // surface as a preset error.\n if (this.nodes.length === 0) {\n return;\n }\n throw new ConfigError({\n message: 'No preset or registry configured and no controllers detected. Provide `preset: \\'@trapi/preset-decorators-express\\'` (or another preset), or pass an inline `registry`, so handlers can match your decorators.',\n code: ConfigErrorCode.PRESET_MISSING,\n });\n }\n\n public reportUnmatchedDecorator(report: UnmatchedDecoratorReport): void {\n const key = `${report.target}:${report.name}`;\n const existing = this.unmatchedDecorators.get(key);\n if (existing) {\n existing.push(report);\n return;\n }\n this.unmatchedDecorators.set(key, [report]);\n }\n\n private dispatchUnmatchedDecoratorReports(): void {\n if (this.unmatchedDecorators.size === 0) {\n return;\n }\n\n const flat: UnmatchedDecoratorReport[] = [];\n for (const reports of this.unmatchedDecorators.values()) {\n flat.push(...reports);\n }\n\n // User-supplied callback short-circuits the default warn/throw path.\n if (this.config.onUnmatchedDecorator) {\n this.config.onUnmatchedDecorator(flat);\n return;\n }\n\n const summary = this.formatUnmatchedSummary();\n\n if (this.config.strict === 'throw') {\n throw new GeneratorError({\n message: summary,\n code: GeneratorErrorCode.STRICT_UNMATCHED_DECORATORS,\n });\n }\n\n // eslint-disable-next-line no-console\n console.warn(summary);\n }\n\n private formatUnmatchedSummary(): string {\n const lines: string[] = ['[trapi] strict mode: decorators with no matching handler:'];\n for (const reports of this.unmatchedDecorators.values()) {\n const first = reports[0];\n if (!first) {\n continue;\n }\n const occurrences = reports.length;\n const location = `${first.file}:${first.line}`;\n const suffix = occurrences > 1 ?\n ` (${occurrences} occurrences; first at ${location})` :\n ` (${location})`;\n lines.push(` - @${first.name} on ${first.target} '${first.host.name}'${suffix}`);\n }\n return lines.join('\\n');\n }\n\n protected buildNodesFromSourceFiles() : string {\n const hash = crypto.createHash('sha256');\n\n this.program.getSourceFiles().forEach((sf: SourceFile) => {\n if (\n this.isIgnoredPath(sf.fileName) &&\n !this.isAllowedPath(sf.fileName)\n ) {\n return;\n }\n\n // Hash the file path alongside its contents so that renames or\n // reordered identical files invalidate the cache. The null byte is\n // a safe separator since it cannot appear in a path or source.\n hash.update(sf.fileName);\n hash.update('\\0');\n hash.update(sf.text);\n hash.update('\\0');\n\n forEachChild(sf, (node: any) => {\n if (isModuleDeclaration(node)) {\n /**\n * For some reason unknown to me, TS resolves both `declare module` and `namespace` to\n * the same kind (`ModuleDeclaration`). In order to figure out whether it's one or the other,\n * we check the node flags. They tell us whether it is a namespace or not.\n */\n\n // tslint:disable-next-line:no-bitwise\n if ((node.flags & NodeFlags.Namespace) === 0 && node.body && isModuleBlock(node.body)) {\n node.body.statements.forEach((statement) => {\n this.nodes.push(statement);\n });\n return;\n }\n }\n\n this.nodes.push(node);\n });\n });\n\n return hash.digest('hex');\n }\n\n // -------------------------------------------------------------------------\n\n /**\n * Check if the source file path is in the ignored path list.\n *\n * @param filePath\n * @protected\n */\n protected isIgnoredPath(filePath: string) : boolean {\n if (typeof this.config.ignore === 'undefined') {\n return false;\n }\n\n return this.config.ignore.some((item) => minimatch(filePath, item));\n }\n\n /**\n * Check if the source file path is in the ignored path list.\n *\n * @param filePath\n * @protected\n */\n protected isAllowedPath(filePath: string) {\n if (typeof this.config.allow === 'undefined') {\n return false;\n }\n\n return this.config.allow.some((item) => minimatch(filePath, item));\n }\n\n // -------------------------------------------------------------------------\n\n public isExportedNode(_node: Node) {\n return true;\n }\n\n // -------------------------------------------------------------------------\n\n public addReferenceType(referenceType: ReferenceType) {\n if (!referenceType.refName) {\n return;\n }\n\n this.referenceTypes[referenceType.refName] = referenceType;\n }\n\n public getReferenceType(refName: string) {\n return this.referenceTypes[refName];\n }\n\n public registerDependencyResolver(callback: DependencyResolver) {\n this.circularDependencyResolvers.push(callback);\n }\n\n private buildControllers() : void {\n this.controllers = [];\n\n for (const node of this.nodes) {\n if (!isClassDeclaration(node)) {\n continue;\n }\n\n const generator = new ControllerGenerator(node, this);\n if (!generator.isValid()) {\n continue;\n }\n\n const controller = generator.generate();\n if (controller) {\n this.controllers.push(controller);\n }\n }\n }\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { CompilerOptions } from 'typescript';\nimport type { MetadataGenerateOptions } from '../core/config';\nimport type { Metadata } from '@trapi/core';\nimport { MetadataGenerator } from './generator/metadata';\nimport { scanSourceFiles } from '../adapters/filesystem';\nimport { softLoadTsconfig } from '../adapters/filesystem/tsconfig';\n\nexport async function generateMetadata(\n options: MetadataGenerateOptions,\n) : Promise<Metadata> {\n let compilerOptions : CompilerOptions | undefined;\n\n if (options.tsconfig) {\n let { tsconfig } = options;\n if (typeof tsconfig === 'string') {\n tsconfig = await softLoadTsconfig({ name: tsconfig });\n compilerOptions = tsconfig.compilerOptions;\n } else {\n compilerOptions = tsconfig.compilerOptions || {};\n }\n }\n\n const sourceFiles = await scanSourceFiles(options.entryPoint);\n\n const generator = new MetadataGenerator({\n sourceFiles,\n compilerOptions,\n options,\n });\n\n return generator.generate();\n}\n"],"mappings":";;;;;;;;;;;;;AASA,IAAa,gBAAb,cAAmC,UAAU,CAE7C;;;ACFA,IAAa,cAAb,cAAiC,cAAc,CAE/C;;;ACJA,MAAa,kBAAkB;CAC3B,oBAAoB;CACpB,kBAAkB;CAClB,gBAAgB;AACpB;;;ACDA,IAAa,iBAAb,cAAoC,cAAc,CAElD;AAEA,SAAgB,iBAAiB,OAA4D;CACzF,IAAI,CAAC,YAAY,KAAK,GAClB,OAAO;CAGX,OAAO,OAAO,MAAM,SAAS;AACjC;;;ACbA,MAAa,qBAAqB;CAC9B,2BAA2B;CAC3B,oBAAoB;CACpB,6BAA6B;CAC7B,0BAA0B;CAC1B,oBAAoB;CACpB,6BAA6B;AACjC;;;ACPA,MAAa,qBAAqB;CAC9B,kBAAkB;CAClB,oBAAoB;CACpB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;AACrB;;;ACyBA,IAAa,iBAAb,MAAa,uBAAuB,cAAc;CAC9C,OAAO,gBAAgB,SAAiC;EACpD,MAAM,WAAW,QAAQ,OAAO,eAAe,mBAAmB,QAAQ,IAAI,IAAI,KAAA;EAClF,OAAO,IAAI,eAAe;GACtB,SAAS,IAAI,QAAQ,cAAc,IAAI,QAAQ,aAAa,uBAAuB,QAAQ,KAAK,SAAS,QAAQ,WAAW,OAAO,aAAa,GAAG;GACn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