import { Stream } from 'node:stream'; import { EventBridgeBaseClass } from '../core/EventBridge/EventBridgeBaseClass.impl.js'; import { PendingInvocationRegistry } from '../core/EventBridge/PendingInvocationRegistry.impl.js'; import { PendingStreamRegistry } from '../core/EventBridge/PendingStreamRegistry.impl.js'; import type { EventBridge } from '../core/EventBridge/types/EventBridge.js'; import type { EventBridgeConfig } from '../core/EventBridge/types/EventBridgeConfig.js'; import type { CustomMessage } from '../core/types/CustomMessage.js'; import type { Command } from '../core/types/commandType/Command.js'; import type { CommandDefinitionMetadataBase } from '../core/types/commandType/CommandDefinitionMetadataBase.js'; import type { CommandErrorResponse } from '../core/types/commandType/CommandErrorResponse.js'; import type { CommandSuccessResponse } from '../core/types/commandType/CommandSuccessResponse.js'; import type { EBMessage } from '../core/types/EBMessage.js'; import type { EBMessageAddress } from '../core/types/EBMessageAddress.js'; import type { StreamDefinitionMetadataBase } from '../core/types/stream/StreamDefinitionMetadataBase.js'; import type { StreamHandle } from '../core/types/stream/StreamHandle.js'; import type { StreamMessage } from '../core/types/stream/StreamMessage.js'; import type { StreamOpenRequest } from '../core/types/stream/StreamOpenRequest.js'; import type { Subscription } from '../core/types/subscription/Subscription.js'; import type { DefaultEventBridgeConfig } from './types/DefaultEventBridgeConfig.js'; import type { SubscriptionStorageEntry } from './types/SubscriptionStorageEntry.js'; /** * Process-local in-memory event bridge for development and tests. * * The bridge supports command invocation, subscriptions, and streams in one * Node.js process. It is not durable: messages, pending invocations, and * subscriptions are lost on process shutdown. Late command responses and late * stream frames are ignored with warnings to avoid resolving timed-out callers. * * @example * ```typescript * import { DefaultEventBridge } from '@purista/core' * * const eventBridge = new DefaultEventBridge() * await eventBridge.start() * * // add your services * ``` * * @group Event bridge */ export declare class DefaultEventBridge extends EventBridgeBaseClass implements EventBridge { protected writeStream: Stream.Writable; protected readStream: Stream.Readable; protected serviceFunctions: Map Promise>; protected streamFunctions: Map Promise>; protected pendingInvocations: PendingInvocationRegistry; protected pendingStreams: PendingStreamRegistry; protected subscriptions: Map; protected hasStarted: boolean; protected healthy: boolean; constructor(config?: EventBridgeConfig); isReady(): Promise; isHealthy(): Promise; start(): Promise; /** * Register a service command and ensure that there is a queue for all incoming command requests. * @param address The service function address * @param cb the function to call if a matching command message arrives * @returns the id of command function queue */ registerCommand(address: EBMessageAddress, cb: (message: Command) => Promise | CommandErrorResponse>, metadata: CommandDefinitionMetadataBase): Promise; registerStream(address: EBMessageAddress, cb: (message: StreamMessage) => Promise, metadata: StreamDefinitionMetadataBase): Promise; unregisterCommand(address: EBMessageAddress): Promise; unregisterStream(address: EBMessageAddress): Promise; registerSubscription(subscription: Subscription, cb: (message: EBMessage) => Promise | undefined>): Promise; unregisterSubscription(address: EBMessageAddress): Promise; /** * Emit a new message to event bridge to be delivered to receiver * * @param message EBMessage */ emitMessage(message: Omit): Promise>; invoke(input: Omit, commandTimeout?: number): Promise; openStream(input: Omit, commandTimeout?: number): Promise>; destroy(): Promise; } //# sourceMappingURL=DefaultEventBridge.impl.d.ts.map