import { BoundInjectionToken, ClassType, ClassTypeWithArgument, FactoryInjectionToken, InjectionToken, InjectionTokenSchemaType } from "../token/injection-token.mjs"; import { Join, UnionToArray } from "../utils/types.mjs"; import { Factorable } from "./factory.interface.mjs"; import { ZodType, z } from "zod/v4"; //#region src/interfaces/container.interface.d.mts /** * Interface for dependency injection containers. * Both Container and ScopedContainer implement this interface, * allowing them to be used interchangeably in factory contexts. */ interface IContainer { /** * Gets an instance from the container. */ get(token: T): InstanceType extends Factorable ? Promise : Promise>; get, R>(token: T, args: R): Promise>; get(token: InjectionToken, args: z.input): Promise; get(token: InjectionToken): R extends false ? Promise : S extends ZodType ? `Error: Your token requires args: ${Join, ', '>}` : 'Error: Your token requires args'; get(token: InjectionToken): Promise; get(token: BoundInjectionToken): Promise; get(token: FactoryInjectionToken): Promise; /** * Invalidates a service and its dependencies. */ invalidate(service: unknown): Promise; /** * Checks if a service is registered in the container. */ isRegistered(token: any): boolean; /** * 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; /** * Disposes the container and cleans up all resources. */ dispose(): Promise; /** * Waits for all pending operations to complete. */ ready(): Promise; /** * @internal * Attempts to get an instance synchronously if it already exists. * Returns null if the instance doesn't exist or is not ready. * Used internally by the inject system for synchronous property initialization. */ tryGetSync(token: any, args?: any): T | null; } //#endregion export { IContainer }; //# sourceMappingURL=container.interface.d.mts.map