dexie-cloud-addon 4.0.1-beta.34 → 4.0.1-beta.35
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 -13
- 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 +31 -12
- 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/module-es5/dexie-cloud-addon.js +47 -25
- package/dist/module-es5/dexie-cloud-addon.js.map +1 -1
- package/dist/module-es5/dexie-cloud-addon.min.js +1 -1
- package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -1
- package/dist/types/sync/getTablesToSyncify.d.ts +1 -1
- package/dist/umd/dexie-cloud-addon.js +47 -25
- 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 -12
- 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/dist/umd-modern/dexie-cloud-addon.js +29 -10
- package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js +1 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Dexie, { liveQuery, cmp } from 'dexie';
|
|
2
2
|
import { BehaviorSubject, fromEvent, of, merge, from as from$1, Observable as Observable$1, Subscription as Subscription$1, Subject, combineLatest, map as map$1, share, timer as timer$1, throwError } from 'rxjs';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/******************************************************************************
|
|
5
5
|
Copyright (c) Microsoft Corporation.
|
|
6
6
|
|
|
7
7
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -88,7 +88,7 @@ function __spreadArray$1(to, from, pack) {
|
|
|
88
88
|
ar[i] = from[i];
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
return to.concat(ar || from);
|
|
91
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/* ==========================================================================
|
|
@@ -101,14 +101,14 @@ function __spreadArray$1(to, from, pack) {
|
|
|
101
101
|
*
|
|
102
102
|
* ==========================================================================
|
|
103
103
|
*
|
|
104
|
-
* Version 4.0.1-beta.
|
|
104
|
+
* Version 4.0.1-beta.35, Tue Apr 11 2023
|
|
105
105
|
*
|
|
106
106
|
* https://dexie.org
|
|
107
107
|
*
|
|
108
108
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
109
109
|
*
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
/******************************************************************************
|
|
112
112
|
Copyright (c) Microsoft Corporation.
|
|
113
113
|
|
|
114
114
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -273,7 +273,7 @@ function __spreadArray(to, from, pack) {
|
|
|
273
273
|
ar[i] = from[i];
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
return to.concat(ar || from);
|
|
276
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
277
277
|
}
|
|
278
278
|
function __await(v) {
|
|
279
279
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -1400,7 +1400,6 @@ var AsyncAction = (function (_super) {
|
|
|
1400
1400
|
return _this;
|
|
1401
1401
|
}
|
|
1402
1402
|
AsyncAction.prototype.schedule = function (state, delay) {
|
|
1403
|
-
var _a;
|
|
1404
1403
|
if (delay === void 0) {
|
|
1405
1404
|
delay = 0;
|
|
1406
1405
|
}
|
|
@@ -1415,7 +1414,7 @@ var AsyncAction = (function (_super) {
|
|
|
1415
1414
|
}
|
|
1416
1415
|
this.pending = true;
|
|
1417
1416
|
this.delay = delay;
|
|
1418
|
-
this.id =
|
|
1417
|
+
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
|
1419
1418
|
return this;
|
|
1420
1419
|
};
|
|
1421
1420
|
AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
|
|
@@ -1431,9 +1430,7 @@ var AsyncAction = (function (_super) {
|
|
|
1431
1430
|
if (delay != null && this.delay === delay && this.pending === false) {
|
|
1432
1431
|
return id;
|
|
1433
1432
|
}
|
|
1434
|
-
|
|
1435
|
-
intervalProvider.clearInterval(id);
|
|
1436
|
-
}
|
|
1433
|
+
intervalProvider.clearInterval(id);
|
|
1437
1434
|
return undefined;
|
|
1438
1435
|
};
|
|
1439
1436
|
AsyncAction.prototype.execute = function (state, delay) {
|
|
@@ -1512,6 +1509,7 @@ var AsyncScheduler = (function (_super) {
|
|
|
1512
1509
|
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1513
1510
|
_this.actions = [];
|
|
1514
1511
|
_this._active = false;
|
|
1512
|
+
_this._scheduled = undefined;
|
|
1515
1513
|
return _this;
|
|
1516
1514
|
}
|
|
1517
1515
|
AsyncScheduler.prototype.flush = function (action) {
|
|
@@ -1910,7 +1908,7 @@ function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
|
1910
1908
|
return concat$1(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
1911
1909
|
};
|
|
1912
1910
|
}
|
|
1913
|
-
return mergeMap(function (value, index) { return
|
|
1911
|
+
return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
|
|
1914
1912
|
}
|
|
1915
1913
|
function delay(due, scheduler) {
|
|
1916
1914
|
if (scheduler === void 0) {
|
|
@@ -2396,13 +2394,22 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
|
|
|
2396
2394
|
var _k, privateKey, publicKey, publicKeySPKI, publicKeyPEM, response2, error_1;
|
|
2397
2395
|
return __generator$1(this, function (_l) {
|
|
2398
2396
|
switch (_l.label) {
|
|
2399
|
-
case 0:
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2397
|
+
case 0:
|
|
2398
|
+
if (!crypto.subtle) {
|
|
2399
|
+
if (typeof location !== 'undefined' && location.protocol === 'http:') {
|
|
2400
|
+
throw new Error("Dexie Cloud Addon needs to use WebCrypto, but your browser has disabled it due to being served from an insecure location. Please serve it from https or http://localhost:<port> (See https://stackoverflow.com/questions/46670556/how-to-enable-crypto-subtle-for-unsecure-origins-in-chrome/46671627#46671627)");
|
|
2401
|
+
}
|
|
2402
|
+
else {
|
|
2403
|
+
throw new Error("This browser does not support WebCrypto.");
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
return [4 /*yield*/, crypto.subtle.generateKey({
|
|
2407
|
+
name: 'RSASSA-PKCS1-v1_5',
|
|
2408
|
+
modulusLength: 2048,
|
|
2409
|
+
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
|
|
2410
|
+
hash: { name: 'SHA-256' },
|
|
2411
|
+
}, false, // Non-exportable...
|
|
2412
|
+
['sign', 'verify'])];
|
|
2406
2413
|
case 1:
|
|
2407
2414
|
_k = _l.sent(), privateKey = _k.privateKey, publicKey = _k.publicKey;
|
|
2408
2415
|
if (!privateKey || !publicKey)
|
|
@@ -2451,7 +2458,7 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
|
|
|
2451
2458
|
type: 'error',
|
|
2452
2459
|
messageCode: 'GENERIC_ERROR',
|
|
2453
2460
|
message: "We're having a problem authenticating right now.",
|
|
2454
|
-
messageParams: {}
|
|
2461
|
+
messageParams: {},
|
|
2455
2462
|
}).catch(function () { })];
|
|
2456
2463
|
case 8:
|
|
2457
2464
|
_l.sent();
|
|
@@ -2717,7 +2724,7 @@ function setCurrentUser(db, user) {
|
|
|
2717
2724
|
}
|
|
2718
2725
|
function login(db, hints) {
|
|
2719
2726
|
return __awaiter(this, void 0, void 0, function () {
|
|
2720
|
-
var currentUser, context;
|
|
2727
|
+
var currentUser, context, e_6;
|
|
2721
2728
|
return __generator$1(this, function (_k) {
|
|
2722
2729
|
switch (_k.label) {
|
|
2723
2730
|
case 0: return [4 /*yield*/, db.getCurrentUser()];
|
|
@@ -2742,11 +2749,26 @@ function login(db, hints) {
|
|
|
2742
2749
|
return [4 /*yield*/, authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints)];
|
|
2743
2750
|
case 2:
|
|
2744
2751
|
_k.sent();
|
|
2745
|
-
|
|
2752
|
+
_k.label = 3;
|
|
2746
2753
|
case 3:
|
|
2747
|
-
_k.
|
|
2748
|
-
return [4 /*yield*/,
|
|
2754
|
+
_k.trys.push([3, 5, , 6]);
|
|
2755
|
+
return [4 /*yield*/, context.save()];
|
|
2749
2756
|
case 4:
|
|
2757
|
+
_k.sent();
|
|
2758
|
+
return [3 /*break*/, 6];
|
|
2759
|
+
case 5:
|
|
2760
|
+
e_6 = _k.sent();
|
|
2761
|
+
try {
|
|
2762
|
+
if (e_6.name === 'DataCloneError') {
|
|
2763
|
+
console.debug("Login context property names:", Object.keys(context));
|
|
2764
|
+
console.debug("Login context:", context);
|
|
2765
|
+
console.debug("Login context JSON:", JSON.stringify(context));
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
catch (_a) { }
|
|
2769
|
+
throw e_6;
|
|
2770
|
+
case 6: return [4 /*yield*/, setCurrentUser(db, context)];
|
|
2771
|
+
case 7:
|
|
2750
2772
|
_k.sent();
|
|
2751
2773
|
// Make sure to resync as the new login will be authorized
|
|
2752
2774
|
// for new realms.
|
|
@@ -6962,7 +6984,7 @@ function dexieCloud(dexie) {
|
|
|
6962
6984
|
currentUserEmitter.next(UNAUTHORIZED_USER);
|
|
6963
6985
|
});
|
|
6964
6986
|
dexie.cloud = {
|
|
6965
|
-
version: '4.0.1-beta.
|
|
6987
|
+
version: '4.0.1-beta.35',
|
|
6966
6988
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6967
6989
|
schema: null,
|
|
6968
6990
|
get currentUserId() {
|
|
@@ -7295,7 +7317,7 @@ function dexieCloud(dexie) {
|
|
|
7295
7317
|
});
|
|
7296
7318
|
}
|
|
7297
7319
|
}
|
|
7298
|
-
dexieCloud.version = '4.0.1-beta.
|
|
7320
|
+
dexieCloud.version = '4.0.1-beta.35';
|
|
7299
7321
|
Dexie.Cloud = dexieCloud;
|
|
7300
7322
|
|
|
7301
7323
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };
|