/** * Canonical-state and conflict-ledger mutations for one observed row. * * Every exported operation assumes its caller already holds the writer fence * and is inside the observation writer's immediate transaction. */ import type { ObservedRowChange } from "../../../contracts/domain/model/types.js"; import type { Presence } from "../../../contracts/state/types.js"; import type { RowEvaluationResult } from "../../../contracts/domain/evaluate/contracts.js"; import type { RowOutcome } from "../../../contracts/domain/evaluate/constants.js"; import { ROW_OUTCOMES } from "../../../contracts/domain/evaluate/constants.js"; import type { SqlExecutor } from "../../../contracts/storage/sql.js"; import type { FencingContext } from "@hikoutei/ikisaki"; import { type AppliedCanonicalCommit, type PersistObservedRowInput, type RowBindingRow } from "./observationTypes.js"; declare const CONFIRM_OBSERVED_VISIBLE_STATE_SQL = "\n INSERT INTO sheet_visible_state (\n physical_sheet_id, projection, row_binding_id, confirmed_snapshot_hash,\n confirmed_visible_revision, confirmed_entity_revision, last_observed_hash\n ) VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT(physical_sheet_id, projection, row_binding_id)\n DO UPDATE SET\n confirmed_snapshot_hash = excluded.confirmed_snapshot_hash,\n confirmed_visible_revision = excluded.confirmed_visible_revision,\n confirmed_entity_revision = excluded.confirmed_entity_revision,\n last_observed_hash = excluded.last_observed_hash\n WHERE sheet_visible_state.confirmed_visible_revision <= excluded.confirmed_visible_revision\n"; /** Exported for the adoption seeding engine (same upsert, one transaction). */ export { CONFIRM_OBSERVED_VISIBLE_STATE_SQL }; type PersistedRowOutcome = Exclude; /** * Applies canonical state and related binding/key/conflict changes through * the active async SQL transaction. */ export declare function applyCanonicalMutationWithSql(sql: SqlExecutor, fence: FencingContext, input: PersistObservedRowInput, row: ObservedRowChange, binding: RowBindingRow): Promise>; /** Rejects synthetic evidence when the exact baseline read by polling changed. */ export declare function assertObservedProjectionBaselineWithSql(sql: SqlExecutor, input: PersistObservedRowInput, row: ObservedRowChange): Promise; /** * Advances the confirmed visible baseline after an accepted observation. * * Without this confirmation, the next User_Input edit appears older than the * canonical entity revision and is forced into a false conflict. Candidate * columns are deliberately preserved; only accepted observed fields advance. */ export declare function confirmObservedProjectionWithSql(sql: SqlExecutor, input: PersistObservedRowInput, row: ObservedRowChange, entityRevision: number): Promise; /** Writes new field candidates through the active async SQL transaction. */ export declare function persistConflictAttemptsWithSql(sql: SqlExecutor, input: PersistObservedRowInput, row: ObservedRowChange, binding: RowBindingRow, eventId: string): Promise; /** Rejects an impossible persistence result before it becomes public output. */ export declare function requirePersistedOutcome(evaluation: RowEvaluationResult): PersistedRowOutcome; //# sourceMappingURL=observationCanonical.d.ts.map