/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import { Container } from "./Container"; /** * Service token type for type-safe dependency injection */ export interface ServiceToken { readonly _type: T; readonly id: string; } /** * Create a typed service token * @param id Unique identifier for the service * @returns A typed service token */ export declare function createServiceToken(id: string): ServiceToken; /** * Service registry for managing and accessing services */ export declare class ServiceRegistry { container: Container; /** * Create a new service registry * @param container Optional container to use (defaults to global container) */ constructor(container?: Container); /** * Register a service factory * @param token Service token * @param factory Factory function to create the service * @param singleton Whether the service should be a singleton */ register(token: ServiceToken, factory: () => T, singleton?: boolean): void; /** * Register a service factory only if the token is not already registered. * @param token Service token * @param factory Factory function to create the service * @param singleton Whether the service should be a singleton */ registerIfAbsent(token: ServiceToken, factory: () => T, singleton?: boolean): void; /** * Register a service instance * @param token Service token * @param instance Service instance to register */ registerInstance(token: ServiceToken, instance: T): void; /** * Get a service by its token * @param token Service token * @returns The service instance */ get(token: ServiceToken): T; /** * Check if a service is registered * @param token Service token * @returns True if the service is registered */ has(token: ServiceToken): boolean; /** * Dispose all instantiated services and clear registrations. */ dispose(): Promise; } /** * Global service registry instance */ export declare const globalServiceRegistry: ServiceRegistry; //# sourceMappingURL=ServiceRegistry.d.ts.map