cry-synced-db-client 0.1.201 → 0.1.202

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6700,14 +6700,29 @@ var _SyncedDb = class _SyncedDb {
6700
6700
  const metas = await this.dexieDb.getDirtyMeta(collectionName);
6701
6701
  const stuck = metas.filter((m) => m.stuckSince !== void 0);
6702
6702
  if (stuck.length === 0) continue;
6703
- const stuckIds = stuck.map((m) => m.id);
6704
- const changesMap = await this.dexieDb.getDirtyChangesBatch(
6705
- collectionName,
6706
- stuckIds
6707
- );
6703
+ const allDirty = await this.dexieDb.getDirty(collectionName);
6708
6704
  const content = stuck.map((m) => {
6709
- const entry = changesMap.get(m.id);
6710
- return entry != null ? entry : __spreadProps(__spreadValues({}, m), { changes: {} });
6705
+ const dirtyId = String(m.id);
6706
+ const found = allDirty.find(
6707
+ (d) => String(d._id) === dirtyId
6708
+ );
6709
+ if (found) {
6710
+ const _a = found, { _id, _ts, _rev } = _a, changedFields = __objRest(_a, ["_id", "_ts", "_rev"]);
6711
+ return {
6712
+ collection: collectionName,
6713
+ id: dirtyId,
6714
+ changes: changedFields,
6715
+ baseTs: _ts,
6716
+ baseRev: _rev,
6717
+ createdAt: m.createdAt,
6718
+ updatedAt: m.updatedAt,
6719
+ firstUploadAttempt: m.firstUploadAttempt,
6720
+ lastUploadAttempt: m.lastUploadAttempt,
6721
+ numUploadAttempts: m.numUploadAttempts,
6722
+ stuckSince: m.stuckSince
6723
+ };
6724
+ }
6725
+ return __spreadProps(__spreadValues({}, m), { changes: {} });
6711
6726
  });
6712
6727
  this.safeCallback(this.onBeforeDirtyClearAll, {
6713
6728
  reason: "discard-stuck",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.201",
3
+ "version": "0.1.202",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",