@bytescale/sdk 3.56.0 → 3.58.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.
@@ -3196,11 +3196,12 @@ function AuthManagerBrowser_awaitIgnored(value, direct) {
3196
3196
  return value && value.then ? value.then(AuthManagerBrowser_empty) : Promise.resolve();
3197
3197
  }
3198
3198
  }
3199
- function AuthManagerBrowser_invokeIgnored(body) {
3199
+ function AuthManagerBrowser_invoke(body, then) {
3200
3200
  var result = body();
3201
3201
  if (result && result.then) {
3202
- return result.then(AuthManagerBrowser_empty);
3202
+ return result.then(then);
3203
3203
  }
3204
+ return then(result);
3204
3205
  }
3205
3206
  function AuthManagerBrowser_await(value, then, direct) {
3206
3207
  if (direct) {
@@ -3223,12 +3224,11 @@ function AuthManagerBrowser_async(f) {
3223
3224
  }
3224
3225
  };
3225
3226
  }
3226
- function AuthManagerBrowser_invoke(body, then) {
3227
+ function AuthManagerBrowser_invokeIgnored(body) {
3227
3228
  var result = body();
3228
3229
  if (result && result.then) {
3229
- return result.then(then);
3230
+ return result.then(AuthManagerBrowser_empty);
3230
3231
  }
3231
- return then(result);
3232
3232
  }
3233
3233
  function AuthManagerBrowser_catch(body, recover) {
3234
3234
  try {
@@ -3261,14 +3261,29 @@ function AuthManagerBrowser_continueIgnored(value) {
3261
3261
  return value.then(AuthManagerBrowser_empty);
3262
3262
  }
3263
3263
  }
3264
+ function AuthManagerBrowser_call(body, then, direct) {
3265
+ if (direct) {
3266
+ return then ? then(body()) : body();
3267
+ }
3268
+ try {
3269
+ var result = Promise.resolve(body());
3270
+ return then ? result.then(then) : result;
3271
+ } catch (e) {
3272
+ return Promise.reject(e);
3273
+ }
3274
+ }
3264
3275
  function AuthManagerBrowser_continue(value, then) {
3265
3276
  return value && value.then ? value.then(then) : then(value);
3266
3277
  }
3267
- function AuthManagerBrowser_typeof(o) { "@babel/helpers - typeof"; return AuthManagerBrowser_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AuthManagerBrowser_typeof(o); }
3268
3278
  function AuthManagerBrowser_defineProperty(e, r, t) { return (r = AuthManagerBrowser_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3269
3279
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = AuthManagerBrowser_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
3280
+ function AuthManagerBrowser_toConsumableArray(r) { return AuthManagerBrowser_arrayWithoutHoles(r) || AuthManagerBrowser_iterableToArray(r) || AuthManagerBrowser_unsupportedIterableToArray(r) || AuthManagerBrowser_nonIterableSpread(); }
3281
+ function AuthManagerBrowser_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3270
3282
  function AuthManagerBrowser_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return AuthManagerBrowser_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? AuthManagerBrowser_arrayLikeToArray(r, a) : void 0; } }
3283
+ function AuthManagerBrowser_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
3284
+ function AuthManagerBrowser_arrayWithoutHoles(r) { if (Array.isArray(r)) return AuthManagerBrowser_arrayLikeToArray(r); }
3271
3285
  function AuthManagerBrowser_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3286
+ function AuthManagerBrowser_typeof(o) { "@babel/helpers - typeof"; return AuthManagerBrowser_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AuthManagerBrowser_typeof(o); }
3272
3287
  function AuthManagerBrowser_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3273
3288
  function AuthManagerBrowser_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, AuthManagerBrowser_toPropertyKey(o.key), o); } }
