1 | import { InjectionToken } from '@nestjs/common';
|
2 | import { Controller, Injectable, Type } from '@nestjs/common/interfaces';
|
3 | import { ContextId, InstancePerContext, InstanceWrapper, PropertyMetadata } from './instance-wrapper';
|
4 | import { Module } from './module';
|
5 | import { SettlementSignal } from './settlement-signal';
|
6 |
|
7 |
|
8 |
|
9 | export type InjectorDependency = InjectionToken;
|
10 |
|
11 |
|
12 |
|
13 | export interface PropertyDependency {
|
14 | key: symbol | string;
|
15 | name: InjectorDependency;
|
16 | isOptional?: boolean;
|
17 | instance?: any;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export interface InjectorDependencyContext {
|
24 | |
25 |
|
26 |
|
27 | key?: string | symbol;
|
28 | |
29 |
|
30 |
|
31 | name?: Function | string | symbol;
|
32 | |
33 |
|
34 |
|
35 |
|
36 | index?: number;
|
37 | |
38 |
|
39 |
|
40 | dependencies?: InjectorDependency[];
|
41 | }
|
42 | export declare class Injector {
|
43 | private readonly options?;
|
44 | private logger;
|
45 | constructor(options?: {
|
46 | preview: boolean;
|
47 | });
|
48 | loadPrototype<T>({ token }: InstanceWrapper<T>, collection: Map<InjectionToken, InstanceWrapper<T>>, contextId?: ContextId): void;
|
49 | loadInstance<T>(wrapper: InstanceWrapper<T>, collection: Map<InjectionToken, InstanceWrapper>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
50 | loadMiddleware(wrapper: InstanceWrapper, collection: Map<InjectionToken, InstanceWrapper>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
51 | loadController(wrapper: InstanceWrapper<Controller>, moduleRef: Module, contextId?: ContextId): Promise<void>;
|
52 | loadInjectable<T = any>(wrapper: InstanceWrapper<T>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
53 | loadProvider(wrapper: InstanceWrapper<Injectable>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
54 | applySettlementSignal<T>(instancePerContext: InstancePerContext<T>, host: InstanceWrapper<T>): SettlementSignal;
|
55 | resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, moduleRef: Module, inject: InjectorDependency[], callback: (args: unknown[]) => void | Promise<void>, contextId?: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<void>;
|
56 | getClassDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
57 | getFactoryProviderDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
|
58 | reflectConstructorParams<T>(type: Type<T>): any[];
|
59 | reflectOptionalParams<T>(type: Type<T>): any[];
|
60 | reflectSelfParams<T>(type: Type<T>): any[];
|
61 | resolveSingleParam<T>(wrapper: InstanceWrapper<T>, param: Type<any> | string | symbol | any, dependencyContext: InjectorDependencyContext, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper<any>>;
|
62 | resolveParamToken<T>(wrapper: InstanceWrapper<T>, param: Type<any> | string | symbol | any): any;
|
63 | resolveComponentInstance<T>(moduleRef: Module, token: InjectionToken, dependencyContext: InjectorDependencyContext, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper>;
|
64 | resolveComponentHost<T>(moduleRef: Module, instanceWrapper: InstanceWrapper<T | Promise<T>>, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<InstanceWrapper>;
|
65 | lookupComponent<T = any>(providers: Map<Function | string | symbol, InstanceWrapper>, moduleRef: Module, dependencyContext: InjectorDependencyContext, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<InstanceWrapper<T>>;
|
66 | lookupComponentInParentModules<T = any>(dependencyContext: InjectorDependencyContext, moduleRef: Module, wrapper: InstanceWrapper<T>, contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number): Promise<any>;
|
67 | lookupComponentInImports(moduleRef: Module, name: InjectionToken, wrapper: InstanceWrapper, moduleRegistry?: any[], contextId?: ContextId, inquirer?: InstanceWrapper, keyOrIndex?: symbol | string | number, isTraversing?: boolean): Promise<any>;
|
68 | resolveProperties<T>(wrapper: InstanceWrapper<T>, moduleRef: Module, inject?: InjectorDependency[], contextId?: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<PropertyDependency[]>;
|
69 | reflectProperties<T>(type: Type<T>): PropertyDependency[];
|
70 | applyProperties<T = any>(instance: T, properties: PropertyDependency[]): void;
|
71 | instantiateClass<T = any>(instances: any[], wrapper: InstanceWrapper, targetMetatype: InstanceWrapper, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<T>;
|
72 | loadPerContext<T = any>(instance: T, moduleRef: Module, collection: Map<InjectionToken, InstanceWrapper>, ctx: ContextId, wrapper?: InstanceWrapper): Promise<T>;
|
73 | loadEnhancersPerContext(wrapper: InstanceWrapper, ctx: ContextId, inquirer?: InstanceWrapper): Promise<void>;
|
74 | loadCtorMetadata(metadata: InstanceWrapper<any>[], contextId: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<any[]>;
|
75 | loadPropertiesMetadata(metadata: PropertyMetadata[], contextId: ContextId, inquirer?: InstanceWrapper): Promise<PropertyDependency[]>;
|
76 | private getInquirerId;
|
77 | private resolveScopedComponentHost;
|
78 | private isInquirerRequest;
|
79 | private isInquirer;
|
80 | protected addDependencyMetadata(keyOrIndex: symbol | string | number, hostWrapper: InstanceWrapper, instanceWrapper: InstanceWrapper): void;
|
81 | private getTokenName;
|
82 | private printResolvingDependenciesLog;
|
83 | private printLookingForProviderLog;
|
84 | private printFoundInModuleLog;
|
85 | private isDebugMode;
|
86 | private getContextId;
|
87 | private getNowTimestamp;
|
88 | }
|