Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

runtimeLayer.ts

36 lines1.6 KB

1import * as Layer from "effect/Layer";
2​
3import { OrchestrationCommandReceiptRepositoryLive } from "../persistence/Layers/OrchestrationCommandReceipts.ts";
4import { OrchestrationEventStoreLive } from "../persistence/Layers/OrchestrationEventStore.ts";
5import { OrchestrationEngineLive } from "./Layers/OrchestrationEngine.ts";
6import { OrchestrationProjectionPipelineLive } from "./Layers/ProjectionPipeline.ts";
7import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSnapshotQuery.ts";
8import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";
9import * as ThreadPlanProgress from "./ThreadPlanProgress.ts";
10​
11export const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(
12 OrchestrationEventStoreLive,
13 OrchestrationCommandReceiptRepositoryLive,
14);
15​
16export const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(
17 Layer.provide(OrchestrationEventStoreLive),
18);
19​
20export const OrchestrationInfrastructureLayerLive = Layer.mergeAll(
21 OrchestrationProjectionSnapshotQueryLive,
22 OrchestrationEventInfrastructureLayerLive,
23 OrchestrationProjectionPipelineLayerLive,
24 // Shared background-liveness and plan-progress registries: written by
25 // runtime ingestion, read by the snapshot query. provideMerge feeds the
26 // same instance to the snapshot query here and re-exports it for runtime
27 // ingestion.
28).pipe(
29 Layer.provideMerge(ThreadBackgroundLiveness.layer),
30 Layer.provideMerge(ThreadPlanProgress.layer),
31);
32​
33export const OrchestrationLayerLive = Layer.mergeAll(
34 OrchestrationInfrastructureLayerLive,
35 OrchestrationEngineLive.pipe(Layer.provide(OrchestrationInfrastructureLayerLive)),
36);