@nestjs/core
Version:
Nest - modern, fast, powerful node.js web framework (@core)
67 lines (66 loc) • 3.79 kB
TypeScript
import { ParamData } from '@nestjs/common';
import { Controller, PipeTransform } from '@nestjs/common/interfaces';
import { GuardsConsumer } from '../guards/guards-consumer';
import { GuardsContextCreator } from '../guards/guards-context-creator';
import { NestContainer } from '../injector/container';
import { Module } from '../injector/module';
import { ModulesContainer } from '../injector/modules-container';
import { InterceptorsConsumer } from '../interceptors/interceptors-consumer';
import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator';
import { PipesConsumer } from '../pipes/pipes-consumer';
import { PipesContextCreator } from '../pipes/pipes-context-creator';
import { ExternalExceptionFilterContext } from './../exceptions/external-exception-filter-context';
import { ContextId } from './../injector/instance-wrapper';
import { ParamProperties } from './context-utils';
export interface ParamsMetadata {
[prop: number]: {
index: number;
data?: ParamData;
};
}
export interface ParamsFactory {
exchangeKeyForValue(type: number, data: ParamData, args: any): any;
}
export interface ExternalHandlerMetadata {
argsLength: number;
paramtypes: any[];
getParamsMetadata: (moduleKey: string, contextId?: ContextId, inquirerId?: string) => (ParamProperties & {
metatype?: any;
})[];
}
export interface ExternalContextOptions {
guards?: boolean;
interceptors?: boolean;
filters?: boolean;
}
export declare class ExternalContextCreator {
private readonly guardsContextCreator;
private readonly guardsConsumer;
private readonly interceptorsContextCreator;
private readonly interceptorsConsumer;
private readonly modulesContainer;
private readonly pipesContextCreator;
private readonly pipesConsumer;
private readonly filtersContextCreator;
private readonly contextUtils;
private readonly externalErrorProxy;
private readonly handlerMetadataStorage;
constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, filtersContextCreator: ExternalExceptionFilterContext);
static fromContainer(container: NestContainer): ExternalContextCreator;
create<T extends ParamsMetadata = ParamsMetadata>(instance: Controller, callback: (...args: any[]) => any, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions): (...args: any[]) => Promise<any>;
getMetadata<T>(instance: Controller, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory): ExternalHandlerMetadata;
findContextModuleName(constructor: Function): string;
findProviderByClassName(module: Module, className: string): boolean;
exchangeKeysForValues<TMetadata = any>(keys: string[], metadata: TMetadata, moduleContext: string, paramsFactory: ParamsFactory, contextId?: ContextId, inquirerId?: string): ParamProperties[];
getCustomFactory(factory: (...args: any[]) => void, data: any): (...args: any[]) => any;
createPipesFn(pipes: PipeTransform[], paramsOptions: (ParamProperties & {
metatype?: any;
})[]): (args: any[], ...params: any[]) => Promise<void>;
getParamValue<T>(value: T, { metatype, type, data }: {
metatype: any;
type: any;
data: any;
}, pipes: PipeTransform[]): Promise<any>;
transformToResult(resultOrDeffered: any): Promise<any>;
createGuardsFn(guards: any[], instance: Controller, callback: (...args: any[]) => any): Function | null;
}