import type { AuraCanonicalAsset } from "./CanonicalAsset.js"; /** * On-disk schema tag. Bump when the persisted shape changes incompatibly so a * stale file can be detected (and, in future, migrated) rather than misread. */ export declare const INDEX_STORE_SCHEMA: "aura3d-asset-index/1"; /** * Persisted JSON shape of an {@link IndexStore}. * * - `watermarks` maps a source id to the opaque cursor returned by that * adapter's `fetchSince`, so the next refresh resumes incrementally. * - `assets` is the flat, de-duplicated canonical catalog keyed (logically) by * `id`; we store it as an array for stable, diff-friendly JSON. * - `updatedAt` is caller-supplied (never read from the wall clock here) to keep * the store deterministic and testable. */ export interface IndexStoreFile { readonly schema: typeof INDEX_STORE_SCHEMA; readonly updatedAt: string | null; readonly watermarks: Record; readonly assets: AuraCanonicalAsset[]; } /** * A file-backed JSON store of {@link AuraCanonicalAsset} records keyed by * canonical id, plus a per-source watermark map. * * This is the durable catalog the "live" cron writes into (via * {@link refreshIndex}) and the resolver reads out of. It is intentionally * deterministic: it never reads wall-clock time or randomness internally. The * caller threads an `updatedAt` string into {@link save} when one is wanted. */ export declare class IndexStore { private readonly path; /** id -> canonical asset (last write wins on upsert). */ private readonly assets; private readonly watermarks; private updatedAt; private constructor(); /** * Load a store from `path`. A missing file is tolerated and yields an empty * store (the cron's first run). A present-but-corrupt file throws so the * problem is surfaced rather than silently discarded. */ static load(path: string): Promise; /** * Insert or replace many records from one source, de-duping by canonical id * with last-write-wins semantics. The `source` argument is accepted for call * symmetry with the watermark API and to document provenance at the call * site; the canonical id already namespaces the source. */ upsertMany(_source: string, assets: Iterable): void; /** The last watermark recorded for `source`, or `null` if never refreshed. */ getWatermark(source: string): string | null; /** Record the next watermark for `source`. */ setWatermark(source: string, watermark: string): void; /** All canonical assets currently held, in stable insertion order. */ all(): AuraCanonicalAsset[]; /** * Atomically persist the store: serialize, write to a sibling temp file, then * `rename` over the real path so a reader never sees a half-written file. * * `updatedAt` is caller-supplied to keep the store deterministic; when * omitted the previously loaded/saved value is preserved. */ save(updatedAt?: string): Promise; } //# sourceMappingURL=IndexStore.d.ts.map