@bytescale/sdk 3.43.0 → 3.44.0

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.
@@ -3084,6 +3084,14 @@ function Scheduler_createClass(Constructor, protoProps, staticProps) { if (proto
3084
3084
  function Scheduler_toPropertyKey(t) { var i = Scheduler_toPrimitive(t, "string"); return "symbol" == Scheduler_typeof(i) ? i : i + ""; }
3085
3085
  function Scheduler_toPrimitive(t, r) { if ("object" != Scheduler_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Scheduler_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3086
3086
 
3087
+ /**
3088
+ * -------------------------
3089
+ * Q: Why not use 'setTimeout'?
3090
+ * -------------------------
3091
+ * A: setTimeout can be paused (e.g., during hibernation), risking JWT expiration before it triggers.
3092
+ * We therefore use a scheduler to check wall-clock time every second and execute the callback at the scheduled time.
3093
+ * -------------------------
3094
+ */
3087
3095
  var Scheduler = /*#__PURE__*/function () {
3088
3096
  function Scheduler() {
3089
3097
  Scheduler_classCallCheck(this, Scheduler);
@@ -3381,6 +3389,8 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3381
3389
  ConsoleUtils.warn("Unable to refresh JWT access token: ".concat(e));
3382
3390
  });
3383
3391
  }, function (_wasThrown, _result) {
3392
+ // 'setTimeout' can be paused (e.g., during hibernation), risking JWT expiration before it triggers. We use a
3393
+ // scheduler to check wall-clock time every second and execute the callback at the scheduled time (below).
3384
3394
  session.accessTokenRefreshHandle = _this3.scheduler.schedule(expires, function () {
3385
3395
  _this3.refreshAccessToken(session).then(function () {},
3386
3396
  // Should not occur, as this method shouldn't throw errors.
@@ -3069,6 +3069,14 @@ function Scheduler_createClass(Constructor, protoProps, staticProps) { if (proto
3069
3069
  function Scheduler_toPropertyKey(t) { var i = Scheduler_toPrimitive(t, "string"); return "symbol" == Scheduler_typeof(i) ? i : i + ""; }
3070
3070
  function Scheduler_toPrimitive(t, r) { if ("object" != Scheduler_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Scheduler_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3071
3071
 
3072
+ /**
3073
+ * -------------------------
3074
+ * Q: Why not use 'setTimeout'?
3075
+ * -------------------------
3076
+ * A: setTimeout can be paused (e.g., during hibernation), risking JWT expiration before it triggers.
3077
+ * We therefore use a scheduler to check wall-clock time every second and execute the callback at the scheduled time.
3078
+ * -------------------------
3079
+ */
3072
3080
  var Scheduler = /*#__PURE__*/function () {
3073
3081
  function Scheduler() {
3074
3082
  Scheduler_classCallCheck(this, Scheduler);
@@ -3366,6 +3374,8 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3366
3374
  ConsoleUtils.warn("Unable to refresh JWT access token: ".concat(e));
3367
3375
  });
3368
3376
  }, function (_wasThrown, _result) {
3377
+ // 'setTimeout' can be paused (e.g., during hibernation), risking JWT expiration before it triggers. We use a
3378
+ // scheduler to check wall-clock time every second and execute the callback at the scheduled time (below).
3369
3379
  session.accessTokenRefreshHandle = _this3.scheduler.schedule(expires, function () {
3370
3380
  _this3.refreshAccessToken(session).then(function () {},
3371
3381
  // Should not occur, as this method shouldn't throw errors.
@@ -1,3 +1,11 @@
1
+ /**
2
+ * -------------------------
3
+ * Q: Why not use 'setTimeout'?
4
+ * -------------------------
5
+ * A: setTimeout can be paused (e.g., during hibernation), risking JWT expiration before it triggers.
6
+ * We therefore use a scheduler to check wall-clock time every second and execute the callback at the scheduled time.
7
+ * -------------------------
8
+ */
1
9
  export declare class Scheduler {
2
10
  private callbacks;
3
11
  private nextId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "3.43.0",
3
+ "version": "3.44.0",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",