3274
3289
  function AuthManagerBrowser_createClass(e, r, t) { return r && AuthManagerBrowser_defineProperties(e.prototype, r), t && AuthManagerBrowser_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -3302,8 +3317,9 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3302
3317
  }, {
3303
3318
  key: "isAuthSessionReady",
3304
3319
  value: function isAuthSessionReady() {
3320
+ var _a;
3305
3321
  var session = AuthSessionState.getSession();
3306
- return (session === null || session === void 0 ? void 0 : session.isReady) === true || (session === null || session === void 0 ? void 0 : session.accessToken) !== undefined;
3322
+ return (_a = session === null || session === void 0 ? void 0 : session.isReady) !== null && _a !== void 0 ? _a : (session === null || session === void 0 ? void 0 : session.accessToken) !== undefined;
3307
3323
  }
3308
3324
  }, {
3309
3325
  key: "beginAuthSession",
@@ -3316,8 +3332,13 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3316
3332
  throw new Error("Auth session already active. Please call 'await endAuthSession()' and then call 'await beginAuthSession(...)' to start a new auth session.");
3317
3333
  }
3318
3334
  var canUseServiceWorkers = _this.serviceWorkerUtils.canUseServiceWorkers();
3319
- if (_this.isV2(params) && !canUseServiceWorkers) {
3320
- throw new Error("This auth session requires service workers, but this browser does not support them.");
3335
+ if (params.serviceWorkerConfig !== undefined) {
3336
+ if (params.serviceWorkerScript === undefined) {
3337
+ throw new Error("The 'serviceWorkerScript' field is required when 'serviceWorkerConfig' is provided.");
3338
+ }
3339
+ if (!canUseServiceWorkers) {
3340
+ throw new Error("The 'serviceWorkerConfig' field requires service workers, but this browser does not support them.");
3341
+ }
3321
3342
  }
3322
3343
  var newSession = {
3323
3344
  accessToken: undefined,
@@ -3328,18 +3349,21 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3328
3349
  authServiceWorker: params.serviceWorkerScript !== undefined && canUseServiceWorkers ? {
3329
3350
  serviceWorkerScript: params.serviceWorkerScript,
3330
3351
  type: "Uninitialized"
3331
- } : undefined
3352
+ } : undefined,
3353
+ primaryAuthSwConfig: undefined,
3354
+ serviceWorkerConfig: undefined,
3355
+ serviceWorkerConfigRefreshHandle: undefined
3332
3356
  };
3333
3357
  AuthSessionState.setSession(newSession);
3334
3358
  return newSession;
