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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.0.1-beta.41, Sat Jul 01 2023
11
+ * Version 4.0.1-beta.43, Sat Jul 01 2023
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -2750,7 +2750,10 @@ function listClientChanges(mutationTables, db, { since = {}, limit = Infinity }
2750
2750
  }));
2751
2751
  })));
2752
2752
  // Sort by time to get a true order of the operations (between tables)
2753
- const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.ts - b.mut.ts);
2753
+ const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.txid === b.mut.txid
2754
+ ? a.mut.opNo - b.mut.opNo // Within same transaction, sort by opNo
2755
+ : a.mut.ts - b.mut.ts // Different transactions - sort by timestamp when mutation resolved
2756
+ );
2754
2757
  const result = [];
2755
2758
  let currentEntry = null;
2756
2759
  let currentTxid = null;
@@ -4769,6 +4772,7 @@ function createMutationTrackingMiddleware({ currentUserObservable, db }) {
4769
4772
  ? {
4770
4773
  type: 'insert',
4771
4774
  ts,
4775
+ opNo,
4772
4776
  keys,
4773
4777
  txid,
4774
4778
  userId,
@@ -4779,6 +4783,7 @@ function createMutationTrackingMiddleware({ currentUserObservable, db }) {
4779
4783
  // Common changeSpec for all keys
4780
4784
  type: 'modify',
4781
4785
  ts,
4786
+ opNo,
4782
4787
  keys,
4783
4788
  criteria: req.criteria,
4784
4789
  changeSpec: req.changeSpec,
@@ -4790,6 +4795,7 @@ function createMutationTrackingMiddleware({ currentUserObservable, db }) {
4790
4795
  // One changeSpec per key
4791
4796
  type: 'update',
4792
4797
  ts,
4798
+ opNo,
4793
4799
  keys: updates.keys,
4794
4800
  changeSpecs: updates.changeSpecs,
4795
4801
  txid,
@@ -4798,6 +4804,7 @@ function createMutationTrackingMiddleware({ currentUserObservable, db }) {
4798
4804
  : {
4799
4805
  type: 'upsert',
4800
4806
  ts,
4807
+ opNo,
4801
4808
  keys,
4802
4809
  values,
4803
4810
  txid,
@@ -6082,7 +6089,7 @@ function dexieCloud(dexie) {
6082
6089
  });
6083
6090
  const syncComplete = new Subject();
6084
6091
  dexie.cloud = {
6085
- version: '4.0.1-beta.41',
6092
+ version: '4.0.1-beta.43',
6086
6093
  options: Object.assign({}, DEFAULT_OPTIONS),
6087
6094
  schema: null,
6088
6095
  get currentUserId() {
@@ -6343,7 +6350,7 @@ function dexieCloud(dexie) {
6343
6350
  });
6344
6351
  }
6345
6352
  }
6346
- dexieCloud.version = '4.0.1-beta.41';
6353
+ dexieCloud.version = '4.0.1-beta.43';
6347
6354
  Dexie.Cloud = dexieCloud;
6348
6355
 
6349
6356
  export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };