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.
@@ -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>[];
@@ -8,7 +8,7 @@
8
8
 
9
9
  var Dexie__default = /*#__PURE__*/_interopDefaultLegacy(Dexie);
10
10
 
11
- /*! *****************************************************************************
11
+ /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
13
13
 
14
14
  Permission to use, copy, modify, and/or distribute this software for any
@@ -95,7 +95,7 @@
95
95
  ar[i] = from[i];
96
96
  }
97
97
  }
98
- return to.concat(ar || from);
98
+ return to.concat(ar || Array.prototype.slice.call(from));
99
99
  }
100
100
 
101
101
  /* ==========================================================================
@@ -108,14 +108,14 @@
108
108
  *
109
109
  * ==========================================================================
110
110
  *
111
- * Version 4.0.1-beta.34, Mon Mar 27 2023
111
+ * Version 4.0.1-beta.35, Tue Apr 11 2023
112
112
  *
113
113
  * https://dexie.org
114
114
  *
115
115
  * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
116
116
  *
117
117
  */
118
- /*! *****************************************************************************
118
+ /******************************************************************************
119
119
  Copyright (c) Microsoft Corporation.
120
120
 
121
121
  Permission to use, copy, modify, and/or distribute this software for any
@@ -280,7 +280,7 @@
280
280
  ar[i] = from[i];
281
281
  }
282
282
  }
283
- return to.concat(ar || from);
283
+ return to.concat(ar || Array.prototype.slice.call(from));
284
284
  }
285
285
  function __await(v) {
286
286
  return this instanceof __await ? (this.v = v, this) : new __await(v);
@@ -1407,7 +1407,6 @@
1407
1407
  return _this;
1408
1408
  }
1409
1409
  AsyncAction.prototype.schedule = function (state, delay) {
1410
- var _a;
1411
1410
  if (delay === void 0) {
1412
1411
  delay = 0;
1413
1412
  }
@@ -1422,7 +1421,7 @@
1422
1421
  }
1423
1422
  this.pending = true;
1424
1423
  this.delay = delay;
1425
- this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
1424
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
1426
1425
  return this;
1427
1426
  };
1428
1427
  AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
@@ -1438,9 +1437,7 @@
1438
1437
  if (delay != null && this.delay === delay && this.pending === false) {
1439
1438
  return id;
1440
1439
  }
1441
- if (id != null) {
1442
- intervalProvider.clearInterval(id);
1443
- }
1440
+ intervalProvider.clearInterval(id);
1444
1441
  return undefined;
1445
1442
  };
1446
1443
  AsyncAction.prototype.execute = function (state, delay) {
@@ -1519,6 +1516,7 @@
1519
1516
  var _this = _super.call(this, SchedulerAction, now) || this;
1520
1517
  _this.actions = [];
1521
1518
  _this._active = false;
1519
+ _this._scheduled = undefined;
1522
1520
  return _this;
1523
1521
  }
1524
1522
  AsyncScheduler.prototype.flush = function (action) {
@@ -1917,7 +1915,7 @@
1917
1915
  return concat$1(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
1918
1916
  };
1919
1917
  }
1920
- return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
1918
+ return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
1921
1919
  }
1922
1920
  function delay(due, scheduler) {
1923
1921
  if (scheduler === void 0) {
@@ -2403,13 +2401,22 @@
2403
2401
  var _k, privateKey, publicKey, publicKeySPKI, publicKeyPEM, response2, error_1;
2404
2402
  return __generator$1(this, function (_l) {
2405
2403
  switch (_l.label) {
2406
- case 0: 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
+ 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'])];
2413
2420
  case 1:
2414
2421
  _k = _l.sent(), privateKey = _k.privateKey, publicKey = _k.publicKey;
2415
2422
  if (!privateKey || !publicKey)
@@ -2458,7 +2465,7 @@
2458
2465
  type: 'error',
2459
2466
  messageCode: 'GENERIC_ERROR',
2460
2467
  message: "We're having a problem authenticating right now.",
2461
- messageParams: {}
2468
+ messageParams: {},
2462
2469
  }).catch(function () { })];
2463
2470
  case 8:
2464
2471
  _l.sent();
@@ -2724,7 +2731,7 @@
2724
2731
  }
2725
2732
  function login(db, hints) {
2726
2733
  return __awaiter(this, void 0, void 0, function () {
2727
- var currentUser, context;
2734
+ var currentUser, context, e_6;
2728
2735
  return __generator$1(this, function (_k) {
2729
2736
  switch (_k.label) {
2730
2737
  case 0: return [4 /*yield*/, db.getCurrentUser()];
@@ -2749,11 +2756,26 @@
2749
2756
  return [4 /*yield*/, authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints)];
2750
2757
  case 2:
2751
2758
  _k.sent();
2752
- return [4 /*yield*/, context.save()];
2759
+ _k.label = 3;
2753
2760
  case 3:
2754
- _k.sent();
2755
- return [4 /*yield*/, setCurrentUser(db, context)];
2761
+ _k.trys.push([3, 5, , 6]);
2762
+ return [4 /*yield*/, context.save()];
2756
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:
2757
2779
  _k.sent();
2758
2780
  // Make sure to resync as the new login will be authorized
2759
2781
  // for new realms.
@@ -6969,7 +6991,7 @@
6969
6991
  currentUserEmitter.next(UNAUTHORIZED_USER);
6970
6992
  });
6971
6993
  dexie.cloud = {
6972
- version: '4.0.1-beta.34',
6994
+ version: '4.0.1-beta.35',
6973
6995
  options: Object.assign({}, DEFAULT_OPTIONS),
6974
6996
  schema: null,
6975
6997
  get currentUserId() {
@@ -7302,7 +7324,7 @@
7302
7324
  });
7303
7325
  }
7304
7326
  }
7305
- dexieCloud.version = '4.0.1-beta.34';
7327
+ dexieCloud.version = '4.0.1-beta.35';
7306
7328
  Dexie__default["default"].Cloud = dexieCloud;
7307
7329
 
7308
7330
  exports["default"] = dexieCloud;