| 2 | import z from "zod"; |
| 3 | |
| 4 | export interface IBus { |
| 5 | publish(event: z.infer<typeof RunEvent>): Promise<void>; |
| 6 | |
| 7 | // subscribe accepts a handler to handle events |
| 8 | // and returns a function to unsubscribe |
| 9 | subscribe(runId: string, handler: (event: z.infer<typeof RunEvent>) => Promise<void>): Promise<() => void>; |
| 10 | } |
| 11 | |
| 12 | export class InMemoryBus implements IBus { |
| 13 | private subscribers: Map<string, ((event: z.infer<typeof RunEvent>) => Promise<void>)[]> = new Map(); |
nothing calls this directly
no outgoing calls
no test coverage detected