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 { Observable as Observable$1, BehaviorSubject, Subject, firstValueFrom, from as from$1, filter as filter$1, 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) {
|
|
@@ -3161,7 +3173,7 @@ class FakeBigInt {
|
|
|
3161
3173
|
this.v = value;
|
|
3162
3174
|
}
|
|
3163
3175
|
}
|
|
3164
|
-
const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
3176
|
+
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
3165
3177
|
? {}
|
|
3166
3178
|
: {
|
|
3167
3179
|
bigint: {
|
|
@@ -3171,7 +3183,16 @@ const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
|
|
|
3171
3183
|
},
|
|
3172
3184
|
revive: ({ v, }) => new FakeBigInt(v)
|
|
3173
3185
|
}
|
|
3174
|
-
}))
|
|
3186
|
+
})), { PropModification: {
|
|
3187
|
+
test: (val) => val instanceof PropModification,
|
|
3188
|
+
replace: (propModification) => {
|
|
3189
|
+
return Object.assign({ $t: 'PropModification' }, propModification);
|
|
3190
|
+
},
|
|
3191
|
+
revive: (_a) => {
|
|
3192
|
+
var propModification = __rest(_a, ["$t"]);
|
|
3193
|
+
return new PropModification(propModification);
|
|
3194
|
+
}
|
|
3195
|
+
} });
|
|
3175
3196
|
const TSON = TypesonSimplified(builtin, defs);
|
|
3176
3197
|
const BISON = Bison(defs);
|
|
3177
3198
|
|
|
@@ -4391,16 +4412,11 @@ function login(db, hints) {
|
|
|
4391
4412
|
const origUserId = currentUser.userId;
|
|
4392
4413
|
if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
|
|
4393
4414
|
const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
|
|
4394
|
-
if (licenseStatus === 'ok' &&
|
|
4395
|
-
currentUser.accessToken &&
|
|
4396
|
-
(!currentUser.accessTokenExpiration ||
|
|
4397
|
-
currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
4415
|
+
if (licenseStatus === 'ok' && currentUser.accessToken && (!currentUser.accessTokenExpiration || currentUser.accessTokenExpiration.getTime() > Date.now())) {
|
|
4398
4416
|
// Already authenticated according to given hints. And license is valid.
|
|
4399
4417
|
return false;
|
|
4400
4418
|
}
|
|
4401
|
-
if (currentUser.refreshToken &&
|
|
4402
|
-
(!currentUser.refreshTokenExpiration ||
|
|
4403
|
-
currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
4419
|
+
if (currentUser.refreshToken && (!currentUser.refreshTokenExpiration || currentUser.refreshTokenExpiration.getTime() > Date.now())) {
|
|
4404
4420
|
// Refresh the token
|
|
4405
4421
|
yield loadAccessToken(db);
|
|
4406
4422
|
return false;
|
|
@@ -4412,8 +4428,7 @@ function login(db, hints) {
|
|
|
4412
4428
|
lastLogin: new Date(0),
|
|
4413
4429
|
});
|
|
4414
4430
|
yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
|
|
4415
|
-
if (origUserId !== UNAUTHORIZED_USER.userId &&
|
|
4416
|
-
context.userId !== origUserId) {
|
|
4431
|
+
if (origUserId !== UNAUTHORIZED_USER.userId && context.userId !== origUserId) {
|
|
4417
4432
|
// User was logged in before, but now logged in as another user.
|
|
4418
4433
|
yield logout(db);
|
|
4419
4434
|
}
|
|
@@ -4432,7 +4447,7 @@ function login(db, hints) {
|
|
|
4432
4447
|
yield setCurrentUser(db, context);
|
|
4433
4448
|
// Make sure to resync as the new login will be authorized
|
|
4434
4449
|
// for new realms.
|
|
4435
|
-
triggerSync(db,
|
|
4450
|
+
triggerSync(db, "pull");
|
|
4436
4451
|
return context.userId !== origUserId;
|
|
4437
4452
|
});
|
|
4438
4453
|
}
|
|
@@ -6263,7 +6278,7 @@ function dexieCloud(dexie) {
|
|
|
6263
6278
|
const syncComplete = new Subject();
|
|
6264
6279
|
dexie.cloud = {
|
|
6265
6280
|
// @ts-ignore
|
|
6266
|
-
version: "4.0.1-
|
|
6281
|
+
version: "4.0.1-rc.1",
|
|
6267
6282
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6268
6283
|
schema: null,
|
|
6269
6284
|
get currentUserId() {
|
|
@@ -6494,10 +6509,7 @@ function dexieCloud(dexie) {
|
|
|
6494
6509
|
// HERE: If requireAuth, do athentication now.
|
|
6495
6510
|
let changedUser = false;
|
|
6496
6511
|
if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
|
|
6497
|
-
|
|
6498
|
-
if (!user.isLoggedIn) {
|
|
6499
|
-
changedUser = yield login(db);
|
|
6500
|
-
}
|
|
6512
|
+
changedUser = yield login(db);
|
|
6501
6513
|
}
|
|
6502
6514
|
if (localSyncWorker)
|
|
6503
6515
|
localSyncWorker.stop();
|
|
@@ -6543,7 +6555,7 @@ function dexieCloud(dexie) {
|
|
|
6543
6555
|
}
|
|
6544
6556
|
}
|
|
6545
6557
|
// @ts-ignore
|
|
6546
|
-
dexieCloud.version = "4.0.1-
|
|
6558
|
+
dexieCloud.version = "4.0.1-rc.1";
|
|
6547
6559
|
Dexie.Cloud = dexieCloud;
|
|
6548
6560
|
|
|
6549
6561
|
// In case the SW lives for a while, let it reuse already opened connections:
|