Open History to see the last commit
1import { Effect, Layer, PubSub, Stream } from "effect";
2
3import {
4 RuntimeReceiptBus,
5 type RuntimeReceiptBusShape,
6 type OrchestrationRuntimeReceipt,
7} from "../Services/RuntimeReceiptBus.ts";
8
9const makeRuntimeReceiptBus = Effect.gen(function* () {
10 const pubSub = yield* PubSub.unbounded<OrchestrationRuntimeReceipt>();
11
12 return {
13 publish: (receipt) => PubSub.publish(pubSub, receipt).pipe(Effect.asVoid),
14 stream: Stream.fromPubSub(pubSub),
15 } satisfies RuntimeReceiptBusShape;
16});
17
18export const RuntimeReceiptBusLive = Layer.effect(RuntimeReceiptBus, makeRuntimeReceiptBus);