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
|
*
|
|
@@ -2709,6 +2709,21 @@
|
|
|
2709
2709
|
});
|
|
2710
2710
|
}
|
|
2711
2711
|
|
|
2712
|
+
/**
|
|
2713
|
+
* Error thrown when initiating an OAuth redirect.
|
|
2714
|
+
*
|
|
2715
|
+
* This is not a real error - it's used to signal that the page is
|
|
2716
|
+
* navigating away to an OAuth provider. It should be caught and
|
|
2717
|
+
* silently ignored at the appropriate level.
|
|
2718
|
+
*/
|
|
2719
|
+
class OAuthRedirectError extends Error {
|
|
2720
|
+
constructor(provider) {
|
|
2721
|
+
super(`OAuth redirect initiated for provider: ${provider}`);
|
|
2722
|
+
this.name = 'OAuthRedirectError';
|
|
2723
|
+
this.provider = provider;
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2712
2727
|
function loadAccessToken(db) {
|
|
2713
2728
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2714
2729
|
var _a, _b, _c;
|
|
@@ -2876,6 +2891,10 @@
|
|
|
2876
2891
|
return context;
|
|
2877
2892
|
}
|
|
2878
2893
|
catch (error) {
|
|
2894
|
+
// OAuth redirect is not an error - page is navigating away
|
|
2895
|
+
if (error instanceof OAuthRedirectError || (error === null || error === void 0 ? void 0 : error.name) === 'OAuthRedirectError') {
|
|
2896
|
+
throw error; // Re-throw without logging
|
|
2897
|
+
}
|
|
2879
2898
|
if (error instanceof TokenErrorResponseError) {
|
|
2880
2899
|
yield alertUser(userInteraction, error.title, {
|
|
2881
2900
|
type: 'error',
|
|
@@ -13242,7 +13261,7 @@
|
|
|
13242
13261
|
*
|
|
13243
13262
|
* ==========================================================================
|
|
13244
13263
|
*
|
|
13245
|
-
* Version 4.2.2,
|
|
13264
|
+
* Version 4.2.2, Fri Jan 23 2026
|
|
13246
13265
|
*
|
|
13247
13266
|
* https://dexie.org
|
|
13248
13267
|
*
|
|
@@ -14846,7 +14865,7 @@
|
|
|
14846
14865
|
if (hints === null || hints === void 0 ? void 0 : hints.provider) {
|
|
14847
14866
|
initiateOAuthRedirect(db, hints.provider);
|
|
14848
14867
|
// This function never returns - page navigates away
|
|
14849
|
-
throw new
|
|
14868
|
+
throw new OAuthRedirectError(hints.provider);
|
|
14850
14869
|
}
|
|
14851
14870
|
if ((hints === null || hints === void 0 ? void 0 : hints.grant_type) === 'demo') {
|
|
14852
14871
|
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));
|
|
@@ -14881,7 +14900,7 @@
|
|
|
14881
14900
|
// User selected an OAuth provider - initiate redirect
|
|
14882
14901
|
initiateOAuthRedirect(db, selection.provider);
|
|
14883
14902
|
// This function never returns - page navigates away
|
|
14884
|
-
throw new
|
|
14903
|
+
throw new OAuthRedirectError(selection.provider);
|
|
14885
14904
|
}
|
|
14886
14905
|
// User chose OTP - continue with email prompt below
|
|
14887
14906
|
}
|
|
@@ -15070,7 +15089,15 @@
|
|
|
15070
15089
|
claims: {},
|
|
15071
15090
|
lastLogin: new Date(0),
|
|
15072
15091
|
});
|
|
15073
|
-
|
|
15092
|
+
try {
|
|
15093
|
+
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
15094
|
+
}
|
|
15095
|
+
catch (err) {
|
|
15096
|
+
if (err.name === 'OAuthRedirectError') {
|
|
15097
|
+
return false; // Page is redirecting for OAuth login
|
|
15098
|
+
}
|
|
15099
|
+
throw err;
|
|
15100
|
+
}
|
|
15074
15101
|
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
15075
15102
|
context.userId !== origUserId) {
|
|
15076
15103
|
// 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) {
|
|
@@ -17916,6 +17943,8 @@
|
|
|
17916
17943
|
let configuredProgramatically = false;
|
|
17917
17944
|
// Pending OAuth auth code from dxc-auth redirect (detected in configure())
|
|
17918
17945
|
let pendingOAuthCode = null;
|
|
17946
|
+
// Pending OAuth error from dxc-auth redirect (detected in configure())
|
|
17947
|
+
let pendingOAuthError = null;
|
|
17919
17948
|
// local sync worker - used when there's no service worker.
|
|
17920
17949
|
let localSyncWorker = null;
|
|
17921
17950
|
dexie.on('ready', (dexie) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17945,7 +17974,7 @@
|
|
|
17945
17974
|
const syncComplete = new rxjs.Subject();
|
|
17946
17975
|
dexie.cloud = {
|
|
17947
17976
|
// @ts-ignore
|
|
17948
|
-
version: "4.3.
|
|
17977
|
+
version: "4.3.4",
|
|
17949
17978
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
17950
17979
|
schema: null,
|
|
17951
17980
|
get currentUserId() {
|
|
@@ -17995,9 +18024,14 @@
|
|
|
17995
18024
|
}
|
|
17996
18025
|
catch (error) {
|
|
17997
18026
|
// parseOAuthCallback throws OAuthError on error callbacks
|
|
17998
|
-
// Store null for code but log the error
|
|
17999
|
-
console.warn('[dexie-cloud] OAuth callback error:', error);
|
|
18000
18027
|
cleanupOAuthUrl();
|
|
18028
|
+
if (error instanceof OAuthError) {
|
|
18029
|
+
pendingOAuthError = error;
|
|
18030
|
+
console.error('[dexie-cloud] OAuth callback error:', error.message);
|
|
18031
|
+
}
|
|
18032
|
+
else {
|
|
18033
|
+
console.error('[dexie-cloud] OAuth callback error:', error);
|
|
18034
|
+
}
|
|
18001
18035
|
}
|
|
18002
18036
|
}
|
|
18003
18037
|
},
|
|
@@ -18008,6 +18042,16 @@
|
|
|
18008
18042
|
: yield logout(DexieCloudDB(dexie));
|
|
18009
18043
|
});
|
|
18010
18044
|
},
|
|
18045
|
+
getAuthProviders() {
|
|
18046
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18047
|
+
const options = dexie.cloud.options;
|
|
18048
|
+
if (!(options === null || options === void 0 ? void 0 : options.databaseUrl)) {
|
|
18049
|
+
throw new Error('Dexie Cloud not configured. Call db.cloud.configure() first.');
|
|
18050
|
+
}
|
|
18051
|
+
const socialAuthEnabled = options.socialAuth !== false;
|
|
18052
|
+
return fetchAuthProviders(options.databaseUrl, socialAuthEnabled);
|
|
18053
|
+
});
|
|
18054
|
+
},
|
|
18011
18055
|
sync() {
|
|
18012
18056
|
return __awaiter(this, arguments, void 0, function* ({ wait, purpose } = { wait: true, purpose: 'push' }) {
|
|
18013
18057
|
var _a;
|
|
@@ -18193,7 +18237,20 @@
|
|
|
18193
18237
|
}
|
|
18194
18238
|
// HERE: If requireAuth, do athentication now.
|
|
18195
18239
|
let changedUser = false;
|
|
18196
|
-
|
|
18240
|
+
let user = yield db.getCurrentUser();
|
|
18241
|
+
// Show pending OAuth error if present (from dxc-auth redirect)
|
|
18242
|
+
if (pendingOAuthError && !db.cloud.isServiceWorkerDB) {
|
|
18243
|
+
const error = pendingOAuthError;
|
|
18244
|
+
pendingOAuthError = null; // Clear pending error
|
|
18245
|
+
console.debug('[dexie-cloud] Showing OAuth error:', error.message);
|
|
18246
|
+
// Show alert to user about the OAuth error
|
|
18247
|
+
yield alertUser(db.cloud.userInteraction, 'Authentication Error', {
|
|
18248
|
+
type: 'error',
|
|
18249
|
+
messageCode: 'GENERIC_ERROR',
|
|
18250
|
+
message: error.message,
|
|
18251
|
+
messageParams: { provider: error.provider || 'unknown' }
|
|
18252
|
+
});
|
|
18253
|
+
}
|
|
18197
18254
|
// Process pending OAuth callback if present (from dxc-auth redirect)
|
|
18198
18255
|
if (pendingOAuthCode && !db.cloud.isServiceWorkerDB) {
|
|
18199
18256
|
const { code, provider } = pendingOAuthCode;
|
|
@@ -18201,6 +18258,7 @@
|
|
|
18201
18258
|
console.debug('[dexie-cloud] Processing OAuth callback, provider:', provider);
|
|
18202
18259
|
try {
|
|
18203
18260
|
changedUser = yield login(db, { oauthCode: code, provider });
|
|
18261
|
+
user = yield db.getCurrentUser();
|
|
18204
18262
|
}
|
|
18205
18263
|
catch (error) {
|
|
18206
18264
|
console.error('[dexie-cloud] OAuth login failed:', error);
|
|
@@ -18295,7 +18353,7 @@
|
|
|
18295
18353
|
}
|
|
18296
18354
|
}
|
|
18297
18355
|
// @ts-ignore
|
|
18298
|
-
dexieCloud.version = "4.3.
|
|
18356
|
+
dexieCloud.version = "4.3.4";
|
|
18299
18357
|
Dexie.Cloud = dexieCloud;
|
|
18300
18358
|
|
|
18301
18359
|
// In case the SW lives for a while, let it reuse already opened connections:
|