import type { ILogger } from './logger/types.js'; import type { TContainerOptions, TSelector, TTargetOptions, Type } from './types.js'; export declare const DEFAULT_OPTIONS: TContainerOptions; export declare class Container { #private; constructor(options?: Partial); get logger(): ILogger; /** * Adds a new provider to the container storage. * The provider is identified by `target`, and has the specific `options` configured. * * The method throws an error if the `target` is not provided or if the `target` already exists in the storage. * * If the `scope` of `provider` is `request`, then a `WeakMap` is also added to the `contextMap` of the `storageEntry`. * * @template Selector - The type that extends TSelector. * * @param {Selector} target - The identifier used for the provider. * @param {TTargetOptions} [options={}] - Additional configuration for the provider. * * @throws {DependencyInjectionError} - If `target` is not provided or already exists in the container. * * @returns {Container} - The container instance for method chaining. */ add(target: Selector, options?: TTargetOptions): Container; /** * This method gets an instance of the class or value associated with the provided selector from the container. * It throws an error if the selector has not been registered in the container. * * @template {TSelector} Selector - The type that extends TSelector. * @template {Record} Context - The type representing the context object provided when the provider is request-scoped. * @template {Type} Result - Some value got from container by selector * * @param {Selector} selector - The class/constructor or value to get from the container. * @param {Context} [context] - Optional context if the requested provider is request-scoped. * * @throws {DependencyInjectionError} - If the target has not been registered in the container. * * @returns {Promise} - The instance associated with the selector. */ getOrFail = Record, Selector extends Items = Items, Result = Selector extends Type ? A : any>(selector: Selector, context?: Context): Promise; /** * This method gets an instance of the class or value associated with the provided selector from the container. * It returns null if the selector has not been registered in the container. * * @template {TSelector} Selector - The type that extends TSelector. * @template {Record} Context - The type representing the context object provided when the provider is request-scoped. * @template {Type} Result - Some value got from container by selector * * @param {Selector} selector - The class/constructor or value to get from the container. * @param {Context} [context] - Optional context if the requested provider is request-scoped. * @returns {Promise} - The instance associated with the selector if it exists, otherwise null. */ get = Record, Selector extends Items = Items, Result = Selector extends Type ? A : any>(selector: Selector, context?: Context): Promise; /** * Run this method after all dependencies registered in the container * @return {Promise} */ finalize(): Promise>; /** * Alias for `finalize()` * @return {Promise} */ build(): Promise>; } export * from './errors/constants.js'; export * from './errors/dependency-injection.error.js'; export * from './constants.js'; export * from './types.js'; export * from './utils.js'; /** * Logger */ export * from './logger/types.js'; export * from './logger/console-logger.impl.js';