@overmap-ai/core 1.0.71-fields.0 → 1.0.71-fields.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.
@@ -7394,6 +7394,61 @@ class FormSubmissionAttachmentService extends BaseUploadService {
7394
7394
  this.dispatch(initializeFormSubmissionAttachments(result));
7395
7395
  }
7396
7396
  }
7397
+ class FormRevisionService extends BaseUploadService {
7398
+ add(payload) {
7399
+ var _a2;
7400
+ const { store } = this.client;
7401
+ const state = store.getState();
7402
+ const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
7403
+ const offlineFormRevision = offline({
7404
+ ...payload,
7405
+ created_by: createdBy,
7406
+ revision: "Pending",
7407
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7408
+ });
7409
+ this.dispatch(addFormRevision(offlineFormRevision));
7410
+ const promise = this.enqueueRequest({
7411
+ description: "Create form revision",
7412
+ method: HttpMethod.POST,
7413
+ url: "/form-revisions/",
7414
+ payload: offlineFormRevision,
7415
+ blockers: [payload.form],
7416
+ blocks: [offlineFormRevision.offline_id]
7417
+ });
7418
+ void promise.then((result) => {
7419
+ this.dispatch(setFormRevision(result));
7420
+ }).catch(() => {
7421
+ this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
7422
+ });
7423
+ return [offlineFormRevision, promise];
7424
+ }
7425
+ async refreshStore(projectId, organizationId) {
7426
+ let formRevisions = [];
7427
+ const projectFormRevisions = await this.enqueueRequest({
7428
+ description: "Fetch project form revisions",
7429
+ method: HttpMethod.GET,
7430
+ url: "/form-revisions/",
7431
+ queryParams: {
7432
+ project: projectId.toString()
7433
+ },
7434
+ blockers: [projectId.toString()],
7435
+ blocks: []
7436
+ });
7437
+ formRevisions = formRevisions.concat(projectFormRevisions);
7438
+ const organizationFormRevisions = await this.enqueueRequest({
7439
+ description: "Fetch organization form revisions",
7440
+ method: HttpMethod.GET,
7441
+ url: "/form-revisions/",
7442
+ queryParams: {
7443
+ organization: organizationId.toString()
7444
+ },
7445
+ blockers: [organizationId.toString()],
7446
+ blocks: []
7447
+ });
7448
+ formRevisions = formRevisions.concat(organizationFormRevisions);
7449
+ this.dispatch(initializeFormRevisions(formRevisions));
7450
+ }
7451
+ }
7397
7452
  class AssetTypeFieldsAttachmentService extends BaseUploadService {
7398
7453
  async bulkAdd(payloads) {
7399
7454
  var _a2;
@@ -8092,6 +8147,7 @@ export {
8092
8147
  EmailVerificationService,
8093
8148
  FileService,
8094
8149
  FormRevisionAttachmentService,
8150
+ FormRevisionService,
8095
8151
  FormService,
8096
8152
  FormSubmissionAttachmentService,
8097
8153
  FormSubmissionService,