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.
@@ -1,3 +1,3 @@
1
1
  import { DexieCloudDB } from "../db/DexieCloudDB";
2
2
  import { PersistedSyncState } from "../db/entities/PersistedSyncState";
3
- export declare function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined): import("dexie").Table<import("../db/entities/EntityCommon").EntityCommon, import("dexie").IndexableType, import("../db/entities/EntityCommon").EntityCommon>[];
3
+ export declare function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined): import("dexie").Table<import("../db/entities/EntityCommon").EntityCommon, any, import("../db/entities/EntityCommon").EntityCommon>[];
@@ -108,7 +108,7 @@
108
108
  *
109
109
  * ==========================================================================
110
110
  *
111
- * Version 4.0.1-beta.33, Sat Mar 11 2023
111
+ * Version 4.0.1-beta.35, Tue Apr 11 2023
112
112
  *
113
113
  * https://dexie.org
114
114
  *
@@ -2401,13 +2401,22 @@
2401
2401
  var _k, privateKey, publicKey, publicKeySPKI, publicKeyPEM, response2, error_1;
2402
2402
  return __generator$1(this, function (_l) {
2403
2403
  switch (_l.label) {
2404
- case 0: return [4 /*yield*/, crypto.subtle.generateKey({
2405
- name: 'RSASSA-PKCS1-v1_5',
2406
- modulusLength: 2048,
2407
- publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
2408
- hash: { name: 'SHA-256' },
2409
- }, false, // Non-exportable...
2410
- ['sign', 'verify'])];
2404
+ case 0:
2405
+ if (!crypto.subtle) {
2406
+ if (typeof location !== 'undefined' && location.protocol === 'http:') {
2407
+ 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)");
2408
+ }
2409
+ else {
2410
+ throw new Error("This browser does not support WebCrypto.");
2411
+ }
2412
+ }
2413
+ return [4 /*yield*/, crypto.subtle.generateKey({
2414
+ name: 'RSASSA-PKCS1-v1_5',
2415
+ modulusLength: 2048,
2416
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
2417
+ hash: { name: 'SHA-256' },
2418
+ }, false, // Non-exportable...
2419
+ ['sign', 'verify'])];
2411
2420
  case 1:
2412
2421
  _k = _l.sent(), privateKey = _k.privateKey, publicKey = _k.publicKey;
2413
2422
  if (!privateKey || !publicKey)
@@ -2456,7 +2465,7 @@
2456
2465
  type: 'error',
2457
2466
  messageCode: 'GENERIC_ERROR',
2458
2467
  message: "We're having a problem authenticating right now.",
2459
- messageParams: {}
2468
+ messageParams: {},
2460
2469
  }).catch(function () { })];
2461
2470
  case 8:
2462
2471
  _l.sent();
@@ -2722,7 +2731,7 @@
2722
2731
  }
2723
2732
  function login(db, hints) {
2724
2733
  return __awaiter(this, void 0, void 0, function () {
2725
- var currentUser, context;
2734
+ var currentUser, context, e_6;
2726
2735
  return __generator$1(this, function (_k) {
2727
2736
  switch (_k.label) {
2728
2737
  case 0: return [4 /*yield*/, db.getCurrentUser()];
@@ -2747,11 +2756,26 @@
2747
2756
  return [4 /*yield*/, authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints)];
2748
2757
  case 2:
2749
2758
  _k.sent();
2750
- return [4 /*yield*/, context.save()];
2759
+ _k.label = 3;
2751
2760
  case 3:
2752
- _k.sent();
2753
- return [4 /*yield*/, setCurrentUser(db, context)];
2761
+ _k.trys.push([3, 5, , 6]);
2762
+ return [4 /*yield*/, context.save()];
2754
2763
  case 4:
2764
+ _k.sent();
2765
+ return [3 /*break*/, 6];
2766
+ case 5:
2767
+ e_6 = _k.sent();
2768
+ try {
2769
+ if (e_6.name === 'DataCloneError') {
2770
+ console.debug("Login context property names:", Object.keys(context));
2771
+ console.debug("Login context:", context);
2772
+ console.debug("Login context JSON:", JSON.stringify(context));
2773
+ }
2774
+ }
2775
+ catch (_a) { }
2776
+ throw e_6;
2777
+ case 6: return [4 /*yield*/, setCurrentUser(db, context)];
2778
+ case 7:
2755
2779
  _k.sent();
2756
2780
  // Make sure to resync as the new login will be authorized
2757
2781
  // for new realms.
@@ -6967,7 +6991,7 @@
6967
6991
  currentUserEmitter.next(UNAUTHORIZED_USER);
6968
6992
  });
6969
6993
  dexie.cloud = {
6970
- version: '4.0.1-beta.33',
6994
+ version: '4.0.1-beta.35',
6971
6995
  options: Object.assign({}, DEFAULT_OPTIONS),
6972
6996
  schema: null,
6973
6997
  get currentUserId() {
@@ -7300,7 +7324,7 @@
7300
7324
  });
7301
7325
  }
7302
7326
  }
7303
- dexieCloud.version = '4.0.1-beta.33';
7327
+ dexieCloud.version = '4.0.1-beta.35';
7304
7328
  Dexie__default["default"].Cloud = dexieCloud;
7305
7329
 
7306
7330
  exports["default"] = dexieCloud;