/** * Publications ledger store accessors (T13362) — the store-backed replacement * for the deprecated `.cleo/docs-publications.json` sidecar. * * Every read/write of the docs publication ledger goes through this module on * the `openDualScopeDb` chokepoint's drizzle handle ({@link getDb}) — gate 3 * (no raw opens) and gate 28 (no raw SQL writes to the syncing * `docs_publications` table; the drizzle upsert compiles to the sanctioned * `INSERT … ON CONFLICT … DO UPDATE` form). * * Semantics: * * - Identity is NATURAL over (owner_id, blob_name, published_path): both * devices derive the same row uid for one triple, so a re-publish * coalesces onto one row (gate 37 declaration in * `row-identity-registry.ts`). * - {@link upsertDocsPublication} refreshes `last_blob_sha` / * `published_at` on conflict (latest-publish-wins); nothing is ever * DELETEd here. * - {@link readDocsPublications} carries a one-time, idempotent migration * shim: when the store table is empty and the legacy * `.cleo/docs-publications.json` still holds entries, they are seeded * into the table on first access. The shim is marked for follow-up in * T13362: once the JSON shim has shipped one release, drop the seed path. * * @module * @task T13362 * @epic T13340 * @saga T13339 */ import type { DocsPublicationRecord } from './docs-ops.js'; /** * Record (or refresh) one publication in the store ledger. * * Upserts on (ownerId, blobName, publishedPath). A conflicting row gets the * fresh `lastBlobSha`/`publishedAt` so the ledger always reflects the latest * known good publication; the row uid is the natural identity over the triple, * so a concurrent publish on another device coalesces onto the same row. * * @param projectRoot - Absolute path to the CLEO project root. * @param record - The publication facts; `publishedAt` is stamped here. */ export declare function upsertDocsPublication(projectRoot: string, record: Omit): Promise; /** * Read every publication row from the store ledger. * * Legacy shim (T13362 follow-up: remove one release after ship): when the * table is empty and `.cleo/docs-publications.json` still holds entries, the * entries are seeded idempotently (natural-key insert, `ON CONFLICT DO * NOTHING`) and a `.seeded` marker is written so the seed runs once. When the * table already holds rows they are authoritative and the JSON is ignored. * * @param projectRoot - Absolute path to the CLEO project root. * @returns All recorded publications (empty when none exist). */ export declare function readDocsPublications(projectRoot: string): Promise; /** * Read the set of blob SHA-256 hashes named by any publication row. * * Used by the attachment janitor so a published blob is never declared * unreferenced (and GC'd) while its publication lives. * * @param projectRoot - Absolute path to the CLEO project root. * @returns Distinct `last_blob_sha` values across all publications. */ export declare function readDocsPublicationSha256Set(projectRoot: string): Promise>; //# sourceMappingURL=publications-store.d.ts.map