/** * Turning stored rows back into records. * * The database's CHECK constraints hold the shapes it was given, and a file on * disk can still be edited by anything with write access. So a row is parsed * exactly as a caller's argument is: every column is checked, and the record is * rebuilt from the checked columns rather than handed on because its shape * looked right. * * A failure names the column and never the value. Props and journal payloads * are retained history, and a row that does not parse is not a reason to print * what it held. */ import { type WorkflowDefinition } from "../storage/definition.js"; import { type DefinitionRetrieval, type DocumentExecutionRecord, type WorkflowRunRecord, type WorkflowStopReason } from "../storage/record.js"; import type { WorkflowSchemaVersion } from "./schema.js"; /** One row as SQLite hands it back. */ export type Row = Record; /** The three columns a stop reason occupies. */ export interface StopReasonColumns { readonly kind: string | null; readonly code: string | null; readonly eventId: string | null; } /** The stop reason three columns describe, or none when they are all empty. */ export declare function readStopReason(row: Row, table: string): WorkflowStopReason | undefined; /** The three column values a stop reason binds to. */ export declare function stopReasonColumns(reason: WorkflowStopReason | undefined): StopReasonColumns; /** The definition a stored column describes. */ export declare function readDefinition(row: Row, table: string): WorkflowDefinition; /** * The run the singleton row describes, read as the version it was recognized * at. * * The version is the one structural recognition just proved rather than one * inferred from the descriptor the row happens to hold: a version-1 table * carrying a source-bundle descriptor is a file disagreeing with itself, and * reading it as a version-2 record would quietly drop the `base` column that * table still has. */ export declare function readRunRecord(row: Row, version?: WorkflowSchemaVersion): WorkflowRunRecord; /** The retrieval metadata the singleton row describes. */ export declare function readRetrieval(row: Row): DefinitionRetrieval; /** The document execution one ordered row describes. */ export declare function readDocumentExecution(row: Row): DocumentExecutionRecord;