@overmap-ai/core 1.0.65-bulk-form-submit.0 → 1.0.65-error-message-fix.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.
@@ -217,13 +217,16 @@ var __publicField = (obj, key, value) => {
217
217
  const MAX_ERROR_MESSAGE_LENGTH = 500;
218
218
  const _SPECIAL_KEYS = ["non_field_errors", "detail"];
219
219
  function extractErrorMessage(errorRes, err) {
220
+ console.debug("extracting error message from response", errorRes, err);
220
221
  let ret;
221
222
  if (errorRes == null ? void 0 : errorRes.body) {
222
223
  if (typeof errorRes.body === "object") {
223
224
  const responseBody = errorRes.body;
224
225
  if (typeof responseBody.error === "string") {
226
+ console.debug("body.error is string", responseBody.error);
225
227
  ret = responseBody.error;
226
228
  } else if (typeof responseBody.message === "string") {
229
+ console.debug("body.message is string", responseBody.message);
227
230
  ret = responseBody.message;
228
231
  } else if (responseBody.body) {
229
232
  try {
@@ -240,16 +243,20 @@ var __publicField = (obj, key, value) => {
240
243
  }
241
244
  return `${key}: ${JSON.stringify(value)}`;
242
245
  }).join("\n");
246
+ console.debug("parsing error body", ret);
243
247
  } catch (e) {
244
248
  console.error("Failed to extract error message from response body", e);
245
249
  }
246
250
  }
247
251
  } else if (typeof errorRes.body === "string") {
252
+ console.debug("error body is string", errorRes.body);
248
253
  ret = errorRes.body;
249
254
  }
250
255
  } else if (errorRes == null ? void 0 : errorRes.text) {
256
+ console.debug("error.text", errorRes.text);
251
257
  ret = errorRes.text;
252
258
  } else if (err instanceof Error) {
259
+ console.debug("instance of Error", err.message);
253
260
  ret = err.message;
254
261
  }
255
262
  if (!ret || ret.length > MAX_ERROR_MESSAGE_LENGTH) {
@@ -645,7 +652,7 @@ var __publicField = (obj, key, value) => {
645
652
  const fullAssetMarkerSize = 45;
646
653
  const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
647
654
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
648
- const OUTBOX_RETRY_DELAY = 5e3;
655
+ const OUTBOX_RETRY_DELAY = 6e4;
649
656
  const EMPTY_ARRAY = Object.freeze([]);
650
657
  let debug = false;
651
658
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
@@ -6211,22 +6218,50 @@ var __publicField = (obj, key, value) => {
6211
6218
  }
6212
6219
  }
6213
6220
  async refreshStore(projectId) {
6214
- const submissions = await this.enqueueRequest({
6215
- description: "Fetch form submissions",
6221
+ const formSubmissions = {};
6222
+ const modelSubmissions = await this.enqueueRequest({
6223
+ description: "Fetch model submissions",
6216
6224
  method: HttpMethod.GET,
6217
- url: `/forms/in-project/${projectId}/submissions/`,
6225
+ url: `/forms/in-project/${projectId}/submissions/model/latest/`,
6218
6226
  blockers: [],
6219
6227
  blocks: []
6220
6228
  });
6221
- this.dispatch(initializeFormSubmissions(submissions));
6222
- const attachments = await this.enqueueRequest({
6223
- description: "Fetch form attachments",
6229
+ for (const modelSubmission of modelSubmissions) {
6230
+ formSubmissions[modelSubmission.offline_id] = modelSubmission;
6231
+ }
6232
+ const standaloneSubmissions = await this.enqueueRequest({
6233
+ description: "Fetch standalone submissions",
6234
+ method: HttpMethod.GET,
6235
+ url: `/forms/in-project/${projectId}/submissions/standalone/`,
6236
+ blockers: [],
6237
+ blocks: []
6238
+ });
6239
+ for (const standaloneSubmission of standaloneSubmissions) {
6240
+ formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
6241
+ }
6242
+ this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
6243
+ const attachments = {};
6244
+ const modelAttachments = await this.enqueueRequest({
6245
+ description: "Fetch model submission attachments",
6224
6246
  method: HttpMethod.GET,
6225
- url: `/forms/in-project/${projectId}/attachments/`,
6247
+ url: `/forms/in-project/${projectId}/attachments/model/latest/`,
6226
6248
  blockers: [],
6227
6249
  blocks: []
6228
6250
  });
6229
- this.dispatch(initializeFormSubmissionAttachments(attachments));
6251
+ for (const modelAttachment of modelAttachments) {
6252
+ attachments[modelAttachment.offline_id] = modelAttachment;
6253
+ }
6254
+ const standaloneAttachments = await this.enqueueRequest({
6255
+ description: "Fetch standalone submission attachments",
6256
+ method: HttpMethod.GET,
6257
+ url: `/forms/in-project/${projectId}/attachments/standalone/`,
6258
+ blockers: [],
6259
+ blocks: []
6260
+ });
6261
+ for (const standaloneAttachent of standaloneAttachments) {
6262
+ attachments[standaloneAttachent.offline_id] = standaloneAttachent;
6263
+ }
6264
+ this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
6230
6265
  }
6231
6266
  }
6232
6267
  class WorkspaceService extends BaseApiService {