import { ContextType, PipeTransform } from '@nestjs/common'; import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host'; /** * Instance holder for a router class resolved through the Nest injector. * * This used to be `Controller` from `@nestjs/common/interfaces`. That * specifier is a directory index, and NestJS 12 is ESM-only with an exports * map (`"./*": "./*.js"`) that resolves files, never directories — so the * import fails to compile against 12. Nest 12 defines the type as plain * `object`, and every use here is an instance holder, so a local alias is * exact on both majors. `test/nestjs-deep-imports.spec.ts` keeps every * remaining `@nestjs/*` deep import pointed at a real file. */ type Controller = object; interface TrpcHandlerOptions { callback: (...args: any[]) => any; methodName: string; moduleKey: string; paramTypes?: unknown[]; inquirerId?: string; resolveContextId?: () => { id: number; }; resolveInstance: (contextId: { id: number; }) => Promise; } type TrpcCallback = (...args: any[]) => any; type TrpcContextId = { id: number; }; interface TrpcGuardsContextCreatorLike { create(instance: Controller, callback: TrpcCallback, moduleKey: string, contextId: TrpcContextId, inquirerId?: string): unknown[]; } interface TrpcGuardsConsumerLike { tryActivate(guards: unknown[], args: unknown[], instance: Controller, callback: TrpcCallback, type: ContextType): Promise; } interface TrpcInterceptorsContextCreatorLike { create(instance: Controller, callback: TrpcCallback, moduleKey: string, contextId: TrpcContextId, inquirerId?: string): unknown[]; } interface TrpcInterceptorsConsumerLike { intercept(interceptors: unknown[], args: unknown[], instance: Controller, callback: TrpcCallback, next: () => Promise, type: ContextType): Promise; } interface TrpcPipesContextCreatorLike { create(instance: Controller, callback: TrpcCallback, moduleKey: string, contextId: TrpcContextId, inquirerId?: string): PipeTransform[]; } interface TrpcPipesConsumerLike { apply(value: unknown, metadata: { type: unknown; metatype?: unknown; data?: string; }, pipes: PipeTransform[]): Promise; } interface TrpcExceptionHandlerLike { next(error: Error, executionContext: ExecutionContextHost): Promise; } interface TrpcExceptionFiltersContextLike { create(instance: Controller, callback: TrpcCallback, moduleKey: string, contextId: TrpcContextId, inquirerId?: string): TrpcExceptionHandlerLike; } export interface TrpcEnhancerRuntime { guardsContextCreator: TrpcGuardsContextCreatorLike; guardsConsumer: TrpcGuardsConsumerLike; interceptorsContextCreator: TrpcInterceptorsContextCreatorLike; interceptorsConsumer: TrpcInterceptorsConsumerLike; pipesContextCreator: TrpcPipesContextCreatorLike; pipesConsumer: TrpcPipesConsumerLike; exceptionFiltersContext: TrpcExceptionFiltersContextLike; } /** * Creates execution-context-aware wrappers for tRPC procedure handlers. * * Integrates NestJS guards, interceptors, pipes, and exception filters * into the tRPC request lifecycle, mirroring Nest external context handling. * * @internal */ export declare class TrpcContextCreator { private readonly runtime; constructor(runtime: TrpcEnhancerRuntime); constructor(guardsContextCreator: TrpcGuardsContextCreatorLike, guardsConsumer: TrpcGuardsConsumerLike, interceptorsContextCreator: TrpcInterceptorsContextCreatorLike, interceptorsConsumer: TrpcInterceptorsConsumerLike, pipesContextCreator: TrpcPipesContextCreatorLike, pipesConsumer: TrpcPipesConsumerLike, exceptionFiltersContext: TrpcExceptionFiltersContextLike); private isEnhancerRuntime; /** * Backward-compatible overload for existing unit tests and internal callers. */ create(instance: Controller, callback: (...args: any[]) => any, moduleKey: string, contextId?: { id: number; }, inquirerId?: string): (input: unknown, ctx: unknown) => Promise; /** * Preferred overload used by TrpcRouter for request-scoped resolution. */ create(options: TrpcHandlerOptions): (input: unknown, ctx: unknown) => Promise; private createHandler; private handleException; private applyPipes; private getPipeTargets; private resolveHandlerArgs; private extractParamValue; private pickField; private transformToResult; private toTrpcError; private extractHttpExceptionMessage; private mapHttpStatusToTrpcCode; } export {};