@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.
@@ -9,6 +9,8 @@ var __publicField = (obj, key, value) => {
9
9
  })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, uuid, ColorCls, jwtDecode, constants, idb) {
10
10
  var _a;
11
11
  "use strict";
12
+ const debugLog = (...args) => {
13
+ };
12
14
  class OutboxCoordinator {
13
15
  constructor() {
14
16
  __publicField(this, "graph");
@@ -79,6 +81,7 @@ var __publicField = (obj, key, value) => {
79
81
  continue;
80
82
  const details = this.graph.getNodeData(node);
81
83
  if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
84
+ debugLog("Adding dependency from", request2.payload.uuid, "to", node);
82
85
  this._addDependency(request2.payload.uuid, node);
83
86
  }
84
87
  }
@@ -130,9 +133,11 @@ var __publicField = (obj, key, value) => {
130
133
  */
131
134
  peek() {
132
135
  const nextNode = this._getNextNode();
133
- if (!nextNode)
136
+ if (!nextNode) {
134
137
  return void 0;
135
- return this.graph.getNodeData(nextNode);
138
+ }
139
+ const ret = this.graph.getNodeData(nextNode);
140
+ return ret;
136
141
  }
137
142
  /**
138
143
  * Removes a request from the graph. This should be called when a request is successfully sent.
@@ -189,6 +194,7 @@ var __publicField = (obj, key, value) => {
189
194
  }
190
195
  registerRetry(uuid2) {
191
196
  this.requestAttemptCounter[uuid2] = (this.requestAttemptCounter[uuid2] || 0) + 1;
197
+ debugLog("Registered retry for request:", uuid2, "with", this.requestAttemptCounter[uuid2], "attempts");
192
198
  }
193
199
  }
194
200
  class APIError extends Error {
@@ -2105,7 +2111,7 @@ var __publicField = (obj, key, value) => {
2105
2111
  issue.offline_id,
2106
2112
  "warn",
2107
2113
  `Encountered issue with an index_workspace that doesn't exist. Issue ${issue.offline_id} has
2108
- index_workspace = ${issue.index_workspace}, but ${issue.index_workspace} does not exist in:`,
2114
+ index_workspace = ${issue.index_workspace}, which does not exist in:`,
2109
2115
  Object.keys(workspaceMapping)
2110
2116
  );
2111
2117
  continue;
@@ -3289,6 +3295,7 @@ var __publicField = (obj, key, value) => {
3289
3295
  }
3290
3296
  });
3291
3297
  async function performRequest(action, client) {
3298
+ var _a2;
3292
3299
  async function checkToken() {
3293
3300
  if (client.auth.tokenIsExpiringSoon()) {
3294
3301
  await client.auth.renewTokens();
@@ -3370,6 +3377,7 @@ var __publicField = (obj, key, value) => {
3370
3377
  requestToSend = requestToSend.set(headers);
3371
3378
  }
3372
3379
  try {
3380
+ debugLog("Sending request:", requestDetails, "with params:", queryParams);
3373
3381
  return await requestToSend.query(queryParams);
3374
3382
  } catch (error) {
3375
3383
  console.error(error);
@@ -3392,9 +3400,18 @@ var __publicField = (obj, key, value) => {
3392
3400
  throw new APIError("You have been signed out due to inactivity.", originalError, { discard: true });
3393
3401
  }
3394
3402
  }
3395
- throw new APIError(originalError.text, originalError, {
3396
- discard: discardStatuses.includes(originalError.status)
3397
- });
3403
+ const apiErrorMessage = (_a2 = originalError.body) == null ? void 0 : _a2.error;
3404
+ throw new APIError(
3405
+ typeof apiErrorMessage === "string" ? apiErrorMessage : (
3406
+ // TODO: Error codes for all APIErrors.
3407
+ // TODO: Constant for all messages.
3408
+ originalError.text || "An unexpected error occurred."
3409
+ ),
3410
+ originalError,
3411
+ {
3412
+ discard: discardStatuses.includes(originalError.status)
3413
+ }
3414
+ );
3398
3415
  }
3399
3416
  }
3400
3417
  class MiddlewareChainerPrivate {
@@ -5297,7 +5314,7 @@ var __publicField = (obj, key, value) => {
5297
5314
  const { store } = this.client;
5298
5315
  const projectId = store.getState().projectReducer.activeProjectId;
5299
5316
  const submissions = await this.enqueueRequest({
5300
- description: "Fetch user form submissions",
5317
+ description: "Fetch form submissions",
5301
5318
  method: HttpMethod.GET,
5302
5319
  url: `/forms/in-project/${projectId}/submissions/`,
5303
5320
  blockers: [],
@@ -5305,7 +5322,7 @@ var __publicField = (obj, key, value) => {
5305
5322
  });
5306
5323
  store.dispatch(setUserFormSubmissions(submissions));
5307
5324
  const attachments = await this.enqueueRequest({
5308
- description: "Fetch user form attachments",
5325
+ description: "Fetch form attachments",
5309
5326
  method: HttpMethod.GET,
5310
5327
  url: `/forms/in-project/${projectId}/attachments/`,
5311
5328
  blockers: [],
@@ -5758,6 +5775,7 @@ var __publicField = (obj, key, value) => {
5758
5775
  exports2.coordinatesToUrlText = coordinatesToUrlText;
5759
5776
  exports2.createOfflineAction = createOfflineAction;
5760
5777
  exports2.createPointMarker = createPointMarker;
5778
+ exports2.debugLog = debugLog;
5761
5779
  exports2.defaultBadgeColor = defaultBadgeColor;
5762
5780
  exports2.defaultStore = defaultStore;
5763
5781
  exports2.deleteComponentType = deleteComponentType;