dexie-cloud-addon 4.3.8 → 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,5 +20,5 @@ export interface UserLogin {
20
20
  publicKey?: CryptoKey;
21
21
  isLoggedIn?: boolean;
22
22
  data?: any;
23
- oauthInProgress?: boolean;
23
+ isLoading?: boolean;
24
24
  }
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.3.8, Thu Jan 29 2026
11
+ * Version 4.3.9, Thu Jan 29 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6068,9 +6068,7 @@ function associate(factory) {
6068
6068
  };
6069
6069
  }
6070
6070
 
6071
- const isOathCallback = typeof location !== 'undefined' && !!(new URL(location.href)).searchParams.get('dxc-auth');
6072
- const getCurrentUserEmitter = associate((db) => new BehaviorSubject(isOathCallback
6073
- ? Object.assign(Object.assign({}, UNAUTHORIZED_USER), { oauthInProgress: true }) : UNAUTHORIZED_USER));
6071
+ const getCurrentUserEmitter = associate((db) => new BehaviorSubject(Object.assign(Object.assign({}, UNAUTHORIZED_USER), { isLoading: true })));
6074
6072
 
6075
6073
  function computeSyncState(db) {
6076
6074
  let _prevStatus = db.cloud.webSocketStatus.value;
@@ -6876,7 +6874,7 @@ function dexieCloud(dexie) {
6876
6874
  const syncComplete = new Subject();
6877
6875
  dexie.cloud = {
6878
6876
  // @ts-ignore
6879
- version: "4.3.8",
6877
+ version: "4.3.9",
6880
6878
  options: Object.assign({}, DEFAULT_OPTIONS),
6881
6879
  schema: null,
6882
6880
  get currentUserId() {
@@ -7117,7 +7115,14 @@ function dexieCloud(dexie) {
7117
7115
  // Manage CurrentUser observable:
7118
7116
  throwIfClosed();
7119
7117
  if (!db.cloud.isServiceWorkerDB) {
7120
- 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));
7121
7126
  // Manage PersistendSyncState observable:
7122
7127
  subscriptions.push(liveQuery(() => db.getPersistedSyncState()).subscribe(db.cloud.persistedSyncState));
7123
7128
  // Wait till currentUser and persistedSyncState gets populated
@@ -7153,7 +7158,6 @@ function dexieCloud(dexie) {
7153
7158
  });
7154
7159
  // Clean up URL (remove dxc-auth param)
7155
7160
  cleanupOAuthUrl();
7156
- currentUserEmitter.next(Object.assign(Object.assign({}, currentUserEmitter.value), { oauthInProgress: false }));
7157
7161
  }
7158
7162
  catch (uiError) {
7159
7163
  console.error('[dexie-cloud] Failed to show OAuth error alert:', uiError);
@@ -7263,7 +7267,7 @@ function dexieCloud(dexie) {
7263
7267
  }
7264
7268
  }
7265
7269
  // @ts-ignore
7266
- dexieCloud.version = "4.3.8";
7270
+ dexieCloud.version = "4.3.9";
7267
7271
  Dexie.Cloud = dexieCloud;
7268
7272
 
7269
7273
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };