/** Tables. Four, and the vocabulary is the vault's: nodes, edges, rows, cites. */ export declare const SCHEMA: string[]; /** Indexes and the full-text table, applied AFTER the bulk insert — building * them once at the end is markedly cheaper than maintaining them per row. */ export declare const INDEXES: string[]; export declare const INSERT: { readonly vec: "INSERT OR REPLACE INTO vec (id, kind, model, dims, v) VALUES (?, ?, ?, ?, ?)"; readonly node: "INSERT OR REPLACE INTO node (id, kind, label, type, domain) VALUES (?, ?, ?, ?, ?)"; readonly edge: "INSERT INTO edge (src, dst, rel, label) VALUES (?, ?, ?, ?)"; readonly row: "INSERT OR REPLACE INTO row_ (id, node, block, key, state, text) VALUES (?, ?, ?, ?, ?, ?)"; readonly cite: "INSERT INTO cite (row, uri, resolved) VALUES (?, ?, ?)"; }; /** Dropping is how an update happens: the projection is derived, so a rebuild * is always correct and never needs a migration. */ export declare const RESET: string[]; /** A double-quoted SQL identifier. Anything may be quoted; only a quote itself * needs escaping, by doubling, which is SQL's own rule. */ export declare const ident: (name: string) => string; export interface TypedColumn { /** the definition's own key — a column key, `id`, or the declared identity */ key: string; /** REAL for a column the format declares `type: number`; TEXT otherwise. * A `date` is TEXT because lexical order over YYYY-MM-DD is chronological. */ affinity: 'REAL' | 'TEXT'; } export interface TypedTable { /** the block this table projects */ block: string; /** `rec_`, unquoted — quote it with `ident` at the point of use */ table: string; columns: TypedColumn[]; /** DROP then CREATE: the shape follows the format, so it is re-derived rather * than altered. A format edit reshapes the table on the next rebuild. */ drop: string; ddl: string; /** parameterised insert, columns in `columns` order */ insert: string; } /** Every block's table, derived from the compiled definition. Pure. */ export declare function typedTablesFor(def: { blocks: Record; }): TypedTable[]; /** Tables this projection owns but the current format no longer declares. A * lingering one is worse than an absent one: still queryable, no longer * maintained by any rebuild — stale data that lies quietly, where a missing * table fails loudly. */ export declare const STALE_TYPED_TABLES = "SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE 'rec\\_%' ESCAPE '\\'"; export interface QueryDef { /** what it answers */ about: string; /** bound parameters, in order */ params: string[]; sql: string; } /** * The query library. * * Every walk below uses `UNION` — not `UNION ALL` — so the frontier is * deduplicated and each node is expanded once. This is the single most * important line in the file: measured on the reference vault, the same * shortest-path walk written with `UNION ALL` and an accumulated path string * takes 1,832 ms; deduped it takes 3.8 ms. Reconstruct a route in a second * pass, never inside the walk. */ export declare const QUERIES: Record; /** Names a host can offer without hand-writing SQL. */ export declare const QUERY_NAMES: string[];