/** * Uniform timestamp format (journal spec §1.8, R3, M4; T12986, S3c). * * - {@link canonicalStoreTimestamp}: the strict, pure canonicalizer. Accepts * ISO-8601 with `Z` or an explicit `±hh:mm` offset (any fractional * precision) and SQLite's `YYYY-MM-DD HH:MM:SS[.fff]` UTC form; refuses * zoneless `T` forms, date-only values and anything else. * - {@link SYNC_TIMESTAMP_COLUMNS}: the captured timestamp columns per table. * - {@link canonicalizeStoreTimestamps}: the one-time rewrite under the * `timestamp_canon_v1` marker, run before the capture triggers go in. It * never touches `tasks_tasks.updated_at` (the #1698 CAS token) and is * refused once `row_identity_synced` exists. * * After genesis the sealer canonicalizes on the wire only; local rows are * never rewritten there. * * @module store/sync/timestamps * @task T12986 * @epic T12323 */ import type { DatabaseSync } from 'node:sqlite'; import type { TableScope } from '@cleocode/contracts'; export { CANON_EXCLUDED_COLUMNS, canonicalStoreTimestamp, SYNC_TIMESTAMP_COLUMNS, timestampColumns, } from './timestamp-canon.js'; /** Marker key in `tasks_row_identity_meta` once the rewrite has run. */ export declare const TIMESTAMP_CANON_MARKER = "timestamp_canon_v1"; /** Per `table.column`, how many rows. */ export type ColumnCounts = Readonly>; /** What {@link canonicalizeStoreTimestamps} did. */ export type TimestampCanonReport = { readonly status: 'done'; /** Rows rewritten to the canonical form. */ readonly rewritten: ColumnCounts; /** Rows left as they are: refused by the canonicalizer (`timestamp_ambiguous`). */ readonly ambiguous: ColumnCounts; } | { readonly status: 'already'; } | { readonly status: 'skipped'; readonly reason: string; } | { readonly status: 'refused'; readonly reason: string; }; /** * Rows whose timestamp the canonicalizer refuses, per `table.column`: the * doctor's `timestamp_ambiguous` finding. Read-only. */ export declare function ambiguousTimestamps(db: DatabaseSync, scope: TableScope): ColumnCounts; /** * The one-time rewrite (§1.8): every accepted legacy value in * {@link SYNC_TIMESTAMP_COLUMNS}, except {@link CANON_EXCLUDED_COLUMNS}, * becomes canonical. Refused values stay as they are and are counted. * * - Runs once per store: the {@link TIMESTAMP_CANON_MARKER} row records it. * - Refused once `row_identity_synced` exists: values have left the device. * - Runs in one `BEGIN IMMEDIATE` (or the caller's transaction) with the * capture and side-effect triggers suspended, so nothing is captured and * no trigger reacts. Guards stay on; canonical values satisfy them. * - Deterministic: each distinct value maps through the pure canonicalizer, * so two copies of a store agree. */ export declare function canonicalizeStoreTimestamps(db: DatabaseSync, scope: TableScope): TimestampCanonReport; //# sourceMappingURL=timestamps.d.ts.map