dexie-cloud-addon 4.4.4-alpha.0 → 4.4.5

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.4.4-alpha.0, Tue Mar 24 2026
11
+ * Version 4.4.5, Wed Mar 25 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -13588,7 +13588,7 @@
13588
13588
  *
13589
13589
  * ==========================================================================
13590
13590
  *
13591
- * Version 4.4.0, Tue Mar 24 2026
13591
+ * Version 4.4.0, Wed Mar 25 2026
13592
13592
  *
13593
13593
  * https://dexie.org
13594
13594
  *
@@ -17104,6 +17104,7 @@
17104
17104
  return cursor.start(() => {
17105
17105
  const rawValue = cursor.value;
17106
17106
  if (!rawValue || !hasUnresolvedBlobRefs(rawValue)) {
17107
+ wrappedCursor.value = rawValue;
17107
17108
  onNext();
17108
17109
  return;
17109
17110
  }
@@ -17112,6 +17113,7 @@
17112
17113
  onNext();
17113
17114
  }, err => {
17114
17115
  console.error('Failed to resolve BlobRefs for cursor value:', err);
17116
+ wrappedCursor.value = rawValue;
17115
17117
  onNext();
17116
17118
  });
17117
17119
  });
@@ -18001,14 +18003,13 @@
18001
18003
  throw new Error(`No database URL to connect WebSocket to`);
18002
18004
  }
18003
18005
  const readyForChangesMessage = db.messageConsumer.readyToServe.pipe(operators.filter((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it
18004
- operators.switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:
18005
- operators.filter((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place
18006
+ operators.switchMap(() => db.cloud.persistedSyncState.pipe(operators.filter((syncState) => !!(syncState && syncState.serverRevision)), operators.take(1))), // Wait reactively for syncState with serverRevision (avoids race with logout/re-sync)
18006
18007
  operators.switchMap((syncState) => __awaiter(this, void 0, void 0, function* () {
18007
18008
  return ({
18008
18009
  // Produce the message to trigger server to send us new messages to consume:
18009
18010
  type: 'ready',
18010
18011
  rev: syncState.serverRevision,
18011
- realmSetHash: yield computeRealmSetHash(syncState)
18012
+ realmSetHash: yield computeRealmSetHash(syncState),
18012
18013
  });
18013
18014
  })));
18014
18015
  const messageProducer = rxjs.merge(readyForChangesMessage, db.messageProducer);
@@ -18021,7 +18022,8 @@
18021
18022
  }*/
18022
18023
  return userIsReallyActive.pipe(operators.map((isActive) => [isActive ? userLogin : null, syncState]));
18023
18024
  }), operators.switchMap(([userLogin, syncState]) => {
18024
- if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) && !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
18025
+ if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) &&
18026
+ !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
18025
18027
  // We're in an in-between state when user is logged in but the user's realms are not yet synced.
18026
18028
  // Don't make this change reconnect the websocket just yet. Wait till syncState is updated
18027
18029
  // to iclude the user's realm.
@@ -18056,7 +18058,7 @@
18056
18058
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
18057
18059
  claims: refreshedLogin.claims,
18058
18060
  license: refreshedLogin.license,
18059
- data: refreshedLogin.data
18061
+ data: refreshedLogin.data,
18060
18062
  });
18061
18063
  })), operators.switchMap(() => createObservable()));
18062
18064
  }
@@ -18064,7 +18066,7 @@
18064
18066
  return rxjs.throwError(() => error);
18065
18067
  }
18066
18068
  }), operators.catchError((error) => {
18067
- db.cloud.webSocketStatus.next("error");
18069
+ db.cloud.webSocketStatus.next('error');
18068
18070
  if (error instanceof InvalidLicenseError) {
18069
18071
  // Don't retry. Just throw and don't try connect again.
18070
18072
  return rxjs.throwError(() => error);
@@ -18176,27 +18178,30 @@
18176
18178
  // break free from possible active transaction:
18177
18179
  setTimeout(() => {
18178
18180
  const purpose = pullSignalled ? 'pull' : 'push';
18181
+ pullSignalled = false;
18182
+ pushSignalled = false;
18179
18183
  syncStartTime = Date.now();
18180
18184
  syncIfPossible(db, cloudOptions, cloudSchema, {
18181
18185
  cancelToken,
18182
18186
  retryImmediatelyOnFetchError: true, // workaround for "net::ERR_NETWORK_CHANGED" in chrome.
18183
18187
  purpose,
18184
- }).then(() => {
18188
+ })
18189
+ .then(() => {
18185
18190
  if (cancelToken.cancelled) {
18186
18191
  stop();
18187
18192
  }
18188
18193
  else {
18189
18194
  if (pullSignalled || pushSignalled) {
18190
18195
  // If we have signalled for more sync, do it now.
18191
- pullSignalled = false;
18192
- pushSignalled = false;
18196
+ // Note: don't reset flags here - syncAndRetry reads them in setTimeout
18193
18197
  return syncAndRetry();
18194
18198
  }
18195
18199
  }
18196
18200
  ongoingSync = false;
18197
18201
  nextRetryTime = 0;
18198
18202
  syncStartTime = 0;
18199
- }).catch((error) => {
18203
+ })
18204
+ .catch((error) => {
18200
18205
  console.error('error in syncIfPossible()', error);
18201
18206
  if (cancelToken.cancelled) {
18202
18207
  stop();
@@ -18239,7 +18244,8 @@
18239
18244
  if (nextRetryTime) {
18240
18245
  console.debug(`Sync is paused until ${new Date(nextRetryTime).toISOString()} due to error in last sync attempt`);
18241
18246
  }
18242
- else if (syncStartTime > 0 && Date.now() - syncStartTime > 20 * SECONDS) {
18247
+ else if (syncStartTime > 0 &&
18248
+ Date.now() - syncStartTime > 20 * SECONDS) {
18243
18249
  console.debug(`An existing sync operation is taking more than 20 seconds. Will resync when done.`);
18244
18250
  }
18245
18251
  return;
@@ -19430,7 +19436,7 @@
19430
19436
  const downloading$ = createDownloadingState();
19431
19437
  dexie.cloud = {
19432
19438
  // @ts-ignore
19433
- version: "4.4.4-alpha.0",
19439
+ version: "4.4.5",
19434
19440
  options: Object.assign({}, DEFAULT_OPTIONS),
19435
19441
  schema: null,
19436
19442
  get currentUserId() {
@@ -19857,7 +19863,7 @@
19857
19863
  }
19858
19864
  }
19859
19865
  // @ts-ignore
19860
- dexieCloud.version = "4.4.4-alpha.0";
19866
+ dexieCloud.version = "4.4.5";
19861
19867
  Dexie.Cloud = dexieCloud;
19862
19868
 
19863
19869
  // In case the SW lives for a while, let it reuse already opened connections: