@overmap-ai/core 1.0.60-sdk-refactor.15 → 1.0.60-sdk-refactor.17

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.
@@ -15462,22 +15462,20 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15462
15462
  }
15463
15463
  if (!response.access)
15464
15464
  throw new Error("Missing access token");
15465
- if (!response.refresh)
15466
- throw new Error("Missing refresh token");
15467
- return { accessToken: response.access, refreshToken: response.refresh };
15465
+ return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
15468
15466
  });
15469
15467
  }
15470
15468
  /**
15471
15469
  * Logs the user out
15472
15470
  */
15473
15471
  clearAuth() {
15472
+ console.debug(this.constructor.name, "clearing auth;");
15474
15473
  this.dispatch(setLoggedIn(false));
15475
15474
  this.clearTokens();
15476
15475
  this.dispatch(setActiveProjectId(null));
15477
15476
  this.dispatch(setActiveWorkspaceId(null));
15478
15477
  this.dispatch({ type: constants.RESET_STATE });
15479
15478
  this.dispatch({ type: resetStore });
15480
- console.debug(this.constructor.name, "clearing auth;");
15481
15479
  }
15482
15480
  /**
15483
15481
  * Attempts to renew tokens
@@ -15487,6 +15485,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15487
15485
  if (!dyingRefreshToken) {
15488
15486
  throw new Error("No refresh token found");
15489
15487
  }
15488
+ console.debug(this.constructor.name, "renewing tokens");
15490
15489
  try {
15491
15490
  const tokens = await this._getRenewedTokens(dyingRefreshToken);
15492
15491
  if (!tokens) {
@@ -15517,12 +15516,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15517
15516
  }
15518
15517
  getAuthHeader() {
15519
15518
  const accessToken = this.getAccessToken();
15520
- console.debug("getAuthHeader", accessToken);
15521
15519
  return `Bearer ${accessToken}`;
15522
15520
  }
15523
15521
  async prepareAuth() {
15524
15522
  if (!this.tokenIsExpiringSoon())
15525
15523
  return;
15524
+ console.debug(this.constructor.name, "preparing auth");
15526
15525
  try {
15527
15526
  await this.renewTokens();
15528
15527
  } catch (e) {
@@ -15559,6 +15558,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
15559
15558
  }
15560
15559
  async initAuth(payload) {
15561
15560
  const uuid$1 = uuid.v4();
15561
+ console.debug(this.constructor.name, "Initiating auth");
15562
15562
  const promise = this.enqueueRequest({
15563
15563
  uuid: uuid$1,
15564
15564
  description: "Get token pair",