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.
@@ -1539,9 +1539,19 @@ function encodeIdsForServer(schema, currentUser, changes) {
1539
1539
  const mutClone = changeClone.muts[mutIndex];
1540
1540
  const rewrittenKey = JSON.stringify(key);
1541
1541
  mutClone.keys[keyIndex] = rewrittenKey;
1542
- if (rewriteValues) {
1543
- Dexie.setByKeyPath(mutClone.values[keyIndex], primaryKey.keyPath, rewrittenKey);
1544
- }
1542
+ /* Bug (#1777)
1543
+ We should not rewrite values. It will fail because the key is array and the value is string.
1544
+ Only the keys should be rewritten and it's already done on the server.
1545
+ We should take another round of revieweing how key transformations are being done between
1546
+ client and server and let the server do the key transformations entirely instead now that
1547
+ we have the primary key schema on the server making it possible to do so.
1548
+ if (rewriteValues) {
1549
+ Dexie.setByKeyPath(
1550
+ (mutClone as DBInsertOperation).values[keyIndex],
1551
+ primaryKey.keyPath!,
1552
+ rewrittenKey
1553
+ );
1554
+ }*/
1545
1555
  }
1546
1556
  else if (key[0] === '#') {
1547
1557
  // Private ID - translate!
@@ -1848,7 +1858,7 @@ function sync(db, options, schema, syncOptions) {
1848
1858
  });
1849
1859
  db.syncStateChangedEvent.next({
1850
1860
  phase: isOnline ? 'error' : 'offline',
1851
- error,
1861
+ error: new Error('' + (error === null || error === void 0 ? void 0 : error.message) || error),
1852
1862
  });
1853
1863
  return Promise.reject(error);
1854
1864
  }));
@@ -4455,7 +4465,7 @@ function dexieCloud(dexie) {
4455
4465
  });
4456
4466
  const syncComplete = new Subject();
4457
4467
  dexie.cloud = {
4458
- version: '4.0.1-beta.44',
4468
+ version: '4.0.1-beta.46',
4459
4469
  options: Object.assign({}, DEFAULT_OPTIONS),
4460
4470
  schema: null,
4461
4471
  get currentUserId() {
@@ -4716,7 +4726,7 @@ function dexieCloud(dexie) {
4716
4726
  });
4717
4727
  }
4718
4728
  }
4719
- dexieCloud.version = '4.0.1-beta.44';
4729
+ dexieCloud.version = '4.0.1-beta.46';
4720
4730
  Dexie.Cloud = dexieCloud;
4721
4731
 
4722
4732
  // In case the SW lives for a while, let it reuse already opened connections: