cry-synced-db-client 0.1.193 → 0.1.194

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## 0.1.192 (2026-05-25)
3
+ ## 0.1.193 (2026-05-25)
4
4
 
5
5
  Adds per-collection preload status reporting (non-breaking, additive).
6
6
 
@@ -11,10 +11,12 @@ New synchronous getter `getPreloadStatus(): PreloadStatus` and config callback
11
11
  (non-`writeOnly`), in-scope collection:
12
12
 
13
13
  - Per-collection `state` (`pending` / `hydrated` / `failed`), `itemCount`,
14
- `lastError`, `everDownloaded`, and a derived `ready` flag
15
- (`ready = hydrated && (itemCount > 0 || everDownloaded)` a hydrated-but-empty
16
- collection that was never downloaded is **not** ready, so a fresh device
17
- doesn't report "full" before its first server sync).
14
+ `lastError`, `everDownloaded` (informational), and a derived `ready` flag
15
+ (`ready = (state === "hydrated")` the local cache is loaded into in-mem;
16
+ empty is valid). Data *freshness* is a separate, global concern
17
+ (`lastSuccessfulServerSync`), deliberately **not** folded into `ready`:
18
+ gating on a per-collection cursor wedged the aggregate at `partial` for
19
+ genuinely-empty, never-synced collections (every tenant has several).
18
20
  - Rolled-up `aggregate`: `idle` / `full` / `partial` / `failed`.
19
21
 
20
22
  The callback fires on each hydration transition (success/failure), on scope
package/dist/index.js CHANGED
@@ -6971,7 +6971,7 @@ var _SyncedDb = class _SyncedDb {
6971
6971
  if (!this.isSyncAllowed(name)) continue;
6972
6972
  const rec = (_a = this.preloadStatusMap.get(name)) != null ? _a : { state: "pending", itemCount: 0 };
6973
6973
  const everDownloaded = !!((_b = this.syncMetaCache.get(name)) == null ? void 0 : _b.lastSyncTs);
6974
- const ready = rec.state === "hydrated" && (rec.itemCount > 0 || everDownloaded);
6974
+ const ready = rec.state === "hydrated";
6975
6975
  if (rec.state === "failed") failedCount++;
6976
6976
  else if (ready) readyCount++;
6977
6977
  else pendingCount++;
@@ -411,18 +411,21 @@ export interface CollectionPreloadStatus {
411
411
  /** In-mem item count after the last successful hydration (0 is valid). */
412
412
  itemCount: number;
413
413
  /**
414
- * Whether the collection is considered ready: hydrated AND either has data
415
- * (`itemCount > 0`) or its cursor has advanced via a server download
416
- * (`everDownloaded`). A hydrated-but-empty collection that was never
417
- * downloaded is NOT ready — we can't tell "genuinely empty" from
418
- * "not fetched yet".
414
+ * Whether the local cache is loaded into in-mem (`state === "hydrated"`).
415
+ * Empty is valid a genuinely empty, never-synced collection is still ready.
416
+ * Data *freshness* is a separate, global concern (`lastSuccessfulServerSync`),
417
+ * not tracked per-collection.
419
418
  */
420
419
  ready: boolean;
421
420
  /** Timestamp of the last successful Dexie→in-mem hydration. */
422
421
  hydratedAt?: Date;
423
422
  /** Error message from the last failed hydration (set when `state === "failed"`). */
424
423
  lastError?: string;
425
- /** True once a server download has advanced this collection's cursor (`lastSyncTs` set). */
424
+ /**
425
+ * Informational: true once a server download has advanced this collection's
426
+ * cursor (`lastSyncTs` set). NOT part of `ready` — an unused collection may
427
+ * never get a cursor yet is perfectly loadable.
428
+ */
426
429
  everDownloaded: boolean;
427
430
  }
428
431
  /** Rolled-up preload status across all readable, in-scope collections. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.193",
3
+ "version": "0.1.194",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",