import { ContainerInstance } from './container-instance.class'; import { ContainerIdentifier } from './types/container-identifier.type'; /** * The container registry is responsible for holding the default and every * created container instance for later access. * * _Note: This class is for internal use and its API may break in minor or * patch releases without warning._ */ export declare class ContainerRegistry { /** * The list of all known container. Created containers are automatically added * to this list. Two container cannot be registered with the same ID. * * This map doesn't contains the default container. */ private static readonly containerMap; /** * Registers the given container instance or throws an error. * * _Note: This function is auto-called when a Container instance is created, * it doesn't need to be called manually!_ * * @param container the container to add to the registry * * @throws ContainerRegistryError * This exception is thrown in the following scenarios: * - If the item being registered is not a container. * - A container with the same ID already exists in the registry. */ static registerContainer(container: ContainerInstance): void; /** * Returns true if a container exists with the given ID or false otherwise. * * @param container the ID of the container * * @returns Whether a container with the specified ID could be * found in the registry. */ static hasContainer(id: ContainerIdentifier): boolean; /** * Returns the container for requested ID or throws an error if no container * is registered with the given ID. * * @param container the ID of the container * * @throws ContainerRegistryError * This exception is thrown when a container with * the given ID does not exist in the registry. */ static getContainer(id: ContainerIdentifier): ContainerInstance; /** * Removes the given container from the registry and disposes all services * registered only in this container. * * This function throws an error if no * - container exists with the given ID * - any of the registered services threw an error during it's disposal * * @param container the container to remove from the registry * * @throws ContainerRegistryError * This exception is thrown when a container with * the specified ID does not exist in the registry. * * @throws Error * */ static removeContainer(container: ContainerInstance): Promise; }