UNPKG

3.92 kBTypeScriptView Raw
1import { HttpServer, ParamData, PipeTransform, RequestMethod } from '@nestjs/common';
2import { RouteParamMetadata } from '@nestjs/common/decorators';
3import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum';
4import { ContextType, Controller } from '@nestjs/common/interfaces';
5import { GuardsConsumer } from '../guards/guards-consumer';
6import { GuardsContextCreator } from '../guards/guards-context-creator';
7import { HandlerMetadata } from '../helpers/handler-metadata-storage';
8import { InterceptorsConsumer } from '../interceptors/interceptors-consumer';
9import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator';
10import { PipesConsumer } from '../pipes/pipes-consumer';
11import { PipesContextCreator } from '../pipes/pipes-context-creator';
12import { IRouteParamsFactory } from './interfaces/route-params-factory.interface';
13import { CustomHeader, RedirectResponse } from './router-response-controller';
14export interface ParamProperties {
15 index: number;
16 type: RouteParamtypes | string;
17 data: ParamData;
18 pipes: PipeTransform[];
19 extractValue: <TRequest, TResponse>(req: TRequest, res: TResponse, next: Function) => any;
20}
21export declare class RouterExecutionContext {
22 private readonly paramsFactory;
23 private readonly pipesContextCreator;
24 private readonly pipesConsumer;
25 private readonly guardsContextCreator;
26 private readonly guardsConsumer;
27 private readonly interceptorsContextCreator;
28 private readonly interceptorsConsumer;
29 readonly applicationRef: HttpServer;
30 private readonly handlerMetadataStorage;
31 private readonly contextUtils;
32 private readonly responseController;
33 constructor(paramsFactory: IRouteParamsFactory, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, applicationRef: HttpServer);
34 create(instance: Controller, callback: (...args: any[]) => any, methodName: string, module: string, requestMethod: RequestMethod, contextId?: import("..").ContextId, inquirerId?: string): <TRequest, TResponse>(req: TRequest, res: TResponse, next: Function) => Promise<void>;
35 getMetadata(instance: Controller, callback: (...args: any[]) => any, methodName: string, module: string, requestMethod: RequestMethod): HandlerMetadata;
36 reflectRedirect(callback: (...args: any[]) => any): RedirectResponse;
37 reflectHttpStatusCode(callback: (...args: any[]) => any): number;
38 reflectRenderTemplate(callback: (...args: any[]) => any): string;
39 reflectResponseHeaders(callback: (...args: any[]) => any): CustomHeader[];
40 exchangeKeysForValues(keys: string[], metadata: Record<number, RouteParamMetadata>, moduleContext: string, contextId?: import("..").ContextId, inquirerId?: string): ParamProperties[];
41 getCustomFactory(factory: (...args: unknown[]) => void, data: unknown): (...args: unknown[]) => unknown;
42 getParamValue<T>(value: T, { metatype, type, data, }: {
43 metatype: unknown;
44 type: RouteParamtypes;
45 data: unknown;
46 }, pipes: PipeTransform[]): Promise<unknown>;
47 isPipeable(type: number | string): boolean;
48 createGuardsFn<TContext extends string = ContextType>(guards: any[], instance: Controller, callback: (...args: any[]) => any, contextType?: TContext): (args: any[]) => Promise<void> | null;
49 createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
50 metatype?: any;
51 })[]): <TRequest, TResponse>(args: any[], req: TRequest, res: TResponse, next: Function) => Promise<void>;
52 createHandleResponseFn(callback: (...args: any[]) => any, isResponseHandled: boolean, redirectResponse?: RedirectResponse, httpStatusCode?: number): <TResult, TResponse>(result: TResult, res: TResponse) => Promise<void>;
53}