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
@@ -3034,12 +3034,12 @@ var undefinedDef = {
3034
3034
  // serverRev.rev = new FakeBigInt(server.rev)
3035
3035
  const hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';
3036
3036
  class FakeBigInt {
3037
- constructor(value) {
3038
- this.v = value;
3039
- }
3040
3037
  toString() {
3041
3038
  return this.v;
3042
3039
  }
3040
+ constructor(value) {
3041
+ this.v = value;
3042
+ }
3043
3043
  }
3044
3044
  const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3045
3045
  ? {}
@@ -3910,7 +3910,16 @@ function DexieCloudDB(dx) {
3910
3910
  return db.$syncState.get('syncState');
3911
3911
  },
3912
3912
  getSchema() {
3913
- return db.$syncState.get('schema');
3913
+ return db.$syncState.get('schema').then((schema) => {
3914
+ if (schema) {
3915
+ for (const table of db.tables) {
3916
+ if (table.schema.primKey && table.schema.primKey.keyPath && schema[table.name]) {
3917
+ schema[table.name].primaryKey = nameFromKeyPath(table.schema.primKey.keyPath);
3918
+ }
3919
+ }
3920
+ }
3921
+ return schema;
3922
+ });
3914
3923
  },
3915
3924
  getOptions() {
3916
3925
  return db.$syncState.get('options');
@@ -3928,6 +3937,11 @@ function DexieCloudDB(dx) {
3928
3937
  }
3929
3938
  return db;
3930
3939
  }
3940
+ function nameFromKeyPath(keyPath) {
3941
+ return typeof keyPath === 'string' ?
3942
+ keyPath :
3943
+ keyPath ? ('[' + [].join.call(keyPath, '+') + ']') : "";
3944
+ }
3931
3945
 
3932
3946
  // Emulate true-private property db. Why? So it's not stored in DB.
3933
3947
  const wm = new WeakMap();
@@ -5896,7 +5910,7 @@ function dexieCloud(dexie) {
5896
5910
  currentUserEmitter.next(UNAUTHORIZED_USER);
5897
5911
  });
5898
5912
  dexie.cloud = {
5899
- version: '4.0.1-beta.26',
5913
+ version: '4.0.1-beta.28',
5900
5914
  options: Object.assign({}, DEFAULT_OPTIONS),
5901
5915
  schema: null,
5902
5916
  get currentUserId() {
@@ -6026,7 +6040,9 @@ function dexieCloud(dexie) {
6026
6040
  // Update persisted options:
6027
6041
  if (!options)
6028
6042
  throw new Error(`Internal error`); // options cannot be null if configuredProgramatically is set.
6029
- yield db.$syncState.put(options, 'options');
6043
+ const newPersistedOptions = Object.assign({}, options);
6044
+ delete newPersistedOptions.fetchTokens;
6045
+ yield db.$syncState.put(newPersistedOptions, 'options');
6030
6046
  }
6031
6047
  if (((_h = db.cloud.options) === null || _h === void 0 ? void 0 : _h.tryUseServiceWorker) &&
6032
6048
  'serviceWorker' in navigator &&
@@ -6149,7 +6165,7 @@ function dexieCloud(dexie) {
6149
6165
  });
6150
6166
  }
6151
6167
  }
6152
- dexieCloud.version = '4.0.1-beta.26';
6168
+ dexieCloud.version = '4.0.1-beta.28';
6153
6169
  Dexie.Cloud = dexieCloud;
6154
6170
 
6155
6171
  // In case the SW lives for a while, let it reuse already opened connections: