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.
@@ -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
@@ -113,7 +113,7 @@
113
113
  ar[i] = from[i];
114
114
  }
115
115
  }
116
- return to.concat(ar || from);
116
+ return to.concat(ar || Array.prototype.slice.call(from));
117
117
  }
118
118
 
119
119
  function __await(v) {
@@ -1096,7 +1096,6 @@
1096
1096
  return _this;
1097
1097
  }
1098
1098
  AsyncAction.prototype.schedule = function (state, delay) {
1099
- var _a;
1100
1099
  if (delay === void 0) { delay = 0; }
1101
1100
  if (this.closed) {
1102
1101
  return this;
@@ -1109,7 +1108,7 @@
1109
1108
  }
1110
1109
  this.pending = true;
1111
1110
  this.delay = delay;
1112
- this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
1111
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
1113
1112
  return this;
1114
1113
  };
1115
1114
  AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
@@ -1121,9 +1120,7 @@
1121
1120
  if (delay != null && this.delay === delay && this.pending === false) {
1122
1121
  return id;
1123
1122
  }
1124
- if (id != null) {
1125
- intervalProvider.clearInterval(id);
1126
- }
1123
+ intervalProvider.clearInterval(id);
1127
1124
  return undefined;
1128
1125
  };
1129
1126
  AsyncAction.prototype.execute = function (state, delay) {
@@ -1199,6 +1196,7 @@
1199
1196
  var _this = _super.call(this, SchedulerAction, now) || this;
1200
1197
  _this.actions = [];
1201
1198
  _this._active = false;
1199
+ _this._scheduled = undefined;
1202
1200
  return _this;
1203
1201
  }
1204
1202
  AsyncScheduler.prototype.flush = function (action) {
@@ -1608,7 +1606,7 @@
1608
1606
  return concat$1(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
1609
1607
  };
1610
1608
  }
1611
- return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
1609
+ return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
1612
1610
  }
1613
1611
 
1614
1612
  function delay(due, scheduler) {
@@ -2492,6 +2490,14 @@
2492
2490
  }
2493
2491
  function userAuthenticate(context, fetchToken, userInteraction, hints) {
2494
2492
  return __awaiter(this, void 0, void 0, function* () {
2493
+ if (!crypto.subtle) {
2494
+ if (typeof location !== 'undefined' && location.protocol === 'http:') {
2495
+ 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)`);
2496
+ }
2497
+ else {
2498
+ throw new Error(`This browser does not support WebCrypto.`);
2499
+ }
2500
+ }
2495
2501
  const { privateKey, publicKey } = yield crypto.subtle.generateKey({
2496
2502
  name: 'RSASSA-PKCS1-v1_5',
2497
2503
  modulusLength: 2048,
@@ -2537,7 +2543,7 @@
2537
2543
  type: 'error',
2538
2544
  messageCode: 'GENERIC_ERROR',
2539
2545
  message: `We're having a problem authenticating right now.`,
2540
- messageParams: {}
2546
+ messageParams: {},
2541
2547
  }).catch(() => { });
2542
2548
  throw error;
2543
2549
  }
@@ -4186,7 +4192,20 @@
4186
4192
  lastLogin: new Date(0),
4187
4193
  });
4188
4194
  yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
4189
- yield context.save();
4195
+ try {
4196
+ yield context.save();
4197
+ }
4198
+ catch (e) {
4199
+ try {
4200
+ if (e.name === 'DataCloneError') {
4201
+ console.debug(`Login context property names:`, Object.keys(context));
4202
+ console.debug(`Login context:`, context);
4203
+ console.debug(`Login context JSON:`, JSON.stringify(context));
4204
+ }
4205
+ }
4206
+ catch (_a) { }
4207
+ throw e;
4208
+ }
4190
4209
  yield setCurrentUser(db, context);
4191
4210
  // Make sure to resync as the new login will be authorized
4192
4211
  // for new realms.
@@ -5946,7 +5965,7 @@
5946
5965
  currentUserEmitter.next(UNAUTHORIZED_USER);
5947
5966
  });
5948
5967
  dexie.cloud = {
5949
- version: '4.0.1-beta.34',
5968
+ version: '4.0.1-beta.35',
5950
5969
  options: Object.assign({}, DEFAULT_OPTIONS),
5951
5970
  schema: null,
5952
5971
  get currentUserId() {
@@ -6201,7 +6220,7 @@
6201
6220
  });
6202
6221
  }
6203
6222
  }
6204
- dexieCloud.version = '4.0.1-beta.34';
6223
+ dexieCloud.version = '4.0.1-beta.35';
6205
6224
  Dexie__default["default"].Cloud = dexieCloud;
6206
6225
 
6207
6226
  // In case the SW lives for a while, let it reuse already opened connections: