TypeScript
refactor(server): classify orchestration exports (#10275)
Julius Marminge0af04f1801ea
diff --git a/apps/server/src/orchestration/Errors.ts b/apps/server/src/orchestration/Errors.tsindex a0dd1d18eab..dccb8b4be0f 100644--- a/apps/server/src/orchestration/Errors.ts+++ b/apps/server/src/orchestration/Errors.ts@@ -126,13 +126,6 @@ export type OrchestrationEngineError =| OrchestrationCommandJsonParseError| OrchestrationCommandDecodeError;-export function toOrchestrationCommandDecodeError(error: Schema.SchemaError) {- return new OrchestrationCommandDecodeError({- issue: SchemaIssue.makeFormatterDefault()(error.issue),- cause: error,- });-}-export function toProjectorDecodeError(eventType: string) {return (error: Schema.SchemaError): OrchestrationProjectorDecodeError =>new OrchestrationProjectorDecodeError({@@ -141,19 +134,3 @@ export function toProjectorDecodeError(eventType: string) {cause: error,});}--export function toOrchestrationJsonParseError(cause: unknown) {- return new OrchestrationCommandJsonParseError({- detail: `Failed to parse orchestration command JSON`,- cause,- });-}--export function toListenerCallbackError(listener: "read-model" | "domain-event") {- return (cause: unknown): OrchestrationListenerCallbackError =>- new OrchestrationListenerCallbackError({- listener,- detail: `Failed to invoke orchestration ${listener} listener`,- cause,- });-}diff --git a/apps/server/src/orchestration/LiveStreamBudget.ts b/apps/server/src/orchestration/LiveStreamBudget.tsindex e86127b2b2d..5a3a08e7e4b 100644--- a/apps/server/src/orchestration/LiveStreamBudget.ts+++ b/apps/server/src/orchestration/LiveStreamBudget.ts@@ -6,8 +6,8 @@ import * as Exit from "effect/Exit";import * as Scope from "effect/Scope";import * as Stream from "effect/Stream";-export const LIVE_STREAM_MAX_ITEMS = 1_000;-export const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;+const LIVE_STREAM_MAX_ITEMS = 1_000;+const LIVE_STREAM_MAX_SERIALIZED_BYTES = 8 * 1024 * 1024;export interface RetainedLiveItem<A> {readonly value: A;diff --git a/apps/server/src/orchestration/ThreadPullRequestReactor.ts b/apps/server/src/orchestration/ThreadPullRequestReactor.tsindex 6e2aa0b3e05..b694bacbbb3 100644--- a/apps/server/src/orchestration/ThreadPullRequestReactor.ts+++ b/apps/server/src/orchestration/ThreadPullRequestReactor.ts@@ -77,6 +77,7 @@ export function pullRequestMatchesProject();}+/** @public Service construction is part of the canonical Effect module API. */export const make = Effect.gen(function* () {const engine = yield* OrchestrationEngine.OrchestrationEngineService;const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;diff --git a/apps/server/src/orchestration/ThreadSettlementPolicy.ts b/apps/server/src/orchestration/ThreadSettlementPolicy.tsindex 7c55fa37d1f..1df7855d1e0 100644--- a/apps/server/src/orchestration/ThreadSettlementPolicy.ts+++ b/apps/server/src/orchestration/ThreadSettlementPolicy.ts@@ -8,7 +8,7 @@ export interface SettlementPullRequest {}const DAY_MS = 24 * 60 * 60 * 1_000;-export const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000;+const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000;function latestTimestamp(values: ReadonlyArray<string | null | undefined>): string | null {let latest: string | null = null;diff --git a/apps/server/src/orchestration/ThreadSettlementReactor.ts b/apps/server/src/orchestration/ThreadSettlementReactor.tsindex 4830ec9d80e..d925df5d98f 100644--- a/apps/server/src/orchestration/ThreadSettlementReactor.ts+++ b/apps/server/src/orchestration/ThreadSettlementReactor.ts@@ -32,6 +32,7 @@ export class ThreadSettlementReactor extends Context.Service<}>()("t3/orchestration/ThreadSettlementReactor") {}+/** @public Service construction is part of the canonical Effect module API. */export const make = Effect.gen(function* () {const engine = yield* OrchestrationEngine.OrchestrationEngineService;const snapshots = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;diff --git a/apps/server/src/orchestration/commandInvariants.ts b/apps/server/src/orchestration/commandInvariants.tsindex 110a499d37c..873eab007be 100644--- a/apps/server/src/orchestration/commandInvariants.ts+++ b/apps/server/src/orchestration/commandInvariants.ts@@ -25,7 +25,7 @@ function findThreadById(return readModel.threads.find((thread) => thread.id === threadId);}-export function findProjectById(+function findProjectById(readModel: OrchestrationReadModel,projectId: ProjectId,): OrchestrationProject | undefined {diff --git a/apps/server/src/orchestration/runtimeLayer.ts b/apps/server/src/orchestration/runtimeLayer.tsindex 779042e2f68..ea02e5e2ebf 100644--- a/apps/server/src/orchestration/runtimeLayer.ts+++ b/apps/server/src/orchestration/runtimeLayer.ts@@ -8,16 +8,16 @@ import { OrchestrationProjectionSnapshotQueryLive } from "./Layers/ProjectionSnaimport * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts";import * as ThreadPlanProgress from "./ThreadPlanProgress.ts";-export const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(+const OrchestrationEventInfrastructureLayerLive = Layer.mergeAll(OrchestrationEventStoreLive,OrchestrationCommandReceiptRepositoryLive,);-export const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(+const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipelineLive.pipe(Layer.provide(OrchestrationEventStoreLive),);-export const OrchestrationInfrastructureLayerLive = Layer.mergeAll(+const OrchestrationInfrastructureLayerLive = Layer.mergeAll(OrchestrationProjectionSnapshotQueryLive,OrchestrationEventInfrastructureLayerLive,OrchestrationProjectionPipelineLayerLive,