import type { EventEnvelope } from './event-envelope.js';
type EventLike = {
    readonly type: string;
};
type EventForType<TEvent extends EventLike, TType extends TEvent['type']> = Extract<TEvent, {
    type: TType;
}>;
export interface RuntimeEventFeed<TEvent extends EventLike = EventLike> {
    on<TType extends TEvent['type']>(type: TType, listener: (payload: EventForType<TEvent, TType>) => void): () => void;
    onEnvelope<TType extends TEvent['type']>(type: TType, listener: (envelope: EventEnvelope<TType, EventForType<TEvent, TType>>) => void): () => void;
}
export type RuntimeEventFeeds<TDomain extends string, TEvent extends EventLike = EventLike> = {
    readonly domains: readonly TDomain[];
    domain(domain: TDomain): RuntimeEventFeed<TEvent>;
} & {
    readonly [K in TDomain]: RuntimeEventFeed<TEvent>;
};
export type EnvelopeSubscriber<TEvent extends EventLike> = <TType extends TEvent['type']>(type: TType, listener: (envelope: EventEnvelope<TType, EventForType<TEvent, TType>>) => void) => () => void;
export declare function createRuntimeEventFeed<TEvent extends EventLike>(subscribe: EnvelopeSubscriber<TEvent>): RuntimeEventFeed<TEvent>;
export declare function createRuntimeEventFeeds<TDomain extends string, TEvent extends EventLike>(domains: readonly TDomain[], createFeed: (domain: TDomain) => RuntimeEventFeed<TEvent>): RuntimeEventFeeds<TDomain, TEvent>;
export {};
//# sourceMappingURL=event-feeds.d.ts.map