Review an event-sourced account projection

src/account-event-types.tsTypeScript
@@ -0,0 +1,24 @@
1+export interface AccountEvent {
2+ eventId: string;
3+ offset: string;
4+ accountId: string;
5+ sequence: number;
6+ type: "account-opened" | "money-deposited";
7+ amountCents?: number;
8+}
9+
10+export interface AccountProjectionRow {
11+ accountId: string;
12+ sequence: number;
13+ balanceDollars: number;
14+}
15+
16+export interface ProjectionStore {
17+ checkpoint(name: string): Promise<string | undefined>;
18+ saveCheckpoint(name: string, offset: string): Promise<void>;
19+ get(name: string, accountId: string): Promise<AccountProjectionRow | undefined>;
20+ put(name: string, row: AccountProjectionRow): Promise<void>;
21+ clear(name: string): Promise<void>;
22+ swap(source: string, destination: string): Promise<void>;
23+ quarantine(event: AccountEvent, error: unknown): Promise<void>;
24+}