dexie-cloud-addon 4.0.1-beta.57 → 4.0.1-beta.58
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 +17 -8
- 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/service-worker.js +17 -8
- 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 +17 -8
- 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 +17 -8
- 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.0.1-beta.
|
|
11
|
+
* Version 4.0.1-beta.58, Tue Feb 20 2024
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -2602,11 +2602,16 @@ function login(db, hints) {
|
|
|
2602
2602
|
const origUserId = currentUser.userId;
|
|
2603
2603
|
if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
|
|
2604
2604
|
const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
|
|
2605
|
-
if (licenseStatus === 'ok' &&
|
|
2605
|
+
if (licenseStatus === 'ok' &&
|
|
2606
|
+
currentUser.accessToken &&
|
|
2607
|
+
(!currentUser.accessTokenExpiration ||
|
|
2608
|
+
currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
2606
2609
|
// Already authenticated according to given hints. And license is valid.
|
|
2607
2610
|
return false;
|
|
2608
2611
|
}
|
|
2609
|
-
if (currentUser.refreshToken &&
|
|
2612
|
+
if (currentUser.refreshToken &&
|
|
2613
|
+
(!currentUser.refreshTokenExpiration ||
|
|
2614
|
+
currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
2610
2615
|
// Refresh the token
|
|
2611
2616
|
yield loadAccessToken(db);
|
|
2612
2617
|
return false;
|
|
@@ -2618,7 +2623,8 @@ function login(db, hints) {
|
|
|
2618
2623
|
lastLogin: new Date(0),
|
|
2619
2624
|
});
|
|
2620
2625
|
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
2621
|
-
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
2626
|
+
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
2627
|
+
context.userId !== origUserId) {
|
|
2622
2628
|
// User was logged in before, but now logged in as another user.
|
|
2623
2629
|
yield logout(db);
|
|
2624
2630
|
}
|
|
@@ -2637,7 +2643,7 @@ function login(db, hints) {
|
|
|
2637
2643
|
yield setCurrentUser(db, context);
|
|
2638
2644
|
// Make sure to resync as the new login will be authorized
|
|
2639
2645
|
// for new realms.
|
|
2640
|
-
triggerSync(db,
|
|
2646
|
+
triggerSync(db, 'pull');
|
|
2641
2647
|
return context.userId !== origUserId;
|
|
2642
2648
|
});
|
|
2643
2649
|
}
|
|
@@ -6264,7 +6270,7 @@ function dexieCloud(dexie) {
|
|
|
6264
6270
|
const syncComplete = new Subject();
|
|
6265
6271
|
dexie.cloud = {
|
|
6266
6272
|
// @ts-ignore
|
|
6267
|
-
version: "4.0.1-beta.
|
|
6273
|
+
version: "4.0.1-beta.58",
|
|
6268
6274
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6269
6275
|
schema: null,
|
|
6270
6276
|
get currentUserId() {
|
|
@@ -6495,7 +6501,10 @@ function dexieCloud(dexie) {
|
|
|
6495
6501
|
// HERE: If requireAuth, do athentication now.
|
|
6496
6502
|
let changedUser = false;
|
|
6497
6503
|
if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
|
|
6498
|
-
|
|
6504
|
+
const user = yield db.getCurrentUser();
|
|
6505
|
+
if (!user.isLoggedIn) {
|
|
6506
|
+
changedUser = yield login(db);
|
|
6507
|
+
}
|
|
6499
6508
|
}
|
|
6500
6509
|
if (localSyncWorker)
|
|
6501
6510
|
localSyncWorker.stop();
|
|
@@ -6541,7 +6550,7 @@ function dexieCloud(dexie) {
|
|
|
6541
6550
|
}
|
|
6542
6551
|
}
|
|
6543
6552
|
// @ts-ignore
|
|
6544
|
-
dexieCloud.version = "4.0.1-beta.
|
|
6553
|
+
dexieCloud.version = "4.0.1-beta.58";
|
|
6545
6554
|
Dexie.Cloud = dexieCloud;
|
|
6546
6555
|
|
|
6547
6556
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|