| 42 | import { ModuleRef, ModuleRefGetOrResolveOpts } from class="st">'./module-ref'; |
| 43 | |
| 44 | export class Module { |
| 45 | private readonly _id: string; |
| 46 | private readonly _imports = new Set<Module>(); |
| 47 | private readonly _providers = new Map< |
| 48 | InjectionToken, |
| 49 | InstanceWrapper<Injectable> |
| 50 | >(); |
| 51 | private readonly _injectables = new Map< |
| 52 | InjectionToken, |
| 53 | InstanceWrapper<Injectable> |
| 54 | >(); |
| 55 | private readonly _middlewares = new Map< |
| 56 | InjectionToken, |
| 57 | InstanceWrapper<Injectable> |
| 58 | >(); |
| 59 | private readonly _controllers = new Map< |
| 60 | InjectionToken, |
| 61 | InstanceWrapper<Controller> |
| 62 | >(); |
| 63 | private readonly _entryProviderKeys = new Set<InjectionToken>(); |
| 64 | private readonly _exports = new Set<InjectionToken>(); |
| 65 | |
| 66 | private _distance = 0; |
| 67 | private _initOnPreview = false; |
| 68 | private _isGlobal = false; |
| 69 | private _token: string; |
| 70 | |
| 71 | constructor( |
| 72 | private readonly _metatype: Type<any>, |
| 73 | private readonly container: NestContainer, |
| 74 | ) { |
| 75 | this.addCoreProviders(); |
| 76 | this._id = this.generateUuid(); |
| 77 | } |
| 78 | |
| 79 | get id(): string { |
| 80 | return this._id; |
| 81 | } |
| 82 | |
| 83 | get token(): string { |
| 84 | return this._token; |
| 85 | } |
| 86 | |
| 87 | set token(token: string) { |
| 88 | this._token = token; |
| 89 | } |
| 90 | |
| 91 | get name() { |
| 92 | return this.metatype.name; |
| 93 | } |
| 94 | |
| 95 | get isGlobal() { |
| 96 | return this._isGlobal; |
| 97 | } |
| 98 | |
| 99 | set isGlobal(global: boolean) { |
| 100 | this._isGlobal = global; |
| 101 | } |