dexie-cloud-addon 4.0.1-beta.58 → 4.0.1-rc.1

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
  * ==========================================================================
10
10
  *
11
- * Version 4.0.1-beta.58, Tue Feb 20 2024
11
+ * Version 4.0.1-rc.1, Wed Mar 20 2024
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -53,6 +53,18 @@
53
53
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
54
54
  }
55
55
 
56
+ function __rest(s, e) {
57
+ var t = {};
58
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
59
+ t[p] = s[p];
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
61
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
62
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
63
+ t[p[i]] = s[p[i]];
64
+ }
65
+ return t;
66
+ }
67
+
56
68
  function __awaiter(thisArg, _arguments, P, generator) {
57
69
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
58
70
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -3164,7 +3176,7 @@
3164
3176
  this.v = value;
3165
3177
  }
3166
3178
  }
3167
- const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3179
+ const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3168
3180
  ? {}
3169
3181
  : {
3170
3182
  bigint: {
@@ -3174,7 +3186,16 @@
3174
3186
  },
3175
3187
  revive: ({ v, }) => new FakeBigInt(v)
3176
3188
  }
3177
- }));
3189
+ })), { PropModification: {
3190
+ test: (val) => val instanceof Dexie.PropModification,
3191
+ replace: (propModification) => {
3192
+ return Object.assign({ $t: 'PropModification' }, propModification);
3193
+ },
3194
+ revive: (_a) => {
3195
+ var propModification = __rest(_a, ["$t"]);
3196
+ return new Dexie.PropModification(propModification);
3197
+ }
3198
+ } });
3178
3199
  const TSON = TypesonSimplified(builtin, defs);
3179
3200
  const BISON = Bison(defs);
3180
3201
 
@@ -4394,16 +4415,11 @@
4394
4415
  const origUserId = currentUser.userId;
4395
4416
  if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
4396
4417
  const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
4397
- if (licenseStatus === 'ok' &&
4398
- currentUser.accessToken &&
4399
- (!currentUser.accessTokenExpiration ||
4400
- currentUser.accessTokenExpiration.getTime() > Date.now())) {
4418
+ if (licenseStatus === 'ok' && currentUser.accessToken && (!currentUser.accessTokenExpiration || currentUser.accessTokenExpiration.getTime() > Date.now())) {
4401
4419
  // Already authenticated according to given hints. And license is valid.
4402
4420
  return false;
4403
4421
  }
4404
- if (currentUser.refreshToken &&
4405
- (!currentUser.refreshTokenExpiration ||
4406
- currentUser.refreshTokenExpiration.getTime() > Date.now())) {
4422
+ if (currentUser.refreshToken && (!currentUser.refreshTokenExpiration || currentUser.refreshTokenExpiration.getTime() > Date.now())) {
4407
4423
  // Refresh the token
4408
4424
  yield loadAccessToken(db);
4409
4425
  return false;
@@ -4415,8 +4431,7 @@
4415
4431
  lastLogin: new Date(0),
4416
4432
  });
4417
4433
  yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
4418
- if (origUserId !== UNAUTHORIZED_USER.userId &&
4419
- context.userId !== origUserId) {
4434
+ if (origUserId !== UNAUTHORIZED_USER.userId && context.userId !== origUserId) {
4420
4435
  // User was logged in before, but now logged in as another user.
4421
4436
  yield logout(db);
4422
4437
  }
@@ -4435,7 +4450,7 @@
4435
4450
  yield setCurrentUser(db, context);
4436
4451
  // Make sure to resync as the new login will be authorized
4437
4452
  // for new realms.
4438
- triggerSync(db, 'pull');
4453
+ triggerSync(db, "pull");
4439
4454
  return context.userId !== origUserId;
4440
4455
  });
4441
4456
  }
@@ -6266,7 +6281,7 @@
6266
6281
  const syncComplete = new rxjs.Subject();
6267
6282
  dexie.cloud = {
6268
6283
  // @ts-ignore
6269
- version: "4.0.1-beta.58",
6284
+ version: "4.0.1-rc.1",
6270
6285
  options: Object.assign({}, DEFAULT_OPTIONS),
6271
6286
  schema: null,
6272
6287
  get currentUserId() {
@@ -6497,10 +6512,7 @@
6497
6512
  // HERE: If requireAuth, do athentication now.
6498
6513
  let changedUser = false;
6499
6514
  if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
6500
- const user = yield db.getCurrentUser();
6501
- if (!user.isLoggedIn) {
6502
- changedUser = yield login(db);
6503
- }
6515
+ changedUser = yield login(db);
6504
6516
  }
6505
6517
  if (localSyncWorker)
6506
6518
  localSyncWorker.stop();
@@ -6546,7 +6558,7 @@
6546
6558
  }
6547
6559
  }
6548
6560
  // @ts-ignore
6549
- dexieCloud.version = "4.0.1-beta.58";
6561
+ dexieCloud.version = "4.0.1-rc.1";
6550
6562
  Dexie.Cloud = dexieCloud;
6551
6563
 
6552
6564
  // In case the SW lives for a while, let it reuse already opened connections: