dexie-cloud-addon 4.0.1-beta.41 → 4.0.1-beta.43

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.
@@ -335,7 +335,10 @@
335
335
  }));
336
336
  })));
337
337
  // Sort by time to get a true order of the operations (between tables)
338
- const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.ts - b.mut.ts);
338
+ const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.txid === b.mut.txid
339
+ ? a.mut.opNo - b.mut.opNo // Within same transaction, sort by opNo
340
+ : a.mut.ts - b.mut.ts // Different transactions - sort by timestamp when mutation resolved
341
+ );
339
342
  const result = [];
340
343
  let currentEntry = null;
341
344
  let currentTxid = null;
@@ -3137,6 +3140,7 @@
3137
3140
  ? {
3138
3141
  type: 'insert',
3139
3142
  ts,
3143
+ opNo,
3140
3144
  keys,
3141
3145
  txid,
3142
3146
  userId,
@@ -3147,6 +3151,7 @@
3147
3151
  // Common changeSpec for all keys
3148
3152
  type: 'modify',
3149
3153
  ts,
3154
+ opNo,
3150
3155
  keys,
3151
3156
  criteria: req.criteria,
3152
3157
  changeSpec: req.changeSpec,
@@ -3158,6 +3163,7 @@
3158
3163
  // One changeSpec per key
3159
3164
  type: 'update',
3160
3165
  ts,
3166
+ opNo,
3161
3167
  keys: updates.keys,
3162
3168
  changeSpecs: updates.changeSpecs,
3163
3169
  txid,
@@ -3166,6 +3172,7 @@
3166
3172
  : {
3167
3173
  type: 'upsert',
3168
3174
  ts,
3175
+ opNo,
3169
3176
  keys,
3170
3177
  values,
3171
3178
  txid,
@@ -4443,7 +4450,7 @@
4443
4450
  });
4444
4451
  const syncComplete = new rxjs.Subject();
4445
4452
  dexie.cloud = {
4446
- version: '4.0.1-beta.41',
4453
+ version: '4.0.1-beta.43',
4447
4454
  options: Object.assign({}, DEFAULT_OPTIONS),
4448
4455
  schema: null,
4449
4456
  get currentUserId() {
@@ -4704,7 +4711,7 @@
4704
4711
  });
4705
4712
  }
4706
4713
  }
4707
- dexieCloud.version = '4.0.1-beta.41';
4714
+ dexieCloud.version = '4.0.1-beta.43';
4708
4715
  Dexie__default["default"].Cloud = dexieCloud;
4709
4716
 
4710
4717
  // In case the SW lives for a while, let it reuse already opened connections: