dexie 4.1.0-alpha.2 → 4.1.0-alpha.3

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/dist/dexie.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.1.0-alpha.2, Fri Oct 04 2024
7
+ * Version 4.1.0-alpha.3, Fri Oct 11 2024
8
8
  *
9
9
  * https://dexie.org
10
10
  *
package/dist/dexie.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.1.0-alpha.2, Fri Oct 04 2024
7
+ * Version 4.1.0-alpha.3, Fri Oct 11 2024
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1177,7 +1177,7 @@
1177
1177
  }
1178
1178
  }
1179
1179
 
1180
- var DEXIE_VERSION = '4.1.0-alpha.2';
1180
+ var DEXIE_VERSION = '4.1.0-alpha.3';
1181
1181
  var maxString = String.fromCharCode(65535);
1182
1182
  var minKey = -Infinity;
1183
1183
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -5611,20 +5611,22 @@
5611
5611
  if (!stamp)
5612
5612
  return;
5613
5613
  var lastCompressedUpdate = stamp.lastCompressed;
5614
- var unsyncedFrom = Math.min.apply(Math, __spreadArray([], __read(syncers.map(function (s) { return Math.min(s.unsentFrom || Infinity, s.receivedUntil != null ? s.receivedUntil + 1 : Infinity); })), false));
5614
+ var unsyncedFrom = Math.min.apply(Math, __spreadArray([], __read(syncers.map(function (s) {
5615
+ return Math.min(s.unsentFrom || Infinity, s.receivedUntil != null ? s.receivedUntil + 1 : Infinity);
5616
+ })), false));
5615
5617
  return updTbl
5616
5618
  .where('i')
5617
5619
  .between(lastCompressedUpdate, Infinity, false)
5618
5620
  .toArray(function (addedUpdates) {
5619
5621
  var e_3, _a;
5620
- if (addedUpdates.length <= 1)
5622
+ if (addedUpdates.length === 0)
5621
5623
  return;
5622
5624
  var docsToCompress = [];
5623
- var lastUpdateToCompress = lastCompressedUpdate + 1;
5625
+ var lastUpdateToCompress = lastCompressedUpdate;
5624
5626
  var _loop_2 = function (j) {
5625
5627
  var updateRow = addedUpdates[j];
5626
5628
  var i = updateRow.i, f = updateRow.f, k = updateRow.k;
5627
- if (i >= unsyncedFrom && (f & 0x01))
5629
+ if (i >= unsyncedFrom && f & 0x01)
5628
5630
  return "break";
5629
5631
  var entry = docsToCompress.find(function (entry) { return cmp(entry.docId, k) === 0; });
5630
5632
  if (entry)
@@ -5638,9 +5640,13 @@
5638
5640
  if (state_1 === "break")
5639
5641
  break;
5640
5642
  }
5643
+ if (lastUpdateToCompress === lastCompressedUpdate)
5644
+ return;
5641
5645
  var p = Promise.resolve();
5642
5646
  var _loop_3 = function (docId, updates) {
5643
- p = p.then(function () { return compressUpdatesForDoc(db, updatesTable, docId, updates); });
5647
+ p = p.then(function () {
5648
+ return compressUpdatesForDoc(db, updatesTable, docId, updates);
5649
+ });
5644
5650
  };
5645
5651
  try {
5646
5652
  for (var docsToCompress_1 = __values(docsToCompress), docsToCompress_1_1 = docsToCompress_1.next(); !docsToCompress_1_1.done; docsToCompress_1_1 = docsToCompress_1.next()) {
@@ -5671,7 +5677,7 @@
5671
5677
  return db.transaction('rw', updatesTable, function (tx) {
5672
5678
  var updTbl = tx.table(updatesTable);
5673
5679
  return updTbl.where({ k: parentId }).first(function (mainUpdate) {
5674
- var updates = [mainUpdate].concat(addedUpdatesToCompress);
5680
+ var updates = [mainUpdate].concat(addedUpdatesToCompress.filter(function (u) { return u.i !== mainUpdate.i; }));
5675
5681
  var Y = getYLibrary(db);
5676
5682
  var doc = new Y.Doc({ gc: true });
5677
5683
  updates.forEach(function (update) {