/** * Canonical SQLite helpers used by mapped entity lifecycle writes. * * These functions validate row bindings and revision contracts before the * storage commit helper mutates canonical state and appends projection effects. */ import { type CanonicalCommitInput } from "../../../storage/state/canonical/canonicalCommit.js"; import type { FencingContext } from "@hikoutei/ikisaki"; import type { SqlExecutor } from "../../../contracts/storage/sql.js"; import type { TypedSheetsEntityMapping } from "../../mapping/entityMapping.js"; /** Result of preparing a mapped create's row binding. */ export type CreateRowBindingResult = { readonly kind: "created"; } | { readonly kind: "reactivated"; }; /** * Prepares the active row binding used by both physical projections for a * mapped create. * * A fresh ID gets an ordinary active binding. A recreate reusing the exact * tombstoned identity (same logical sheet, deterministic anchor, binding, and * canonical entity ID) CAS-reactivates only the state, preserving the row's * candidate epoch and physical identity. Any other existing binding, or an * identity mismatch, stays a structured row-binding conflict. */ export declare function createRowBinding(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, rowBindingId: string, entityId: string, anchor: string): Promise; /** Reads an existing binding's canonical identity for legacy-compatible updates. */ export declare function existingCanonicalEntityId(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, rowBindingId: string, anchor: string): Promise; /** Requires the active binding to still match the mapped entity identity. */ export declare function requireActiveRowBinding(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, rowBindingId: string, entityId: string, anchor: string): Promise; /** Reads the current active canonical entity revision for an update or delete. */ export declare function requireActiveCanonicalEntityRevision(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, entityId: string): Promise; /** Reads the tombstoned canonical entity revision that a reactivation must advance. */ export declare function requireTombstonedCanonicalEntityRevision(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, entityId: string): Promise; /** Returns canonical field revisions indexed by field name for update CAS. */ export declare function canonicalFieldRevisions(sql: SqlExecutor, entityId: string): Promise>; /** Applies a canonical commit or translates its stable result into an ORM error. */ export declare function requireAppliedCanonicalCommit(sql: SqlExecutor, fence: FencingContext, commit: CanonicalCommitInput): Promise; /** Tombstones a mapped row binding after the canonical delete has committed. */ export declare function tombstoneActiveRowBinding(sql: SqlExecutor, mapping: TypedSheetsEntityMapping, rowBindingId: string, entityId: string): Promise; //# sourceMappingURL=canonicalState.d.ts.map