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
|
*
|
|
@@ -2325,6 +2325,21 @@
|
|
|
2325
2325
|
});
|
|
2326
2326
|
}
|
|
2327
2327
|
|
|
2328
|
+
/**
|
|
2329
|
+
* Error thrown when initiating an OAuth redirect.
|
|
2330
|
+
*
|
|
2331
|
+
* This is not a real error - it's used to signal that the page is
|
|
2332
|
+
* navigating away to an OAuth provider. It should be caught and
|
|
2333
|
+
* silently ignored at the appropriate level.
|
|
2334
|
+
*/
|
|
2335
|
+
class OAuthRedirectError extends Error {
|
|
2336
|
+
constructor(provider) {
|
|
2337
|
+
super(`OAuth redirect initiated for provider: ${provider}`);
|
|
2338
|
+
this.name = 'OAuthRedirectError';
|
|
2339
|
+
this.provider = provider;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2328
2343
|
function loadAccessToken(db) {
|
|
2329
2344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2330
2345
|
var _a, _b, _c;
|
|
@@ -2492,6 +2507,10 @@
|
|
|
2492
2507
|
return context;
|
|
2493
2508
|
}
|
|
2494
2509
|
catch (error) {
|
|
2510
|
+
// OAuth redirect is not an error - page is navigating away
|
|
2511
|
+
if (error instanceof OAuthRedirectError || (error === null || error === void 0 ? void 0 : error.name) === 'OAuthRedirectError') {
|
|
2512
|
+
throw error; // Re-throw without logging
|
|
2513
|
+
}
|
|
2495
2514
|
if (error instanceof TokenErrorResponseError) {
|
|
2496
2515
|
yield alertUser(userInteraction, error.title, {
|
|
2497
2516
|
type: 'error',
|
|
@@ -2854,7 +2873,7 @@
|
|
|
2854
2873
|
if (hints === null || hints === void 0 ? void 0 : hints.provider) {
|
|
2855
2874
|
initiateOAuthRedirect(db, hints.provider);
|
|
2856
2875
|
// This function never returns - page navigates away
|
|
2857
|
-
throw new
|
|
2876
|
+
throw new OAuthRedirectError(hints.provider);
|
|
2858
2877
|
}
|
|
2859
2878
|
if ((hints === null || hints === void 0 ? void 0 : hints.grant_type) === 'demo') {
|
|
2860
2879
|
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));
|
|
@@ -2889,7 +2908,7 @@
|
|
|
2889
2908
|
// User selected an OAuth provider - initiate redirect
|
|
2890
2909
|
initiateOAuthRedirect(db, selection.provider);
|
|
2891
2910
|
// This function never returns - page navigates away
|
|
2892
|
-
throw new
|
|
2911
|
+
throw new OAuthRedirectError(selection.provider);
|
|
2893
2912
|
}
|
|
2894
2913
|
// User chose OTP - continue with email prompt below
|
|
2895
2914
|
}
|
|
@@ -3078,7 +3097,15 @@
|
|
|
3078
3097
|
claims: {},
|
|
3079
3098
|
lastLogin: new Date(0),
|
|
3080
3099
|
});
|
|
3081
|
-
|
|
3100
|
+
try {
|
|
3101
|
+
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
3102
|
+
}
|
|
3103
|
+
catch (err) {
|
|
3104
|
+
if (err.name === 'OAuthRedirectError') {
|
|
3105
|
+
return false; // Page is redirecting for OAuth login
|
|
3106
|
+
}
|
|
3107
|
+
throw err;
|
|
3108
|
+
}
|
|
3082
3109
|
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
3083
3110
|
context.userId !== origUserId) {
|
|
3084
3111
|
// User was logged in before, but now logged in as another user.
|
|
@@ -17234,7 +17261,7 @@
|
|
|
17234
17261
|
} }))))))),
|
|
17235
17262
|
_$1("div", { style: Styles.ButtonsDiv },
|
|
17236
17263
|
_$1(k$1, null,
|
|
17237
|
-
hasFields &&
|
|
17264
|
+
submitLabel && (hasFields || (!hasOptions && !hasFields)) && (_$1("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel)),
|
|
17238
17265
|
cancelLabel && (_$1("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
|
|
17239
17266
|
}
|
|
17240
17267
|
function valueTransformer(type, value) {
|
|
@@ -18087,6 +18114,8 @@
|
|
|
18087
18114
|
let configuredProgramatically = false;
|
|
18088
18115
|
// Pending OAuth auth code from dxc-auth redirect (detected in configure())
|
|
18089
18116
|
let pendingOAuthCode = null;
|
|
18117
|
+
// Pending OAuth error from dxc-auth redirect (detected in configure())
|
|
18118
|
+
let pendingOAuthError = null;
|
|
18090
18119
|
// local sync worker - used when there's no service worker.
|
|
18091
18120
|
let localSyncWorker = null;
|
|
18092
18121
|
dexie.on('ready', (dexie) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -18116,7 +18145,7 @@
|
|
|
18116
18145
|
const syncComplete = new rxjs.Subject();
|
|
18117
18146
|
dexie.cloud = {
|
|
18118
18147
|
// @ts-ignore
|
|
18119
|
-
version: "4.3.
|
|
18148
|
+
version: "4.3.3",
|
|
18120
18149
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
18121
18150
|
schema: null,
|
|
18122
18151
|
get currentUserId() {
|
|
@@ -18166,9 +18195,14 @@
|
|
|
18166
18195
|
}
|
|
18167
18196
|
catch (error) {
|
|
18168
18197
|
// parseOAuthCallback throws OAuthError on error callbacks
|
|
18169
|
-
// Store null for code but log the error
|
|
18170
|
-
console.warn('[dexie-cloud] OAuth callback error:', error);
|
|
18171
18198
|
cleanupOAuthUrl();
|
|
18199
|
+
if (error instanceof OAuthError) {
|
|
18200
|
+
pendingOAuthError = error;
|
|
18201
|
+
console.error('[dexie-cloud] OAuth callback error:', error.message);
|
|
18202
|
+
}
|
|
18203
|
+
else {
|
|
18204
|
+
console.error('[dexie-cloud] OAuth callback error:', error);
|
|
18205
|
+
}
|
|
18172
18206
|
}
|
|
18173
18207
|
}
|
|
18174
18208
|
},
|
|
@@ -18364,7 +18398,20 @@
|
|
|
18364
18398
|
}
|
|
18365
18399
|
// HERE: If requireAuth, do athentication now.
|
|
18366
18400
|
let changedUser = false;
|
|
18367
|
-
|
|
18401
|
+
let user = yield db.getCurrentUser();
|
|
18402
|
+
// Show pending OAuth error if present (from dxc-auth redirect)
|
|
18403
|
+
if (pendingOAuthError && !db.cloud.isServiceWorkerDB) {
|
|
18404
|
+
const error = pendingOAuthError;
|
|
18405
|
+
pendingOAuthError = null; // Clear pending error
|
|
18406
|
+
console.debug('[dexie-cloud] Showing OAuth error:', error.message);
|
|
18407
|
+
// Show alert to user about the OAuth error
|
|
18408
|
+
yield alertUser(db.cloud.userInteraction, 'Authentication Error', {
|
|
18409
|
+
type: 'error',
|
|
18410
|
+
messageCode: 'GENERIC_ERROR',
|
|
18411
|
+
message: error.message,
|
|
18412
|
+
messageParams: { provider: error.provider || 'unknown' }
|
|
18413
|
+
});
|
|
18414
|
+
}
|
|
18368
18415
|
// Process pending OAuth callback if present (from dxc-auth redirect)
|
|
18369
18416
|
if (pendingOAuthCode && !db.cloud.isServiceWorkerDB) {
|
|
18370
18417
|
const { code, provider } = pendingOAuthCode;
|
|
@@ -18372,6 +18419,7 @@
|
|
|
18372
18419
|
console.debug('[dexie-cloud] Processing OAuth callback, provider:', provider);
|
|
18373
18420
|
try {
|
|
18374
18421
|
changedUser = yield login(db, { oauthCode: code, provider });
|
|
18422
|
+
user = yield db.getCurrentUser();
|
|
18375
18423
|
}
|
|
18376
18424
|
catch (error) {
|
|
18377
18425
|
console.error('[dexie-cloud] OAuth login failed:', error);
|
|
@@ -18466,7 +18514,7 @@
|
|
|
18466
18514
|
}
|
|
18467
18515
|
}
|
|
18468
18516
|
// @ts-ignore
|
|
18469
|
-
dexieCloud.version = "4.3.
|
|
18517
|
+
dexieCloud.version = "4.3.3";
|
|
18470
18518
|
Dexie.Cloud = dexieCloud;
|
|
18471
18519
|
|
|
18472
18520
|
exports.default = dexieCloud;
|