dexie-cloud-addon 4.0.1-beta.33 → 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 +26 -5
- 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 +25 -4
- 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 +39 -15
- 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 +39 -15
- 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 +25 -4
- 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 +23 -2
- 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 +4 -3
|
@@ -101,7 +101,7 @@ 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
|
*
|
|
@@ -2394,13 +2394,22 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
|
|
|
2394
2394
|
var _k, privateKey, publicKey, publicKeySPKI, publicKeyPEM, response2, error_1;
|
|
2395
2395
|
return __generator$1(this, function (_l) {
|
|
2396
2396
|
switch (_l.label) {
|
|
2397
|
-
case 0:
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
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'])];
|
|
2404
2413
|
case 1:
|
|
2405
2414
|
_k = _l.sent(), privateKey = _k.privateKey, publicKey = _k.publicKey;
|
|
2406
2415
|
if (!privateKey || !publicKey)
|
|
@@ -2449,7 +2458,7 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
|
|
|
2449
2458
|
type: 'error',
|
|
2450
2459
|
messageCode: 'GENERIC_ERROR',
|
|
2451
2460
|
message: "We're having a problem authenticating right now.",
|
|
2452
|
-
messageParams: {}
|
|
2461
|
+
messageParams: {},
|
|
2453
2462
|
}).catch(function () { })];
|
|
2454
2463
|
case 8:
|
|
2455
2464
|
_l.sent();
|
|
@@ -2715,7 +2724,7 @@ function setCurrentUser(db, user) {
|
|
|
2715
2724
|
}
|
|
2716
2725
|
function login(db, hints) {
|
|
2717
2726
|
return __awaiter(this, void 0, void 0, function () {
|
|
2718
|
-
var currentUser, context;
|
|
2727
|
+
var currentUser, context, e_6;
|
|
2719
2728
|
return __generator$1(this, function (_k) {
|
|
2720
2729
|
switch (_k.label) {
|
|
2721
2730
|
case 0: return [4 /*yield*/, db.getCurrentUser()];
|
|
@@ -2740,11 +2749,26 @@ function login(db, hints) {
|
|
|
2740
2749
|
return [4 /*yield*/, authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints)];
|
|
2741
2750
|
case 2:
|
|
2742
2751
|
_k.sent();
|
|
2743
|
-
|
|
2752
|
+
_k.label = 3;
|
|
2744
2753
|
case 3:
|
|
2745
|
-
_k.
|
|
2746
|
-
return [4 /*yield*/,
|
|
2754
|
+
_k.trys.push([3, 5, , 6]);
|
|
2755
|
+
return [4 /*yield*/, context.save()];
|
|
2747
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:
|
|
2748
2772
|
_k.sent();
|
|
2749
2773
|
// Make sure to resync as the new login will be authorized
|
|
2750
2774
|
// for new realms.
|
|
@@ -6960,7 +6984,7 @@ function dexieCloud(dexie) {
|
|
|
6960
6984
|
currentUserEmitter.next(UNAUTHORIZED_USER);
|
|
6961
6985
|
});
|
|
6962
6986
|
dexie.cloud = {
|
|
6963
|
-
version: '4.0.1-beta.
|
|
6987
|
+
version: '4.0.1-beta.35',
|
|
6964
6988
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6965
6989
|
schema: null,
|
|
6966
6990
|
get currentUserId() {
|
|
@@ -7293,7 +7317,7 @@ function dexieCloud(dexie) {
|
|
|
7293
7317
|
});
|
|
7294
7318
|
}
|
|
7295
7319
|
}
|
|
7296
|
-
dexieCloud.version = '4.0.1-beta.
|
|
7320
|
+
dexieCloud.version = '4.0.1-beta.35';
|
|
7297
7321
|
Dexie.Cloud = dexieCloud;
|
|
7298
7322
|
|
|
7299
7323
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };
|