dexie-cloud-addon 4.3.7 → 4.3.8

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.
@@ -20,4 +20,5 @@ export interface UserLogin {
20
20
  publicKey?: CryptoKey;
21
21
  isLoggedIn?: boolean;
22
22
  data?: any;
23
+ oauthInProgress?: 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.8, Thu Jan 29 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6068,7 +6068,9 @@ function associate(factory) {
6068
6068
  };
6069
6069
  }
6070
6070
 
6071
- const getCurrentUserEmitter = associate((db) => new BehaviorSubject(UNAUTHORIZED_USER));
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));
6072
6074
 
6073
6075
  function computeSyncState(db) {
6074
6076
  let _prevStatus = db.cloud.webSocketStatus.value;
@@ -6874,7 +6876,7 @@ function dexieCloud(dexie) {
6874
6876
  const syncComplete = new Subject();
6875
6877
  dexie.cloud = {
6876
6878
  // @ts-ignore
6877
- version: "4.3.7",
6879
+ version: "4.3.8",
6878
6880
  options: Object.assign({}, DEFAULT_OPTIONS),
6879
6881
  schema: null,
6880
6882
  get currentUserId() {
@@ -6915,8 +6917,6 @@ function dexieCloud(dexie) {
6915
6917
  try {
6916
6918
  const callback = parseOAuthCallback();
6917
6919
  if (callback) {
6918
- // Clean up URL immediately (remove dxc-auth param)
6919
- cleanupOAuthUrl();
6920
6920
  // Store the pending auth code for processing when db is ready
6921
6921
  pendingOAuthCode = { code: callback.code, provider: callback.provider };
6922
6922
  console.debug('[dexie-cloud] OAuth callback detected, auth code stored for processing');
@@ -6924,7 +6924,6 @@ function dexieCloud(dexie) {
6924
6924
  }
6925
6925
  catch (error) {
6926
6926
  // parseOAuthCallback throws OAuthError on error callbacks
6927
- cleanupOAuthUrl();
6928
6927
  if (error instanceof OAuthError) {
6929
6928
  pendingOAuthError = error;
6930
6929
  console.error('[dexie-cloud] OAuth callback error:', error.message);
@@ -7152,6 +7151,9 @@ function dexieCloud(dexie) {
7152
7151
  message: error.message,
7153
7152
  messageParams: { provider: error.provider || 'unknown' }
7154
7153
  });
7154
+ // Clean up URL (remove dxc-auth param)
7155
+ cleanupOAuthUrl();
7156
+ currentUserEmitter.next(Object.assign(Object.assign({}, currentUserEmitter.value), { oauthInProgress: false }));
7155
7157
  }
7156
7158
  catch (uiError) {
7157
7159
  console.error('[dexie-cloud] Failed to show OAuth error alert:', uiError);
@@ -7165,6 +7167,8 @@ function dexieCloud(dexie) {
7165
7167
  try {
7166
7168
  changedUser = yield login(db, { oauthCode: code, provider });
7167
7169
  user = yield db.getCurrentUser();
7170
+ // Clean up URL (remove dxc-auth param)
7171
+ cleanupOAuthUrl();
7168
7172
  }
7169
7173
  catch (error) {
7170
7174
  console.error('[dexie-cloud] OAuth login failed:', error);
@@ -7259,7 +7263,7 @@ function dexieCloud(dexie) {
7259
7263
  }
7260
7264
  }
7261
7265
  // @ts-ignore
7262
- dexieCloud.version = "4.3.7";
7266
+ dexieCloud.version = "4.3.8";
7263
7267
  Dexie.Cloud = dexieCloud;
7264
7268
 
7265
7269
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };