import type { EventLog } from './events.js'; import type { DocRecord, DocState } from './state.js'; import type { ProblemView, ReadResult, Refusal, StoreErrorCode, StoreEvent, StoreGuard, TypeBinding } from './store-types.js'; import type { DocContract } from './types.js'; /** A document type as the store holds it: the binding, the resolved contract and its pinned revision. */ export interface Bound { binding: TypeBinding; contract: DocContract; revision: string; } export interface Attempts { used: number; left: number; refusals_used: number; refusals_left: number; } /** What publish and decide may use of the store. Internal: the class implements it, nothing else should. */ export interface StoreCtx { readonly run: string; readonly bound: Map; readonly state: DocState; readonly guards: StoreGuard[]; readonly badBodies: Map; bodyPath(d: Pick, version: number): string; commit(body: Parameters[0]): StoreEvent; attempts(type: string): Attempts | undefined; peek(id: string, version?: number): ReadResult | Refusal; counted(op: 'publish' | 'decide', role: string, x: Bound, code: StoreErrorCode, message: string, counts: 'attempt' | 'consistency', problems?: ProblemView[], at?: { doc?: string; version?: number; }, guard_code?: string): Refusal; } export declare const validRole: (r: unknown) => r is string; export declare const validKey: (k: unknown) => k is string; /** Own-property lookup, so an id such as `__proto__` is never found on the prototype. */ export declare const own: (o: Record, k: string) => T | undefined; export declare const fail: (code: StoreErrorCode, message: string, extra?: Partial) => Refusal; export declare const problemText: (p: ProblemView) => string; export declare const ROLE_REFUSAL: () => Refusal; export declare const KEY_REFUSAL: () => Refusal; /** Validate a binding and resolve its contract; throws (a configuration error, found at construction). */ export declare function bindType(b: TypeBinding, known: Map): Bound; //# sourceMappingURL=store-common.d.ts.map