UNPKG

2.48 kBTypeScriptView Raw
1import { HttpServer } from '@nestjs/common';
2import { RequestMethod } from '@nestjs/common/enums/request-method.enum';
3import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
4import { Type } from '@nestjs/common/interfaces/type.interface';
5import { ApplicationConfig } from '../application-config';
6import { NestContainer } from '../injector/container';
7import { Injector } from '../injector/injector';
8import { InstanceWrapper } from '../injector/instance-wrapper';
9import { Module } from '../injector/module';
10import { MetadataScanner } from '../metadata-scanner';
11import { ExceptionsFilter } from './interfaces/exceptions-filter.interface';
12import { RouterProxy, RouterProxyCallback } from './router-proxy';
13export interface RoutePathProperties {
14 path: string[];
15 requestMethod: RequestMethod;
16 targetCallback: RouterProxyCallback;
17 methodName: string;
18}
19export declare class RouterExplorer {
20 private readonly metadataScanner;
21 private readonly container;
22 private readonly injector?;
23 private readonly routerProxy?;
24 private readonly exceptionsFilter?;
25 private readonly executionContextCreator;
26 private readonly routerMethodFactory;
27 private readonly logger;
28 private readonly exceptionFiltersCache;
29 constructor(metadataScanner: MetadataScanner, container: NestContainer, injector?: Injector, routerProxy?: RouterProxy, exceptionsFilter?: ExceptionsFilter, config?: ApplicationConfig);
30 explore<T extends HttpServer = any>(instanceWrapper: InstanceWrapper, module: string, applicationRef: T, basePath: string, host: string): void;
31 extractRouterPath(metatype: Type<Controller>, prefix?: string): string;
32 validateRoutePath(path: string): string;
33 scanForPaths(instance: Controller, prototype?: any): RoutePathProperties[];
34 exploreMethodMetadata(instance: Controller, instancePrototype: any, methodName: string): RoutePathProperties;
35 applyPathsToRouterProxy<T extends HttpServer>(router: T, routePaths: RoutePathProperties[], instanceWrapper: InstanceWrapper, module: string, basePath: string, host: string): void;
36 private applyCallbackToRouter;
37 private applyHostFilter;
38 private createCallbackProxy;
39 createRequestScopedHandler(instanceWrapper: InstanceWrapper, requestMethod: RequestMethod, module: Module, moduleKey: string, methodName: string): <TRequest, TResponse>(req: TRequest, res: TResponse, next: () => void) => Promise<void>;
40 private getContextId;
41}