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) {
@@ -2605,16 +2617,11 @@
2605
2617
  const origUserId = currentUser.userId;
2606
2618
  if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {
2607
2619
  const licenseStatus = ((_a = currentUser.license) === null || _a === void 0 ? void 0 : _a.status) || 'ok';
2608
- if (licenseStatus === 'ok' &&
2609
- currentUser.accessToken &&
2610
- (!currentUser.accessTokenExpiration ||
2611
- currentUser.accessTokenExpiration.getTime() > Date.now())) {
2620
+ if (licenseStatus === 'ok' && currentUser.accessToken && (!currentUser.accessTokenExpiration || currentUser.accessTokenExpiration.getTime() > Date.now())) {
2612
2621
  // Already authenticated according to given hints. And license is valid.
2613
2622
  return false;
2614
2623
  }
2615
- if (currentUser.refreshToken &&
2616
- (!currentUser.refreshTokenExpiration ||
2617
- currentUser.refreshTokenExpiration.getTime() > Date.now())) {
2624
+ if (currentUser.refreshToken && (!currentUser.refreshTokenExpiration || currentUser.refreshTokenExpiration.getTime() > Date.now())) {
2618
2625
  // Refresh the token
2619
2626
  yield loadAccessToken(db);
2620
2627
  return false;
@@ -2626,8 +2633,7 @@
2626
2633
  lastLogin: new Date(0),
2627
2634
  });
2628
2635
  yield authenticate(db.cloud.options.databaseUrl, context, db.cloud.options.fetchTokens || otpFetchTokenCallback(db), db.cloud.userInteraction, hints);
2629
- if (origUserId !== UNAUTHORIZED_USER.userId &&
2630
- context.userId !== origUserId) {
2636
+ if (origUserId !== UNAUTHORIZED_USER.userId && context.userId !== origUserId) {
2631
2637
  // User was logged in before, but now logged in as another user.
2632
2638
  yield logout(db);
2633
2639
  }
@@ -2646,7 +2652,7 @@
2646
2652
  yield setCurrentUser(db, context);
2647
2653
  // Make sure to resync as the new login will be authorized
2648
2654
  // for new realms.
2649
- triggerSync(db, 'pull');
2655
+ triggerSync(db, "pull");
2650
2656
  return context.userId !== origUserId;
2651
2657
  });
2652
2658
  }
@@ -3470,7 +3476,7 @@
3470
3476
  this.v = value;
3471
3477
  }
3472
3478
  }
3473
- const defs = Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3479
+ const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBigIntSupport
3474
3480
  ? {}
3475
3481
  : {
3476
3482
  bigint: {
@@ -3480,7 +3486,16 @@
3480
3486
  },
3481
3487
  revive: ({ v, }) => new FakeBigInt(v)
3482
3488
  }
3483
- }));
3489
+ })), { PropModification: {
3490
+ test: (val) => val instanceof Dexie.PropModification,
3491
+ replace: (propModification) => {
3492
+ return Object.assign({ $t: 'PropModification' }, propModification);
3493
+ },
3494
+ revive: (_a) => {
3495
+ var propModification = __rest(_a, ["$t"]);
3496
+ return new Dexie.PropModification(propModification);
3497
+ }
3498
+ } });
3484
3499
  const TSON = TypesonSimplified(builtin, defs);
3485
3500
  const BISON = Bison(defs);
3486
3501
 
@@ -6273,7 +6288,7 @@
6273
6288
  const syncComplete = new rxjs.Subject();
6274
6289
  dexie.cloud = {
6275
6290
  // @ts-ignore
6276
- version: "4.0.1-beta.58",
6291
+ version: "4.0.1-rc.1",
6277
6292
  options: Object.assign({}, DEFAULT_OPTIONS),
6278
6293
  schema: null,
6279
6294
  get currentUserId() {
@@ -6504,10 +6519,7 @@
6504
6519
  // HERE: If requireAuth, do athentication now.
6505
6520
  let changedUser = false;
6506
6521
  if ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.requireAuth) {
6507
- const user = yield db.getCurrentUser();
6508
- if (!user.isLoggedIn) {
6509
- changedUser = yield login(db);
6510
- }
6522
+ changedUser = yield login(db);
6511
6523
  }
6512
6524
  if (localSyncWorker)
6513
6525
  localSyncWorker.stop();
@@ -6553,7 +6565,7 @@
6553
6565
  }
6554
6566
  }
6555
6567
  // @ts-ignore
6556
- dexieCloud.version = "4.0.1-beta.58";
6568
+ dexieCloud.version = "4.0.1-rc.1";
6557
6569
  Dexie.Cloud = dexieCloud;
6558
6570
 
6559
6571
  exports.default = dexieCloud;