import type { z } from "zod"; import type { EventDescriptor } from "./event-descriptor"; export type EventHandler = (event: T) => Promise; export interface IEventBus { publish( descriptor: EventDescriptor>, payload: T, ): Promise; /** * Subscribe a handler. `consumerFeature` is the kebab-case name of the * subscribing feature (e.g., "marketing-pages"). It is unused by * InMemoryEventBus; PayloadJobsEventBus uses it to name the fan-out task * slug deterministically (`__events..`). */ subscribe( descriptor: EventDescriptor>, consumerFeature: string, handler: EventHandler, ): void; }