UNPKG

4.66 kBTypeScriptView Raw
1import { EnhancerSubtype } from '@nestjs/common/constants';
2import { ClassProvider, Controller, DynamicModule, ExistingProvider, FactoryProvider, Injectable, InjectionToken, NestModule, Provider, Type, ValueProvider } from '@nestjs/common/interfaces';
3import { NestContainer } from './container';
4import { InstanceWrapper } from './instance-wrapper';
5import { ModuleRef } from './module-ref';
6export declare class Module {
7 private readonly _metatype;
8 private readonly container;
9 private readonly _id;
10 private readonly _imports;
11 private readonly _providers;
12 private readonly _injectables;
13 private readonly _middlewares;
14 private readonly _controllers;
15 private readonly _entryProviderKeys;
16 private readonly _exports;
17 private _distance;
18 private _initOnPreview;
19 private _isGlobal;
20 private _token;
21 constructor(_metatype: Type<any>, container: NestContainer);
22 get id(): string;
23 get token(): string;
24 set token(token: string);
25 get name(): string;
26 get isGlobal(): boolean;
27 set isGlobal(global: boolean);
28 get initOnPreview(): boolean;
29 set initOnPreview(initOnPreview: boolean);
30 get providers(): Map<InjectionToken, InstanceWrapper<Injectable>>;
31 get middlewares(): Map<InjectionToken, InstanceWrapper<Injectable>>;
32 get imports(): Set<Module>;
33 get injectables(): Map<InjectionToken, InstanceWrapper<Injectable>>;
34 get controllers(): Map<InjectionToken, InstanceWrapper<Controller>>;
35 get entryProviders(): Array<InstanceWrapper<Injectable>>;
36 get exports(): Set<InjectionToken>;
37 get instance(): NestModule;
38 get metatype(): Type<any>;
39 get distance(): number;
40 set distance(value: number);
41 addCoreProviders(): void;
42 addModuleRef(): void;
43 addModuleAsProvider(): void;
44 addApplicationConfig(): void;
45 addInjectable<T extends Injectable>(injectable: Provider, enhancerSubtype: EnhancerSubtype, host?: Type<T>): string | symbol | Function | InstanceWrapper<unknown>;
46 addProvider(provider: Provider): InjectionToken;
47 addProvider(provider: Provider, enhancerSubtype: EnhancerSubtype): InjectionToken;
48 isCustomProvider(provider: Provider): provider is ClassProvider | FactoryProvider | ValueProvider | ExistingProvider;
49 addCustomProvider(provider: ClassProvider | FactoryProvider | ValueProvider | ExistingProvider, collection: Map<Function | string | symbol, any>, enhancerSubtype?: EnhancerSubtype): InjectionToken;
50 isCustomClass(provider: any): provider is ClassProvider;
51 isCustomValue(provider: any): provider is ValueProvider;
52 isCustomFactory(provider: any): provider is FactoryProvider;
53 isCustomUseExisting(provider: any): provider is ExistingProvider;
54 isDynamicModule(exported: any): exported is DynamicModule;
55 addCustomClass(provider: ClassProvider, collection: Map<InjectionToken, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
56 addCustomValue(provider: ValueProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
57 addCustomFactory(provider: FactoryProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
58 addCustomUseExisting(provider: ExistingProvider, collection: Map<Function | string | symbol, InstanceWrapper>, enhancerSubtype?: EnhancerSubtype): void;
59 addExportedProvider(provider: Provider | string | symbol | DynamicModule): Set<InjectionToken>;
60 addCustomExportedProvider(provider: FactoryProvider | ValueProvider | ClassProvider | ExistingProvider): Set<InjectionToken>;
61 validateExportedProvider(token: InjectionToken): InjectionToken;
62 addController(controller: Type<Controller>): void;
63 assignControllerUniqueId(controller: Type<Controller>): void;
64 addImport(moduleRef: Module): void;
65 /**
66 * @deprecated
67 */
68 addRelatedModule(module: Module): void;
69 replace(toReplace: InjectionToken, options: any): void;
70 hasProvider(token: InjectionToken): boolean;
71 hasInjectable(token: InjectionToken): boolean;
72 getProviderByKey<T = any>(name: InjectionToken): InstanceWrapper<T>;
73 getProviderById<T = any>(id: string): InstanceWrapper<T> | undefined;
74 getControllerById<T = any>(id: string): InstanceWrapper<T> | undefined;
75 getInjectableById<T = any>(id: string): InstanceWrapper<T> | undefined;
76 getMiddlewareById<T = any>(id: string): InstanceWrapper<T> | undefined;
77 getNonAliasProviders(): Array<[
78 InjectionToken,
79 InstanceWrapper<Injectable>
80 ]>;
81 createModuleReferenceType(): Type<ModuleRef>;
82 private isEntryProvider;
83 private generateUuid;
84}