| author | |
| committer | |
| log | 0af04f1801ea75119c74fd406ced7da6c9c71721 |
| tree | 3a4a30d46891c64ad9b26d0fee23e9675a346574 |
| parent | 6f4cd07b900299629b9f2f9a9336f5c090556a51 |
| signature | Signed by PGP key B5690EEEBB952194 |
7 files changed, 9 insertions(+), 30 deletions(-)
apps/server/src/orchestration/Errors.ts-23| ... | @@ -126,13 +126,6 @@ export type OrchestrationEngineError = | ... | @@ -126,13 +126,6 @@ export type OrchestrationEngineError = |
| 126 | | OrchestrationCommandJsonParseError | 126 | | OrchestrationCommandJsonParseError |
| 127 | | OrchestrationCommandDecodeError; | 127 | | OrchestrationCommandDecodeError; |
| 128 | 128 | ||
| 129 | export function toOrchestrationCommandDecodeError(error: Schema.SchemaError) { | ||
| 130 | return new OrchestrationCommandDecodeError({ | ||
| 131 | issue: SchemaIssue.makeFormatterDefault()(error.issue), | ||
| 132 | cause: error, | ||
| 133 | }); | ||
| 134 | } | ||
| 135 | |||
| 136 | export function toProjectorDecodeError(eventType: string) { | 129 | export function toProjectorDecodeError(eventType: string) { |
| 137 | return (error: Schema.SchemaError): OrchestrationProjectorDecodeError => | 130 | return (error: Schema.SchemaError): OrchestrationProjectorDecodeError => |
| 138 | new OrchestrationProjectorDecodeError({ | 131 | new OrchestrationProjectorDecodeError({ |
| ... | @@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) { | ... | @@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) { |
| 141 | cause: error, | 134 | cause: error, |
| 142 | }); | 135 | }); |
| 143 | } | 136 | } |
| 144 | |||
| 145 | export function toOrchestrationJsonParseError(cause: unknown) { | ||
| 146 | return new OrchestrationCommandJsonParseError({ | ||
| 147 | detail: `Failed to parse orchestration command JSON`, | ||
| 148 | cause, | ||
| 149 | }); | ||
| 150 | } | ||
| 151 | |||
| 152 | export function toListenerCallbackError(listener: "read-model" | "domain-event") { | ||
| 153 | return (cause: unknown): OrchestrationListenerCallbackError => | ||
| 154 | new OrchestrationListenerCallbackError({ | ||
| 155 | listener, | ||
| 156 | detail: `Failed to invoke orchestration ${listener} listener`, | ||
| 157 | cause, | ||
| 158 | }); | ||
| 159 | } |
apps/server/src/orchestration/LiveStreamBudget.ts+2-2| ... | @@ -6,8 +6,8 @@ import * as Exit from "effect/Exit"; | ... | @@ -6,8 +6,8 @@ import * as Exit from "effect/Exit"; |
| 6 | import * as Scope from "effect/Scope"; | 6 | import * as Scope from "effect/Scope"; |
| 7 | import * as Stream from "effect/Stream"; | 7 | import * as Stream from "effect/Stream"; |
| 8 | 8 | ||
| 9 | export const LIVE_STREAM_MAX_ITEMS = 1_000; | 9 | const LIVE_STREAM_MAX_ITEMS = 1_000; |
| 10 | export const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024; | 10 | const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024; |
| 11 | 11 | ||
| 12 | export interface RetainedLiveItem<A> { | 12 | export interface RetainedLiveItem<A> { |
| 13 | readonly value: A; | 13 | readonly value: A; |
apps/server/src/orchestration/ThreadPullRequestReactor.ts+1| ... | @@ -77,6 +77,7 @@ export function pullRequestMatchesProject( | ... | @@ -77,6 +77,7 @@ export function pullRequestMatchesProject( |
| 77 | ); | 77 | ); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 80 | export const make = Effect.gen(function* () { | 81 | export const make = Effect.gen(function* () { |
| 81 | const engine = yield* OrchestrationEngine.OrchestrationEngineService; | 82 | const engine = yield* OrchestrationEngine.OrchestrationEngineService; |
| 82 | const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery; | 83 | const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery; |
apps/server/src/orchestration/ThreadSettlementPolicy.ts+1-1| ... | @@ -8,7 +8,7 @@ export interface SettlementPullRequest { | ... | @@ -8,7 +8,7 @@ export interface SettlementPullRequest { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | const DAY_MS = 24 * 60 * 60 * 1_000; | 10 | const DAY_MS = 24 * 60 * 60 * 1_000; |
| 11 | export const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000; | 11 | const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000; |
| 12 | 12 | ||
| 13 | function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null { | 13 | function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null { |
| 14 | let latest: string | null = null; | 14 | let latest: string | null = null; |
apps/server/src/orchestration/ThreadSettlementReactor.ts+1| ... | @@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service< | ... | @@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service< |
| 32 | } | 32 | } |
| 33 | >()("t3/orchestration/ThreadSettlementReactor") {} | 33 | >()("t3/orchestration/ThreadSettlementReactor") {} |
| 34 | 34 | ||
| 35 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 35 | export const make = Effect.gen(function* () { | 36 | export const make = Effect.gen(function* () { |
| 36 | const engine = yield* OrchestrationEngine.OrchestrationEngineService; | 37 | const engine = yield* OrchestrationEngine.OrchestrationEngineService; |
| 37 | const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery; | 38 | const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery; |
apps/server/src/orchestration/commandInvariants.ts+1-1| ... | @@ -25,7 +25,7 @@ function findThreadById( | ... | @@ -25,7 +25,7 @@ function findThreadById( |
| 25 | return readModel.threads.find((thread) => thread.id === threadId); | 25 | return readModel.threads.find((thread) => thread.id === threadId); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | export function findProjectById( | 28 | function findProjectById( |
| 29 | readModel: OrchestrationReadModel, | 29 | readModel: OrchestrationReadModel, |
| 30 | projectId: ProjectId, | 30 | projectId: ProjectId, |
| 31 | ): OrchestrationProject | undefined { | 31 | ): OrchestrationProject | undefined { |
apps/server/src/orchestration/runtimeLayer.ts+3-3| ... | @@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSna | ... | @@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSna |
| 8 | import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts"; | 8 | import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts"; |
| 9 | import * as ThreadPlanProgress from "./ThreadPlanProgress.ts"; | 9 | import * as ThreadPlanProgress from "./ThreadPlanProgress.ts"; |
| 10 | 10 | ||
| 11 | export const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll( | 11 | const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll( |
| 12 | OrchestrationEventStoreLive, | 12 | OrchestrationEventStoreLive, |
| 13 | OrchestrationCommandReceiptRepositoryLive, | 13 | OrchestrationCommandReceiptRepositoryLive, |
| 14 | ); | 14 | ); |
| 15 | 15 | ||
| 16 | export const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe( | 16 | const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe( |
| 17 | Layer.provide(OrchestrationEventStoreLive), | 17 | Layer.provide(OrchestrationEventStoreLive), |
| 18 | ); | 18 | ); |
| 19 | 19 | ||
| 20 | export const OrchestrationInfrastructureLayerLive = Layer.mergeAll( | 20 | const OrchestrationInfrastructureLayerLive = Layer.mergeAll( |
| 21 | OrchestrationProjectionSnapshotQueryLive, | 21 | OrchestrationProjectionSnapshotQueryLive, |
| 22 | OrchestrationEventInfrastructureLayerLive, | 22 | OrchestrationEventInfrastructureLayerLive, |
| 23 | OrchestrationProjectionPipelineLayerLive, | 23 | OrchestrationProjectionPipelineLayerLive, |