/// import { EventEmitter } from 'events'; import { IConfigObj } from '../configLoader'; import { IApplicationConfig } from '../launcher'; import { ILogger } from '../logger'; import { IModule } from '../module'; export interface IContainer { baseDir: string; logger(): ILogger; config(module: string): (object | undefined); module(moduleName: string): IModule; } export interface IInjections { container?: IContainer; logger?: ILogger; config?: IConfigObj; } export interface IConstructible { prototype: T; new (injections: IInjections): T; } export interface IESModule { default: IConstructible; __esModule: true; } /** * Internal module for dependency injection */ export declare class Container extends EventEmitter implements IContainer { baseDir: string; private readonly modules; private readonly store; private loggerObj; private configObj; /** * Initialize container * @param applicationConfig Application configuration */ init(applicationConfig: IApplicationConfig): Promise; /** * Set container-local variables * @param key Object key * @param value Object value */ set(key: string, value: Object | Function): void; /** * Get container-local variable by key * @param key Object key */ get(key: string): Object | Function | undefined; /** * Return logger instance */ logger(): ILogger; /** * Return config object */ config(): (object | undefined); /** * Return loaded module by name * @param moduleName Module name */ module(moduleName: string): IModule; /** * Setup logger * @param loggerConfig Logger configuration */ private initializeLogger; /** * Inject module into the container * @param name Module name * @param modulePath Path of module */ private injectModule; /** * Load configuration * @param configLoader Config Loader instance */ private loadConfig; }