Library.open with a transparent background refresh (closes #42)
check / check (push) Successful in 24s

Library.open loads metadata.json and serves reads from RAM: an empty cache awaits the first refresh, an existing cache returns at once and refreshes in the background so an unreachable server never stalls open(). A background timer refreshes every refreshIntervalSeconds (default 3), diffing only changed albums via the resumable cursor+tombstone enumerators and rewriting metadata.json only when something changed. A refresh failure is invisible to reads and surfaced via status()/onProgress; a failed save keeps status().lastError set and retries until one lands, so a stale disk is never masked. No sync()/refresh()/serverReachable surface; status() and close() included.

Model: opus-4-8
This commit was merged in pull request #60.
This commit is contained in:
2026-09-22 14:52:02 +02:00
parent 4b4f550f89
commit 7570055a5b
4 changed files with 1001 additions and 0 deletions
+9
View File
@@ -33,6 +33,15 @@ export {
requestEmailOTP,
submitEmailOTP,
} from "./auth/login.js";
export {
Library,
DEFAULT_REFRESH_INTERVAL_SECONDS,
type LibraryClient,
type LibraryOptions,
type LibraryStatus,
type RefreshEvent,
type RefreshProgressCallback,
} from "./library/index.js";
export { decryptCollection, decryptFile } from "./model/index.js";
export { downloadFile, downloadThumbnail } from "./download/index.js";
export type {