import { type InjectionModeType } from 'awilix'; import { ComponentDescriptor } from '../model/ComponentDescriptor'; export interface InjectableConfig { name: string; source: string; scope: 'TRANSIENT' | 'SCOPED' | 'SINGLETON'; resolver: 'VALUE' | 'CLASS' | 'FUNCTION'; lazy: boolean; dependsOn: string[]; } export interface ContextConfig { injectionMode: 'proxy' | 'classic'; contextScan: boolean; contextRoot?: string; appConfigPath?: string; components: InjectableConfig[]; configurations: InjectableConfig[]; } /** * The provider of the application context configuration. * Configuration must have the following yaml format: * injectionMode: transient * components: * - name: (mandatory) the name of the component, will act as a reference for injection * - source: (mandatory) the source file of the component class relative to the root of the project or a module name * - scope: (optional) the resolution scope for the component, defaults to singleton * - resolver: (optional) the resolver to use available are class, value, function; if omitted class resolver wil be used * @typedef {ContextConfigurationProvider} * @public * @since 0.2.2 */ export declare class ContextConfigurationProvider { private readonly activeProfiles; private readonly contextRoots; private readonly conf; private readonly selectedComponentNames; /** * Create a new instance of ConfigurationProvider * @param {String} config the path of the configuration relative to the root of the project, * if not provided a scan will be performed to collect all entities defined. * @param {array} activeProfiles the profiles that are considered active for the current run * @returns {ContextConfigurationProvider} * * @public * @static */ constructor(conf: ContextConfig, activeProfiles?: string[]); getContextRoots(): string[]; /** * Provide the mode the injection will be performed, if mode is not defined "proxy" will be used. * Supported injection mode are: * - CLASSIC * - PROXY * * @returns {awilix.InjectionMode} the injection mode * @public */ mode(): InjectionModeType; /** * Normalize the source path * @param {String} source the configured source location * * @private */ normalizePath(source: string): string; /** * Create the component descriptors based on the provided configuration or context * * @returns {Promise>} a promise resolved with an array of component descriptors * @public */ createComponentDescriptors(): Promise; private doBuildComponentDescriptorFromSource; /** * * @param {String} name the name of the component to validate * @private */ private throwExceptionIfComponentNameIsNotProvidedOrNotAvailable; private profileIsActive; }