@overmap-ai/core 1.0.15 → 1.0.16-fix-misc-issues.1

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.
@@ -21,6 +21,8 @@ import ColorCls from "color";
21
21
  import jwtDecode from "jwt-decode";
22
22
  import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
23
23
  import { openDB } from "idb";
24
+ const debugLog = (...args) => {
25
+ };
24
26
  class OutboxCoordinator {
25
27
  constructor() {
26
28
  __publicField(this, "graph");
@@ -91,6 +93,7 @@ class OutboxCoordinator {
91
93
  continue;
92
94
  const details = this.graph.getNodeData(node);
93
95
  if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
96
+ debugLog("Adding dependency from", request2.payload.uuid, "to", node);
94
97
  this._addDependency(request2.payload.uuid, node);
95
98
  }
96
99
  }
@@ -142,9 +145,11 @@ class OutboxCoordinator {
142
145
  */
143
146
  peek() {
144
147
  const nextNode = this._getNextNode();
145
- if (!nextNode)
148
+ if (!nextNode) {
146
149
  return void 0;
147
- return this.graph.getNodeData(nextNode);
150
+ }
151
+ const ret = this.graph.getNodeData(nextNode);
152
+ return ret;
148
153
  }
149
154
  /**
150
155
  * Removes a request from the graph. This should be called when a request is successfully sent.
@@ -201,6 +206,7 @@ class OutboxCoordinator {
201
206
  }
202
207
  registerRetry(uuid) {
203
208
  this.requestAttemptCounter[uuid] = (this.requestAttemptCounter[uuid] || 0) + 1;
209
+ debugLog("Registered retry for request:", uuid, "with", this.requestAttemptCounter[uuid], "attempts");
204
210
  }
205
211
  }
206
212
  class APIError extends Error {
@@ -2117,7 +2123,7 @@ const searchIssues = restructureCreateSelectorWithArgs(
2117
2123
  issue.offline_id,
2118
2124
  "warn",
2119
2125
  `Encountered issue with an index_workspace that doesn't exist. Issue ${issue.offline_id} has
2120
- index_workspace = ${issue.index_workspace}, but ${issue.index_workspace} does not exist in:`,
2126
+ index_workspace = ${issue.index_workspace}, which does not exist in:`,
2121
2127
  Object.keys(workspaceMapping)
2122
2128
  );
2123
2129
  continue;
@@ -3301,6 +3307,7 @@ const defaultStore = configureStore({
3301
3307
  }
3302
3308
  });
3303
3309
  async function performRequest(action, client) {
3310
+ var _a2;
3304
3311
  async function checkToken() {
3305
3312
  if (client.auth.tokenIsExpiringSoon()) {
3306
3313
  await client.auth.renewTokens();
@@ -3382,6 +3389,7 @@ async function performRequest(action, client) {
3382
3389
  requestToSend = requestToSend.set(headers);
3383
3390
  }
3384
3391
  try {
3392
+ debugLog("Sending request:", requestDetails, "with params:", queryParams);
3385
3393
  return await requestToSend.query(queryParams);
3386
3394
  } catch (error) {
3387
3395
  console.error(error);
@@ -3404,9 +3412,18 @@ async function performRequest(action, client) {
3404
3412
  throw new APIError("You have been signed out due to inactivity.", originalError, { discard: true });
3405
3413
  }
3406
3414
  }
3407
- throw new APIError(originalError.text, originalError, {
3408
- discard: discardStatuses.includes(originalError.status)
3409
- });
3415
+ const apiErrorMessage = (_a2 = originalError.body) == null ? void 0 : _a2.error;
3416
+ throw new APIError(
3417
+ typeof apiErrorMessage === "string" ? apiErrorMessage : (
3418
+ // TODO: Error codes for all APIErrors.
3419
+ // TODO: Constant for all messages.
3420
+ originalError.text || "An unexpected error occurred."
3421
+ ),
3422
+ originalError,
3423
+ {
3424
+ discard: discardStatuses.includes(originalError.status)
3425
+ }
3426
+ );
3410
3427
  }
3411
3428
  }
3412
3429
  class MiddlewareChainerPrivate {
@@ -5309,7 +5326,7 @@ class UserFormSubmissionService extends BaseApiService {
5309
5326
  const { store } = this.client;
5310
5327
  const projectId = store.getState().projectReducer.activeProjectId;
5311
5328
  const submissions = await this.enqueueRequest({
5312
- description: "Fetch user form submissions",
5329
+ description: "Fetch form submissions",
5313
5330
  method: HttpMethod.GET,
5314
5331
  url: `/forms/in-project/${projectId}/submissions/`,
5315
5332
  blockers: [],
@@ -5317,7 +5334,7 @@ class UserFormSubmissionService extends BaseApiService {
5317
5334
  });
5318
5335
  store.dispatch(setUserFormSubmissions(submissions));
5319
5336
  const attachments = await this.enqueueRequest({
5320
- description: "Fetch user form attachments",
5337
+ description: "Fetch form attachments",
5321
5338
  method: HttpMethod.GET,
5322
5339
  url: `/forms/in-project/${projectId}/attachments/`,
5323
5340
  blockers: [],
@@ -5772,6 +5789,7 @@ export {
5772
5789
  coordinatesToUrlText,
5773
5790
  createOfflineAction,
5774
5791
  createPointMarker,
5792
+ debugLog,
5775
5793
  defaultBadgeColor,
5776
5794
  defaultStore,
5777
5795
  deleteComponentType,