dexie-cloud-addon 4.3.7 → 4.3.9

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.
@@ -1,3 +1,4 @@
1
1
  import Dexie from "dexie";
2
2
  import { BehaviorSubject } from "rxjs";
3
- export declare const getCurrentUserEmitter: (x: Dexie) => BehaviorSubject<import("./dexie-cloud-client").UserLogin>;
3
+ import { UserLogin } from "./dexie-cloud-client";
4
+ export declare const getCurrentUserEmitter: (x: Dexie) => BehaviorSubject<UserLogin>;
@@ -20,4 +20,5 @@ export interface UserLogin {
20
20
  publicKey?: CryptoKey;
21
21
  isLoggedIn?: boolean;
22
22
  data?: any;
23
+ isLoading?: boolean;
23
24
  }
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.3.7, Wed Jan 28 2026
11
+ * Version 4.3.9, Thu Jan 29 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6068,7 +6068,7 @@ function associate(factory) {
6068
6068
  };
6069
6069
  }
6070
6070
 
6071
- const getCurrentUserEmitter = associate((db) => new BehaviorSubject(UNAUTHORIZED_USER));
6071
+ const getCurrentUserEmitter = associate((db) => new BehaviorSubject(Object.assign(Object.assign({}, UNAUTHORIZED_USER), { isLoading: true })));
6072
6072
 
6073
6073
  function computeSyncState(db) {
6074
6074
  let _prevStatus = db.cloud.webSocketStatus.value;
@@ -6874,7 +6874,7 @@ function dexieCloud(dexie) {
6874
6874
  const syncComplete = new Subject();
6875
6875
  dexie.cloud = {
6876
6876
  // @ts-ignore
6877
- version: "4.3.7",
6877
+ version: "4.3.9",
6878
6878
  options: Object.assign({}, DEFAULT_OPTIONS),
6879
6879
  schema: null,
6880
6880
  get currentUserId() {
@@ -6915,8 +6915,6 @@ function dexieCloud(dexie) {
6915
6915
  try {
6916
6916
  const callback = parseOAuthCallback();
6917
6917
  if (callback) {
6918
- // Clean up URL immediately (remove dxc-auth param)
6919
- cleanupOAuthUrl();
6920
6918
  // Store the pending auth code for processing when db is ready
6921
6919
  pendingOAuthCode = { code: callback.code, provider: callback.provider };
6922
6920
  console.debug('[dexie-cloud] OAuth callback detected, auth code stored for processing');
@@ -6924,7 +6922,6 @@ function dexieCloud(dexie) {
6924
6922
  }
6925
6923
  catch (error) {
6926
6924
  // parseOAuthCallback throws OAuthError on error callbacks
6927
- cleanupOAuthUrl();
6928
6925
  if (error instanceof OAuthError) {
6929
6926
  pendingOAuthError = error;
6930
6927
  console.error('[dexie-cloud] OAuth callback error:', error.message);
@@ -7118,7 +7115,14 @@ function dexieCloud(dexie) {
7118
7115
  // Manage CurrentUser observable:
7119
7116
  throwIfClosed();
7120
7117
  if (!db.cloud.isServiceWorkerDB) {
7121
- subscriptions.push(liveQuery(() => db.getCurrentUser()).subscribe(currentUserEmitter));
7118
+ subscriptions.push(liveQuery(() => db.getCurrentUser().then(user => {
7119
+ if (!user.isLoggedIn && typeof location !== 'undefined' && /dxc-auth\=/.test(location.search)) {
7120
+ // Still loading user because OAuth redirect just happened.
7121
+ // Keep isLoading true.
7122
+ return Object.assign(Object.assign({}, user), { isLoading: true });
7123
+ }
7124
+ return user;
7125
+ })).subscribe(currentUserEmitter));
7122
7126
  // Manage PersistendSyncState observable:
7123
7127
  subscriptions.push(liveQuery(() => db.getPersistedSyncState()).subscribe(db.cloud.persistedSyncState));
7124
7128
  // Wait till currentUser and persistedSyncState gets populated
@@ -7152,6 +7156,8 @@ function dexieCloud(dexie) {
7152
7156
  message: error.message,
7153
7157
  messageParams: { provider: error.provider || 'unknown' }
7154
7158
  });
7159
+ // Clean up URL (remove dxc-auth param)
7160
+ cleanupOAuthUrl();
7155
7161
  }
7156
7162
  catch (uiError) {
7157
7163
  console.error('[dexie-cloud] Failed to show OAuth error alert:', uiError);
@@ -7165,6 +7171,8 @@ function dexieCloud(dexie) {
7165
7171
  try {
7166
7172
  changedUser = yield login(db, { oauthCode: code, provider });
7167
7173
  user = yield db.getCurrentUser();
7174
+ // Clean up URL (remove dxc-auth param)
7175
+ cleanupOAuthUrl();
7168
7176
  }
7169
7177
  catch (error) {
7170
7178
  console.error('[dexie-cloud] OAuth login failed:', error);
@@ -7259,7 +7267,7 @@ function dexieCloud(dexie) {
7259
7267
  }
7260
7268
  }
7261
7269
  // @ts-ignore
7262
- dexieCloud.version = "4.3.7";
7270
+ dexieCloud.version = "4.3.9";
7263
7271
  Dexie.Cloud = dexieCloud;
7264
7272
 
7265
7273
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };