@overmap-ai/core 1.0.65-error-message-fix.2 → 1.0.65-error-message-fix.4

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.
@@ -229,9 +229,9 @@ var __publicField = (obj, key, value) => {
229
229
  } else if (typeof responseBody.message === "string") {
230
230
  console.debug("body.message is string", responseBody.message);
231
231
  ret = responseBody.message;
232
- } else if (responseBody.body) {
232
+ } else {
233
233
  try {
234
- ret = Object.entries(responseBody.body).map(([key, value]) => {
234
+ ret = Object.entries(responseBody).map(([key, value]) => {
235
235
  if (typeof value === "string") {
236
236
  if (_SPECIAL_KEYS.includes(key))
237
237
  return value;
@@ -4056,7 +4056,6 @@ var __publicField = (obj, key, value) => {
4056
4056
  }
4057
4057
  async initAuth(payload) {
4058
4058
  const uuid$1 = uuid.v4();
4059
- console.debug(this.constructor.name, "Initiating auth");
4060
4059
  const promise = this.enqueueRequest({
4061
4060
  uuid: uuid$1,
4062
4061
  description: "Get token pair",
@@ -4067,23 +4066,19 @@ var __publicField = (obj, key, value) => {
4067
4066
  checkAuth: false,
4068
4067
  blockers: [],
4069
4068
  blocks: []
4070
- }).then(parseTokens);
4071
- const timeout = 5;
4069
+ });
4070
+ const timeout = 10;
4072
4071
  let timedOut = false;
4073
- const timeoutPromise = new Promise((_, reject) => {
4074
- setTimeout(() => {
4075
- timedOut = true;
4076
- this.dispatch(markForDeletion(uuid$1));
4077
- reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
4078
- }, timeout * 1e3);
4079
- });
4080
- const successPromise = promise.then((tokens) => {
4072
+ setTimeout(() => {
4073
+ timedOut = true;
4074
+ this.dispatch(markForDeletion(uuid$1));
4075
+ }, timeout * 1e3);
4076
+ return promise.then((tokens) => {
4081
4077
  if (timedOut) {
4082
4078
  return void 0;
4083
4079
  }
4084
- this.setTokens(tokens);
4080
+ this.setTokens(parseTokens(tokens));
4085
4081
  });
4086
- return Promise.race([timeoutPromise, successPromise]);
4087
4082
  }
4088
4083
  }
4089
4084
  class BaseApiService extends BaseService {