import { BootstrapConstructor } from "./bootstrap-constructor"; /** * DisposableSingletonContainer is a class that is used to create instances of classes and manage their lifecycle via singleton methods. */ export declare class DisposableSingletonContainer { private readonly singletonContainer; private readonly disposeSequenceMap; private disposeSequence; readonly bootstrap: BootstrapConstructor; /** * Creates an instance of DisposableSingletonContainer. * @param singletonContainer The singleton container map(defaults to an empty map) * @param disposeSequenceMap The dispose sequence map(defaults to an empty map, to be filled if singletonContainer is not empty) * @param disposeSequence The dispose sequence number(defaults to 0, to be incremented appropriately if singletonContainer is not empty) * @param bootstrap The bootstrap constructor. */ constructor(singletonContainer?: Map, disposeSequenceMap?: Map>, disposeSequence?: number, bootstrap?: BootstrapConstructor); /** * Creates a new instance of a class with a constructor or returns an existing one based on name. * @param {string} name The name of the instance, has to be unique across all instances. * @param typeConstructor The class constructor * @param constructorArguments The arguments to pass to the constructor(optional) * @param {number} disposeSequence The dispose sequence number(optional) * @returns The instance of the class */ createInstance(name: string, typeConstructor: new (...constructorArguments: any[]) => InstanceType, constructorArguments?: any[], disposeSequence?: number): InstanceType; /** * Creates a new instance of a class without a constructor asynchronously or returns an existing one based on name. * @param {string} name The name of the instance, has to be unique across all instances. * @param typeConstructorFunction The class constructor ASYNC function. * @param constructorFunctionArguments The arguments to pass to the constructor(optional) * @param {number} disposeSequence The dispose sequence number(optional) * @returns The instance of the class */ createAsyncInstanceWithoutConstructor(name: string, typeConstructorFunction: (...constructorArguments: any[]) => Promise, constructorFunctionArguments?: any[], disposeSequence?: number): Promise; /** * Creates a new instance of a class without a constructor or returns an existing one based on name. * @param {string} name The name of the instance, has to be unique across all instances. * @param typeConstructorFunction The class constructor * @param constructorFunctionArguments The arguments to pass to the constructor(optional) * @param {number} disposeSequence The dispose sequence number(optional) * @returns The instance of the class * @template InstanceType The type of the instance * @returns {InstanceType} The instance of the class */ createInstanceWithoutConstructor(name: string, typeConstructorFunction: (...constructorArguments: any[]) => InstanceType, constructorFunctionArguments?: any[], disposeSequence?: number): InstanceType; /** * Fetches an existing instance based on name. * @param {string} name The name of the instance * @returns The instance of the class or undefined if it does not exist * @template InstanceType The type of the instance * @returns {InstanceType | undefined} The instance of the class or undefined if it does not exist */ fetchInstance(name: string): InstanceType | undefined; /** * Registers an existing instance based on name. * @param {string} name The name of the instance * @param {InstanceType} instance The instance of the class * @param {number} disposeSequence The dispose sequence number(optional) * @template InstanceType The type of the instance * @returns {void} void */ registerInstance(name: string, instance: InstanceType, disposeSequence?: number, overrideExistingInstance?: boolean): boolean; /** * Disposes an existing instance based on name. * @param {string} name The name of the instance * @returns {Promise} void */ disposeInstance(name: string): Promise; /** * Disposes all existing instances based on the dispose sequence. * @returns {Promise} void */ disposeAll(): Promise; }