dexie-cloud-addon 4.0.1-rc.2 → 4.0.1

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.0.1-rc.2, Wed Mar 20 2024
11
+ * Version 4.0.1, Tue Mar 26 2024
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -5434,10 +5434,14 @@
5434
5434
  return new rxjs.BehaviorSubject([userLogin, syncState]);
5435
5435
  }), switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), distinctUntilChanged(([prevUser, prevHash], [currUser, currHash]) => prevUser === currUser && prevHash === currHash), switchMap(([userLogin, realmSetHash]) => {
5436
5436
  var _a;
5437
+ if (!((_a = db.cloud.persistedSyncState) === null || _a === void 0 ? void 0 : _a.value)) {
5438
+ // Restart the flow if persistedSyncState is not yet available.
5439
+ return createObservable();
5440
+ }
5437
5441
  // Let server end query changes from last entry of same client-ID and forward.
5438
5442
  // If no new entries, server won't bother the client. If new entries, server sends only those
5439
5443
  // and the baseRev of the last from same client-ID.
5440
- if (userLogin && ((_a = db.cloud.persistedSyncState) === null || _a === void 0 ? void 0 : _a.value)) {
5444
+ if (userLogin) {
5441
5445
  return new WSObservable(db.cloud.options.databaseUrl, db.cloud.persistedSyncState.value.serverRevision, realmSetHash, db.cloud.persistedSyncState.value.clientIdentity, messageProducer, db.cloud.webSocketStatus, userLogin.accessToken, userLogin.accessTokenExpiration);
5442
5446
  }
5443
5447
  else {
@@ -6282,7 +6286,7 @@
6282
6286
  const syncComplete = new rxjs.Subject();
6283
6287
  dexie.cloud = {
6284
6288
  // @ts-ignore
6285
- version: "4.0.1-rc.2",
6289
+ version: "4.0.1",
6286
6290
  options: Object.assign({}, DEFAULT_OPTIONS),
6287
6291
  schema: null,
6288
6292
  get currentUserId() {
@@ -6559,7 +6563,7 @@
6559
6563
  }
6560
6564
  }
6561
6565
  // @ts-ignore
6562
- dexieCloud.version = "4.0.1-rc.2";
6566
+ dexieCloud.version = "4.0.1";
6563
6567
  Dexie.Cloud = dexieCloud;
6564
6568
 
6565
6569
  // In case the SW lives for a while, let it reuse already opened connections: