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
  *
@@ -6136,6 +6136,7 @@ function createBlobResolvingCursor(cursor, table, blobSavingQueue, db) {
6136
6136
  return cursor.start(() => {
6137
6137
  const rawValue = cursor.value;
6138
6138
  if (!rawValue || !hasUnresolvedBlobRefs(rawValue)) {
6139
+ wrappedCursor.value = rawValue;
6139
6140
  onNext();
6140
6141
  return;
6141
6142
  }
@@ -6144,6 +6145,7 @@ function createBlobResolvingCursor(cursor, table, blobSavingQueue, db) {
6144
6145
  onNext();
6145
6146
  }, err => {
6146
6147
  console.error('Failed to resolve BlobRefs for cursor value:', err);
6148
+ wrappedCursor.value = rawValue;
6147
6149
  onNext();
6148
6150
  });
6149
6151
  });
@@ -6771,14 +6773,13 @@ function connectWebSocket(db) {
6771
6773
  throw new Error(`No database URL to connect WebSocket to`);
6772
6774
  }
6773
6775
  const readyForChangesMessage = db.messageConsumer.readyToServe.pipe(filter$1((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it
6774
- switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:
6775
- filter$1((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place
6776
+ switchMap(() => db.cloud.persistedSyncState.pipe(filter$1((syncState) => !!(syncState && syncState.serverRevision)), take(1))), // Wait reactively for syncState with serverRevision (avoids race with logout/re-sync)
6776
6777
  switchMap((syncState) => __awaiter(this, void 0, void 0, function* () {
6777
6778
  return ({
6778
6779
  // Produce the message to trigger server to send us new messages to consume:
6779
6780
  type: 'ready',
6780
6781
  rev: syncState.serverRevision,
6781
- realmSetHash: yield computeRealmSetHash(syncState)
6782
+ realmSetHash: yield computeRealmSetHash(syncState),
6782
6783
  });
6783
6784
  })));
6784
6785
  const messageProducer = merge(readyForChangesMessage, db.messageProducer);
@@ -6791,7 +6792,8 @@ function connectWebSocket(db) {
6791
6792
  }*/
6792
6793
  return userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]));
6793
6794
  }), switchMap(([userLogin, syncState]) => {
6794
- if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) && !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
6795
+ if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) &&
6796
+ !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
6795
6797
  // We're in an in-between state when user is logged in but the user's realms are not yet synced.
6796
6798
  // Don't make this change reconnect the websocket just yet. Wait till syncState is updated
6797
6799
  // to iclude the user's realm.
@@ -6826,7 +6828,7 @@ function connectWebSocket(db) {
6826
6828
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
6827
6829
  claims: refreshedLogin.claims,
6828
6830
  license: refreshedLogin.license,
6829
- data: refreshedLogin.data
6831
+ data: refreshedLogin.data,
6830
6832
  });
6831
6833
  })), switchMap(() => createObservable()));
6832
6834
  }
@@ -6834,7 +6836,7 @@ function connectWebSocket(db) {
6834
6836
  return throwError(() => error);
6835
6837
  }
6836
6838
  }), catchError((error) => {
6837
- db.cloud.webSocketStatus.next("error");
6839
+ db.cloud.webSocketStatus.next('error');
6838
6840
  if (error instanceof InvalidLicenseError) {
6839
6841
  // Don't retry. Just throw and don't try connect again.
6840
6842
  return throwError(() => error);
@@ -6946,27 +6948,30 @@ function LocalSyncWorker(db, cloudOptions, cloudSchema) {
6946
6948
  // break free from possible active transaction:
6947
6949
  setTimeout(() => {
6948
6950
  const purpose = pullSignalled ? 'pull' : 'push';
6951
+ pullSignalled = false;
6952
+ pushSignalled = false;
6949
6953
  syncStartTime = Date.now();
6950
6954
  syncIfPossible(db, cloudOptions, cloudSchema, {
6951
6955
  cancelToken,
6952
6956
  retryImmediatelyOnFetchError: true, // workaround for "net::ERR_NETWORK_CHANGED" in chrome.
6953
6957
  purpose,
6954
- }).then(() => {
6958
+ })
6959
+ .then(() => {
6955
6960
  if (cancelToken.cancelled) {
6956
6961
  stop();
6957
6962
  }
6958
6963
  else {
6959
6964
  if (pullSignalled || pushSignalled) {
6960
6965
  // If we have signalled for more sync, do it now.
6961
- pullSignalled = false;
6962
- pushSignalled = false;
6966
+ // Note: don't reset flags here - syncAndRetry reads them in setTimeout
6963
6967
  return syncAndRetry();
6964
6968
  }
6965
6969
  }
6966
6970
  ongoingSync = false;
6967
6971
  nextRetryTime = 0;
6968
6972
  syncStartTime = 0;
6969
- }).catch((error) => {
6973
+ })
6974
+ .catch((error) => {
6970
6975
  console.error('error in syncIfPossible()', error);
6971
6976
  if (cancelToken.cancelled) {
6972
6977
  stop();
@@ -7009,7 +7014,8 @@ function LocalSyncWorker(db, cloudOptions, cloudSchema) {
7009
7014
  if (nextRetryTime) {
7010
7015
  console.debug(`Sync is paused until ${new Date(nextRetryTime).toISOString()} due to error in last sync attempt`);
7011
7016
  }
7012
- else if (syncStartTime > 0 && Date.now() - syncStartTime > 20 * SECONDS) {
7017
+ else if (syncStartTime > 0 &&
7018
+ Date.now() - syncStartTime > 20 * SECONDS) {
7013
7019
  console.debug(`An existing sync operation is taking more than 20 seconds. Will resync when done.`);
7014
7020
  }
7015
7021
  return;
@@ -8371,7 +8377,7 @@ function dexieCloud(dexie) {
8371
8377
  const downloading$ = createDownloadingState();
8372
8378
  dexie.cloud = {
8373
8379
  // @ts-ignore
8374
- version: "4.4.4-alpha.0",
8380
+ version: "4.4.5",
8375
8381
  options: Object.assign({}, DEFAULT_OPTIONS),
8376
8382
  schema: null,
8377
8383
  get currentUserId() {
@@ -8798,7 +8804,7 @@ function dexieCloud(dexie) {
8798
8804
  }
8799
8805
  }
8800
8806
  // @ts-ignore
8801
- dexieCloud.version = "4.4.4-alpha.0";
8807
+ dexieCloud.version = "4.4.5";
8802
8808
  Dexie.Cloud = dexieCloud;
8803
8809
 
8804
8810
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };