/** * Foreign keys between sync-set tables, as the apply sees them (T12344 * PR-4; journal spec §3.2 "FK actions", R5-7). * * Read-only: from `PRAGMA foreign_key_list`. Only sync-set children count: * local-only and derived children cascade locally as SQLite does, and nothing * about them is replicated. * * @module store/sync/apply/fk * @task T12344 */ import type { DatabaseSync } from 'node:sqlite'; import type { TableScope } from '@cleocode/contracts'; /** One sync-set child foreign key onto a parent table. */ export interface ChildKey { /** The child table. */ readonly child: string; /** The child's referencing column. */ readonly from: string; /** The parent's referenced column. */ readonly to: string; /** `ON DELETE` action, upper-case (`CASCADE`, `SET NULL`, `RESTRICT`, `NO ACTION` …). */ readonly onDelete: string; } /** * Every sync-set table's sync-set children, by parent table. * * @param db - The store. * @param scope - The store's scope. * @returns Parent table → its children's foreign keys. */ export declare function syncSetChildKeys(db: DatabaseSync, scope: TableScope): ReadonlyMap; /** * Every child foreign key OUTSIDE the sync set whose `ON DELETE` action a * parent DELETE fires (`CASCADE`, `SET NULL`, `SET DEFAULT`), by parent * table (any table). Capture never records these children, so the stream * cannot bring back what such an action removes; a rebase rewind snapshots * them before it deletes a row it will replay (§3.5 R7-2, T13267). * Journal tables (`_sync_*`) and the trigger-suspend flag table are not * children. Composite keys are listed once per column pair. * * @param db - The store. * @param scope - The store's scope. * @returns Parent table → its local children's foreign keys. */ export declare function localChildKeys(db: DatabaseSync, scope: TableScope): ReadonlyMap; //# sourceMappingURL=fk.d.ts.map