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.
@@ -101,7 +101,7 @@ function __spreadArray$1(to, from, pack) {
101
101
  *
102
102
  * ==========================================================================
103
103
  *
104
- * Version 4.0.0-beta.14, Mon Dec 20 2021
104
+ * Version 4.0.0-beta.15, Mon Dec 20 2021
105
105
  *
106
106
  * https://dexie.org
107
107
  *
@@ -6717,6 +6717,7 @@ function dexieCloud(dexie) {
6717
6717
  //
6718
6718
  var currentUserEmitter = getCurrentUserEmitter(dexie);
6719
6719
  var subscriptions = [];
6720
+ var configuredProgramatically = false;
6720
6721
  // local sync worker - used when there's no service worker.
6721
6722
  var localSyncWorker = null;
6722
6723
  dexie.on('ready', function (dexie) { return __awaiter$1(_this_1, void 0, void 0, function () {
@@ -6752,7 +6753,7 @@ function dexieCloud(dexie) {
6752
6753
  currentUserEmitter.next(UNAUTHORIZED_USER);
6753
6754
  });
6754
6755
  dexie.cloud = {
6755
- version: '4.0.0-beta.14',
6756
+ version: '4.0.0-beta.15',
6756
6757
  options: __assign({}, DEFAULT_OPTIONS),
6757
6758
  schema: null,
6758
6759
  serverState: null,
@@ -6788,6 +6789,7 @@ function dexieCloud(dexie) {
6788
6789
  invites: getInvitesObservable(dexie),
6789
6790
  configure: function (options) {
6790
6791
  options = dexie.cloud.options = __assign(__assign({}, dexie.cloud.options), options);
6792
+ configuredProgramatically = true;
6791
6793
  if (options.databaseUrl && options.nameSuffix) {
6792
6794
  // @ts-ignore
6793
6795
  dexie.name = "".concat(origIdbName, "-").concat(getDbNameFromDbUrl(options.databaseUrl));
@@ -6922,7 +6924,7 @@ function dexieCloud(dexie) {
6922
6924
  ])];
6923
6925
  case 1:
6924
6926
  _f = _m.sent(), persistedOptions = _f[0], persistedSchema = _f[1], persistedSyncState = _f[2];
6925
- if (!!options) return [3 /*break*/, 2];
6927
+ if (!!configuredProgramatically) return [3 /*break*/, 2];
6926
6928
  // Options not specified programatically (use case for SW!)
6927
6929
  // Take persisted options:
6928
6930
  db.cloud.options = persistedOptions || null;
@@ -6931,9 +6933,10 @@ function dexieCloud(dexie) {
6931
6933
  if (!(!persistedOptions ||
6932
6934
  JSON.stringify(persistedOptions) !== JSON.stringify(options))) return [3 /*break*/, 4];
6933
6935
  // Update persisted options:
6936
+ if (!options)
6937
+ throw new Error("Internal error"); // options cannot be null if configuredProgramatically is set.
6934
6938
  return [4 /*yield*/, db.$syncState.put(options, 'options')];
6935
6939
  case 3:
6936
- // Update persisted options:
6937
6940
  _m.sent();
6938
6941
  _m.label = 4;
6939
6942
  case 4:
@@ -7079,7 +7082,7 @@ function dexieCloud(dexie) {
7079
7082
  });
7080
7083
  }
7081
7084
  }
7082
- dexieCloud.version = '4.0.0-beta.14';
7085
+ dexieCloud.version = '4.0.0-beta.15';
7083
7086
  Dexie.Cloud = dexieCloud;
7084
7087
 
7085
7088
  export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };