UNPKG

3.83 kBTypeScriptView Raw
1import { ParamData } from '@nestjs/common';
2import { ContextType, Controller, PipeTransform } from '@nestjs/common/interfaces';
3import { ExternalExceptionFilterContext } from '../exceptions/external-exception-filter-context';
4import { GuardsConsumer } from '../guards/guards-consumer';
5import { GuardsContextCreator } from '../guards/guards-context-creator';
6import { NestContainer } from '../injector/container';
7import { ContextId } from '../injector/instance-wrapper';
8import { ModulesContainer } from '../injector/modules-container';
9import { InterceptorsConsumer } from '../interceptors/interceptors-consumer';
10import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator';
11import { PipesConsumer } from '../pipes/pipes-consumer';
12import { PipesContextCreator } from '../pipes/pipes-context-creator';
13import { ParamProperties } from './context-utils';
14import { ExternalHandlerMetadata } from './interfaces/external-handler-metadata.interface';
15import { ParamsMetadata } from './interfaces/params-metadata.interface';
16export interface ParamsFactory {
17 exchangeKeyForValue(type: number, data: ParamData, args: any): any;
18}
19export interface ExternalContextOptions {
20 guards?: boolean;
21 interceptors?: boolean;
22 filters?: boolean;
23}
24export declare class ExternalContextCreator {
25 private readonly guardsContextCreator;
26 private readonly guardsConsumer;
27 private readonly interceptorsContextCreator;
28 private readonly interceptorsConsumer;
29 private readonly modulesContainer;
30 private readonly pipesContextCreator;
31 private readonly pipesConsumer;
32 private readonly filtersContextCreator;
33 private readonly contextUtils;
34 private readonly externalErrorProxy;
35 private readonly handlerMetadataStorage;
36 private container;
37 constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, filtersContextCreator: ExternalExceptionFilterContext);
38 static fromContainer(container: NestContainer): ExternalContextCreator;
39 create<TParamsMetadata extends ParamsMetadata = ParamsMetadata, TContext extends string = ContextType>(instance: Controller, callback: (...args: unknown[]) => unknown, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions, contextType?: TContext): (...args: any[]) => Promise<any>;
40 getMetadata<TMetadata, TContext extends string = ContextType>(instance: Controller, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextType?: TContext): ExternalHandlerMetadata;
41 getContextModuleKey(moduleCtor: Function | undefined): string;
42 exchangeKeysForValues<TMetadata = any>(keys: string[], metadata: TMetadata, moduleContext: string, paramsFactory: ParamsFactory, contextId?: ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => import("./execution-context-host").ExecutionContextHost): ParamProperties[];
43 createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
44 metatype?: unknown;
45 })[]): (args: unknown[], ...params: unknown[]) => Promise<void>;
46 getParamValue<T>(value: T, { metatype, type, data }: {
47 metatype: any;
48 type: any;
49 data: any;
50 }, pipes: PipeTransform[]): Promise<any>;
51 transformToResult(resultOrDeffered: any): Promise<any>;
52 createGuardsFn<TContext extends string = ContextType>(guards: any[], instance: Controller, callback: (...args: any[]) => any, contextType?: TContext): Function | null;
53 registerRequestProvider<T = any>(request: T, contextId: ContextId): void;
54}