UNPKG

dino-core

Version:

A dependency injection framework for NodeJS applications

43 lines (42 loc) 1.98 kB
import type { ComponentDescriptor } from '../model/ComponentDescriptor'; export declare class ApplicationContextHelper { private expandedDependencies; /** * Build a dependency tree for the specified set of component descriptors based on the dependencies defined. * * @param {Array<ComponentDescriptor>} componentDescriptors the array of component descriptors * * @public */ buildDependencyTree(componentDescriptors: ComponentDescriptor[], computationRequired?: boolean): Map<symbol, ComponentDescriptor[]>; /** * Effectively build the dependency tree * @param {ComponentDescriptor} componentDescriptor the component descriptor to analyse * @param {Map<Symbol, ComponentDescriptor>} dependencyTree the dependency tree * @param {Array<ComponentDescriptor>} waitingList a waiting list for components that have not been placed * * @private */ private doBuildDependencyTree; /** * Compute the level this component descriptor should be placed * * @param {Map<Symbol, ComponentDescriptor>} dependencyTree the dependency tree map * @param {Array<ComponentDescriptor>} waitingList an array containing components that cannot still be placed * @param {ComponentDescriptor} componentDescriptor the component descriptor to compute the level for * * @private */ private computeLevel; /** * Add the requested component descriptor to the requested level * * @param {Map} dependencyTree the dependency tree map * @param {Symbol} level the level that the component should be added to * @param {ComponentDescriptor} componentDescriptor the component descriptor to add * * @private */ addAtLevel(dependencyTree: Map<symbol, ComponentDescriptor[]>, level: symbol, componentDescriptor: ComponentDescriptor): void; isForWaitingList(level: number, componentDescriptor: ComponentDescriptor, firstPass: boolean): boolean; }