@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.
@@ -1 +1 @@
1
- export declare const OUTBOX_RETRY_DELAY = 5000;
1
+ export declare const OUTBOX_RETRY_DELAY = 60000;
@@ -229,13 +229,16 @@ const UNKNOWN_ERROR_MESSAGE = "An unknown error occurred";
229
229
  const MAX_ERROR_MESSAGE_LENGTH = 500;
230
230
  const _SPECIAL_KEYS = ["non_field_errors", "detail"];
231
231
  function extractErrorMessage(errorRes, err) {
232
+ console.debug("extracting error message from response", errorRes, err);
232
233
  let ret;
233
234
  if (errorRes == null ? void 0 : errorRes.body) {
234
235
  if (typeof errorRes.body === "object") {
235
236
  const responseBody = errorRes.body;
236
237
  if (typeof responseBody.error === "string") {
238
+ console.debug("body.error is string", responseBody.error);
237
239
  ret = responseBody.error;
238
240
  } else if (typeof responseBody.message === "string") {
241
+ console.debug("body.message is string", responseBody.message);
239
242
  ret = responseBody.message;
240
243
  } else if (responseBody.body) {
241
244
  try {
@@ -252,16 +255,20 @@ function extractErrorMessage(errorRes, err) {
252
255
  }
253
256
  return `${key}: ${JSON.stringify(value)}`;
254
257
  }).join("\n");
258
+ console.debug("parsing error body", ret);
255
259
  } catch (e) {
256
260
  console.error("Failed to extract error message from response body", e);
257
261
  }
258
262
  }
259
263
  } else if (typeof errorRes.body === "string") {
264
+ console.debug("error body is string", errorRes.body);
260
265
  ret = errorRes.body;
261
266
  }
262
267
  } else if (errorRes == null ? void 0 : errorRes.text) {
268
+ console.debug("error.text", errorRes.text);
263
269
  ret = errorRes.text;
264
270
  } else if (err instanceof Error) {
271
+ console.debug("instance of Error", err.message);
265
272
  ret = err.message;
266
273
  }
267
274
  if (!ret || ret.length > MAX_ERROR_MESSAGE_LENGTH) {
@@ -657,7 +664,7 @@ const emailRegex = /^.+@.+\..+$/;
657
664
  const fullAssetMarkerSize = 45;
658
665
  const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
659
666
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
660
- const OUTBOX_RETRY_DELAY = 5e3;
667
+ const OUTBOX_RETRY_DELAY = 6e4;
661
668
  const EMPTY_ARRAY = Object.freeze([]);
662
669
  let debug = false;
663
670
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
@@ -6223,22 +6230,50 @@ class FormSubmissionService extends BaseUploadService {
6223
6230
  }
6224
6231
  }
6225
6232
  async refreshStore(projectId) {
6226
- const submissions = await this.enqueueRequest({
6227
- description: "Fetch form submissions",
6233
+ const formSubmissions = {};
6234
+ const modelSubmissions = await this.enqueueRequest({
6235
+ description: "Fetch model submissions",
6228
6236
  method: HttpMethod.GET,
6229
- url: `/forms/in-project/${projectId}/submissions/`,
6237
+ url: `/forms/in-project/${projectId}/submissions/model/latest/`,
6230
6238
  blockers: [],
6231
6239
  blocks: []
6232
6240
  });
6233
- this.dispatch(initializeFormSubmissions(submissions));
6234
- const attachments = await this.enqueueRequest({
6235
- description: "Fetch form attachments",
6241
+ for (const modelSubmission of modelSubmissions) {
6242
+ formSubmissions[modelSubmission.offline_id] = modelSubmission;
6243
+ }
6244
+ const standaloneSubmissions = await this.enqueueRequest({
6245
+ description: "Fetch standalone submissions",
6246
+ method: HttpMethod.GET,
6247
+ url: `/forms/in-project/${projectId}/submissions/standalone/`,
6248
+ blockers: [],
6249
+ blocks: []
6250
+ });
6251
+ for (const standaloneSubmission of standaloneSubmissions) {
6252
+ formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
6253
+ }
6254
+ this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
6255
+ const attachments = {};
6256
+ const modelAttachments = await this.enqueueRequest({
6257
+ description: "Fetch model submission attachments",
6236
6258
  method: HttpMethod.GET,
6237
- url: `/forms/in-project/${projectId}/attachments/`,
6259
+ url: `/forms/in-project/${projectId}/attachments/model/latest/`,
6238
6260
  blockers: [],
6239
6261
  blocks: []
6240
6262
  });
6241
- this.dispatch(initializeFormSubmissionAttachments(attachments));
6263
+ for (const modelAttachment of modelAttachments) {
6264
+ attachments[modelAttachment.offline_id] = modelAttachment;
6265
+ }
6266
+ const standaloneAttachments = await this.enqueueRequest({
6267
+ description: "Fetch standalone submission attachments",
6268
+ method: HttpMethod.GET,
6269
+ url: `/forms/in-project/${projectId}/attachments/standalone/`,
6270
+ blockers: [],
6271
+ blocks: []
6272
+ });
6273
+ for (const standaloneAttachent of standaloneAttachments) {
6274
+ attachments[standaloneAttachent.offline_id] = standaloneAttachent;
6275
+ }
6276
+ this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
6242
6277
  }
6243
6278
  }
6244
6279
  class WorkspaceService extends BaseApiService {