dexie-cloud-addon 4.0.1-beta.26 → 4.0.1-beta.28

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.
Files changed (58) hide show
  1. package/dist/modern/dexie-cloud-addon.js +24 -8
  2. package/dist/modern/dexie-cloud-addon.js.map +1 -1
  3. package/dist/modern/dexie-cloud-addon.min.js +2 -1
  4. package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
  5. package/dist/modern/service-worker.js +23 -7
  6. package/dist/modern/service-worker.js.map +1 -1
  7. package/dist/modern/service-worker.min.js +2 -1
  8. package/dist/modern/service-worker.min.js.map +1 -1
  9. package/dist/module-es5/dexie-cloud-addon.js +23 -6
  10. package/dist/module-es5/dexie-cloud-addon.js.map +1 -1
  11. package/dist/module-es5/dexie-cloud-addon.min.js +2 -1
  12. package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -1
  13. package/dist/types/DXCWebSocketStatus.d.ts +1 -1
  14. package/dist/types/DexieCloudEntity.d.ts +8 -0
  15. package/dist/types/DexieCloudServerState.d.ts +5 -0
  16. package/dist/types/DexieCloudTable.d.ts +2 -2
  17. package/dist/types/PermissionChecker.d.ts +1 -1
  18. package/dist/types/TSON.d.ts +1 -1
  19. package/dist/types/WSObservable.d.ts +2 -2
  20. package/dist/types/WebSocketStatus.d.ts +1 -0
  21. package/dist/types/authentication/authenticate.d.ts +1 -1
  22. package/dist/types/createMyMembersObservable.d.ts +14 -0
  23. package/dist/types/currentUserObservable.d.ts +3 -0
  24. package/dist/types/db/DexieCloudDB.d.ts +1 -1
  25. package/dist/types/extend-dexie-interface.d.ts +1 -1
  26. package/dist/types/getInternalAccessControlObservable.d.ts +1 -1
  27. package/dist/types/getPermissionsLookupObservable.d.ts +2 -2
  28. package/dist/types/helpers/BroadcastedLocalEvent.d.ts +8 -0
  29. package/dist/types/helpers/visibleState.d.ts +1 -0
  30. package/dist/types/permissionsLookup.d.ts +9 -0
  31. package/dist/types/permissionsLookupObservable.d.ts +14 -0
  32. package/dist/types/sync/globalizePrivateIds.d.ts +4 -0
  33. package/dist/types/sync/messagesFromServerQueue.d.ts +1 -1
  34. package/dist/types/sync/syncServerToClientOnly.d.ts +3 -0
  35. package/dist/types/types/CloudConnectionStatus.d.ts +0 -0
  36. package/dist/types/types/ConnectionStatus.d.ts +0 -0
  37. package/dist/types/types/DXCAlert.d.ts +1 -1
  38. package/dist/types/types/DXCInputField.d.ts +1 -1
  39. package/dist/types/types/DXCUserInteraction.d.ts +1 -1
  40. package/dist/types/types/LoginState.d.ts +41 -0
  41. package/dist/types/types/SWSyncEvent.d.ts +1 -1
  42. package/dist/types/types/SyncConnectionStatus.d.ts +1 -0
  43. package/dist/types/types/SyncFlowStatus.d.ts +6 -0
  44. package/dist/types/types/SyncState.d.ts +2 -2
  45. package/dist/types/types/SyncStatus.d.ts +6 -0
  46. package/dist/umd/dexie-cloud-addon.js +23 -6
  47. package/dist/umd/dexie-cloud-addon.js.map +1 -1
  48. package/dist/umd/dexie-cloud-addon.min.js +1 -1
  49. package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
  50. package/dist/umd/service-worker.js +23 -7
  51. package/dist/umd/service-worker.js.map +1 -1
  52. package/dist/umd/service-worker.min.js +2 -1
  53. package/dist/umd/service-worker.min.js.map +1 -1
  54. package/dist/umd-modern/dexie-cloud-addon.js +21 -5
  55. package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
  56. package/dist/umd-modern/dexie-cloud-addon.min.js +2 -0
  57. package/dist/umd-modern/dexie-cloud-addon.min.js.map +1 -0
  58. package/package.json +41 -12
@@ -3041,12 +3041,12 @@
3041
3041
  // serverRev.rev = new FakeBigInt(server.rev)
3042
3042
  const hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';
3043
3043
  class FakeBigInt {
3044
- constructor(value) {
3045
- this.v = value;
3046
- }
3047
3044
  toString() {
3048
3045
  return this.v;
3049
3046
  }
3047
+ constructor(value) {
3048
+ this.v = value;
3049
+ }
3050
3050
  }
3051
3051
  const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3052
3052
  ? {}
@@ -3917,7 +3917,16 @@
3917
3917
  return db.$syncState.get('syncState');
3918
3918
  },
3919
3919
  getSchema() {
3920
- return db.$syncState.get('schema');
3920
+ return db.$syncState.get('schema').then((schema) => {
3921
+ if (schema) {
3922
+ for (const table of db.tables) {
3923
+ if (table.schema.primKey && table.schema.primKey.keyPath && schema[table.name]) {
3924
+ schema[table.name].primaryKey = nameFromKeyPath(table.schema.primKey.keyPath);
3925
+ }
3926
+ }
3927
+ }
3928
+ return schema;
3929
+ });
3921
3930
  },
3922
3931
  getOptions() {
3923
3932
  return db.$syncState.get('options');
@@ -3935,6 +3944,11 @@
3935
3944
  }
3936
3945
  return db;
3937
3946
  }
3947
+ function nameFromKeyPath(keyPath) {
3948
+ return typeof keyPath === 'string' ?
3949
+ keyPath :
3950
+ keyPath ? ('[' + [].join.call(keyPath, '+') + ']') : "";
3951
+ }
3938
3952
 
3939
3953
  // Emulate true-private property db. Why? So it's not stored in DB.
3940
3954
  const wm = new WeakMap();
@@ -5903,7 +5917,7 @@
5903
5917
  currentUserEmitter.next(UNAUTHORIZED_USER);
5904
5918
  });
5905
5919
  dexie.cloud = {
5906
- version: '4.0.1-beta.26',
5920
+ version: '4.0.1-beta.28',
5907
5921
  options: Object.assign({}, DEFAULT_OPTIONS),
5908
5922
  schema: null,
5909
5923
  get currentUserId() {
@@ -6033,7 +6047,9 @@
6033
6047
  // Update persisted options:
6034
6048
  if (!options)
6035
6049
  throw new Error(`Internal error`); // options cannot be null if configuredProgramatically is set.
6036
- yield db.$syncState.put(options, 'options');
6050
+ const newPersistedOptions = Object.assign({}, options);
6051
+ delete newPersistedOptions.fetchTokens;
6052
+ yield db.$syncState.put(newPersistedOptions, 'options');
6037
6053
  }
6038
6054
  if (((_h = db.cloud.options) === null || _h === void 0 ? void 0 : _h.tryUseServiceWorker) &&
6039
6055
  'serviceWorker' in navigator &&
@@ -6156,7 +6172,7 @@
6156
6172
  });
6157
6173
  }
6158
6174
  }
6159
- dexieCloud.version = '4.0.1-beta.26';
6175
+ dexieCloud.version = '4.0.1-beta.28';
6160
6176
  Dexie__default["default"].Cloud = dexieCloud;
6161
6177
 
6162
6178
  // In case the SW lives for a while, let it reuse already opened connections: