@nestbridge/core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +6 -2
- package/build/nestbridge.core.d.ts +47 -3
- package/build/nestbridge.core.js +357 -65
- package/build/nestbridge.core.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestbridge.core.js","names":[],"sources":["../src/analysis/attach-response-wrappers.ts","../src/models/response-wrapper-substitution.ts","../src/analysis/unwrap-parenthesized-expression.ts","../src/analysis/resolve-sole-return-expression.ts","../src/analysis/synthesize-generic-object-type.ts","../src/analysis/read-map-operation.ts","../src/analysis/open-source-file.ts","../src/analysis/parse-source-file.ts","../src/analysis/resolve-type-declaration.ts","../src/analysis/read-pipe-operator.ts","../src/analysis/contains-return-statement.ts","../src/analysis/resolve-intercept-return-expression.ts","../src/analysis/analyze-intercept-method.ts","../src/analysis/analyze-interceptor-class.ts","../src/analysis/compose-wrapper-type-source.ts","../src/analysis/node-location.ts","../src/analysis/create-interceptor-diagnostic.ts","../src/analysis/decorator-inspection.ts","../src/analysis/read-module-option.ts","../src/analysis/find-app-interceptor-provider-registrations.ts","../src/analysis/read-imported-modules.ts","../src/analysis/collect-module-interceptor-registrations.ts","../src/analysis/find-bootstrap-interceptor-registrations.ts","../src/analysis/find-root-module-class-name.ts","../src/analysis/find-global-interceptor-registrations.ts","../src/analysis/find-use-interceptors-registrations.ts","../src/analysis/create-interceptor-analysis.ts","../src/models/graphql-operation-kind.ts","../src/models/http-method.ts","../src/models/message-kind.ts","../src/analysis/find-payload-parameter-index.ts","../src/analysis/read-literal-type.ts","../src/analysis/read-message-pattern.ts","../src/analysis/extract-message-handler-definition.ts","../src/analysis/extract-parameter-definition.ts","../src/analysis/is-nullish-type-node.ts","../src/analysis/graphql-scalar-type.ts","../src/analysis/read-response-kind.ts","../src/analysis/read-route-version.ts","../src/analysis/route-path.ts","../src/analysis/extract-method-definition.ts","../src/analysis/read-controller-options.ts","../src/analysis/extract-controller-definition.ts","../src/analysis/find-controller-classes.ts","../src/analysis/analyze-controllers.ts","../src/analysis/read-args-nullable-option.ts","../src/analysis/read-type-thunk-expression.ts","../src/analysis/read-args-type-option.ts","../src/analysis/extract-resolver-argument-definition.ts","../src/analysis/extract-selection-fields.ts","../src/analysis/read-graphql-operation-name.ts","../src/analysis/read-graphql-return-type-option.ts","../src/analysis/extract-resolver-method-definition.ts","../src/analysis/extract-resolver-definition.ts","../src/analysis/find-resolver-classes.ts","../src/analysis/analyze-resolvers.ts","../src/analysis/apply-application-routing.ts","../src/analysis/find-app-filter-provider-class-name.ts","../src/analysis/find-global-filter-class-name.ts","../src/analysis/resolve-catch-method-body.ts","../src/analysis/synthesize-error-body-type.ts","../src/analysis/detect-error-response-shape.ts","../src/analysis/collect-bootstrap-calls.ts","../src/analysis/create-bootstrap-diagnostic.ts","../src/analysis/read-global-prefix-exclusions.ts","../src/analysis/detect-global-prefix.ts","../src/analysis/detect-versioning.ts","../src/declarations/generate-controller-declaration.ts","../src/declarations/generate-error-body-declaration.ts","../src/diagnostics/format-diagnostic.ts","../src/diagnostics/nestbridge-diagnostic-error.ts","../package.json","../src/version.ts"],"sourcesContent":["import type { ClassDeclaration, MethodDeclaration } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { ControllerDefinition } from '../models/controller-definition';\nimport type { ControllerInterceptors } from './controller-interceptors';\n\nexport const attachResponseWrappers = (\n controller: ControllerDefinition,\n classDeclaration: ClassDeclaration,\n interceptors: ControllerInterceptors,\n) => {\n const memberMethods = classDeclaration.members.filter((member): member is MethodDeclaration =>\n isMethodDeclaration(member),\n );\n\n const methods = controller.methods.map((method) => {\n const declaration = memberMethods.find((candidate) => candidate.name.getText() === method.name);\n const responseWrapper =\n method.responseKind === 'json' && declaration !== undefined\n ? interceptors.responseWrapperOf(declaration)\n : undefined;\n\n return responseWrapper === undefined ? method : { ...method, responseWrapper };\n });\n\n return { ...controller, methods };\n};\n","export const WRAPPED_RESULT_SUBSTITUTION = 'Awaited<Result>';\n\nexport const UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE = 'unknown';\n","import type { Expression } from 'typescript/unstable/ast';\nimport { isParenthesizedExpression } from 'typescript/unstable/ast';\n\nexport const unwrapParenthesizedExpression = (expression: Expression) => {\n let unwrapped = expression;\n\n while (isParenthesizedExpression(unwrapped)) {\n unwrapped = unwrapped.expression;\n }\n\n return unwrapped;\n};\n","import type { Block, Expression } from 'typescript/unstable/ast';\nimport {\n isBlock,\n isIdentifier,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\nimport { unwrapParenthesizedExpression } from './unwrap-parenthesized-expression';\n\n/**\n * Accepts an expression body, or a block that holds nothing but simple `const` declarations and\n * a single trailing `return`. A returned identifier resolves to its declared initializer.\n */\nexport const resolveSoleReturnExpression = (body: Block | Expression) => {\n if (!isBlock(body)) {\n return unwrapParenthesizedExpression(body);\n }\n\n const localDeclarations = new Map<string, Expression>();\n let returnExpression: Expression | undefined;\n let sawReturn = false;\n\n for (const statement of body.statements) {\n if (sawReturn) {\n return undefined;\n }\n\n if (isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (isReturnStatement(statement)) {\n sawReturn = true;\n returnExpression = statement.expression;\n continue;\n }\n\n return undefined;\n }\n\n if (returnExpression === undefined) {\n return undefined;\n }\n\n return isIdentifier(returnExpression)\n ? localDeclarations.get(returnExpression.text)\n : returnExpression;\n};\n","import type { Expression, Node, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isBinaryExpression,\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isParenthesizedExpression,\n isPropertyAssignment,\n isShorthandPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\ninterface SynthesisFailure {\n node: Node;\n reason: string;\n}\n\ninterface SynthesisState {\n substitutionCount: number;\n failure?: SynthesisFailure;\n}\n\nconst NUMERIC_OPERATOR_KINDS: readonly SyntaxKind[] = [\n SyntaxKind.MinusToken,\n SyntaxKind.AsteriskToken,\n SyntaxKind.SlashToken,\n SyntaxKind.PercentToken,\n];\n\nconst fail = (state: SynthesisState, node: Node, reason: string) => {\n state.failure ??= { node, reason };\n return undefined;\n};\n\nconst describeUntypedExpression = (expression: Expression) =>\n isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.PlusToken\n ? `\\`${expression.getText()}\\` can be a string or a number, so its type is not guessed.`\n : `The type of \\`${expression.getText()}\\` cannot be determined statically.`;\n\nconst synthesizeExpressionType = (\n expression: Expression,\n parameterName: string,\n substitution: string,\n state: SynthesisState,\n) => {\n if (isParenthesizedExpression(expression)) {\n return synthesizeExpressionType(expression.expression, parameterName, substitution, state);\n }\n\n if (isIdentifier(expression) && expression.text === parameterName) {\n state.substitutionCount += 1;\n return substitution;\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (isShorthandPropertyAssignment(property)) {\n const shorthandName = property.name.getText();\n\n if (shorthandName !== parameterName) {\n return fail(\n state,\n property,\n `The type of \\`${shorthandName}\\` cannot be determined statically.`,\n );\n }\n\n state.substitutionCount += 1;\n memberTypes.push(`${shorthandName}: ${substitution}`);\n continue;\n }\n\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return fail(\n state,\n property,\n `\\`${property.getText()}\\` is not a plain \\`name: value\\` property.`,\n );\n }\n\n const valueType = synthesizeExpressionType(\n property.initializer,\n parameterName,\n substitution,\n state,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n if (\n isBinaryExpression(expression) &&\n NUMERIC_OPERATOR_KINDS.includes(expression.operatorToken.kind)\n ) {\n return 'number';\n }\n\n return fail(state, expression, describeUntypedExpression(expression));\n};\n\nexport const synthesizeGenericObjectType = (\n objectLiteral: ObjectLiteralExpression,\n parameterName: string,\n substitution: string,\n) => {\n const state: SynthesisState = { substitutionCount: 0 };\n const objectType = synthesizeExpressionType(objectLiteral, parameterName, substitution, state);\n\n if (objectType === undefined) {\n const failure = state.failure ?? {\n node: objectLiteral,\n reason: `The type of \\`${objectLiteral.getText()}\\` cannot be determined statically.`,\n };\n\n return { ok: false, node: failure.node, reason: failure.reason } as const;\n }\n\n if (state.substitutionCount !== 1) {\n return {\n ok: false,\n node: objectLiteral,\n reason:\n `The payload parameter \\`${parameterName}\\` must appear exactly once in the returned ` +\n `object, but appears ${state.substitutionCount} times.`,\n } as const;\n }\n\n return { ok: true, typeSource: objectType } as const;\n};\n","import type { CallExpression } from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n} from 'typescript/unstable/ast';\nimport { WRAPPED_RESULT_SUBSTITUTION } from '../models/response-wrapper-substitution';\nimport { resolveSoleReturnExpression } from './resolve-sole-return-expression';\nimport { synthesizeGenericObjectType } from './synthesize-generic-object-type';\n\nexport const readMapOperation = (operator: CallExpression) => {\n const [callback] = operator.arguments;\n\n if (\n operator.arguments.length !== 1 ||\n callback === undefined ||\n !(isArrowFunction(callback) || isFunctionExpression(callback))\n ) {\n return {\n ok: false,\n node: operator,\n reason: 'The `map` operator must take a single arrow or function expression.',\n } as const;\n }\n\n const [parameter] = callback.parameters;\n\n if (\n callback.parameters.length !== 1 ||\n parameter === undefined ||\n !isIdentifier(parameter.name)\n ) {\n return {\n ok: false,\n node: callback,\n reason: 'The `map` callback must take exactly one plain parameter.',\n } as const;\n }\n\n const returnExpression = resolveSoleReturnExpression(callback.body);\n\n if (returnExpression === undefined || !isObjectLiteralExpression(returnExpression)) {\n return {\n ok: false,\n node: callback,\n reason: 'The `map` callback must return an object literal.',\n } as const;\n }\n\n const synthesis = synthesizeGenericObjectType(\n returnExpression,\n parameter.name.text,\n WRAPPED_RESULT_SUBSTITUTION,\n );\n\n if (!synthesis.ok) {\n return { ok: false, node: synthesis.node, reason: synthesis.reason } as const;\n }\n\n return {\n ok: true,\n operation: { parameterName: parameter.name.text, returnExpression },\n } as const;\n};\n","import { API } from 'typescript/unstable/sync';\n\nlet sharedApi: API | undefined;\n\n/**\n * The returned checker belongs to the snapshot opened for this file. Opening the next file\n * replaces that snapshot, so finish every checker query before calling this again.\n */\nexport const openSourceFile = (filePath: string) => {\n sharedApi ??= new API();\n\n sharedApi.updateSnapshot({ closeFiles: [filePath] });\n const snapshot = sharedApi.updateSnapshot({\n openFiles: [filePath],\n fileChanges: { changed: [filePath] },\n });\n const project = snapshot.getDefaultProjectForFile(filePath);\n const sourceFile = project?.program.getSourceFile(filePath);\n\n if (project === undefined || sourceFile === undefined) {\n throw new Error(`Unable to parse source file: ${filePath}`);\n }\n\n return { sourceFile, checker: project.checker };\n};\n","import { openSourceFile } from './open-source-file';\n\nexport const parseSourceFile = (filePath: string) => openSourceFile(filePath).sourceFile;\n","import { existsSync } from 'node:fs';\nimport { dirname, resolve as resolvePath } from 'node:path';\nimport type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isClassDeclaration,\n isExportDeclaration,\n isImportDeclaration,\n isNamedExports,\n isNamedImports,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport { parseSourceFile } from './parse-source-file';\n\nexport interface ResolvedTypeDeclaration {\n classDeclaration: ClassDeclaration;\n sourceFile: SourceFile;\n filePath: string;\n}\n\ninterface ImportSource {\n moduleSpecifierText: string;\n importedName: string;\n}\n\nconst parsedFilesByPath = new Map<string, SourceFile>();\n\n/**\n * Each analysis entry point starts from an empty cache, so a long-running watch session never\n * resolves a class from a file version that has since changed.\n */\nexport const clearParsedFileCache = () => {\n parsedFilesByPath.clear();\n};\n\nconst parseFile = (filePath: string): SourceFile => {\n const cached = parsedFilesByPath.get(filePath);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const sourceFile = parseSourceFile(filePath);\n parsedFilesByPath.set(filePath, sourceFile);\n return sourceFile;\n};\n\nconst resolveModuleFile = (\n fromFilePath: string,\n moduleSpecifierText: string,\n): string | undefined => {\n if (!moduleSpecifierText.startsWith('.')) {\n return undefined;\n }\n\n const base = resolvePath(dirname(fromFilePath), moduleSpecifierText);\n const candidates = [`${base}.ts`, `${base}.tsx`, resolvePath(base, 'index.ts')];\n\n return candidates.find((candidate) => existsSync(candidate));\n};\n\nconst findExportedDeclaration = (\n sourceFile: SourceFile,\n name: string,\n): ClassDeclaration | undefined =>\n sourceFile.statements.find(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && statement.name?.text === name,\n );\n\nexport const findImportSource = (\n sourceFile: SourceFile,\n localName: string,\n): ImportSource | undefined => {\n for (const statement of sourceFile.statements) {\n if (!isImportDeclaration(statement) || !isStringLiteralLikeNode(statement.moduleSpecifier)) {\n continue;\n }\n\n const namedBindings = statement.importClause?.namedBindings;\n\n if (namedBindings === undefined || !isNamedImports(namedBindings)) {\n continue;\n }\n\n const element = namedBindings.elements.find((candidate) => candidate.name.text === localName);\n\n if (element !== undefined) {\n return {\n moduleSpecifierText: statement.moduleSpecifier.text,\n importedName: element.propertyName?.text ?? element.name.text,\n };\n }\n }\n\n return undefined;\n};\n\nconst findReExportSource = (sourceFile: SourceFile, name: string): string | undefined => {\n for (const statement of sourceFile.statements) {\n if (\n !isExportDeclaration(statement) ||\n statement.moduleSpecifier === undefined ||\n !isStringLiteralLikeNode(statement.moduleSpecifier)\n ) {\n continue;\n }\n\n if (statement.exportClause === undefined) {\n return statement.moduleSpecifier.text;\n }\n\n if (\n isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.some(\n (element) => (element.propertyName?.text ?? element.name.text) === name,\n )\n ) {\n return statement.moduleSpecifier.text;\n }\n }\n\n return undefined;\n};\n\nexport const resolveClassDeclaration = (\n name: string,\n fromSourceFile: SourceFile,\n fromFilePath: string,\n visited: Set<string> = new Set(),\n): ResolvedTypeDeclaration | undefined => {\n if (visited.has(fromFilePath)) {\n return undefined;\n }\n\n visited.add(fromFilePath);\n\n const direct = findExportedDeclaration(fromSourceFile, name);\n\n if (direct !== undefined) {\n return { classDeclaration: direct, sourceFile: fromSourceFile, filePath: fromFilePath };\n }\n\n const importSource = findImportSource(fromSourceFile, name);\n\n if (importSource !== undefined) {\n const resolvedPath = resolveModuleFile(fromFilePath, importSource.moduleSpecifierText);\n\n if (resolvedPath !== undefined) {\n const nextSourceFile = parseFile(resolvedPath);\n const result = resolveClassDeclaration(\n importSource.importedName,\n nextSourceFile,\n resolvedPath,\n visited,\n );\n\n if (result !== undefined) {\n return result;\n }\n }\n }\n\n const reExportModuleSpecifierText = findReExportSource(fromSourceFile, name);\n\n if (reExportModuleSpecifierText !== undefined) {\n const resolvedPath = resolveModuleFile(fromFilePath, reExportModuleSpecifierText);\n\n if (resolvedPath !== undefined) {\n const nextSourceFile = parseFile(resolvedPath);\n return resolveClassDeclaration(name, nextSourceFile, resolvedPath, visited);\n }\n }\n\n return undefined;\n};\n","import type { Expression, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier } from 'typescript/unstable/ast';\nimport { readMapOperation } from './read-map-operation';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst RXJS_MODULE_SPECIFIERS = ['rxjs', 'rxjs/operators'];\nconst MAP_OPERATOR_NAME = 'map';\nconst SHAPE_NEUTRAL_OPERATOR_NAMES = ['tap', 'timeout', 'finalize'];\n\nexport const readPipeOperator = (operator: Expression, sourceFile: SourceFile) => {\n if (!isCallExpression(operator) || !isIdentifier(operator.expression)) {\n return {\n ok: false,\n node: operator,\n reason: 'Pipe operators must be calls of operators imported by name from rxjs.',\n } as const;\n }\n\n const importSource = findImportSource(sourceFile, operator.expression.text);\n\n if (\n importSource === undefined ||\n !RXJS_MODULE_SPECIFIERS.includes(importSource.moduleSpecifierText)\n ) {\n return {\n ok: false,\n node: operator,\n reason: `Operator \\`${operator.expression.text}\\` is not imported from rxjs, so its effect on the response shape is unknown.`,\n } as const;\n }\n\n if (importSource.importedName === MAP_OPERATOR_NAME) {\n return readMapOperation(operator);\n }\n\n if (SHAPE_NEUTRAL_OPERATOR_NAMES.includes(importSource.importedName)) {\n return { ok: true, operation: undefined } as const;\n }\n\n return {\n ok: false,\n node: operator,\n reason: `Operator \\`${importSource.importedName}\\` changes or hides the response shape.`,\n } as const;\n};\n","import type { Node } from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isClassDeclaration,\n isClassExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isMethodDeclaration,\n isReturnStatement,\n} from 'typescript/unstable/ast';\n\nconst isNestedFunctionScope = (node: Node) =>\n isArrowFunction(node) ||\n isFunctionExpression(node) ||\n isFunctionDeclaration(node) ||\n isMethodDeclaration(node) ||\n isClassDeclaration(node) ||\n isClassExpression(node);\n\nexport const containsReturnStatement = (node: Node) => {\n if (isReturnStatement(node)) {\n return true;\n }\n\n if (isNestedFunctionScope(node)) {\n return false;\n }\n\n let found = false;\n\n node.forEachChild((child) => {\n if (containsReturnStatement(child)) {\n found = true;\n }\n\n return undefined;\n });\n\n return found;\n};\n","import type { Block, Expression } from 'typescript/unstable/ast';\nimport { isIdentifier, isReturnStatement, isVariableStatement } from 'typescript/unstable/ast';\nimport { containsReturnStatement } from './contains-return-statement';\nimport { unwrapParenthesizedExpression } from './unwrap-parenthesized-expression';\n\n/**\n * Any statements may precede the final `return` (logger setup, `const startedAt = Date.now()`),\n * but none of them may return early, since the response shape would then depend on the branch.\n * A returned identifier resolves to the initializer of the `const` declared with that name.\n */\nexport const resolveInterceptReturnExpression = (body: Block) => {\n const finalStatement = body.statements[body.statements.length - 1];\n\n if (\n finalStatement === undefined ||\n !isReturnStatement(finalStatement) ||\n finalStatement.expression === undefined\n ) {\n return {\n ok: false,\n node: finalStatement ?? body,\n reason: 'The last statement of intercept() must be a `return` statement with a value.',\n } as const;\n }\n\n const localDeclarations = new Map<string, Expression>();\n\n for (const statement of body.statements) {\n if (statement === finalStatement) {\n continue;\n }\n\n if (containsReturnStatement(statement)) {\n return {\n ok: false,\n node: statement,\n reason:\n 'intercept() returns before its last statement, so the response shape is ambiguous.',\n } as const;\n }\n\n if (isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (isIdentifier(declaration.name) && declaration.initializer !== undefined) {\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n }\n }\n }\n\n const returned = unwrapParenthesizedExpression(finalStatement.expression);\n\n if (!isIdentifier(returned)) {\n return { ok: true, expression: returned } as const;\n }\n\n const initializer = localDeclarations.get(returned.text);\n\n return initializer === undefined\n ? ({\n ok: false,\n node: returned,\n reason: `\\`${returned.text}\\` is not a local \\`const\\` initialized inside intercept().`,\n } as const)\n : ({ ok: true, expression: unwrapParenthesizedExpression(initializer) } as const);\n};\n","import type { Expression, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport type { InterceptorShape } from './interceptor-shape';\nimport type { MapOperation } from './map-operation';\nimport { readPipeOperator } from './read-pipe-operator';\nimport { resolveInterceptReturnExpression } from './resolve-intercept-return-expression';\n\nconst HANDLE_MEMBER_NAME = 'handle';\nconst PIPE_MEMBER_NAME = 'pipe';\nconst CALL_HANDLER_PARAMETER_INDEX = 1;\n\nconst isHandleCall = (expression: Expression, callHandlerName: string) =>\n isCallExpression(expression) &&\n expression.arguments.length === 0 &&\n isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === HANDLE_MEMBER_NAME &&\n isIdentifier(expression.expression.expression) &&\n expression.expression.expression.text === callHandlerName;\n\nexport const analyzeInterceptMethod = (method: MethodDeclaration, sourceFile: SourceFile) => {\n const callHandler = method.parameters[CALL_HANDLER_PARAMETER_INDEX];\n\n if (method.body === undefined || callHandler === undefined || !isIdentifier(callHandler.name)) {\n return {\n ok: false,\n node: method,\n reason: 'intercept() must have a body and name its CallHandler parameter.',\n } as const;\n }\n\n const returned = resolveInterceptReturnExpression(method.body);\n\n if (!returned.ok) {\n return returned;\n }\n\n const callHandlerName = callHandler.name.text;\n const expression = returned.expression;\n\n if (isHandleCall(expression, callHandlerName)) {\n const shape: InterceptorShape = { operations: [] };\n return { ok: true, shape } as const;\n }\n\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n expression.expression.name.text !== PIPE_MEMBER_NAME ||\n !isHandleCall(expression.expression.expression, callHandlerName)\n ) {\n return {\n ok: false,\n node: expression,\n reason: `intercept() must return \\`${callHandlerName}.handle()\\`, optionally piped through rxjs operators.`,\n } as const;\n }\n\n const operations: MapOperation[] = [];\n\n for (const operator of expression.arguments) {\n const read = readPipeOperator(operator, sourceFile);\n\n if (!read.ok) {\n return read;\n }\n\n if (read.operation !== undefined) {\n operations.push(read.operation);\n }\n }\n\n const shape: InterceptorShape = { operations };\n return { ok: true, shape } as const;\n};\n","import type { ClassDeclaration, MethodDeclaration } from 'typescript/unstable/ast';\nimport { isIdentifier, isMethodDeclaration } from 'typescript/unstable/ast';\nimport { analyzeInterceptMethod } from './analyze-intercept-method';\nimport type { ResolvedTypeDeclaration } from './resolve-type-declaration';\n\nconst INTERCEPT_METHOD_NAME = 'intercept';\n\nconst findInterceptMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === INTERCEPT_METHOD_NAME,\n );\n\nexport const analyzeInterceptorClass = (resolved: ResolvedTypeDeclaration) => {\n const interceptMethod = findInterceptMethod(resolved.classDeclaration.members);\n\n if (interceptMethod === undefined) {\n return {\n ok: false,\n location: resolved.classDeclaration,\n found: undefined,\n reason: 'The class declares no intercept() method of its own.',\n } as const;\n }\n\n const analysis = analyzeInterceptMethod(interceptMethod, resolved.sourceFile);\n\n return analysis.ok\n ? analysis\n : ({\n ok: false,\n location: interceptMethod,\n found: analysis.node.getText(),\n reason: analysis.reason,\n } as const);\n};\n","import { WRAPPED_RESULT_SUBSTITUTION } from '../models/response-wrapper-substitution';\nimport type { InterceptorShape } from './interceptor-shape';\nimport { synthesizeGenericObjectType } from './synthesize-generic-object-type';\n\n/**\n * `shapes` run outermost first, so the type is built from the innermost interceptor outward,\n * starting at the awaited server result. Returns `undefined` when no interceptor changes the\n * shape.\n */\nexport const composeWrapperTypeSource = (shapes: readonly InterceptorShape[]) => {\n const operations = [...shapes].reverse().flatMap((shape) => shape.operations);\n\n if (operations.length === 0) {\n return undefined;\n }\n\n let typeSource = WRAPPED_RESULT_SUBSTITUTION;\n\n for (const operation of operations) {\n const synthesis = synthesizeGenericObjectType(\n operation.returnExpression,\n operation.parameterName,\n typeSource,\n );\n\n if (!synthesis.ok) {\n throw new Error(\n `[nestbridge] An interceptor shape that was validated can no longer be typed: ${synthesis.reason}`,\n );\n }\n\n typeSource = synthesis.typeSource;\n }\n\n return typeSource;\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\n\nexport const locationOf = (sourceFile: SourceFile, node: Node) => {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n return { line: line + 1, column: character + 1 };\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { locationOf } from './node-location';\n\ninterface InterceptorDiagnosticSource {\n controllerName: string;\n memberName: string;\n detail: string;\n found?: string;\n location: Node;\n sourceFile: SourceFile;\n filePath: string;\n}\n\nconst EXPECTED =\n 'An intercept() method that returns next.handle(), optionally piped through rxjs `map` ' +\n 'operators that return object literals and the shape-neutral `tap`, `timeout` and `finalize` ' +\n 'operators, registered as a class or `new Class()`. Routes under an interceptor that cannot ' +\n 'be analyzed are declared as AbortablePromise<unknown>.';\n\nexport const createInterceptorDiagnostic = (source: InterceptorDiagnosticSource) => {\n const location = locationOf(source.sourceFile, source.location);\n\n return {\n code: 'unsupported-interceptor',\n title: 'Unsupported interceptor.',\n controllerName: source.controllerName,\n memberName: source.memberName,\n detail: source.detail,\n found: source.found ?? source.location.getText(),\n expected: EXPECTED,\n filePath: source.filePath,\n line: location.line,\n column: location.column,\n } satisfies NestBridgeDiagnostic;\n};\n","import type {\n ClassDeclaration,\n Decorator,\n MethodDeclaration,\n ParameterDeclaration,\n PropertyDeclaration,\n} from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isDecorator,\n isIdentifier,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nconst getDecorators = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n) => {\n const decorators = node.modifiers?.filter(isDecorator);\n return decorators === undefined || decorators.length === 0 ? undefined : decorators;\n};\n\nexport const findDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorName: string,\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);\n};\n\nexport const findDecorators = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorName: string,\n) =>\n (getDecorators(node) ?? []).filter((decorator) => decoratorNameOf(decorator) === decoratorName);\n\nexport const hasAnyDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n) => getDecorators(node) !== undefined;\n\nexport const findAnyDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorNames: readonly string[],\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ''));\n};\n\nexport const decoratorNameOf = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (isCallExpression(expression) && isIdentifier(expression.expression)) {\n return expression.expression.text;\n }\n\n if (isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nexport const readStaticStringArgument = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true, value: undefined };\n }\n\n if (isStringLiteralLikeNode(firstArgument)) {\n return { ok: true, value: firstArgument.text };\n }\n\n return { ok: false, argumentText: firstArgument.getText() };\n};\n","import type { ClassDeclaration, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n} from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nconst MODULE_DECORATOR_NAME = 'Module';\n\nexport const hasModuleDecorator = (classDeclaration: ClassDeclaration) =>\n findDecorator(classDeclaration, MODULE_DECORATOR_NAME) !== undefined;\n\nexport const readModuleOption = (classDeclaration: ClassDeclaration, optionName: string) => {\n const moduleDecorator = findDecorator(classDeclaration, MODULE_DECORATOR_NAME);\n\n if (moduleDecorator === undefined || !isCallExpression(moduleDecorator.expression)) {\n return undefined;\n }\n\n const [moduleOptions] = moduleDecorator.expression.arguments;\n\n if (moduleOptions === undefined || !isObjectLiteralExpression(moduleOptions)) {\n return undefined;\n }\n\n return moduleOptions.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === optionName,\n );\n};\n","import type {\n ClassDeclaration,\n Node,\n ObjectLiteralExpression,\n PropertyAssignment,\n SourceFile,\n} from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSpreadElement,\n} from 'typescript/unstable/ast';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { readModuleOption } from './read-module-option';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst PROVIDERS_OPTION_NAME = 'providers';\nconst PROVIDE_PROPERTY_NAME = 'provide';\nconst USE_CLASS_PROPERTY_NAME = 'useClass';\nconst APP_INTERCEPTOR_LOCAL_NAME = 'APP_INTERCEPTOR';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\nconst UNSUPPORTED_PROVIDER_PROPERTY_NAMES = ['useFactory', 'useValue', 'useExisting'];\n\nconst findProperty = (provider: ObjectLiteralExpression, name: string) =>\n provider.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === name,\n );\n\nconst findUnsupportedProviderPropertyName = (provider: ObjectLiteralExpression) =>\n UNSUPPORTED_PROVIDER_PROPERTY_NAMES.find((name) => findProperty(provider, name) !== undefined);\n\n/**\n * Reads the `{ provide: APP_INTERCEPTOR, useClass: X }` providers of one module, in the order\n * they are declared. Only `useClass` can be analyzed: `useFactory`, `useValue`, `useExisting` and\n * spread providers are reported as problems because the interceptor behind them is unknown.\n */\nexport const findAppInterceptorProviderRegistrations = (\n moduleClassDeclaration: ClassDeclaration,\n moduleSourceFile: SourceFile,\n moduleFilePath: string,\n): InterceptorRegistrations => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const providersProperty = readModuleOption(moduleClassDeclaration, PROVIDERS_OPTION_NAME);\n const appInterceptorImportSource = findImportSource(moduleSourceFile, APP_INTERCEPTOR_LOCAL_NAME);\n\n if (\n providersProperty === undefined ||\n appInterceptorImportSource === undefined ||\n appInterceptorImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return registrations;\n }\n\n const reportProblem = (node: Node, detail: string) => {\n registrations.problems.push({\n node,\n sourceFile: moduleSourceFile,\n filePath: moduleFilePath,\n detail,\n });\n };\n\n if (!isArrayLiteralExpression(providersProperty.initializer)) {\n reportProblem(\n providersProperty.initializer,\n 'The `providers` of a module registering APP_INTERCEPTOR must be an array literal.',\n );\n return registrations;\n }\n\n for (const element of providersProperty.initializer.elements) {\n if (isSpreadElement(element)) {\n reportProblem(\n element,\n 'Spread providers cannot be analyzed, so an APP_INTERCEPTOR provider inside them would be missed.',\n );\n continue;\n }\n\n if (!isObjectLiteralExpression(element)) {\n continue;\n }\n\n const provideProperty = findProperty(element, PROVIDE_PROPERTY_NAME);\n\n if (\n provideProperty === undefined ||\n !isIdentifier(provideProperty.initializer) ||\n provideProperty.initializer.text !== APP_INTERCEPTOR_LOCAL_NAME\n ) {\n continue;\n }\n\n const unsupportedPropertyName = findUnsupportedProviderPropertyName(element);\n\n if (unsupportedPropertyName !== undefined) {\n reportProblem(\n element,\n `\\`${unsupportedPropertyName}\\` interceptor providers can't be analysed; use \\`useClass\\`.`,\n );\n continue;\n }\n\n const useClassProperty = findProperty(element, USE_CLASS_PROPERTY_NAME);\n\n if (useClassProperty === undefined || !isIdentifier(useClassProperty.initializer)) {\n reportProblem(\n element,\n 'An APP_INTERCEPTOR provider must state its interceptor as `useClass: InterceptorClass`.',\n );\n continue;\n }\n\n registrations.references.push({\n className: useClassProperty.initializer.text,\n node: useClassProperty.initializer,\n sourceFile: moduleSourceFile,\n filePath: moduleFilePath,\n });\n }\n\n return registrations;\n};\n","import { isArrayLiteralExpression, isIdentifier } from 'typescript/unstable/ast';\nimport { hasModuleDecorator, readModuleOption } from './read-module-option';\nimport { type ResolvedTypeDeclaration, resolveClassDeclaration } from './resolve-type-declaration';\n\nconst IMPORTS_OPTION_NAME = 'imports';\n\n/**\n * Only plain class identifiers that resolve to a local `@Module()` class are followed. Dynamic\n * modules such as `FooModule.forRoot()`, `forwardRef()` calls, spreads and package imports are\n * skipped because their providers cannot be read statically.\n */\nexport const readImportedModules = (module: ResolvedTypeDeclaration) => {\n const importsProperty = readModuleOption(module.classDeclaration, IMPORTS_OPTION_NAME);\n\n if (importsProperty === undefined || !isArrayLiteralExpression(importsProperty.initializer)) {\n return [];\n }\n\n const importedModules: ResolvedTypeDeclaration[] = [];\n\n for (const element of importsProperty.initializer.elements) {\n if (!isIdentifier(element)) {\n continue;\n }\n\n const resolved = resolveClassDeclaration(element.text, module.sourceFile, module.filePath);\n\n if (resolved !== undefined && hasModuleDecorator(resolved.classDeclaration)) {\n importedModules.push(resolved);\n }\n }\n\n return importedModules;\n};\n","import { findAppInterceptorProviderRegistrations } from './find-app-interceptor-provider-registrations';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { readImportedModules } from './read-imported-modules';\nimport type { ResolvedTypeDeclaration } from './resolve-type-declaration';\n\n/**\n * Nest scans modules depth-first starting at the root module, inserting a module before the\n * modules it imports, and a module reached twice keeps its first position. Registering the\n * `APP_INTERCEPTOR` providers module by module, each module's providers before its imports,\n * reproduces the order in which Nest adds them to the global interceptor list.\n */\nexport const collectModuleInterceptorRegistrations = (\n rootModule: ResolvedTypeDeclaration,\n contributingFiles: Set<string>,\n) => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const visitedModules = new Set<string>();\n\n const visit = (module: ResolvedTypeDeclaration) => {\n const moduleKey = `${module.filePath}#${module.classDeclaration.name?.text}`;\n\n if (visitedModules.has(moduleKey)) {\n return;\n }\n\n visitedModules.add(moduleKey);\n contributingFiles.add(module.filePath);\n\n const moduleRegistrations = findAppInterceptorProviderRegistrations(\n module.classDeclaration,\n module.sourceFile,\n module.filePath,\n );\n registrations.references.push(...moduleRegistrations.references);\n registrations.problems.push(...moduleRegistrations.problems);\n\n for (const importedModule of readImportedModules(module)) {\n visit(importedModule);\n }\n };\n\n visit(rootModule);\n\n return registrations;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\n\nconst USE_GLOBAL_INTERCEPTORS_METHOD_NAME = 'useGlobalInterceptors';\n\nconst collectUseGlobalInterceptorsCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_INTERCEPTORS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalInterceptorsCalls(child, calls);\n return undefined;\n });\n};\n\n/**\n * Returned in registration order: `useGlobalInterceptors` concatenates onto a single global\n * list, so a later call (or a later argument within one call) registers an interceptor that wraps\n * closer to the raw handler result.\n */\nexport const findBootstrapInterceptorRegistrations = (\n sourceFile: SourceFile,\n filePath: string,\n): InterceptorRegistrations => {\n const calls: CallExpression[] = [];\n collectUseGlobalInterceptorsCalls(sourceFile, calls);\n\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (isNewExpression(argument) && isIdentifier(argument.expression)) {\n registrations.references.push({\n className: argument.expression.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n registrations.problems.push({\n node: argument,\n sourceFile,\n filePath,\n detail:\n 'Global interceptors must be registered as `new InterceptorClass()` to be analyzed.',\n });\n }\n }\n\n return registrations;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst NEST_FACTORY_LOCAL_NAME = 'NestFactory';\nconst NEST_FACTORY_CREATE_METHOD_NAME = 'create';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nconst collectNestFactoryCreateCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n isIdentifier(node.expression.expression) &&\n node.expression.expression.text === NEST_FACTORY_LOCAL_NAME &&\n node.expression.name.text === NEST_FACTORY_CREATE_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectNestFactoryCreateCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findRootModuleClassName = (sourceFile: SourceFile) => {\n const nestFactoryImportSource = findImportSource(sourceFile, NEST_FACTORY_LOCAL_NAME);\n\n if (\n nestFactoryImportSource === undefined ||\n nestFactoryImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const calls: CallExpression[] = [];\n collectNestFactoryCreateCalls(sourceFile, calls);\n\n if (calls.length !== 1) {\n return undefined;\n }\n\n const [call] = calls;\n\n if (call === undefined) {\n return undefined;\n }\n\n const [moduleArgument] = call.arguments;\n\n return moduleArgument !== undefined && isIdentifier(moduleArgument)\n ? moduleArgument.text\n : undefined;\n};\n","import { collectModuleInterceptorRegistrations } from './collect-module-interceptor-registrations';\nimport { findBootstrapInterceptorRegistrations } from './find-bootstrap-interceptor-registrations';\nimport { findRootModuleClassName } from './find-root-module-class-name';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\n/**\n * The global interceptors in the order Nest runs them, outermost first: the `APP_INTERCEPTOR`\n * providers of the root module and of the local modules it imports, then the interceptors passed\n * to `useGlobalInterceptors()`.\n *\n * Verified against @nestjs/core 12.3.1: `NestFactory.create()` awaits `initialize()`, which calls\n * `DependenciesScanner.applyApplicationProviders()` (nest-factory.js line 108) and pushes every\n * `APP_INTERCEPTOR` instance onto the global list (scanner.js line 386,\n * application-config.js line 60). `useGlobalInterceptors()` can only run once `create()` has\n * returned, and it appends to the same list (application-config.js line 63). The first entry of\n * the list is the outermost interceptor. Request- and transient-scoped `APP_INTERCEPTOR`\n * providers are appended after all of them at request time and are not distinguished here.\n */\nexport const findGlobalInterceptorRegistrations = (\n bootstrapFilePath: string,\n contributingFiles: Set<string>,\n): InterceptorRegistrations => {\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n contributingFiles.add(bootstrapFilePath);\n\n const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);\n const rootModule =\n rootModuleClassName === undefined\n ? undefined\n : resolveClassDeclaration(rootModuleClassName, bootstrapSourceFile, bootstrapFilePath);\n\n const moduleRegistrations: InterceptorRegistrations =\n rootModule === undefined\n ? { references: [], problems: [] }\n : collectModuleInterceptorRegistrations(rootModule, contributingFiles);\n const bootstrapRegistrations = findBootstrapInterceptorRegistrations(\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n return {\n references: [...moduleRegistrations.references, ...bootstrapRegistrations.references],\n problems: [...moduleRegistrations.problems, ...bootstrapRegistrations.problems],\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier, isNewExpression } from 'typescript/unstable/ast';\nimport { findDecorators } from './decorator-inspection';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst USE_INTERCEPTORS_DECORATOR_NAME = 'UseInterceptors';\nconst NEST_COMMON_MODULE_SPECIFIER = '@nestjs/common';\n\n/**\n * Decorators are applied bottom-up and each one appends to the target's interceptor metadata, so\n * stacked `@UseInterceptors()` decorators contribute in reverse source order.\n */\nexport const findUseInterceptorsRegistrations = (\n target: ClassDeclaration | MethodDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n): InterceptorRegistrations => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const importSource = findImportSource(sourceFile, USE_INTERCEPTORS_DECORATOR_NAME);\n\n if (\n importSource === undefined ||\n importSource.moduleSpecifierText !== NEST_COMMON_MODULE_SPECIFIER ||\n importSource.importedName !== USE_INTERCEPTORS_DECORATOR_NAME\n ) {\n return registrations;\n }\n\n const decorators = findDecorators(target, USE_INTERCEPTORS_DECORATOR_NAME).reverse();\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) {\n continue;\n }\n\n for (const argument of decorator.expression.arguments) {\n if (isIdentifier(argument)) {\n registrations.references.push({\n className: argument.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n if (isNewExpression(argument) && isIdentifier(argument.expression)) {\n registrations.references.push({\n className: argument.expression.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n registrations.problems.push({\n node: argument,\n sourceFile,\n filePath,\n detail:\n '@UseInterceptors() arguments must be interceptor classes or `new InterceptorClass()` to be analyzed.',\n });\n }\n }\n\n return registrations;\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE } from '../models/response-wrapper-substitution';\nimport { analyzeInterceptorClass } from './analyze-interceptor-class';\nimport { composeWrapperTypeSource } from './compose-wrapper-type-source';\nimport type { ControllerInterceptors } from './controller-interceptors';\nimport { createInterceptorDiagnostic } from './create-interceptor-diagnostic';\nimport { findGlobalInterceptorRegistrations } from './find-global-interceptor-registrations';\nimport { findUseInterceptorsRegistrations } from './find-use-interceptors-registrations';\nimport type { InterceptorProblem } from './interceptor-problem';\nimport type { InterceptorReference } from './interceptor-reference';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport type { InterceptorShape } from './interceptor-shape';\nimport { locationOf } from './node-location';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst REGISTRATION_SUBJECT = '(interceptors)';\nconst INTERCEPT_MEMBER_NAME = 'intercept';\n\nexport interface InterceptorAnalysisOptions {\n bootstrapFilePath?: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\n/**\n * Resolves, for each JSON route, the interceptors that apply to it (global, then controller, then\n * route, outermost first) and the response shape they give it. Every interceptor class is\n * analyzed once and every problem is reported once, however many routes the interceptor reaches.\n * Global interceptors are only read when the first JSON route asks for them.\n */\nexport const createInterceptorAnalysis = (options: InterceptorAnalysisOptions) => {\n const { bootstrapFilePath, diagnostics } = options;\n const contributingFiles = new Set<string>();\n const shapesByInterceptor = new Map<string, InterceptorShape | undefined>();\n let globalRegistrations: InterceptorRegistrations | undefined;\n\n const reportRegistrationProblem = (problem: InterceptorProblem) => {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: REGISTRATION_SUBJECT,\n memberName: '',\n detail: problem.detail,\n location: problem.node,\n sourceFile: problem.sourceFile,\n filePath: problem.filePath,\n }),\n );\n };\n\n const reportUnresolvedReference = (reference: InterceptorReference) => {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: reference.className,\n memberName: '',\n detail:\n `Interceptor \\`${reference.className}\\` does not resolve to a class declared in a local ` +\n 'source file, so its effect on the response shape is unknown.',\n location: reference.node,\n sourceFile: reference.sourceFile,\n filePath: reference.filePath,\n }),\n );\n };\n\n const resolveShape = (reference: InterceptorReference) => {\n const resolved = resolveClassDeclaration(\n reference.className,\n reference.sourceFile,\n reference.filePath,\n );\n\n if (resolved === undefined) {\n const location = locationOf(reference.sourceFile, reference.node);\n const referenceKey = `${reference.filePath}:${location.line}:${location.column}`;\n\n if (!shapesByInterceptor.has(referenceKey)) {\n shapesByInterceptor.set(referenceKey, undefined);\n reportUnresolvedReference(reference);\n }\n\n return undefined;\n }\n\n contributingFiles.add(resolved.filePath);\n const interceptorKey = `${resolved.filePath}#${resolved.classDeclaration.name?.text}`;\n\n if (shapesByInterceptor.has(interceptorKey)) {\n return shapesByInterceptor.get(interceptorKey);\n }\n\n const analysis = analyzeInterceptorClass(resolved);\n\n if (!analysis.ok) {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: resolved.classDeclaration.name?.text ?? reference.className,\n memberName: INTERCEPT_MEMBER_NAME,\n detail: analysis.reason,\n found: analysis.found,\n location: analysis.location,\n sourceFile: resolved.sourceFile,\n filePath: resolved.filePath,\n }),\n );\n }\n\n const shape = analysis.ok ? analysis.shape : undefined;\n shapesByInterceptor.set(interceptorKey, shape);\n return shape;\n };\n\n const readGlobalRegistrations = () => {\n if (globalRegistrations === undefined) {\n globalRegistrations =\n bootstrapFilePath === undefined\n ? { references: [], problems: [] }\n : findGlobalInterceptorRegistrations(bootstrapFilePath, contributingFiles);\n globalRegistrations.problems.forEach(reportRegistrationProblem);\n }\n\n return globalRegistrations;\n };\n\n const forController = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n ) => {\n let controllerRegistrations: InterceptorRegistrations | undefined;\n\n const readControllerRegistrations = () => {\n if (controllerRegistrations === undefined) {\n controllerRegistrations = findUseInterceptorsRegistrations(\n classDeclaration,\n sourceFile,\n filePath,\n );\n controllerRegistrations.problems.forEach(reportRegistrationProblem);\n }\n\n return controllerRegistrations;\n };\n\n const responseWrapperOf = (method: MethodDeclaration) => {\n const methodRegistrations = findUseInterceptorsRegistrations(method, sourceFile, filePath);\n methodRegistrations.problems.forEach(reportRegistrationProblem);\n\n const chain = [readGlobalRegistrations(), readControllerRegistrations(), methodRegistrations];\n const shapes = chain.flatMap(({ references }) => references.map(resolveShape));\n const hasUnsupportedInterceptor =\n chain.some(({ problems }) => problems.length > 0) ||\n shapes.some((shape) => shape === undefined);\n\n if (hasUnsupportedInterceptor) {\n return { wrappedResultTypeSource: UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE };\n }\n\n const wrappedResultTypeSource = composeWrapperTypeSource(\n shapes.filter((shape) => shape !== undefined),\n );\n\n return wrappedResultTypeSource === undefined ? undefined : { wrappedResultTypeSource };\n };\n\n const interceptors: ControllerInterceptors = { responseWrapperOf };\n return interceptors;\n };\n\n return { forController, contributingFiles: () => [...contributingFiles] };\n};\n","export type GraphqlOperationKind = 'query' | 'mutation';\n\nexport const GRAPHQL_OPERATION_DECORATOR_NAMES: Record<string, GraphqlOperationKind> = {\n Query: 'query',\n Mutation: 'mutation',\n};\n","export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport const HTTP_METHOD_DECORATOR_NAMES: Record<string, HttpMethod> = {\n Get: 'GET',\n Post: 'POST',\n Put: 'PUT',\n Patch: 'PATCH',\n Delete: 'DELETE',\n};\n","export type MessageKind = 'event' | 'message';\n\nexport const MESSAGE_PATTERN_DECORATOR_NAMES: Record<string, MessageKind> = {\n EventPattern: 'event',\n MessagePattern: 'message',\n};\n","import type { MethodDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator, hasAnyDecorator } from './decorator-inspection';\n\nconst PAYLOAD_DECORATOR_NAME = 'Payload';\n\n/**\n * Nest passes the payload to the `@Payload()` parameter. Without decorators it passes it as the\n * first argument; once any parameter is decorated (`@Ctx()`, a custom decorator), undecorated\n * parameters receive nothing, so the handler takes no payload.\n */\nexport const findPayloadParameterIndex = (method: MethodDeclaration) => {\n const payloadIndex = method.parameters.findIndex(\n (parameter) => findDecorator(parameter, PAYLOAD_DECORATOR_NAME) !== undefined,\n );\n\n if (payloadIndex !== -1) {\n return payloadIndex;\n }\n\n if (method.parameters.length === 0 || method.parameters.some(hasAnyDecorator)) {\n return null;\n }\n\n return 0;\n};\n","import type { Node } from 'typescript/unstable/ast';\nimport type { Checker, Type } from 'typescript/unstable/sync';\nimport type { MessagePattern } from '../models/message-pattern';\n\nexport const readLiteralType = (\n type: Type,\n checker: Checker,\n location: Node,\n): MessagePattern | undefined => {\n if (type.isStringLiteralType() || type.isNumberLiteralType() || type.isBooleanLiteralType()) {\n return type.value;\n }\n\n if (!type.isObjectType()) {\n return undefined;\n }\n\n const pattern: Record<string, MessagePattern> = {};\n\n for (const property of checker.getPropertiesOfType(type)) {\n const value = readLiteralType(\n checker.getTypeOfSymbolAtLocation(property, location),\n checker,\n location,\n );\n\n if (value === undefined) {\n return undefined;\n }\n\n pattern[property.name] = value;\n }\n\n return pattern;\n};\n","import type { Expression, PropertyName } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { MessagePattern } from '../models/message-pattern';\nimport { readLiteralType } from './read-literal-type';\n\nconst readPropertyName = (name: PropertyName) => {\n if (isIdentifier(name) || isStringLiteralLikeNode(name) || isNumericLiteral(name)) {\n return name.text;\n }\n\n return undefined;\n};\n\n/**\n * Object literals are read from the syntax because the checker widens their property types\n * (`{ cmd: 'count' }` is `{ cmd: string }`). Everything else, including identifiers and property\n * accesses that point at `const` values or `as const` objects, is read from its literal type.\n */\nexport const readMessagePattern = (\n expression: Expression,\n checker: Checker,\n): MessagePattern | undefined => {\n if (isStringLiteralLikeNode(expression)) {\n return expression.text;\n }\n\n if (isNumericLiteral(expression)) {\n return Number(expression.text);\n }\n\n if (!isObjectLiteralExpression(expression)) {\n const type = checker.getTypeAtLocation(expression);\n return type === undefined ? undefined : readLiteralType(type, checker, expression);\n }\n\n const pattern: Record<string, MessagePattern> = {};\n\n for (const property of expression.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n const name = readPropertyName(property.name);\n const value = readMessagePattern(property.initializer, checker);\n\n if (name === undefined || value === undefined) {\n return undefined;\n }\n\n pattern[name] = value;\n }\n\n return pattern;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier } from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { NestBridgeDiagnostic } from '../diagnostics';\nimport { MESSAGE_PATTERN_DECORATOR_NAMES } from '../models';\nimport { decoratorNameOf, findAnyDecorator } from './decorator-inspection';\nimport { findPayloadParameterIndex } from './find-payload-parameter-index';\nimport { locationOf } from './node-location';\nimport { readMessagePattern } from './read-message-pattern';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n checker: Checker;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractMessageHandlerDefinition = (\n method: MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(MESSAGE_PATTERN_DECORATOR_NAMES));\n const decoratorName = decorator === undefined ? undefined : decoratorNameOf(decorator);\n const kind =\n decoratorName === undefined ? undefined : MESSAGE_PATTERN_DECORATOR_NAMES[decoratorName];\n\n if (decorator === undefined || kind === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const location = locationOf(context.sourceFile, method);\n const [patternArgument] = isCallExpression(decorator.expression)\n ? decorator.expression.arguments\n : [];\n\n const reportUnsupported = (detail: string) => {\n context.diagnostics.push({\n code: 'unsupported-message-pattern',\n title: 'Unsupported message pattern.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail,\n found: `@${decoratorName}(${patternArgument?.getText() ?? ''})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n };\n\n if (!isIdentifier(method.name)) {\n return reportUnsupported('Message handlers need a plain identifier method name.');\n }\n\n if (patternArgument === undefined) {\n return reportUnsupported(`@${decoratorName}() needs a pattern.`);\n }\n\n const pattern = readMessagePattern(patternArgument, context.checker);\n\n if (pattern === undefined) {\n return reportUnsupported(\n 'Message patterns must be statically known: a string or number literal, an object literal of those, or a const value (use \"as const\" for objects).',\n );\n }\n\n return {\n name: methodName,\n kind,\n pattern,\n payloadParameterIndex: findPayloadParameterIndex(method),\n line: location.line,\n column: location.column,\n };\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ControllerParameterDefinition } from '../models/controller-parameter-definition';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n hasAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { locationOf } from './node-location';\n\nconst SUPPORTED_PARAMETER_DECORATORS = ['Param', 'Query', 'Body', 'Headers'] as const;\nconst KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = ['Req', 'Res', 'Request', 'Response'] as const;\n\nconst TRANSPORT_PARAMETER_DECORATORS = [\n ...SUPPORTED_PARAMETER_DECORATORS,\n ...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS,\n];\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const isServerResolvedParameter = (parameter: ParameterDeclaration) =>\n hasAnyDecorator(parameter) &&\n findAnyDecorator(parameter, TRANSPORT_PARAMETER_DECORATORS) === undefined;\n\nexport const extractParameterDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ControllerParameterDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, TRANSPORT_PARAMETER_DECORATORS);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorName = decoratorNameOf(decorator);\n\n if (\n decoratorName !== undefined &&\n (KNOWN_UNSUPPORTED_PARAMETER_DECORATORS as readonly string[]).includes(decoratorName)\n ) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge HTTP client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,\n found: `@${decoratorName}(${argument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const base = {\n index,\n parameterName: parameter.name.text,\n };\n\n if (decoratorName === 'Param') {\n return { ...base, kind: 'param', name: argument.value };\n }\n\n if (decoratorName === 'Headers') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Headers() is not supported; provide a header name such as @Headers('x-example').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'header', name: argument.value };\n }\n\n if (decoratorName === 'Query') {\n return { ...base, kind: 'query', name: argument.value };\n }\n\n return { ...base, kind: 'body', name: argument.value };\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport { isLiteralTypeNode, SyntaxKind } from 'typescript/unstable/ast';\n\nexport const isNullishTypeNode = (typeNode: TypeNode) =>\n typeNode.kind === SyntaxKind.UndefinedKeyword ||\n typeNode.kind === SyntaxKind.NullKeyword ||\n (isLiteralTypeNode(typeNode) && typeNode.literal.kind === SyntaxKind.NullKeyword);\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport {\n isArrayTypeNode,\n isIdentifier,\n isTypeReferenceNode,\n isUnionTypeNode,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nimport { isNullishTypeNode } from './is-nullish-type-node';\n\nconst PRIMITIVE_SCALAR_TYPES: Record<string, string> = {\n string: 'String',\n number: 'Float',\n boolean: 'Boolean',\n};\n\nexport interface UnwrappedTypeNode {\n identifierText: string;\n isArray: boolean;\n isNullable: boolean;\n}\n\nexport const unwrapPromise = (typeNode: TypeNode): TypeNode => {\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Promise' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return unwrapPromise(typeNode.typeArguments[0]);\n }\n\n return typeNode;\n};\n\nconst unwrapNullable = (typeNode: TypeNode) => {\n if (!isUnionTypeNode(typeNode)) {\n return { inner: typeNode, isNullable: false };\n }\n\n const nonNullMembers = typeNode.types.filter((member) => !isNullishTypeNode(member));\n const [onlyMember] = nonNullMembers;\n\n if (nonNullMembers.length !== 1 || onlyMember === undefined) {\n return { inner: typeNode, isNullable: nonNullMembers.length !== typeNode.types.length };\n }\n\n return { inner: onlyMember, isNullable: true };\n};\n\nconst unwrapArrayElement = (typeNode: TypeNode): TypeNode | undefined => {\n if (isArrayTypeNode(typeNode)) {\n return typeNode.elementType;\n }\n\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Array' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return typeNode.typeArguments[0];\n }\n\n return undefined;\n};\n\nconst identifierTextOf = (typeNode: TypeNode): string | undefined => {\n if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n\n switch (typeNode.kind) {\n case SyntaxKind.StringKeyword:\n return 'string';\n case SyntaxKind.NumberKeyword:\n return 'number';\n case SyntaxKind.BooleanKeyword:\n return 'boolean';\n default:\n return undefined;\n }\n};\n\nexport const unwrapTypeNode = (typeNode: TypeNode): UnwrappedTypeNode | undefined => {\n const withoutPromise = unwrapPromise(typeNode);\n const { inner: withoutNullable, isNullable } = unwrapNullable(withoutPromise);\n const arrayElement = unwrapArrayElement(withoutNullable);\n const element = arrayElement === undefined ? withoutNullable : unwrapNullable(arrayElement).inner;\n const identifierText = identifierTextOf(element);\n\n if (identifierText === undefined) {\n return undefined;\n }\n\n return { identifierText, isArray: arrayElement !== undefined, isNullable };\n};\n\nexport const graphqlScalarNameFor = (identifierText: string) =>\n PRIMITIVE_SCALAR_TYPES[identifierText] ?? identifierText;\n\nexport const graphqlTypeStringFor = (unwrapped: UnwrappedTypeNode, explicitTypeName?: string) => {\n const baseName = explicitTypeName ?? graphqlScalarNameFor(unwrapped.identifierText);\n const wrapped = unwrapped.isArray ? `[${baseName}!]` : baseName;\n return unwrapped.isNullable ? wrapped : `${wrapped}!`;\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport { isIdentifier, isTypeReferenceNode } from 'typescript/unstable/ast';\nimport type { ResponseKind } from '../models/response-kind';\nimport { unwrapPromise } from './graphql-scalar-type';\n\nconst OBSERVABLE_TYPE_NAME = 'Observable';\nconst STREAMABLE_FILE_TYPE_NAME = 'StreamableFile';\n\nexport const readResponseKind = (returnType: TypeNode | undefined): ResponseKind => {\n if (returnType === undefined) {\n return 'json';\n }\n\n const unwrapped = unwrapPromise(returnType);\n\n if (!isTypeReferenceNode(unwrapped) || !isIdentifier(unwrapped.typeName)) {\n return 'json';\n }\n\n if (unwrapped.typeName.text === OBSERVABLE_TYPE_NAME) {\n return 'observable';\n }\n\n if (unwrapped.typeName.text === STREAMABLE_FILE_TYPE_NAME) {\n return 'stream';\n }\n\n return 'json';\n};\n","import type { Expression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nconst VERSION_NEUTRAL_NAME = 'VERSION_NEUTRAL';\n\nconst readSingleRouteVersion = (expression: Expression) => {\n if (isStringLiteralLikeNode(expression)) {\n return { ok: true as const, version: expression.text };\n }\n\n if (isIdentifier(expression) && expression.text === VERSION_NEUTRAL_NAME) {\n return { ok: true as const, version: null };\n }\n\n return { ok: false as const, argumentText: expression.getText() };\n};\n\n/**\n * An array of versions registers the route once per version, so any one of them is a valid URL;\n * the first is used.\n */\nexport const readRouteVersion = (expression: Expression) => {\n if (!isArrayLiteralExpression(expression)) {\n return readSingleRouteVersion(expression);\n }\n\n const [firstElement] = expression.elements;\n\n return firstElement === undefined\n ? { ok: false as const, argumentText: expression.getText() }\n : readSingleRouteVersion(firstElement);\n};\n","const trimSlashes = (segment: string) => segment.replace(/^\\/+/, '').replace(/\\/+$/, '');\n\nexport const joinRoutePath = (controllerPath: string, methodPath: string | undefined) => {\n const segments = [trimSlashes(controllerPath), trimSlashes(methodPath ?? '')].filter(\n (segment) => segment.length > 0,\n );\n\n return `/${segments.join('/')}`;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics';\nimport { HTTP_METHOD_DECORATOR_NAMES } from '../models';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n findDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport {\n extractParameterDefinition,\n isServerResolvedParameter,\n} from './extract-parameter-definition';\nimport { locationOf } from './node-location';\nimport { readResponseKind } from './read-response-kind';\nimport { readRouteVersion } from './read-route-version';\nimport { joinRoutePath } from './route-path';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n controllerPath: string;\n controllerVersion: string | null | undefined;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nconst VERSION_DECORATOR_NAME = 'Version';\n\nconst readMethodVersion = (method: MethodDeclaration, context: ExtractionContext) => {\n const decorator = findDecorator(method, VERSION_DECORATOR_NAME);\n\n if (decorator === undefined) {\n return { value: context.controllerVersion };\n }\n\n const [argument] = isCallExpression(decorator.expression) ? decorator.expression.arguments : [];\n const routeVersion = argument === undefined ? undefined : readRouteVersion(argument);\n\n if (routeVersion?.ok === true) {\n return { value: routeVersion.version };\n }\n\n const location = locationOf(context.sourceFile, method);\n\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: method.name.getText(),\n detail: 'Route versions must be statically analyzable.',\n found: `@Version(${routeVersion?.argumentText ?? ''})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n};\n\nexport const extractMethodDefinition = (method: MethodDeclaration, context: ExtractionContext) => {\n const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];\n\n if (httpMethod === undefined) {\n return undefined;\n }\n\n const routeArgument = readStaticStringArgument(decorator);\n\n if (!routeArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail: 'Route paths must be statically analyzable.',\n found: `@${decoratorName}(${routeArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const version = readMethodVersion(method, context);\n\n if (version === undefined) {\n return undefined;\n }\n\n const serverOnlyParameterIndexes = method.parameters.flatMap((parameter, index) =>\n isServerResolvedParameter(parameter) ? [index] : [],\n );\n\n const parameters = method.parameters.map((parameter, index) =>\n serverOnlyParameterIndexes.includes(index)\n ? null\n : extractParameterDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n controllerName: context.controllerName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (parameters.some((parameter) => parameter === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n httpMethod,\n path: joinRoutePath(context.controllerPath, routeArgument.value),\n version: version.value,\n parameters: parameters.filter((parameter) => parameter !== undefined && parameter !== null),\n serverOnlyParameterIndexes,\n responseKind: readResponseKind(method.type),\n line: location.line,\n column: location.column,\n };\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport { readRouteVersion } from './read-route-version';\n\nconst PATH_OPTION_NAME = 'path';\nconst VERSION_OPTION_NAME = 'version';\n\nconst optionNameOf = (property: PropertyAssignment) => {\n const name = property.name;\n return isIdentifier(name) || isStringLiteralLikeNode(name) ? name.text : undefined;\n};\n\nexport const readControllerOptions = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true as const, path: undefined, version: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true as const, path: undefined, version: undefined };\n }\n\n if (isStringLiteralLikeNode(firstArgument)) {\n return { ok: true as const, path: firstArgument.text, version: undefined };\n }\n\n if (!isObjectLiteralExpression(firstArgument)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n let path: string | undefined;\n let version: string | null | undefined;\n\n for (const property of firstArgument.properties) {\n if (!isPropertyAssignment(property)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n const optionName = optionNameOf(property);\n\n if (optionName === PATH_OPTION_NAME) {\n if (!isStringLiteralLikeNode(property.initializer)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n path = property.initializer.text;\n }\n\n if (optionName === VERSION_OPTION_NAME) {\n const routeVersion = readRouteVersion(property.initializer);\n\n if (!routeVersion.ok) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n version = routeVersion.version;\n }\n }\n\n return { ok: true as const, path, version };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { findDecorator } from './decorator-inspection';\nimport { extractMessageHandlerDefinition } from './extract-message-handler-definition';\nimport { extractMethodDefinition } from './extract-method-definition';\nimport { locationOf } from './node-location';\nimport { readControllerOptions } from './read-controller-options';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n checker: Checker;\n messagePatterns: boolean;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractControllerDefinition = (\n classDeclaration: ClassDeclaration,\n context: ExtractionContext,\n) => {\n const { sourceFile, filePath, diagnostics } = context;\n const controllerName = classDeclaration.name?.text ?? '(anonymous controller)';\n const decorator = findDecorator(classDeclaration, 'Controller');\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const location = locationOf(sourceFile, classDeclaration);\n const options = readControllerOptions(decorator);\n\n if (!options.ok) {\n diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName,\n memberName: '',\n detail: 'Controller paths and versions must be statically analyzable.',\n found: `@Controller(${options.argumentText})`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const memberMethods = classDeclaration.members.filter((member): member is MethodDeclaration =>\n isMethodDeclaration(member),\n );\n\n const methods = memberMethods\n .map((method) =>\n extractMethodDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n controllerPath: options.path ?? '',\n controllerVersion: options.version,\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n const messageHandlers = context.messagePatterns\n ? memberMethods\n .map((method) =>\n extractMessageHandlerDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n checker: context.checker,\n diagnostics,\n }),\n )\n .filter((handler) => handler !== undefined)\n : [];\n\n return {\n name: controllerName,\n path: options.path ?? '',\n sourceFile: filePath,\n methods,\n messageHandlers,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findControllerClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Controller') !== undefined,\n );\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type {\n ControllerAnalysisOptions,\n ControllerAnalysisResult,\n ControllerDefinition,\n} from '../models';\nimport { attachResponseWrappers } from './attach-response-wrappers';\nimport { createInterceptorAnalysis } from './create-interceptor-analysis';\nimport { extractControllerDefinition } from './extract-controller-definition';\nimport { findControllerClasses } from './find-controller-classes';\nimport { openSourceFile } from './open-source-file';\nimport { clearParsedFileCache } from './resolve-type-declaration';\n\nexport const analyzeControllers = (\n filePaths: readonly string[],\n options: ControllerAnalysisOptions = {},\n): ControllerAnalysisResult => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const controllers: ControllerDefinition[] = [];\n const interceptors = createInterceptorAnalysis({\n bootstrapFilePath: options.bootstrapFilePath,\n diagnostics,\n });\n\n clearParsedFileCache();\n\n for (const filePath of filePaths) {\n const { sourceFile, checker } = openSourceFile(filePath);\n\n const extractedControllers = findControllerClasses(sourceFile).map((classDeclaration) => ({\n classDeclaration,\n controller: extractControllerDefinition(classDeclaration, {\n sourceFile,\n filePath,\n checker,\n messagePatterns: options.messagePatterns ?? false,\n diagnostics,\n }),\n }));\n\n for (const { classDeclaration, controller } of extractedControllers) {\n if (controller !== undefined) {\n controllers.push(\n attachResponseWrappers(\n controller,\n classDeclaration,\n interceptors.forController(classDeclaration, sourceFile, filePath),\n ),\n );\n }\n }\n }\n\n return { controllers, diagnostics, interceptorFiles: interceptors.contributingFiles() };\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nexport const readArgsNullableOption = (decorator: Decorator) => {\n if (!isCallExpression(decorator.expression)) {\n return false;\n }\n\n const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);\n\n const nullableProperty = optionsArgument?.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'nullable',\n );\n\n return nullableProperty?.initializer.kind === SyntaxKind.TrueKeyword;\n};\n","import type { ArrowFunction, Expression, FunctionExpression } from 'typescript/unstable/ast';\nimport { isBlock, isReturnStatement } from 'typescript/unstable/ast';\n\nexport const readTypeThunkExpression = (\n thunk: ArrowFunction | FunctionExpression,\n): Expression | undefined => {\n if (!isBlock(thunk.body)) {\n return thunk.body;\n }\n\n const returnStatement = thunk.body.statements.find(isReturnStatement);\n return returnStatement?.expression;\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport interface ArgsTypeOption {\n typeName: string;\n isArray: boolean;\n}\n\nexport const readArgsTypeOption = (decorator: Decorator): ArgsTypeOption | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);\n\n if (optionsArgument === undefined) {\n return undefined;\n }\n\n const typeProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'type',\n );\n\n if (typeProperty === undefined) {\n return undefined;\n }\n\n const thunk = typeProperty.initializer;\n\n if (!isArrowFunction(thunk) && !isFunctionExpression(thunk)) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element)\n ? { typeName: element.text, isArray: true }\n : undefined;\n }\n\n return isIdentifier(returnedExpression)\n ? { typeName: returnedExpression.text, isArray: false }\n : undefined;\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ResolverArgumentDefinition } from '../models/resolver-argument-definition';\nimport { findAnyDecorator, readStaticStringArgument } from './decorator-inspection';\nimport { graphqlTypeStringFor, unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readArgsNullableOption } from './read-args-nullable-option';\nimport { readArgsTypeOption } from './read-args-type-option';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverArgumentDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ResolverArgumentDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, ['Args']);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with @Args to be transported through a NestBridge GraphQL client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge GraphQL client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nameArgument = readStaticStringArgument(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: '@Args() name must be a statically analyzable string literal.',\n found: `@Args(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (nameArgument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: \"A whole @Args() is not supported; provide an argument name such as @Args('id').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (parameter.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" needs an explicit type annotation.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(parameter.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" has a type NestBridge cannot statically resolve to a GraphQL type.`,\n found: parameter.type.getText(),\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const explicitType = readArgsTypeOption(decorator);\n const isNullable = unwrapped.isNullable || readArgsNullableOption(decorator);\n\n return {\n index,\n parameterName: parameter.name.text,\n name: nameArgument.value,\n graphqlType: graphqlTypeStringFor({ ...unwrapped, isNullable }, explicitType?.typeName),\n };\n};\n","import type { ClassDeclaration, PropertyDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier, isPropertyDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { SelectionField } from '../models/selection-field';\nimport { findDecorator } from './decorator-inspection';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface SelectionContext {\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n visitedTypeNames: Set<string>;\n}\n\nexport const extractSelectionFields = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n context: SelectionContext,\n): SelectionField[] | undefined => {\n const typeName = classDeclaration.name?.text ?? '(anonymous type)';\n const location = locationOf(sourceFile, classDeclaration);\n\n if (context.visitedTypeNames.has(typeName)) {\n context.diagnostics.push({\n code: 'circular-type',\n title: 'Circular type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Type \"${typeName}\" references itself, directly or indirectly. NestBridge cannot build a finite GraphQL selection set for it.`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nextVisited = new Set(context.visitedTypeNames).add(typeName);\n\n const properties = classDeclaration.members.filter(\n (member): member is PropertyDeclaration =>\n isPropertyDeclaration(member) && findDecorator(member, 'Field') !== undefined,\n );\n\n const fields: SelectionField[] = [];\n\n for (const property of properties) {\n if (!isIdentifier(property.name)) {\n continue;\n }\n\n const fieldName = property.name.text;\n const fieldLocation = locationOf(sourceFile, property);\n\n if (property.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" needs an explicit type annotation.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(property.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" has a type NestBridge cannot statically resolve.`,\n found: property.type.getText(),\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n if (PRIMITIVE_SCALAR_NAMES.has(unwrapped.identifierText)) {\n fields.push({ name: fieldName });\n continue;\n }\n\n const resolved = resolveClassDeclaration(unwrapped.identifierText, sourceFile, filePath);\n\n if (resolved === undefined) {\n fields.push({ name: fieldName });\n continue;\n }\n\n if (findDecorator(resolved.classDeclaration, 'ObjectType') === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" resolves to class \"${unwrapped.identifierText}\", which is not decorated with @ObjectType(). NestBridge cannot build a GraphQL selection set for it.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const children = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n ...context,\n visitedTypeNames: nextVisited,\n },\n );\n\n if (children === undefined) {\n return undefined;\n }\n\n fields.push({ name: fieldName, children });\n }\n\n return fields;\n};\n","import type {\n Decorator,\n ObjectLiteralExpression,\n PropertyAssignment,\n} from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nexport interface ReadGraphqlOperationNameResult {\n ok: boolean;\n value?: string;\n argumentText?: string;\n}\n\nconst readNameFromOptions = (optionsArgument: ObjectLiteralExpression) => {\n const nameProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'name',\n );\n\n if (nameProperty === undefined || !isStringLiteralLikeNode(nameProperty.initializer)) {\n return undefined;\n }\n\n return nameProperty.initializer.text;\n};\n\nexport const readGraphqlOperationName = (decorator: Decorator): ReadGraphqlOperationNameResult => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n let value: string | undefined;\n\n for (const argument of expression.arguments) {\n if (isArrowFunction(argument) || isFunctionExpression(argument)) {\n continue;\n }\n\n if (isStringLiteralLikeNode(argument)) {\n value = argument.text;\n continue;\n }\n\n if (isObjectLiteralExpression(argument)) {\n value = readNameFromOptions(argument) ?? value;\n continue;\n }\n\n return { ok: false, argumentText: argument.getText() };\n }\n\n return { ok: true, value };\n};\n","import type { ArrowFunction, Decorator, FunctionExpression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport const readGraphqlReturnTypeOption = (decorator: Decorator): string | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const thunk = decorator.expression.arguments.find(\n (argument): argument is ArrowFunction | FunctionExpression =>\n isArrowFunction(argument) || isFunctionExpression(argument),\n );\n\n if (thunk === undefined) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element) ? element.text : undefined;\n }\n\n return isIdentifier(returnedExpression) ? returnedExpression.text : undefined;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { GRAPHQL_OPERATION_DECORATOR_NAMES } from '../models/graphql-operation-kind';\nimport type { SelectionField } from '../models/selection-field';\nimport { decoratorNameOf, findAnyDecorator } from './decorator-inspection';\nimport { extractResolverArgumentDefinition } from './extract-resolver-argument-definition';\nimport { extractSelectionFields } from './extract-selection-fields';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readGraphqlOperationName } from './read-graphql-operation-name';\nimport { readGraphqlReturnTypeOption } from './read-graphql-return-type-option';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverMethodDefinition = (\n method: MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(GRAPHQL_OPERATION_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const operationKind = GRAPHQL_OPERATION_DECORATOR_NAMES[decoratorName];\n\n if (operationKind === undefined) {\n return undefined;\n }\n\n const nameArgument = readGraphqlOperationName(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported operation name.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: 'GraphQL operation names must be statically analyzable string literals.',\n found: `@${decoratorName}(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorReturnType = readGraphqlReturnTypeOption(decorator);\n const identifierText =\n decoratorReturnType ??\n (method.type === undefined ? undefined : unwrapTypeNode(method.type)?.identifierText);\n\n if (identifierText === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail:\n 'GraphQL resolver methods need a type thunk on @Query()/@Mutation() (e.g. \"() => UserType\") or an explicit return type annotation so NestBridge can build a selection set.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n let selection: SelectionField[] = [];\n\n if (!PRIMITIVE_SCALAR_NAMES.has(identifierText.toLowerCase())) {\n const resolved = resolveClassDeclaration(identifierText, context.sourceFile, context.filePath);\n\n if (resolved === undefined && decoratorReturnType === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: `NestBridge could not locate the declaration of type \"${identifierText}\".`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (resolved !== undefined) {\n const fields = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n visitedTypeNames: new Set(),\n },\n );\n\n if (fields === undefined) {\n return undefined;\n }\n\n selection = fields;\n }\n }\n\n const args = method.parameters.map((parameter, index) =>\n extractResolverArgumentDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (args.some((argument) => argument === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n operationKind,\n operationName: nameArgument.value ?? methodName,\n arguments: args.filter((argument) => argument !== undefined),\n selection,\n line: location.line,\n column: location.column,\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { extractResolverMethodDefinition } from './extract-resolver-method-definition';\n\nexport const extractResolverDefinition = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n diagnostics: NestBridgeDiagnostic[],\n) => {\n const resolverName = classDeclaration.name?.text ?? '(anonymous resolver)';\n\n const methods = classDeclaration.members\n .filter((member): member is MethodDeclaration => isMethodDeclaration(member))\n .map((method) =>\n extractResolverMethodDefinition(method, {\n sourceFile,\n filePath,\n resolverName,\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n return {\n name: resolverName,\n sourceFile: filePath,\n methods,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findResolverClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Resolver') !== undefined,\n );\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type { ResolverAnalysisResult, ResolverDefinition } from '../models';\nimport { extractResolverDefinition } from './extract-resolver-definition';\nimport { findResolverClasses } from './find-resolver-classes';\nimport { parseSourceFile } from './parse-source-file';\n\nexport const analyzeResolvers = (filePaths: readonly string[]): ResolverAnalysisResult => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const resolvers: ResolverDefinition[] = [];\n\n for (const filePath of filePaths) {\n const sourceFile = parseSourceFile(filePath);\n\n for (const classDeclaration of findResolverClasses(sourceFile)) {\n const resolver = extractResolverDefinition(\n classDeclaration,\n sourceFile,\n filePath,\n diagnostics,\n );\n\n if (resolver !== undefined) {\n resolvers.push(resolver);\n }\n }\n }\n\n return { resolvers, diagnostics };\n};\n","import type { ApplicationRouting } from '../models/application-routing';\nimport type { ControllerDefinition } from '../models/controller-definition';\nimport type { ControllerMethodDefinition } from '../models/controller-method-definition';\nimport type { GlobalPrefix } from '../models/global-prefix';\nimport type { GlobalPrefixExclusion } from '../models/global-prefix-exclusion';\nimport type { UriVersioning } from '../models/uri-versioning';\n\nconst splitSegments = (path: string) => path.split('/').filter((segment) => segment.length > 0);\n\nconst matchesExclusionPath = (pattern: string, path: string) => {\n const patternSegments = splitSegments(pattern);\n const pathSegments = splitSegments(path);\n\n for (const [index, patternSegment] of patternSegments.entries()) {\n if (patternSegment.startsWith('*')) {\n return pathSegments.length > index;\n }\n\n const pathSegment = pathSegments[index];\n\n if (pathSegment === undefined) {\n return false;\n }\n\n if (!patternSegment.startsWith(':') && patternSegment !== pathSegment) {\n return false;\n }\n }\n\n return patternSegments.length === pathSegments.length;\n};\n\nconst isExcluded = (exclusion: GlobalPrefixExclusion, method: ControllerMethodDefinition) =>\n (exclusion.httpMethod === undefined || exclusion.httpMethod === method.httpMethod) &&\n matchesExclusionPath(exclusion.path, method.path);\n\nconst prefixSegmentFor = (\n method: ControllerMethodDefinition,\n globalPrefix: GlobalPrefix | undefined,\n) => {\n if (globalPrefix === undefined || splitSegments(globalPrefix.prefix).length === 0) {\n return '';\n }\n\n if (globalPrefix.exclude.some((exclusion) => isExcluded(exclusion, method))) {\n return '';\n }\n\n return `/${splitSegments(globalPrefix.prefix).join('/')}`;\n};\n\nconst versionSegmentFor = (\n method: ControllerMethodDefinition,\n versioning: UriVersioning | undefined,\n) => {\n if (versioning === undefined || method.version === null) {\n return '';\n }\n\n const version = method.version ?? versioning.defaultVersion;\n return version === undefined ? '' : `/${versioning.prefix}${version}`;\n};\n\nconst joinRoutedPath = (...parts: string[]) => `/${splitSegments(parts.join('/')).join('/')}`;\n\nconst routeMethod = (method: ControllerMethodDefinition, routing: ApplicationRouting) => ({\n ...method,\n path: joinRoutedPath(\n prefixSegmentFor(method, routing.globalPrefix),\n versionSegmentFor(method, routing.versioning),\n method.path,\n ),\n});\n\nexport const applyApplicationRouting = (\n controllers: readonly ControllerDefinition[],\n routing: ApplicationRouting,\n): ControllerDefinition[] =>\n controllers.map((controller) => ({\n ...controller,\n methods: controller.methods.map((method) => routeMethod(method, routing)),\n }));\n","import type { ClassDeclaration, PropertyAssignment, SourceFile } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSpreadElement,\n} from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst MODULE_DECORATOR_NAME = 'Module';\nconst PROVIDERS_PROPERTY_NAME = 'providers';\nconst PROVIDE_PROPERTY_NAME = 'provide';\nconst USE_CLASS_PROPERTY_NAME = 'useClass';\nconst APP_FILTER_LOCAL_NAME = 'APP_FILTER';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nexport const findAppFilterProviderClassName = (\n moduleClassDeclaration: ClassDeclaration,\n moduleSourceFile: SourceFile,\n) => {\n const moduleDecorator = findDecorator(moduleClassDeclaration, MODULE_DECORATOR_NAME);\n\n if (moduleDecorator === undefined || !isCallExpression(moduleDecorator.expression)) {\n return undefined;\n }\n\n const [moduleOptions] = moduleDecorator.expression.arguments;\n\n if (moduleOptions === undefined || !isObjectLiteralExpression(moduleOptions)) {\n return undefined;\n }\n\n const providersProperty = moduleOptions.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDERS_PROPERTY_NAME,\n );\n\n if (providersProperty === undefined || !isArrayLiteralExpression(providersProperty.initializer)) {\n return undefined;\n }\n\n const appFilterImportSource = findImportSource(moduleSourceFile, APP_FILTER_LOCAL_NAME);\n\n if (\n appFilterImportSource === undefined ||\n appFilterImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const element of providersProperty.initializer.elements) {\n if (isSpreadElement(element)) {\n return undefined;\n }\n\n if (!isObjectLiteralExpression(element)) {\n continue;\n }\n\n const provideProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDE_PROPERTY_NAME,\n );\n\n if (\n provideProperty === undefined ||\n !isIdentifier(provideProperty.initializer) ||\n provideProperty.initializer.text !== APP_FILTER_LOCAL_NAME\n ) {\n continue;\n }\n\n const useClassProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === USE_CLASS_PROPERTY_NAME,\n );\n\n if (useClassProperty === undefined || !isIdentifier(useClassProperty.initializer)) {\n return undefined;\n }\n\n classNames.add(useClassProperty.initializer.text);\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\n\nconst USE_GLOBAL_FILTERS_METHOD_NAME = 'useGlobalFilters';\n\nconst collectUseGlobalFiltersCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_FILTERS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalFiltersCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findGlobalFilterClassName = (sourceFile: SourceFile) => {\n const calls: CallExpression[] = [];\n collectUseGlobalFiltersCalls(sourceFile, calls);\n\n if (calls.length === 0) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (!isNewExpression(argument) || !isIdentifier(argument.expression)) {\n return undefined;\n }\n\n classNames.add(argument.expression.text);\n }\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { Expression, MethodDeclaration } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isExpressionStatement,\n isIdentifier,\n isPropertyAccessExpression,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\n\nexport interface CatchMethodBodyResolution {\n exceptionParameterName: string;\n localDeclarations: Map<string, Expression>;\n responseBodyArgument: Expression;\n}\n\nconst RESPONSE_BODY_CALL_NAMES = new Set(['json', 'send']);\n\nconst matchResponseBodyArgument = (expression: Expression) => {\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n !RESPONSE_BODY_CALL_NAMES.has(expression.expression.name.text) ||\n expression.arguments.length !== 1\n ) {\n return undefined;\n }\n\n const [argument] = expression.arguments;\n return argument;\n};\n\nexport const resolveCatchMethodBody = (\n catchMethod: MethodDeclaration,\n): CatchMethodBodyResolution | undefined => {\n const [exceptionParameter] = catchMethod.parameters;\n\n if (exceptionParameter === undefined || !isIdentifier(exceptionParameter.name)) {\n return undefined;\n }\n\n const body = catchMethod.body;\n\n if (body === undefined) {\n return undefined;\n }\n\n const localDeclarations = new Map<string, Expression>();\n let responseBodyArgument: Expression | undefined;\n let sawResponseCall = false;\n let sawTrailingReturn = false;\n\n for (const statement of body.statements) {\n if (sawTrailingReturn) {\n return undefined;\n }\n\n if (!sawResponseCall && isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (!sawResponseCall && isExpressionStatement(statement)) {\n const argument = matchResponseBodyArgument(statement.expression);\n\n if (argument === undefined) {\n return undefined;\n }\n\n responseBodyArgument = argument;\n sawResponseCall = true;\n continue;\n }\n\n if (sawResponseCall && isReturnStatement(statement) && statement.expression === undefined) {\n sawTrailingReturn = true;\n continue;\n }\n\n return undefined;\n }\n\n if (!sawResponseCall || responseBodyArgument === undefined) {\n return undefined;\n }\n\n return {\n exceptionParameterName: exceptionParameter.name.text,\n localDeclarations,\n responseBodyArgument,\n };\n};\n","import type { Expression, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n} from 'typescript/unstable/ast';\n\nconst EXCEPTION_MESSAGE_MEMBER_NAME = 'message';\nconst EXCEPTION_STATUS_METHOD_NAME = 'getStatus';\n\nconst resolvesToExceptionParameter = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n visited: Set<string>,\n): boolean => {\n if (!isIdentifier(expression)) {\n return false;\n }\n\n if (expression.text === exceptionParameterName) {\n return true;\n }\n\n if (visited.has(expression.text)) {\n return false;\n }\n\n visited.add(expression.text);\n\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? resolvesToExceptionParameter(\n aliasedExpression,\n exceptionParameterName,\n localDeclarations,\n visited,\n )\n : false;\n};\n\nconst synthesizeErrorValueType = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n): string | undefined => {\n if (\n isPropertyAccessExpression(expression) &&\n expression.name.text === EXCEPTION_MESSAGE_MEMBER_NAME &&\n resolvesToExceptionParameter(\n expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'string';\n }\n\n if (\n isCallExpression(expression) &&\n expression.arguments.length === 0 &&\n isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === EXCEPTION_STATUS_METHOD_NAME &&\n resolvesToExceptionParameter(\n expression.expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'number';\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return undefined;\n }\n\n const valueType = synthesizeErrorValueType(\n property.initializer,\n exceptionParameterName,\n localDeclarations,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n if (isIdentifier(expression)) {\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? synthesizeErrorValueType(aliasedExpression, exceptionParameterName, localDeclarations)\n : undefined;\n }\n\n return undefined;\n};\n\nexport const synthesizeErrorBodyType = (\n objectLiteral: ObjectLiteralExpression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n) => synthesizeErrorValueType(objectLiteral, exceptionParameterName, localDeclarations);\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isMethodDeclaration,\n isObjectLiteralExpression,\n} from 'typescript/unstable/ast';\nimport type { ErrorResponseShapeDetection } from '../models/error-response-shape-detection';\nimport { findDecorator } from './decorator-inspection';\nimport { findAppFilterProviderClassName } from './find-app-filter-provider-class-name';\nimport { findGlobalFilterClassName } from './find-global-filter-class-name';\nimport { findRootModuleClassName } from './find-root-module-class-name';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveCatchMethodBody } from './resolve-catch-method-body';\nimport {\n clearParsedFileCache,\n type ResolvedTypeDeclaration,\n resolveClassDeclaration,\n} from './resolve-type-declaration';\nimport { synthesizeErrorBodyType } from './synthesize-error-body-type';\n\nconst CATCH_DECORATOR_NAME = 'Catch';\nconst CATCH_METHOD_NAME = 'catch';\n\nconst findCatchMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === CATCH_METHOD_NAME,\n );\n\nconst resolveViaGlobalFilters = (bootstrapSourceFile: SourceFile, bootstrapFilePath: string) => {\n const filterClassName = findGlobalFilterClassName(bootstrapSourceFile);\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, bootstrapSourceFile, bootstrapFilePath);\n};\n\nconst resolveViaAppFilterProvider = (\n bootstrapSourceFile: SourceFile,\n bootstrapFilePath: string,\n) => {\n const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);\n\n if (rootModuleClassName === undefined) {\n return undefined;\n }\n\n const resolvedModule = resolveClassDeclaration(\n rootModuleClassName,\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n if (resolvedModule === undefined) {\n return undefined;\n }\n\n const filterClassName = findAppFilterProviderClassName(\n resolvedModule.classDeclaration,\n resolvedModule.sourceFile,\n );\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, resolvedModule.sourceFile, resolvedModule.filePath);\n};\n\nconst isSameDeclaration = (a: ResolvedTypeDeclaration, b: ResolvedTypeDeclaration) =>\n a.filePath === b.filePath && a.classDeclaration.name?.text === b.classDeclaration.name?.text;\n\nconst reconcileResolvedFilter = (\n viaGlobalFilters: ResolvedTypeDeclaration | undefined,\n viaAppFilterProvider: ResolvedTypeDeclaration | undefined,\n) => {\n if (viaGlobalFilters !== undefined && viaAppFilterProvider !== undefined) {\n return isSameDeclaration(viaGlobalFilters, viaAppFilterProvider) ? viaGlobalFilters : undefined;\n }\n\n return viaGlobalFilters ?? viaAppFilterProvider;\n};\n\nexport const detectErrorResponseShape = (\n bootstrapFilePath: string,\n): ErrorResponseShapeDetection | undefined => {\n clearParsedFileCache();\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n\n const resolved = reconcileResolvedFilter(\n resolveViaGlobalFilters(bootstrapSourceFile, bootstrapFilePath),\n resolveViaAppFilterProvider(bootstrapSourceFile, bootstrapFilePath),\n );\n\n if (\n resolved === undefined ||\n findDecorator(resolved.classDeclaration, CATCH_DECORATOR_NAME) === undefined\n ) {\n return undefined;\n }\n\n const catchMethod = findCatchMethod(resolved.classDeclaration.members);\n\n if (catchMethod?.body === undefined) {\n return undefined;\n }\n\n const bodyResolution = resolveCatchMethodBody(catchMethod);\n\n if (\n bodyResolution === undefined ||\n !isObjectLiteralExpression(bodyResolution.responseBodyArgument)\n ) {\n return undefined;\n }\n\n const errorBodyTypeSource = synthesizeErrorBodyType(\n bodyResolution.responseBodyArgument,\n bodyResolution.exceptionParameterName,\n bodyResolution.localDeclarations,\n );\n\n return errorBodyTypeSource === undefined ? undefined : { errorBodyTypeSource };\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isBinaryExpression,\n isCallExpression,\n isConditionalExpression,\n isDoStatement,\n isForInStatement,\n isForOfStatement,\n isForStatement,\n isIfStatement,\n isPropertyAccessExpression,\n isSwitchStatement,\n isWhileStatement,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nexport interface BootstrapCall {\n call: CallExpression;\n conditional: boolean;\n}\n\nconst isConditionalContainer = (node: Node) =>\n isIfStatement(node) ||\n isConditionalExpression(node) ||\n isSwitchStatement(node) ||\n isForStatement(node) ||\n isForInStatement(node) ||\n isForOfStatement(node) ||\n isWhileStatement(node) ||\n isDoStatement(node) ||\n (isBinaryExpression(node) &&\n (node.operatorToken.kind === SyntaxKind.AmpersandAmpersandToken ||\n node.operatorToken.kind === SyntaxKind.BarBarToken ||\n node.operatorToken.kind === SyntaxKind.QuestionQuestionToken));\n\nconst collect = (node: Node, methodName: string, conditional: boolean, calls: BootstrapCall[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === methodName\n ) {\n calls.push({ call: node, conditional });\n }\n\n const childConditional = conditional || isConditionalContainer(node);\n\n node.forEachChild((child) => {\n collect(child, methodName, childConditional, calls);\n return undefined;\n });\n};\n\nexport const collectBootstrapCalls = (sourceFile: SourceFile, methodName: string) => {\n const calls: BootstrapCall[] = [];\n collect(sourceFile, methodName, false, calls);\n return calls;\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport type {\n NestBridgeDiagnostic,\n NestBridgeDiagnosticCode,\n} from '../diagnostics/nestbridge-diagnostic';\nimport { locationOf } from './node-location';\n\ninterface BootstrapDiagnosticSource {\n code: Extract<NestBridgeDiagnosticCode, 'unsupported-global-prefix' | 'unsupported-versioning'>;\n title: string;\n detail: string;\n expected: string;\n node: Node;\n sourceFile: SourceFile;\n filePath: string;\n}\n\nexport const createBootstrapDiagnostic = (source: BootstrapDiagnosticSource) => {\n const location = locationOf(source.sourceFile, source.node);\n\n return {\n code: source.code,\n title: source.title,\n controllerName: '(bootstrap)',\n memberName: '',\n detail: source.detail,\n found: source.node.getText(),\n expected: source.expected,\n filePath: source.filePath,\n line: location.line,\n column: location.column,\n } satisfies NestBridgeDiagnostic;\n};\n","import type { Expression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport type { GlobalPrefixExclusion } from '../models/global-prefix-exclusion';\nimport type { HttpMethod } from '../models/http-method';\n\nconst REQUEST_METHOD_ENUM_NAME = 'RequestMethod';\nconst REQUEST_METHOD_ALL_NAME = 'ALL';\nconst EXCLUDE_OPTION_NAME = 'exclude';\nconst PATH_PROPERTY_NAME = 'path';\nconst METHOD_PROPERTY_NAME = 'method';\nconst SUPPORTED_EXCLUSION_PATH = /^[A-Za-z0-9_\\-./:*]*$/;\nconst REQUEST_METHODS: Record<string, HttpMethod | undefined> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n PATCH: 'PATCH',\n DELETE: 'DELETE',\n};\n\nconst readExclusionPath = (expression: Expression) =>\n isStringLiteralLikeNode(expression) && SUPPORTED_EXCLUSION_PATH.test(expression.text)\n ? expression.text\n : undefined;\n\nconst readRequestMethod = (expression: Expression) => {\n if (\n !isPropertyAccessExpression(expression) ||\n !isIdentifier(expression.expression) ||\n expression.expression.text !== REQUEST_METHOD_ENUM_NAME\n ) {\n return undefined;\n }\n\n const methodName = expression.name.text;\n\n if (methodName === REQUEST_METHOD_ALL_NAME) {\n return { httpMethod: undefined, generated: true };\n }\n\n const httpMethod = REQUEST_METHODS[methodName];\n return { httpMethod, generated: httpMethod !== undefined };\n};\n\nconst readExclusion = (element: Expression) => {\n if (isStringLiteralLikeNode(element)) {\n const path = readExclusionPath(element);\n return path === undefined ? undefined : { exclusion: { path } satisfies GlobalPrefixExclusion };\n }\n\n if (!isObjectLiteralExpression(element)) {\n return undefined;\n }\n\n let path: string | undefined;\n let httpMethod: HttpMethod | undefined;\n\n for (const property of element.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n const propertyName = property.name.getText();\n\n if (propertyName === PATH_PROPERTY_NAME) {\n path = readExclusionPath(property.initializer);\n }\n\n if (propertyName === METHOD_PROPERTY_NAME) {\n const requestMethod = readRequestMethod(property.initializer);\n\n if (requestMethod === undefined) {\n return undefined;\n }\n\n if (!requestMethod.generated) {\n return { exclusion: undefined };\n }\n\n httpMethod = requestMethod.httpMethod;\n }\n }\n\n if (path === undefined) {\n return undefined;\n }\n\n return { exclusion: httpMethod === undefined ? { path } : { path, httpMethod } };\n};\n\n/**\n * Returns `undefined` when an entry cannot be read statically. Entries for request methods\n * NestBridge never generates (OPTIONS, HEAD, SEARCH) are dropped because they cannot match.\n */\nexport const readGlobalPrefixExclusions = (options: Expression | undefined) => {\n if (options === undefined) {\n return [];\n }\n\n if (!isObjectLiteralExpression(options)) {\n return undefined;\n }\n\n const exclusions: GlobalPrefixExclusion[] = [];\n\n for (const property of options.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n if (property.name.getText() !== EXCLUDE_OPTION_NAME) {\n continue;\n }\n\n if (!isArrayLiteralExpression(property.initializer)) {\n return undefined;\n }\n\n for (const element of property.initializer.elements) {\n const entry = readExclusion(element);\n\n if (entry === undefined) {\n return undefined;\n }\n\n if (entry.exclusion !== undefined) {\n exclusions.push(entry.exclusion);\n }\n }\n }\n\n return exclusions;\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport { isStringLiteralLikeNode } from 'typescript/unstable/ast';\nimport type { BootstrapDetection } from '../models/bootstrap-detection';\nimport type { GlobalPrefix } from '../models/global-prefix';\nimport { collectBootstrapCalls } from './collect-bootstrap-calls';\nimport { createBootstrapDiagnostic } from './create-bootstrap-diagnostic';\nimport { parseSourceFile } from './parse-source-file';\nimport { readGlobalPrefixExclusions } from './read-global-prefix-exclusions';\n\nconst SET_GLOBAL_PREFIX_METHOD_NAME = 'setGlobalPrefix';\nconst EXPECTED =\n 'A single unconditional setGlobalPrefix() call with a string literal prefix and exclude ' +\n 'entries written as string literals or { path, method } literals. Set the `globalPrefix` ' +\n 'option to provide the prefix explicitly.';\n\nconst unsupported = (\n sourceFile: SourceFile,\n filePath: string,\n node: Node,\n detail: string,\n): BootstrapDetection<GlobalPrefix> => ({\n value: undefined,\n diagnostics: [\n createBootstrapDiagnostic({\n code: 'unsupported-global-prefix',\n title: 'Unsupported global prefix.',\n detail,\n expected: EXPECTED,\n node,\n sourceFile,\n filePath,\n }),\n ],\n});\n\nexport const detectGlobalPrefix = (bootstrapFilePath: string): BootstrapDetection<GlobalPrefix> => {\n const sourceFile = parseSourceFile(bootstrapFilePath);\n const calls = collectBootstrapCalls(sourceFile, SET_GLOBAL_PREFIX_METHOD_NAME);\n const [first] = calls;\n\n if (first === undefined) {\n return { value: undefined, diagnostics: [] };\n }\n\n if (calls.length > 1 || first.conditional) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'setGlobalPrefix() must be called exactly once and unconditionally.',\n );\n }\n\n const [prefixArgument, optionsArgument] = first.call.arguments;\n\n if (prefixArgument === undefined || !isStringLiteralLikeNode(prefixArgument)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The global prefix must be a string literal.',\n );\n }\n\n const exclude = readGlobalPrefixExclusions(optionsArgument);\n\n if (exclude === undefined) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'Global prefix exclusions must be statically analyzable.',\n );\n }\n\n return { value: { prefix: prefixArgument.text, exclude }, diagnostics: [] };\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n SyntaxKind,\n} from 'typescript/unstable/ast';\nimport type { BootstrapDetection } from '../models/bootstrap-detection';\nimport type { UriVersioning } from '../models/uri-versioning';\nimport { collectBootstrapCalls } from './collect-bootstrap-calls';\nimport { createBootstrapDiagnostic } from './create-bootstrap-diagnostic';\nimport { parseSourceFile } from './parse-source-file';\nimport { readRouteVersion } from './read-route-version';\n\nconst ENABLE_VERSIONING_METHOD_NAME = 'enableVersioning';\nconst VERSIONING_TYPE_ENUM_NAME = 'VersioningType';\nconst URI_VERSIONING_TYPE_NAME = 'URI';\nconst TYPE_OPTION_NAME = 'type';\nconst PREFIX_OPTION_NAME = 'prefix';\nconst DEFAULT_VERSION_OPTION_NAME = 'defaultVersion';\nconst DEFAULT_VERSION_PREFIX = 'v';\nconst EXPECTED =\n 'A single unconditional enableVersioning() call with `type: VersioningType.URI`, a string ' +\n 'literal or `false` prefix, and a string literal defaultVersion. Header, media type and ' +\n 'custom versioning need request headers NestBridge cannot set. Set the `versioning` option ' +\n 'to provide URI versioning explicitly.';\n\nconst unsupported = (\n sourceFile: SourceFile,\n filePath: string,\n node: Node,\n detail: string,\n): BootstrapDetection<UriVersioning> => ({\n value: undefined,\n diagnostics: [\n createBootstrapDiagnostic({\n code: 'unsupported-versioning',\n title: 'Unsupported versioning.',\n detail,\n expected: EXPECTED,\n node,\n sourceFile,\n filePath,\n }),\n ],\n});\n\nconst isUriVersioningType = (node: Node) =>\n isPropertyAccessExpression(node) &&\n isIdentifier(node.expression) &&\n node.expression.text === VERSIONING_TYPE_ENUM_NAME &&\n node.name.text === URI_VERSIONING_TYPE_NAME;\n\nexport const detectVersioning = (bootstrapFilePath: string): BootstrapDetection<UriVersioning> => {\n const sourceFile = parseSourceFile(bootstrapFilePath);\n const calls = collectBootstrapCalls(sourceFile, ENABLE_VERSIONING_METHOD_NAME);\n const [first] = calls;\n\n if (first === undefined) {\n return { value: undefined, diagnostics: [] };\n }\n\n if (calls.length > 1 || first.conditional) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'enableVersioning() must be called exactly once and unconditionally.',\n );\n }\n\n const [options] = first.call.arguments;\n\n if (options === undefined || !isObjectLiteralExpression(options)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The versioning options must be an object literal.',\n );\n }\n\n let hasUriType = false;\n let prefix = DEFAULT_VERSION_PREFIX;\n let defaultVersion: string | undefined;\n\n for (const property of options.properties) {\n if (!isPropertyAssignment(property)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'Versioning options must be written as plain properties.',\n );\n }\n\n const optionName = property.name.getText();\n const value = property.initializer;\n\n if (optionName === TYPE_OPTION_NAME) {\n if (!isUriVersioningType(value)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'Only VersioningType.URI is supported.',\n );\n }\n\n hasUriType = true;\n }\n\n if (optionName === PREFIX_OPTION_NAME) {\n if (value.kind === SyntaxKind.FalseKeyword) {\n prefix = '';\n } else if (isStringLiteralLikeNode(value)) {\n prefix = value.text;\n } else {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'The version prefix must be a string literal or false.',\n );\n }\n }\n\n if (optionName === DEFAULT_VERSION_OPTION_NAME) {\n const routeVersion = readRouteVersion(value);\n\n if (!routeVersion.ok) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'The default version must be a string literal.',\n );\n }\n\n defaultVersion = routeVersion.version ?? undefined;\n }\n }\n\n if (!hasUriType) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The versioning type must be VersioningType.URI.',\n );\n }\n\n return {\n value: defaultVersion === undefined ? { prefix } : { prefix, defaultVersion },\n diagnostics: [],\n };\n};\n","import { dirname, extname, relative } from 'node:path';\nimport type { MessageHandlerDefinition } from '../models/message-handler-definition';\nimport type { ResponseKind } from '../models/response-kind';\nimport type { ResponseWrapperDetection } from '../models/response-wrapper-detection';\nimport { WRAPPED_RESULT_SUBSTITUTION } from '../models/response-wrapper-substitution';\n\ninterface ClientDeclarationParameter {\n index: number;\n parameterName: string;\n}\n\ninterface ClientDeclarationMethod {\n name: string;\n responseKind?: ResponseKind;\n responseWrapper?: ResponseWrapperDetection;\n parameters?: readonly ClientDeclarationParameter[];\n serverOnlyParameterIndexes?: readonly number[];\n}\n\ntype ClientDeclarationMessageHandler = Pick<\n MessageHandlerDefinition,\n 'name' | 'kind' | 'payloadParameterIndex'\n>;\n\ninterface ClientDeclarationSource {\n name: string;\n sourceFile: string;\n methods: readonly ClientDeclarationMethod[];\n messageHandlers?: readonly ClientDeclarationMessageHandler[];\n}\n\nconst REMOTE_RESULT_HELPERS: Record<ResponseKind, string> = {\n json: 'RemoteResult',\n observable: 'RemoteObservableResult',\n stream: 'RemoteStreamResult',\n};\n\nconst WRAPPED_RESULT_HELPER = '__NestBridgeWrapped';\n\nconst ABORTABLE_PROMISE = 'AbortablePromise';\n\nconst MESSAGE_RESULT_HELPER = 'NestBridgeMessageResult';\n\nconst MESSAGE_PAYLOAD_PARAMETER = 'payload';\n\nconst toPosixPath = (filePath: string) => filePath.replace(/\\\\/g, '/');\n\nconst importSpecifierFor = (sourceFile: string, outputFilePath: string) => {\n if (\n !sourceFile.startsWith('.') &&\n !/^[A-Za-z]:[\\\\/]/.test(sourceFile) &&\n !sourceFile.startsWith('/')\n ) {\n return sourceFile;\n }\n\n const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst stripExtension = (filePath: string) => {\n const extension = extname(filePath);\n return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;\n};\n\nconst dependsOnServerResult = (wrapper: ResponseWrapperDetection) =>\n wrapper.wrappedResultTypeSource.includes(WRAPPED_RESULT_SUBSTITUTION);\n\nconst wrapperOf = (method: ClientDeclarationMethod) =>\n (method.responseKind ?? 'json') === 'json' ? method.responseWrapper : undefined;\n\n/**\n * Wrappers that depend on the server result get a generic alias, in order of first use, so the\n * first one keeps the name `__NestBridgeWrapped`. A wrapper that does not depend on it, such as\n * `unknown`, is written inline.\n */\nconst aliasedWrapperSourcesOf = (methods: readonly ClientDeclarationMethod[]) => {\n const sources = new Set<string>();\n\n for (const method of methods) {\n const wrapper = wrapperOf(method);\n\n if (wrapper !== undefined && dependsOnServerResult(wrapper)) {\n sources.add(wrapper.wrappedResultTypeSource);\n }\n }\n\n return [...sources];\n};\n\nconst wrapperHelperName = (aliasIndex: number) =>\n aliasIndex === 0 ? WRAPPED_RESULT_HELPER : `${WRAPPED_RESULT_HELPER}${aliasIndex + 1}`;\n\nexport const generateControllerDeclaration = (\n controller: ClientDeclarationSource,\n outputFilePath: string,\n): string => {\n const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);\n const importSpecifier = stripExtension(sourceFileSpecifier);\n const serverAlias = `__Server${controller.name}`;\n\n const aliasedWrapperSources = aliasedWrapperSourcesOf(controller.methods);\n\n const resultTypeFor = (method: ClientDeclarationMethod) => {\n const serverMethod = `${serverAlias}['${method.name}']`;\n const wrapper = wrapperOf(method);\n\n if (wrapper === undefined) {\n return `${REMOTE_RESULT_HELPERS[method.responseKind ?? 'json']}<${serverMethod}>`;\n }\n\n if (!dependsOnServerResult(wrapper)) {\n return `${ABORTABLE_PROMISE}<${wrapper.wrappedResultTypeSource}>`;\n }\n\n const aliasIndex = aliasedWrapperSources.indexOf(wrapper.wrappedResultTypeSource);\n return `${wrapperHelperName(aliasIndex)}<${serverMethod}>`;\n };\n\n const importedHelperFor = (method: ClientDeclarationMethod) =>\n wrapperOf(method) === undefined\n ? REMOTE_RESULT_HELPERS[method.responseKind ?? 'json']\n : ABORTABLE_PROMISE;\n\n const parameterListFor = (method: ClientDeclarationMethod) => {\n const serverParameters = `Parameters<${serverAlias}['${method.name}']>`;\n\n if ((method.serverOnlyParameterIndexes ?? []).length === 0) {\n return `...args: ${serverParameters}`;\n }\n\n return [...(method.parameters ?? [])]\n .sort((a, b) => a.index - b.index)\n .map((parameter) => `${parameter.parameterName}: ${serverParameters}[${parameter.index}]`)\n .join(', ');\n };\n\n const methodDeclarations = controller.methods.map(\n (method) => ` ${method.name}(${parameterListFor(method)}): ${resultTypeFor(method)};`,\n );\n\n const messageHandlers = controller.messageHandlers ?? [];\n\n const messageHandlerDeclarations = messageHandlers.map((handler) => {\n const serverMethod = `${serverAlias}['${handler.name}']`;\n const parameterList =\n handler.payloadParameterIndex === null\n ? ''\n : `${MESSAGE_PAYLOAD_PARAMETER}: Parameters<${serverMethod}>[${handler.payloadParameterIndex}]`;\n const result =\n handler.kind === 'event' ? 'void' : `${MESSAGE_RESULT_HELPER}<ReturnType<${serverMethod}>>`;\n\n return ` ${handler.name}(${parameterList}): Promise<${result}>;`;\n });\n\n const classBody = [\n ' constructor();',\n '',\n ...methodDeclarations,\n ...messageHandlerDeclarations,\n ].join('\\n');\n\n const remoteHelperImports = Array.from(\n new Set(controller.methods.map((method) => importedHelperFor(method))),\n ).sort();\n const helperImports =\n remoteHelperImports.length === 0 && messageHandlers.length === 0\n ? ['RemoteResult']\n : remoteHelperImports;\n const usesMessageResult = messageHandlers.some((handler) => handler.kind === 'message');\n\n const wrappedResultTypeAliasLines =\n aliasedWrapperSources.length === 0\n ? []\n : [\n ...aliasedWrapperSources.map(\n (source, aliasIndex) =>\n `type ${wrapperHelperName(aliasIndex)}<T> = T extends (...args: never[]) => infer Result ? ${ABORTABLE_PROMISE}<${source}> : never;`,\n ),\n '',\n ];\n\n return [\n `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,\n ...(helperImports.length > 0\n ? [`import type { ${helperImports.join(', ')} } from 'nestbridge';`]\n : []),\n ...(usesMessageResult\n ? [`import type { ${MESSAGE_RESULT_HELPER} } from 'nestbridge/microservices';`]\n : []),\n '',\n '/**',\n ' * Generated by NestBridge — client-facing methods only.',\n ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,\n ' */',\n ...wrappedResultTypeAliasLines,\n `export declare class ${controller.name} {`,\n classBody,\n '}',\n '',\n ].join('\\n');\n};\n","export const ERROR_BODY_TYPE_NAME = 'NestBridgeErrorBody';\n\nexport const generateErrorBodyDeclaration = (errorBodyTypeSource: string): string =>\n [\n '/**',\n \" * Generated by NestBridge — inferred shape of the global exception filter's response body.\",\n ' */',\n `export type ${ERROR_BODY_TYPE_NAME} = ${errorBodyTypeSource};`,\n '',\n ].join('\\n');\n","import type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport const formatDiagnostic = (diagnostic: NestBridgeDiagnostic): string => {\n const subject =\n diagnostic.memberName.length > 0\n ? `${diagnostic.controllerName}.${diagnostic.memberName}`\n : diagnostic.controllerName;\n\n const lines = [`[NestBridge] ${diagnostic.title}`, '', subject, '', diagnostic.detail];\n\n if (diagnostic.found !== undefined) {\n lines.push('', 'Found:', diagnostic.found);\n }\n\n if (diagnostic.expected !== undefined) {\n lines.push('', 'Expected:', diagnostic.expected);\n }\n\n lines.push('', `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);\n\n return lines.join('\\n');\n};\n","import { formatDiagnostic } from './format-diagnostic';\nimport type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport class NestBridgeDiagnosticError extends Error {\n readonly diagnostic: NestBridgeDiagnostic;\n\n constructor(diagnostic: NestBridgeDiagnostic) {\n super(formatDiagnostic(diagnostic));\n this.name = 'NestBridgeDiagnosticError';\n this.diagnostic = diagnostic;\n }\n}\n","{\n \"name\": \"@nestbridge/core\",\n \"version\": \"3.0.0\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/MDReal32/nestbridge.git\",\n \"directory\": \"packages/core\"\n },\n \"main\": \"./build/nestbridge.core.js\",\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"import\": \"./build/nestbridge.core.js\"\n }\n },\n \"files\": [\n \"build\"\n ],\n \"scripts\": {\n \"build\": \"vite build\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"lint\": \"biome check .\"\n },\n \"dependencies\": {\n \"typescript\": \"^7.0.2\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^26.4.1\",\n \"rolldown-plugin-dts\": \"^0.28.5\",\n \"vite\": \"^8.2.2\",\n \"vitest\": \"^5.0.0\"\n }\n}\n","import { version } from '../package.json';\n\nexport const VERSION: string = version;\n"],"mappings":";;;;;AAKA,IAAa,0BACX,YACA,kBACA,iBACG;CACH,MAAM,gBAAgB,iB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a,uBAAuB;AAEpC,IAAa,gCAAgC,wBAC3C;CACE;CACA;CACA;CACA,eAAe,qBAAqB,KAAK,oBAAoB;CAC7D;AACF,CAAC,CAAC,KAAK,IAAI;;;ACPb,IAAa,oBAAoB,eAA6C;CAC5E,MAAM,UACJ,WAAW,WAAW,SAAS,IAC3B,GAAG,WAAW,eAAe,GAAG,WAAW,eAC3C,WAAW;CAEjB,MAAM,QAAQ;EAAC,gBAAgB,WAAW;EAAS;EAAI;EAAS;EAAI,WAAW;CAAM;CAErF,IAAI,WAAW,UAAU,KAAA,GACvB,MAAM,KAAK,IAAI,UAAU,WAAW,KAAK;CAG3C,IAAI,WAAW,aAAa,KAAA,GAC1B,MAAM,KAAK,IAAI,aAAa,WAAW,QAAQ;CAGjD,MAAM,KAAK,IAAI,GAAG,WAAW,SAAS,GAAG,WAAW,KAAK,GAAG,WAAW,QAAQ;CAE/E,OAAO,MAAM,KAAK,IAAI;AACxB;;;AClBA,IAAa,4BAAb,cAA+C,MAAM;CACnD;CAEA,YAAY,YAAkC;EAC5C,MAAM,iBAAiB,UAAU,CAAC;EAClC,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;;AETA,IAAa,UAAkB"}
|
|
1
|
+
{"version":3,"file":"nestbridge.core.js","names":[],"sources":["../src/analysis/attach-response-wrappers.ts","../src/models/response-wrapper-substitution.ts","../src/analysis/unwrap-parenthesized-expression.ts","../src/analysis/resolve-sole-return-expression.ts","../src/analysis/synthesize-generic-object-type.ts","../src/analysis/read-map-operation.ts","../src/analysis/open-source-file.ts","../src/analysis/parse-source-file.ts","../src/analysis/resolve-module-origin.ts","../src/analysis/resolve-type-declaration.ts","../src/analysis/read-pipe-operator.ts","../src/analysis/contains-return-statement.ts","../src/analysis/resolve-intercept-return-expression.ts","../src/analysis/analyze-intercept-method.ts","../src/analysis/analyze-interceptor-class.ts","../src/models/declared-interceptor-reference.ts","../src/analysis/compose-wrapper-type-source.ts","../src/analysis/node-location.ts","../src/analysis/create-interceptor-diagnostic.ts","../src/analysis/decorator-inspection.ts","../src/analysis/read-module-option.ts","../src/analysis/find-app-interceptor-provider-registrations.ts","../src/analysis/read-imported-modules.ts","../src/analysis/collect-module-interceptor-registrations.ts","../src/analysis/find-bootstrap-interceptor-registrations.ts","../src/analysis/find-root-module-class-name.ts","../src/analysis/find-global-interceptor-registrations.ts","../src/analysis/find-use-interceptors-registrations.ts","../src/analysis/package-interceptor-shape.ts","../src/analysis/create-interceptor-analysis.ts","../src/models/graphql-operation-kind.ts","../src/models/http-method.ts","../src/models/message-kind.ts","../src/analysis/find-payload-parameter-index.ts","../src/analysis/read-literal-type.ts","../src/analysis/read-message-pattern.ts","../src/analysis/extract-message-handler-definition.ts","../src/analysis/extract-parameter-definition.ts","../src/analysis/is-nullish-type-node.ts","../src/analysis/graphql-scalar-type.ts","../src/analysis/read-response-kind.ts","../src/analysis/read-route-version.ts","../src/analysis/route-path.ts","../src/analysis/extract-method-definition.ts","../src/analysis/read-controller-options.ts","../src/analysis/extract-controller-definition.ts","../src/analysis/find-controller-classes.ts","../src/analysis/interceptor-declaration-file-names.ts","../src/analysis/create-interceptor-declaration-diagnostic.ts","../src/analysis/read-interceptor-declarations.ts","../src/analysis/analyze-controllers.ts","../src/analysis/read-args-nullable-option.ts","../src/analysis/read-type-thunk-expression.ts","../src/analysis/read-args-type-option.ts","../src/analysis/extract-resolver-argument-definition.ts","../src/analysis/extract-selection-fields.ts","../src/analysis/read-graphql-operation-name.ts","../src/analysis/read-graphql-return-type-option.ts","../src/analysis/extract-resolver-method-definition.ts","../src/analysis/extract-resolver-definition.ts","../src/analysis/find-resolver-classes.ts","../src/analysis/analyze-resolvers.ts","../src/analysis/apply-application-routing.ts","../src/analysis/find-app-filter-provider-class-name.ts","../src/analysis/find-global-filter-class-name.ts","../src/analysis/resolve-catch-method-body.ts","../src/analysis/synthesize-error-body-type.ts","../src/analysis/detect-error-response-shape.ts","../src/analysis/collect-bootstrap-calls.ts","../src/analysis/create-bootstrap-diagnostic.ts","../src/analysis/read-global-prefix-exclusions.ts","../src/analysis/detect-global-prefix.ts","../src/analysis/detect-versioning.ts","../src/declarations/import-specifier-for.ts","../src/declarations/generate-controller-declaration.ts","../src/declarations/generate-error-body-declaration.ts","../src/declarations/generate-interceptors-declaration.ts","../src/diagnostics/format-diagnostic.ts","../src/diagnostics/nestbridge-diagnostic-error.ts","../package.json","../src/version.ts"],"sourcesContent":["import type { ClassDeclaration, MethodDeclaration } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { ControllerDefinition } from '../models/controller-definition';\nimport type { ControllerInterceptors } from './controller-interceptors';\n\nexport const attachResponseWrappers = (\n controller: ControllerDefinition,\n classDeclaration: ClassDeclaration,\n interceptors: ControllerInterceptors,\n) => {\n const memberMethods = classDeclaration.members.filter((member): member is MethodDeclaration =>\n isMethodDeclaration(member),\n );\n\n const methods = controller.methods.map((method) => {\n const declaration = memberMethods.find((candidate) => candidate.name.getText() === method.name);\n const responseWrapper =\n method.responseKind === 'json' && declaration !== undefined\n ? interceptors.responseWrapperOf(declaration)\n : undefined;\n\n return responseWrapper === undefined ? method : { ...method, responseWrapper };\n });\n\n return { ...controller, methods };\n};\n","export const WRAPPED_RESULT_SUBSTITUTION = 'Awaited<Result>';\n\nexport const UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE = 'unknown';\n","import type { Expression } from 'typescript/unstable/ast';\nimport { isParenthesizedExpression } from 'typescript/unstable/ast';\n\nexport const unwrapParenthesizedExpression = (expression: Expression) => {\n let unwrapped = expression;\n\n while (isParenthesizedExpression(unwrapped)) {\n unwrapped = unwrapped.expression;\n }\n\n return unwrapped;\n};\n","import type { Block, Expression } from 'typescript/unstable/ast';\nimport {\n isBlock,\n isIdentifier,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\nimport { unwrapParenthesizedExpression } from './unwrap-parenthesized-expression';\n\n/**\n * Accepts an expression body, or a block that holds nothing but simple `const` declarations and\n * a single trailing `return`. A returned identifier resolves to its declared initializer.\n */\nexport const resolveSoleReturnExpression = (body: Block | Expression) => {\n if (!isBlock(body)) {\n return unwrapParenthesizedExpression(body);\n }\n\n const localDeclarations = new Map<string, Expression>();\n let returnExpression: Expression | undefined;\n let sawReturn = false;\n\n for (const statement of body.statements) {\n if (sawReturn) {\n return undefined;\n }\n\n if (isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (isReturnStatement(statement)) {\n sawReturn = true;\n returnExpression = statement.expression;\n continue;\n }\n\n return undefined;\n }\n\n if (returnExpression === undefined) {\n return undefined;\n }\n\n return isIdentifier(returnExpression)\n ? localDeclarations.get(returnExpression.text)\n : returnExpression;\n};\n","import type { Expression, Node, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isBinaryExpression,\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isParenthesizedExpression,\n isPropertyAssignment,\n isShorthandPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\ninterface SynthesisFailure {\n node: Node;\n reason: string;\n}\n\ninterface SynthesisState {\n substitutionCount: number;\n failure?: SynthesisFailure;\n}\n\nconst NUMERIC_OPERATOR_KINDS: readonly SyntaxKind[] = [\n SyntaxKind.MinusToken,\n SyntaxKind.AsteriskToken,\n SyntaxKind.SlashToken,\n SyntaxKind.PercentToken,\n];\n\nconst fail = (state: SynthesisState, node: Node, reason: string) => {\n state.failure ??= { node, reason };\n return undefined;\n};\n\nconst describeUntypedExpression = (expression: Expression) =>\n isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.PlusToken\n ? `\\`${expression.getText()}\\` can be a string or a number, so its type is not guessed.`\n : `The type of \\`${expression.getText()}\\` cannot be determined statically.`;\n\nconst synthesizeExpressionType = (\n expression: Expression,\n parameterName: string,\n substitution: string,\n state: SynthesisState,\n) => {\n if (isParenthesizedExpression(expression)) {\n return synthesizeExpressionType(expression.expression, parameterName, substitution, state);\n }\n\n if (isIdentifier(expression) && expression.text === parameterName) {\n state.substitutionCount += 1;\n return substitution;\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (isShorthandPropertyAssignment(property)) {\n const shorthandName = property.name.getText();\n\n if (shorthandName !== parameterName) {\n return fail(\n state,\n property,\n `The type of \\`${shorthandName}\\` cannot be determined statically.`,\n );\n }\n\n state.substitutionCount += 1;\n memberTypes.push(`${shorthandName}: ${substitution}`);\n continue;\n }\n\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return fail(\n state,\n property,\n `\\`${property.getText()}\\` is not a plain \\`name: value\\` property.`,\n );\n }\n\n const valueType = synthesizeExpressionType(\n property.initializer,\n parameterName,\n substitution,\n state,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n if (\n isBinaryExpression(expression) &&\n NUMERIC_OPERATOR_KINDS.includes(expression.operatorToken.kind)\n ) {\n return 'number';\n }\n\n return fail(state, expression, describeUntypedExpression(expression));\n};\n\nexport const synthesizeGenericObjectType = (\n objectLiteral: ObjectLiteralExpression,\n parameterName: string,\n substitution: string,\n) => {\n const state: SynthesisState = { substitutionCount: 0 };\n const objectType = synthesizeExpressionType(objectLiteral, parameterName, substitution, state);\n\n if (objectType === undefined) {\n const failure = state.failure ?? {\n node: objectLiteral,\n reason: `The type of \\`${objectLiteral.getText()}\\` cannot be determined statically.`,\n };\n\n return { ok: false, node: failure.node, reason: failure.reason } as const;\n }\n\n if (state.substitutionCount !== 1) {\n return {\n ok: false,\n node: objectLiteral,\n reason:\n `The payload parameter \\`${parameterName}\\` must appear exactly once in the returned ` +\n `object, but appears ${state.substitutionCount} times.`,\n } as const;\n }\n\n return { ok: true, typeSource: objectType } as const;\n};\n","import type { CallExpression } from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n} from 'typescript/unstable/ast';\nimport { WRAPPED_RESULT_SUBSTITUTION } from '../models/response-wrapper-substitution';\nimport { resolveSoleReturnExpression } from './resolve-sole-return-expression';\nimport { synthesizeGenericObjectType } from './synthesize-generic-object-type';\n\nexport const readMapOperation = (operator: CallExpression) => {\n const [callback] = operator.arguments;\n\n if (\n operator.arguments.length !== 1 ||\n callback === undefined ||\n !(isArrowFunction(callback) || isFunctionExpression(callback))\n ) {\n return {\n ok: false,\n node: operator,\n reason: 'The `map` operator must take a single arrow or function expression.',\n } as const;\n }\n\n const [parameter] = callback.parameters;\n\n if (\n callback.parameters.length !== 1 ||\n parameter === undefined ||\n !isIdentifier(parameter.name)\n ) {\n return {\n ok: false,\n node: callback,\n reason: 'The `map` callback must take exactly one plain parameter.',\n } as const;\n }\n\n const returnExpression = resolveSoleReturnExpression(callback.body);\n\n if (returnExpression === undefined || !isObjectLiteralExpression(returnExpression)) {\n return {\n ok: false,\n node: callback,\n reason: 'The `map` callback must return an object literal.',\n } as const;\n }\n\n const synthesis = synthesizeGenericObjectType(\n returnExpression,\n parameter.name.text,\n WRAPPED_RESULT_SUBSTITUTION,\n );\n\n if (!synthesis.ok) {\n return { ok: false, node: synthesis.node, reason: synthesis.reason } as const;\n }\n\n return {\n ok: true,\n operation: { parameterName: parameter.name.text, returnExpression },\n } as const;\n};\n","import { API } from 'typescript/unstable/sync';\n\nlet sharedApi: API | undefined;\n\n/**\n * The returned checker belongs to the snapshot opened for this file. Opening the next file\n * replaces that snapshot, so finish every checker query before calling this again.\n */\nexport const openSourceFile = (filePath: string) => {\n sharedApi ??= new API();\n\n sharedApi.updateSnapshot({ closeFiles: [filePath] });\n const snapshot = sharedApi.updateSnapshot({\n openFiles: [filePath],\n fileChanges: { changed: [filePath] },\n });\n const project = snapshot.getDefaultProjectForFile(filePath);\n const sourceFile = project?.program.getSourceFile(filePath);\n\n if (project === undefined || sourceFile === undefined) {\n throw new Error(`Unable to parse source file: ${filePath}`);\n }\n\n return { sourceFile, checker: project.checker };\n};\n","import { openSourceFile } from './open-source-file';\n\nexport const parseSourceFile = (filePath: string) => openSourceFile(filePath).sourceFile;\n","import { existsSync, realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve as resolvePath } from 'node:path';\n\nconst NODE_MODULES_DIRECTORY_NAME = 'node_modules';\nconst TYPESCRIPT_SOURCE_EXTENSIONS = ['.ts', '.tsx'];\nconst UNRESOLVED_ENTRY_ERROR_CODES = new Set<unknown>([\n 'MODULE_NOT_FOUND',\n 'ERR_PACKAGE_PATH_NOT_EXPORTED',\n]);\nconst DECLARATION_FILE_EXTENSIONS = ['.d.ts', '.d.mts', '.d.cts'];\n\nconst isTypeScriptSourceFile = (filePath: string) =>\n TYPESCRIPT_SOURCE_EXTENSIONS.some((extension) => filePath.endsWith(extension)) &&\n !DECLARATION_FILE_EXTENSIONS.some((extension) => filePath.endsWith(extension));\n\nconst isInsideNodeModules = (filePath: string) =>\n filePath.split(/[/]/).includes(NODE_MODULES_DIRECTORY_NAME);\n\nconst readPackageName = (moduleSpecifierText: string) => {\n const segments = moduleSpecifierText.split('/');\n return moduleSpecifierText.startsWith('@') ? segments.slice(0, 2).join('/') : segments[0];\n};\n\nconst findInstalledPackageDirectory = (fromFilePath: string, packageName: string) => {\n let directory = dirname(fromFilePath);\n\n for (;;) {\n const candidate = join(directory, NODE_MODULES_DIRECTORY_NAME, packageName);\n\n if (existsSync(candidate)) {\n return candidate;\n }\n\n const parent = dirname(directory);\n\n if (parent === directory) {\n return undefined;\n }\n\n directory = parent;\n }\n};\n\nconst resolveRelativeModule = (fromFilePath: string, moduleSpecifierText: string) => {\n const base = resolvePath(dirname(fromFilePath), moduleSpecifierText);\n const candidates = [`${base}.ts`, `${base}.tsx`, resolvePath(base, 'index.ts')];\n const filePath = candidates.find((candidate) => existsSync(candidate));\n\n return filePath === undefined ? undefined : ({ kind: 'source-file', filePath } as const);\n};\n\nconst resolveWorkspacePackageEntry = (fromFilePath: string, moduleSpecifierText: string) => {\n try {\n return createRequire(fromFilePath).resolve(moduleSpecifierText);\n } catch (error) {\n if (error instanceof Error && 'code' in error && UNRESOLVED_ENTRY_ERROR_CODES.has(error.code)) {\n return undefined;\n }\n\n throw error;\n }\n};\n\n/**\n * A bare specifier is a package when the installed copy lives in a `node_modules` directory once\n * symlinks are followed, or when its entry point is a declaration or JavaScript file. Only a\n * workspace library whose entry point is TypeScript source (a symlinked workspace package) can be\n * read, so it resolves to that source file. Anything that does not resolve at all is `undefined`.\n */\nconst resolveBareModule = (fromFilePath: string, moduleSpecifierText: string) => {\n const packageName = readPackageName(moduleSpecifierText);\n const packageDirectory =\n packageName === undefined\n ? undefined\n : findInstalledPackageDirectory(fromFilePath, packageName);\n\n if (packageDirectory === undefined) {\n return undefined;\n }\n\n if (isInsideNodeModules(realpathSync(packageDirectory))) {\n return { kind: 'package' } as const;\n }\n\n const entryPath = resolveWorkspacePackageEntry(fromFilePath, moduleSpecifierText);\n\n if (entryPath === undefined) {\n return undefined;\n }\n\n return isTypeScriptSourceFile(entryPath) && !isInsideNodeModules(entryPath)\n ? ({ kind: 'source-file', filePath: entryPath } as const)\n : ({ kind: 'package' } as const);\n};\n\nexport const resolveModuleOrigin = (fromFilePath: string, moduleSpecifierText: string) =>\n moduleSpecifierText.startsWith('.')\n ? resolveRelativeModule(fromFilePath, moduleSpecifierText)\n : resolveBareModule(fromFilePath, moduleSpecifierText);\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isClassDeclaration,\n isExportDeclaration,\n isImportDeclaration,\n isNamedExports,\n isNamedImports,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport type { ClassOrigin } from './class-origin';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveModuleOrigin } from './resolve-module-origin';\n\nexport interface ResolvedTypeDeclaration {\n classDeclaration: ClassDeclaration;\n sourceFile: SourceFile;\n filePath: string;\n}\n\ninterface ImportSource {\n moduleSpecifierText: string;\n importedName: string;\n}\n\nconst parsedFilesByPath = new Map<string, SourceFile>();\n\n/**\n * Each analysis entry point starts from an empty cache, so a long-running watch session never\n * resolves a class from a file version that has since changed.\n */\nexport const clearParsedFileCache = () => {\n parsedFilesByPath.clear();\n};\n\nconst parseFile = (filePath: string): SourceFile => {\n const cached = parsedFilesByPath.get(filePath);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const sourceFile = parseSourceFile(filePath);\n parsedFilesByPath.set(filePath, sourceFile);\n return sourceFile;\n};\n\nconst findExportedDeclaration = (\n sourceFile: SourceFile,\n name: string,\n): ClassDeclaration | undefined =>\n sourceFile.statements.find(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && statement.name?.text === name,\n );\n\nexport const findImportSource = (\n sourceFile: SourceFile,\n localName: string,\n): ImportSource | undefined => {\n for (const statement of sourceFile.statements) {\n if (!isImportDeclaration(statement) || !isStringLiteralLikeNode(statement.moduleSpecifier)) {\n continue;\n }\n\n const namedBindings = statement.importClause?.namedBindings;\n\n if (namedBindings === undefined || !isNamedImports(namedBindings)) {\n continue;\n }\n\n const element = namedBindings.elements.find((candidate) => candidate.name.text === localName);\n\n if (element !== undefined) {\n return {\n moduleSpecifierText: statement.moduleSpecifier.text,\n importedName: element.propertyName?.text ?? element.name.text,\n };\n }\n }\n\n return undefined;\n};\n\nconst findReExportSource = (sourceFile: SourceFile, name: string): string | undefined => {\n for (const statement of sourceFile.statements) {\n if (\n !isExportDeclaration(statement) ||\n statement.moduleSpecifier === undefined ||\n !isStringLiteralLikeNode(statement.moduleSpecifier)\n ) {\n continue;\n }\n\n if (statement.exportClause === undefined) {\n return statement.moduleSpecifier.text;\n }\n\n if (\n isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.some(\n (element) => (element.propertyName?.text ?? element.name.text) === name,\n )\n ) {\n return statement.moduleSpecifier.text;\n }\n }\n\n return undefined;\n};\n\nconst resolveImportedClassOrigin = (\n name: string,\n moduleSpecifierText: string,\n fromFilePath: string,\n visited: Set<string>,\n): ClassOrigin | undefined => {\n const moduleOrigin = resolveModuleOrigin(fromFilePath, moduleSpecifierText);\n\n if (moduleOrigin === undefined) {\n return undefined;\n }\n\n if (moduleOrigin.kind === 'package') {\n return { kind: 'package', moduleSpecifierText };\n }\n\n const origin = resolveOrigin(\n name,\n parseFile(moduleOrigin.filePath),\n moduleOrigin.filePath,\n visited,\n );\n\n return origin.kind === 'unresolved' ? undefined : origin;\n};\n\nconst resolveOrigin = (\n name: string,\n fromSourceFile: SourceFile,\n fromFilePath: string,\n visited: Set<string>,\n): ClassOrigin => {\n if (visited.has(fromFilePath)) {\n return { kind: 'unresolved' };\n }\n\n visited.add(fromFilePath);\n\n const direct = findExportedDeclaration(fromSourceFile, name);\n\n if (direct !== undefined) {\n return {\n kind: 'source',\n resolved: { classDeclaration: direct, sourceFile: fromSourceFile, filePath: fromFilePath },\n };\n }\n\n const importSource = findImportSource(fromSourceFile, name);\n const imported =\n importSource === undefined\n ? undefined\n : resolveImportedClassOrigin(\n importSource.importedName,\n importSource.moduleSpecifierText,\n fromFilePath,\n visited,\n );\n\n if (imported !== undefined) {\n return imported;\n }\n\n const reExportModuleSpecifierText = findReExportSource(fromSourceFile, name);\n const reExported =\n reExportModuleSpecifierText === undefined\n ? undefined\n : resolveImportedClassOrigin(name, reExportModuleSpecifierText, fromFilePath, visited);\n\n return reExported ?? { kind: 'unresolved' };\n};\n\n/**\n * Follows imports and re-exports from `fromSourceFile` to where the class named `name` comes\n * from: a TypeScript class declaration that can be read, a package that has no readable source,\n * or nowhere (the import does not resolve, or the name is not declared there).\n */\nexport const resolveClassOrigin = (\n name: string,\n fromSourceFile: SourceFile,\n fromFilePath: string,\n) => resolveOrigin(name, fromSourceFile, fromFilePath, new Set());\n\nexport const resolveClassDeclaration = (\n name: string,\n fromSourceFile: SourceFile,\n fromFilePath: string,\n) => {\n const origin = resolveClassOrigin(name, fromSourceFile, fromFilePath);\n return origin.kind === 'source' ? origin.resolved : undefined;\n};\n","import type { Expression, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier } from 'typescript/unstable/ast';\nimport { readMapOperation } from './read-map-operation';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst RXJS_MODULE_SPECIFIERS = ['rxjs', 'rxjs/operators'];\nconst MAP_OPERATOR_NAME = 'map';\nconst SHAPE_NEUTRAL_OPERATOR_NAMES = ['tap', 'timeout', 'finalize'];\n\nexport const readPipeOperator = (operator: Expression, sourceFile: SourceFile) => {\n if (!isCallExpression(operator) || !isIdentifier(operator.expression)) {\n return {\n ok: false,\n node: operator,\n reason: 'Pipe operators must be calls of operators imported by name from rxjs.',\n } as const;\n }\n\n const importSource = findImportSource(sourceFile, operator.expression.text);\n\n if (\n importSource === undefined ||\n !RXJS_MODULE_SPECIFIERS.includes(importSource.moduleSpecifierText)\n ) {\n return {\n ok: false,\n node: operator,\n reason: `Operator \\`${operator.expression.text}\\` is not imported from rxjs, so its effect on the response shape is unknown.`,\n } as const;\n }\n\n if (importSource.importedName === MAP_OPERATOR_NAME) {\n return readMapOperation(operator);\n }\n\n if (SHAPE_NEUTRAL_OPERATOR_NAMES.includes(importSource.importedName)) {\n return { ok: true, operation: undefined } as const;\n }\n\n return {\n ok: false,\n node: operator,\n reason: `Operator \\`${importSource.importedName}\\` changes or hides the response shape.`,\n } as const;\n};\n","import type { Node } from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isClassDeclaration,\n isClassExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isMethodDeclaration,\n isReturnStatement,\n} from 'typescript/unstable/ast';\n\nconst isNestedFunctionScope = (node: Node) =>\n isArrowFunction(node) ||\n isFunctionExpression(node) ||\n isFunctionDeclaration(node) ||\n isMethodDeclaration(node) ||\n isClassDeclaration(node) ||\n isClassExpression(node);\n\nexport const containsReturnStatement = (node: Node) => {\n if (isReturnStatement(node)) {\n return true;\n }\n\n if (isNestedFunctionScope(node)) {\n return false;\n }\n\n let found = false;\n\n node.forEachChild((child) => {\n if (containsReturnStatement(child)) {\n found = true;\n }\n\n return undefined;\n });\n\n return found;\n};\n","import type { Block, Expression } from 'typescript/unstable/ast';\nimport { isIdentifier, isReturnStatement, isVariableStatement } from 'typescript/unstable/ast';\nimport { containsReturnStatement } from './contains-return-statement';\nimport { unwrapParenthesizedExpression } from './unwrap-parenthesized-expression';\n\n/**\n * Any statements may precede the final `return` (logger setup, `const startedAt = Date.now()`),\n * but none of them may return early, since the response shape would then depend on the branch.\n * A returned identifier resolves to the initializer of the `const` declared with that name.\n */\nexport const resolveInterceptReturnExpression = (body: Block) => {\n const finalStatement = body.statements[body.statements.length - 1];\n\n if (\n finalStatement === undefined ||\n !isReturnStatement(finalStatement) ||\n finalStatement.expression === undefined\n ) {\n return {\n ok: false,\n node: finalStatement ?? body,\n reason: 'The last statement of intercept() must be a `return` statement with a value.',\n } as const;\n }\n\n const localDeclarations = new Map<string, Expression>();\n\n for (const statement of body.statements) {\n if (statement === finalStatement) {\n continue;\n }\n\n if (containsReturnStatement(statement)) {\n return {\n ok: false,\n node: statement,\n reason:\n 'intercept() returns before its last statement, so the response shape is ambiguous.',\n } as const;\n }\n\n if (isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (isIdentifier(declaration.name) && declaration.initializer !== undefined) {\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n }\n }\n }\n\n const returned = unwrapParenthesizedExpression(finalStatement.expression);\n\n if (!isIdentifier(returned)) {\n return { ok: true, expression: returned } as const;\n }\n\n const initializer = localDeclarations.get(returned.text);\n\n return initializer === undefined\n ? ({\n ok: false,\n node: returned,\n reason: `\\`${returned.text}\\` is not a local \\`const\\` initialized inside intercept().`,\n } as const)\n : ({ ok: true, expression: unwrapParenthesizedExpression(initializer) } as const);\n};\n","import type { Expression, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport type { InterceptorShape } from './interceptor-shape';\nimport type { MapOperation } from './map-operation';\nimport { readPipeOperator } from './read-pipe-operator';\nimport { resolveInterceptReturnExpression } from './resolve-intercept-return-expression';\n\nconst HANDLE_MEMBER_NAME = 'handle';\nconst PIPE_MEMBER_NAME = 'pipe';\nconst CALL_HANDLER_PARAMETER_INDEX = 1;\n\nconst isHandleCall = (expression: Expression, callHandlerName: string) =>\n isCallExpression(expression) &&\n expression.arguments.length === 0 &&\n isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === HANDLE_MEMBER_NAME &&\n isIdentifier(expression.expression.expression) &&\n expression.expression.expression.text === callHandlerName;\n\nexport const analyzeInterceptMethod = (method: MethodDeclaration, sourceFile: SourceFile) => {\n const callHandler = method.parameters[CALL_HANDLER_PARAMETER_INDEX];\n\n if (method.body === undefined || callHandler === undefined || !isIdentifier(callHandler.name)) {\n return {\n ok: false,\n node: method,\n reason: 'intercept() must have a body and name its CallHandler parameter.',\n } as const;\n }\n\n const returned = resolveInterceptReturnExpression(method.body);\n\n if (!returned.ok) {\n return returned;\n }\n\n const callHandlerName = callHandler.name.text;\n const expression = returned.expression;\n\n if (isHandleCall(expression, callHandlerName)) {\n const shape: InterceptorShape = { operations: [] };\n return { ok: true, shape } as const;\n }\n\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n expression.expression.name.text !== PIPE_MEMBER_NAME ||\n !isHandleCall(expression.expression.expression, callHandlerName)\n ) {\n return {\n ok: false,\n node: expression,\n reason: `intercept() must return \\`${callHandlerName}.handle()\\`, optionally piped through rxjs operators.`,\n } as const;\n }\n\n const operations: MapOperation[] = [];\n\n for (const operator of expression.arguments) {\n const read = readPipeOperator(operator, sourceFile);\n\n if (!read.ok) {\n return read;\n }\n\n if (read.operation !== undefined) {\n operations.push(read.operation);\n }\n }\n\n const shape: InterceptorShape = { operations };\n return { ok: true, shape } as const;\n};\n","import type { ClassDeclaration, MethodDeclaration } from 'typescript/unstable/ast';\nimport { isIdentifier, isMethodDeclaration } from 'typescript/unstable/ast';\nimport { analyzeInterceptMethod } from './analyze-intercept-method';\nimport type { ResolvedTypeDeclaration } from './resolve-type-declaration';\n\nconst INTERCEPT_METHOD_NAME = 'intercept';\n\nconst findInterceptMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === INTERCEPT_METHOD_NAME,\n );\n\nexport const analyzeInterceptorClass = (resolved: ResolvedTypeDeclaration) => {\n const interceptMethod = findInterceptMethod(resolved.classDeclaration.members);\n\n if (interceptMethod === undefined) {\n return {\n ok: false,\n location: resolved.classDeclaration,\n found: undefined,\n reason: 'The class declares no intercept() method of its own.',\n } as const;\n }\n\n const analysis = analyzeInterceptMethod(interceptMethod, resolved.sourceFile);\n\n return analysis.ok\n ? analysis\n : ({\n ok: false,\n location: interceptMethod,\n found: analysis.node.getText(),\n reason: analysis.reason,\n } as const);\n};\n","export const DECLARED_INTERCEPTOR_PREFIX = '__DeclaredInterceptor_';\n\nexport const declaredInterceptorReference = (interceptorName: string) =>\n `${DECLARED_INTERCEPTOR_PREFIX}${interceptorName}`;\n","import { declaredInterceptorReference } from '../models/declared-interceptor-reference';\nimport {\n UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE,\n WRAPPED_RESULT_SUBSTITUTION,\n} from '../models/response-wrapper-substitution';\nimport type { ChainLink, ShapeChainLink } from './chain-link';\nimport { synthesizeGenericObjectType } from './synthesize-generic-object-type';\n\nconst applyShape = (typeSource: string, link: ShapeChainLink) => {\n let composed = typeSource;\n\n for (const operation of link.shape.operations) {\n const synthesis = synthesizeGenericObjectType(\n operation.returnExpression,\n operation.parameterName,\n composed,\n );\n\n if (!synthesis.ok) {\n throw new Error(\n `[nestbridge] An interceptor shape that was validated can no longer be typed: ${synthesis.reason}`,\n );\n }\n\n composed = synthesis.typeSource;\n }\n\n return composed;\n};\n\n/**\n * `links` run outermost first, so the type is built from the innermost interceptor outward,\n * starting at the awaited server result. A declared alias with one type parameter wraps what is\n * inside it, one with none replaces it, and an interceptor nobody can read turns what is inside\n * it into `unknown`. Returns `undefined` when no interceptor changes the shape.\n */\nexport const composeWrapperTypeSource = (links: readonly ChainLink[]) => {\n let typeSource = WRAPPED_RESULT_SUBSTITUTION;\n let declaredInterceptors: string[] = [];\n\n for (const link of [...links].reverse()) {\n if (link.kind === 'shape') {\n typeSource = applyShape(typeSource, link);\n continue;\n }\n\n if (link.kind === 'unknown') {\n typeSource = UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE;\n declaredInterceptors = [];\n continue;\n }\n\n const { name, typeParameterCount } = link.declaration;\n const reference = declaredInterceptorReference(name);\n\n if (typeParameterCount === 0) {\n declaredInterceptors = [];\n }\n\n typeSource = typeParameterCount === 0 ? reference : `${reference}<${typeSource}>`;\n declaredInterceptors = [name, ...declaredInterceptors];\n }\n\n if (typeSource === WRAPPED_RESULT_SUBSTITUTION) {\n return undefined;\n }\n\n const uniqueDeclaredInterceptors = [...new Set(declaredInterceptors)];\n\n return uniqueDeclaredInterceptors.length === 0\n ? { wrappedResultTypeSource: typeSource }\n : { wrappedResultTypeSource: typeSource, declaredInterceptors: uniqueDeclaredInterceptors };\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\n\nexport const locationOf = (sourceFile: SourceFile, node: Node) => {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n return { line: line + 1, column: character + 1 };\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { locationOf } from './node-location';\n\ninterface InterceptorDiagnosticSource {\n controllerName: string;\n memberName: string;\n detail: string;\n found?: string;\n location: Node;\n sourceFile: SourceFile;\n filePath: string;\n}\n\nconst EXPECTED =\n 'An intercept() method that returns next.handle(), optionally piped through rxjs `map` ' +\n 'operators that return object literals and the shape-neutral `tap`, `timeout` and `finalize` ' +\n 'operators, registered as a class or `new Class()`. Routes under an interceptor that cannot ' +\n 'be analyzed are declared as AbortablePromise<unknown>.';\n\nexport const createInterceptorDiagnostic = (source: InterceptorDiagnosticSource) => {\n const location = locationOf(source.sourceFile, source.location);\n\n return {\n code: 'unsupported-interceptor',\n title: 'Unsupported interceptor.',\n controllerName: source.controllerName,\n memberName: source.memberName,\n detail: source.detail,\n found: source.found ?? source.location.getText(),\n expected: EXPECTED,\n filePath: source.filePath,\n line: location.line,\n column: location.column,\n } satisfies NestBridgeDiagnostic;\n};\n","import type {\n ClassDeclaration,\n Decorator,\n MethodDeclaration,\n ParameterDeclaration,\n PropertyDeclaration,\n} from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isDecorator,\n isIdentifier,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nconst getDecorators = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n) => {\n const decorators = node.modifiers?.filter(isDecorator);\n return decorators === undefined || decorators.length === 0 ? undefined : decorators;\n};\n\nexport const findDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorName: string,\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);\n};\n\nexport const findDecorators = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorName: string,\n) =>\n (getDecorators(node) ?? []).filter((decorator) => decoratorNameOf(decorator) === decoratorName);\n\nexport const hasAnyDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n) => getDecorators(node) !== undefined;\n\nexport const findAnyDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorNames: readonly string[],\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ''));\n};\n\nexport const decoratorNameOf = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (isCallExpression(expression) && isIdentifier(expression.expression)) {\n return expression.expression.text;\n }\n\n if (isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nexport const readStaticStringArgument = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true, value: undefined };\n }\n\n if (isStringLiteralLikeNode(firstArgument)) {\n return { ok: true, value: firstArgument.text };\n }\n\n return { ok: false, argumentText: firstArgument.getText() };\n};\n","import type { ClassDeclaration, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n} from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nconst MODULE_DECORATOR_NAME = 'Module';\n\nexport const hasModuleDecorator = (classDeclaration: ClassDeclaration) =>\n findDecorator(classDeclaration, MODULE_DECORATOR_NAME) !== undefined;\n\nexport const readModuleOption = (classDeclaration: ClassDeclaration, optionName: string) => {\n const moduleDecorator = findDecorator(classDeclaration, MODULE_DECORATOR_NAME);\n\n if (moduleDecorator === undefined || !isCallExpression(moduleDecorator.expression)) {\n return undefined;\n }\n\n const [moduleOptions] = moduleDecorator.expression.arguments;\n\n if (moduleOptions === undefined || !isObjectLiteralExpression(moduleOptions)) {\n return undefined;\n }\n\n return moduleOptions.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === optionName,\n );\n};\n","import type {\n ClassDeclaration,\n Node,\n ObjectLiteralExpression,\n PropertyAssignment,\n SourceFile,\n} from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSpreadElement,\n} from 'typescript/unstable/ast';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { readModuleOption } from './read-module-option';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst PROVIDERS_OPTION_NAME = 'providers';\nconst PROVIDE_PROPERTY_NAME = 'provide';\nconst USE_CLASS_PROPERTY_NAME = 'useClass';\nconst APP_INTERCEPTOR_LOCAL_NAME = 'APP_INTERCEPTOR';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\nconst UNSUPPORTED_PROVIDER_PROPERTY_NAMES = ['useFactory', 'useValue', 'useExisting'];\n\nconst findProperty = (provider: ObjectLiteralExpression, name: string) =>\n provider.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === name,\n );\n\nconst findUnsupportedProviderPropertyName = (provider: ObjectLiteralExpression) =>\n UNSUPPORTED_PROVIDER_PROPERTY_NAMES.find((name) => findProperty(provider, name) !== undefined);\n\n/**\n * Reads the `{ provide: APP_INTERCEPTOR, useClass: X }` providers of one module, in the order\n * they are declared. Only `useClass` can be analyzed: `useFactory`, `useValue`, `useExisting` and\n * spread providers are reported as problems because the interceptor behind them is unknown.\n */\nexport const findAppInterceptorProviderRegistrations = (\n moduleClassDeclaration: ClassDeclaration,\n moduleSourceFile: SourceFile,\n moduleFilePath: string,\n): InterceptorRegistrations => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const providersProperty = readModuleOption(moduleClassDeclaration, PROVIDERS_OPTION_NAME);\n const appInterceptorImportSource = findImportSource(moduleSourceFile, APP_INTERCEPTOR_LOCAL_NAME);\n\n if (\n providersProperty === undefined ||\n appInterceptorImportSource === undefined ||\n appInterceptorImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return registrations;\n }\n\n const reportProblem = (node: Node, detail: string) => {\n registrations.problems.push({\n node,\n sourceFile: moduleSourceFile,\n filePath: moduleFilePath,\n detail,\n });\n };\n\n if (!isArrayLiteralExpression(providersProperty.initializer)) {\n reportProblem(\n providersProperty.initializer,\n 'The `providers` of a module registering APP_INTERCEPTOR must be an array literal.',\n );\n return registrations;\n }\n\n for (const element of providersProperty.initializer.elements) {\n if (isSpreadElement(element)) {\n reportProblem(\n element,\n 'Spread providers cannot be analyzed, so an APP_INTERCEPTOR provider inside them would be missed.',\n );\n continue;\n }\n\n if (!isObjectLiteralExpression(element)) {\n continue;\n }\n\n const provideProperty = findProperty(element, PROVIDE_PROPERTY_NAME);\n\n if (\n provideProperty === undefined ||\n !isIdentifier(provideProperty.initializer) ||\n provideProperty.initializer.text !== APP_INTERCEPTOR_LOCAL_NAME\n ) {\n continue;\n }\n\n const unsupportedPropertyName = findUnsupportedProviderPropertyName(element);\n\n if (unsupportedPropertyName !== undefined) {\n reportProblem(\n element,\n `\\`${unsupportedPropertyName}\\` interceptor providers can't be analysed; use \\`useClass\\`.`,\n );\n continue;\n }\n\n const useClassProperty = findProperty(element, USE_CLASS_PROPERTY_NAME);\n\n if (useClassProperty === undefined || !isIdentifier(useClassProperty.initializer)) {\n reportProblem(\n element,\n 'An APP_INTERCEPTOR provider must state its interceptor as `useClass: InterceptorClass`.',\n );\n continue;\n }\n\n registrations.references.push({\n className: useClassProperty.initializer.text,\n node: useClassProperty.initializer,\n sourceFile: moduleSourceFile,\n filePath: moduleFilePath,\n });\n }\n\n return registrations;\n};\n","import { isArrayLiteralExpression, isIdentifier } from 'typescript/unstable/ast';\nimport { hasModuleDecorator, readModuleOption } from './read-module-option';\nimport { type ResolvedTypeDeclaration, resolveClassDeclaration } from './resolve-type-declaration';\n\nconst IMPORTS_OPTION_NAME = 'imports';\n\n/**\n * Only plain class identifiers that resolve to a local `@Module()` class are followed. Dynamic\n * modules such as `FooModule.forRoot()`, `forwardRef()` calls, spreads and package imports are\n * skipped because their providers cannot be read statically.\n */\nexport const readImportedModules = (module: ResolvedTypeDeclaration) => {\n const importsProperty = readModuleOption(module.classDeclaration, IMPORTS_OPTION_NAME);\n\n if (importsProperty === undefined || !isArrayLiteralExpression(importsProperty.initializer)) {\n return [];\n }\n\n const importedModules: ResolvedTypeDeclaration[] = [];\n\n for (const element of importsProperty.initializer.elements) {\n if (!isIdentifier(element)) {\n continue;\n }\n\n const resolved = resolveClassDeclaration(element.text, module.sourceFile, module.filePath);\n\n if (resolved !== undefined && hasModuleDecorator(resolved.classDeclaration)) {\n importedModules.push(resolved);\n }\n }\n\n return importedModules;\n};\n","import { findAppInterceptorProviderRegistrations } from './find-app-interceptor-provider-registrations';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { readImportedModules } from './read-imported-modules';\nimport type { ResolvedTypeDeclaration } from './resolve-type-declaration';\n\n/**\n * Nest scans modules depth-first starting at the root module, inserting a module before the\n * modules it imports, and a module reached twice keeps its first position. Registering the\n * `APP_INTERCEPTOR` providers module by module, each module's providers before its imports,\n * reproduces the order in which Nest adds them to the global interceptor list.\n */\nexport const collectModuleInterceptorRegistrations = (\n rootModule: ResolvedTypeDeclaration,\n contributingFiles: Set<string>,\n) => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const visitedModules = new Set<string>();\n\n const visit = (module: ResolvedTypeDeclaration) => {\n const moduleKey = `${module.filePath}#${module.classDeclaration.name?.text}`;\n\n if (visitedModules.has(moduleKey)) {\n return;\n }\n\n visitedModules.add(moduleKey);\n contributingFiles.add(module.filePath);\n\n const moduleRegistrations = findAppInterceptorProviderRegistrations(\n module.classDeclaration,\n module.sourceFile,\n module.filePath,\n );\n registrations.references.push(...moduleRegistrations.references);\n registrations.problems.push(...moduleRegistrations.problems);\n\n for (const importedModule of readImportedModules(module)) {\n visit(importedModule);\n }\n };\n\n visit(rootModule);\n\n return registrations;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\n\nconst USE_GLOBAL_INTERCEPTORS_METHOD_NAME = 'useGlobalInterceptors';\n\nconst collectUseGlobalInterceptorsCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_INTERCEPTORS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalInterceptorsCalls(child, calls);\n return undefined;\n });\n};\n\n/**\n * Returned in registration order: `useGlobalInterceptors` concatenates onto a single global\n * list, so a later call (or a later argument within one call) registers an interceptor that wraps\n * closer to the raw handler result.\n */\nexport const findBootstrapInterceptorRegistrations = (\n sourceFile: SourceFile,\n filePath: string,\n): InterceptorRegistrations => {\n const calls: CallExpression[] = [];\n collectUseGlobalInterceptorsCalls(sourceFile, calls);\n\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (isNewExpression(argument) && isIdentifier(argument.expression)) {\n registrations.references.push({\n className: argument.expression.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n registrations.problems.push({\n node: argument,\n sourceFile,\n filePath,\n detail:\n 'Global interceptors must be registered as `new InterceptorClass()` to be analyzed.',\n });\n }\n }\n\n return registrations;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst NEST_FACTORY_LOCAL_NAME = 'NestFactory';\nconst NEST_FACTORY_CREATE_METHOD_NAME = 'create';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nconst collectNestFactoryCreateCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n isIdentifier(node.expression.expression) &&\n node.expression.expression.text === NEST_FACTORY_LOCAL_NAME &&\n node.expression.name.text === NEST_FACTORY_CREATE_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectNestFactoryCreateCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findRootModuleClassName = (sourceFile: SourceFile) => {\n const nestFactoryImportSource = findImportSource(sourceFile, NEST_FACTORY_LOCAL_NAME);\n\n if (\n nestFactoryImportSource === undefined ||\n nestFactoryImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const calls: CallExpression[] = [];\n collectNestFactoryCreateCalls(sourceFile, calls);\n\n if (calls.length !== 1) {\n return undefined;\n }\n\n const [call] = calls;\n\n if (call === undefined) {\n return undefined;\n }\n\n const [moduleArgument] = call.arguments;\n\n return moduleArgument !== undefined && isIdentifier(moduleArgument)\n ? moduleArgument.text\n : undefined;\n};\n","import { collectModuleInterceptorRegistrations } from './collect-module-interceptor-registrations';\nimport { findBootstrapInterceptorRegistrations } from './find-bootstrap-interceptor-registrations';\nimport { findRootModuleClassName } from './find-root-module-class-name';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\n/**\n * The global interceptors in the order Nest runs them, outermost first: the `APP_INTERCEPTOR`\n * providers of the root module and of the local modules it imports, then the interceptors passed\n * to `useGlobalInterceptors()`.\n *\n * Verified against @nestjs/core 12.3.1: `NestFactory.create()` awaits `initialize()`, which calls\n * `DependenciesScanner.applyApplicationProviders()` (nest-factory.js line 108) and pushes every\n * `APP_INTERCEPTOR` instance onto the global list (scanner.js line 386,\n * application-config.js line 60). `useGlobalInterceptors()` can only run once `create()` has\n * returned, and it appends to the same list (application-config.js line 63). The first entry of\n * the list is the outermost interceptor. Request- and transient-scoped `APP_INTERCEPTOR`\n * providers are appended after all of them at request time and are not distinguished here.\n */\nexport const findGlobalInterceptorRegistrations = (\n bootstrapFilePath: string,\n contributingFiles: Set<string>,\n): InterceptorRegistrations => {\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n contributingFiles.add(bootstrapFilePath);\n\n const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);\n const rootModule =\n rootModuleClassName === undefined\n ? undefined\n : resolveClassDeclaration(rootModuleClassName, bootstrapSourceFile, bootstrapFilePath);\n\n const moduleRegistrations: InterceptorRegistrations =\n rootModule === undefined\n ? { references: [], problems: [] }\n : collectModuleInterceptorRegistrations(rootModule, contributingFiles);\n const bootstrapRegistrations = findBootstrapInterceptorRegistrations(\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n return {\n references: [...moduleRegistrations.references, ...bootstrapRegistrations.references],\n problems: [...moduleRegistrations.problems, ...bootstrapRegistrations.problems],\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier, isNewExpression } from 'typescript/unstable/ast';\nimport { findDecorators } from './decorator-inspection';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst USE_INTERCEPTORS_DECORATOR_NAME = 'UseInterceptors';\nconst NEST_COMMON_MODULE_SPECIFIER = '@nestjs/common';\n\n/**\n * Decorators are applied bottom-up and each one appends to the target's interceptor metadata, so\n * stacked `@UseInterceptors()` decorators contribute in reverse source order.\n */\nexport const findUseInterceptorsRegistrations = (\n target: ClassDeclaration | MethodDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n): InterceptorRegistrations => {\n const registrations: InterceptorRegistrations = { references: [], problems: [] };\n const importSource = findImportSource(sourceFile, USE_INTERCEPTORS_DECORATOR_NAME);\n\n if (\n importSource === undefined ||\n importSource.moduleSpecifierText !== NEST_COMMON_MODULE_SPECIFIER ||\n importSource.importedName !== USE_INTERCEPTORS_DECORATOR_NAME\n ) {\n return registrations;\n }\n\n const decorators = findDecorators(target, USE_INTERCEPTORS_DECORATOR_NAME).reverse();\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) {\n continue;\n }\n\n for (const argument of decorator.expression.arguments) {\n if (isIdentifier(argument)) {\n registrations.references.push({\n className: argument.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n if (isNewExpression(argument) && isIdentifier(argument.expression)) {\n registrations.references.push({\n className: argument.expression.text,\n node: argument,\n sourceFile,\n filePath,\n });\n continue;\n }\n\n registrations.problems.push({\n node: argument,\n sourceFile,\n filePath,\n detail:\n '@UseInterceptors() arguments must be interceptor classes or `new InterceptorClass()` to be analyzed.',\n });\n }\n }\n\n return registrations;\n};\n","import type { InterceptorShape } from './interceptor-shape';\n\n/**\n * An interceptor class that comes from a package has no TypeScript source to read, so it is\n * assumed not to change the response shape. A package interceptor that does change it, such as\n * `ClassSerializerInterceptor` with `@Exclude`, is not reflected in the generated types.\n */\nexport const PACKAGE_INTERCEPTOR_SHAPE: InterceptorShape = { operations: [] };\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { InterceptorDeclaration } from '../models/interceptor-declaration';\nimport { UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE } from '../models/response-wrapper-substitution';\nimport { analyzeInterceptorClass } from './analyze-interceptor-class';\nimport type { ChainLink } from './chain-link';\nimport { composeWrapperTypeSource } from './compose-wrapper-type-source';\nimport type { ControllerInterceptors } from './controller-interceptors';\nimport { createInterceptorDiagnostic } from './create-interceptor-diagnostic';\nimport { findGlobalInterceptorRegistrations } from './find-global-interceptor-registrations';\nimport { findUseInterceptorsRegistrations } from './find-use-interceptors-registrations';\nimport type { InterceptorProblem } from './interceptor-problem';\nimport type { InterceptorReference } from './interceptor-reference';\nimport type { InterceptorRegistrations } from './interceptor-registrations';\nimport type { InterceptorShape } from './interceptor-shape';\nimport { locationOf } from './node-location';\nimport { PACKAGE_INTERCEPTOR_SHAPE } from './package-interceptor-shape';\nimport { findImportSource, resolveClassOrigin } from './resolve-type-declaration';\n\nconst REGISTRATION_SUBJECT = '(interceptors)';\nconst INTERCEPT_MEMBER_NAME = 'intercept';\n\nexport interface InterceptorAnalysisOptions {\n bootstrapFilePath?: string;\n diagnostics: NestBridgeDiagnostic[];\n declarations?: readonly InterceptorDeclaration[];\n}\n\n/**\n * Resolves, for each JSON route, the interceptors that apply to it (global, then controller, then\n * route, outermost first) and the response shape they give it. Every interceptor class is\n * analyzed once and every problem is reported once, however many routes the interceptor reaches.\n * Global interceptors are only read when the first JSON route asks for them.\n */\nexport const createInterceptorAnalysis = (options: InterceptorAnalysisOptions) => {\n const { bootstrapFilePath, diagnostics } = options;\n const declarationsByName = new Map(\n (options.declarations ?? []).map((declaration) => [declaration.name, declaration]),\n );\n const contributingFiles = new Set<string>();\n const shapesByInterceptor = new Map<string, InterceptorShape | undefined>();\n let globalRegistrations: InterceptorRegistrations | undefined;\n\n const reportRegistrationProblem = (problem: InterceptorProblem) => {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: REGISTRATION_SUBJECT,\n memberName: '',\n detail: problem.detail,\n location: problem.node,\n sourceFile: problem.sourceFile,\n filePath: problem.filePath,\n }),\n );\n };\n\n const reportUnresolvedReference = (reference: InterceptorReference) => {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: reference.className,\n memberName: '',\n detail:\n `Interceptor \\`${reference.className}\\` does not resolve to a class declared in a local ` +\n 'source file, so its effect on the response shape is unknown.',\n location: reference.node,\n sourceFile: reference.sourceFile,\n filePath: reference.filePath,\n }),\n );\n };\n\n const resolveShape = (reference: InterceptorReference) => {\n const origin = resolveClassOrigin(\n reference.className,\n reference.sourceFile,\n reference.filePath,\n );\n\n if (origin.kind === 'package') {\n return PACKAGE_INTERCEPTOR_SHAPE;\n }\n\n if (origin.kind === 'unresolved') {\n const location = locationOf(reference.sourceFile, reference.node);\n const referenceKey = `${reference.filePath}:${location.line}:${location.column}`;\n\n if (!shapesByInterceptor.has(referenceKey)) {\n shapesByInterceptor.set(referenceKey, undefined);\n reportUnresolvedReference(reference);\n }\n\n return undefined;\n }\n\n const { resolved } = origin;\n contributingFiles.add(resolved.filePath);\n const interceptorKey = `${resolved.filePath}#${resolved.classDeclaration.name?.text}`;\n\n if (shapesByInterceptor.has(interceptorKey)) {\n return shapesByInterceptor.get(interceptorKey);\n }\n\n const analysis = analyzeInterceptorClass(resolved);\n\n if (!analysis.ok) {\n diagnostics.push(\n createInterceptorDiagnostic({\n controllerName: resolved.classDeclaration.name?.text ?? reference.className,\n memberName: INTERCEPT_MEMBER_NAME,\n detail: analysis.reason,\n found: analysis.found,\n location: analysis.location,\n sourceFile: resolved.sourceFile,\n filePath: resolved.filePath,\n }),\n );\n }\n\n const shape = analysis.ok ? analysis.shape : undefined;\n shapesByInterceptor.set(interceptorKey, shape);\n return shape;\n };\n\n const exportedNameOf = (reference: InterceptorReference) =>\n findImportSource(reference.sourceFile, reference.className)?.importedName ??\n reference.className;\n\n const resolveLink = (reference: InterceptorReference): ChainLink => {\n const declaration = declarationsByName.get(exportedNameOf(reference));\n\n if (declaration !== undefined) {\n return { kind: 'declared', declaration };\n }\n\n const shape = resolveShape(reference);\n return shape === undefined ? { kind: 'unknown' } : { kind: 'shape', shape };\n };\n\n const readGlobalRegistrations = () => {\n if (globalRegistrations === undefined) {\n globalRegistrations =\n bootstrapFilePath === undefined\n ? { references: [], problems: [] }\n : findGlobalInterceptorRegistrations(bootstrapFilePath, contributingFiles);\n globalRegistrations.problems.forEach(reportRegistrationProblem);\n }\n\n return globalRegistrations;\n };\n\n const forController = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n ) => {\n let controllerRegistrations: InterceptorRegistrations | undefined;\n\n const readControllerRegistrations = () => {\n if (controllerRegistrations === undefined) {\n controllerRegistrations = findUseInterceptorsRegistrations(\n classDeclaration,\n sourceFile,\n filePath,\n );\n controllerRegistrations.problems.forEach(reportRegistrationProblem);\n }\n\n return controllerRegistrations;\n };\n\n const responseWrapperOf = (method: MethodDeclaration) => {\n const methodRegistrations = findUseInterceptorsRegistrations(method, sourceFile, filePath);\n methodRegistrations.problems.forEach(reportRegistrationProblem);\n\n const chain = [readGlobalRegistrations(), readControllerRegistrations(), methodRegistrations];\n const links = chain.flatMap(({ references }) => references.map(resolveLink));\n\n if (chain.some(({ problems }) => problems.length > 0)) {\n return { wrappedResultTypeSource: UNRESOLVED_WRAPPED_RESULT_TYPE_SOURCE };\n }\n\n return composeWrapperTypeSource(links);\n };\n\n const interceptors: ControllerInterceptors = { responseWrapperOf };\n return interceptors;\n };\n\n return { forController, contributingFiles: () => [...contributingFiles] };\n};\n","export type GraphqlOperationKind = 'query' | 'mutation';\n\nexport const GRAPHQL_OPERATION_DECORATOR_NAMES: Record<string, GraphqlOperationKind> = {\n Query: 'query',\n Mutation: 'mutation',\n};\n","export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport const HTTP_METHOD_DECORATOR_NAMES: Record<string, HttpMethod> = {\n Get: 'GET',\n Post: 'POST',\n Put: 'PUT',\n Patch: 'PATCH',\n Delete: 'DELETE',\n};\n","export type MessageKind = 'event' | 'message';\n\nexport const MESSAGE_PATTERN_DECORATOR_NAMES: Record<string, MessageKind> = {\n EventPattern: 'event',\n MessagePattern: 'message',\n};\n","import type { MethodDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator, hasAnyDecorator } from './decorator-inspection';\n\nconst PAYLOAD_DECORATOR_NAME = 'Payload';\n\n/**\n * Nest passes the payload to the `@Payload()` parameter. Without decorators it passes it as the\n * first argument; once any parameter is decorated (`@Ctx()`, a custom decorator), undecorated\n * parameters receive nothing, so the handler takes no payload.\n */\nexport const findPayloadParameterIndex = (method: MethodDeclaration) => {\n const payloadIndex = method.parameters.findIndex(\n (parameter) => findDecorator(parameter, PAYLOAD_DECORATOR_NAME) !== undefined,\n );\n\n if (payloadIndex !== -1) {\n return payloadIndex;\n }\n\n if (method.parameters.length === 0 || method.parameters.some(hasAnyDecorator)) {\n return null;\n }\n\n return 0;\n};\n","import type { Node } from 'typescript/unstable/ast';\nimport type { Checker, Type } from 'typescript/unstable/sync';\nimport type { MessagePattern } from '../models/message-pattern';\n\nexport const readLiteralType = (\n type: Type,\n checker: Checker,\n location: Node,\n): MessagePattern | undefined => {\n if (type.isStringLiteralType() || type.isNumberLiteralType() || type.isBooleanLiteralType()) {\n return type.value;\n }\n\n if (!type.isObjectType()) {\n return undefined;\n }\n\n const pattern: Record<string, MessagePattern> = {};\n\n for (const property of checker.getPropertiesOfType(type)) {\n const value = readLiteralType(\n checker.getTypeOfSymbolAtLocation(property, location),\n checker,\n location,\n );\n\n if (value === undefined) {\n return undefined;\n }\n\n pattern[property.name] = value;\n }\n\n return pattern;\n};\n","import type { Expression, PropertyName } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { MessagePattern } from '../models/message-pattern';\nimport { readLiteralType } from './read-literal-type';\n\nconst readPropertyName = (name: PropertyName) => {\n if (isIdentifier(name) || isStringLiteralLikeNode(name) || isNumericLiteral(name)) {\n return name.text;\n }\n\n return undefined;\n};\n\n/**\n * Object literals are read from the syntax because the checker widens their property types\n * (`{ cmd: 'count' }` is `{ cmd: string }`). Everything else, including identifiers and property\n * accesses that point at `const` values or `as const` objects, is read from its literal type.\n */\nexport const readMessagePattern = (\n expression: Expression,\n checker: Checker,\n): MessagePattern | undefined => {\n if (isStringLiteralLikeNode(expression)) {\n return expression.text;\n }\n\n if (isNumericLiteral(expression)) {\n return Number(expression.text);\n }\n\n if (!isObjectLiteralExpression(expression)) {\n const type = checker.getTypeAtLocation(expression);\n return type === undefined ? undefined : readLiteralType(type, checker, expression);\n }\n\n const pattern: Record<string, MessagePattern> = {};\n\n for (const property of expression.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n const name = readPropertyName(property.name);\n const value = readMessagePattern(property.initializer, checker);\n\n if (name === undefined || value === undefined) {\n return undefined;\n }\n\n pattern[name] = value;\n }\n\n return pattern;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression, isIdentifier } from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { NestBridgeDiagnostic } from '../diagnostics';\nimport { MESSAGE_PATTERN_DECORATOR_NAMES } from '../models';\nimport { decoratorNameOf, findAnyDecorator } from './decorator-inspection';\nimport { findPayloadParameterIndex } from './find-payload-parameter-index';\nimport { locationOf } from './node-location';\nimport { readMessagePattern } from './read-message-pattern';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n checker: Checker;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractMessageHandlerDefinition = (\n method: MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(MESSAGE_PATTERN_DECORATOR_NAMES));\n const decoratorName = decorator === undefined ? undefined : decoratorNameOf(decorator);\n const kind =\n decoratorName === undefined ? undefined : MESSAGE_PATTERN_DECORATOR_NAMES[decoratorName];\n\n if (decorator === undefined || kind === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const location = locationOf(context.sourceFile, method);\n const [patternArgument] = isCallExpression(decorator.expression)\n ? decorator.expression.arguments\n : [];\n\n const reportUnsupported = (detail: string) => {\n context.diagnostics.push({\n code: 'unsupported-message-pattern',\n title: 'Unsupported message pattern.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail,\n found: `@${decoratorName}(${patternArgument?.getText() ?? ''})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n };\n\n if (!isIdentifier(method.name)) {\n return reportUnsupported('Message handlers need a plain identifier method name.');\n }\n\n if (patternArgument === undefined) {\n return reportUnsupported(`@${decoratorName}() needs a pattern.`);\n }\n\n const pattern = readMessagePattern(patternArgument, context.checker);\n\n if (pattern === undefined) {\n return reportUnsupported(\n 'Message patterns must be statically known: a string or number literal, an object literal of those, or a const value (use \"as const\" for objects).',\n );\n }\n\n return {\n name: methodName,\n kind,\n pattern,\n payloadParameterIndex: findPayloadParameterIndex(method),\n line: location.line,\n column: location.column,\n };\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ControllerParameterDefinition } from '../models/controller-parameter-definition';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n hasAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { locationOf } from './node-location';\n\nconst SUPPORTED_PARAMETER_DECORATORS = ['Param', 'Query', 'Body', 'Headers'] as const;\nconst KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = ['Req', 'Res', 'Request', 'Response'] as const;\n\nconst TRANSPORT_PARAMETER_DECORATORS = [\n ...SUPPORTED_PARAMETER_DECORATORS,\n ...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS,\n];\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const isServerResolvedParameter = (parameter: ParameterDeclaration) =>\n hasAnyDecorator(parameter) &&\n findAnyDecorator(parameter, TRANSPORT_PARAMETER_DECORATORS) === undefined;\n\nexport const extractParameterDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ControllerParameterDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, TRANSPORT_PARAMETER_DECORATORS);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorName = decoratorNameOf(decorator);\n\n if (\n decoratorName !== undefined &&\n (KNOWN_UNSUPPORTED_PARAMETER_DECORATORS as readonly string[]).includes(decoratorName)\n ) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge HTTP client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,\n found: `@${decoratorName}(${argument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const base = {\n index,\n parameterName: parameter.name.text,\n };\n\n if (decoratorName === 'Param') {\n return { ...base, kind: 'param', name: argument.value };\n }\n\n if (decoratorName === 'Headers') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Headers() is not supported; provide a header name such as @Headers('x-example').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'header', name: argument.value };\n }\n\n if (decoratorName === 'Query') {\n return { ...base, kind: 'query', name: argument.value };\n }\n\n return { ...base, kind: 'body', name: argument.value };\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport { isLiteralTypeNode, SyntaxKind } from 'typescript/unstable/ast';\n\nexport const isNullishTypeNode = (typeNode: TypeNode) =>\n typeNode.kind === SyntaxKind.UndefinedKeyword ||\n typeNode.kind === SyntaxKind.NullKeyword ||\n (isLiteralTypeNode(typeNode) && typeNode.literal.kind === SyntaxKind.NullKeyword);\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport {\n isArrayTypeNode,\n isIdentifier,\n isTypeReferenceNode,\n isUnionTypeNode,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nimport { isNullishTypeNode } from './is-nullish-type-node';\n\nconst PRIMITIVE_SCALAR_TYPES: Record<string, string> = {\n string: 'String',\n number: 'Float',\n boolean: 'Boolean',\n};\n\nexport interface UnwrappedTypeNode {\n identifierText: string;\n isArray: boolean;\n isNullable: boolean;\n}\n\nexport const unwrapPromise = (typeNode: TypeNode): TypeNode => {\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Promise' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return unwrapPromise(typeNode.typeArguments[0]);\n }\n\n return typeNode;\n};\n\nconst unwrapNullable = (typeNode: TypeNode) => {\n if (!isUnionTypeNode(typeNode)) {\n return { inner: typeNode, isNullable: false };\n }\n\n const nonNullMembers = typeNode.types.filter((member) => !isNullishTypeNode(member));\n const [onlyMember] = nonNullMembers;\n\n if (nonNullMembers.length !== 1 || onlyMember === undefined) {\n return { inner: typeNode, isNullable: nonNullMembers.length !== typeNode.types.length };\n }\n\n return { inner: onlyMember, isNullable: true };\n};\n\nconst unwrapArrayElement = (typeNode: TypeNode): TypeNode | undefined => {\n if (isArrayTypeNode(typeNode)) {\n return typeNode.elementType;\n }\n\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Array' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return typeNode.typeArguments[0];\n }\n\n return undefined;\n};\n\nconst identifierTextOf = (typeNode: TypeNode): string | undefined => {\n if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n\n switch (typeNode.kind) {\n case SyntaxKind.StringKeyword:\n return 'string';\n case SyntaxKind.NumberKeyword:\n return 'number';\n case SyntaxKind.BooleanKeyword:\n return 'boolean';\n default:\n return undefined;\n }\n};\n\nexport const unwrapTypeNode = (typeNode: TypeNode): UnwrappedTypeNode | undefined => {\n const withoutPromise = unwrapPromise(typeNode);\n const { inner: withoutNullable, isNullable } = unwrapNullable(withoutPromise);\n const arrayElement = unwrapArrayElement(withoutNullable);\n const element = arrayElement === undefined ? withoutNullable : unwrapNullable(arrayElement).inner;\n const identifierText = identifierTextOf(element);\n\n if (identifierText === undefined) {\n return undefined;\n }\n\n return { identifierText, isArray: arrayElement !== undefined, isNullable };\n};\n\nexport const graphqlScalarNameFor = (identifierText: string) =>\n PRIMITIVE_SCALAR_TYPES[identifierText] ?? identifierText;\n\nexport const graphqlTypeStringFor = (unwrapped: UnwrappedTypeNode, explicitTypeName?: string) => {\n const baseName = explicitTypeName ?? graphqlScalarNameFor(unwrapped.identifierText);\n const wrapped = unwrapped.isArray ? `[${baseName}!]` : baseName;\n return unwrapped.isNullable ? wrapped : `${wrapped}!`;\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport { isIdentifier, isTypeReferenceNode } from 'typescript/unstable/ast';\nimport type { ResponseKind } from '../models/response-kind';\nimport { unwrapPromise } from './graphql-scalar-type';\n\nconst OBSERVABLE_TYPE_NAME = 'Observable';\nconst STREAMABLE_FILE_TYPE_NAME = 'StreamableFile';\n\nexport const readResponseKind = (returnType: TypeNode | undefined): ResponseKind => {\n if (returnType === undefined) {\n return 'json';\n }\n\n const unwrapped = unwrapPromise(returnType);\n\n if (!isTypeReferenceNode(unwrapped) || !isIdentifier(unwrapped.typeName)) {\n return 'json';\n }\n\n if (unwrapped.typeName.text === OBSERVABLE_TYPE_NAME) {\n return 'observable';\n }\n\n if (unwrapped.typeName.text === STREAMABLE_FILE_TYPE_NAME) {\n return 'stream';\n }\n\n return 'json';\n};\n","import type { Expression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nconst VERSION_NEUTRAL_NAME = 'VERSION_NEUTRAL';\n\nconst readSingleRouteVersion = (expression: Expression) => {\n if (isStringLiteralLikeNode(expression)) {\n return { ok: true as const, version: expression.text };\n }\n\n if (isIdentifier(expression) && expression.text === VERSION_NEUTRAL_NAME) {\n return { ok: true as const, version: null };\n }\n\n return { ok: false as const, argumentText: expression.getText() };\n};\n\n/**\n * An array of versions registers the route once per version, so any one of them is a valid URL;\n * the first is used.\n */\nexport const readRouteVersion = (expression: Expression) => {\n if (!isArrayLiteralExpression(expression)) {\n return readSingleRouteVersion(expression);\n }\n\n const [firstElement] = expression.elements;\n\n return firstElement === undefined\n ? { ok: false as const, argumentText: expression.getText() }\n : readSingleRouteVersion(firstElement);\n};\n","const trimSlashes = (segment: string) => segment.replace(/^\\/+/, '').replace(/\\/+$/, '');\n\nexport const joinRoutePath = (controllerPath: string, methodPath: string | undefined) => {\n const segments = [trimSlashes(controllerPath), trimSlashes(methodPath ?? '')].filter(\n (segment) => segment.length > 0,\n );\n\n return `/${segments.join('/')}`;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isCallExpression } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics';\nimport { HTTP_METHOD_DECORATOR_NAMES } from '../models';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n findDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport {\n extractParameterDefinition,\n isServerResolvedParameter,\n} from './extract-parameter-definition';\nimport { locationOf } from './node-location';\nimport { readResponseKind } from './read-response-kind';\nimport { readRouteVersion } from './read-route-version';\nimport { joinRoutePath } from './route-path';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n controllerPath: string;\n controllerVersion: string | null | undefined;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nconst VERSION_DECORATOR_NAME = 'Version';\n\nconst readMethodVersion = (method: MethodDeclaration, context: ExtractionContext) => {\n const decorator = findDecorator(method, VERSION_DECORATOR_NAME);\n\n if (decorator === undefined) {\n return { value: context.controllerVersion };\n }\n\n const [argument] = isCallExpression(decorator.expression) ? decorator.expression.arguments : [];\n const routeVersion = argument === undefined ? undefined : readRouteVersion(argument);\n\n if (routeVersion?.ok === true) {\n return { value: routeVersion.version };\n }\n\n const location = locationOf(context.sourceFile, method);\n\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: method.name.getText(),\n detail: 'Route versions must be statically analyzable.',\n found: `@Version(${routeVersion?.argumentText ?? ''})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n};\n\nexport const extractMethodDefinition = (method: MethodDeclaration, context: ExtractionContext) => {\n const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];\n\n if (httpMethod === undefined) {\n return undefined;\n }\n\n const routeArgument = readStaticStringArgument(decorator);\n\n if (!routeArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail: 'Route paths must be statically analyzable.',\n found: `@${decoratorName}(${routeArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const version = readMethodVersion(method, context);\n\n if (version === undefined) {\n return undefined;\n }\n\n const serverOnlyParameterIndexes = method.parameters.flatMap((parameter, index) =>\n isServerResolvedParameter(parameter) ? [index] : [],\n );\n\n const parameters = method.parameters.map((parameter, index) =>\n serverOnlyParameterIndexes.includes(index)\n ? null\n : extractParameterDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n controllerName: context.controllerName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (parameters.some((parameter) => parameter === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n httpMethod,\n path: joinRoutePath(context.controllerPath, routeArgument.value),\n version: version.value,\n parameters: parameters.filter((parameter) => parameter !== undefined && parameter !== null),\n serverOnlyParameterIndexes,\n responseKind: readResponseKind(method.type),\n line: location.line,\n column: location.column,\n };\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport { readRouteVersion } from './read-route-version';\n\nconst PATH_OPTION_NAME = 'path';\nconst VERSION_OPTION_NAME = 'version';\n\nconst optionNameOf = (property: PropertyAssignment) => {\n const name = property.name;\n return isIdentifier(name) || isStringLiteralLikeNode(name) ? name.text : undefined;\n};\n\nexport const readControllerOptions = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true as const, path: undefined, version: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true as const, path: undefined, version: undefined };\n }\n\n if (isStringLiteralLikeNode(firstArgument)) {\n return { ok: true as const, path: firstArgument.text, version: undefined };\n }\n\n if (!isObjectLiteralExpression(firstArgument)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n let path: string | undefined;\n let version: string | null | undefined;\n\n for (const property of firstArgument.properties) {\n if (!isPropertyAssignment(property)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n const optionName = optionNameOf(property);\n\n if (optionName === PATH_OPTION_NAME) {\n if (!isStringLiteralLikeNode(property.initializer)) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n path = property.initializer.text;\n }\n\n if (optionName === VERSION_OPTION_NAME) {\n const routeVersion = readRouteVersion(property.initializer);\n\n if (!routeVersion.ok) {\n return { ok: false as const, argumentText: firstArgument.getText() };\n }\n\n version = routeVersion.version;\n }\n }\n\n return { ok: true as const, path, version };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { Checker } from 'typescript/unstable/sync';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { findDecorator } from './decorator-inspection';\nimport { extractMessageHandlerDefinition } from './extract-message-handler-definition';\nimport { extractMethodDefinition } from './extract-method-definition';\nimport { locationOf } from './node-location';\nimport { readControllerOptions } from './read-controller-options';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n checker: Checker;\n messagePatterns: boolean;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractControllerDefinition = (\n classDeclaration: ClassDeclaration,\n context: ExtractionContext,\n) => {\n const { sourceFile, filePath, diagnostics } = context;\n const controllerName = classDeclaration.name?.text ?? '(anonymous controller)';\n const decorator = findDecorator(classDeclaration, 'Controller');\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const location = locationOf(sourceFile, classDeclaration);\n const options = readControllerOptions(decorator);\n\n if (!options.ok) {\n diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName,\n memberName: '',\n detail: 'Controller paths and versions must be statically analyzable.',\n found: `@Controller(${options.argumentText})`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const memberMethods = classDeclaration.members.filter((member): member is MethodDeclaration =>\n isMethodDeclaration(member),\n );\n\n const methods = memberMethods\n .map((method) =>\n extractMethodDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n controllerPath: options.path ?? '',\n controllerVersion: options.version,\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n const messageHandlers = context.messagePatterns\n ? memberMethods\n .map((method) =>\n extractMessageHandlerDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n checker: context.checker,\n diagnostics,\n }),\n )\n .filter((handler) => handler !== undefined)\n : [];\n\n return {\n name: controllerName,\n path: options.path ?? '',\n sourceFile: filePath,\n methods,\n messageHandlers,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findControllerClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Controller') !== undefined,\n );\n};\n","export const INTERCEPTOR_DECLARATION_FILE_NAMES = [\n 'nestbridge.d.ts',\n 'nestbridge-env.d.ts',\n] as const;\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { INTERCEPTOR_DECLARATION_FILE_NAMES } from './interceptor-declaration-file-names';\nimport { locationOf } from './node-location';\n\ninterface InterceptorDeclarationDiagnosticSource {\n subject: string;\n detail: string;\n location: Node;\n sourceFile: SourceFile;\n filePath: string;\n}\n\nconst EXPECTED =\n `Only exported \\`type\\` aliases with zero or one type parameter, named after an interceptor ` +\n `class, in ${INTERCEPTOR_DECLARATION_FILE_NAMES.join(' or ')}. Imports and declarations that are not ` +\n 'exported are allowed as helpers.';\n\nexport const createInterceptorDeclarationDiagnostic = (\n source: InterceptorDeclarationDiagnosticSource,\n) => {\n const location = locationOf(source.sourceFile, source.location);\n\n return {\n code: 'invalid-interceptor-declaration',\n title: 'Invalid interceptor declaration.',\n controllerName: source.subject,\n memberName: '',\n detail: source.detail,\n found: source.location.getText(),\n expected: EXPECTED,\n filePath: source.filePath,\n line: location.line,\n column: location.column,\n } satisfies NestBridgeDiagnostic;\n};\n","import { existsSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport type { Node, SourceFile, TypeAliasDeclaration } from 'typescript/unstable/ast';\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isFunctionDeclaration,\n isIdentifier,\n isInterfaceDeclaration,\n isModuleDeclaration,\n isNamedExports,\n isTypeAliasDeclaration,\n isVariableStatement,\n ModifierFlags,\n} from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { InterceptorDeclaration } from '../models/interceptor-declaration';\nimport { createInterceptorDeclarationDiagnostic } from './create-interceptor-declaration-diagnostic';\nimport { parseSourceFile } from './parse-source-file';\n\nexport interface InterceptorDeclarationsReading {\n declarations: InterceptorDeclaration[];\n diagnostics: NestBridgeDiagnostic[];\n}\n\ninterface UnsupportedStatement {\n subject: string;\n detail: string;\n}\n\nconst ONLY_TYPE_ALIASES_DETAIL =\n 'Only `type` aliases can be exported from an interceptor declarations file.';\n\nconst isExported = (statement: { modifierFlags: ModifierFlags }) =>\n (statement.modifierFlags & ModifierFlags.Export) !== 0;\n\nconst findUnsupportedStatement = (\n statement: Node,\n fileName: string,\n): UnsupportedStatement | undefined => {\n if (isModuleDeclaration(statement)) {\n const subject = isIdentifier(statement.name) ? statement.name.text : statement.name.getText();\n\n if (isIdentifier(statement.name) && statement.name.text === 'global') {\n return {\n subject,\n detail: '`declare global` cannot be used in an interceptor declarations file.',\n };\n }\n\n if (!isIdentifier(statement.name)) {\n return {\n subject,\n detail: '`declare module` cannot be used in an interceptor declarations file.',\n };\n }\n\n return isExported(statement)\n ? { subject, detail: 'An exported namespace cannot be used as an interceptor declaration.' }\n : undefined;\n }\n\n if (isExportAssignment(statement)) {\n return {\n subject: fileName,\n detail: '`export =` and `export default` cannot declare an interceptor.',\n };\n }\n\n if (isExportDeclaration(statement)) {\n const isEmptyMarker =\n statement.moduleSpecifier === undefined &&\n statement.exportClause !== undefined &&\n isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.length === 0;\n\n return isEmptyMarker\n ? undefined\n : {\n subject: fileName,\n detail:\n 'Re-exports and export lists cannot declare an interceptor; declare the alias with `export type Name = ...`.',\n };\n }\n\n if (isInterfaceDeclaration(statement) && isExported(statement)) {\n return {\n subject: statement.name.text,\n detail:\n 'An exported interface cannot be used as an interceptor declaration; use a `type` alias.',\n };\n }\n\n if ((isClassDeclaration(statement) || isEnumDeclaration(statement)) && isExported(statement)) {\n return {\n subject: statement.name?.text ?? fileName,\n detail: ONLY_TYPE_ALIASES_DETAIL,\n };\n }\n\n if (isFunctionDeclaration(statement) && isExported(statement)) {\n return {\n subject: statement.name?.text ?? fileName,\n detail: ONLY_TYPE_ALIASES_DETAIL,\n };\n }\n\n if (isVariableStatement(statement) && isExported(statement)) {\n return { subject: fileName, detail: ONLY_TYPE_ALIASES_DETAIL };\n }\n\n return undefined;\n};\n\nconst typeParameterCountOf = (alias: TypeAliasDeclaration) => alias.typeParameters?.length ?? 0;\n\ninterface DeclarationRegistry {\n accepted: Map<string, InterceptorDeclaration>;\n conflicted: Set<string>;\n}\n\nconst readStatements = (\n sourceFile: SourceFile,\n filePath: string,\n registry: DeclarationRegistry,\n) => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const fileName = basename(filePath);\n\n const report = (statement: Node, subject: string, detail: string) => {\n diagnostics.push(\n createInterceptorDeclarationDiagnostic({\n subject,\n detail,\n location: statement,\n sourceFile,\n filePath,\n }),\n );\n };\n\n for (const statement of sourceFile.statements) {\n if (isTypeAliasDeclaration(statement) && isExported(statement)) {\n const name = statement.name.text;\n const typeParameterCount = typeParameterCountOf(statement);\n\n if (typeParameterCount > 1) {\n report(\n statement,\n name,\n `\\`${name}\\` declares ${typeParameterCount} type parameters; an interceptor ` +\n 'declaration takes none (a fixed shape) or one (the shape from inside).',\n );\n continue;\n }\n\n const earlier = registry.accepted.get(name);\n\n if (earlier !== undefined) {\n registry.conflicted.add(name);\n report(\n statement,\n name,\n `\\`${name}\\` is already declared in ${basename(earlier.filePath)}. Neither declaration is used; ` +\n 'declare each interceptor in one file only.',\n );\n continue;\n }\n\n registry.accepted.set(name, {\n name,\n filePath,\n typeParameterCount: typeParameterCount === 0 ? 0 : 1,\n });\n continue;\n }\n\n const unsupported = findUnsupportedStatement(statement, fileName);\n\n if (unsupported !== undefined) {\n report(statement, unsupported.subject, unsupported.detail);\n }\n }\n\n return diagnostics;\n};\n\n/**\n * Reads the exported type aliases of the given declaration files, in order; a missing file\n * declares nothing. Aliases that break the rules are reported and left out, and so is a name that\n * two files declare, so the interceptor they name is analyzed as if it had no declaration.\n */\nexport const readInterceptorDeclarations = (\n filePaths: readonly string[] | undefined,\n): InterceptorDeclarationsReading => {\n const registry: DeclarationRegistry = { accepted: new Map(), conflicted: new Set() };\n const diagnostics: NestBridgeDiagnostic[] = [];\n\n for (const filePath of filePaths ?? []) {\n if (existsSync(filePath)) {\n diagnostics.push(...readStatements(parseSourceFile(filePath), filePath, registry));\n }\n }\n\n const declarations = [...registry.accepted.values()].filter(\n ({ name }) => !registry.conflicted.has(name),\n );\n\n return { declarations, diagnostics };\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type {\n ControllerAnalysisOptions,\n ControllerAnalysisResult,\n ControllerDefinition,\n} from '../models';\nimport { attachResponseWrappers } from './attach-response-wrappers';\nimport { createInterceptorAnalysis } from './create-interceptor-analysis';\nimport { extractControllerDefinition } from './extract-controller-definition';\nimport { findControllerClasses } from './find-controller-classes';\nimport { openSourceFile } from './open-source-file';\nimport { readInterceptorDeclarations } from './read-interceptor-declarations';\nimport { clearParsedFileCache } from './resolve-type-declaration';\n\nexport const analyzeControllers = (\n filePaths: readonly string[],\n options: ControllerAnalysisOptions = {},\n): ControllerAnalysisResult => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const controllers: ControllerDefinition[] = [];\n const interceptorDeclarations = readInterceptorDeclarations(\n options.interceptorDeclarationFilePaths,\n );\n diagnostics.push(...interceptorDeclarations.diagnostics);\n const interceptors = createInterceptorAnalysis({\n bootstrapFilePath: options.bootstrapFilePath,\n diagnostics,\n declarations: interceptorDeclarations.declarations,\n });\n\n clearParsedFileCache();\n\n for (const filePath of filePaths) {\n const { sourceFile, checker } = openSourceFile(filePath);\n\n const extractedControllers = findControllerClasses(sourceFile).map((classDeclaration) => ({\n classDeclaration,\n controller: extractControllerDefinition(classDeclaration, {\n sourceFile,\n filePath,\n checker,\n messagePatterns: options.messagePatterns ?? false,\n diagnostics,\n }),\n }));\n\n for (const { classDeclaration, controller } of extractedControllers) {\n if (controller !== undefined) {\n controllers.push(\n attachResponseWrappers(\n controller,\n classDeclaration,\n interceptors.forController(classDeclaration, sourceFile, filePath),\n ),\n );\n }\n }\n }\n\n return {\n controllers,\n diagnostics,\n interceptorFiles: interceptors.contributingFiles(),\n interceptorDeclarations: interceptorDeclarations.declarations,\n };\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nexport const readArgsNullableOption = (decorator: Decorator) => {\n if (!isCallExpression(decorator.expression)) {\n return false;\n }\n\n const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);\n\n const nullableProperty = optionsArgument?.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'nullable',\n );\n\n return nullableProperty?.initializer.kind === SyntaxKind.TrueKeyword;\n};\n","import type { ArrowFunction, Expression, FunctionExpression } from 'typescript/unstable/ast';\nimport { isBlock, isReturnStatement } from 'typescript/unstable/ast';\n\nexport const readTypeThunkExpression = (\n thunk: ArrowFunction | FunctionExpression,\n): Expression | undefined => {\n if (!isBlock(thunk.body)) {\n return thunk.body;\n }\n\n const returnStatement = thunk.body.statements.find(isReturnStatement);\n return returnStatement?.expression;\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport interface ArgsTypeOption {\n typeName: string;\n isArray: boolean;\n}\n\nexport const readArgsTypeOption = (decorator: Decorator): ArgsTypeOption | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);\n\n if (optionsArgument === undefined) {\n return undefined;\n }\n\n const typeProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'type',\n );\n\n if (typeProperty === undefined) {\n return undefined;\n }\n\n const thunk = typeProperty.initializer;\n\n if (!isArrowFunction(thunk) && !isFunctionExpression(thunk)) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element)\n ? { typeName: element.text, isArray: true }\n : undefined;\n }\n\n return isIdentifier(returnedExpression)\n ? { typeName: returnedExpression.text, isArray: false }\n : undefined;\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ResolverArgumentDefinition } from '../models/resolver-argument-definition';\nimport { findAnyDecorator, readStaticStringArgument } from './decorator-inspection';\nimport { graphqlTypeStringFor, unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readArgsNullableOption } from './read-args-nullable-option';\nimport { readArgsTypeOption } from './read-args-type-option';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverArgumentDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ResolverArgumentDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, ['Args']);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with @Args to be transported through a NestBridge GraphQL client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge GraphQL client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nameArgument = readStaticStringArgument(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: '@Args() name must be a statically analyzable string literal.',\n found: `@Args(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (nameArgument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: \"A whole @Args() is not supported; provide an argument name such as @Args('id').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (parameter.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" needs an explicit type annotation.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(parameter.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" has a type NestBridge cannot statically resolve to a GraphQL type.`,\n found: parameter.type.getText(),\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const explicitType = readArgsTypeOption(decorator);\n const isNullable = unwrapped.isNullable || readArgsNullableOption(decorator);\n\n return {\n index,\n parameterName: parameter.name.text,\n name: nameArgument.value,\n graphqlType: graphqlTypeStringFor({ ...unwrapped, isNullable }, explicitType?.typeName),\n };\n};\n","import type { ClassDeclaration, PropertyDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier, isPropertyDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { SelectionField } from '../models/selection-field';\nimport { findDecorator } from './decorator-inspection';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface SelectionContext {\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n visitedTypeNames: Set<string>;\n}\n\nexport const extractSelectionFields = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n context: SelectionContext,\n): SelectionField[] | undefined => {\n const typeName = classDeclaration.name?.text ?? '(anonymous type)';\n const location = locationOf(sourceFile, classDeclaration);\n\n if (context.visitedTypeNames.has(typeName)) {\n context.diagnostics.push({\n code: 'circular-type',\n title: 'Circular type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Type \"${typeName}\" references itself, directly or indirectly. NestBridge cannot build a finite GraphQL selection set for it.`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nextVisited = new Set(context.visitedTypeNames).add(typeName);\n\n const properties = classDeclaration.members.filter(\n (member): member is PropertyDeclaration =>\n isPropertyDeclaration(member) && findDecorator(member, 'Field') !== undefined,\n );\n\n const fields: SelectionField[] = [];\n\n for (const property of properties) {\n if (!isIdentifier(property.name)) {\n continue;\n }\n\n const fieldName = property.name.text;\n const fieldLocation = locationOf(sourceFile, property);\n\n if (property.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" needs an explicit type annotation.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(property.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" has a type NestBridge cannot statically resolve.`,\n found: property.type.getText(),\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n if (PRIMITIVE_SCALAR_NAMES.has(unwrapped.identifierText)) {\n fields.push({ name: fieldName });\n continue;\n }\n\n const resolved = resolveClassDeclaration(unwrapped.identifierText, sourceFile, filePath);\n\n if (resolved === undefined) {\n fields.push({ name: fieldName });\n continue;\n }\n\n if (findDecorator(resolved.classDeclaration, 'ObjectType') === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" resolves to class \"${unwrapped.identifierText}\", which is not decorated with @ObjectType(). NestBridge cannot build a GraphQL selection set for it.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const children = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n ...context,\n visitedTypeNames: nextVisited,\n },\n );\n\n if (children === undefined) {\n return undefined;\n }\n\n fields.push({ name: fieldName, children });\n }\n\n return fields;\n};\n","import type {\n Decorator,\n ObjectLiteralExpression,\n PropertyAssignment,\n} from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nexport interface ReadGraphqlOperationNameResult {\n ok: boolean;\n value?: string;\n argumentText?: string;\n}\n\nconst readNameFromOptions = (optionsArgument: ObjectLiteralExpression) => {\n const nameProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'name',\n );\n\n if (nameProperty === undefined || !isStringLiteralLikeNode(nameProperty.initializer)) {\n return undefined;\n }\n\n return nameProperty.initializer.text;\n};\n\nexport const readGraphqlOperationName = (decorator: Decorator): ReadGraphqlOperationNameResult => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n let value: string | undefined;\n\n for (const argument of expression.arguments) {\n if (isArrowFunction(argument) || isFunctionExpression(argument)) {\n continue;\n }\n\n if (isStringLiteralLikeNode(argument)) {\n value = argument.text;\n continue;\n }\n\n if (isObjectLiteralExpression(argument)) {\n value = readNameFromOptions(argument) ?? value;\n continue;\n }\n\n return { ok: false, argumentText: argument.getText() };\n }\n\n return { ok: true, value };\n};\n","import type { ArrowFunction, Decorator, FunctionExpression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport const readGraphqlReturnTypeOption = (decorator: Decorator): string | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const thunk = decorator.expression.arguments.find(\n (argument): argument is ArrowFunction | FunctionExpression =>\n isArrowFunction(argument) || isFunctionExpression(argument),\n );\n\n if (thunk === undefined) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element) ? element.text : undefined;\n }\n\n return isIdentifier(returnedExpression) ? returnedExpression.text : undefined;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { GRAPHQL_OPERATION_DECORATOR_NAMES } from '../models/graphql-operation-kind';\nimport type { SelectionField } from '../models/selection-field';\nimport { decoratorNameOf, findAnyDecorator } from './decorator-inspection';\nimport { extractResolverArgumentDefinition } from './extract-resolver-argument-definition';\nimport { extractSelectionFields } from './extract-selection-fields';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readGraphqlOperationName } from './read-graphql-operation-name';\nimport { readGraphqlReturnTypeOption } from './read-graphql-return-type-option';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverMethodDefinition = (\n method: MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(GRAPHQL_OPERATION_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const operationKind = GRAPHQL_OPERATION_DECORATOR_NAMES[decoratorName];\n\n if (operationKind === undefined) {\n return undefined;\n }\n\n const nameArgument = readGraphqlOperationName(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported operation name.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: 'GraphQL operation names must be statically analyzable string literals.',\n found: `@${decoratorName}(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorReturnType = readGraphqlReturnTypeOption(decorator);\n const identifierText =\n decoratorReturnType ??\n (method.type === undefined ? undefined : unwrapTypeNode(method.type)?.identifierText);\n\n if (identifierText === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail:\n 'GraphQL resolver methods need a type thunk on @Query()/@Mutation() (e.g. \"() => UserType\") or an explicit return type annotation so NestBridge can build a selection set.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n let selection: SelectionField[] = [];\n\n if (!PRIMITIVE_SCALAR_NAMES.has(identifierText.toLowerCase())) {\n const resolved = resolveClassDeclaration(identifierText, context.sourceFile, context.filePath);\n\n if (resolved === undefined && decoratorReturnType === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: `NestBridge could not locate the declaration of type \"${identifierText}\".`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (resolved !== undefined) {\n const fields = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n visitedTypeNames: new Set(),\n },\n );\n\n if (fields === undefined) {\n return undefined;\n }\n\n selection = fields;\n }\n }\n\n const args = method.parameters.map((parameter, index) =>\n extractResolverArgumentDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (args.some((argument) => argument === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n operationKind,\n operationName: nameArgument.value ?? methodName,\n arguments: args.filter((argument) => argument !== undefined),\n selection,\n line: location.line,\n column: location.column,\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { extractResolverMethodDefinition } from './extract-resolver-method-definition';\n\nexport const extractResolverDefinition = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n diagnostics: NestBridgeDiagnostic[],\n) => {\n const resolverName = classDeclaration.name?.text ?? '(anonymous resolver)';\n\n const methods = classDeclaration.members\n .filter((member): member is MethodDeclaration => isMethodDeclaration(member))\n .map((method) =>\n extractResolverMethodDefinition(method, {\n sourceFile,\n filePath,\n resolverName,\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n return {\n name: resolverName,\n sourceFile: filePath,\n methods,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findResolverClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Resolver') !== undefined,\n );\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type { ResolverAnalysisResult, ResolverDefinition } from '../models';\nimport { extractResolverDefinition } from './extract-resolver-definition';\nimport { findResolverClasses } from './find-resolver-classes';\nimport { parseSourceFile } from './parse-source-file';\n\nexport const analyzeResolvers = (filePaths: readonly string[]): ResolverAnalysisResult => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const resolvers: ResolverDefinition[] = [];\n\n for (const filePath of filePaths) {\n const sourceFile = parseSourceFile(filePath);\n\n for (const classDeclaration of findResolverClasses(sourceFile)) {\n const resolver = extractResolverDefinition(\n classDeclaration,\n sourceFile,\n filePath,\n diagnostics,\n );\n\n if (resolver !== undefined) {\n resolvers.push(resolver);\n }\n }\n }\n\n return { resolvers, diagnostics };\n};\n","import type { ApplicationRouting } from '../models/application-routing';\nimport type { ControllerDefinition } from '../models/controller-definition';\nimport type { ControllerMethodDefinition } from '../models/controller-method-definition';\nimport type { GlobalPrefix } from '../models/global-prefix';\nimport type { GlobalPrefixExclusion } from '../models/global-prefix-exclusion';\nimport type { UriVersioning } from '../models/uri-versioning';\n\nconst splitSegments = (path: string) => path.split('/').filter((segment) => segment.length > 0);\n\nconst matchesExclusionPath = (pattern: string, path: string) => {\n const patternSegments = splitSegments(pattern);\n const pathSegments = splitSegments(path);\n\n for (const [index, patternSegment] of patternSegments.entries()) {\n if (patternSegment.startsWith('*')) {\n return pathSegments.length > index;\n }\n\n const pathSegment = pathSegments[index];\n\n if (pathSegment === undefined) {\n return false;\n }\n\n if (!patternSegment.startsWith(':') && patternSegment !== pathSegment) {\n return false;\n }\n }\n\n return patternSegments.length === pathSegments.length;\n};\n\nconst isExcluded = (exclusion: GlobalPrefixExclusion, method: ControllerMethodDefinition) =>\n (exclusion.httpMethod === undefined || exclusion.httpMethod === method.httpMethod) &&\n matchesExclusionPath(exclusion.path, method.path);\n\nconst prefixSegmentFor = (\n method: ControllerMethodDefinition,\n globalPrefix: GlobalPrefix | undefined,\n) => {\n if (globalPrefix === undefined || splitSegments(globalPrefix.prefix).length === 0) {\n return '';\n }\n\n if (globalPrefix.exclude.some((exclusion) => isExcluded(exclusion, method))) {\n return '';\n }\n\n return `/${splitSegments(globalPrefix.prefix).join('/')}`;\n};\n\nconst versionSegmentFor = (\n method: ControllerMethodDefinition,\n versioning: UriVersioning | undefined,\n) => {\n if (versioning === undefined || method.version === null) {\n return '';\n }\n\n const version = method.version ?? versioning.defaultVersion;\n return version === undefined ? '' : `/${versioning.prefix}${version}`;\n};\n\nconst joinRoutedPath = (...parts: string[]) => `/${splitSegments(parts.join('/')).join('/')}`;\n\nconst routeMethod = (method: ControllerMethodDefinition, routing: ApplicationRouting) => ({\n ...method,\n path: joinRoutedPath(\n prefixSegmentFor(method, routing.globalPrefix),\n versionSegmentFor(method, routing.versioning),\n method.path,\n ),\n});\n\nexport const applyApplicationRouting = (\n controllers: readonly ControllerDefinition[],\n routing: ApplicationRouting,\n): ControllerDefinition[] =>\n controllers.map((controller) => ({\n ...controller,\n methods: controller.methods.map((method) => routeMethod(method, routing)),\n }));\n","import type { ClassDeclaration, PropertyAssignment, SourceFile } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSpreadElement,\n} from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst MODULE_DECORATOR_NAME = 'Module';\nconst PROVIDERS_PROPERTY_NAME = 'providers';\nconst PROVIDE_PROPERTY_NAME = 'provide';\nconst USE_CLASS_PROPERTY_NAME = 'useClass';\nconst APP_FILTER_LOCAL_NAME = 'APP_FILTER';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nexport const findAppFilterProviderClassName = (\n moduleClassDeclaration: ClassDeclaration,\n moduleSourceFile: SourceFile,\n) => {\n const moduleDecorator = findDecorator(moduleClassDeclaration, MODULE_DECORATOR_NAME);\n\n if (moduleDecorator === undefined || !isCallExpression(moduleDecorator.expression)) {\n return undefined;\n }\n\n const [moduleOptions] = moduleDecorator.expression.arguments;\n\n if (moduleOptions === undefined || !isObjectLiteralExpression(moduleOptions)) {\n return undefined;\n }\n\n const providersProperty = moduleOptions.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDERS_PROPERTY_NAME,\n );\n\n if (providersProperty === undefined || !isArrayLiteralExpression(providersProperty.initializer)) {\n return undefined;\n }\n\n const appFilterImportSource = findImportSource(moduleSourceFile, APP_FILTER_LOCAL_NAME);\n\n if (\n appFilterImportSource === undefined ||\n appFilterImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const element of providersProperty.initializer.elements) {\n if (isSpreadElement(element)) {\n return undefined;\n }\n\n if (!isObjectLiteralExpression(element)) {\n continue;\n }\n\n const provideProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDE_PROPERTY_NAME,\n );\n\n if (\n provideProperty === undefined ||\n !isIdentifier(provideProperty.initializer) ||\n provideProperty.initializer.text !== APP_FILTER_LOCAL_NAME\n ) {\n continue;\n }\n\n const useClassProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === USE_CLASS_PROPERTY_NAME,\n );\n\n if (useClassProperty === undefined || !isIdentifier(useClassProperty.initializer)) {\n return undefined;\n }\n\n classNames.add(useClassProperty.initializer.text);\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\n\nconst USE_GLOBAL_FILTERS_METHOD_NAME = 'useGlobalFilters';\n\nconst collectUseGlobalFiltersCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_FILTERS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalFiltersCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findGlobalFilterClassName = (sourceFile: SourceFile) => {\n const calls: CallExpression[] = [];\n collectUseGlobalFiltersCalls(sourceFile, calls);\n\n if (calls.length === 0) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (!isNewExpression(argument) || !isIdentifier(argument.expression)) {\n return undefined;\n }\n\n classNames.add(argument.expression.text);\n }\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { Expression, MethodDeclaration } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isExpressionStatement,\n isIdentifier,\n isPropertyAccessExpression,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\n\nexport interface CatchMethodBodyResolution {\n exceptionParameterName: string;\n localDeclarations: Map<string, Expression>;\n responseBodyArgument: Expression;\n}\n\nconst RESPONSE_BODY_CALL_NAMES = new Set(['json', 'send']);\n\nconst matchResponseBodyArgument = (expression: Expression) => {\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n !RESPONSE_BODY_CALL_NAMES.has(expression.expression.name.text) ||\n expression.arguments.length !== 1\n ) {\n return undefined;\n }\n\n const [argument] = expression.arguments;\n return argument;\n};\n\nexport const resolveCatchMethodBody = (\n catchMethod: MethodDeclaration,\n): CatchMethodBodyResolution | undefined => {\n const [exceptionParameter] = catchMethod.parameters;\n\n if (exceptionParameter === undefined || !isIdentifier(exceptionParameter.name)) {\n return undefined;\n }\n\n const body = catchMethod.body;\n\n if (body === undefined) {\n return undefined;\n }\n\n const localDeclarations = new Map<string, Expression>();\n let responseBodyArgument: Expression | undefined;\n let sawResponseCall = false;\n let sawTrailingReturn = false;\n\n for (const statement of body.statements) {\n if (sawTrailingReturn) {\n return undefined;\n }\n\n if (!sawResponseCall && isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (!sawResponseCall && isExpressionStatement(statement)) {\n const argument = matchResponseBodyArgument(statement.expression);\n\n if (argument === undefined) {\n return undefined;\n }\n\n responseBodyArgument = argument;\n sawResponseCall = true;\n continue;\n }\n\n if (sawResponseCall && isReturnStatement(statement) && statement.expression === undefined) {\n sawTrailingReturn = true;\n continue;\n }\n\n return undefined;\n }\n\n if (!sawResponseCall || responseBodyArgument === undefined) {\n return undefined;\n }\n\n return {\n exceptionParameterName: exceptionParameter.name.text,\n localDeclarations,\n responseBodyArgument,\n };\n};\n","import type { Expression, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n} from 'typescript/unstable/ast';\n\nconst EXCEPTION_MESSAGE_MEMBER_NAME = 'message';\nconst EXCEPTION_STATUS_METHOD_NAME = 'getStatus';\n\nconst resolvesToExceptionParameter = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n visited: Set<string>,\n): boolean => {\n if (!isIdentifier(expression)) {\n return false;\n }\n\n if (expression.text === exceptionParameterName) {\n return true;\n }\n\n if (visited.has(expression.text)) {\n return false;\n }\n\n visited.add(expression.text);\n\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? resolvesToExceptionParameter(\n aliasedExpression,\n exceptionParameterName,\n localDeclarations,\n visited,\n )\n : false;\n};\n\nconst synthesizeErrorValueType = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n): string | undefined => {\n if (\n isPropertyAccessExpression(expression) &&\n expression.name.text === EXCEPTION_MESSAGE_MEMBER_NAME &&\n resolvesToExceptionParameter(\n expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'string';\n }\n\n if (\n isCallExpression(expression) &&\n expression.arguments.length === 0 &&\n isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === EXCEPTION_STATUS_METHOD_NAME &&\n resolvesToExceptionParameter(\n expression.expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'number';\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return undefined;\n }\n\n const valueType = synthesizeErrorValueType(\n property.initializer,\n exceptionParameterName,\n localDeclarations,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n if (isIdentifier(expression)) {\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? synthesizeErrorValueType(aliasedExpression, exceptionParameterName, localDeclarations)\n : undefined;\n }\n\n return undefined;\n};\n\nexport const synthesizeErrorBodyType = (\n objectLiteral: ObjectLiteralExpression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n) => synthesizeErrorValueType(objectLiteral, exceptionParameterName, localDeclarations);\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isMethodDeclaration,\n isObjectLiteralExpression,\n} from 'typescript/unstable/ast';\nimport type { ErrorResponseShapeDetection } from '../models/error-response-shape-detection';\nimport { findDecorator } from './decorator-inspection';\nimport { findAppFilterProviderClassName } from './find-app-filter-provider-class-name';\nimport { findGlobalFilterClassName } from './find-global-filter-class-name';\nimport { findRootModuleClassName } from './find-root-module-class-name';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveCatchMethodBody } from './resolve-catch-method-body';\nimport {\n clearParsedFileCache,\n type ResolvedTypeDeclaration,\n resolveClassDeclaration,\n} from './resolve-type-declaration';\nimport { synthesizeErrorBodyType } from './synthesize-error-body-type';\n\nconst CATCH_DECORATOR_NAME = 'Catch';\nconst CATCH_METHOD_NAME = 'catch';\n\nconst findCatchMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === CATCH_METHOD_NAME,\n );\n\nconst resolveViaGlobalFilters = (bootstrapSourceFile: SourceFile, bootstrapFilePath: string) => {\n const filterClassName = findGlobalFilterClassName(bootstrapSourceFile);\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, bootstrapSourceFile, bootstrapFilePath);\n};\n\nconst resolveViaAppFilterProvider = (\n bootstrapSourceFile: SourceFile,\n bootstrapFilePath: string,\n) => {\n const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);\n\n if (rootModuleClassName === undefined) {\n return undefined;\n }\n\n const resolvedModule = resolveClassDeclaration(\n rootModuleClassName,\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n if (resolvedModule === undefined) {\n return undefined;\n }\n\n const filterClassName = findAppFilterProviderClassName(\n resolvedModule.classDeclaration,\n resolvedModule.sourceFile,\n );\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, resolvedModule.sourceFile, resolvedModule.filePath);\n};\n\nconst isSameDeclaration = (a: ResolvedTypeDeclaration, b: ResolvedTypeDeclaration) =>\n a.filePath === b.filePath && a.classDeclaration.name?.text === b.classDeclaration.name?.text;\n\nconst reconcileResolvedFilter = (\n viaGlobalFilters: ResolvedTypeDeclaration | undefined,\n viaAppFilterProvider: ResolvedTypeDeclaration | undefined,\n) => {\n if (viaGlobalFilters !== undefined && viaAppFilterProvider !== undefined) {\n return isSameDeclaration(viaGlobalFilters, viaAppFilterProvider) ? viaGlobalFilters : undefined;\n }\n\n return viaGlobalFilters ?? viaAppFilterProvider;\n};\n\nexport const detectErrorResponseShape = (\n bootstrapFilePath: string,\n): ErrorResponseShapeDetection | undefined => {\n clearParsedFileCache();\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n\n const resolved = reconcileResolvedFilter(\n resolveViaGlobalFilters(bootstrapSourceFile, bootstrapFilePath),\n resolveViaAppFilterProvider(bootstrapSourceFile, bootstrapFilePath),\n );\n\n if (\n resolved === undefined ||\n findDecorator(resolved.classDeclaration, CATCH_DECORATOR_NAME) === undefined\n ) {\n return undefined;\n }\n\n const catchMethod = findCatchMethod(resolved.classDeclaration.members);\n\n if (catchMethod?.body === undefined) {\n return undefined;\n }\n\n const bodyResolution = resolveCatchMethodBody(catchMethod);\n\n if (\n bodyResolution === undefined ||\n !isObjectLiteralExpression(bodyResolution.responseBodyArgument)\n ) {\n return undefined;\n }\n\n const errorBodyTypeSource = synthesizeErrorBodyType(\n bodyResolution.responseBodyArgument,\n bodyResolution.exceptionParameterName,\n bodyResolution.localDeclarations,\n );\n\n return errorBodyTypeSource === undefined ? undefined : { errorBodyTypeSource };\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isBinaryExpression,\n isCallExpression,\n isConditionalExpression,\n isDoStatement,\n isForInStatement,\n isForOfStatement,\n isForStatement,\n isIfStatement,\n isPropertyAccessExpression,\n isSwitchStatement,\n isWhileStatement,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nexport interface BootstrapCall {\n call: CallExpression;\n conditional: boolean;\n}\n\nconst isConditionalContainer = (node: Node) =>\n isIfStatement(node) ||\n isConditionalExpression(node) ||\n isSwitchStatement(node) ||\n isForStatement(node) ||\n isForInStatement(node) ||\n isForOfStatement(node) ||\n isWhileStatement(node) ||\n isDoStatement(node) ||\n (isBinaryExpression(node) &&\n (node.operatorToken.kind === SyntaxKind.AmpersandAmpersandToken ||\n node.operatorToken.kind === SyntaxKind.BarBarToken ||\n node.operatorToken.kind === SyntaxKind.QuestionQuestionToken));\n\nconst collect = (node: Node, methodName: string, conditional: boolean, calls: BootstrapCall[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === methodName\n ) {\n calls.push({ call: node, conditional });\n }\n\n const childConditional = conditional || isConditionalContainer(node);\n\n node.forEachChild((child) => {\n collect(child, methodName, childConditional, calls);\n return undefined;\n });\n};\n\nexport const collectBootstrapCalls = (sourceFile: SourceFile, methodName: string) => {\n const calls: BootstrapCall[] = [];\n collect(sourceFile, methodName, false, calls);\n return calls;\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport type {\n NestBridgeDiagnostic,\n NestBridgeDiagnosticCode,\n} from '../diagnostics/nestbridge-diagnostic';\nimport { locationOf } from './node-location';\n\ninterface BootstrapDiagnosticSource {\n code: Extract<NestBridgeDiagnosticCode, 'unsupported-global-prefix' | 'unsupported-versioning'>;\n title: string;\n detail: string;\n expected: string;\n node: Node;\n sourceFile: SourceFile;\n filePath: string;\n}\n\nexport const createBootstrapDiagnostic = (source: BootstrapDiagnosticSource) => {\n const location = locationOf(source.sourceFile, source.node);\n\n return {\n code: source.code,\n title: source.title,\n controllerName: '(bootstrap)',\n memberName: '',\n detail: source.detail,\n found: source.node.getText(),\n expected: source.expected,\n filePath: source.filePath,\n line: location.line,\n column: location.column,\n } satisfies NestBridgeDiagnostic;\n};\n","import type { Expression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport type { GlobalPrefixExclusion } from '../models/global-prefix-exclusion';\nimport type { HttpMethod } from '../models/http-method';\n\nconst REQUEST_METHOD_ENUM_NAME = 'RequestMethod';\nconst REQUEST_METHOD_ALL_NAME = 'ALL';\nconst EXCLUDE_OPTION_NAME = 'exclude';\nconst PATH_PROPERTY_NAME = 'path';\nconst METHOD_PROPERTY_NAME = 'method';\nconst SUPPORTED_EXCLUSION_PATH = /^[A-Za-z0-9_\\-./:*]*$/;\nconst REQUEST_METHODS: Record<string, HttpMethod | undefined> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n PATCH: 'PATCH',\n DELETE: 'DELETE',\n};\n\nconst readExclusionPath = (expression: Expression) =>\n isStringLiteralLikeNode(expression) && SUPPORTED_EXCLUSION_PATH.test(expression.text)\n ? expression.text\n : undefined;\n\nconst readRequestMethod = (expression: Expression) => {\n if (\n !isPropertyAccessExpression(expression) ||\n !isIdentifier(expression.expression) ||\n expression.expression.text !== REQUEST_METHOD_ENUM_NAME\n ) {\n return undefined;\n }\n\n const methodName = expression.name.text;\n\n if (methodName === REQUEST_METHOD_ALL_NAME) {\n return { httpMethod: undefined, generated: true };\n }\n\n const httpMethod = REQUEST_METHODS[methodName];\n return { httpMethod, generated: httpMethod !== undefined };\n};\n\nconst readExclusion = (element: Expression) => {\n if (isStringLiteralLikeNode(element)) {\n const path = readExclusionPath(element);\n return path === undefined ? undefined : { exclusion: { path } satisfies GlobalPrefixExclusion };\n }\n\n if (!isObjectLiteralExpression(element)) {\n return undefined;\n }\n\n let path: string | undefined;\n let httpMethod: HttpMethod | undefined;\n\n for (const property of element.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n const propertyName = property.name.getText();\n\n if (propertyName === PATH_PROPERTY_NAME) {\n path = readExclusionPath(property.initializer);\n }\n\n if (propertyName === METHOD_PROPERTY_NAME) {\n const requestMethod = readRequestMethod(property.initializer);\n\n if (requestMethod === undefined) {\n return undefined;\n }\n\n if (!requestMethod.generated) {\n return { exclusion: undefined };\n }\n\n httpMethod = requestMethod.httpMethod;\n }\n }\n\n if (path === undefined) {\n return undefined;\n }\n\n return { exclusion: httpMethod === undefined ? { path } : { path, httpMethod } };\n};\n\n/**\n * Returns `undefined` when an entry cannot be read statically. Entries for request methods\n * NestBridge never generates (OPTIONS, HEAD, SEARCH) are dropped because they cannot match.\n */\nexport const readGlobalPrefixExclusions = (options: Expression | undefined) => {\n if (options === undefined) {\n return [];\n }\n\n if (!isObjectLiteralExpression(options)) {\n return undefined;\n }\n\n const exclusions: GlobalPrefixExclusion[] = [];\n\n for (const property of options.properties) {\n if (!isPropertyAssignment(property)) {\n return undefined;\n }\n\n if (property.name.getText() !== EXCLUDE_OPTION_NAME) {\n continue;\n }\n\n if (!isArrayLiteralExpression(property.initializer)) {\n return undefined;\n }\n\n for (const element of property.initializer.elements) {\n const entry = readExclusion(element);\n\n if (entry === undefined) {\n return undefined;\n }\n\n if (entry.exclusion !== undefined) {\n exclusions.push(entry.exclusion);\n }\n }\n }\n\n return exclusions;\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport { isStringLiteralLikeNode } from 'typescript/unstable/ast';\nimport type { BootstrapDetection } from '../models/bootstrap-detection';\nimport type { GlobalPrefix } from '../models/global-prefix';\nimport { collectBootstrapCalls } from './collect-bootstrap-calls';\nimport { createBootstrapDiagnostic } from './create-bootstrap-diagnostic';\nimport { parseSourceFile } from './parse-source-file';\nimport { readGlobalPrefixExclusions } from './read-global-prefix-exclusions';\n\nconst SET_GLOBAL_PREFIX_METHOD_NAME = 'setGlobalPrefix';\nconst EXPECTED =\n 'A single unconditional setGlobalPrefix() call with a string literal prefix and exclude ' +\n 'entries written as string literals or { path, method } literals. Set the `globalPrefix` ' +\n 'option to provide the prefix explicitly.';\n\nconst unsupported = (\n sourceFile: SourceFile,\n filePath: string,\n node: Node,\n detail: string,\n): BootstrapDetection<GlobalPrefix> => ({\n value: undefined,\n diagnostics: [\n createBootstrapDiagnostic({\n code: 'unsupported-global-prefix',\n title: 'Unsupported global prefix.',\n detail,\n expected: EXPECTED,\n node,\n sourceFile,\n filePath,\n }),\n ],\n});\n\nexport const detectGlobalPrefix = (bootstrapFilePath: string): BootstrapDetection<GlobalPrefix> => {\n const sourceFile = parseSourceFile(bootstrapFilePath);\n const calls = collectBootstrapCalls(sourceFile, SET_GLOBAL_PREFIX_METHOD_NAME);\n const [first] = calls;\n\n if (first === undefined) {\n return { value: undefined, diagnostics: [] };\n }\n\n if (calls.length > 1 || first.conditional) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'setGlobalPrefix() must be called exactly once and unconditionally.',\n );\n }\n\n const [prefixArgument, optionsArgument] = first.call.arguments;\n\n if (prefixArgument === undefined || !isStringLiteralLikeNode(prefixArgument)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The global prefix must be a string literal.',\n );\n }\n\n const exclude = readGlobalPrefixExclusions(optionsArgument);\n\n if (exclude === undefined) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'Global prefix exclusions must be statically analyzable.',\n );\n }\n\n return { value: { prefix: prefixArgument.text, exclude }, diagnostics: [] };\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n SyntaxKind,\n} from 'typescript/unstable/ast';\nimport type { BootstrapDetection } from '../models/bootstrap-detection';\nimport type { UriVersioning } from '../models/uri-versioning';\nimport { collectBootstrapCalls } from './collect-bootstrap-calls';\nimport { createBootstrapDiagnostic } from './create-bootstrap-diagnostic';\nimport { parseSourceFile } from './parse-source-file';\nimport { readRouteVersion } from './read-route-version';\n\nconst ENABLE_VERSIONING_METHOD_NAME = 'enableVersioning';\nconst VERSIONING_TYPE_ENUM_NAME = 'VersioningType';\nconst URI_VERSIONING_TYPE_NAME = 'URI';\nconst TYPE_OPTION_NAME = 'type';\nconst PREFIX_OPTION_NAME = 'prefix';\nconst DEFAULT_VERSION_OPTION_NAME = 'defaultVersion';\nconst DEFAULT_VERSION_PREFIX = 'v';\nconst EXPECTED =\n 'A single unconditional enableVersioning() call with `type: VersioningType.URI`, a string ' +\n 'literal or `false` prefix, and a string literal defaultVersion. Header, media type and ' +\n 'custom versioning need request headers NestBridge cannot set. Set the `versioning` option ' +\n 'to provide URI versioning explicitly.';\n\nconst unsupported = (\n sourceFile: SourceFile,\n filePath: string,\n node: Node,\n detail: string,\n): BootstrapDetection<UriVersioning> => ({\n value: undefined,\n diagnostics: [\n createBootstrapDiagnostic({\n code: 'unsupported-versioning',\n title: 'Unsupported versioning.',\n detail,\n expected: EXPECTED,\n node,\n sourceFile,\n filePath,\n }),\n ],\n});\n\nconst isUriVersioningType = (node: Node) =>\n isPropertyAccessExpression(node) &&\n isIdentifier(node.expression) &&\n node.expression.text === VERSIONING_TYPE_ENUM_NAME &&\n node.name.text === URI_VERSIONING_TYPE_NAME;\n\nexport const detectVersioning = (bootstrapFilePath: string): BootstrapDetection<UriVersioning> => {\n const sourceFile = parseSourceFile(bootstrapFilePath);\n const calls = collectBootstrapCalls(sourceFile, ENABLE_VERSIONING_METHOD_NAME);\n const [first] = calls;\n\n if (first === undefined) {\n return { value: undefined, diagnostics: [] };\n }\n\n if (calls.length > 1 || first.conditional) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'enableVersioning() must be called exactly once and unconditionally.',\n );\n }\n\n const [options] = first.call.arguments;\n\n if (options === undefined || !isObjectLiteralExpression(options)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The versioning options must be an object literal.',\n );\n }\n\n let hasUriType = false;\n let prefix = DEFAULT_VERSION_PREFIX;\n let defaultVersion: string | undefined;\n\n for (const property of options.properties) {\n if (!isPropertyAssignment(property)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'Versioning options must be written as plain properties.',\n );\n }\n\n const optionName = property.name.getText();\n const value = property.initializer;\n\n if (optionName === TYPE_OPTION_NAME) {\n if (!isUriVersioningType(value)) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'Only VersioningType.URI is supported.',\n );\n }\n\n hasUriType = true;\n }\n\n if (optionName === PREFIX_OPTION_NAME) {\n if (value.kind === SyntaxKind.FalseKeyword) {\n prefix = '';\n } else if (isStringLiteralLikeNode(value)) {\n prefix = value.text;\n } else {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'The version prefix must be a string literal or false.',\n );\n }\n }\n\n if (optionName === DEFAULT_VERSION_OPTION_NAME) {\n const routeVersion = readRouteVersion(value);\n\n if (!routeVersion.ok) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n property,\n 'The default version must be a string literal.',\n );\n }\n\n defaultVersion = routeVersion.version ?? undefined;\n }\n }\n\n if (!hasUriType) {\n return unsupported(\n sourceFile,\n bootstrapFilePath,\n first.call,\n 'The versioning type must be VersioningType.URI.',\n );\n }\n\n return {\n value: defaultVersion === undefined ? { prefix } : { prefix, defaultVersion },\n diagnostics: [],\n };\n};\n","import { dirname, relative } from 'node:path';\n\nconst toPosixPath = (filePath: string) => filePath.replace(/\\\\/g, '/');\n\nexport const importSpecifierFor = (sourceFile: string, outputFilePath: string) => {\n if (\n !sourceFile.startsWith('.') &&\n !/^[A-Za-z]:[\\\\/]/.test(sourceFile) &&\n !sourceFile.startsWith('/')\n ) {\n return sourceFile;\n }\n\n const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nexport const stripDeclarationExtension = (filePath: string) => filePath.replace(/\\.d\\.ts$/, '');\n","import { extname } from 'node:path';\nimport { DECLARED_INTERCEPTOR_PREFIX } from '../models/declared-interceptor-reference';\nimport type { MessageHandlerDefinition } from '../models/message-handler-definition';\nimport type { ResponseKind } from '../models/response-kind';\nimport type { ResponseWrapperDetection } from '../models/response-wrapper-detection';\nimport { WRAPPED_RESULT_SUBSTITUTION } from '../models/response-wrapper-substitution';\nimport type { ControllerDeclarationOptions } from './controller-declaration-options';\nimport { importSpecifierFor, stripDeclarationExtension } from './import-specifier-for';\n\ninterface ClientDeclarationParameter {\n index: number;\n parameterName: string;\n}\n\ninterface ClientDeclarationMethod {\n name: string;\n responseKind?: ResponseKind;\n responseWrapper?: ResponseWrapperDetection;\n parameters?: readonly ClientDeclarationParameter[];\n serverOnlyParameterIndexes?: readonly number[];\n}\n\ntype ClientDeclarationMessageHandler = Pick<\n MessageHandlerDefinition,\n 'name' | 'kind' | 'payloadParameterIndex'\n>;\n\ninterface ClientDeclarationSource {\n name: string;\n sourceFile: string;\n methods: readonly ClientDeclarationMethod[];\n messageHandlers?: readonly ClientDeclarationMessageHandler[];\n}\n\nconst REMOTE_RESULT_HELPERS: Record<ResponseKind, string> = {\n json: 'RemoteResult',\n observable: 'RemoteObservableResult',\n stream: 'RemoteStreamResult',\n};\n\nconst WRAPPED_RESULT_HELPER = '__NestBridgeWrapped';\n\nconst ABORTABLE_PROMISE = 'AbortablePromise';\n\nconst MESSAGE_RESULT_HELPER = 'NestBridgeMessageResult';\n\nconst MESSAGE_PAYLOAD_PARAMETER = 'payload';\n\nconst stripExtension = (filePath: string) => {\n const extension = extname(filePath);\n return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;\n};\n\nconst DECLARED_INTERCEPTOR_ALIAS_PREFIX = '__I';\n\nconst DECLARED_INTERCEPTOR_REFERENCE_PATTERN = new RegExp(\n `${DECLARED_INTERCEPTOR_PREFIX}([A-Za-z0-9_$]+)`,\n 'g',\n);\n\nconst dependsOnServerResult = (source: string) => source.includes(WRAPPED_RESULT_SUBSTITUTION);\n\nconst wrapperOf = (method: ClientDeclarationMethod) =>\n (method.responseKind ?? 'json') === 'json' ? method.responseWrapper : undefined;\n\n/**\n * Wrappers that depend on the server result get a generic alias, in order of first use, so the\n * first one keeps the name `__NestBridgeWrapped`. A wrapper that does not depend on it, such as\n * `unknown`, is written inline.\n */\nconst aliasedWrapperSourcesOf = (\n methods: readonly ClientDeclarationMethod[],\n renderSource: (wrapper: ResponseWrapperDetection) => string,\n) => {\n const sources = new Set<string>();\n\n for (const method of methods) {\n const wrapper = wrapperOf(method);\n\n if (wrapper !== undefined && dependsOnServerResult(renderSource(wrapper))) {\n sources.add(renderSource(wrapper));\n }\n }\n\n return [...sources];\n};\n\nconst declaredInterceptorNamesOf = (methods: readonly ClientDeclarationMethod[]) => {\n const names = new Set<string>();\n\n for (const method of methods) {\n for (const name of wrapperOf(method)?.declaredInterceptors ?? []) {\n names.add(name);\n }\n }\n\n return [...names];\n};\n\nconst wrapperHelperName = (aliasIndex: number) =>\n aliasIndex === 0 ? WRAPPED_RESULT_HELPER : `${WRAPPED_RESULT_HELPER}${aliasIndex + 1}`;\n\nexport const generateControllerDeclaration = (\n controller: ClientDeclarationSource,\n outputFilePath: string,\n options: ControllerDeclarationOptions = {},\n): string => {\n const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);\n const importSpecifier = stripExtension(sourceFileSpecifier);\n const serverAlias = `__Server${controller.name}`;\n\n const declaredInterceptorNames = declaredInterceptorNamesOf(controller.methods);\n\n const renderSource = (wrapper: ResponseWrapperDetection) =>\n wrapper.wrappedResultTypeSource.replace(\n DECLARED_INTERCEPTOR_REFERENCE_PATTERN,\n (_reference, name: string) =>\n `${DECLARED_INTERCEPTOR_ALIAS_PREFIX}${declaredInterceptorNames.indexOf(name)}`,\n );\n\n const aliasedWrapperSources = aliasedWrapperSourcesOf(controller.methods, renderSource);\n\n const declaredInterceptorImportLines = () => {\n if (declaredInterceptorNames.length === 0) {\n return [];\n }\n\n if (options.interceptorsDeclarationFilePath === undefined) {\n throw new Error(\n `[nestbridge] ${controller.name} uses declared interceptors (${declaredInterceptorNames.join(', ')}) but no interceptors declaration file was given.`,\n );\n }\n\n const specifier = importSpecifierFor(\n stripDeclarationExtension(options.interceptorsDeclarationFilePath),\n outputFilePath,\n );\n const imports = declaredInterceptorNames.map(\n (name, index) => `${name} as ${DECLARED_INTERCEPTOR_ALIAS_PREFIX}${index}`,\n );\n\n return [`import type { ${imports.join(', ')} } from '${specifier}';`];\n };\n\n const resultTypeFor = (method: ClientDeclarationMethod) => {\n const serverMethod = `${serverAlias}['${method.name}']`;\n const wrapper = wrapperOf(method);\n\n if (wrapper === undefined) {\n return `${REMOTE_RESULT_HELPERS[method.responseKind ?? 'json']}<${serverMethod}>`;\n }\n\n const source = renderSource(wrapper);\n\n if (!dependsOnServerResult(source)) {\n return `${ABORTABLE_PROMISE}<${source}>`;\n }\n\n const aliasIndex = aliasedWrapperSources.indexOf(source);\n return `${wrapperHelperName(aliasIndex)}<${serverMethod}>`;\n };\n\n const importedHelperFor = (method: ClientDeclarationMethod) =>\n wrapperOf(method) === undefined\n ? REMOTE_RESULT_HELPERS[method.responseKind ?? 'json']\n : ABORTABLE_PROMISE;\n\n const parameterListFor = (method: ClientDeclarationMethod) => {\n const serverParameters = `Parameters<${serverAlias}['${method.name}']>`;\n\n if ((method.serverOnlyParameterIndexes ?? []).length === 0) {\n return `...args: ${serverParameters}`;\n }\n\n return [...(method.parameters ?? [])]\n .sort((a, b) => a.index - b.index)\n .map((parameter) => `${parameter.parameterName}: ${serverParameters}[${parameter.index}]`)\n .join(', ');\n };\n\n const methodDeclarations = controller.methods.map(\n (method) => ` ${method.name}(${parameterListFor(method)}): ${resultTypeFor(method)};`,\n );\n\n const messageHandlers = controller.messageHandlers ?? [];\n\n const messageHandlerDeclarations = messageHandlers.map((handler) => {\n const serverMethod = `${serverAlias}['${handler.name}']`;\n const parameterList =\n handler.payloadParameterIndex === null\n ? ''\n : `${MESSAGE_PAYLOAD_PARAMETER}: Parameters<${serverMethod}>[${handler.payloadParameterIndex}]`;\n const result =\n handler.kind === 'event' ? 'void' : `${MESSAGE_RESULT_HELPER}<ReturnType<${serverMethod}>>`;\n\n return ` ${handler.name}(${parameterList}): Promise<${result}>;`;\n });\n\n const classBody = [\n ' constructor();',\n '',\n ...methodDeclarations,\n ...messageHandlerDeclarations,\n ].join('\\n');\n\n const remoteHelperImports = Array.from(\n new Set(controller.methods.map((method) => importedHelperFor(method))),\n ).sort();\n const helperImports =\n remoteHelperImports.length === 0 && messageHandlers.length === 0\n ? ['RemoteResult']\n : remoteHelperImports;\n const usesMessageResult = messageHandlers.some((handler) => handler.kind === 'message');\n\n const wrappedResultTypeAliasLines =\n aliasedWrapperSources.length === 0\n ? []\n : [\n ...aliasedWrapperSources.map(\n (source, aliasIndex) =>\n `type ${wrapperHelperName(aliasIndex)}<T> = T extends (...args: never[]) => infer Result ? ${ABORTABLE_PROMISE}<${source}> : never;`,\n ),\n '',\n ];\n\n return [\n `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,\n ...(helperImports.length > 0\n ? [`import type { ${helperImports.join(', ')} } from 'nestbridge';`]\n : []),\n ...(usesMessageResult\n ? [`import type { ${MESSAGE_RESULT_HELPER} } from 'nestbridge/microservices';`]\n : []),\n ...declaredInterceptorImportLines(),\n '',\n '/**',\n ' * Generated by NestBridge — client-facing methods only.',\n ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,\n ' */',\n ...wrappedResultTypeAliasLines,\n `export declare class ${controller.name} {`,\n classBody,\n '}',\n '',\n ].join('\\n');\n};\n","export const ERROR_BODY_TYPE_NAME = 'NestBridgeErrorBody';\n\nexport const generateErrorBodyDeclaration = (errorBodyTypeSource: string): string =>\n [\n '/**',\n \" * Generated by NestBridge — inferred shape of the global exception filter's response body.\",\n ' */',\n `export type ${ERROR_BODY_TYPE_NAME} = ${errorBodyTypeSource};`,\n '',\n ].join('\\n');\n","import type { InterceptorDeclaration } from '../models/interceptor-declaration';\nimport { importSpecifierFor, stripDeclarationExtension } from './import-specifier-for';\n\nconst namesByFilePath = (declarations: readonly InterceptorDeclaration[]) => {\n const names = new Map<string, string[]>();\n\n for (const { filePath, name } of declarations) {\n names.set(filePath, [...(names.get(filePath) ?? []), name]);\n }\n\n return names;\n};\n\n/**\n * One re-export line per declaration file, in the order the files were read. A file that\n * contributes no alias gets no line.\n */\nexport const generateInterceptorsDeclaration = (\n declarations: readonly InterceptorDeclaration[],\n outputFilePath: string,\n): string => {\n const exportLines = [...namesByFilePath(declarations)].map(([filePath, names]) => {\n const specifier = importSpecifierFor(stripDeclarationExtension(filePath), outputFilePath);\n return `export type { ${names.join(', ')} } from '${specifier}';`;\n });\n\n return [\n '/**',\n ' * Generated by NestBridge — the interceptor types declared in the server interceptor declaration files.',\n ' */',\n ...exportLines,\n '',\n ].join('\\n');\n};\n","import type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport const formatDiagnostic = (diagnostic: NestBridgeDiagnostic): string => {\n const subject =\n diagnostic.memberName.length > 0\n ? `${diagnostic.controllerName}.${diagnostic.memberName}`\n : diagnostic.controllerName;\n\n const lines = [`[NestBridge] ${diagnostic.title}`, '', subject, '', diagnostic.detail];\n\n if (diagnostic.found !== undefined) {\n lines.push('', 'Found:', diagnostic.found);\n }\n\n if (diagnostic.expected !== undefined) {\n lines.push('', 'Expected:', diagnostic.expected);\n }\n\n lines.push('', `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);\n\n return lines.join('\\n');\n};\n","import { formatDiagnostic } from './format-diagnostic';\nimport type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport class NestBridgeDiagnosticError extends Error {\n readonly diagnostic: NestBridgeDiagnostic;\n\n constructor(diagnostic: NestBridgeDiagnostic) {\n super(formatDiagnostic(diagnostic));\n this.name = 'NestBridgeDiagnosticError';\n this.diagnostic = diagnostic;\n }\n}\n","{\n \"name\": \"@nestbridge/core\",\n \"version\": \"3.1.0\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/MDReal32/nestbridge.git\",\n \"directory\": \"packages/core\"\n },\n \"main\": \"./build/nestbridge.core.js\",\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"import\": \"./build/nestbridge.core.js\"\n }\n },\n \"files\": [\n \"build\"\n ],\n \"scripts\": {\n \"build\": \"vite build\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"lint\": \"biome check .\"\n },\n \"dependencies\": {\n \"typescript\": \"^7.0.2\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^26.4.1\",\n \"rolldown-plugin-dts\": \"^0.28.5\",\n \"vite\": \"^8.2.2\",\n \"vitest\": \"^5.0.0\"\n }\n}\n","import { version } from '../package.json';\n\nexport const VERSION: string = version;\n"],"mappings":";;;;;;AAKA,IAAa,0BACX,YACA,kBACA,iBACG;CACH,MAAM,gBAAgB,iBAAiB,QAAQ,QAAQ,WACrD,oBAAoB,MAAM,CAC5B;CAEA,MAAM,UAAU,WAAW,QAAQ,KAAK,WAAW;EACjD,MAAM,cAAc,cAAc,MAAM,cAAc,UAAU,KAAK,QAAQ,MAAM,OAAO,IAAI;EAC9F,MAAM,kBACJ,OAAO,iBAAiB,UAAU,gBAAgB,KAAA,IAC9C,aAAa,kBAAkB,WAAW,IAC1C,KAAA;EAEN,OAAO,oBAAoB,KAAA,IAAY,SAAS;GAAE,GAAG;GAAQ;EAAgB;CAC/E,CAAC;CAED,OAAO;EAAE,GAAG;EAAY;CAAQ;AAClC;;;ACzBA,IAAa,8BAA8B;AAE3C,IAAa,wCAAwC;;;ACCrD,IAAa,iCAAiC,eAA2B;CACvE,IAAI,YAAY;CAEhB,OAAO,0BAA0B,SAAS,GACxC,YAAY,UAAU;CAGxB,OAAO;AACT;;;;;;;ACEA,IAAa,+BAA+B,SAA6B;CACvE,IAAI,CAAC,QAAQ,IAAI,GACf,OAAO,8BAA8B,IAAI;CAG3C,MAAM,oCAAoB,IAAI,IAAwB;CACtD,IAAI;CACJ,IAAI,YAAY;CAEhB,KAAK,MAAM,aAAa,KAAK,YAAY;EACvC,IAAI,WACF;EAGF,IAAI,oBAAoB,SAAS,GAAG;GAClC,KAAK,MAAM,eAAe,UAAU,g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