import type { StoreEvent, VersionStatus } from './store-types.js'; export interface DecisionRecord { decision: 'accept' | 'reject'; reason?: string; by: string; at: string; seq: number; } export interface VersionRecord { version: number; seq: number; at: string; by: string; contract_revision: string; body_sha256: string; bytes: number; supersedes?: number; note?: string; /** Consuming sections that decide this version, pinned at publish. */ consumers: string[]; decisions: Record; /** Reads per role (work, review, audit and revision alike): count and the sequence of the first one. */ reads: Record; } export interface DocRecord { id: string; type: string; section: string; producer: string; versions: VersionRecord[]; /** Sequence of the latest state change (a publish or a decision): what `expected_state_seq` compares with. */ last_seq: number; /** Committed rejections per consuming section: unique rounds, never duplicate calls. */ rework: Record; } export interface TypeCounters { /** Documents issued so far for the type (the next id is `-`). */ docs: number; /** Counted publish refusals, by contract revision: a changed revision starts a fresh count. */ attempts: Record; /** Counted consistency refusals, by contract revision. */ consistency: Record; } export interface IdemEntry { sha: string; kind: 'publish' | 'decide'; doc: string; version: number; seq: number; consumer?: string; decision?: 'accept' | 'reject'; status?: VersionStatus; waiting_on?: string[]; } export interface DocState { seq: number; types: Record; docs: Record; /** `` (`publish::` or `decide::`) to the committed outcome. */ idem: Record; } export declare class ReplayError extends Error { readonly seq: number; constructor(seq: number, message: string); } export declare const emptyState: () => DocState; export declare const headOf: (d: DocRecord) => VersionRecord; /** pending, accepted (every pinned consumer accepted), rejected (any consumer rejected) or superseded (not the head). */ export declare function versionStatus(d: DocRecord, v: VersionRecord): VersionStatus; /** Consuming sections that have not decided the version yet; empty once it is no longer pending. */ export declare const waitingOn: (d: DocRecord, v: VersionRecord) => string[]; /** Apply one event to `s` in place. Throws ReplayError when the event contradicts the state. */ export declare function applyEvent(s: DocState, e: StoreEvent): void; //# sourceMappingURL=state.d.ts.map