/** * Stream Registry * * Auto-discovery and initialization for stream endpoints. * Similar to ServiceRegistry but for real-time streaming. * * @example * ```typescript * import { StreamServer, StreamRegistry } from '@plyaz/core/events/streaming'; * import { FilesStreamEndpoint } from '@plyaz/core/domain/files/streaming'; * import { SystemStreamEndpoint } from '@plyaz/core/events/streaming/endpoints'; * * // Create stream server * const streamServer = StreamServer.create() * .withAuth(new TokenAuthAdapter({ verifyToken: myVerifier })) * .withSSE({ heartbeatInterval: 15000 }) * .build(); * * // Initialize stream registry (like ServiceRegistry) * await StreamRegistry.initialize({ * broadcaster: streamServer.getBroadcaster(), * endpoints: [ * { endpoint: FilesStreamEndpoint, config: { enabled: true } }, * { endpoint: SystemStreamEndpoint, config: { enabled: true } }, * ], * }); * ``` */ import type { StreamRegistryConfig, StreamBroadcasterInterface } from '@plyaz/types/core'; import type { BaseStreamEndpoint } from './base/BaseStreamEndpoint'; import type { BaseChannelController } from './channels/BaseChannelController'; /** * StreamRegistry - Auto-discovery and initialization for stream endpoints * * Features: * - Auto-initialization of stream endpoints * - get() and getAsync() access patterns (like ServiceRegistry) * - Lifecycle management * - Controller registration with broadcaster */ export declare class StreamRegistry { private static readonly logger; private static get _endpoints(); private static get _controllers(); private static get _broadcaster(); private static set _broadcaster(value); private static get _initialized(); private static set _initialized(value); /** * Initialize the stream registry with endpoints. * * @param config - Registry configuration * @throws StreamPackageError if already initialized or endpoint fails * * @example * ```typescript * await StreamRegistry.initialize({ * broadcaster: streamServer.getBroadcaster(), * endpoints: [ * { endpoint: FilesStreamEndpoint, config: { enabled: true } }, * { endpoint: SystemStreamEndpoint, config: { enabled: true } }, * ], * }); * ``` */ static initialize(config: StreamRegistryConfig): Promise; /** * Get an endpoint by key (synchronous). * * @param key - Endpoint key * @returns Endpoint instance * @throws StreamPackageError if endpoint not found * * @example * ```typescript * const filesEndpoint = StreamRegistry.get('files'); * ``` */ static get(key: string): T; /** * Get an endpoint by key (async for lazy initialization if needed). * * @param key - Endpoint key * @returns Promise resolving to endpoint instance */ static getAsync(key: string): Promise; /** * Check if an endpoint is registered. * * @param key - Endpoint key * @returns true if endpoint is registered */ static has(key: string): boolean; /** * Get all registered endpoint keys. * * @returns Array of endpoint keys */ static getRegisteredKeys(): string[]; /** * Get a controller by scope. * * @param scope - Controller scope * @returns Controller instance or undefined */ static getController(scope: string): BaseChannelController | undefined; /** * Get controller for a channel. * * @param channel - Channel name * @returns Controller that handles the channel, or undefined */ static getControllerForChannel(channel: string): BaseChannelController | undefined; /** * Get all registered controller scopes. * * @returns Array of controller scopes */ static getRegisteredScopes(): string[]; /** * Get the broadcaster instance. * * @returns Broadcaster instance * @throws StreamPackageError if not initialized */ static getBroadcaster(): StreamBroadcasterInterface; /** * Check if registry is initialized. * * @returns true if initialized */ static isInitialized(): boolean; /** * Get registry statistics. * * @returns Statistics object */ static getStats(): { initialized: boolean; endpointCount: number; controllerCount: number; endpoints: string[]; controllers: string[]; }; /** * Dispose all endpoints and reset registry. */ static dispose(): void; /** * Reset registry (for testing). */ static reset(): void; } //# sourceMappingURL=StreamRegistry.d.ts.map