Files
t3code/apps/server/src/orchestration/Services/ProjectionSnapshotQuery.ts
T

35 lines
1.1 KiB
TypeScript

/**
* ProjectionSnapshotQuery - Read-model snapshot query service interface.
*
* Exposes the current orchestration projection snapshot for read-only API
* access.
*
* @module ProjectionSnapshotQuery
*/
import type { OrchestrationReadModel } from "@t3tools/contracts";
import { ServiceMap } from "effect";
import type { Effect } from "effect";
import type { ProjectionRepositoryError } from "../../persistence/Errors.ts";
/**
* ProjectionSnapshotQueryShape - Service API for read-model snapshots.
*/
export interface ProjectionSnapshotQueryShape {
/**
* Read the latest orchestration projection snapshot.
*
* Rehydrates from projection tables and derives snapshot sequence from
* projector cursor state.
*/
readonly getSnapshot: () => Effect.Effect<OrchestrationReadModel, ProjectionRepositoryError>;
}
/**
* ProjectionSnapshotQuery - Service tag for projection snapshot queries.
*/
export class ProjectionSnapshotQuery extends ServiceMap.Service<
ProjectionSnapshotQuery,
ProjectionSnapshotQueryShape
>()("t3/orchestration/Services/ProjectionSnapshotQuery") {}