UNPKG

@tsclean/core

Version:

Plugin for API Rest Full development, based on Clean Architecture, IoC and Dependency Injection.

47 lines 3.44 kB
import { ExternalExceptionFilterContext, ContainerIoC, ContextId, ModulesContainer, HandlersConsumer, HandlersContextCreator } from '../core'; import { AccessResourceConsumer, AccessResourceContextCreator } from '../access'; import { InterceptorsConsumer, InterceptorsContextCreator } from '../interceptors'; import { ParamProperties } from './context-utils'; import { ExternalHandlerMetadataInterface, HandlerTransform } from "../contracts"; import { ParamData } from "../decorators"; import { ContextType, ControllerType, ParamsMetadataType } from "../types"; export interface ParamsFactory { exchangeKeyForValue(type: number, data: ParamData, args: any): any; } export interface ExternalContextOptions { resources?: boolean; interceptors?: boolean; filters?: boolean; } export declare class ExternalContextCreator { private readonly accessResourceContextCreator; private readonly accessResourceConsumer; private readonly interceptorsContextCreator; private readonly interceptorsConsumer; private readonly modulesContainer; private readonly handlersContextCreator; private readonly handlersConsumer; private readonly filtersContextCreator; private readonly contextUtils; private readonly externalErrorProxy; private readonly handlerMetadataStorage; private container; constructor(accessResourceContextCreator: AccessResourceContextCreator, accessResourceConsumer: AccessResourceConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer, handlersContextCreator: HandlersContextCreator, handlersConsumer: HandlersConsumer, filtersContextCreator: ExternalExceptionFilterContext); static fromContainer(container: ContainerIoC): ExternalContextCreator; create<P extends ParamsMetadataType = ParamsMetadataType, T extends string = ContextType>(instance: ControllerType, callback: (...args: unknown[]) => unknown, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextId?: ContextId, inquirerId?: string, options?: ExternalContextOptions, contextType?: T): (...args: any[]) => Promise<any>; getMetadata<T, C extends string = ContextType>(instance: ControllerType, methodName: string, metadataKey?: string, paramsFactory?: ParamsFactory, contextType?: C): ExternalHandlerMetadataInterface; getContextModuleKey(moduleCtor: Function | undefined): string; exchangeKeysForValues<T = any>(keys: string[], metadata: T, moduleContext: string, paramsFactory: ParamsFactory, contextId?: ContextId, inquirerId?: string, contextFactory?: (args: unknown[]) => import("./execution-context-host").ExecutionContextHost): ParamProperties[]; createHandlersFn(pipes: HandlerTransform[], paramsOptions: (ParamProperties & { metaType?: unknown; })[]): (args: unknown[], ...params: unknown[]) => Promise<void>; getParamValue<T>(value: T, { metaType, type, data }: { metaType: any; type: any; data: any; }, handlers: HandlerTransform[]): Promise<any>; transformToResult(resultOrDeferred: any): Promise<any>; createAccessResourceFn<T extends string = ContextType>(resources: any[], instance: ControllerType, callback: (...args: any[]) => any, contextType?: T): Function | null; registerRequestProvider<T = any>(request: T, contextId: ContextId): void; } //# sourceMappingURL=external-context-creator.d.ts.map