/** * The run's filtered journal, as rows. * * Events arrive here already filtered. The secret gate wraps the stream that * feeds this adapter, so an event that reaches these statements has crossed it, * and a rejected or cancelled gate never gets this far. Nothing here filters a * second time: a second policy in a second place is a second thing to keep in * agreement with the first. * * What is stored is exactly what `serializeDurableEvent` produced, terminating * newline included, so the record a replay reads is the record the protocol * wrote rather than a re-encoding of it. Identity and order are separate * columns: the event id is opaque and stable once written, and the sequence is * a physical position this module orders by and never hands out. */ import type { DatabaseSync } from "node:sqlite"; import { type DurableEvent } from "@executablemd/durable-streams"; /** One retained event, the opaque id it keeps, and the root it was written against. */ export interface JournalEntry { readonly eventId: string; readonly event: DurableEvent; readonly workspaceRootId: string; } /** * Append one already-filtered event, and answer with the id it will keep. * * Insertion only. Whether this happens in a transaction of its own or inside * one a caller opened is decided above this function, which is what lets a * standalone append and an enlisted append share one statement. */ export declare function insertJournalEvent(database: DatabaseSync, event: DurableEvent, workspaceRootId?: string): string; /** Every retained event, in the order it was appended. */ export declare function readJournalEntries(database: DatabaseSync): JournalEntry[];