import Config from '../config/ConfigProvider'; import { Logger } from '../log/LogManager'; import { Lifecycle } from './Lifecycle'; import { ObjectDefinition } from './objectdefinition/ObjectDefinition'; import { ObjectDefinitionInspector } from './ObjectDefinitionInspector'; /** * A context used by IoC to register and request objects from. * This is the main class for the inversion of control framework. It serves as a registry where you can * add {ObjectDefinition}s and request instances from them. */ export interface ContextOptions { logger?: Logger; config?: Config; shutdownTimer?: number; } export declare class Context extends Lifecycle { private objectDefinitionInspector; private startedObjects; private objectDefinitions; private parentContext; private config; private objectGroups; private shutdownTimer; constructor(name: string, parentContext?: Context, options?: ContextOptions); lcStart(): Promise; lcStop(): Promise; protected doStart(): Promise; protected doStop(): Promise; clone(name: any): Context; importContext(otherContext: any, overwrite?: boolean): void; addObjectDefinitionInspector(inspector: ObjectDefinitionInspector): void; registerDefinition(objectDefinition: ObjectDefinition, overwrite?: boolean): void; registerSingletons(...singletons: any[]): void; registerSingletonsInDir(patterns: any, options: any): void; static requireFilesInDir(dir: any): void; /** * Walks a directory recursively and returns an array with all the files * * @private * @param dir The directory to walk through * @param filelist The carried-over list of files * @return {Array} The list of files in this directory and subdirs */ static walkDirSync(dir: any, filelist?: any[]): any[]; /** * find matching files based on the given path or glob * * @param {string} patterns - glob pattern(s) or relative path * @param {boolean} [isGlob] - pass true to treat the path as a glob * @param {Object} [globOptions] - options to pass to globby * @returns {Array} files */ static findMatchingFiles(patterns: string | Array, {isGlob, globOptions}: { isGlob: boolean; globOptions: Object; }): Array; /** * Get an element from the configuration. * Can be both a leaf of the configuration, or an intermediate path. In the latter case it will return * an object with all the configs under that path. * It will throw an exception if the key doesn't exist. * * @param {string} key The key of the config we want * @param {*} defaultValue A default value to use if the key doesn't exist * @return {*} The requested configuration * @throws {Error} If the given key doesn't exist and a default value is not provided * @see {@link Context.hasConfig} */ getConfig(key: string, defaultValue?: any): any; /** * Indicates whether a given key exists in the configuration * @param key * @return {*} */ hasConfig(key: string): boolean; addObjectNameToGroup(groupName: string, objectName: string): void; getGroupObjectNames(groupName: string): string[]; getObjectByName(beanName: string): Promise; getObjectByType(className: string): Promise; getObjectsByType(className: string): Promise; getObjectsByGroup(groupName: string): Promise; getDefinitionByName(objectName: string): ObjectDefinition; getDefinitionByType(className: string): ObjectDefinition; getDefinitionsByType(className: string, failOnMissing?: boolean): Array>; getDefinitionsByGroup(groupName: string): Array>; applyObjectDefinitionModifiers(): void; }