dexie-cloud-addon 4.0.1-beta.58 → 4.0.1-rc.1
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 +32 -20
- 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 +32 -20
- 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 +31 -19
- 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 +31 -19
- 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-
|
|
11
|
+
* Version 4.0.1-rc.1, Wed Mar 20 2024
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import Dexie, { cmp, liveQuery } from 'dexie';
|
|
19
|
+
import Dexie, { PropModification, cmp, liveQuery } from 'dexie';
|
|
20
20
|
import { firstValueFrom, from as from$1, filter as filter$1, Observable as Observable$1, BehaviorSubject, Subject, fromEvent, of, merge, Subscription as Subscription$1, throwError, combineLatest, map as map$1, share, timer as timer$1 } from 'rxjs';
|
|
21
21
|
|
|
22
22
|
/******************************************************************************
|
|
@@ -50,6 +50,18 @@ function __extends(d, b) {
|
|
|
50
50
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function __rest(s, e) {
|
|
54
|
+
var t = {};
|
|
55
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
56
|
+
t[p] = s[p];
|
|
57
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
58
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
59
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
60
|
+
t[p[i]] = s[p[i]];
|
|
61
|
+
}
|
|
62
|
+
return t;
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
54
66
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
55
67
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2602,16 +2614,11 @@ function login(db, hints) {
|
|
|
2602
2614
|
const origUserId = currentUser.userId;
|
|
2603
2615
|
if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
|
|
2604
2616
|
const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
|
|
2605
|
-
if (licenseStatus === 'ok' &&
|
|
2606
|
-
currentUser.accessToken &&
|
|
2607
|
-
(!currentUser.accessTokenExpiration ||
|
|
2608
|
-
currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
2617
|
+
if (licenseStatus === 'ok' && currentUser.accessToken && (!currentUser.accessTokenExpiration || currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
2609
2618
|
// Already authenticated according to given hints. And license is valid.
|
|
2610
2619
|
return false;
|
|
2611
2620
|
}
|
|
2612
|
-
if (currentUser.refreshToken &&
|
|
2613
|
-
(!currentUser.refreshTokenExpiration ||
|
|
2614
|
-
currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
2621
|
+
if (currentUser.refreshToken && (!currentUser.refreshTokenExpiration || currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
2615
2622
|
// Refresh the token
|
|
2616
2623
|
yield loadAccessToken(db);
|
|
2617
2624
|
return false;
|
|
@@ -2623,8 +2630,7 @@ function login(db, hints) {
|
|
|
2623
2630
|
lastLogin: new Date(0),
|
|
2624
2631
|
});
|
|
2625
2632
|
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
2626
|
-
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
2627
|
-
context.userId !== origUserId) {
|
|
2633
|
+
if (origUserId !== UNAUTHORIZED_USER.userId && context.userId !== origUserId) {
|
|
2628
2634
|
// User was logged in before, but now logged in as another user.
|
|
2629
2635
|
yield logout(db);
|
|
2630
2636
|
}
|
|
@@ -2643,7 +2649,7 @@ function login(db, hints) {
|
|
|
2643
2649
|
yield setCurrentUser(db, context);
|
|
2644
2650
|
// Make sure to resync as the new login will be authorized
|
|
2645
2651
|
// for new realms.
|
|
2646
|
-
triggerSync(db,
|
|
2652
|
+
triggerSync(db, "pull");
|
|
2647
2653
|
return context.userId !== origUserId;
|
|
2648
2654
|
});
|
|
2649
2655
|
}
|
|
@@ -3467,7 +3473,7 @@ class FakeBigInt {
|
|
|
3467
3473
|
this.v = value;
|
|
3468
3474
|
}
|
|
3469
3475
|
}
|
|
3470
|
-
const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
3476
|
+
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
3471
3477
|
? {}
|
|
3472
3478
|
: {
|
|
3473
3479
|
bigint: {
|
|
@@ -3477,7 +3483,16 @@ const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
|
3477
3483
|
},
|
|
3478
3484
|
revive: ({ v, }) => new FakeBigInt(v)
|
|
3479
3485
|
}
|
|
3480
|
-
}))
|
|
3486
|
+
})), { PropModification: {
|
|
3487
|
+
test: (val) => val instanceof PropModification,
|
|
3488
|
+
replace: (propModification) => {
|
|
3489
|
+
return Object.assign({ $t: 'PropModification' }, propModification);
|
|
3490
|
+
},
|
|
3491
|
+
revive: (_a) => {
|
|
3492
|
+
var propModification = __rest(_a, ["$t"]);
|
|
3493
|
+
return new PropModification(propModification);
|
|
3494
|
+
}
|
|
3495
|
+
} });
|
|
3481
3496
|
const TSON = TypesonSimplified(builtin, defs);
|
|
3482
3497
|
const BISON = Bison(defs);
|
|
3483
3498
|
|
|
@@ -6270,7 +6285,7 @@ function dexieCloud(dexie) {
|
|
|
6270
6285
|
const syncComplete = new Subject();
|
|
6271
6286
|
dexie.cloud = {
|
|
6272
6287
|
// @ts-ignore
|
|
6273
|
-
version: "4.0.1-
|
|
6288
|
+
version: "4.0.1-rc.1",
|
|
6274
6289
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6275
6290
|
schema: null,
|
|
6276
6291
|
get currentUserId() {
|
|
@@ -6501,10 +6516,7 @@ function dexieCloud(dexie) {
|
|
|
6501
6516
|
// HERE: If requireAuth, do athentication now.
|
|
6502
6517
|
let changedUser = false;
|
|
6503
6518
|
if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
|
|
6504
|
-
|
|
6505
|
-
if (!user.isLoggedIn) {
|
|
6506
|
-
changedUser = yield login(db);
|
|
6507
|
-
}
|
|
6519
|
+
changedUser = yield login(db);
|
|
6508
6520
|
}
|
|
6509
6521
|
if (localSyncWorker)
|
|
6510
6522
|
localSyncWorker.stop();
|
|
@@ -6550,7 +6562,7 @@ function dexieCloud(dexie) {
|
|
|
6550
6562
|
}
|
|
6551
6563
|
}
|
|
6552
6564
|
// @ts-ignore
|
|
6553
|
-
dexieCloud.version = "4.0.1-
|
|
6565
|
+
dexieCloud.version = "4.0.1-rc.1";
|
|
6554
6566
|
Dexie.Cloud = dexieCloud;
|
|
6555
6567
|
|
|
6556
6568
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|