Server IP : 150.95.80.236 / Your IP : 18.224.67.0 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/api-uat.pcu.in.th/node_modules/@nestjs/core/injector/ |
Upload File : |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstanceLoader = void 0; const common_1 = require("@nestjs/common"); const messages_1 = require("../helpers/messages"); const internal_core_module_1 = require("./internal-core-module/internal-core-module"); class InstanceLoader { constructor(container, injector, graphInspector, logger = new common_1.Logger(InstanceLoader.name, { timestamp: true, })) { this.container = container; this.injector = injector; this.graphInspector = graphInspector; this.logger = logger; } setLogger(logger) { this.logger = logger; } async createInstancesOfDependencies(modules = this.container.getModules()) { this.createPrototypes(modules); try { await this.createInstances(modules); } catch (err) { this.graphInspector.inspectModules(modules); this.graphInspector.registerPartial(err); throw err; } this.graphInspector.inspectModules(modules); } createPrototypes(modules) { modules.forEach(moduleRef => { this.createPrototypesOfProviders(moduleRef); this.createPrototypesOfInjectables(moduleRef); this.createPrototypesOfControllers(moduleRef); }); } async createInstances(modules) { await Promise.all([...modules.values()].map(async (moduleRef) => { await this.createInstancesOfProviders(moduleRef); await this.createInstancesOfInjectables(moduleRef); await this.createInstancesOfControllers(moduleRef); const { name } = moduleRef; this.isModuleWhitelisted(name) && this.logger.log((0, messages_1.MODULE_INIT_MESSAGE) `${name}`); })); } createPrototypesOfProviders(moduleRef) { const { providers } = moduleRef; providers.forEach(wrapper => this.injector.loadPrototype(wrapper, providers)); } async createInstancesOfProviders(moduleRef) { const { providers } = moduleRef; const wrappers = [...providers.values()]; await Promise.all(wrappers.map(async (item) => { await this.injector.loadProvider(item, moduleRef); this.graphInspector.inspectInstanceWrapper(item, moduleRef); })); } createPrototypesOfControllers(moduleRef) { const { controllers } = moduleRef; controllers.forEach(wrapper => this.injector.loadPrototype(wrapper, controllers)); } async createInstancesOfControllers(moduleRef) { const { controllers } = moduleRef; const wrappers = [...controllers.values()]; await Promise.all(wrappers.map(async (item) => { await this.injector.loadController(item, moduleRef); this.graphInspector.inspectInstanceWrapper(item, moduleRef); })); } createPrototypesOfInjectables(moduleRef) { const { injectables } = moduleRef; injectables.forEach(wrapper => this.injector.loadPrototype(wrapper, injectables)); } async createInstancesOfInjectables(moduleRef) { const { injectables } = moduleRef; const wrappers = [...injectables.values()]; await Promise.all(wrappers.map(async (item) => { await this.injector.loadInjectable(item, moduleRef); this.graphInspector.inspectInstanceWrapper(item, moduleRef); })); } isModuleWhitelisted(name) { return name !== internal_core_module_1.InternalCoreModule.name; } } exports.InstanceLoader = InstanceLoader;