dexie-cloud-addon 4.0.1-beta.45 → 4.0.1-beta.46

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.44, Wed Jul 05 2023
11
+ * Version 4.0.1-beta.46, Sat Aug 05 2023
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -3406,9 +3406,19 @@ function encodeIdsForServer(schema, currentUser, changes) {
3406
3406
  const mutClone = changeClone.muts[mutIndex];
3407
3407
  const rewrittenKey = JSON.stringify(key);
3408
3408
  mutClone.keys[keyIndex] = rewrittenKey;
3409
- if (rewriteValues) {
3410
- Dexie.setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
3411
- }
3409
+ /* Bug (#1777)
3410
+ We should not rewrite values. It will fail because the key is array and the value is string.
3411
+ Only the keys should be rewritten and it's already done on the server.
3412
+ We should take another round of revieweing how key transformations are being done between
3413
+ client and server and let the server do the key transformations entirely instead now that
3414
+ we have the primary key schema on the server making it possible to do so.
3415
+ if (rewriteValues) {
3416
+ Dexie.setByKeyPath(
3417
+ (mutClone as DBInsertOperation).values[keyIndex],
3418
+ primaryKey.keyPath!,
3419
+ rewrittenKey
3420
+ );
3421
+ }*/
3412
3422
  }
3413
3423
  else if (key[0] === '#') {
3414
3424
  // Private ID - translate!
@@ -3715,7 +3725,7 @@ function sync(db, options, schema, syncOptions) {
3715
3725
  });
3716
3726
  db.syncStateChangedEvent.next({
3717
3727
  phase: isOnline ? 'error' : 'offline',
3718
- error,
3728
+ error: new Error('' + (error === null || error === void 0 ? void 0 : error.message) || error),
3719
3729
  });
3720
3730
  return Promise.reject(error);
3721
3731
  }));
@@ -6100,7 +6110,7 @@ function dexieCloud(dexie) {
6100
6110
  });
6101
6111
  const syncComplete = new Subject();
6102
6112
  dexie.cloud = {
6103
- version: '4.0.1-beta.44',
6113
+ version: '4.0.1-beta.46',
6104
6114
  options: Object.assign({}, DEFAULT_OPTIONS),
6105
6115
  schema: null,
6106
6116
  get currentUserId() {
@@ -6361,7 +6371,7 @@ function dexieCloud(dexie) {
6361
6371
  });
6362
6372
  }
6363
6373
  }
6364
- dexieCloud.version = '4.0.1-beta.44';
6374
+ dexieCloud.version = '4.0.1-beta.46';
6365
6375
  Dexie.Cloud = dexieCloud;
6366
6376
 
6367
6377
  export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };