import { LibraryId, PhaseId, LibraryState, LibraryRegistration, LifecycleManager, LifecycleManagerConfig } from './types'; /** * Implementation of the lifecycle manager. * * @example * ```typescript * const lifecycle = new LifecycleManagerImpl(); * * // Register libraries * lifecycle.registerLibrary({ * id: createLibraryId('auth'), * name: 'Authentication', * version: '1.0.0', * dependencies: [], * phase: createPhaseId('core'), * initialize: async () => { * await authService.init(); * }, * cleanup: async () => { * await authService.cleanup(); * }, * }); * * // Initialize all libraries * await lifecycle.initialize(); * ``` */ export declare class LifecycleManagerImpl implements LifecycleManager { /** Configuration */ private readonly config; /** Registered libraries */ private readonly libraries; /** Initialization order (computed after resolution) */ private initializationOrder; /** Overall initialization state */ private state; /** Initialization promise for deduplication */ private initPromise; /** Shutdown promise for deduplication */ private shutdownPromise; /** * Creates a new lifecycle manager. * @param config - Configuration options */ constructor(config?: Partial); /** * Registers a library for lifecycle management. * @param registration - Library registration */ registerLibrary(registration: Omit): void; /** * Unregisters a library. * @param id - Library ID */ unregisterLibrary(id: LibraryId): void; /** * Initializes all registered libraries. * @returns Promise that resolves when initialization completes */ initialize(): Promise; /** * Shuts down all libraries in reverse order. * @returns Promise that resolves when shutdown completes */ shutdown(): Promise; /** * Gets the state of a library. * @param id - Library ID * @returns Library state or undefined */ getLibraryState(id: LibraryId): LibraryState | undefined; /** * Gets all library states. * @returns Map of library ID to state */ getAllStates(): Map; /** * Checks if all libraries are initialized. * @returns True if all libraries are running */ isFullyInitialized(): boolean; /** * Performs health check on all libraries. * @returns Map of library ID to health status */ healthCheck(): Promise>; /** * Suspends low-priority libraries (e.g., for memory pressure). * @returns Promise that resolves when suspension completes */ suspend(): Promise; /** * Resumes suspended libraries. * @returns Promise that resolves when resume completes */ resume(): Promise; /** * Performs the actual initialization. */ private doInitialize; /** * Initializes libraries in parallel. */ private initializeLibrariesParallel; /** * Initializes libraries sequentially. */ private initializeLibrariesSequential; /** * Initializes a single library. */ private initializeLibrary; /** * Performs the actual shutdown. */ private doShutdown; } /** * Gets the global lifecycle manager. * @param config - Optional configuration * @returns Global lifecycle manager instance */ export declare function getLifecycleManager(config?: Partial): LifecycleManagerImpl; /** * Sets the global lifecycle manager. * @param manager - Lifecycle manager instance */ export declare function setLifecycleManager(manager: LifecycleManagerImpl): void; /** * Resets the global lifecycle manager. */ export declare function resetLifecycleManager(): Promise; /** * Registers a library with the global lifecycle manager. */ export declare function registerLibrary(registration: Omit): void; /** * Initializes all libraries. */ export declare function initializeLibraries(): Promise; /** * Shuts down all libraries. */ export declare function shutdownLibraries(): Promise; export declare const LIBRARY_IDS: { readonly coordination: LibraryId; readonly auth: LibraryId; readonly rbac: LibraryId; readonly theme: LibraryId; readonly featureFlags: LibraryId; readonly hydration: LibraryId; readonly streaming: LibraryId; readonly realtime: LibraryId; readonly vdom: LibraryId; readonly state: LibraryId; readonly security: LibraryId; readonly performance: LibraryId; readonly ux: LibraryId; readonly system: LibraryId; }; export declare const PHASE_IDS: { readonly bootstrap: PhaseId; readonly core: PhaseId; readonly feature: PhaseId; readonly ui: PhaseId; };