import { BoundInjectionToken, ClassType, ClassTypeWithArgument, FactoryInjectionToken, InjectionToken, InjectionTokenSchemaType } from "../token/injection-token.mjs"; import { Join, UnionToArray } from "../utils/types.mjs"; import { IContainer } from "../interfaces/container.interface.mjs"; import { InjectableScope } from "../enums/injectable-scope.enum.mjs"; import { Factorable } from "../interfaces/factory.interface.mjs"; import { Registry } from "../token/registry.mjs"; import { NameResolver } from "../internal/core/name-resolver.mjs"; import { ServiceInvalidator } from "../internal/core/service-invalidator.mjs"; import { TokenResolver } from "../internal/core/token-resolver.mjs"; import { UnifiedStorage } from "../internal/holder/unified-storage.mjs"; import { ZodType, z } from "zod/v4"; //#region src/container/abstract-container.d.mts /** * Abstract base class for dependency injection containers. * * Provides shared implementation for common container operations. * Both Container and ScopedContainer extend this class. */ declare abstract class AbstractContainer implements IContainer { /** * The default scope used when adding instances without explicit registration. */ protected abstract readonly defaultScope: InjectableScope; /** * The request ID for scoped containers, undefined for root container. */ protected abstract readonly requestId: string | undefined; /** * Gets the storage for this container. */ abstract getStorage(): UnifiedStorage; /** * Gets the registry for this container. */ protected abstract getRegistry(): Registry; /** * Gets the token resolver. */ protected abstract getTokenResolver(): TokenResolver; /** * Gets the name resolver. */ protected abstract getNameResolver(): NameResolver; /** * Gets the service invalidator. */ protected abstract getServiceInvalidator(): ServiceInvalidator; /** * Gets an instance from the container. */ abstract get(token: T): InstanceType extends Factorable ? Promise : Promise>; abstract get, R>(token: T, args: R): Promise>; abstract get(token: InjectionToken, args: z.input): Promise; abstract get(token: InjectionToken): R extends false ? Promise : S extends ZodType ? `Error: Your token requires args: ${Join, ', '>}` : 'Error: Your token requires args'; abstract get(token: InjectionToken): Promise; abstract get(token: BoundInjectionToken): Promise; abstract get(token: FactoryInjectionToken): Promise; /** * Invalidates a service and its dependencies. */ abstract invalidate(service: unknown): Promise; /** * Disposes the container and cleans up all resources. */ abstract dispose(): Promise; /** * Calculates the instance name for a given token and optional arguments. * * @internal * @param token The class type, InjectionToken, BoundInjectionToken, or FactoryInjectionToken * @param args Optional arguments (ignored for BoundInjectionToken which uses its bound value) * @returns The calculated instance name string, or null if the token is a FactoryInjectionToken that is not yet resolved */ calculateInstanceName(token: ClassType | InjectionToken | BoundInjectionToken | FactoryInjectionToken, args?: unknown): string | null; /** * Checks if a service is registered in the container. */ isRegistered(token: any): boolean; /** * Waits for all pending operations to complete. */ ready(): Promise; /** * @internal * Attempts to get an instance synchronously if it already exists. */ tryGetSync(token: any, args?: any): T | null; /** * @internal * Internal method for getting instances synchronously with configurable storage. */ protected tryGetSyncFromStorage(token: any, args: any, storage: UnifiedStorage, requestId?: string): T | null; /** * Adds an instance to the container. * Accepts class types, InjectionTokens, and BoundInjectionTokens. * Rejects InjectionTokens with required schemas (use BoundInjectionToken instead). * * @param token The class type, InjectionToken, or BoundInjectionToken to register the instance for * @param instance The instance to store */ addInstance(token: ClassType | InjectionToken | BoundInjectionToken, instance: T): void; /** * @internal * Internal method for adding instances with configurable scope and storage. */ protected addInstanceToStorage(token: ClassType | InjectionToken | BoundInjectionToken, instance: T, storage: UnifiedStorage, scope: InjectableScope, requestId?: string): void; } //#endregion export { AbstractContainer }; //# sourceMappingURL=abstract-container.d.mts.map