import type { LwwFields } from '../sync/lww.js'; import type { LocalStore } from './localStore.js'; import type { WasRemoteStore } from './wasRemoteStore.js'; /** * Installs the opened store (called once by the app bootstrap). * * @param store {LocalStore} * @returns {void} */ export declare function setLocalStore(store: LocalStore): void; /** * The opened store, or throws if the app has not bootstrapped yet. * * @returns {LocalStore} */ export declare function requireStore(): LocalStore; /** * Whether the store has been opened. * * @returns {boolean} */ export declare function hasStore(): boolean; /** * Releases the held store reference (logout; the caller closes the db). * * @returns {void} */ export declare function clearLocalStore(): void; /** * Installs the per-session delegated remote store (set once background sync * has bootstrapped it from the granted zcaps). * * @param store {WasRemoteStore} * @returns {void} */ export declare function setRemoteStore(store: WasRemoteStore): void; /** * The connected session's remote store, or throws while no wallet-connected * session is active (local-only mode, or sync has not bootstrapped yet). * * @returns {WasRemoteStore} */ export declare function requireRemoteStore(): WasRemoteStore; /** * Whether a connected session's remote store is available. * * @returns {boolean} */ export declare function hasRemoteStore(): boolean; /** * Releases the held remote store reference (logout / sync teardown). * * @returns {void} */ export declare function clearRemoteStore(): void; /** * A stable per-install writer id (the last-write-wins tiebreak stamped into * every payload), persisted in localStorage under `writerId`. In an * environment without `localStorage` it falls back to a process-stable * unpersisted id instead of throwing. * * The id is an unkeyed, clearable attribution label -- never an identity. On a * miss it adopts a value left under the pre-rename `clientId` key and * removes the old one, so an existing install keeps stamping the same id * across the rename rather than looking like a second writer. * * @param [options] {object} * @param [options.storageKeyPrefix] {string} the localStorage key prefix * (defaults to {@link DEFAULT_STORAGE_KEY_PREFIX}) * @returns {string} */ export declare function getWriterId({ storageKeyPrefix }?: { storageKeyPrefix?: string; }): string; /** * Installs the session's resolved writer id (called once by the session store, * under the app's configured `storageKeyPrefix`, before any replica opens). * * @param id {string} * @returns {void} */ export declare function setWriterId(id: string): void; /** * The session's resolved writer id, or throws if it has not been installed * yet. Deliberately never falls back to {@link getWriterId}: that would resolve * under the DEFAULT key prefix, so an app with a custom `storageKeyPrefix` * would silently stamp a second writer id. * * @returns {string} */ export declare function requireWriterId(): string; /** * Stamps a payload with fresh last-write-wins fields: the current instant as * `updatedAt` and the session's resolved writer id. Any values the caller * supplied are overwritten -- a stamp must describe THIS write, or a hydrated * doc's older `updatedAt` would ride a later edit and lose the conflict. * * @param payload {object} * @returns {object} the payload with the LWW fields set */ export declare function stampLww(payload: T): T & LwwFields; //# sourceMappingURL=storageManager.d.ts.map