dexie-cloud-addon 4.3.2 → 4.3.3
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.
- package/dist/modern/dexie-cloud-addon.js +58 -10
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/errors/OAuthRedirectError.d.ts +11 -0
- package/dist/modern/service-worker.js +58 -10
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.js +58 -10
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +58 -10
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.3.
|
|
11
|
+
* Version 4.3.3, Thu Jan 22 2026
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -1025,6 +1025,21 @@ function promptForProvider(userInteraction_1, providers_1, otpEnabled_1) {
|
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* Error thrown when initiating an OAuth redirect.
|
|
1030
|
+
*
|
|
1031
|
+
* This is not a real error - it's used to signal that the page is
|
|
1032
|
+
* navigating away to an OAuth provider. It should be caught and
|
|
1033
|
+
* silently ignored at the appropriate level.
|
|
1034
|
+
*/
|
|
1035
|
+
class OAuthRedirectError extends Error {
|
|
1036
|
+
constructor(provider) {
|
|
1037
|
+
super(`OAuth redirect initiated for provider: ${provider}`);
|
|
1038
|
+
this.name = 'OAuthRedirectError';
|
|
1039
|
+
this.provider = provider;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1028
1043
|
function loadAccessToken(db) {
|
|
1029
1044
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1030
1045
|
var _a, _b, _c;
|
|
@@ -1192,6 +1207,10 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
|
|
|
1192
1207
|
return context;
|
|
1193
1208
|
}
|
|
1194
1209
|
catch (error) {
|
|
1210
|
+
// OAuth redirect is not an error - page is navigating away
|
|
1211
|
+
if (error instanceof OAuthRedirectError || (error === null || error === void 0 ? void 0 : error.name) === 'OAuthRedirectError') {
|
|
1212
|
+
throw error; // Re-throw without logging
|
|
1213
|
+
}
|
|
1195
1214
|
if (error instanceof TokenErrorResponseError) {
|
|
1196
1215
|
yield alertUser(userInteraction, error.title, {
|
|
1197
1216
|
type: 'error',
|
|
@@ -1554,7 +1573,7 @@ function otpFetchTokenCallback(db) {
|
|
|
1554
1573
|
if (hints === null || hints === void 0 ? void 0 : hints.provider) {
|
|
1555
1574
|
initiateOAuthRedirect(db, hints.provider);
|
|
1556
1575
|
// This function never returns - page navigates away
|
|
1557
|
-
throw new
|
|
1576
|
+
throw new OAuthRedirectError(hints.provider);
|
|
1558
1577
|
}
|
|
1559
1578
|
if ((hints === null || hints === void 0 ? void 0 : hints.grant_type) === 'demo') {
|
|
1560
1579
|
const demo_user = yield promptForEmail(userInteraction, 'Enter a demo user email', (hints === null || hints === void 0 ? void 0 : hints.email) || (hints === null || hints === void 0 ? void 0 : hints.userId));
|
|
@@ -1589,7 +1608,7 @@ function otpFetchTokenCallback(db) {
|
|
|
1589
1608
|
// User selected an OAuth provider - initiate redirect
|
|
1590
1609
|
initiateOAuthRedirect(db, selection.provider);
|
|
1591
1610
|
// This function never returns - page navigates away
|
|
1592
|
-
throw new
|
|
1611
|
+
throw new OAuthRedirectError(selection.provider);
|
|
1593
1612
|
}
|
|
1594
1613
|
// User chose OTP - continue with email prompt below
|
|
1595
1614
|
}
|
|
@@ -1778,7 +1797,15 @@ function login(db, hints) {
|
|
|
1778
1797
|
claims: {},
|
|
1779
1798
|
lastLogin: new Date(0),
|
|
1780
1799
|
});
|
|
1781
|
-
|
|
1800
|
+
try {
|
|
1801
|
+
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
1802
|
+
}
|
|
1803
|
+
catch (err) {
|
|
1804
|
+
if (err.name === 'OAuthRedirectError') {
|
|
1805
|
+
return false; // Page is redirecting for OAuth login
|
|
1806
|
+
}
|
|
1807
|
+
throw err;
|
|
1808
|
+
}
|
|
1782
1809
|
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
1783
1810
|
context.userId !== origUserId) {
|
|
1784
1811
|
// User was logged in before, but now logged in as another user.
|
|
@@ -6004,7 +6031,7 @@ function LoginDialog({ title, alerts, fields, options, submitLabel, cancelLabel,
|
|
|
6004
6031
|
} }))))))),
|
|
6005
6032
|
_$1("div", { style: Styles.ButtonsDiv },
|
|
6006
6033
|
_$1(k$1, null,
|
|
6007
|
-
hasFields &&
|
|
6034
|
+
submitLabel && (hasFields || (!hasOptions && !hasFields)) && (_$1("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel)),
|
|
6008
6035
|
cancelLabel && (_$1("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
|
|
6009
6036
|
}
|
|
6010
6037
|
function valueTransformer(type, value) {
|
|
@@ -6857,6 +6884,8 @@ function dexieCloud(dexie) {
|
|
|
6857
6884
|
let configuredProgramatically = false;
|
|
6858
6885
|
// Pending OAuth auth code from dxc-auth redirect (detected in configure())
|
|
6859
6886
|
let pendingOAuthCode = null;
|
|
6887
|
+
// Pending OAuth error from dxc-auth redirect (detected in configure())
|
|
6888
|
+
let pendingOAuthError = null;
|
|
6860
6889
|
// local sync worker - used when there's no service worker.
|
|
6861
6890
|
let localSyncWorker = null;
|
|
6862
6891
|
dexie.on('ready', (dexie) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -6886,7 +6915,7 @@ function dexieCloud(dexie) {
|
|
|
6886
6915
|
const syncComplete = new Subject();
|
|
6887
6916
|
dexie.cloud = {
|
|
6888
6917
|
// @ts-ignore
|
|
6889
|
-
version: "4.3.
|
|
6918
|
+
version: "4.3.3",
|
|
6890
6919
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6891
6920
|
schema: null,
|
|
6892
6921
|
get currentUserId() {
|
|
@@ -6936,9 +6965,14 @@ function dexieCloud(dexie) {
|
|
|
6936
6965
|
}
|
|
6937
6966
|
catch (error) {
|
|
6938
6967
|
// parseOAuthCallback throws OAuthError on error callbacks
|
|
6939
|
-
// Store null for code but log the error
|
|
6940
|
-
console.warn('[dexie-cloud] OAuth callback error:', error);
|
|
6941
6968
|
cleanupOAuthUrl();
|
|
6969
|
+
if (error instanceof OAuthError) {
|
|
6970
|
+
pendingOAuthError = error;
|
|
6971
|
+
console.error('[dexie-cloud] OAuth callback error:', error.message);
|
|
6972
|
+
}
|
|
6973
|
+
else {
|
|
6974
|
+
console.error('[dexie-cloud] OAuth callback error:', error);
|
|
6975
|
+
}
|
|
6942
6976
|
}
|
|
6943
6977
|
}
|
|
6944
6978
|
},
|
|
@@ -7134,7 +7168,20 @@ function dexieCloud(dexie) {
|
|
|
7134
7168
|
}
|
|
7135
7169
|
// HERE: If requireAuth, do athentication now.
|
|
7136
7170
|
let changedUser = false;
|
|
7137
|
-
|
|
7171
|
+
let user = yield db.getCurrentUser();
|
|
7172
|
+
// Show pending OAuth error if present (from dxc-auth redirect)
|
|
7173
|
+
if (pendingOAuthError && !db.cloud.isServiceWorkerDB) {
|
|
7174
|
+
const error = pendingOAuthError;
|
|
7175
|
+
pendingOAuthError = null; // Clear pending error
|
|
7176
|
+
console.debug('[dexie-cloud] Showing OAuth error:', error.message);
|
|
7177
|
+
// Show alert to user about the OAuth error
|
|
7178
|
+
yield alertUser(db.cloud.userInteraction, 'Authentication Error', {
|
|
7179
|
+
type: 'error',
|
|
7180
|
+
messageCode: 'GENERIC_ERROR',
|
|
7181
|
+
message: error.message,
|
|
7182
|
+
messageParams: { provider: error.provider || 'unknown' }
|
|
7183
|
+
});
|
|
7184
|
+
}
|
|
7138
7185
|
// Process pending OAuth callback if present (from dxc-auth redirect)
|
|
7139
7186
|
if (pendingOAuthCode && !db.cloud.isServiceWorkerDB) {
|
|
7140
7187
|
const { code, provider } = pendingOAuthCode;
|
|
@@ -7142,6 +7189,7 @@ function dexieCloud(dexie) {
|
|
|
7142
7189
|
console.debug('[dexie-cloud] Processing OAuth callback, provider:', provider);
|
|
7143
7190
|
try {
|
|
7144
7191
|
changedUser = yield login(db, { oauthCode: code, provider });
|
|
7192
|
+
user = yield db.getCurrentUser();
|
|
7145
7193
|
}
|
|
7146
7194
|
catch (error) {
|
|
7147
7195
|
console.error('[dexie-cloud] OAuth login failed:', error);
|
|
@@ -7236,7 +7284,7 @@ function dexieCloud(dexie) {
|
|
|
7236
7284
|
}
|
|
7237
7285
|
}
|
|
7238
7286
|
// @ts-ignore
|
|
7239
|
-
dexieCloud.version = "4.3.
|
|
7287
|
+
dexieCloud.version = "4.3.3";
|
|
7240
7288
|
Dexie.Cloud = dexieCloud;
|
|
7241
7289
|
|
|
7242
7290
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|