import type { Repository } from "@stapel/core"; import type { CategorySnapshot } from "../catalog/sync.js"; /** The repository namespace. Changing it orphans every stored snapshot, which * is the intended migration for a shape change too large for `version`. */ export declare const CATALOG_NAMESPACE = "categories.catalog"; /** The single key inside that namespace. */ export declare const CATALOG_KEY = "snapshot"; /** Read / write the catalogue snapshot, with every failure mode absorbed. */ export interface CatalogStore { load(): Promise; save(snapshot: CategorySnapshot): Promise; clear(): Promise; } export interface CreateCatalogStoreOptions { /** Inject a repository (tests, SSR, a host with its own backend). Default: * an app-scoped repository under {@link CATALOG_NAMESPACE}. */ readonly repository?: Repository; /** * Called when no storage backend could be created and the catalogue will * run UNPERSISTED โ€” a full re-download on every page load. Default: one * `console.warn` (see {@link UNPERSISTED_WARNING}). Pass `() => undefined` * to accept the degradation deliberately and silence it. */ readonly onUnpersisted?: (error: unknown) => void; } /** * What the default `onUnpersisted` prints. A silent fallback to an in-memory * store is the ยง83 shape: the page still works, so nobody reports it, and the * whole catalogue is fetched again on every navigation forever. Naming it in * the console is the minimum โ€” the person who can fix it is the one looking * at that console. */ export declare const UNPERSISTED_WARNING: string; /** A store that remembers nothing โ€” the honest fallback when persistence is * unavailable, and what a caller passes to opt out of caching entirely. */ export declare function memoryCatalogStore(): CatalogStore; export declare function createCatalogStore(options?: CreateCatalogStoreOptions): CatalogStore; //# sourceMappingURL=catalogStore.d.ts.map