dexie-cloud-addon 4.3.6 → 4.3.7

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.3.6, Wed Jan 28 2026
11
+ * Version 4.3.7, Wed Jan 28 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -14809,7 +14809,21 @@
14809
14809
  }
14810
14810
  // Handle OAuth provider login via redirect
14811
14811
  if (hints === null || hints === void 0 ? void 0 : hints.provider) {
14812
- initiateOAuthRedirect(db, hints.provider);
14812
+ let resolvedRedirectUri = undefined;
14813
+ if (hints.redirectPath) {
14814
+ // If redirectPath is absolute, use as is. If relative, resolve against current location
14815
+ if (/^https?:\/\//i.test(hints.redirectPath)) {
14816
+ resolvedRedirectUri = hints.redirectPath;
14817
+ }
14818
+ else if (typeof window !== 'undefined' && window.location) {
14819
+ // Use URL constructor to resolve relative path
14820
+ resolvedRedirectUri = new URL(hints.redirectPath, window.location.href).toString();
14821
+ }
14822
+ else if (typeof location !== 'undefined' && location.href) {
14823
+ resolvedRedirectUri = new URL(hints.redirectPath, location.href).toString();
14824
+ }
14825
+ }
14826
+ initiateOAuthRedirect(db, hints.provider, resolvedRedirectUri);
14813
14827
  // This function never returns - page navigates away
14814
14828
  throw new OAuthRedirectError(hints.provider);
14815
14829
  }
@@ -14954,12 +14968,13 @@
14954
14968
  * the user is redirected back with a dxc-auth query parameter that is
14955
14969
  * automatically detected by db.cloud.configure().
14956
14970
  */
14957
- function initiateOAuthRedirect(db, provider) {
14971
+ function initiateOAuthRedirect(db, provider, redirectUriOverride) {
14958
14972
  var _a, _b;
14959
14973
  const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
14960
14974
  if (!url)
14961
14975
  throw new Error(`No database URL given.`);
14962
- const redirectUri = ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
14976
+ const redirectUri = redirectUriOverride ||
14977
+ ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
14963
14978
  (typeof location !== 'undefined' ? location.href : undefined);
14964
14979
  // CodeRabbit suggested to fail fast here, but the only situation where
14965
14980
  // redirectUri would be undefined is in non-browser environments, and
@@ -17918,7 +17933,7 @@
17918
17933
  const syncComplete = new rxjs.Subject();
17919
17934
  dexie.cloud = {
17920
17935
  // @ts-ignore
17921
- version: "4.3.6",
17936
+ version: "4.3.7",
17922
17937
  options: Object.assign({}, DEFAULT_OPTIONS),
17923
17938
  schema: null,
17924
17939
  get currentUserId() {
@@ -18303,7 +18318,7 @@
18303
18318
  }
18304
18319
  }
18305
18320
  // @ts-ignore
18306
- dexieCloud.version = "4.3.6";
18321
+ dexieCloud.version = "4.3.7";
18307
18322
  Dexie.Cloud = dexieCloud;
18308
18323
 
18309
18324
  // In case the SW lives for a while, let it reuse already opened connections: