dexie-cloud-addon 4.1.0-alpha.15 → 4.1.0-alpha.17

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.1.0-alpha.15, Fri Oct 18 2024
11
+ * Version 4.1.0-alpha.17, Fri Oct 18 2024
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -8093,7 +8093,7 @@ function dexieCloud(dexie) {
8093
8093
  const syncComplete = new Subject();
8094
8094
  dexie.cloud = {
8095
8095
  // @ts-ignore
8096
- version: "4.1.0-alpha.15",
8096
+ version: "4.1.0-alpha.17",
8097
8097
  options: Object.assign({}, DEFAULT_OPTIONS),
8098
8098
  schema: null,
8099
8099
  get currentUserId() {
@@ -8395,7 +8395,7 @@ function dexieCloud(dexie) {
8395
8395
  }
8396
8396
  }
8397
8397
  // @ts-ignore
8398
- dexieCloud.version = "4.1.0-alpha.15";
8398
+ dexieCloud.version = "4.1.0-alpha.17";
8399
8399
  Dexie.Cloud = dexieCloud;
8400
8400
 
8401
8401
  const ydocTriggers = {};
@@ -8420,6 +8420,8 @@ const createMiddleware = (db) => ({
8420
8420
  switch (req.type) {
8421
8421
  case 'add': {
8422
8422
  for (const yUpdateRow of req.values) {
8423
+ if (typeof yUpdateRow.i !== 'number' || yUpdateRow.i < 1)
8424
+ continue; // A syncer (i is string) or garbage collection state (i is 0) - ignore.
8423
8425
  const primaryKey = yUpdateRow.k;
8424
8426
  const doc = DexieYProvider.getDocCache(db).find(parentTable, primaryKey, prop);
8425
8427
  if (doc) {
@@ -8449,10 +8451,12 @@ const createMiddleware = (db) => ({
8449
8451
  .then((updates) => {
8450
8452
  const keySet = new RangeSet();
8451
8453
  for (const { k } of updates) {
8452
- keySet.addKey(k);
8454
+ if (typeof k === 'number' && k > 0) {
8455
+ keySet.addKey(k);
8456
+ }
8453
8457
  }
8454
- for (const key of keySet) {
8455
- enqueueTrigger(db, tblName, key, trigger);
8458
+ for (const interval of keySet) {
8459
+ enqueueTrigger(db, tblName, interval.from, trigger);
8456
8460
  }
8457
8461
  });
8458
8462
  }
@@ -8497,9 +8501,9 @@ function executeTriggers(triggersToRun) {
8497
8501
  function enqueueTrigger(db, updatesTable, parentId, trigger) {
8498
8502
  scheduledTriggers.push({
8499
8503
  db,
8504
+ updatesTable,
8500
8505
  parentId,
8501
8506
  trigger,
8502
- updatesTable
8503
8507
  });
8504
8508
  }
8505
8509
  function onTransactionCommitted() {