@overmap-ai/core 1.0.60-sdk-refactor.14 → 1.0.60-sdk-refactor.16

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.
@@ -15071,7 +15071,6 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15071
15071
  }
15072
15072
  async function performRequest(action, client) {
15073
15073
  const serviceOfRequest = CLASS_NAME_TO_SERVICE[action.meta.offline.effect.serviceName];
15074
- console.debug(CLASS_NAME_TO_SERVICE, action.meta.offline.effect.serviceName, serviceOfRequest);
15075
15074
  if (!serviceOfRequest) {
15076
15075
  throw new Error(`Service ${action.meta.offline.effect.serviceName} not found`);
15077
15076
  }
@@ -15452,19 +15451,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15452
15451
  checkAuth: false,
15453
15452
  // Don't wait for other requests to finish, or we might end up in a deadlock.
15454
15453
  immediate: true
15455
- }).catch((e) => {
15456
- console.error("Could not renew tokens; logging out due to error:", e);
15457
- this.clearAuth();
15458
- return void 0;
15459
15454
  });
15460
15455
  let response = void 0;
15461
15456
  try {
15462
15457
  response = await promise;
15463
15458
  } catch (e) {
15459
+ console.error("Could not renew tokens; clearing auth", e);
15464
15460
  this.clearAuth();
15465
- }
15466
- if (!response)
15467
15461
  return void 0;
15462
+ }
15468
15463
  if (!response.access)
15469
15464
  throw new Error("Missing access token");
15470
15465
  if (!response.refresh)
@@ -15476,6 +15471,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15476
15471
  * Logs the user out
15477
15472
  */
15478
15473
  clearAuth() {
15474
+ console.debug(this.constructor.name, "clearing auth;");
15479
15475
  this.dispatch(setLoggedIn(false));
15480
15476
  this.clearTokens();
15481
15477
  this.dispatch(setActiveProjectId(null));
@@ -15491,6 +15487,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15491
15487
  if (!dyingRefreshToken) {
15492
15488
  throw new Error("No refresh token found");
15493
15489
  }
15490
+ console.debug(this.constructor.name, "renewing tokens");
15494
15491
  try {
15495
15492
  const tokens = await this._getRenewedTokens(dyingRefreshToken);
15496
15493
  if (!tokens) {
@@ -15499,15 +15496,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15499
15496
  console.log("Got renewed tokens");
15500
15497
  this.setTokens(tokens);
15501
15498
  } catch (e) {
15502
- console.error("Could not renew tokens; logging out.");
15499
+ console.error("Could not renew tokens; clearing auth", e);
15503
15500
  this.clearAuth();
15504
15501
  throw e;
15505
15502
  }
15506
15503
  }
15507
- /**
15508
- * Checks whether the tokens will be expiring soon
15509
- * @returns {boolean}
15510
- */
15511
15504
  tokenIsExpiringSoon() {
15512
15505
  const accessToken = this.getAccessToken();
15513
15506
  if (!accessToken) {
@@ -15525,12 +15518,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15525
15518
  }
15526
15519
  getAuthHeader() {
15527
15520
  const accessToken = this.getAccessToken();
15528
- console.debug("getAuthHeader", accessToken);
15529
15521
  return `Bearer ${accessToken}`;
15530
15522
  }
15531
15523
  async prepareAuth() {
15532
15524
  if (!this.tokenIsExpiringSoon())
15533
15525
  return;
15526
+ console.debug(this.constructor.name, "preparing auth");
15534
15527
  try {
15535
15528
  await this.renewTokens();
15536
15529
  } catch (e) {
@@ -15567,6 +15560,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15567
15560
  }
15568
15561
  async initAuth(payload) {
15569
15562
  const uuid$1 = uuid.v4();
15563
+ console.debug(this.constructor.name, "Initiating auth");
15570
15564
  const promise = this.enqueueRequest({
15571
15565
  uuid: uuid$1,
15572
15566
  description: "Get token pair",