3335
3359
  })), function (session) {
3336
3360
  // IMPORTANT: must be called outside the above, else re-entrant deadlock will occur.
3337
- return AuthManagerBrowser_invokeIgnored(function () {
3338
- if (_this.isV2(session.params)) {
3361
+ return AuthManagerBrowser_invoke(function () {
3362
+ if (session.params.serviceWorkerConfig !== undefined) {
3339
3363
  return AuthManagerBrowser_awaitIgnored(_this.refreshServiceWorkerConfig(session, session.params));
3340
- } else {
3341
- return AuthManagerBrowser_awaitIgnored(_this.refreshAccessToken(session, session.params));
3342
3364
  }
3365
+ }, function () {
3366
+ return AuthManagerBrowser_awaitIgnored(_this.refreshAccessToken(session, session.params));
3343
3367
  });
3344
3368
  });
3345
3369
  } catch (e) {
@@ -3361,8 +3385,13 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3361
3385
  if (session.accessTokenRefreshHandle !== undefined) {
3362
3386
  _this2.scheduler.unschedule(session.accessTokenRefreshHandle);
3363
3387
  }
3388
+ if (session.serviceWorkerConfigRefreshHandle !== undefined) {
3389
+ _this2.scheduler.unschedule(session.serviceWorkerConfigRefreshHandle);
3390
+ }
3391
+ // AuthSessionState is shared between bundled SDK versions. Service-worker-only sessions from 3.56.0 did not
3392
+ // contain an accountId, so allow a newer SDK instance to tear those sessions down without calling this endpoint.
3364
3393
  return AuthManagerBrowser_invoke(function () {
3365
- if (!_this2.isV2(session.params)) {
3394
+ if (typeof session.params.accountId === "string") {
3366
3395
  return AuthManagerBrowser_awaitIgnored(_this2.deleteAccessToken(session.params));
3367
3396
  }
3368
3397
  }, function () {
@@ -3404,21 +3433,24 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3404
3433
  return AuthManagerBrowser_await(_this3.setAccessToken(params, jwt, setCookie), function (setTokenResult) {
3405
3434
  return AuthManagerBrowser_invoke(function () {
3406
3435
  if (session.authServiceWorker !== undefined) {
3407
- return AuthManagerBrowser_await(_this3.sendServiceWorkerConfig(session, [{
3436
+ var primaryAuthSwConfig = {
3408
3437
  headers: [{
3409
3438
  key: "Authorization",
3410
3439
  value: "Bearer ".concat(jwt)
3411
3440
  }],
3412
3441
  expires: secondsFromNow(setTokenResult.ttlSeconds),
3413
- sourceUrlPrefixes: params.sourceUrlPrefixes,
3414
3442
  urlPrefix: "".concat(_this3.getCdnUrl(params), "/").concat(params.accountId, "/")
3415
- }]), function () {
3416
- // Allow time for the service worker to receive and process the message. Since this is asynchronous and not
3417
- // synchronized, we need to wait for a sufficient amount of time to ensure the service worker is ready to
3418
- // authenticate requests, so that after 'beginAuthSession' completes, users can start making requests.
3419
- return AuthManagerBrowser_awaitIgnored(new Promise(function (resolve) {
3420
- return setTimeout(resolve, 100);
3421
- }));
3443
+ };
3444
+ // Fail closed until the initial serviceWorkerConfig callback succeeds: without its result, we do not know
3445
+ // the source-page restrictions intended for the primary JWT.
3446
+ return AuthManagerBrowser_invoke(function () {
3447
+ if (params.serviceWorkerConfig === undefined || session.serviceWorkerConfig !== undefined) {
3448
+ return AuthManagerBrowser_await(_this3.sendMergedServiceWorkerConfig(session, primaryAuthSwConfig, session.serviceWorkerConfig), function () {
3449
+ return AuthManagerBrowser_awaitIgnored(_this3.waitForServiceWorker());
3450
+ });
3451
+ }
3452
+ }, function () {
3453
+ session.primaryAuthSwConfig = primaryAuthSwConfig;
3422
3454
  });
3423
3455
  }
3424
3456
  }, function () {
@@ -3430,7 +3462,7 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3430
3462
  expires = secondsFromNow(actualTtl);
3431
3463
  // Set this at the end, as it's also used to signal 'isAuthSessionReady', so must be set after configuring the Service Worker, etc.
3432
3464
  session.accessToken = setTokenResult.accessToken;
3433
- session.isReady = true;
3465
+ _this3.updateSessionReadiness(session);
3434
3466
  });
3435
3467
  });
3436
3468
  });
@@ -3461,6 +3493,10 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3461
3493
  value: function refreshServiceWorkerConfig(session, params) {
3462
3494
  try {
3463
3495
  var _this4 = this;
3496
+ var getServiceWorkerConfig = params.serviceWorkerConfig;
3497
+ if (getServiceWorkerConfig === undefined) {
3498
+ return AuthManagerBrowser_await();
3499
+ }
3464
3500
  return AuthManagerBrowser_await(AuthManagerBrowser_awaitIgnored(_this4.authSessionMutex.safe(AuthManagerBrowser_async(function () {
3465
3501
  var _exit = false;
3466
3502
  if (!session.isActive) {
@@ -3468,17 +3504,35 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3468
3504
  }
3469
3505
  var refreshAt;
3470
3506
  return AuthManagerBrowser_continue(AuthManagerBrowser_catch(function () {
3471
- return AuthManagerBrowser_await(params.getServiceWorkerConfig(), function (config) {
3472
- if (!Array.isArray(config)) {
3473
- throw new Error("The 'getServiceWorkerConfig' callback must return an array.");
3507
+ return AuthManagerBrowser_call(getServiceWorkerConfig, function (result) {
3508
+ if (result === null || AuthManagerBrowser_typeof(result) !== "object" || !Array.isArray(result.additionalConfig)) {
3509
+ throw new Error("The 'serviceWorkerConfig' callback must return an object containing 'additionalConfig'.");
3474
3510
  }
3475
- return AuthManagerBrowser_await(_this4.sendServiceWorkerConfig(session, config), function () {
3476
- return AuthManagerBrowser_await(new Promise(function (resolve) {
3477
- return setTimeout(resolve, 100);
3478
- }), function () {
3479
- session.isReady = true;
3480
- refreshAt = _this4.getServiceWorkerConfigRefreshEpoch(config);
3481
- });
3511
+ if (result.sourceUrlPrefixes !== undefined && (!Array.isArray(result.sourceUrlPrefixes) || !result.sourceUrlPrefixes.every(function (prefix) {
3512
+ return typeof prefix === "string";
3513
+ }))) {
3514
+ throw new Error("The 'sourceUrlPrefixes' field returned by 'serviceWorkerConfig' must be an array of strings.");
3515
+ }
3516
+ if (result.urlRewriteRules !== undefined && (!Array.isArray(result.urlRewriteRules) || !result.urlRewriteRules.every(function (rule) {
3517
+ return rule !== null && AuthManagerBrowser_typeof(rule) === "object" && typeof rule.fromUrlPrefix === "string" && typeof rule.toUrlPrefix === "string";
3518
+ }))) {
3519
+ throw new Error("The 'urlRewriteRules' field returned by 'serviceWorkerConfig' must be an array of URL rewrite rules.");
3520
+ }
3521
+ var config = {
3522
+ additionalConfig: result.additionalConfig,
3523
+ sourceUrlPrefixes: result.sourceUrlPrefixes,
3524
+ urlRewriteRules: result.urlRewriteRules
3525
+ };
3526
+ return AuthManagerBrowser_invoke(function () {
3527
+ if (session.primaryAuthSwConfig !== undefined) {
3528
+ return AuthManagerBrowser_await(_this4.sendMergedServiceWorkerConfig(session, session.primaryAuthSwConfig, config), function () {
3529
+ return AuthManagerBrowser_awaitIgnored(_this4.waitForServiceWorker());
3530
+ });
3531
+ }
3532
+ }, function () {
3533
+ session.serviceWorkerConfig = config;
3534
+ _this4.updateSessionReadiness(session);
3535
+ refreshAt = _this4.getServiceWorkerConfigRefreshEpoch(config.additionalConfig);
3482
3536
  });
3483
3537
  });
3484
3538
  }, function (e) {
@@ -3487,7 +3541,7 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3487
3541
  }), function (_result2) {
3488
3542
  if (_exit) return _result2;
3489
3543
  if (refreshAt !== undefined) {
3490
- session.accessTokenRefreshHandle = _this4.scheduler.schedule(refreshAt, function () {
3544
+ session.serviceWorkerConfigRefreshHandle = _this4.scheduler.schedule(refreshAt, function () {
3491
3545
  _this4.refreshServiceWorkerConfig(session, params).then(function () {}, function (e) {
3492
3546
  return ConsoleUtils.error("Unexpected error when refreshing service worker auth config: ".concat(e));
3493
3547
  });
@@ -3499,6 +3553,19 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3499
3553
  return Promise.reject(e);
3500
3554
  }
3501
3555
  }
3556
+ }, {
3557
+ key: "sendMergedServiceWorkerConfig",
3558
+ value: function sendMergedServiceWorkerConfig(session, primaryConfig, serviceWorkerConfig) {
3559
+ try {
3560
+ var _this5 = this;
3561
+ var _a;
3562
+ return AuthManagerBrowser_await(AuthManagerBrowser_awaitIgnored(_this5.sendServiceWorkerConfig(session, [Object.assign(Object.assign({}, primaryConfig), {
3563
+ sourceUrlPrefixes: serviceWorkerConfig === null || serviceWorkerConfig === void 0 ? void 0 : serviceWorkerConfig.sourceUrlPrefixes
3564
+ })].concat(AuthManagerBrowser_toConsumableArray((_a = serviceWorkerConfig === null || serviceWorkerConfig === void 0 ? void 0 : serviceWorkerConfig.additionalConfig) !== null && _a !== void 0 ? _a : [])), serviceWorkerConfig === null || serviceWorkerConfig === void 0 ? void 0 : serviceWorkerConfig.urlRewriteRules)));
3565
+ } catch (e) {
3566
+ return Promise.reject(e);
3567
+ }
3568
+ }
3502
3569
  }, {
3503
3570
  key: "getServiceWorkerConfigRefreshEpoch",
3504
3571
  value: function getServiceWorkerConfigRefreshEpoch(config) {
@@ -3521,26 +3588,46 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3521
3588
  }
3522
3589
  }, {
3523
3590
  key: "sendServiceWorkerConfig",
3524
- value: function sendServiceWorkerConfig(session, config) {
3591
+ value: function sendServiceWorkerConfig(session, config, urlRewriteRules) {
3525
3592
  try {
3526
- var _this5 = this;
3593
+ var _this6 = this;
3527
3594
  if (session.authServiceWorker === undefined) {
3528
3595
  throw new Error("Service worker configuration cannot be applied because service workers are unavailable.");
3529
3596
  }
3530
- return AuthManagerBrowser_await(_this5.serviceWorkerUtils.sendMessage({
3597
+ return AuthManagerBrowser_await(_this6.serviceWorkerUtils.sendMessage(Object.assign({
3531
3598
  type: "SET_BYTESCALE_AUTH_CONFIG",
3532
3599
  config: config.map(function (entry) {
3533
3600
  return Object.assign(Object.assign({}, entry), {
3534
- urlPrefix: "".concat(entry.sourceUrlPrefixes === undefined ? "" : _this5.sourceScopedUrlPrefixMarker).concat(entry.urlPrefix)
3601
+ urlPrefix: "".concat(entry.sourceUrlPrefixes === undefined ? "" : _this6.sourceScopedUrlPrefixMarker).concat(entry.urlPrefix)
3535
3602
  });
3536
3603
  })
3537
- }, session.authServiceWorker, _this5.serviceWorkerScriptFieldName), function (_this5$serviceWorkerU) {
3538
- session.authServiceWorker = _this5$serviceWorkerU;
3604
+ }, urlRewriteRules === undefined ? {} : {
3605
+ urlRewriteRules: urlRewriteRules
3606
+ }), session.authServiceWorker, _this6.serviceWorkerScriptFieldName), function (_this6$serviceWorkerU) {
3607
+ session.authServiceWorker = _this6$serviceWorkerU;
3539
3608
  });
3540
3609
  } catch (e) {
3541
3610
  return Promise.reject(e);
3542
3611
  }
3543
3612
  }
3613
+ }, {
3614
+ key: "updateSessionReadiness",
3615
+ value: function updateSessionReadiness(session) {
3616
+ session.isReady = session.accessToken !== undefined && (session.params.serviceWorkerConfig === undefined || session.serviceWorkerConfig !== undefined);
3617
+ }
3618
+ }, {
3619
+ key: "waitForServiceWorker",
3620
+ value: function waitForServiceWorker() {
3621
+ try {
3622
+ // Message delivery is asynchronous and has no acknowledgement, so allow the worker time to apply the config before
3623
+ // beginAuthSession reports that authenticated requests are ready.
3624
+ return AuthManagerBrowser_await(AuthManagerBrowser_awaitIgnored(new Promise(function (resolve) {
3625
+ return setTimeout(resolve, 100);
3626
+ })));
3627
+ } catch (e) {
3628
+ return Promise.reject(e);
3629
+ }
3630
+ }
3544
3631
  }, {
3545
3632
  key: "getAccessTokenUrl",
3546
3633
  value: function getAccessTokenUrl(params, setCookie) {
@@ -3556,9 +3643,9 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3556
3643
  key: "deleteAccessToken",
3557
3644
  value: function deleteAccessToken(params) {
3558
3645
  try {
3559
- var _this6 = this;
3646
+ var _this7 = this;
3560
3647
  var _a;
3561
- return AuthManagerBrowser_await(AuthManagerBrowser_awaitIgnored(BaseAPI.fetch(_this6.getAccessTokenUrl(params, true), {
3648
+ return AuthManagerBrowser_await(AuthManagerBrowser_awaitIgnored(BaseAPI.fetch(_this7.getAccessTokenUrl(params, true), {
3562
3649
  method: "DELETE",
3563
3650
  credentials: "include",
3564
3651
  headers: {}
@@ -3574,15 +3661,15 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3574
3661
  key: "setAccessToken",
3575
3662
  value: function setAccessToken(params, jwt, setCookie) {
3576
3663
  try {
3577
- var _this7 = this;
3664
+ var _this8 = this;
3578
3665
  var _a;
3579
3666
  var request = {
3580
3667
  accessToken: jwt
3581
3668
  };
3582
- return AuthManagerBrowser_await(BaseAPI.fetch(_this7.getAccessTokenUrl(params, setCookie), {
3669
+ return AuthManagerBrowser_await(BaseAPI.fetch(_this8.getAccessTokenUrl(params, setCookie), {
3583
3670
  method: "PUT",
3584
3671
  credentials: "include",
3585
- headers: AuthManagerBrowser_defineProperty({}, _this7.contentType, _this7.contentTypeJson),
3672
+ headers: AuthManagerBrowser_defineProperty({}, _this8.contentType, _this8.contentTypeJson),
3586
3673
  body: JSON.stringify(request)
3587
3674
  }, {
3588
3675
  isBytescaleApi: true,
@@ -3598,10 +3685,10 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3598
3685
  key: "getAccessToken",
3599
3686
  value: function getAccessToken(params, headers) {
3600
3687
  try {
3601
- var _this8 = this;
3688
+ var _this9 = this;
3602
3689
  var _a, _b;
3603
3690
  var endpointName = "Your auth API endpoint";
3604
- var requiredContentType = _this8.contentTypeText;
3691
+ var requiredContentType = _this9.contentTypeText;
3605
3692
  return AuthManagerBrowser_await(BaseAPI.fetch(params.authUrl, {
3606
3693
  method: "GET",
3607
3694
  headers: headers
@@ -3609,10 +3696,10 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3609
3696
  isBytescaleApi: false,
3610
3697
  fetchApi: (_a = params.options) === null || _a === void 0 ? void 0 : _a.fetchApi
3611
3698
  }), function (result) {
3612
- var actualContentType = (_b = result.headers.get(_this8.contentType)) !== null && _b !== void 0 ? _b : "";
3699
+ var actualContentType = (_b = result.headers.get(_this9.contentType)) !== null && _b !== void 0 ? _b : "";
3613
3700
  // Support content types like "text/plain; charset=utf-8" and "text/plain"
3614
3701
  if (actualContentType.split(";")[0] !== requiredContentType) {
3615
- throw new Error("".concat(endpointName, " returned \"").concat(actualContentType, "\" for the ").concat(_this8.contentType, " response header, but the Bytescale SDK requires \"").concat(requiredContentType, "\"."));
3702
+ throw new Error("".concat(endpointName, " returned \"").concat(actualContentType, "\" for the ").concat(_this9.contentType, " response header, but the Bytescale SDK requires \"").concat(requiredContentType, "\"."));
3616
3703
  }
3617
3704
  return AuthManagerBrowser_await(result.text(), function (jwt) {
3618
3705
  if (jwt.length === 0) {
@@ -3629,11 +3716,6 @@ var AuthManagerImpl = /*#__PURE__*/function () {
3629
3716
  return Promise.reject(e);
3630
3717
  }
3631
3718
  }
3632
- }, {
3633
- key: "isV2",
3634
- value: function isV2(params) {
3635
- return "getServiceWorkerConfig" in params;
3636
- }
3637
3719
  }]);
3638
3720
  }();
3639
3721
  /**