import { Kapp } from '..'; import { IModule, IModuleConfig } from './interfaces'; export declare class ModulesManager { /** * @property Contains the loaded application modules configurations. */ private _modules; /** * @property The application instance that uses this modules manager. */ private _app; /** * Class constructor. * @param modules The application modules informations organized by their name. */ constructor(app: Kapp); /** * Loads all the modules of the application. * @throws {ModuleException} Thrown if a configuration file is not valid or if two modules have the same name. */ loadAllAppModules(): Promise; /** * Calls the initialization scripts of all registered modules. */ initAllAppModules(): Promise; /** * Loads a module: extract its services, setup its base configuration, ... * @param path The absolute path to the module directory. * @param config The module configuration. * @throws {ModuleException} Thrown if another module of the same name exists. */ loadModule(path: string, config: IModuleConfig): Promise; /** * Initializes the module at the given path (executes its init.js or any configured initialization scripts). * @param path The absolute path to the module directory. * @param config The module configuration. * @throws {ModuleException} Thrown if an initialization script cannot be found or executed. */ initModule(path: string, config: IModuleConfig): Promise; /** * Performs an operation for each loaded modules. * @param callback The method to execute for each module. */ forEach(callback: (path: string, config: IModuleConfig) => void | Promise): Promise; /** * Gets the module of the given name. * @param name The name of the module you want to get. * @returns Returns the found module path and configuration, or null if there's no module of the given name. */ get(name: string): IModule; /** * Loads the declared services of a module. * @param modulePath The absolute path to the module directory. * @param services A path or array of paths to service scripts, or an object that defines the service names and their paths. * @throws {ModuleException} Thrown if the path to the service is wrong, or if the target script doesn't export a service class. */ private _loadModuleServices; /** * Instantiates the service from the script at the given path. * @param path The absolute path to the service script. * @returns Returns the service instance. * @throws {ModuleException} Thrown if the path to the service is wrong, or if the target script doesn't export a service class. */ private _instantiateService; private _loadModuleConfig; /** * Executes the initialization method in the script at the given path. * @param path The path to the initialization script. */ private _runInitializationScript; } export default ModulesManager;