dexie-cloud-addon 4.3.2 → 4.3.4
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/DexieCloudAPI.d.ts +12 -1
- package/dist/modern/dexie-cloud-addon.js +68 -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/dexie-cloud-client.d.ts +1 -1
- package/dist/modern/errors/OAuthRedirectError.d.ts +11 -0
- package/dist/modern/service-worker.js +68 -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 +69 -11
- 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 +69 -11
- 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.4, Fri Jan 23 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.
|
|
@@ -13781,7 +13808,7 @@
|
|
|
13781
13808
|
*
|
|
13782
13809
|
* ==========================================================================
|
|
13783
13810
|
*
|
|
13784
|
-
* Version 4.2.2,
|
|
13811
|
+
* Version 4.2.2, Fri Jan 23 2026
|
|
13785
13812
|
*
|
|
13786
13813
|
* https://dexie.org
|
|
13787
13814
|
*
|
|
@@ -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.4",
|
|
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
|
},
|
|
@@ -18179,6 +18213,16 @@
|
|
|
18179
18213
|
: yield logout(DexieCloudDB(dexie));
|
|
18180
18214
|
});
|
|
18181
18215
|
},
|
|
18216
|
+
getAuthProviders() {
|
|
18217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18218
|
+
const options = dexie.cloud.options;
|
|
18219
|
+
if (!(options === null || options === void 0 ? void 0 : options.databaseUrl)) {
|
|
18220
|
+
throw new Error('Dexie Cloud not configured. Call db.cloud.configure() first.');
|
|
18221
|
+
}
|
|
18222
|
+
const socialAuthEnabled = options.socialAuth !== false;
|
|
18223
|
+
return fetchAuthProviders(options.databaseUrl, socialAuthEnabled);
|
|
18224
|
+
});
|
|
18225
|
+
},
|
|
18182
18226
|
sync() {
|
|
18183
18227
|
return __awaiter(this, arguments, void 0, function* ({ wait, purpose } = { wait: true, purpose: 'push' }) {
|
|
18184
18228
|
var _a;
|
|
@@ -18364,7 +18408,20 @@
|
|
|
18364
18408
|
}
|
|
18365
18409
|
// HERE: If requireAuth, do athentication now.
|
|
18366
18410
|
let changedUser = false;
|
|
18367
|
-
|
|
18411
|
+
let user = yield db.getCurrentUser();
|
|
18412
|
+
// Show pending OAuth error if present (from dxc-auth redirect)
|
|
18413
|
+
if (pendingOAuthError && !db.cloud.isServiceWorkerDB) {
|
|
18414
|
+
const error = pendingOAuthError;
|
|
18415
|
+
pendingOAuthError = null; // Clear pending error
|
|
18416
|
+
console.debug('[dexie-cloud] Showing OAuth error:', error.message);
|
|
18417
|
+
// Show alert to user about the OAuth error
|
|
18418
|
+
yield alertUser(db.cloud.userInteraction, 'Authentication Error', {
|
|
18419
|
+
type: 'error',
|
|
18420
|
+
messageCode: 'GENERIC_ERROR',
|
|
18421
|
+
message: error.message,
|
|
18422
|
+
messageParams: { provider: error.provider || 'unknown' }
|
|
18423
|
+
});
|
|
18424
|
+
}
|
|
18368
18425
|
// Process pending OAuth callback if present (from dxc-auth redirect)
|
|
18369
18426
|
if (pendingOAuthCode && !db.cloud.isServiceWorkerDB) {
|
|
18370
18427
|
const { code, provider } = pendingOAuthCode;
|
|
@@ -18372,6 +18429,7 @@
|
|
|
18372
18429
|
console.debug('[dexie-cloud] Processing OAuth callback, provider:', provider);
|
|
18373
18430
|
try {
|
|
18374
18431
|
changedUser = yield login(db, { oauthCode: code, provider });
|
|
18432
|
+
user = yield db.getCurrentUser();
|
|
18375
18433
|
}
|
|
18376
18434
|
catch (error) {
|
|
18377
18435
|
console.error('[dexie-cloud] OAuth login failed:', error);
|
|
@@ -18466,7 +18524,7 @@
|
|
|
18466
18524
|
}
|
|
18467
18525
|
}
|
|
18468
18526
|
// @ts-ignore
|
|
18469
|
-
dexieCloud.version = "4.3.
|
|
18527
|
+
dexieCloud.version = "4.3.4";
|
|
18470
18528
|
Dexie.Cloud = dexieCloud;
|
|
18471
18529
|
|
|
18472
18530
|
exports.default = dexieCloud;
|