import { type IEventDispatcher, type IDispatchPipelineProcessor, type IEventSet, type IEventBus, type IContainer } from './interfaces/index.ts'; import { EventDispatchPipeline } from './EventDispatchPipeline.ts'; export declare class EventDispatcher implements IEventDispatcher { #private; /** Default pipeline name */ static DEFAULT_PIPELINE: string; /** Default maximum number of parallel batches for newly created pipelines */ static DEFAULT_CONCURRENT_LIMIT: number; /** Default router that uses `meta.origin` as the pipeline name */ static DEFAULT_ROUTER: (_e: IEventSet, meta?: Record) => any; /** * Event bus where dispatched messages are delivered after processing. * If not provided in the constructor, defaults to an instance of `InMemoryMessageBus`. */ eventBus: IEventBus; /** * Default maximum number of parallel batches for newly created pipelines. */ concurrentLimit: number; /** Router that selects a pipeline name given events and meta */ eventDispatchRouter?: (events: IEventSet, meta?: Record) => string | undefined; /** * Called when a fire-and-forget event bus publish fails. * If not set, publish errors are silently discarded. */ eventPublishErrorHandler?: (error: Error) => void; constructor(o?: Pick & { eventDispatcherConfig?: { concurrentLimit?: number; }; eventDispatchPipelines?: Record; eventDispatchRouter?: (events: IEventSet, meta?: Record) => string | undefined; eventPublishErrorHandler?: (error: Error) => void; }); /** Add or create the default pipeline processors */ addPipelineProcessors(eventDispatchPipeline: IDispatchPipelineProcessor[], pipelineName?: string): void; /** Adds a single processor to the default pipeline */ addPipelineProcessor(preprocessor: IDispatchPipelineProcessor, pipelineName?: string): void; /** Create a named pipeline with processors and optional concurrency limit */ addPipeline(name: string, processors?: IDispatchPipelineProcessor[], options?: { concurrentLimit?: number; }): EventDispatchPipeline; /** Get a promise that resolves when all in-flight fire-and-forget event bus publishes have settled */ drain(): Promise; /** Dispatch events through a routed pipeline and publish to the shared eventBus */ dispatch(events: IEventSet, meta?: Record): Promise; }