dexie-cloud-addon 4.0.0-beta.14 → 4.0.0-beta.15

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.
@@ -108,7 +108,7 @@
108
108
  *
109
109
  * ==========================================================================
110
110
  *
111
- * Version 4.0.0-beta.14, Mon Dec 20 2021
111
+ * Version 4.0.0-beta.15, Mon Dec 20 2021
112
112
  *
113
113
  * https://dexie.org
114
114
  *
@@ -6724,6 +6724,7 @@
6724
6724
  //
6725
6725
  var currentUserEmitter = getCurrentUserEmitter(dexie);
6726
6726
  var subscriptions = [];
6727
+ var configuredProgramatically = false;
6727
6728
  // local sync worker - used when there's no service worker.
6728
6729
  var localSyncWorker = null;
6729
6730
  dexie.on('ready', function (dexie) { return __awaiter$1(_this_1, void 0, void 0, function () {
@@ -6759,7 +6760,7 @@
6759
6760
  currentUserEmitter.next(UNAUTHORIZED_USER);
6760
6761
  });
6761
6762
  dexie.cloud = {
6762
- version: '4.0.0-beta.14',
6763
+ version: '4.0.0-beta.15',
6763
6764
  options: __assign({}, DEFAULT_OPTIONS),
6764
6765
  schema: null,
6765
6766
  serverState: null,
@@ -6795,6 +6796,7 @@
6795
6796
  invites: getInvitesObservable(dexie),
6796
6797
  configure: function (options) {
6797
6798
  options = dexie.cloud.options = __assign(__assign({}, dexie.cloud.options), options);
6799
+ configuredProgramatically = true;
6798
6800
  if (options.databaseUrl && options.nameSuffix) {
6799
6801
  // @ts-ignore
6800
6802
  dexie.name = "".concat(origIdbName, "-").concat(getDbNameFromDbUrl(options.databaseUrl));
@@ -6929,7 +6931,7 @@
6929
6931
  ])];
6930
6932
  case 1:
6931
6933
  _f = _m.sent(), persistedOptions = _f[0], persistedSchema = _f[1], persistedSyncState = _f[2];
6932
- if (!!options) return [3 /*break*/, 2];
6934
+ if (!!configuredProgramatically) return [3 /*break*/, 2];
6933
6935
  // Options not specified programatically (use case for SW!)
6934
6936
  // Take persisted options:
6935
6937
  db.cloud.options = persistedOptions || null;
@@ -6938,9 +6940,10 @@
6938
6940
  if (!(!persistedOptions ||
6939
6941
  JSON.stringify(persistedOptions) !== JSON.stringify(options))) return [3 /*break*/, 4];
6940
6942
  // Update persisted options:
6943
+ if (!options)
6944
+ throw new Error("Internal error"); // options cannot be null if configuredProgramatically is set.
6941
6945
  return [4 /*yield*/, db.$syncState.put(options, 'options')];
6942
6946
  case 3:
6943
- // Update persisted options:
6944
6947
  _m.sent();
6945
6948
  _m.label = 4;
6946
6949
  case 4:
@@ -7086,7 +7089,7 @@
7086
7089
  });
7087
7090
  }
7088
7091
  }
7089
- dexieCloud.version = '4.0.0-beta.14';
7092
+ dexieCloud.version = '4.0.0-beta.15';
7090
7093
  Dexie__default["default"].Cloud = dexieCloud;
7091
7094
 
7092
7095
  exports["default"] = dexieCloud;