dexie-cloud-addon 4.0.1-beta.56 → 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 +20 -11
- 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 +20 -11
- 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 +20 -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 +20 -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 +2 -2
|
@@ -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
|
*
|
|
@@ -2501,7 +2501,7 @@
|
|
|
2501
2501
|
if (response.type !== 'otp-sent')
|
|
2502
2502
|
throw new Error(`Unexpected response from ${url}/token`);
|
|
2503
2503
|
const otp = yield promptForOTP(userInteraction, tokenRequest.email);
|
|
2504
|
-
const tokenRequest2 = Object.assign(Object.assign({}, tokenRequest), { otp: otp || '', otp_id: response.otp_id });
|
|
2504
|
+
const tokenRequest2 = Object.assign(Object.assign({}, tokenRequest), { otp: otp || '', otp_id: response.otp_id, public_key });
|
|
2505
2505
|
let res2 = yield fetch(`${url}/token`, {
|
|
2506
2506
|
body: JSON.stringify(tokenRequest2),
|
|
2507
2507
|
method: 'post',
|
|
@@ -2605,11 +2605,16 @@
|
|
|
2605
2605
|
const origUserId = currentUser.userId;
|
|
2606
2606
|
if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
|
|
2607
2607
|
const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
|
|
2608
|
-
if (licenseStatus === 'ok' &&
|
|
2608
|
+
if (licenseStatus === 'ok' &&
|
|
2609
|
+
currentUser.accessToken &&
|
|
2610
|
+
(!currentUser.accessTokenExpiration ||
|
|
2611
|
+
currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
2609
2612
|
// Already authenticated according to given hints. And license is valid.
|
|
2610
2613
|
return false;
|
|
2611
2614
|
}
|
|
2612
|
-
if (currentUser.refreshToken &&
|
|
2615
|
+
if (currentUser.refreshToken &&
|
|
2616
|
+
(!currentUser.refreshTokenExpiration ||
|
|
2617
|
+
currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
2613
2618
|
// Refresh the token
|
|
2614
2619
|
yield loadAccessToken(db);
|
|
2615
2620
|
return false;
|
|
@@ -2621,7 +2626,8 @@
|
|
|
2621
2626
|
lastLogin: new Date(0),
|
|
2622
2627
|
});
|
|
2623
2628
|
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
2624
|
-
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
2629
|
+
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
2630
|
+
context.userId !== origUserId) {
|
|
2625
2631
|
// User was logged in before, but now logged in as another user.
|
|
2626
2632
|
yield logout(db);
|
|
2627
2633
|
}
|
|
@@ -2640,7 +2646,7 @@
|
|
|
2640
2646
|
yield setCurrentUser(db, context);
|
|
2641
2647
|
// Make sure to resync as the new login will be authorized
|
|
2642
2648
|
// for new realms.
|
|
2643
|
-
triggerSync(db,
|
|
2649
|
+
triggerSync(db, 'pull');
|
|
2644
2650
|
return context.userId !== origUserId;
|
|
2645
2651
|
});
|
|
2646
2652
|
}
|
|
@@ -3622,7 +3628,7 @@
|
|
|
3622
3628
|
const res = yield fetch(`${databaseUrl}/sync`, {
|
|
3623
3629
|
method: 'post',
|
|
3624
3630
|
headers,
|
|
3625
|
-
credentials: 'include',
|
|
3631
|
+
credentials: 'include', // For Arr Affinity cookie only, for better Rate-Limit counting only.
|
|
3626
3632
|
body: TSON.stringify(syncRequest),
|
|
3627
3633
|
});
|
|
3628
3634
|
//const contentLength = Number(res.headers.get('content-length'));
|
|
@@ -5586,7 +5592,7 @@
|
|
|
5586
5592
|
retryPurpose = null;
|
|
5587
5593
|
syncIfPossible(db, cloudOptions, cloudSchema, {
|
|
5588
5594
|
cancelToken,
|
|
5589
|
-
retryImmediatelyOnFetchError: true,
|
|
5595
|
+
retryImmediatelyOnFetchError: true, // workaround for "net::ERR_NETWORK_CHANGED" in chrome.
|
|
5590
5596
|
purpose: combPurpose,
|
|
5591
5597
|
}).catch((e) => {
|
|
5592
5598
|
console.error('error in syncIfPossible()', e);
|
|
@@ -6267,7 +6273,7 @@
|
|
|
6267
6273
|
const syncComplete = new rxjs.Subject();
|
|
6268
6274
|
dexie.cloud = {
|
|
6269
6275
|
// @ts-ignore
|
|
6270
|
-
version: "4.0.1-beta.
|
|
6276
|
+
version: "4.0.1-beta.58",
|
|
6271
6277
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6272
6278
|
schema: null,
|
|
6273
6279
|
get currentUserId() {
|
|
@@ -6498,7 +6504,10 @@
|
|
|
6498
6504
|
// HERE: If requireAuth, do athentication now.
|
|
6499
6505
|
let changedUser = false;
|
|
6500
6506
|
if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
|
|
6501
|
-
|
|
6507
|
+
const user = yield db.getCurrentUser();
|
|
6508
|
+
if (!user.isLoggedIn) {
|
|
6509
|
+
changedUser = yield login(db);
|
|
6510
|
+
}
|
|
6502
6511
|
}
|
|
6503
6512
|
if (localSyncWorker)
|
|
6504
6513
|
localSyncWorker.stop();
|
|
@@ -6544,7 +6553,7 @@
|
|
|
6544
6553
|
}
|
|
6545
6554
|
}
|
|
6546
6555
|
// @ts-ignore
|
|
6547
|
-
dexieCloud.version = "4.0.1-beta.
|
|
6556
|
+
dexieCloud.version = "4.0.1-beta.58";
|
|
6548
6557
|
Dexie.Cloud = dexieCloud;
|
|
6549
6558
|
|
|
6550
6559
|
exports.default = dexieCloud;
|