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
  *
@@ -3841,7 +3841,21 @@ function otpFetchTokenCallback(db) {
3841
3841
  }
3842
3842
  // Handle OAuth provider login via redirect
3843
3843
  if (hints === null || hints === void 0 ? void 0 : hints.provider) {
3844
- initiateOAuthRedirect(db, hints.provider);
3844
+ let resolvedRedirectUri = undefined;
3845
+ if (hints.redirectPath) {
3846
+ // If redirectPath is absolute, use as is. If relative, resolve against current location
3847
+ if (/^https?:\/\//i.test(hints.redirectPath)) {
3848
+ resolvedRedirectUri = hints.redirectPath;
3849
+ }
3850
+ else if (typeof window !== 'undefined' && window.location) {
3851
+ // Use URL constructor to resolve relative path
3852
+ resolvedRedirectUri = new URL(hints.redirectPath, window.location.href).toString();
3853
+ }
3854
+ else if (typeof location !== 'undefined' && location.href) {
3855
+ resolvedRedirectUri = new URL(hints.redirectPath, location.href).toString();
3856
+ }
3857
+ }
3858
+ initiateOAuthRedirect(db, hints.provider, resolvedRedirectUri);
3845
3859
  // This function never returns - page navigates away
3846
3860
  throw new OAuthRedirectError(hints.provider);
3847
3861
  }
@@ -3986,12 +4000,13 @@ function otpFetchTokenCallback(db) {
3986
4000
  * the user is redirected back with a dxc-auth query parameter that is
3987
4001
  * automatically detected by db.cloud.configure().
3988
4002
  */
3989
- function initiateOAuthRedirect(db, provider) {
4003
+ function initiateOAuthRedirect(db, provider, redirectUriOverride) {
3990
4004
  var _a, _b;
3991
4005
  const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
3992
4006
  if (!url)
3993
4007
  throw new Error(`No database URL given.`);
3994
- const redirectUri = ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
4008
+ const redirectUri = redirectUriOverride ||
4009
+ ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
3995
4010
  (typeof location !== 'undefined' ? location.href : undefined);
3996
4011
  // CodeRabbit suggested to fail fast here, but the only situation where
3997
4012
  // redirectUri would be undefined is in non-browser environments, and
@@ -6688,7 +6703,7 @@ function dexieCloud(dexie) {
6688
6703
  const syncComplete = new Subject();
6689
6704
  dexie.cloud = {
6690
6705
  // @ts-ignore
6691
- version: "4.3.6",
6706
+ version: "4.3.7",
6692
6707
  options: Object.assign({}, DEFAULT_OPTIONS),
6693
6708
  schema: null,
6694
6709
  get currentUserId() {
@@ -7073,7 +7088,7 @@ function dexieCloud(dexie) {
7073
7088
  }
7074
7089
  }
7075
7090
  // @ts-ignore
7076
- dexieCloud.version = "4.3.6";
7091
+ dexieCloud.version = "4.3.7";
7077
7092
  Dexie.Cloud = dexieCloud;
7078
7093
 
7079
7094
  // In case the SW lives for a while, let it reuse already opened connections: