@overmap-ai/core 1.0.71-active-project-state.0 → 1.0.71-field-values-service-improvements.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.
- package/dist/constants/defaults.d.ts +2 -1
- package/dist/constants/index.d.ts +3 -3
- package/dist/enums/index.d.ts +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/overmap-core.js +2005 -1316
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +2013 -1323
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/base.d.ts +8 -6
- package/dist/sdk/classes/OutboxCoordinator.d.ts +4 -4
- package/dist/sdk/classes/index.d.ts +1 -1
- package/dist/sdk/errors.d.ts +3 -1
- package/dist/sdk/globals.d.ts +7 -5
- package/dist/sdk/index.d.ts +6 -6
- package/dist/sdk/sdk.d.ts +6 -5
- package/dist/sdk/services/AgentService.d.ts +4 -3
- package/dist/sdk/services/AssetAttachmentService.d.ts +39 -16
- package/dist/sdk/services/AssetService.d.ts +6 -5
- package/dist/sdk/services/AssetStageCompletionService.d.ts +5 -4
- package/dist/sdk/services/AssetStageService.d.ts +6 -7
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +38 -16
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +13 -0
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +21 -0
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +13 -0
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +9 -0
- package/dist/sdk/services/AssetTypeService.d.ts +6 -5
- package/dist/sdk/services/BaseApiService.d.ts +5 -4
- package/dist/sdk/services/BaseAttachmentService.d.ts +22 -23
- package/dist/sdk/services/BaseAuthService.d.ts +5 -4
- package/dist/sdk/services/BaseService.d.ts +7 -5
- package/dist/sdk/services/BaseUploadService.d.ts +6 -4
- package/dist/sdk/services/CategoryService.d.ts +5 -4
- package/dist/sdk/services/DocumentAttachmentService.d.ts +37 -16
- package/dist/sdk/services/DocumentService.d.ts +5 -4
- package/dist/sdk/services/EmailDomainsService.d.ts +4 -3
- package/dist/sdk/services/EmailVerificationService.d.ts +4 -3
- package/dist/sdk/services/FileService.d.ts +5 -4
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +13 -0
- package/dist/sdk/services/FormRevisionService.d.ts +9 -0
- package/dist/sdk/services/FormService.d.ts +15 -17
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +14 -0
- package/dist/sdk/services/FormSubmissionService.d.ts +12 -31
- package/dist/sdk/services/GeoImageService.d.ts +5 -4
- package/dist/sdk/services/IssueAssociationService.d.ts +6 -5
- package/dist/sdk/services/IssueAttachmentService.d.ts +38 -16
- package/dist/sdk/services/IssueCommentService.d.ts +5 -4
- package/dist/sdk/services/IssueService.d.ts +5 -7
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +14 -0
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +11 -0
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +13 -0
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +9 -0
- package/dist/sdk/services/IssueTypeService.d.ts +5 -4
- package/dist/sdk/services/IssueUpdateService.d.ts +4 -3
- package/dist/sdk/services/JWTAuthService.d.ts +7 -6
- package/dist/sdk/services/LicenseService.d.ts +4 -3
- package/dist/sdk/services/OrganizationAccessService.d.ts +4 -3
- package/dist/sdk/services/OrganizationService.d.ts +4 -3
- package/dist/sdk/services/ProjectAccessService.d.ts +4 -3
- package/dist/sdk/services/ProjectAttachmentService.d.ts +38 -16
- package/dist/sdk/services/ProjectFileService.d.ts +5 -4
- package/dist/sdk/services/ProjectService.d.ts +4 -3
- package/dist/sdk/services/TeamService.d.ts +5 -4
- package/dist/sdk/services/UserService.d.ts +4 -3
- package/dist/sdk/services/WorkspaceService.d.ts +5 -4
- package/dist/sdk/services/index.d.ts +45 -34
- package/dist/sdk/typings.d.ts +9 -8
- package/dist/store/adapter.d.ts +12 -11
- package/dist/store/index.d.ts +2 -2
- package/dist/store/migrations.d.ts +2 -1
- package/dist/store/slices/agentsSlice.d.ts +11 -10
- package/dist/store/slices/assetAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/assetSlice.d.ts +35 -24
- package/dist/store/slices/assetStageCompletionSlice.d.ts +33 -22
- package/dist/store/slices/assetStageSlice.d.ts +36 -26
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +64 -0
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +64 -0
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +63 -0
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +64 -0
- package/dist/store/slices/assetTypeSlice.d.ts +16 -21
- package/dist/store/slices/authSlice.d.ts +10 -9
- package/dist/store/slices/categorySlice.d.ts +30 -16
- package/dist/store/slices/documentAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/documentSlice.d.ts +30 -13
- package/dist/store/slices/emailDomainsSlice.d.ts +29 -15
- package/dist/store/slices/fileSlice.d.ts +7 -6
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/formRevisionSlice.d.ts +37 -27
- package/dist/store/slices/formSlice.d.ts +36 -26
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/formSubmissionSlice.d.ts +16 -27
- package/dist/store/slices/geoImageSlice.d.ts +16 -21
- package/dist/store/slices/index.d.ts +46 -38
- package/dist/store/slices/issueAssociationSlice.d.ts +35 -24
- package/dist/store/slices/issueAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/issueCommentSlice.d.ts +13 -18
- package/dist/store/slices/issueSlice.d.ts +13 -18
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +64 -0
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +63 -0
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +63 -0
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +65 -0
- package/dist/store/slices/issueTypeSlice.d.ts +12 -14
- package/dist/store/slices/issueUpdateSlice.d.ts +13 -18
- package/dist/store/slices/licenseSlice.d.ts +10 -9
- package/dist/store/slices/organizationAccessSlice.d.ts +11 -13
- package/dist/store/slices/organizationSlice.d.ts +27 -10
- package/dist/store/slices/outboxSlice.d.ts +15 -15
- package/dist/store/slices/projectAccessSlice.d.ts +11 -16
- package/dist/store/slices/projectAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/projectFileSlice.d.ts +33 -16
- package/dist/store/slices/projectSlice.d.ts +10 -9
- package/dist/store/slices/rehydratedSlice.d.ts +7 -6
- package/dist/store/slices/teamSlice.d.ts +12 -14
- package/dist/store/slices/userSlice.d.ts +14 -13
- package/dist/store/slices/versioningSlice.d.ts +3 -2
- package/dist/store/slices/workspaceSlice.d.ts +31 -17
- package/dist/store/store.d.ts +15 -7
- package/dist/typings/files.d.ts +8 -4
- package/dist/typings/index.d.ts +6 -6
- package/dist/typings/models/access.d.ts +3 -2
- package/dist/typings/models/agents.d.ts +3 -2
- package/dist/typings/models/assets.d.ts +20 -4
- package/dist/typings/models/attachments.d.ts +3 -7
- package/dist/typings/models/base.d.ts +3 -2
- package/dist/typings/models/categories.d.ts +3 -2
- package/dist/typings/models/documents.d.ts +2 -1
- package/dist/typings/models/emailDomain.d.ts +2 -1
- package/dist/typings/models/emailVerification.d.ts +3 -2
- package/dist/typings/models/fields.d.ts +17 -0
- package/dist/typings/models/forms.d.ts +14 -30
- package/dist/typings/models/geoImages.d.ts +4 -3
- package/dist/typings/models/index.d.ts +22 -21
- package/dist/typings/models/issueTypes.d.ts +3 -2
- package/dist/typings/models/issues.d.ts +22 -6
- package/dist/typings/models/license.d.ts +3 -2
- package/dist/typings/models/organizations.d.ts +2 -1
- package/dist/typings/models/projects.d.ts +4 -3
- package/dist/typings/models/store.d.ts +11 -3
- package/dist/typings/models/teams.d.ts +4 -3
- package/dist/typings/models/users.d.ts +2 -1
- package/dist/typings/models/workspace.d.ts +2 -1
- package/dist/typings/search.d.ts +1 -1
- package/dist/typings/store.d.ts +2 -1
- package/dist/utils/async/DeferredPromise.d.ts +1 -1
- package/dist/utils/colors.d.ts +2 -1
- package/dist/utils/coordinates.d.ts +3 -2
- package/dist/utils/file.d.ts +3 -2
- package/dist/utils/forms.d.ts +2 -1
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/offline.d.ts +2 -1
- package/dist/utils/utils.d.ts +2 -1
- package/package.json +18 -20
package/dist/overmap-core.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
var _a;
|
|
8
5
|
import { DepGraph } from "dependency-graph";
|
|
9
6
|
import { v4 } from "uuid";
|
|
10
7
|
import { saveAs } from "file-saver";
|
|
11
8
|
import ColorCls from "color";
|
|
12
|
-
import {
|
|
9
|
+
import { sky, mint, lime, grass, jade, cyan, blue, indigo, iris, violet, purple, plum, pink, crimson, red, orange, amber, yellow, brown, gold, gray } from "@radix-ui/colors";
|
|
10
|
+
import { createSlice, createSelector, combineReducers, compose } from "@reduxjs/toolkit";
|
|
13
11
|
import { offline as offline$1 } from "@redux-offline/redux-offline";
|
|
14
12
|
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
|
|
15
13
|
import localforage from "localforage";
|
|
16
14
|
import createMigration from "redux-persist-migrate";
|
|
17
|
-
import { createSlice, createSelector, combineReducers } from "@reduxjs/toolkit";
|
|
18
15
|
import request from "superagent";
|
|
19
16
|
import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
|
|
20
17
|
import jwtDecode from "jwt-decode";
|
|
21
18
|
import { openDB } from "idb";
|
|
22
|
-
import { unsafeShowToast } from "@overmap-ai/blocks";
|
|
23
19
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
24
20
|
HttpMethod2["GET"] = "GET";
|
|
25
21
|
HttpMethod2["POST"] = "POST";
|
|
@@ -153,8 +149,7 @@ class OutboxCoordinator {
|
|
|
153
149
|
return;
|
|
154
150
|
}
|
|
155
151
|
for (const node of this.graph.overallOrder()) {
|
|
156
|
-
if (node === request2.payload.uuid)
|
|
157
|
-
continue;
|
|
152
|
+
if (node === request2.payload.uuid) continue;
|
|
158
153
|
const details = this.graph.getNodeData(node);
|
|
159
154
|
if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
|
|
160
155
|
this._addDependency(request2.payload.uuid, node);
|
|
@@ -171,8 +166,7 @@ class OutboxCoordinator {
|
|
|
171
166
|
insertRequest(request2) {
|
|
172
167
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
173
168
|
for (const node of this.graph.overallOrder()) {
|
|
174
|
-
if (node === request2.payload.uuid)
|
|
175
|
-
continue;
|
|
169
|
+
if (node === request2.payload.uuid) continue;
|
|
176
170
|
const details = this.graph.getNodeData(node);
|
|
177
171
|
if (details.payload.blockers.some((blocker) => request2.payload.blocks.includes(blocker))) {
|
|
178
172
|
this._addDependency(node, request2.payload.uuid);
|
|
@@ -208,8 +202,7 @@ class OutboxCoordinator {
|
|
|
208
202
|
*/
|
|
209
203
|
peek() {
|
|
210
204
|
const nextNode = this._getNextNode();
|
|
211
|
-
if (!nextNode)
|
|
212
|
-
return void 0;
|
|
205
|
+
if (!nextNode) return void 0;
|
|
213
206
|
return this.graph.getNodeData(nextNode);
|
|
214
207
|
}
|
|
215
208
|
/**
|
|
@@ -281,17 +274,15 @@ function extractErrorMessage(errorRes, err) {
|
|
|
281
274
|
ret = responseBody.error;
|
|
282
275
|
} else if (typeof responseBody.message === "string") {
|
|
283
276
|
ret = responseBody.message;
|
|
284
|
-
} else
|
|
277
|
+
} else {
|
|
285
278
|
try {
|
|
286
|
-
ret = Object.entries(responseBody
|
|
279
|
+
ret = Object.entries(responseBody).map(([key, value]) => {
|
|
287
280
|
if (typeof value === "string") {
|
|
288
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
289
|
-
return value;
|
|
281
|
+
if (_SPECIAL_KEYS.includes(key)) return value;
|
|
290
282
|
return `${key}: ${value}`;
|
|
291
283
|
}
|
|
292
284
|
if (Array.isArray(value)) {
|
|
293
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
294
|
-
return value.join("\n");
|
|
285
|
+
if (_SPECIAL_KEYS.includes(key)) return value.join("\n");
|
|
295
286
|
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
296
287
|
}
|
|
297
288
|
return `${key}: ${JSON.stringify(value)}`;
|
|
@@ -359,11 +350,9 @@ const coordinatesAreEqual = (a, b) => {
|
|
|
359
350
|
return a[0] === b[0] && a[1] === b[1];
|
|
360
351
|
};
|
|
361
352
|
const coordinatesToText = (coordinates, decimalPlaces) => {
|
|
362
|
-
if (!coordinates)
|
|
363
|
-
return "(No Location)";
|
|
353
|
+
if (!coordinates) return "(No Location)";
|
|
364
354
|
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
365
|
-
if (decimalPlaces)
|
|
366
|
-
return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
355
|
+
if (decimalPlaces) return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
367
356
|
return `${lat}, ${lng}`;
|
|
368
357
|
};
|
|
369
358
|
const coordinatesToUrlText = (coordinates) => {
|
|
@@ -416,7 +405,7 @@ function hashFile(file) {
|
|
|
416
405
|
reader.onload = () => {
|
|
417
406
|
const fileResult = reader.result;
|
|
418
407
|
if (!fileResult) {
|
|
419
|
-
reject();
|
|
408
|
+
reject(new Error("FileReader did not return a valid ArrayBuffer."));
|
|
420
409
|
return;
|
|
421
410
|
}
|
|
422
411
|
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
@@ -430,8 +419,7 @@ function hashFile(file) {
|
|
|
430
419
|
function getFileIdentifier(file) {
|
|
431
420
|
if (!file.name || !file.type || !file.size) {
|
|
432
421
|
const message = "File has no name, type, and/or size";
|
|
433
|
-
|
|
434
|
-
throw new Error(`${message}.`);
|
|
422
|
+
throw new Error(message);
|
|
435
423
|
}
|
|
436
424
|
return `${file.name}&${file.type}${file.size}`;
|
|
437
425
|
}
|
|
@@ -553,21 +541,19 @@ const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
|
553
541
|
const OUTBOX_RETRY_DELAY = 6e4;
|
|
554
542
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
555
543
|
let debug = false;
|
|
556
|
-
const REACT_APP_DEBUG_MEMOIZATION =
|
|
544
|
+
const REACT_APP_DEBUG_MEMOIZATION = "";
|
|
557
545
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
558
546
|
debug = true;
|
|
559
547
|
}
|
|
560
548
|
function shallowEqual(objA, objB) {
|
|
561
|
-
if (objA === objB)
|
|
562
|
-
return true;
|
|
549
|
+
if (objA === objB) return true;
|
|
563
550
|
if (typeof objA !== typeof objB) {
|
|
564
551
|
return false;
|
|
565
552
|
}
|
|
566
553
|
const keysA = Object.keys(objA);
|
|
567
554
|
const keysB = Object.keys(objB);
|
|
568
555
|
const keysALength = keysA.length;
|
|
569
|
-
if (keysALength !== keysB.length)
|
|
570
|
-
return false;
|
|
556
|
+
if (keysALength !== keysB.length) return false;
|
|
571
557
|
for (let i = 0; i < keysALength; i++) {
|
|
572
558
|
const key = keysA[i];
|
|
573
559
|
if (!Object.prototype.hasOwnProperty.call(objB, key) || objA[key] !== objB[key]) {
|
|
@@ -594,11 +580,9 @@ function memoize(func) {
|
|
|
594
580
|
};
|
|
595
581
|
}
|
|
596
582
|
function areArraysEqual(first, second) {
|
|
597
|
-
if (first.length !== second.length)
|
|
598
|
-
return false;
|
|
583
|
+
if (first.length !== second.length) return false;
|
|
599
584
|
for (let i = 0; i < first.length; i++) {
|
|
600
|
-
if (first[i] !== second[i])
|
|
601
|
-
return false;
|
|
585
|
+
if (first[i] !== second[i]) return false;
|
|
602
586
|
}
|
|
603
587
|
return true;
|
|
604
588
|
}
|
|
@@ -643,13 +627,11 @@ const generateBadgeColors = (rawColor) => {
|
|
|
643
627
|
return { backgroundColor, textColor };
|
|
644
628
|
};
|
|
645
629
|
const getLocalDateString = memoize((date) => {
|
|
646
|
-
if (!date)
|
|
647
|
-
return "";
|
|
630
|
+
if (!date) return "";
|
|
648
631
|
const asDate = new Date(date);
|
|
649
632
|
const isThisYear = asDate.getFullYear() === today.getFullYear();
|
|
650
633
|
const options = { day: "numeric", month: "short" };
|
|
651
|
-
if (!isThisYear)
|
|
652
|
-
options.year = "numeric";
|
|
634
|
+
if (!isThisYear) options.year = "numeric";
|
|
653
635
|
return asDate.toLocaleDateString([], options);
|
|
654
636
|
});
|
|
655
637
|
const relative = new Intl.RelativeTimeFormat([], { style: "long", numeric: "auto" });
|
|
@@ -660,10 +642,10 @@ const isToday = (date) => {
|
|
|
660
642
|
};
|
|
661
643
|
const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
662
644
|
const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
|
|
663
|
-
if (days < min || days > max)
|
|
664
|
-
return getLocalDateString(date);
|
|
645
|
+
if (days < min || days > max) return getLocalDateString(date);
|
|
665
646
|
return relative.format(days, "days");
|
|
666
647
|
});
|
|
648
|
+
_a = Symbol.toStringTag;
|
|
667
649
|
class DeferredPromise {
|
|
668
650
|
constructor() {
|
|
669
651
|
__publicField(this, _a, "Promise");
|
|
@@ -688,14 +670,12 @@ class DeferredPromise {
|
|
|
688
670
|
return this._promise.catch(onRejected);
|
|
689
671
|
}
|
|
690
672
|
resolve(value) {
|
|
691
|
-
if (!this._resolve)
|
|
692
|
-
throw new Error("No resolve callback");
|
|
673
|
+
if (!this._resolve) throw new Error("No resolve callback");
|
|
693
674
|
this._resolve(value);
|
|
694
675
|
this._state = "fulfilled";
|
|
695
676
|
}
|
|
696
677
|
reject(reason) {
|
|
697
|
-
if (!this._reject)
|
|
698
|
-
throw reason;
|
|
678
|
+
if (!this._reject) throw reason;
|
|
699
679
|
this._reject(reason);
|
|
700
680
|
this._state = "rejected";
|
|
701
681
|
}
|
|
@@ -703,35 +683,6 @@ class DeferredPromise {
|
|
|
703
683
|
throw new Error("`finally` not implemented");
|
|
704
684
|
}
|
|
705
685
|
}
|
|
706
|
-
_a = Symbol.toStringTag;
|
|
707
|
-
var randomString = function randomString2() {
|
|
708
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
709
|
-
};
|
|
710
|
-
({
|
|
711
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
712
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
713
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
714
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
function compose() {
|
|
718
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
719
|
-
funcs[_key] = arguments[_key];
|
|
720
|
-
}
|
|
721
|
-
if (funcs.length === 0) {
|
|
722
|
-
return function(arg) {
|
|
723
|
-
return arg;
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
if (funcs.length === 1) {
|
|
727
|
-
return funcs[0];
|
|
728
|
-
}
|
|
729
|
-
return funcs.reduce(function(a, b) {
|
|
730
|
-
return function() {
|
|
731
|
-
return a(b.apply(void 0, arguments));
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
686
|
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
736
687
|
const latestVersion = () => migrations.length - 1;
|
|
737
688
|
const initialVersioning = (state) => {
|
|
@@ -752,21 +703,20 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
752
703
|
if (state === void 0) {
|
|
753
704
|
state = {};
|
|
754
705
|
}
|
|
755
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
756
|
-
return state;
|
|
706
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion()) return state;
|
|
757
707
|
return migrator(state);
|
|
758
708
|
};
|
|
759
709
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
760
710
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
761
|
-
const initialState$
|
|
711
|
+
const initialState$J = {
|
|
762
712
|
accessToken: "",
|
|
763
713
|
refreshToken: "",
|
|
764
714
|
isLoggedIn: false
|
|
765
715
|
};
|
|
766
716
|
const authSlice = createSlice({
|
|
767
717
|
name: "auth",
|
|
768
|
-
initialState: initialState$
|
|
769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
718
|
+
initialState: initialState$J,
|
|
719
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$J)),
|
|
770
720
|
reducers: {
|
|
771
721
|
setTokens: (state, action) => {
|
|
772
722
|
state.accessToken = action.payload.accessToken;
|
|
@@ -854,11 +804,11 @@ function createModelAdapter(computeModelId) {
|
|
|
854
804
|
};
|
|
855
805
|
}
|
|
856
806
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
857
|
-
const initialState$
|
|
807
|
+
const initialState$I = categoryAdapter.getInitialState({});
|
|
858
808
|
const categorySlice = createSlice({
|
|
859
809
|
name: "categories",
|
|
860
|
-
initialState: initialState$
|
|
861
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
810
|
+
initialState: initialState$I,
|
|
811
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$I)),
|
|
862
812
|
reducers: {
|
|
863
813
|
initializeCategories: categoryAdapter.initialize,
|
|
864
814
|
addCategory: categoryAdapter.addOne,
|
|
@@ -902,11 +852,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
|
902
852
|
};
|
|
903
853
|
const categoryReducer = categorySlice.reducer;
|
|
904
854
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
905
|
-
const initialState$
|
|
855
|
+
const initialState$H = assetAdapter.getInitialState({});
|
|
906
856
|
const assetSlice = createSlice({
|
|
907
857
|
name: "assets",
|
|
908
|
-
initialState: initialState$
|
|
909
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
858
|
+
initialState: initialState$H,
|
|
859
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$H)),
|
|
910
860
|
reducers: {
|
|
911
861
|
initializeAssets: assetAdapter.initialize,
|
|
912
862
|
addAsset: assetAdapter.addOne,
|
|
@@ -947,8 +897,7 @@ const selectAssetsByIds = restructureCreateSelectorWithArgs(
|
|
|
947
897
|
const assets = [];
|
|
948
898
|
for (const assetId of assetIds) {
|
|
949
899
|
const asset = assetsMapping[assetId];
|
|
950
|
-
if (asset)
|
|
951
|
-
assets.push(asset);
|
|
900
|
+
if (asset) assets.push(asset);
|
|
952
901
|
}
|
|
953
902
|
return fallbackToEmptyArray(assets);
|
|
954
903
|
})
|
|
@@ -958,11 +907,11 @@ const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
|
958
907
|
};
|
|
959
908
|
const assetReducer = assetSlice.reducer;
|
|
960
909
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
961
|
-
const initialState$
|
|
910
|
+
const initialState$G = assetAttachmentAdapter.getInitialState({});
|
|
962
911
|
const assetAttachmentSlice = createSlice({
|
|
963
912
|
name: "assetAttachments",
|
|
964
|
-
initialState: initialState$
|
|
965
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
913
|
+
initialState: initialState$G,
|
|
914
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$G)),
|
|
966
915
|
reducers: {
|
|
967
916
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
968
917
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1009,11 +958,11 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1009
958
|
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
1010
959
|
const fileAttachments = attachmentsOfAsset.filter(
|
|
1011
960
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1012
|
-
({ file_type }) => !file_type
|
|
961
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1013
962
|
);
|
|
1014
963
|
const imageAttachments = attachmentsOfAsset.filter(
|
|
1015
964
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1016
|
-
({ file_type }) => file_type
|
|
965
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1017
966
|
);
|
|
1018
967
|
return { fileAttachments, imageAttachments };
|
|
1019
968
|
}
|
|
@@ -1023,11 +972,11 @@ const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
|
1023
972
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1024
973
|
(stageCompletion) => stageCompletion.offline_id
|
|
1025
974
|
);
|
|
1026
|
-
const initialState$
|
|
975
|
+
const initialState$F = assetStageCompletionAdapter.getInitialState({});
|
|
1027
976
|
const assetStageCompletionSlice = createSlice({
|
|
1028
977
|
name: "assetStageCompletions",
|
|
1029
|
-
initialState: initialState$
|
|
1030
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
978
|
+
initialState: initialState$F,
|
|
979
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$F)),
|
|
1031
980
|
reducers: {
|
|
1032
981
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1033
982
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1056,8 +1005,7 @@ const selectCompletedStagesByAsset = createSelector(
|
|
|
1056
1005
|
const completedStagesByAsset = {};
|
|
1057
1006
|
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
1058
1007
|
const { asset, stage, submitted_at } = stageCompletion;
|
|
1059
|
-
if (!completedStagesByAsset[asset])
|
|
1060
|
-
completedStagesByAsset[asset] = {};
|
|
1008
|
+
if (!completedStagesByAsset[asset]) completedStagesByAsset[asset] = {};
|
|
1061
1009
|
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1062
1010
|
}
|
|
1063
1011
|
return completedStagesByAsset;
|
|
@@ -1089,11 +1037,11 @@ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
|
|
|
1089
1037
|
);
|
|
1090
1038
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1091
1039
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1092
|
-
const initialState$
|
|
1040
|
+
const initialState$E = assetStageAdapter.getInitialState({});
|
|
1093
1041
|
const assetStageSlice = createSlice({
|
|
1094
1042
|
name: "assetStages",
|
|
1095
|
-
initialState: initialState$
|
|
1096
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1043
|
+
initialState: initialState$E,
|
|
1044
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
|
|
1097
1045
|
reducers: {
|
|
1098
1046
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1099
1047
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1157,27 +1105,12 @@ const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
|
|
|
1157
1105
|
return fallbackToEmptyArray(assetStages);
|
|
1158
1106
|
})
|
|
1159
1107
|
);
|
|
1160
|
-
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
1161
|
-
createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1162
|
-
const ret = {};
|
|
1163
|
-
for (const stageId of stageIds) {
|
|
1164
|
-
const stage = stageMapping[stageId];
|
|
1165
|
-
if (!stage) {
|
|
1166
|
-
throw new Error("No stage exists with the id " + stageId);
|
|
1167
|
-
}
|
|
1168
|
-
if (stage.form) {
|
|
1169
|
-
ret[stageId] = stage.form;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
return ret;
|
|
1173
|
-
})
|
|
1174
|
-
);
|
|
1175
1108
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1176
|
-
const initialState$
|
|
1109
|
+
const initialState$D = assetTypeAdapter.getInitialState({});
|
|
1177
1110
|
const assetTypeSlice = createSlice({
|
|
1178
1111
|
name: "assetTypes",
|
|
1179
|
-
initialState: initialState$
|
|
1180
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1112
|
+
initialState: initialState$D,
|
|
1113
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
|
|
1181
1114
|
reducers: {
|
|
1182
1115
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1183
1116
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1230,11 +1163,11 @@ const assetTypeReducer = assetTypeSlice.reducer;
|
|
|
1230
1163
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1231
1164
|
(attachment) => attachment.offline_id
|
|
1232
1165
|
);
|
|
1233
|
-
const initialState$
|
|
1166
|
+
const initialState$C = assetTypeAttachmentAdapter.getInitialState({});
|
|
1234
1167
|
const assetTypeAttachmentSlice = createSlice({
|
|
1235
1168
|
name: "assetTypeAttachments",
|
|
1236
|
-
initialState: initialState$
|
|
1237
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1169
|
+
initialState: initialState$C,
|
|
1170
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
|
|
1238
1171
|
reducers: {
|
|
1239
1172
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1240
1173
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1281,11 +1214,11 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1281
1214
|
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1282
1215
|
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1283
1216
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1284
|
-
({ file_type }) => !file_type
|
|
1217
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1285
1218
|
);
|
|
1286
1219
|
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1287
1220
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1288
|
-
({ file_type }) => file_type
|
|
1221
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1289
1222
|
);
|
|
1290
1223
|
return { fileAttachments, imageAttachments };
|
|
1291
1224
|
}
|
|
@@ -1293,12 +1226,12 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1293
1226
|
);
|
|
1294
1227
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1295
1228
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1296
|
-
const initialState$
|
|
1229
|
+
const initialState$B = issueAdapter.getInitialState({});
|
|
1297
1230
|
const issueSlice = createSlice({
|
|
1298
1231
|
name: "issues",
|
|
1299
|
-
initialState: initialState$
|
|
1232
|
+
initialState: initialState$B,
|
|
1300
1233
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1301
|
-
Object.assign(state, initialState$
|
|
1234
|
+
Object.assign(state, initialState$B);
|
|
1302
1235
|
}),
|
|
1303
1236
|
reducers: {
|
|
1304
1237
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1330,12 +1263,12 @@ const selectIssuesByIds = restructureCreateSelectorWithArgs(
|
|
|
1330
1263
|
);
|
|
1331
1264
|
const issueReducer = issueSlice.reducer;
|
|
1332
1265
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1333
|
-
const initialState$
|
|
1266
|
+
const initialState$A = issueTypeAdapter.getInitialState({});
|
|
1334
1267
|
const issueTypeSlice = createSlice({
|
|
1335
1268
|
name: "issueTypes",
|
|
1336
|
-
initialState: initialState$
|
|
1269
|
+
initialState: initialState$A,
|
|
1337
1270
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1338
|
-
Object.assign(state, initialState$
|
|
1271
|
+
Object.assign(state, initialState$A);
|
|
1339
1272
|
}),
|
|
1340
1273
|
reducers: {
|
|
1341
1274
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1392,15 +1325,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
1392
1325
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1393
1326
|
};
|
|
1394
1327
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1395
|
-
const initialState$
|
|
1328
|
+
const initialState$z = {
|
|
1396
1329
|
s3Urls: {}
|
|
1397
1330
|
};
|
|
1398
1331
|
const msPerHour = 1e3 * 60 * 60;
|
|
1399
1332
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1400
1333
|
const fileSlice = createSlice({
|
|
1401
1334
|
name: "file",
|
|
1402
|
-
initialState: initialState$
|
|
1403
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1335
|
+
initialState: initialState$z,
|
|
1336
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
1404
1337
|
reducers: {
|
|
1405
1338
|
setUploadUrl: (state, action) => {
|
|
1406
1339
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1422,19 +1355,18 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1422
1355
|
}
|
|
1423
1356
|
const today2 = (/* @__PURE__ */ new Date()).getTime();
|
|
1424
1357
|
const expiringWithinAnHour = (url.exp ?? today2) - today2 < msPerHour;
|
|
1425
|
-
if (expiringWithinAnHour)
|
|
1426
|
-
return void 0;
|
|
1358
|
+
if (expiringWithinAnHour) return void 0;
|
|
1427
1359
|
return url;
|
|
1428
1360
|
};
|
|
1429
1361
|
const fileReducer = fileSlice.reducer;
|
|
1430
|
-
const initialState$
|
|
1362
|
+
const initialState$y = {
|
|
1431
1363
|
users: {},
|
|
1432
1364
|
currentUser: null
|
|
1433
1365
|
};
|
|
1434
1366
|
const userSlice = createSlice({
|
|
1435
1367
|
name: "users",
|
|
1436
|
-
initialState: initialState$
|
|
1437
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1368
|
+
initialState: initialState$y,
|
|
1369
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
1438
1370
|
reducers: {
|
|
1439
1371
|
setUsers: (state, action) => {
|
|
1440
1372
|
const usersMapping = {};
|
|
@@ -1452,8 +1384,7 @@ const userSlice = createSlice({
|
|
|
1452
1384
|
state.currentUser = action.payload;
|
|
1453
1385
|
},
|
|
1454
1386
|
setProfilePicture: (state, action) => {
|
|
1455
|
-
if (!state.currentUser)
|
|
1456
|
-
return;
|
|
1387
|
+
if (!state.currentUser) return;
|
|
1457
1388
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1458
1389
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1459
1390
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1492,11 +1423,11 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
|
1492
1423
|
const organizationAccessAdapter = createModelAdapter(
|
|
1493
1424
|
(organizationAccess) => organizationAccess.offline_id
|
|
1494
1425
|
);
|
|
1495
|
-
const initialState$
|
|
1426
|
+
const initialState$x = organizationAccessAdapter.getInitialState({});
|
|
1496
1427
|
const organizationAccessSlice = createSlice({
|
|
1497
1428
|
name: "organizationAccess",
|
|
1498
|
-
initialState: initialState$
|
|
1499
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1429
|
+
initialState: initialState$x,
|
|
1430
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1500
1431
|
reducers: {
|
|
1501
1432
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1502
1433
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1533,11 +1464,11 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
1533
1464
|
};
|
|
1534
1465
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1535
1466
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1536
|
-
const initialState$
|
|
1467
|
+
const initialState$w = licenseAdapter.getInitialState({});
|
|
1537
1468
|
const licenseSlice = createSlice({
|
|
1538
1469
|
name: "license",
|
|
1539
|
-
initialState: initialState$
|
|
1540
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1470
|
+
initialState: initialState$w,
|
|
1471
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1541
1472
|
reducers: {
|
|
1542
1473
|
initializeLicences: licenseAdapter.initialize,
|
|
1543
1474
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1562,11 +1493,11 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
1562
1493
|
);
|
|
1563
1494
|
const licenseReducer = licenseSlice.reducer;
|
|
1564
1495
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1565
|
-
const initialState$
|
|
1496
|
+
const initialState$v = projectAccessAdapter.getInitialState({});
|
|
1566
1497
|
const projectAccessSlice = createSlice({
|
|
1567
1498
|
name: "projectAccess",
|
|
1568
|
-
initialState: initialState$
|
|
1569
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1499
|
+
initialState: initialState$v,
|
|
1500
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1570
1501
|
reducers: {
|
|
1571
1502
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1572
1503
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1600,13 +1531,13 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1600
1531
|
return projectAccesses;
|
|
1601
1532
|
};
|
|
1602
1533
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1603
|
-
const initialState$
|
|
1534
|
+
const initialState$u = {
|
|
1604
1535
|
projects: {}
|
|
1605
1536
|
};
|
|
1606
1537
|
const projectSlice = createSlice({
|
|
1607
1538
|
name: "projects",
|
|
1608
|
-
initialState: initialState$
|
|
1609
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1539
|
+
initialState: initialState$u,
|
|
1540
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1610
1541
|
reducers: {
|
|
1611
1542
|
setProjects: (state, action) => {
|
|
1612
1543
|
const projectsMap = {};
|
|
@@ -1665,13 +1596,13 @@ const selectSortedProjectUsers = createSelector(
|
|
|
1665
1596
|
});
|
|
1666
1597
|
}
|
|
1667
1598
|
);
|
|
1668
|
-
const initialState$
|
|
1599
|
+
const initialState$t = {
|
|
1669
1600
|
organizations: {}
|
|
1670
1601
|
};
|
|
1671
1602
|
const organizationSlice = createSlice({
|
|
1672
1603
|
name: "organizations",
|
|
1673
|
-
initialState: initialState$
|
|
1674
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1604
|
+
initialState: initialState$t,
|
|
1605
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
|
|
1675
1606
|
reducers: {
|
|
1676
1607
|
setOrganizations: (state, action) => {
|
|
1677
1608
|
for (const org of action.payload) {
|
|
@@ -1762,14 +1693,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
|
|
|
1762
1693
|
}
|
|
1763
1694
|
};
|
|
1764
1695
|
};
|
|
1765
|
-
const initialState$
|
|
1696
|
+
const initialState$s = {
|
|
1766
1697
|
deletedRequests: [],
|
|
1767
1698
|
latestRetryTime: 0
|
|
1768
1699
|
};
|
|
1769
1700
|
const outboxSlice = createSlice({
|
|
1770
1701
|
name: "outbox",
|
|
1771
|
-
initialState: initialState$
|
|
1772
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1702
|
+
initialState: initialState$s,
|
|
1703
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
1773
1704
|
reducers: {
|
|
1774
1705
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1775
1706
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1789,8 +1720,7 @@ const outboxSlice = createSlice({
|
|
|
1789
1720
|
},
|
|
1790
1721
|
markAsDeleted(state, action) {
|
|
1791
1722
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1792
|
-
if (index !== -1)
|
|
1793
|
-
state.deletedRequests.splice(index, 1);
|
|
1723
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1794
1724
|
},
|
|
1795
1725
|
_setLatestRetryTime: (state, action) => {
|
|
1796
1726
|
state.latestRetryTime = action.payload;
|
|
@@ -1801,15 +1731,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
1801
1731
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1802
1732
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1803
1733
|
const outboxReducer = outboxSlice.reducer;
|
|
1804
|
-
const initialState$
|
|
1734
|
+
const initialState$r = {
|
|
1805
1735
|
projectFiles: {},
|
|
1806
1736
|
activeProjectFileId: null,
|
|
1807
1737
|
isImportingProjectFile: false
|
|
1808
1738
|
};
|
|
1809
1739
|
const projectFileSlice = createSlice({
|
|
1810
1740
|
name: "projectFiles",
|
|
1811
|
-
initialState: initialState$
|
|
1812
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1741
|
+
initialState: initialState$r,
|
|
1742
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1813
1743
|
reducers: {
|
|
1814
1744
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1815
1745
|
for (let fileObj of action.payload) {
|
|
@@ -1891,11 +1821,11 @@ const selectProjectFileById = (id) => (state) => {
|
|
|
1891
1821
|
};
|
|
1892
1822
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1893
1823
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1894
|
-
const initialState$
|
|
1824
|
+
const initialState$q = projectAttachmentAdapter.getInitialState({});
|
|
1895
1825
|
const projectAttachmentSlice = createSlice({
|
|
1896
1826
|
name: "projectAttachments",
|
|
1897
|
-
initialState: initialState$
|
|
1898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1827
|
+
initialState: initialState$q,
|
|
1828
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1899
1829
|
reducers: {
|
|
1900
1830
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1901
1831
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -1939,23 +1869,23 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
1939
1869
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1940
1870
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1941
1871
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1942
|
-
({ file_type }) => !file_type
|
|
1872
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1943
1873
|
);
|
|
1944
1874
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1945
1875
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1946
|
-
({ file_type }) => file_type
|
|
1876
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1947
1877
|
);
|
|
1948
1878
|
return { fileAttachments, imageAttachments };
|
|
1949
1879
|
}
|
|
1950
1880
|
)
|
|
1951
1881
|
);
|
|
1952
1882
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
1953
|
-
const initialState$
|
|
1883
|
+
const initialState$p = {
|
|
1954
1884
|
isRehydrated: false
|
|
1955
1885
|
};
|
|
1956
1886
|
const rehydratedSlice = createSlice({
|
|
1957
1887
|
name: "rehydrated",
|
|
1958
|
-
initialState: initialState$
|
|
1888
|
+
initialState: initialState$p,
|
|
1959
1889
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
1960
1890
|
reducers: {
|
|
1961
1891
|
setRehydrated: (state, action) => {
|
|
@@ -1980,11 +1910,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
1980
1910
|
}
|
|
1981
1911
|
};
|
|
1982
1912
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
1983
|
-
const initialState$
|
|
1913
|
+
const initialState$o = formRevisionAdapter.getInitialState({});
|
|
1984
1914
|
const formRevisionsSlice = createSlice({
|
|
1985
1915
|
name: "formRevisions",
|
|
1986
|
-
initialState: initialState$
|
|
1987
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1916
|
+
initialState: initialState$o,
|
|
1917
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1988
1918
|
reducers: {
|
|
1989
1919
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
1990
1920
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2027,8 +1957,7 @@ const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
|
|
|
2027
1957
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2028
1958
|
(revisions, formId) => {
|
|
2029
1959
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2030
|
-
if (revisionsOfForm.length === 0)
|
|
2031
|
-
return void 0;
|
|
1960
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2032
1961
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2033
1962
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2034
1963
|
return revisions[latestRevision.offline_id];
|
|
@@ -2043,24 +1972,13 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2043
1972
|
}
|
|
2044
1973
|
)
|
|
2045
1974
|
);
|
|
2046
|
-
const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2047
|
-
const latestRevisions = {};
|
|
2048
|
-
for (const revision of Object.values(revisions)) {
|
|
2049
|
-
const formId = revision.form;
|
|
2050
|
-
const currentLatestRevision = latestRevisions[formId];
|
|
2051
|
-
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2052
|
-
latestRevisions[formId] = revision;
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
return latestRevisions;
|
|
2056
|
-
});
|
|
2057
1975
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2058
1976
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2059
|
-
const initialState$
|
|
1977
|
+
const initialState$n = formAdapter.getInitialState({});
|
|
2060
1978
|
const formSlice = createSlice({
|
|
2061
1979
|
name: "forms",
|
|
2062
|
-
initialState: initialState$
|
|
2063
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1980
|
+
initialState: initialState$n,
|
|
1981
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
2064
1982
|
reducers: {
|
|
2065
1983
|
initializeForms: formAdapter.initialize,
|
|
2066
1984
|
setForm: formAdapter.setOne,
|
|
@@ -2078,6 +1996,9 @@ const selectFormMapping = (state) => {
|
|
|
2078
1996
|
const selectForms = createSelector([selectFormMapping], (formsMapping) => {
|
|
2079
1997
|
return Object.values(formsMapping);
|
|
2080
1998
|
});
|
|
1999
|
+
const selectFormById = (formId) => (state) => {
|
|
2000
|
+
return state.formReducer.instances[formId];
|
|
2001
|
+
};
|
|
2081
2002
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2082
2003
|
createSelector(
|
|
2083
2004
|
[
|
|
@@ -2100,40 +2021,15 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2100
2021
|
return [...regularMatches.slice(0, maxResults)];
|
|
2101
2022
|
},
|
|
2102
2023
|
// as the argument is an object, we check the first level of properties for equality
|
|
2103
|
-
{ memoizeOptions: {
|
|
2104
|
-
)
|
|
2105
|
-
);
|
|
2106
|
-
const selectFormById = (formId) => (state) => {
|
|
2107
|
-
return state.formReducer.instances[formId];
|
|
2108
|
-
};
|
|
2109
|
-
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2110
|
-
createSelector(
|
|
2111
|
-
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2112
|
-
(formsMapping, assetTypeId) => {
|
|
2113
|
-
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2114
|
-
}
|
|
2115
|
-
)
|
|
2116
|
-
);
|
|
2117
|
-
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2118
|
-
createSelector(
|
|
2119
|
-
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2120
|
-
(formsMapping, issueTypeId) => {
|
|
2121
|
-
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2122
|
-
}
|
|
2024
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2123
2025
|
)
|
|
2124
2026
|
);
|
|
2125
|
-
const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2126
|
-
return Object.keys(formsMapping).length;
|
|
2127
|
-
});
|
|
2128
|
-
const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2129
|
-
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2130
|
-
});
|
|
2131
2027
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2132
|
-
const initialState$
|
|
2028
|
+
const initialState$m = submissionAdapter.getInitialState({});
|
|
2133
2029
|
const formSubmissionSlice = createSlice({
|
|
2134
2030
|
name: "formSubmissions",
|
|
2135
|
-
initialState: initialState$
|
|
2136
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2031
|
+
initialState: initialState$m,
|
|
2032
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
2137
2033
|
reducers: {
|
|
2138
2034
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2139
2035
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2179,8 +2075,7 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2179
2075
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2180
2076
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2181
2077
|
for (const revision of Object.values(revisionMapping)) {
|
|
2182
|
-
if (revision.form !== formId)
|
|
2183
|
-
continue;
|
|
2078
|
+
if (revision.form !== formId) continue;
|
|
2184
2079
|
revisionIds.add(revision.offline_id);
|
|
2185
2080
|
}
|
|
2186
2081
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2189,43 +2084,6 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2189
2084
|
}
|
|
2190
2085
|
)
|
|
2191
2086
|
);
|
|
2192
|
-
const selectFormSubmissionsByFormRevisions = createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2193
|
-
var _a2;
|
|
2194
|
-
const submissionMapping = {};
|
|
2195
|
-
for (const revisionId in revisions) {
|
|
2196
|
-
submissionMapping[revisionId] = [];
|
|
2197
|
-
}
|
|
2198
|
-
for (const submission of submissions) {
|
|
2199
|
-
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2200
|
-
}
|
|
2201
|
-
return submissionMapping;
|
|
2202
|
-
});
|
|
2203
|
-
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2204
|
-
createSelector(
|
|
2205
|
-
[
|
|
2206
|
-
selectFormRevisionMapping,
|
|
2207
|
-
selectFormSubmissionsByFormRevisions,
|
|
2208
|
-
(_state, formId) => formId
|
|
2209
|
-
],
|
|
2210
|
-
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2211
|
-
const submissionsByFormRevisions = {};
|
|
2212
|
-
for (const revisionId in revisionsMapping) {
|
|
2213
|
-
const revision = revisionsMapping[revisionId];
|
|
2214
|
-
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2215
|
-
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2216
|
-
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2217
|
-
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2218
|
-
);
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2222
|
-
const aRevision = revisionsMapping[a[0]];
|
|
2223
|
-
const bRevision = revisionsMapping[b[0]];
|
|
2224
|
-
return formRevisionSortFn(aRevision, bRevision);
|
|
2225
|
-
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2226
|
-
}
|
|
2227
|
-
)
|
|
2228
|
-
);
|
|
2229
2087
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2230
2088
|
createSelector(
|
|
2231
2089
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -2236,54 +2094,6 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2236
2094
|
}
|
|
2237
2095
|
)
|
|
2238
2096
|
);
|
|
2239
|
-
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2240
|
-
createSelector(
|
|
2241
|
-
[
|
|
2242
|
-
(state) => state.issueReducer.instances,
|
|
2243
|
-
(state) => state.formReducer.instances,
|
|
2244
|
-
(state) => state.formRevisionReducer.instances,
|
|
2245
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2246
|
-
(_state, issueId) => issueId
|
|
2247
|
-
],
|
|
2248
|
-
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2249
|
-
const issue = issues[issueId];
|
|
2250
|
-
if (!issue)
|
|
2251
|
-
return [];
|
|
2252
|
-
if (!issue.issue_type) {
|
|
2253
|
-
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2254
|
-
}
|
|
2255
|
-
const issueTypeForms = new Set(
|
|
2256
|
-
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2257
|
-
);
|
|
2258
|
-
const issueTypeFormRevisions = new Set(
|
|
2259
|
-
Object.keys(formRevisions).filter(
|
|
2260
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2261
|
-
)
|
|
2262
|
-
);
|
|
2263
|
-
return Object.values(submissions).filter(
|
|
2264
|
-
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2265
|
-
);
|
|
2266
|
-
}
|
|
2267
|
-
)
|
|
2268
|
-
);
|
|
2269
|
-
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2270
|
-
createSelector(
|
|
2271
|
-
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2272
|
-
(submissions, issueIds) => {
|
|
2273
|
-
var _a2;
|
|
2274
|
-
const issueSubmissions = {};
|
|
2275
|
-
for (const issueId of issueIds) {
|
|
2276
|
-
issueSubmissions[issueId] = [];
|
|
2277
|
-
}
|
|
2278
|
-
for (const submission of submissions) {
|
|
2279
|
-
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2280
|
-
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
return issueSubmissions;
|
|
2284
|
-
}
|
|
2285
|
-
)
|
|
2286
|
-
);
|
|
2287
2097
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2288
2098
|
createSelector(
|
|
2289
2099
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2294,62 +2104,15 @@ const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
2294
2104
|
}
|
|
2295
2105
|
)
|
|
2296
2106
|
);
|
|
2297
|
-
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2298
|
-
createSelector(
|
|
2299
|
-
[
|
|
2300
|
-
(state) => state.assetReducer.instances,
|
|
2301
|
-
(state) => state.formReducer.instances,
|
|
2302
|
-
(state) => state.formRevisionReducer.instances,
|
|
2303
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2304
|
-
(_state, assetId) => assetId
|
|
2305
|
-
],
|
|
2306
|
-
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2307
|
-
const asset = assets[assetId];
|
|
2308
|
-
if (!asset)
|
|
2309
|
-
return [];
|
|
2310
|
-
if (!asset.asset_type) {
|
|
2311
|
-
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2312
|
-
}
|
|
2313
|
-
const issueTypeForms = new Set(
|
|
2314
|
-
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2315
|
-
);
|
|
2316
|
-
const issueTypeFormRevisions = new Set(
|
|
2317
|
-
Object.keys(formRevisions).filter(
|
|
2318
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2319
|
-
)
|
|
2320
|
-
);
|
|
2321
|
-
return Object.values(submissions).filter(
|
|
2322
|
-
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2323
|
-
);
|
|
2324
|
-
}
|
|
2325
|
-
)
|
|
2326
|
-
);
|
|
2327
|
-
const selectFormSubmissionsByAssets = createSelector(
|
|
2328
|
-
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2329
|
-
(submissions, assets) => {
|
|
2330
|
-
var _a2;
|
|
2331
|
-
const assetSubmissionMapping = {};
|
|
2332
|
-
for (const assetId in assets) {
|
|
2333
|
-
assetSubmissionMapping[assetId] = [];
|
|
2334
|
-
}
|
|
2335
|
-
for (const submissionId in submissions) {
|
|
2336
|
-
const submission = submissions[submissionId];
|
|
2337
|
-
if (submission.asset) {
|
|
2338
|
-
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
return assetSubmissionMapping;
|
|
2342
|
-
}
|
|
2343
|
-
);
|
|
2344
2107
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2345
2108
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2346
2109
|
(attachment) => attachment.offline_id
|
|
2347
2110
|
);
|
|
2348
|
-
const initialState$
|
|
2111
|
+
const initialState$l = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2349
2112
|
const formSubmissionAttachmentSlice = createSlice({
|
|
2350
2113
|
name: "formSubmissionAttachments",
|
|
2351
|
-
initialState: initialState$
|
|
2352
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2114
|
+
initialState: initialState$l,
|
|
2115
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
2353
2116
|
reducers: {
|
|
2354
2117
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2355
2118
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2392,7 +2155,9 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
2392
2155
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2393
2156
|
(attachmentsMapping, submissionId) => {
|
|
2394
2157
|
return fallbackToEmptyArray(
|
|
2395
|
-
Object.values(attachmentsMapping).filter(
|
|
2158
|
+
Object.values(attachmentsMapping).filter(
|
|
2159
|
+
(attachment) => attachment.form_submission === submissionId
|
|
2160
|
+
)
|
|
2396
2161
|
);
|
|
2397
2162
|
}
|
|
2398
2163
|
)
|
|
@@ -2401,11 +2166,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
|
|
|
2401
2166
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2402
2167
|
(attachment) => attachment.offline_id
|
|
2403
2168
|
);
|
|
2404
|
-
const initialState$
|
|
2169
|
+
const initialState$k = formRevisionAttachmentAdapter.getInitialState({});
|
|
2405
2170
|
const formRevisionAttachmentSlice = createSlice({
|
|
2406
2171
|
name: "formRevisionAttachments",
|
|
2407
|
-
initialState: initialState$
|
|
2408
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2172
|
+
initialState: initialState$k,
|
|
2173
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
2409
2174
|
reducers: {
|
|
2410
2175
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2411
2176
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2437,17 +2202,17 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
2437
2202
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2438
2203
|
(attachments, revisionId) => {
|
|
2439
2204
|
return fallbackToEmptyArray(
|
|
2440
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2205
|
+
Object.values(attachments).filter((attachment) => attachment.form_revision === revisionId)
|
|
2441
2206
|
);
|
|
2442
2207
|
}
|
|
2443
2208
|
)
|
|
2444
2209
|
);
|
|
2445
2210
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2446
2211
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2447
|
-
const initialState$
|
|
2212
|
+
const initialState$j = workspaceAdapter.getInitialState({});
|
|
2448
2213
|
const workspaceSlice = createSlice({
|
|
2449
2214
|
name: "workspace",
|
|
2450
|
-
initialState: initialState$
|
|
2215
|
+
initialState: initialState$j,
|
|
2451
2216
|
reducers: {
|
|
2452
2217
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2453
2218
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2478,10 +2243,10 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2478
2243
|
);
|
|
2479
2244
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2480
2245
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2481
|
-
const initialState$
|
|
2246
|
+
const initialState$i = emailDomainAdapter.getInitialState({});
|
|
2482
2247
|
const emailDomainsSlice = createSlice({
|
|
2483
2248
|
name: "emailDomains",
|
|
2484
|
-
initialState: initialState$
|
|
2249
|
+
initialState: initialState$i,
|
|
2485
2250
|
reducers: {
|
|
2486
2251
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2487
2252
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2502,14 +2267,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
2502
2267
|
)
|
|
2503
2268
|
);
|
|
2504
2269
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2505
|
-
const initialState$
|
|
2270
|
+
const initialState$h = {
|
|
2506
2271
|
documents: {}
|
|
2507
2272
|
};
|
|
2508
2273
|
const documentSlice = createSlice({
|
|
2509
2274
|
name: "documents",
|
|
2510
|
-
initialState: initialState$
|
|
2275
|
+
initialState: initialState$h,
|
|
2511
2276
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2512
|
-
Object.assign(state, initialState$
|
|
2277
|
+
Object.assign(state, initialState$h);
|
|
2513
2278
|
}),
|
|
2514
2279
|
reducers: {
|
|
2515
2280
|
setDocuments: (state, action) => {
|
|
@@ -2682,8 +2447,7 @@ const selectAncestorIdsOfDocument = restructureCreateSelectorWithArgs(
|
|
|
2682
2447
|
createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2683
2448
|
const listOfAncestors = [];
|
|
2684
2449
|
const document2 = mapping[documentId];
|
|
2685
|
-
if (!document2 || !document2.parent_document)
|
|
2686
|
-
return listOfAncestors;
|
|
2450
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2687
2451
|
let currentAncestor = mapping[document2.parent_document];
|
|
2688
2452
|
while (currentAncestor) {
|
|
2689
2453
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2698,11 +2462,11 @@ const selectRootDocuments = createSelector(
|
|
|
2698
2462
|
);
|
|
2699
2463
|
const documentsReducer = documentSlice.reducer;
|
|
2700
2464
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2701
|
-
const initialState$
|
|
2465
|
+
const initialState$g = documentAttachmentAdapter.getInitialState({});
|
|
2702
2466
|
const documentAttachmentSlice = createSlice({
|
|
2703
2467
|
name: "documentAttachments",
|
|
2704
|
-
initialState: initialState$
|
|
2705
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2468
|
+
initialState: initialState$g,
|
|
2469
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2706
2470
|
reducers: {
|
|
2707
2471
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2708
2472
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2749,11 +2513,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
2749
2513
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2750
2514
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2751
2515
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2752
|
-
({ file_type }) => !file_type
|
|
2516
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2753
2517
|
);
|
|
2754
2518
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2755
2519
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2756
|
-
({ file_type }) => file_type
|
|
2520
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2757
2521
|
);
|
|
2758
2522
|
return { fileAttachments, imageAttachments };
|
|
2759
2523
|
}
|
|
@@ -2761,11 +2525,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
2761
2525
|
);
|
|
2762
2526
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2763
2527
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2764
|
-
const initialState$
|
|
2528
|
+
const initialState$f = teamAdapter.getInitialState({});
|
|
2765
2529
|
const teamSlice = createSlice({
|
|
2766
2530
|
name: "teams",
|
|
2767
|
-
initialState: initialState$
|
|
2768
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2531
|
+
initialState: initialState$f,
|
|
2532
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2769
2533
|
reducers: {
|
|
2770
2534
|
setTeam: teamAdapter.setOne,
|
|
2771
2535
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2816,11 +2580,11 @@ const teamReducer = teamSlice.reducer;
|
|
|
2816
2580
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2817
2581
|
(conversation) => conversation.offline_id
|
|
2818
2582
|
);
|
|
2819
|
-
const initialState$
|
|
2583
|
+
const initialState$e = agentUserConversationAdapter.getInitialState({});
|
|
2820
2584
|
const agentsSlice = createSlice({
|
|
2821
2585
|
name: "agents",
|
|
2822
|
-
initialState: initialState$
|
|
2823
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2586
|
+
initialState: initialState$e,
|
|
2587
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2824
2588
|
reducers: {
|
|
2825
2589
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2826
2590
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2842,11 +2606,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
|
|
|
2842
2606
|
);
|
|
2843
2607
|
const agentsReducer = agentsSlice.reducer;
|
|
2844
2608
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2845
|
-
const initialState$
|
|
2609
|
+
const initialState$d = issueCommentAdapter.getInitialState({});
|
|
2846
2610
|
const issueCommentSlice = createSlice({
|
|
2847
2611
|
name: "issueComments",
|
|
2848
|
-
initialState: initialState$
|
|
2849
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2612
|
+
initialState: initialState$d,
|
|
2613
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2850
2614
|
reducers: {
|
|
2851
2615
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2852
2616
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2875,11 +2639,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2875
2639
|
);
|
|
2876
2640
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2877
2641
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2878
|
-
const initialState$
|
|
2642
|
+
const initialState$c = issueUpdateAdapter.getInitialState({});
|
|
2879
2643
|
const issueUpdateSlice = createSlice({
|
|
2880
2644
|
name: "issueUpdates",
|
|
2881
|
-
initialState: initialState$
|
|
2882
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2645
|
+
initialState: initialState$c,
|
|
2646
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2883
2647
|
reducers: {
|
|
2884
2648
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2885
2649
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2908,11 +2672,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2908
2672
|
);
|
|
2909
2673
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2910
2674
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2911
|
-
const initialState$
|
|
2675
|
+
const initialState$b = issueAttachmentAdapter.getInitialState({});
|
|
2912
2676
|
const issueAttachmentSlice = createSlice({
|
|
2913
2677
|
name: "issueAttachments",
|
|
2914
|
-
initialState: initialState$
|
|
2915
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2678
|
+
initialState: initialState$b,
|
|
2679
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2916
2680
|
reducers: {
|
|
2917
2681
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2918
2682
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -2959,34 +2723,34 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
|
2959
2723
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2960
2724
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2961
2725
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2962
|
-
({ file_type }) => !file_type
|
|
2726
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2963
2727
|
);
|
|
2964
2728
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2965
2729
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2966
|
-
({ file_type }) => file_type
|
|
2730
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2967
2731
|
);
|
|
2968
2732
|
return { fileAttachments, imageAttachments };
|
|
2969
2733
|
}
|
|
2970
2734
|
)
|
|
2971
2735
|
);
|
|
2972
2736
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
2973
|
-
const initialState$
|
|
2737
|
+
const initialState$a = {
|
|
2974
2738
|
version: 0
|
|
2975
2739
|
};
|
|
2976
2740
|
const versioningSlice = createSlice({
|
|
2977
2741
|
name: "versioning",
|
|
2978
|
-
initialState: initialState$
|
|
2742
|
+
initialState: initialState$a,
|
|
2979
2743
|
reducers: {}
|
|
2980
2744
|
});
|
|
2981
2745
|
const versioningReducer = versioningSlice.reducer;
|
|
2982
2746
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
2983
|
-
const initialState$
|
|
2747
|
+
const initialState$9 = geoImageAdapter.getInitialState({});
|
|
2984
2748
|
const geoImageSlice = createSlice({
|
|
2985
2749
|
name: "geoImages",
|
|
2986
|
-
initialState: initialState$
|
|
2750
|
+
initialState: initialState$9,
|
|
2987
2751
|
extraReducers: (builder) => {
|
|
2988
2752
|
builder.addCase("RESET", (state) => {
|
|
2989
|
-
Object.assign(state, initialState$
|
|
2753
|
+
Object.assign(state, initialState$9);
|
|
2990
2754
|
});
|
|
2991
2755
|
},
|
|
2992
2756
|
reducers: {
|
|
@@ -3024,11 +2788,11 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
|
|
|
3024
2788
|
);
|
|
3025
2789
|
const geoImageReducer = geoImageSlice.reducer;
|
|
3026
2790
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
3027
|
-
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2791
|
+
const initialState$8 = issueAssociationAdapter.getInitialState({});
|
|
3028
2792
|
const issueAssociationSlice = createSlice({
|
|
3029
2793
|
name: "issueAssociations",
|
|
3030
|
-
initialState,
|
|
3031
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2794
|
+
initialState: initialState$8,
|
|
2795
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3032
2796
|
reducers: {
|
|
3033
2797
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
3034
2798
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -3086,37 +2850,460 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
3086
2850
|
)
|
|
3087
2851
|
);
|
|
3088
2852
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3108
|
-
this.client = sdk;
|
|
3109
|
-
}
|
|
3110
|
-
async enqueueRequest(requestDetails) {
|
|
3111
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3112
|
-
}
|
|
3113
|
-
dispatch(action) {
|
|
3114
|
-
this.client.store.dispatch(action);
|
|
2853
|
+
const issueTypeFieldValuesAdapter = createModelAdapter(
|
|
2854
|
+
(fieldValues) => fieldValues.offline_id
|
|
2855
|
+
);
|
|
2856
|
+
const initialState$7 = issueTypeFieldValuesAdapter.getInitialState({});
|
|
2857
|
+
const issueTypeFieldValuesSlice = createSlice({
|
|
2858
|
+
name: "issueTypeFieldValues",
|
|
2859
|
+
initialState: initialState$7,
|
|
2860
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2861
|
+
reducers: {
|
|
2862
|
+
initializeIssueTypeFieldValues: issueTypeFieldValuesAdapter.initialize,
|
|
2863
|
+
addIssueTypeFieldValues: issueTypeFieldValuesAdapter.addOne,
|
|
2864
|
+
addIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.addMany,
|
|
2865
|
+
setIssueTypeFieldValues: issueTypeFieldValuesAdapter.setOne,
|
|
2866
|
+
setIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.setMany,
|
|
2867
|
+
updateIssueTypeFieldValues: issueTypeFieldValuesAdapter.updateOne,
|
|
2868
|
+
updateIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.updateMany,
|
|
2869
|
+
deleteIssueTypeFieldValues: issueTypeFieldValuesAdapter.deleteOne,
|
|
2870
|
+
deleteIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.deleteMany
|
|
3115
2871
|
}
|
|
3116
|
-
}
|
|
3117
|
-
const
|
|
3118
|
-
|
|
3119
|
-
|
|
2872
|
+
});
|
|
2873
|
+
const {
|
|
2874
|
+
initializeIssueTypeFieldValues,
|
|
2875
|
+
addIssueTypeFieldValues,
|
|
2876
|
+
addIssueTypeFieldValuesMany,
|
|
2877
|
+
setIssueTypeFieldValues,
|
|
2878
|
+
setIssueTypeFieldValuesMany,
|
|
2879
|
+
updateIssueTypeFieldValues,
|
|
2880
|
+
updateIssueTypeFieldValuesMany,
|
|
2881
|
+
deleteIssueTypeFieldValues,
|
|
2882
|
+
deleteIssueTypeFieldValuesMany
|
|
2883
|
+
} = issueTypeFieldValuesSlice.actions;
|
|
2884
|
+
const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
|
|
2885
|
+
const selectIssueTypeFieldValues = createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
2886
|
+
return Object.values(fieldValuesMapping);
|
|
2887
|
+
});
|
|
2888
|
+
const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
|
|
2889
|
+
createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
|
|
2890
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
|
|
2891
|
+
})
|
|
2892
|
+
);
|
|
2893
|
+
const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
2894
|
+
return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
|
|
2895
|
+
};
|
|
2896
|
+
const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
|
|
2897
|
+
const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
2898
|
+
const initialState$6 = issueTypeFieldsAdapter.getInitialState({});
|
|
2899
|
+
const issueTypeFieldsSlice = createSlice({
|
|
2900
|
+
name: "issueTypeFields",
|
|
2901
|
+
initialState: initialState$6,
|
|
2902
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2903
|
+
reducers: {
|
|
2904
|
+
initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
|
|
2905
|
+
addIssueTypeFields: issueTypeFieldsAdapter.addOne,
|
|
2906
|
+
addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
|
|
2907
|
+
setIssueTypeFields: issueTypeFieldsAdapter.setOne,
|
|
2908
|
+
setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
|
|
2909
|
+
updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
|
|
2910
|
+
updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
|
|
2911
|
+
deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
|
|
2912
|
+
deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
const {
|
|
2916
|
+
initializeIssueTypeFields,
|
|
2917
|
+
addIssueTypeFields,
|
|
2918
|
+
addIssueTypeFieldsMany,
|
|
2919
|
+
setIssueTypeFields,
|
|
2920
|
+
setIssueTypeFieldsMany,
|
|
2921
|
+
updateIssueTypeFields,
|
|
2922
|
+
updateIssueTypeFieldsMany,
|
|
2923
|
+
deleteIssueTypeFields,
|
|
2924
|
+
deleteIssueTypeFieldsMany
|
|
2925
|
+
} = issueTypeFieldsSlice.actions;
|
|
2926
|
+
const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
|
|
2927
|
+
const selectIssueTypeFields = createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
|
|
2928
|
+
return Object.values(fieldsMapping);
|
|
2929
|
+
});
|
|
2930
|
+
const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
2931
|
+
createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
|
|
2932
|
+
return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
|
|
2933
|
+
})
|
|
2934
|
+
);
|
|
2935
|
+
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
2936
|
+
createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
2937
|
+
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
2938
|
+
})
|
|
2939
|
+
);
|
|
2940
|
+
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
2941
|
+
createSelector(
|
|
2942
|
+
[selectIssueTypeFields, selectIssueTypeFieldValues, (_state, id) => id],
|
|
2943
|
+
(fields, fieldValues, id) => {
|
|
2944
|
+
const fieldsIds = new Set(
|
|
2945
|
+
fields.filter((field) => field.issue_type === id).map((field) => field.offline_id)
|
|
2946
|
+
);
|
|
2947
|
+
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
2948
|
+
}
|
|
2949
|
+
)
|
|
2950
|
+
);
|
|
2951
|
+
const selectIssueTypeFieldsById = (fieldsId) => (state) => {
|
|
2952
|
+
return state.issueTypeFieldsReducer.instances[fieldsId];
|
|
2953
|
+
};
|
|
2954
|
+
const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
|
|
2955
|
+
const issueTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
2956
|
+
(attachment) => attachment.offline_id
|
|
2957
|
+
);
|
|
2958
|
+
const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
|
|
2959
|
+
const issueTypeFieldsAttachmentSlice = createSlice({
|
|
2960
|
+
name: "issueTypeFieldsAttachments",
|
|
2961
|
+
initialState: initialState$5,
|
|
2962
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2963
|
+
reducers: {
|
|
2964
|
+
initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
|
|
2965
|
+
addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
|
|
2966
|
+
addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
|
|
2967
|
+
setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
|
|
2968
|
+
setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
|
|
2969
|
+
updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
|
|
2970
|
+
updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
|
|
2971
|
+
deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
|
|
2972
|
+
deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
|
|
2973
|
+
}
|
|
2974
|
+
});
|
|
2975
|
+
const {
|
|
2976
|
+
initializeIssueTypeFieldsAttachments,
|
|
2977
|
+
addIssueTypeFieldsAttachment,
|
|
2978
|
+
addIssueTypeFieldsAttachments,
|
|
2979
|
+
setIssueTypeFieldsAttachment,
|
|
2980
|
+
setIssueTypeFieldsAttachments,
|
|
2981
|
+
updateIssueTypeFieldsAttachment,
|
|
2982
|
+
updateIssueTypeFieldsAttachments,
|
|
2983
|
+
deleteIssueTypeFieldsAttachment,
|
|
2984
|
+
deleteIssueTypeFieldsAttachments
|
|
2985
|
+
} = issueTypeFieldsAttachmentSlice.actions;
|
|
2986
|
+
const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
|
|
2987
|
+
const selectIssueTypeFieldsAttachments = createSelector(
|
|
2988
|
+
[selectIssueTypeFieldsAttachmentsMapping],
|
|
2989
|
+
(attachmentsMapping) => {
|
|
2990
|
+
return Object.values(attachmentsMapping);
|
|
2991
|
+
}
|
|
2992
|
+
);
|
|
2993
|
+
const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
|
|
2994
|
+
createSelector(
|
|
2995
|
+
[selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
|
|
2996
|
+
(attachments, fieldsRevision) => {
|
|
2997
|
+
return fallbackToEmptyArray(
|
|
2998
|
+
attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
|
|
2999
|
+
);
|
|
3000
|
+
}
|
|
3001
|
+
)
|
|
3002
|
+
);
|
|
3003
|
+
const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3004
|
+
return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3005
|
+
};
|
|
3006
|
+
const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
|
|
3007
|
+
const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3008
|
+
(attachment) => attachment.offline_id
|
|
3009
|
+
);
|
|
3010
|
+
const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3011
|
+
const issueTypeFieldValuesAttachmentSlice = createSlice({
|
|
3012
|
+
name: "issueTypeFieldValuesAttachments",
|
|
3013
|
+
initialState: initialState$4,
|
|
3014
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3015
|
+
reducers: {
|
|
3016
|
+
initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
|
|
3017
|
+
addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
|
|
3018
|
+
addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
|
|
3019
|
+
setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
|
|
3020
|
+
setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
|
|
3021
|
+
updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3022
|
+
updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3023
|
+
deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3024
|
+
deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3025
|
+
}
|
|
3026
|
+
});
|
|
3027
|
+
const {
|
|
3028
|
+
initializeIssueTypeFieldValuesAttachments,
|
|
3029
|
+
addIssueTypeFieldValuesAttachment,
|
|
3030
|
+
addIssueTypeFieldValuesAttachments,
|
|
3031
|
+
setIssueTypeFieldValuesAttachment,
|
|
3032
|
+
setIssueTypeFieldValuesAttachments,
|
|
3033
|
+
updateIssueTypeFieldValuesAttachment,
|
|
3034
|
+
updateIssueTypeFieldValuesAttachments,
|
|
3035
|
+
deleteIssueTypeFieldValuesAttachment,
|
|
3036
|
+
deleteIssueTypeFieldValuesAttachments
|
|
3037
|
+
} = issueTypeFieldValuesAttachmentSlice.actions;
|
|
3038
|
+
const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
|
|
3039
|
+
const selectIssueTypeFieldValuesAttachments = createSelector(
|
|
3040
|
+
[selectIssueTypeFieldValuesAttachmentsMapping],
|
|
3041
|
+
(attachmentsMapping) => {
|
|
3042
|
+
return Object.values(attachmentsMapping);
|
|
3043
|
+
}
|
|
3044
|
+
);
|
|
3045
|
+
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3046
|
+
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3047
|
+
};
|
|
3048
|
+
const selectIssueTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3049
|
+
createSelector(
|
|
3050
|
+
[selectIssueTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3051
|
+
(mapping, attachmentIds) => {
|
|
3052
|
+
const attachmentIdsSet = new Set(attachmentIds);
|
|
3053
|
+
return fallbackToEmptyArray(
|
|
3054
|
+
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3055
|
+
);
|
|
3056
|
+
}
|
|
3057
|
+
)
|
|
3058
|
+
);
|
|
3059
|
+
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3060
|
+
createSelector(
|
|
3061
|
+
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
3062
|
+
(attachments, fieldValuesId) => {
|
|
3063
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
|
|
3064
|
+
}
|
|
3065
|
+
)
|
|
3066
|
+
);
|
|
3067
|
+
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3068
|
+
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3069
|
+
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
3070
|
+
const assetTypeFieldsSlice = createSlice({
|
|
3071
|
+
name: "assetTypeFields",
|
|
3072
|
+
initialState: initialState$3,
|
|
3073
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3074
|
+
reducers: {
|
|
3075
|
+
initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
|
|
3076
|
+
addAssetTypeFields: assetTypeFieldsAdapter.addOne,
|
|
3077
|
+
addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
|
|
3078
|
+
setAssetTypeFields: assetTypeFieldsAdapter.setOne,
|
|
3079
|
+
setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
|
|
3080
|
+
updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
|
|
3081
|
+
updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
|
|
3082
|
+
deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
|
|
3083
|
+
deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
|
|
3084
|
+
}
|
|
3085
|
+
});
|
|
3086
|
+
const {
|
|
3087
|
+
initializeAssetTypeFields,
|
|
3088
|
+
addAssetTypeFields,
|
|
3089
|
+
addAssetTypeFieldsMany,
|
|
3090
|
+
setAssetTypeFields,
|
|
3091
|
+
setAssetTypeFieldsMany,
|
|
3092
|
+
updateAssetTypeFields,
|
|
3093
|
+
updateAssetTypeFieldsMany,
|
|
3094
|
+
deleteAssetTypeFields,
|
|
3095
|
+
deleteAssetTypeFieldsMany
|
|
3096
|
+
} = assetTypeFieldsSlice.actions;
|
|
3097
|
+
const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
|
|
3098
|
+
const selectAssetTypeFields = createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
|
|
3099
|
+
return Object.values(fieldsMapping);
|
|
3100
|
+
});
|
|
3101
|
+
const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3102
|
+
createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
|
|
3103
|
+
return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
|
|
3104
|
+
})
|
|
3105
|
+
);
|
|
3106
|
+
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3107
|
+
createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3108
|
+
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3109
|
+
})
|
|
3110
|
+
);
|
|
3111
|
+
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
3112
|
+
return state.assetTypeFieldsReducer.instances[fieldsId];
|
|
3113
|
+
};
|
|
3114
|
+
const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
|
|
3115
|
+
const assetTypeFieldValuesAdapter = createModelAdapter(
|
|
3116
|
+
(fieldValues) => fieldValues.offline_id
|
|
3117
|
+
);
|
|
3118
|
+
const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
|
|
3119
|
+
const assetTypeFieldValuesSlice = createSlice({
|
|
3120
|
+
name: "assetTypeFieldValues",
|
|
3121
|
+
initialState: initialState$2,
|
|
3122
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
3123
|
+
reducers: {
|
|
3124
|
+
initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
|
|
3125
|
+
addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
|
|
3126
|
+
addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
|
|
3127
|
+
setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
|
|
3128
|
+
setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
|
|
3129
|
+
updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
|
|
3130
|
+
updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
|
|
3131
|
+
deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
|
|
3132
|
+
deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
|
|
3133
|
+
}
|
|
3134
|
+
});
|
|
3135
|
+
const {
|
|
3136
|
+
initializeAssetTypeFieldValues,
|
|
3137
|
+
addAssetTypeFieldValues,
|
|
3138
|
+
addAssetTypeFieldValuesMany,
|
|
3139
|
+
setAssetTypeFieldValues,
|
|
3140
|
+
setAssetTypeFieldValuesMany,
|
|
3141
|
+
updateAssetTypeFieldValues,
|
|
3142
|
+
updateAssetTypeFieldValuesMany,
|
|
3143
|
+
deleteAssetTypeFieldValues,
|
|
3144
|
+
deleteAssetTypeFieldValuesMany
|
|
3145
|
+
} = assetTypeFieldValuesSlice.actions;
|
|
3146
|
+
const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
|
|
3147
|
+
const selectAssetTypeFieldValues = createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3148
|
+
return Object.values(fieldValuesMapping);
|
|
3149
|
+
});
|
|
3150
|
+
const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
|
|
3151
|
+
createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
|
|
3152
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
|
|
3153
|
+
})
|
|
3154
|
+
);
|
|
3155
|
+
const selectAssetTypeValuesOfAssetType = restructureCreateSelectorWithArgs(
|
|
3156
|
+
createSelector(
|
|
3157
|
+
[selectAssetTypeFields, selectAssetTypeFieldValues, (_state, id) => id],
|
|
3158
|
+
(fields, fieldValues, id) => {
|
|
3159
|
+
const fieldsIds = new Set(
|
|
3160
|
+
fields.filter((field) => field.asset_type === id).map((field) => field.offline_id)
|
|
3161
|
+
);
|
|
3162
|
+
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3163
|
+
}
|
|
3164
|
+
)
|
|
3165
|
+
);
|
|
3166
|
+
const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3167
|
+
return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3168
|
+
};
|
|
3169
|
+
const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
|
|
3170
|
+
const assetTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3171
|
+
(attachment) => attachment.offline_id
|
|
3172
|
+
);
|
|
3173
|
+
const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3174
|
+
const assetTypeFieldsAttachmentSlice = createSlice({
|
|
3175
|
+
name: "assetTypeFieldsAttachments",
|
|
3176
|
+
initialState: initialState$1,
|
|
3177
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
3178
|
+
reducers: {
|
|
3179
|
+
initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
|
|
3180
|
+
addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
|
|
3181
|
+
addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
|
|
3182
|
+
setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
|
|
3183
|
+
setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
|
|
3184
|
+
updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
|
|
3185
|
+
updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
|
|
3186
|
+
deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
|
|
3187
|
+
deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
|
|
3188
|
+
}
|
|
3189
|
+
});
|
|
3190
|
+
const {
|
|
3191
|
+
initializeAssetTypeFieldsAttachments,
|
|
3192
|
+
addAssetTypeFieldsAttachment,
|
|
3193
|
+
addAssetTypeFieldsAttachments,
|
|
3194
|
+
setAssetTypeFieldsAttachment,
|
|
3195
|
+
setAssetTypeFieldsAttachments,
|
|
3196
|
+
updateAssetTypeFieldsAttachment,
|
|
3197
|
+
updateAssetTypeFieldsAttachments,
|
|
3198
|
+
deleteAssetTypeFieldsAttachment,
|
|
3199
|
+
deleteAssetTypeFieldsAttachments
|
|
3200
|
+
} = assetTypeFieldsAttachmentSlice.actions;
|
|
3201
|
+
const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
|
|
3202
|
+
const selectAssetTypeFieldsAttachments = createSelector(
|
|
3203
|
+
[selectAssetTypeFieldsAttachmentsMapping],
|
|
3204
|
+
(attachmentsMapping) => {
|
|
3205
|
+
return Object.values(attachmentsMapping);
|
|
3206
|
+
}
|
|
3207
|
+
);
|
|
3208
|
+
const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
|
|
3209
|
+
createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
|
|
3210
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
|
|
3211
|
+
})
|
|
3212
|
+
);
|
|
3213
|
+
const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3214
|
+
return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3215
|
+
};
|
|
3216
|
+
const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
|
|
3217
|
+
const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3218
|
+
(attachment) => attachment.offline_id
|
|
3219
|
+
);
|
|
3220
|
+
const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3221
|
+
const assetTypeFieldValuesAttachmentSlice = createSlice({
|
|
3222
|
+
name: "assetTypeFieldValuesAttachments",
|
|
3223
|
+
initialState,
|
|
3224
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3225
|
+
reducers: {
|
|
3226
|
+
initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
|
|
3227
|
+
addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
|
|
3228
|
+
addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
|
|
3229
|
+
setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
|
|
3230
|
+
setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
|
|
3231
|
+
updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3232
|
+
updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3233
|
+
deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3234
|
+
deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3235
|
+
}
|
|
3236
|
+
});
|
|
3237
|
+
const {
|
|
3238
|
+
initializeAssetTypeFieldValuesAttachments,
|
|
3239
|
+
addAssetTypeFieldValuesAttachment,
|
|
3240
|
+
addAssetTypeFieldValuesAttachments,
|
|
3241
|
+
setAssetTypeFieldValuesAttachment,
|
|
3242
|
+
setAssetTypeFieldValuesAttachments,
|
|
3243
|
+
updateAssetTypeFieldValuesAttachment,
|
|
3244
|
+
updateAssetTypeFieldValuesAttachments,
|
|
3245
|
+
deleteAssetTypeFieldValuesAttachment,
|
|
3246
|
+
deleteAssetTypeFieldValuesAttachments
|
|
3247
|
+
} = assetTypeFieldValuesAttachmentSlice.actions;
|
|
3248
|
+
const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
|
|
3249
|
+
const selectAssetTypeFieldValuesAttachments = createSelector(
|
|
3250
|
+
[selectAssetTypeFieldValuesAttachmentsMapping],
|
|
3251
|
+
(attachmentsMapping) => {
|
|
3252
|
+
return Object.values(attachmentsMapping);
|
|
3253
|
+
}
|
|
3254
|
+
);
|
|
3255
|
+
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3256
|
+
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3257
|
+
};
|
|
3258
|
+
const selectAssetTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3259
|
+
createSelector(
|
|
3260
|
+
[selectAssetTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3261
|
+
(mapping, attachmentIds) => {
|
|
3262
|
+
const attachmentIdsSet = new Set(attachmentIds);
|
|
3263
|
+
return fallbackToEmptyArray(
|
|
3264
|
+
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3265
|
+
);
|
|
3266
|
+
}
|
|
3267
|
+
)
|
|
3268
|
+
);
|
|
3269
|
+
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3270
|
+
createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3271
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3272
|
+
})
|
|
3273
|
+
);
|
|
3274
|
+
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3275
|
+
let clientStore;
|
|
3276
|
+
function setClientStore(store) {
|
|
3277
|
+
clientStore = store;
|
|
3278
|
+
}
|
|
3279
|
+
function getClientStore() {
|
|
3280
|
+
return clientStore;
|
|
3281
|
+
}
|
|
3282
|
+
let clientSDK;
|
|
3283
|
+
function setClientSDK(sdkCtor) {
|
|
3284
|
+
clientSDK = sdkCtor;
|
|
3285
|
+
}
|
|
3286
|
+
function getClientSDK() {
|
|
3287
|
+
return clientSDK;
|
|
3288
|
+
}
|
|
3289
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3290
|
+
class BaseService {
|
|
3291
|
+
constructor(sdk) {
|
|
3292
|
+
__publicField(this, "client");
|
|
3293
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3294
|
+
this.client = sdk;
|
|
3295
|
+
}
|
|
3296
|
+
async enqueueRequest(requestDetails) {
|
|
3297
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3298
|
+
}
|
|
3299
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3300
|
+
dispatch(action) {
|
|
3301
|
+
this.client.store.dispatch(action);
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
const VERSION_REDUCER_KEY = "versioning";
|
|
3305
|
+
const overmapReducers = {
|
|
3306
|
+
// TODO: attachmentReducer,
|
|
3120
3307
|
[VERSION_REDUCER_KEY]: versioningReducer,
|
|
3121
3308
|
fileReducer,
|
|
3122
3309
|
authReducer,
|
|
@@ -3154,7 +3341,15 @@ const overmapReducers = {
|
|
|
3154
3341
|
issueCommentReducer,
|
|
3155
3342
|
issueUpdateReducer,
|
|
3156
3343
|
geoImageReducer,
|
|
3157
|
-
issueAssociationReducer
|
|
3344
|
+
issueAssociationReducer,
|
|
3345
|
+
issueTypeFieldsReducer,
|
|
3346
|
+
issueTypeFieldValuesReducer,
|
|
3347
|
+
issueTypeFieldsAttachmentReducer,
|
|
3348
|
+
issueTypeFieldValuesAttachmentReducer,
|
|
3349
|
+
assetTypeFieldsReducer,
|
|
3350
|
+
assetTypeFieldValuesReducer,
|
|
3351
|
+
assetTypeFieldsAttachmentReducer,
|
|
3352
|
+
assetTypeFieldValuesAttachmentReducer
|
|
3158
3353
|
};
|
|
3159
3354
|
const overmapReducer = combineReducers(overmapReducers);
|
|
3160
3355
|
const resetStore = "RESET";
|
|
@@ -3179,9 +3374,8 @@ function getOutboxCoordinator() {
|
|
|
3179
3374
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3180
3375
|
return coordinator;
|
|
3181
3376
|
}
|
|
3182
|
-
const persistCallback = (
|
|
3183
|
-
if (
|
|
3184
|
-
throw err;
|
|
3377
|
+
const persistCallback = (e) => {
|
|
3378
|
+
if (e) throw e;
|
|
3185
3379
|
const clientStore2 = getClientStore();
|
|
3186
3380
|
if (clientStore2) {
|
|
3187
3381
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3245,14 +3439,11 @@ function extractResponseFromError(error) {
|
|
|
3245
3439
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3246
3440
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3247
3441
|
}
|
|
3248
|
-
if (isResponse(error))
|
|
3249
|
-
return error;
|
|
3442
|
+
if (isResponse(error)) return error;
|
|
3250
3443
|
if (typeof error === "object" && error !== null) {
|
|
3251
3444
|
const typedError = error;
|
|
3252
|
-
if (isResponse(typedError.response))
|
|
3253
|
-
|
|
3254
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3255
|
-
return typedError.response.response;
|
|
3445
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3446
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3256
3447
|
}
|
|
3257
3448
|
return void 0;
|
|
3258
3449
|
}
|
|
@@ -3293,15 +3484,11 @@ async function performRequest(action, client) {
|
|
|
3293
3484
|
const addPayload = (req) => {
|
|
3294
3485
|
if (attachmentHash) {
|
|
3295
3486
|
const s3url = requestDetails.s3url;
|
|
3296
|
-
if (!s3url)
|
|
3297
|
-
|
|
3298
|
-
if (
|
|
3299
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3300
|
-
if (!file)
|
|
3301
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3487
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3488
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3489
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3302
3490
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3303
|
-
if (!s3Sha1Checksum)
|
|
3304
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3491
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3305
3492
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3306
3493
|
}
|
|
3307
3494
|
return req.send(payload);
|
|
@@ -3361,8 +3548,7 @@ class MiddlewareChainerPrivate {
|
|
|
3361
3548
|
this.compile = this.compile.bind(this);
|
|
3362
3549
|
}
|
|
3363
3550
|
then(next) {
|
|
3364
|
-
if (this._previous)
|
|
3365
|
-
this._previous.next = next;
|
|
3551
|
+
if (this._previous) this._previous.next = next;
|
|
3366
3552
|
this._all.push(next);
|
|
3367
3553
|
this._previous = next;
|
|
3368
3554
|
return {
|
|
@@ -3390,11 +3576,9 @@ class OfflineMiddleware {
|
|
|
3390
3576
|
} else {
|
|
3391
3577
|
console.debug("Middleware finished. Performing request:", action);
|
|
3392
3578
|
const clientStore2 = getClientStore();
|
|
3393
|
-
if (!clientStore2)
|
|
3394
|
-
throw new Error("Client store not set");
|
|
3579
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3395
3580
|
const clientSDK2 = getClientSDK();
|
|
3396
|
-
if (!clientSDK2)
|
|
3397
|
-
throw new Error("Client SDK not set");
|
|
3581
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3398
3582
|
return performRequest(action, clientSDK2);
|
|
3399
3583
|
}
|
|
3400
3584
|
}
|
|
@@ -3415,20 +3599,6 @@ function runMiddleware(action) {
|
|
|
3415
3599
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3416
3600
|
}
|
|
3417
3601
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3418
|
-
const statusMessages = {
|
|
3419
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3420
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3421
|
-
405: {
|
|
3422
|
-
title: "Not supported",
|
|
3423
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3424
|
-
accentColor: "red"
|
|
3425
|
-
},
|
|
3426
|
-
500: {
|
|
3427
|
-
title: "Server error",
|
|
3428
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3429
|
-
accentColor: "red"
|
|
3430
|
-
}
|
|
3431
|
-
};
|
|
3432
3602
|
function discard(reason, action, retries = 0) {
|
|
3433
3603
|
var _a2;
|
|
3434
3604
|
console.debug(
|
|
@@ -3481,14 +3651,6 @@ function discard(reason, action, retries = 0) {
|
|
|
3481
3651
|
}
|
|
3482
3652
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3483
3653
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3484
|
-
const message = statusMessages[status];
|
|
3485
|
-
if (message) {
|
|
3486
|
-
if (unsafeShowToast) {
|
|
3487
|
-
unsafeShowToast(message);
|
|
3488
|
-
} else {
|
|
3489
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3490
|
-
}
|
|
3491
|
-
}
|
|
3492
3654
|
const coordinator2 = getOutboxCoordinator();
|
|
3493
3655
|
if (!coordinator2) {
|
|
3494
3656
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3516,6 +3678,7 @@ function retry(_action, _retries) {
|
|
|
3516
3678
|
}
|
|
3517
3679
|
class BaseSDK {
|
|
3518
3680
|
constructor(store) {
|
|
3681
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3519
3682
|
__publicField(this, "store");
|
|
3520
3683
|
this.store = store;
|
|
3521
3684
|
}
|
|
@@ -3551,9 +3714,13 @@ class BaseSDK {
|
|
|
3551
3714
|
};
|
|
3552
3715
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3553
3716
|
promise.resolve(result.body);
|
|
3554
|
-
}).catch((
|
|
3555
|
-
discard(
|
|
3556
|
-
|
|
3717
|
+
}).catch((e) => {
|
|
3718
|
+
discard(e, fullOfflineAction);
|
|
3719
|
+
if (e instanceof Error) {
|
|
3720
|
+
promise.reject(e);
|
|
3721
|
+
} else {
|
|
3722
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3723
|
+
}
|
|
3557
3724
|
});
|
|
3558
3725
|
} else {
|
|
3559
3726
|
const innerPromise = this.store.dispatch(
|
|
@@ -3607,10 +3774,8 @@ class BaseAuthService extends BaseService {
|
|
|
3607
3774
|
}
|
|
3608
3775
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3609
3776
|
function parseTokens(response) {
|
|
3610
|
-
if (!response.access)
|
|
3611
|
-
|
|
3612
|
-
if (!response.refresh)
|
|
3613
|
-
throw new Error("Missing refresh token");
|
|
3777
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3778
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3614
3779
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3615
3780
|
}
|
|
3616
3781
|
class JWTService extends BaseAuthService {
|
|
@@ -3647,8 +3812,7 @@ class JWTService extends BaseAuthService {
|
|
|
3647
3812
|
this.clearAuth();
|
|
3648
3813
|
return void 0;
|
|
3649
3814
|
}
|
|
3650
|
-
if (!response.access)
|
|
3651
|
-
throw new Error("Missing access token");
|
|
3815
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3652
3816
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3653
3817
|
});
|
|
3654
3818
|
}
|
|
@@ -3704,8 +3868,7 @@ class JWTService extends BaseAuthService {
|
|
|
3704
3868
|
return `Bearer ${accessToken}`;
|
|
3705
3869
|
}
|
|
3706
3870
|
async prepareAuth() {
|
|
3707
|
-
if (!this.tokenIsExpiringSoon())
|
|
3708
|
-
return;
|
|
3871
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3709
3872
|
console.debug(this.constructor.name, "preparing auth");
|
|
3710
3873
|
try {
|
|
3711
3874
|
await this.renewTokens();
|
|
@@ -3713,7 +3876,11 @@ class JWTService extends BaseAuthService {
|
|
|
3713
3876
|
if (e instanceof APIError) {
|
|
3714
3877
|
this.clearAuth();
|
|
3715
3878
|
}
|
|
3716
|
-
|
|
3879
|
+
if (e instanceof Error) {
|
|
3880
|
+
return Promise.reject(e);
|
|
3881
|
+
} else {
|
|
3882
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3883
|
+
}
|
|
3717
3884
|
}
|
|
3718
3885
|
}
|
|
3719
3886
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -3744,7 +3911,7 @@ class JWTService extends BaseAuthService {
|
|
|
3744
3911
|
async initAuth(payload) {
|
|
3745
3912
|
const uuid = v4();
|
|
3746
3913
|
console.debug(this.constructor.name, "Initiating auth");
|
|
3747
|
-
|
|
3914
|
+
return this.enqueueRequest({
|
|
3748
3915
|
uuid,
|
|
3749
3916
|
description: "Get token pair",
|
|
3750
3917
|
method: HttpMethod.POST,
|
|
@@ -3752,25 +3919,12 @@ class JWTService extends BaseAuthService {
|
|
|
3752
3919
|
payload,
|
|
3753
3920
|
isAuthNeeded: false,
|
|
3754
3921
|
checkAuth: false,
|
|
3922
|
+
immediate: true,
|
|
3755
3923
|
blockers: [],
|
|
3756
3924
|
blocks: []
|
|
3757
|
-
}).then(
|
|
3758
|
-
|
|
3759
|
-
let timedOut = false;
|
|
3760
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3761
|
-
setTimeout(() => {
|
|
3762
|
-
timedOut = true;
|
|
3763
|
-
this.dispatch(markForDeletion(uuid));
|
|
3764
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
3765
|
-
}, timeout * 1e3);
|
|
3766
|
-
});
|
|
3767
|
-
const successPromise = promise.then((tokens) => {
|
|
3768
|
-
if (timedOut) {
|
|
3769
|
-
return void 0;
|
|
3770
|
-
}
|
|
3771
|
-
this.setTokens(tokens);
|
|
3925
|
+
}).then((tokens) => {
|
|
3926
|
+
this.setTokens(parseTokens(tokens));
|
|
3772
3927
|
});
|
|
3773
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3774
3928
|
}
|
|
3775
3929
|
}
|
|
3776
3930
|
class BaseApiService extends BaseService {
|
|
@@ -3796,9 +3950,6 @@ class CategoryService extends BaseApiService {
|
|
|
3796
3950
|
description: "Create Category",
|
|
3797
3951
|
method: HttpMethod.POST,
|
|
3798
3952
|
url: "/categories/",
|
|
3799
|
-
queryParams: {
|
|
3800
|
-
workspace_id: payload.workspace.toString()
|
|
3801
|
-
},
|
|
3802
3953
|
payload: offlineCategory,
|
|
3803
3954
|
blockers: [payload.workspace],
|
|
3804
3955
|
blocks: [offlineCategory.offline_id]
|
|
@@ -3881,15 +4032,7 @@ class AssetService extends BaseApiService {
|
|
|
3881
4032
|
description: "Create asset",
|
|
3882
4033
|
method: HttpMethod.POST,
|
|
3883
4034
|
url: "/assets/",
|
|
3884
|
-
payload:
|
|
3885
|
-
offline_id: offlineAsset.offline_id,
|
|
3886
|
-
submitted_at: offlineAsset.submitted_at,
|
|
3887
|
-
geo_marker: offlineAsset.geo_marker,
|
|
3888
|
-
canvas_marker: offlineAsset.canvas_marker,
|
|
3889
|
-
label: offlineAsset.label,
|
|
3890
|
-
description: offlineAsset.description,
|
|
3891
|
-
asset_type: offlineAsset.asset_type
|
|
3892
|
-
},
|
|
4035
|
+
payload: offlineAsset,
|
|
3893
4036
|
blockers: [offlineAsset.asset_type],
|
|
3894
4037
|
blocks: [offlineAsset.offline_id]
|
|
3895
4038
|
});
|
|
@@ -3933,8 +4076,7 @@ class AssetService extends BaseApiService {
|
|
|
3933
4076
|
const { store } = this.client;
|
|
3934
4077
|
const state = store.getState();
|
|
3935
4078
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3936
|
-
if (!assetToBeDeleted)
|
|
3937
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
4079
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
3938
4080
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3939
4081
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3940
4082
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3957,15 +4099,15 @@ class AssetService extends BaseApiService {
|
|
|
3957
4099
|
url: `/assets/${id}/`,
|
|
3958
4100
|
blockers: [id],
|
|
3959
4101
|
blocks: []
|
|
3960
|
-
}).catch((
|
|
4102
|
+
}).catch((e) => {
|
|
3961
4103
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3962
4104
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3963
4105
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3964
4106
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3965
|
-
throw
|
|
4107
|
+
throw e;
|
|
3966
4108
|
});
|
|
3967
4109
|
}
|
|
3968
|
-
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
4110
|
+
bulkAdd(payloads, assetTypeId, projectId, batchSize) {
|
|
3969
4111
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3970
4112
|
const transactionId = v4();
|
|
3971
4113
|
const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
|
|
@@ -3976,6 +4118,7 @@ class AssetService extends BaseApiService {
|
|
|
3976
4118
|
transaction_id: transactionId,
|
|
3977
4119
|
submitted_at: submittedAt,
|
|
3978
4120
|
asset_type: assetTypeId,
|
|
4121
|
+
project: projectId,
|
|
3979
4122
|
assets: assetPayloads
|
|
3980
4123
|
}
|
|
3981
4124
|
};
|
|
@@ -3986,8 +4129,7 @@ class AssetService extends BaseApiService {
|
|
|
3986
4129
|
const { batchId, payload } = assetBatch;
|
|
3987
4130
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3988
4131
|
const blockers = [assetTypeId];
|
|
3989
|
-
if (prevBatchId)
|
|
3990
|
-
blockers.push(prevBatchId);
|
|
4132
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
3991
4133
|
const blocks = batchAssetOfflineIds;
|
|
3992
4134
|
blocks.push(batchId);
|
|
3993
4135
|
const promise = this.enqueueRequest({
|
|
@@ -4011,7 +4153,10 @@ class AssetService extends BaseApiService {
|
|
|
4011
4153
|
const result = await this.enqueueRequest({
|
|
4012
4154
|
description: "Get assets",
|
|
4013
4155
|
method: HttpMethod.GET,
|
|
4014
|
-
url:
|
|
4156
|
+
url: "/assets/",
|
|
4157
|
+
queryParams: {
|
|
4158
|
+
project: projectId.toString()
|
|
4159
|
+
},
|
|
4015
4160
|
blockers: [],
|
|
4016
4161
|
blocks: []
|
|
4017
4162
|
});
|
|
@@ -4032,7 +4177,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4032
4177
|
const promise = this.enqueueRequest({
|
|
4033
4178
|
description: "Add asset stage completion",
|
|
4034
4179
|
method: HttpMethod.POST,
|
|
4035
|
-
url: "/
|
|
4180
|
+
url: "/asset-stage-completions/",
|
|
4036
4181
|
payload: {
|
|
4037
4182
|
offline_id: offlineStageCompletion.offline_id,
|
|
4038
4183
|
submitted_at: submittedAt,
|
|
@@ -4059,7 +4204,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4059
4204
|
const promise = this.enqueueRequest({
|
|
4060
4205
|
description: "Delete asset stage completion",
|
|
4061
4206
|
method: HttpMethod.DELETE,
|
|
4062
|
-
url: `/
|
|
4207
|
+
url: `/asset-stage-completions/${id}/`,
|
|
4063
4208
|
blockers: [id],
|
|
4064
4209
|
blocks: []
|
|
4065
4210
|
});
|
|
@@ -4085,7 +4230,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4085
4230
|
const promise = this.enqueueRequest({
|
|
4086
4231
|
description: "Bulk create asset stage completions",
|
|
4087
4232
|
method: HttpMethod.POST,
|
|
4088
|
-
url: "/
|
|
4233
|
+
url: "/asset-stage-completions/bulk/",
|
|
4089
4234
|
payload: {
|
|
4090
4235
|
submitted_at: submittedAt,
|
|
4091
4236
|
completions: payload
|
|
@@ -4107,7 +4252,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4107
4252
|
const promise = this.enqueueRequest({
|
|
4108
4253
|
description: "Deleting asset stage completions",
|
|
4109
4254
|
method: HttpMethod.DELETE,
|
|
4110
|
-
url: "/
|
|
4255
|
+
url: "/asset-stage-completions/bulk/",
|
|
4111
4256
|
payload: {
|
|
4112
4257
|
completion_ids: ids
|
|
4113
4258
|
},
|
|
@@ -4123,7 +4268,10 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4123
4268
|
const result = await this.enqueueRequest({
|
|
4124
4269
|
description: "Get asset stage completions",
|
|
4125
4270
|
method: HttpMethod.GET,
|
|
4126
|
-
url:
|
|
4271
|
+
url: "/asset-stage-completions/",
|
|
4272
|
+
queryParams: {
|
|
4273
|
+
project: projectId.toString()
|
|
4274
|
+
},
|
|
4127
4275
|
blockers: [],
|
|
4128
4276
|
blocks: []
|
|
4129
4277
|
});
|
|
@@ -4144,7 +4292,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4144
4292
|
const promise = this.enqueueRequest({
|
|
4145
4293
|
description: "Add asset stages",
|
|
4146
4294
|
method: HttpMethod.POST,
|
|
4147
|
-
url: "/
|
|
4295
|
+
url: "/asset-stages/bulk/",
|
|
4148
4296
|
payload: {
|
|
4149
4297
|
submitted_at: submittedAt,
|
|
4150
4298
|
asset_type: assetTypeId,
|
|
@@ -4168,7 +4316,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4168
4316
|
return this.enqueueRequest({
|
|
4169
4317
|
description: "Edit asset stages",
|
|
4170
4318
|
method: HttpMethod.PATCH,
|
|
4171
|
-
url: `/
|
|
4319
|
+
url: `/asset-types/${assetTypeId}/bulk-update-stages/`,
|
|
4172
4320
|
payload: {
|
|
4173
4321
|
stages: stagesToUpdate
|
|
4174
4322
|
},
|
|
@@ -4186,7 +4334,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4186
4334
|
const promise = this.enqueueRequest({
|
|
4187
4335
|
description: "Delete asset stages",
|
|
4188
4336
|
method: HttpMethod.DELETE,
|
|
4189
|
-
url: "/
|
|
4337
|
+
url: "/asset-stages/bulk/",
|
|
4190
4338
|
payload: {
|
|
4191
4339
|
stage_ids: idsToDelete
|
|
4192
4340
|
},
|
|
@@ -4201,8 +4349,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4201
4349
|
update(payload) {
|
|
4202
4350
|
const { store } = this.client;
|
|
4203
4351
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4204
|
-
if (!assetStage)
|
|
4205
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4352
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4206
4353
|
const updatedAssetStage = {
|
|
4207
4354
|
...assetStage,
|
|
4208
4355
|
...payload
|
|
@@ -4211,7 +4358,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4211
4358
|
const promise = this.enqueueRequest({
|
|
4212
4359
|
description: "Update asset stage",
|
|
4213
4360
|
method: HttpMethod.PATCH,
|
|
4214
|
-
url: `/
|
|
4361
|
+
url: `/asset-stages/${assetStage.offline_id}/`,
|
|
4215
4362
|
payload: {
|
|
4216
4363
|
name: payload.name,
|
|
4217
4364
|
description: payload.description,
|
|
@@ -4228,52 +4375,14 @@ class AssetStageService extends BaseApiService {
|
|
|
4228
4375
|
});
|
|
4229
4376
|
return [updatedAssetStage, promise];
|
|
4230
4377
|
}
|
|
4231
|
-
async
|
|
4232
|
-
const { store } = this.client;
|
|
4233
|
-
const stage = store.getState().assetStageReducer.instances[stageId];
|
|
4234
|
-
if (!stage) {
|
|
4235
|
-
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4236
|
-
}
|
|
4237
|
-
this.dispatch(updateAssetStage({ ...stage, form: formId }));
|
|
4238
|
-
try {
|
|
4239
|
-
await this.enqueueRequest({
|
|
4240
|
-
description: "Link asset stage to form",
|
|
4241
|
-
method: HttpMethod.POST,
|
|
4242
|
-
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4243
|
-
payload: { form: formId },
|
|
4244
|
-
blockers: [stageId, formId],
|
|
4245
|
-
blocks: [stageId]
|
|
4246
|
-
});
|
|
4247
|
-
} catch (e) {
|
|
4248
|
-
this.dispatch(setAssetStage(stage));
|
|
4249
|
-
throw e;
|
|
4250
|
-
}
|
|
4251
|
-
}
|
|
4252
|
-
async unlinkForm(stageId, formId) {
|
|
4253
|
-
const { store } = this.client;
|
|
4254
|
-
const stage = store.getState().assetStageReducer.instances[stageId];
|
|
4255
|
-
if (!stage) {
|
|
4256
|
-
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4257
|
-
}
|
|
4258
|
-
this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
|
|
4259
|
-
try {
|
|
4260
|
-
await this.enqueueRequest({
|
|
4261
|
-
description: "Unlink asset stage from form",
|
|
4262
|
-
method: HttpMethod.DELETE,
|
|
4263
|
-
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4264
|
-
blockers: [stageId, formId],
|
|
4265
|
-
blocks: [stageId]
|
|
4266
|
-
});
|
|
4267
|
-
} catch (e) {
|
|
4268
|
-
this.dispatch(setAssetStage(stage));
|
|
4269
|
-
throw e;
|
|
4270
|
-
}
|
|
4271
|
-
}
|
|
4272
|
-
async refreshStore(projectId) {
|
|
4378
|
+
async refreshStore(organizationId) {
|
|
4273
4379
|
const result = await this.enqueueRequest({
|
|
4274
4380
|
description: "Get asset stages",
|
|
4275
4381
|
method: HttpMethod.GET,
|
|
4276
|
-
url:
|
|
4382
|
+
url: "/asset-stages/",
|
|
4383
|
+
queryParams: {
|
|
4384
|
+
organization: organizationId.toString()
|
|
4385
|
+
},
|
|
4277
4386
|
blockers: [],
|
|
4278
4387
|
blocks: []
|
|
4279
4388
|
});
|
|
@@ -4290,7 +4399,12 @@ class BaseUploadService extends BaseApiService {
|
|
|
4290
4399
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4291
4400
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4292
4401
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4293
|
-
geoImageReducer: geoImageReducer2
|
|
4402
|
+
geoImageReducer: geoImageReducer2,
|
|
4403
|
+
// fields
|
|
4404
|
+
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4405
|
+
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4406
|
+
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4407
|
+
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4294
4408
|
} = this.client.store.getState();
|
|
4295
4409
|
const objectsWithSha1 = [].concat(
|
|
4296
4410
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4300,7 +4414,11 @@ class BaseUploadService extends BaseApiService {
|
|
|
4300
4414
|
Object.values(projectAttachmentReducer2.instances),
|
|
4301
4415
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4302
4416
|
Object.values(formSubmissionAttachmentReducer2.instances),
|
|
4303
|
-
Object.values(geoImageReducer2.instances)
|
|
4417
|
+
Object.values(geoImageReducer2.instances),
|
|
4418
|
+
Object.values(assetTypeFieldsAttachmentReducer2.instances),
|
|
4419
|
+
Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
|
|
4420
|
+
Object.values(issueTypeFieldsAttachmentReducer2.instances),
|
|
4421
|
+
Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
|
|
4304
4422
|
);
|
|
4305
4423
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4306
4424
|
}
|
|
@@ -4322,41 +4440,20 @@ class BaseUploadService extends BaseApiService {
|
|
|
4322
4440
|
}
|
|
4323
4441
|
return promisesBySha1;
|
|
4324
4442
|
}
|
|
4325
|
-
|
|
4326
|
-
const
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
attachUrlPrefix: "/assets",
|
|
4336
|
-
deleteUrlPrefix: "/assets",
|
|
4337
|
-
fetchUrlPostfix: "/asset-attachments"
|
|
4338
|
-
},
|
|
4339
|
-
[AttachmentModel.AssetType]: {
|
|
4340
|
-
name: "asset type",
|
|
4341
|
-
attachUrlPrefix: "/assets/types",
|
|
4342
|
-
deleteUrlPrefix: "/assets/types",
|
|
4343
|
-
fetchUrlPostfix: "/asset-type-attachments"
|
|
4344
|
-
},
|
|
4345
|
-
[AttachmentModel.Project]: {
|
|
4346
|
-
name: "project",
|
|
4347
|
-
attachUrlPrefix: "/projects",
|
|
4348
|
-
deleteUrlPrefix: "/projects",
|
|
4349
|
-
fetchUrlPostfix: "/attachments"
|
|
4350
|
-
},
|
|
4351
|
-
[AttachmentModel.Document]: {
|
|
4352
|
-
name: "document",
|
|
4353
|
-
attachUrlPrefix: "/documents",
|
|
4354
|
-
deleteUrlPrefix: "/documents",
|
|
4355
|
-
fetchUrlPostfix: "/document-attachments"
|
|
4443
|
+
async getFilePayload(file) {
|
|
4444
|
+
const sha1 = await hashFile(file);
|
|
4445
|
+
const filePayload = {
|
|
4446
|
+
sha1,
|
|
4447
|
+
file_type: file.type,
|
|
4448
|
+
extension: file.name.split(".").pop(),
|
|
4449
|
+
size: file.size
|
|
4450
|
+
};
|
|
4451
|
+
await this.client.files.addCache(file, sha1);
|
|
4452
|
+
return filePayload;
|
|
4356
4453
|
}
|
|
4357
|
-
}
|
|
4454
|
+
}
|
|
4358
4455
|
class BaseAttachmentService extends BaseUploadService {
|
|
4359
|
-
async
|
|
4456
|
+
async _bulkAdd(payloads) {
|
|
4360
4457
|
var _a2;
|
|
4361
4458
|
const { store } = this.client;
|
|
4362
4459
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4364,39 +4461,35 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4364
4461
|
const offlineAttachments = [];
|
|
4365
4462
|
const attachmentPayloads = [];
|
|
4366
4463
|
const filePayloads = {};
|
|
4367
|
-
for (const
|
|
4368
|
-
const
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
file_type: file.type,
|
|
4373
|
-
extension: file.name.split(".").pop(),
|
|
4374
|
-
size: file.size
|
|
4375
|
-
};
|
|
4376
|
-
await this.client.files.addCache(file, sha1);
|
|
4377
|
-
}
|
|
4378
|
-
const offlineAttachment = buildOfflineAttachment({
|
|
4464
|
+
for (const payload of payloads) {
|
|
4465
|
+
const { modelId, file } = payload;
|
|
4466
|
+
const filePayload = await this.getFilePayload(file);
|
|
4467
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
4468
|
+
const offlineAttachment = this.buildOfflineAttachment({
|
|
4379
4469
|
file,
|
|
4380
|
-
sha1,
|
|
4381
|
-
submittedAt,
|
|
4382
|
-
createdBy,
|
|
4470
|
+
file_sha1: filePayload.sha1,
|
|
4471
|
+
submitted_at: submittedAt,
|
|
4472
|
+
created_by: createdBy,
|
|
4383
4473
|
description: "",
|
|
4384
4474
|
modelId
|
|
4385
4475
|
});
|
|
4386
4476
|
offlineAttachments.push(offlineAttachment);
|
|
4387
|
-
attachmentPayloads.push(
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4477
|
+
attachmentPayloads.push(
|
|
4478
|
+
this.buildAttachmentPayload({
|
|
4479
|
+
offline_id: offlineAttachment.offline_id,
|
|
4480
|
+
file_name: offlineAttachment.file_name,
|
|
4481
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
4482
|
+
file_extension: filePayload.extension,
|
|
4483
|
+
description: offlineAttachment.description,
|
|
4484
|
+
modelId
|
|
4485
|
+
})
|
|
4486
|
+
);
|
|
4393
4487
|
}
|
|
4394
4488
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4395
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4396
4489
|
const promise = this.enqueueRequest({
|
|
4397
|
-
description: `
|
|
4490
|
+
description: `Add ${this.name}`,
|
|
4398
4491
|
method: HttpMethod.POST,
|
|
4399
|
-
url: `${
|
|
4492
|
+
url: `${this.url}/bulk/`,
|
|
4400
4493
|
payload: {
|
|
4401
4494
|
submitted_at: submittedAt,
|
|
4402
4495
|
attachments: attachmentPayloads,
|
|
@@ -4413,7 +4506,7 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4413
4506
|
});
|
|
4414
4507
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4415
4508
|
}
|
|
4416
|
-
async
|
|
4509
|
+
async _delete(attachmendId) {
|
|
4417
4510
|
const { store } = this.client;
|
|
4418
4511
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4419
4512
|
if (!attachment) {
|
|
@@ -4422,11 +4515,10 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4422
4515
|
);
|
|
4423
4516
|
}
|
|
4424
4517
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4425
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4426
4518
|
const promise = this.enqueueRequest({
|
|
4427
|
-
description:
|
|
4519
|
+
description: `Delete ${this.name}`,
|
|
4428
4520
|
method: HttpMethod.DELETE,
|
|
4429
|
-
url: `${
|
|
4521
|
+
url: `${this.url}/${attachmendId}/`,
|
|
4430
4522
|
blockers: [attachmendId],
|
|
4431
4523
|
blocks: []
|
|
4432
4524
|
});
|
|
@@ -4439,24 +4531,12 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4439
4531
|
});
|
|
4440
4532
|
return promise;
|
|
4441
4533
|
}
|
|
4442
|
-
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4443
|
-
// so for some attachment model services, this method will have to be overridden.
|
|
4444
|
-
async refreshStore(projectId, _organizationId) {
|
|
4445
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4446
|
-
const result = await this.enqueueRequest({
|
|
4447
|
-
description: `Get ${meta.name} attachments`,
|
|
4448
|
-
method: HttpMethod.GET,
|
|
4449
|
-
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4450
|
-
blocks: [],
|
|
4451
|
-
blockers: []
|
|
4452
|
-
});
|
|
4453
|
-
this.dispatch(this.initializeAttachments(result));
|
|
4454
|
-
}
|
|
4455
4534
|
}
|
|
4456
4535
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4457
4536
|
constructor() {
|
|
4458
4537
|
super(...arguments);
|
|
4459
|
-
__publicField(this, "
|
|
4538
|
+
__publicField(this, "name", "Asset Attachment");
|
|
4539
|
+
__publicField(this, "url", "/asset-attachments");
|
|
4460
4540
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4461
4541
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4462
4542
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4468,20 +4548,39 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
4468
4548
|
buildOfflineAttachment(data) {
|
|
4469
4549
|
return offline({
|
|
4470
4550
|
file: URL.createObjectURL(data.file),
|
|
4471
|
-
file_sha1: data.
|
|
4472
|
-
created_by: data.
|
|
4551
|
+
file_sha1: data.file_sha1,
|
|
4552
|
+
created_by: data.created_by,
|
|
4473
4553
|
file_name: data.file.name,
|
|
4474
4554
|
file_type: data.file.type,
|
|
4475
|
-
submitted_at: data.
|
|
4555
|
+
submitted_at: data.submitted_at,
|
|
4476
4556
|
description: data.description,
|
|
4477
4557
|
asset: data.modelId
|
|
4478
4558
|
});
|
|
4479
4559
|
}
|
|
4480
|
-
|
|
4481
|
-
return
|
|
4560
|
+
buildAttachmentPayload(data) {
|
|
4561
|
+
return {
|
|
4562
|
+
...data,
|
|
4563
|
+
asset: data.modelId
|
|
4564
|
+
};
|
|
4565
|
+
}
|
|
4566
|
+
async bulkAdd(payloads) {
|
|
4567
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
|
|
4568
|
+
}
|
|
4569
|
+
async delete(id) {
|
|
4570
|
+
return this._delete(id);
|
|
4482
4571
|
}
|
|
4483
|
-
async
|
|
4484
|
-
|
|
4572
|
+
async refreshStore(projectId) {
|
|
4573
|
+
const result = await this.enqueueRequest({
|
|
4574
|
+
description: "Get asset attachments",
|
|
4575
|
+
method: HttpMethod.GET,
|
|
4576
|
+
url: `${this.url}/`,
|
|
4577
|
+
queryParams: {
|
|
4578
|
+
project: projectId.toString()
|
|
4579
|
+
},
|
|
4580
|
+
blocks: [],
|
|
4581
|
+
blockers: []
|
|
4582
|
+
});
|
|
4583
|
+
this.dispatch(initializeAssetAttachments(result));
|
|
4485
4584
|
}
|
|
4486
4585
|
}
|
|
4487
4586
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4498,8 +4597,8 @@ class AssetTypeService extends BaseApiService {
|
|
|
4498
4597
|
const promise = this.enqueueRequest({
|
|
4499
4598
|
description: "Create asset type",
|
|
4500
4599
|
method: HttpMethod.POST,
|
|
4501
|
-
url:
|
|
4502
|
-
payload:
|
|
4600
|
+
url: "/asset-types/",
|
|
4601
|
+
payload: offlineAssetType,
|
|
4503
4602
|
blockers: [],
|
|
4504
4603
|
blocks: [offlineAssetType.offline_id]
|
|
4505
4604
|
});
|
|
@@ -4524,7 +4623,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4524
4623
|
const promise = this.enqueueRequest({
|
|
4525
4624
|
description: "Update asset type",
|
|
4526
4625
|
method: HttpMethod.PATCH,
|
|
4527
|
-
url: `/
|
|
4626
|
+
url: `/asset-types/${payload.offline_id}/`,
|
|
4528
4627
|
payload: {
|
|
4529
4628
|
icon: payload.icon,
|
|
4530
4629
|
color: payload.color,
|
|
@@ -4558,7 +4657,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4558
4657
|
return this.enqueueRequest({
|
|
4559
4658
|
description: "Delete asset type",
|
|
4560
4659
|
method: HttpMethod.DELETE,
|
|
4561
|
-
url: `/
|
|
4660
|
+
url: `/asset-types/${assetTypeId}/`,
|
|
4562
4661
|
blockers: [assetTypeId],
|
|
4563
4662
|
blocks: []
|
|
4564
4663
|
}).catch((e) => {
|
|
@@ -4569,12 +4668,15 @@ class AssetTypeService extends BaseApiService {
|
|
|
4569
4668
|
throw e;
|
|
4570
4669
|
});
|
|
4571
4670
|
}
|
|
4572
|
-
async refreshStore(
|
|
4671
|
+
async refreshStore(organizationId) {
|
|
4573
4672
|
const result = await this.enqueueRequest({
|
|
4574
4673
|
description: "Get asset types",
|
|
4575
4674
|
method: HttpMethod.GET,
|
|
4576
|
-
url:
|
|
4577
|
-
|
|
4675
|
+
url: "/asset-types/",
|
|
4676
|
+
queryParams: {
|
|
4677
|
+
organization: organizationId.toString()
|
|
4678
|
+
},
|
|
4679
|
+
blockers: [],
|
|
4578
4680
|
blocks: []
|
|
4579
4681
|
});
|
|
4580
4682
|
this.dispatch(initializeAssetTypes(result));
|
|
@@ -4583,8 +4685,8 @@ class AssetTypeService extends BaseApiService {
|
|
|
4583
4685
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4584
4686
|
constructor() {
|
|
4585
4687
|
super(...arguments);
|
|
4586
|
-
__publicField(this, "
|
|
4587
|
-
__publicField(this, "
|
|
4688
|
+
__publicField(this, "name", "Asset Type Attachment");
|
|
4689
|
+
__publicField(this, "url", "/asset-type-attachments");
|
|
4588
4690
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4589
4691
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4590
4692
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4595,20 +4697,39 @@ class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
|
4595
4697
|
buildOfflineAttachment(data) {
|
|
4596
4698
|
return offline({
|
|
4597
4699
|
file: URL.createObjectURL(data.file),
|
|
4598
|
-
file_sha1: data.
|
|
4599
|
-
created_by: data.
|
|
4700
|
+
file_sha1: data.file_sha1,
|
|
4701
|
+
created_by: data.created_by,
|
|
4600
4702
|
file_name: data.file.name,
|
|
4601
4703
|
file_type: data.file.type,
|
|
4602
|
-
submitted_at: data.
|
|
4704
|
+
submitted_at: data.submitted_at,
|
|
4603
4705
|
description: data.description,
|
|
4604
4706
|
asset_type: data.modelId
|
|
4605
4707
|
});
|
|
4606
4708
|
}
|
|
4607
|
-
|
|
4608
|
-
return
|
|
4709
|
+
buildAttachmentPayload(data) {
|
|
4710
|
+
return {
|
|
4711
|
+
...data,
|
|
4712
|
+
asset_type: data.modelId
|
|
4713
|
+
};
|
|
4714
|
+
}
|
|
4715
|
+
async bulkAdd(payloads) {
|
|
4716
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
|
|
4717
|
+
}
|
|
4718
|
+
async delete(attachmentId) {
|
|
4719
|
+
return this._delete(attachmentId);
|
|
4609
4720
|
}
|
|
4610
|
-
async
|
|
4611
|
-
|
|
4721
|
+
async refreshStore(organizationId) {
|
|
4722
|
+
const result = await this.enqueueRequest({
|
|
4723
|
+
description: "Get asset type attachments",
|
|
4724
|
+
method: HttpMethod.GET,
|
|
4725
|
+
url: `${this.url}/`,
|
|
4726
|
+
queryParams: {
|
|
4727
|
+
organization: organizationId.toString()
|
|
4728
|
+
},
|
|
4729
|
+
blocks: [],
|
|
4730
|
+
blockers: []
|
|
4731
|
+
});
|
|
4732
|
+
this.dispatch(initializeAssetTypeAttachments(result));
|
|
4612
4733
|
}
|
|
4613
4734
|
}
|
|
4614
4735
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4624,7 +4745,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4624
4745
|
const promise = this.enqueueRequest({
|
|
4625
4746
|
description: "Add issue comment",
|
|
4626
4747
|
method: HttpMethod.POST,
|
|
4627
|
-
url:
|
|
4748
|
+
url: "/issue-comments/",
|
|
4628
4749
|
payload: offlineComment,
|
|
4629
4750
|
blockers: [payload.issue],
|
|
4630
4751
|
blocks: [offlineComment.offline_id]
|
|
@@ -4648,7 +4769,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4648
4769
|
const promise = this.enqueueRequest({
|
|
4649
4770
|
description: "Edit issue comment",
|
|
4650
4771
|
method: HttpMethod.PATCH,
|
|
4651
|
-
url: `/
|
|
4772
|
+
url: `/issue-comments/${payload.offline_id}/`,
|
|
4652
4773
|
payload,
|
|
4653
4774
|
blockers: [payload.offline_id],
|
|
4654
4775
|
blocks: [payload.offline_id]
|
|
@@ -4667,7 +4788,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4667
4788
|
const promise = this.enqueueRequest({
|
|
4668
4789
|
description: "Delete comment",
|
|
4669
4790
|
method: HttpMethod.DELETE,
|
|
4670
|
-
url: `/
|
|
4791
|
+
url: `/issue-comments/${id}/`,
|
|
4671
4792
|
blockers: [id],
|
|
4672
4793
|
blocks: []
|
|
4673
4794
|
});
|
|
@@ -4680,7 +4801,10 @@ class IssueCommentService extends BaseApiService {
|
|
|
4680
4801
|
const result = await this.enqueueRequest({
|
|
4681
4802
|
description: "Get comments",
|
|
4682
4803
|
method: HttpMethod.GET,
|
|
4683
|
-
url:
|
|
4804
|
+
url: "/issue-comments/",
|
|
4805
|
+
queryParams: {
|
|
4806
|
+
project: projectId.toString()
|
|
4807
|
+
},
|
|
4684
4808
|
blockers: [],
|
|
4685
4809
|
blocks: []
|
|
4686
4810
|
});
|
|
@@ -4692,27 +4816,21 @@ class IssueUpdateService extends BaseApiService {
|
|
|
4692
4816
|
const result = await this.enqueueRequest({
|
|
4693
4817
|
description: "Get issue updates",
|
|
4694
4818
|
method: HttpMethod.GET,
|
|
4695
|
-
url:
|
|
4819
|
+
url: "/issue-updates/",
|
|
4820
|
+
queryParams: {
|
|
4821
|
+
project: projectId.toString()
|
|
4822
|
+
},
|
|
4696
4823
|
blockers: [],
|
|
4697
4824
|
blocks: []
|
|
4698
4825
|
});
|
|
4699
|
-
|
|
4700
|
-
filteredResult = filteredResult.map((comment) => {
|
|
4701
|
-
return { ...comment };
|
|
4702
|
-
});
|
|
4703
|
-
if (result.length !== filteredResult.length) {
|
|
4704
|
-
console.error(
|
|
4705
|
-
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4706
|
-
);
|
|
4707
|
-
}
|
|
4708
|
-
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
4826
|
+
this.dispatch(initializeIssueUpdates(result));
|
|
4709
4827
|
}
|
|
4710
4828
|
}
|
|
4711
4829
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
4712
4830
|
constructor() {
|
|
4713
4831
|
super(...arguments);
|
|
4714
|
-
__publicField(this, "
|
|
4715
|
-
__publicField(this, "
|
|
4832
|
+
__publicField(this, "name", "Issue Attachment");
|
|
4833
|
+
__publicField(this, "url", "/issue-attachments");
|
|
4716
4834
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
4717
4835
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
4718
4836
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -4723,24 +4841,42 @@ class IssueAttachmentService extends BaseAttachmentService {
|
|
|
4723
4841
|
buildOfflineAttachment(data) {
|
|
4724
4842
|
return offline({
|
|
4725
4843
|
file: URL.createObjectURL(data.file),
|
|
4726
|
-
file_sha1: data.
|
|
4727
|
-
created_by: data.
|
|
4844
|
+
file_sha1: data.file_sha1,
|
|
4845
|
+
created_by: data.created_by,
|
|
4728
4846
|
file_name: data.file.name,
|
|
4729
4847
|
file_type: data.file.type,
|
|
4730
|
-
submitted_at: data.
|
|
4848
|
+
submitted_at: data.submitted_at,
|
|
4731
4849
|
description: data.description,
|
|
4732
4850
|
issue: data.modelId
|
|
4733
4851
|
});
|
|
4734
4852
|
}
|
|
4735
|
-
|
|
4736
|
-
return
|
|
4853
|
+
buildAttachmentPayload(data) {
|
|
4854
|
+
return {
|
|
4855
|
+
...data,
|
|
4856
|
+
issue: data.modelId
|
|
4857
|
+
};
|
|
4858
|
+
}
|
|
4859
|
+
async bulkAdd(payloads) {
|
|
4860
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
|
|
4861
|
+
}
|
|
4862
|
+
async delete(id) {
|
|
4863
|
+
return this._delete(id);
|
|
4737
4864
|
}
|
|
4738
|
-
async
|
|
4739
|
-
|
|
4865
|
+
async refreshStore(projectId) {
|
|
4866
|
+
const result = await this.enqueueRequest({
|
|
4867
|
+
description: "Get issue attachments",
|
|
4868
|
+
method: HttpMethod.GET,
|
|
4869
|
+
url: `${this.url}/`,
|
|
4870
|
+
queryParams: {
|
|
4871
|
+
project: projectId.toString()
|
|
4872
|
+
},
|
|
4873
|
+
blocks: [],
|
|
4874
|
+
blockers: []
|
|
4875
|
+
});
|
|
4876
|
+
this.dispatch(initializeIssueAttachments(result));
|
|
4740
4877
|
}
|
|
4741
4878
|
}
|
|
4742
4879
|
class IssueService extends BaseApiService {
|
|
4743
|
-
// Basic CRUD functions
|
|
4744
4880
|
add(payload) {
|
|
4745
4881
|
var _a2;
|
|
4746
4882
|
const { store } = this.client;
|
|
@@ -4757,10 +4893,6 @@ class IssueService extends BaseApiService {
|
|
|
4757
4893
|
description: "Create issue",
|
|
4758
4894
|
method: HttpMethod.POST,
|
|
4759
4895
|
url: "/issues/",
|
|
4760
|
-
queryParams: {
|
|
4761
|
-
workspace_id: payload.index_workspace,
|
|
4762
|
-
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4763
|
-
},
|
|
4764
4896
|
payload: offlineIssue,
|
|
4765
4897
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
4766
4898
|
blocks: [offlineIssue.offline_id]
|
|
@@ -4796,7 +4928,18 @@ class IssueService extends BaseApiService {
|
|
|
4796
4928
|
]) {
|
|
4797
4929
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4798
4930
|
switch (issueUpdateChange) {
|
|
4799
|
-
case
|
|
4931
|
+
case IssueUpdateChange.PRIORITY:
|
|
4932
|
+
case IssueUpdateChange.STATUS: {
|
|
4933
|
+
const val = payload[issueUpdateChange];
|
|
4934
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4935
|
+
break;
|
|
4936
|
+
}
|
|
4937
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4938
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4939
|
+
case IssueUpdateChange.TITLE:
|
|
4940
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4941
|
+
break;
|
|
4942
|
+
case IssueUpdateChange.CATEGORY: {
|
|
4800
4943
|
let categoryOrNull = null;
|
|
4801
4944
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4802
4945
|
if (categoryIdOrNull) {
|
|
@@ -4813,7 +4956,7 @@ class IssueService extends BaseApiService {
|
|
|
4813
4956
|
} : null;
|
|
4814
4957
|
break;
|
|
4815
4958
|
}
|
|
4816
|
-
case
|
|
4959
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4817
4960
|
let userOrNull = null;
|
|
4818
4961
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4819
4962
|
if (userIdOrNull) {
|
|
@@ -4829,20 +4972,6 @@ class IssueService extends BaseApiService {
|
|
|
4829
4972
|
} : null;
|
|
4830
4973
|
break;
|
|
4831
4974
|
}
|
|
4832
|
-
case "description":
|
|
4833
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4834
|
-
break;
|
|
4835
|
-
case "title":
|
|
4836
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4837
|
-
break;
|
|
4838
|
-
case "priority":
|
|
4839
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4840
|
-
break;
|
|
4841
|
-
case "status":
|
|
4842
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4843
|
-
break;
|
|
4844
|
-
case "due_date":
|
|
4845
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
4846
4975
|
}
|
|
4847
4976
|
}
|
|
4848
4977
|
}
|
|
@@ -4913,7 +5042,10 @@ class IssueService extends BaseApiService {
|
|
|
4913
5042
|
const result = await this.enqueueRequest({
|
|
4914
5043
|
description: "Get issues",
|
|
4915
5044
|
method: HttpMethod.GET,
|
|
4916
|
-
url:
|
|
5045
|
+
url: "/issues/",
|
|
5046
|
+
queryParams: {
|
|
5047
|
+
project: projectId.toString()
|
|
5048
|
+
},
|
|
4917
5049
|
blockers: [],
|
|
4918
5050
|
blocks: []
|
|
4919
5051
|
});
|
|
@@ -4933,16 +5065,8 @@ class IssueTypeService extends BaseApiService {
|
|
|
4933
5065
|
this.dispatch(addIssueType(offlineIssueType));
|
|
4934
5066
|
const promise = this.enqueueRequest({
|
|
4935
5067
|
method: HttpMethod.POST,
|
|
4936
|
-
url:
|
|
4937
|
-
|
|
4938
|
-
payload: {
|
|
4939
|
-
offline_id: offlineIssueType.offline_id,
|
|
4940
|
-
submitted_at: offlineIssueType.submitted_at,
|
|
4941
|
-
icon: offlineIssueType.icon,
|
|
4942
|
-
color: offlineIssueType.color,
|
|
4943
|
-
name: offlineIssueType.name,
|
|
4944
|
-
description: offlineIssueType.description
|
|
4945
|
-
},
|
|
5068
|
+
url: "/issue-types/",
|
|
5069
|
+
payload: offlineIssueType,
|
|
4946
5070
|
blockers: [],
|
|
4947
5071
|
blocks: [offlineIssueType.offline_id]
|
|
4948
5072
|
});
|
|
@@ -4967,7 +5091,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
4967
5091
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
4968
5092
|
const promise = this.enqueueRequest({
|
|
4969
5093
|
method: HttpMethod.PATCH,
|
|
4970
|
-
url: `/
|
|
5094
|
+
url: `/issue-types/${payload.offline_id}/`,
|
|
4971
5095
|
payload,
|
|
4972
5096
|
blockers: [payload.offline_id],
|
|
4973
5097
|
blocks: [payload.offline_id]
|
|
@@ -4991,7 +5115,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
4991
5115
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
4992
5116
|
const promise = this.enqueueRequest({
|
|
4993
5117
|
method: HttpMethod.DELETE,
|
|
4994
|
-
url: `/
|
|
5118
|
+
url: `/issue-types/${id}/`,
|
|
4995
5119
|
blockers: [id],
|
|
4996
5120
|
blocks: []
|
|
4997
5121
|
});
|
|
@@ -5004,7 +5128,10 @@ class IssueTypeService extends BaseApiService {
|
|
|
5004
5128
|
async refreshStore(organizationId) {
|
|
5005
5129
|
const result = await this.enqueueRequest({
|
|
5006
5130
|
method: HttpMethod.GET,
|
|
5007
|
-
url:
|
|
5131
|
+
url: "/issue-types/",
|
|
5132
|
+
queryParams: {
|
|
5133
|
+
organization: organizationId.toString()
|
|
5134
|
+
},
|
|
5008
5135
|
blockers: [],
|
|
5009
5136
|
blocks: []
|
|
5010
5137
|
});
|
|
@@ -5144,8 +5271,8 @@ class ProjectFileService extends BaseApiService {
|
|
|
5144
5271
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5145
5272
|
constructor() {
|
|
5146
5273
|
super(...arguments);
|
|
5147
|
-
__publicField(this, "
|
|
5148
|
-
__publicField(this, "
|
|
5274
|
+
__publicField(this, "name", "Project Attachment");
|
|
5275
|
+
__publicField(this, "url", "/project-attachments");
|
|
5149
5276
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5150
5277
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5151
5278
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5156,20 +5283,39 @@ class ProjectAttachmentService extends BaseAttachmentService {
|
|
|
5156
5283
|
buildOfflineAttachment(data) {
|
|
5157
5284
|
return offline({
|
|
5158
5285
|
file: URL.createObjectURL(data.file),
|
|
5159
|
-
file_sha1: data.
|
|
5160
|
-
created_by: data.
|
|
5286
|
+
file_sha1: data.file_sha1,
|
|
5287
|
+
created_by: data.created_by,
|
|
5161
5288
|
file_name: data.file.name,
|
|
5162
5289
|
file_type: data.file.type,
|
|
5163
|
-
submitted_at: data.
|
|
5290
|
+
submitted_at: data.submitted_at,
|
|
5164
5291
|
description: data.description,
|
|
5165
5292
|
project: data.modelId
|
|
5166
5293
|
});
|
|
5167
5294
|
}
|
|
5168
|
-
|
|
5169
|
-
return
|
|
5295
|
+
buildAttachmentPayload(data) {
|
|
5296
|
+
return {
|
|
5297
|
+
...data,
|
|
5298
|
+
project: data.modelId
|
|
5299
|
+
};
|
|
5300
|
+
}
|
|
5301
|
+
async bulkAdd(payloads) {
|
|
5302
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
|
|
5303
|
+
}
|
|
5304
|
+
async delete(attachmentId) {
|
|
5305
|
+
return this._delete(attachmentId);
|
|
5170
5306
|
}
|
|
5171
|
-
async
|
|
5172
|
-
|
|
5307
|
+
async refreshStore(projectId) {
|
|
5308
|
+
const result = await this.enqueueRequest({
|
|
5309
|
+
description: "Get project attachments",
|
|
5310
|
+
method: HttpMethod.GET,
|
|
5311
|
+
url: `${this.url}/`,
|
|
5312
|
+
queryParams: {
|
|
5313
|
+
project: projectId.toString()
|
|
5314
|
+
},
|
|
5315
|
+
blockers: [],
|
|
5316
|
+
blocks: []
|
|
5317
|
+
});
|
|
5318
|
+
this.dispatch(initializeProjectAttachments(result));
|
|
5173
5319
|
}
|
|
5174
5320
|
}
|
|
5175
5321
|
class ProjectService extends BaseApiService {
|
|
@@ -5312,88 +5458,31 @@ const separateImageFromFields = async (fields) => {
|
|
|
5312
5458
|
return { fields: newFields, images };
|
|
5313
5459
|
};
|
|
5314
5460
|
class FormService extends BaseUploadService {
|
|
5315
|
-
|
|
5461
|
+
add(payload, initialRevision) {
|
|
5316
5462
|
var _a2;
|
|
5463
|
+
const { store } = this.client;
|
|
5317
5464
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5318
|
-
const createdBy = (_a2 =
|
|
5319
|
-
const
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
const sha1 = await hashFile(file);
|
|
5324
|
-
if (!(sha1 in filePayloads)) {
|
|
5325
|
-
filePayloads[sha1] = {
|
|
5326
|
-
sha1,
|
|
5327
|
-
file_type: file.type,
|
|
5328
|
-
extension: file.name.split(".").pop(),
|
|
5329
|
-
size: file.size
|
|
5330
|
-
};
|
|
5331
|
-
await this.client.files.addCache(file, sha1);
|
|
5332
|
-
}
|
|
5333
|
-
const offlineFormRevisionAttachment = offline({
|
|
5334
|
-
file: URL.createObjectURL(file),
|
|
5335
|
-
file_type: file.type,
|
|
5336
|
-
file_name: file.name,
|
|
5337
|
-
file_sha1: sha1,
|
|
5338
|
-
created_by: createdBy,
|
|
5339
|
-
revision: revisionId,
|
|
5340
|
-
submitted_at: submittedAt,
|
|
5341
|
-
field_identifier: fieldIdentifier
|
|
5342
|
-
});
|
|
5343
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5344
|
-
const attachmentPayload = {
|
|
5345
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5346
|
-
name: file.name,
|
|
5347
|
-
field_identifier: fieldIdentifier,
|
|
5348
|
-
sha1
|
|
5349
|
-
};
|
|
5350
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5351
|
-
}
|
|
5352
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5353
|
-
const promise = this.enqueueRequest({
|
|
5354
|
-
description: "Attach files to form revision",
|
|
5355
|
-
method: HttpMethod.POST,
|
|
5356
|
-
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5357
|
-
payload: {
|
|
5358
|
-
submitted_at: submittedAt,
|
|
5359
|
-
attachments: attachmentPayloads,
|
|
5360
|
-
files: Object.values(filePayloads)
|
|
5361
|
-
},
|
|
5362
|
-
blockers: [revisionId],
|
|
5363
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5364
|
-
});
|
|
5365
|
-
promise.then((result) => {
|
|
5366
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5367
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5368
|
-
}).catch(() => {
|
|
5369
|
-
this.dispatch(
|
|
5370
|
-
deleteFormRevisionAttachments(
|
|
5371
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5372
|
-
)
|
|
5373
|
-
);
|
|
5465
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5466
|
+
const offlineForm = offline({
|
|
5467
|
+
...payload,
|
|
5468
|
+
submitted_at: submittedAt,
|
|
5469
|
+
created_by: createdBy
|
|
5374
5470
|
});
|
|
5375
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5376
|
-
}
|
|
5377
|
-
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5378
|
-
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5379
5471
|
const offlineFormRevision = offline({
|
|
5380
5472
|
...initialRevision,
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
revision: "Pending"
|
|
5473
|
+
form: offlineForm.offline_id,
|
|
5474
|
+
revision: "Pending",
|
|
5475
|
+
submitted_at: submittedAt,
|
|
5476
|
+
created_by: createdBy
|
|
5386
5477
|
});
|
|
5387
|
-
this.dispatch(addForm(
|
|
5478
|
+
this.dispatch(addForm(offlineForm));
|
|
5388
5479
|
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5389
5480
|
const formPromise = this.enqueueRequest({
|
|
5390
5481
|
description: "Create form",
|
|
5391
5482
|
method: HttpMethod.POST,
|
|
5392
|
-
url:
|
|
5483
|
+
url: "/forms/",
|
|
5393
5484
|
payload: {
|
|
5394
|
-
|
|
5395
|
-
offline_id: form.offline_id,
|
|
5396
|
-
submitted_at: form.submitted_at,
|
|
5485
|
+
...offlineForm,
|
|
5397
5486
|
initial_revision: {
|
|
5398
5487
|
offline_id: offlineFormRevision.offline_id,
|
|
5399
5488
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5402,111 +5491,15 @@ class FormService extends BaseUploadService {
|
|
|
5402
5491
|
fields: offlineFormRevision.fields
|
|
5403
5492
|
}
|
|
5404
5493
|
},
|
|
5405
|
-
blockers: [
|
|
5406
|
-
blocks: [
|
|
5494
|
+
blockers: [],
|
|
5495
|
+
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5407
5496
|
});
|
|
5408
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5409
|
-
offlineFormRevision.offline_id,
|
|
5410
|
-
images
|
|
5411
|
-
);
|
|
5412
5497
|
void formPromise.catch((e) => {
|
|
5413
|
-
this.dispatch(deleteForm(
|
|
5498
|
+
this.dispatch(deleteForm(offlineForm.offline_id));
|
|
5414
5499
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5415
5500
|
throw e;
|
|
5416
5501
|
});
|
|
5417
|
-
return [
|
|
5418
|
-
}
|
|
5419
|
-
addForOrganization(organizationId, initialRevision) {
|
|
5420
|
-
var _a2;
|
|
5421
|
-
const state = this.client.store.getState();
|
|
5422
|
-
const offlineForm = offline({
|
|
5423
|
-
favorite: false,
|
|
5424
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5425
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5426
|
-
organization: organizationId
|
|
5427
|
-
});
|
|
5428
|
-
return this.add(
|
|
5429
|
-
organizationId.toString(),
|
|
5430
|
-
offlineForm,
|
|
5431
|
-
initialRevision,
|
|
5432
|
-
`/organizations/${organizationId}/create-form/`
|
|
5433
|
-
);
|
|
5434
|
-
}
|
|
5435
|
-
addForProject(projectId, initialRevision) {
|
|
5436
|
-
var _a2;
|
|
5437
|
-
const state = this.client.store.getState();
|
|
5438
|
-
const offlineForm = offline({
|
|
5439
|
-
favorite: false,
|
|
5440
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5441
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5442
|
-
project: projectId
|
|
5443
|
-
});
|
|
5444
|
-
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5445
|
-
}
|
|
5446
|
-
addForIssueType(issueTypeId, initialRevision) {
|
|
5447
|
-
var _a2;
|
|
5448
|
-
const state = this.client.store.getState();
|
|
5449
|
-
const offlineForm = offline({
|
|
5450
|
-
favorite: false,
|
|
5451
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5452
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5453
|
-
issue_type: issueTypeId
|
|
5454
|
-
});
|
|
5455
|
-
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5456
|
-
}
|
|
5457
|
-
addForAssetType(assetTypeId, initialRevision) {
|
|
5458
|
-
var _a2;
|
|
5459
|
-
const state = this.client.store.getState();
|
|
5460
|
-
const offlineForm = offline({
|
|
5461
|
-
favorite: false,
|
|
5462
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5463
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5464
|
-
asset_type: assetTypeId
|
|
5465
|
-
});
|
|
5466
|
-
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5467
|
-
}
|
|
5468
|
-
async createRevision(formId, revision) {
|
|
5469
|
-
var _a2;
|
|
5470
|
-
const offlineRevision = offline(revision);
|
|
5471
|
-
const { store } = this.client;
|
|
5472
|
-
const state = store.getState();
|
|
5473
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5474
|
-
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5475
|
-
const fullRevision = {
|
|
5476
|
-
...offlineRevision,
|
|
5477
|
-
fields,
|
|
5478
|
-
created_by: createdBy,
|
|
5479
|
-
revision: "Pending",
|
|
5480
|
-
form: formId,
|
|
5481
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5482
|
-
};
|
|
5483
|
-
this.dispatch(addFormRevision(fullRevision));
|
|
5484
|
-
const promise = this.enqueueRequest({
|
|
5485
|
-
description: "Create form revision",
|
|
5486
|
-
method: HttpMethod.PATCH,
|
|
5487
|
-
url: `/forms/${formId}/`,
|
|
5488
|
-
payload: {
|
|
5489
|
-
initial_revision: {
|
|
5490
|
-
offline_id: fullRevision.offline_id,
|
|
5491
|
-
submitted_at: fullRevision.submitted_at,
|
|
5492
|
-
title: fullRevision.title,
|
|
5493
|
-
description: fullRevision.description,
|
|
5494
|
-
fields: fullRevision.fields
|
|
5495
|
-
}
|
|
5496
|
-
},
|
|
5497
|
-
blockers: [formId],
|
|
5498
|
-
blocks: [offlineRevision.offline_id]
|
|
5499
|
-
});
|
|
5500
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5501
|
-
fullRevision.offline_id,
|
|
5502
|
-
images
|
|
5503
|
-
);
|
|
5504
|
-
void promise.then((result) => {
|
|
5505
|
-
this.dispatch(setFormRevision(result));
|
|
5506
|
-
}).catch(() => {
|
|
5507
|
-
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5508
|
-
});
|
|
5509
|
-
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5502
|
+
return [offlineForm, offlineFormRevision, formPromise];
|
|
5510
5503
|
}
|
|
5511
5504
|
async delete(id) {
|
|
5512
5505
|
const { store } = this.client;
|
|
@@ -5543,65 +5536,18 @@ class FormService extends BaseUploadService {
|
|
|
5543
5536
|
throw e;
|
|
5544
5537
|
}
|
|
5545
5538
|
}
|
|
5546
|
-
async refreshStore(
|
|
5547
|
-
const forms =
|
|
5548
|
-
const revisions = [];
|
|
5549
|
-
const attachments = [];
|
|
5550
|
-
const projectFormsResult = await this.enqueueRequest({
|
|
5551
|
-
description: "Fetch project forms",
|
|
5552
|
-
method: HttpMethod.GET,
|
|
5553
|
-
url: `/projects/${projectId}/forms/`,
|
|
5554
|
-
blockers: [projectId.toString()],
|
|
5555
|
-
blocks: []
|
|
5556
|
-
});
|
|
5557
|
-
for (const form of projectFormsResult.forms)
|
|
5558
|
-
forms.push(form);
|
|
5559
|
-
for (const revision of projectFormsResult.revisions)
|
|
5560
|
-
revisions.push(revision);
|
|
5561
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5562
|
-
attachments.push(attachment);
|
|
5563
|
-
const organizationFormsResult = await this.enqueueRequest({
|
|
5539
|
+
async refreshStore(organizationId) {
|
|
5540
|
+
const forms = await this.enqueueRequest({
|
|
5564
5541
|
description: "Fetch organization forms",
|
|
5565
5542
|
method: HttpMethod.GET,
|
|
5566
|
-
url:
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
forms.push(form);
|
|
5572
|
-
for (const revision of organizationFormsResult.revisions)
|
|
5573
|
-
revisions.push(revision);
|
|
5574
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5575
|
-
attachments.push(attachment);
|
|
5576
|
-
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5577
|
-
description: "Fetch asset type forms",
|
|
5578
|
-
method: HttpMethod.GET,
|
|
5579
|
-
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5580
|
-
blockers: [projectId.toString()],
|
|
5581
|
-
blocks: []
|
|
5582
|
-
});
|
|
5583
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5584
|
-
forms.push(form);
|
|
5585
|
-
for (const revision of assetTypeFormsResult.revisions)
|
|
5586
|
-
revisions.push(revision);
|
|
5587
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5588
|
-
attachments.push(attachment);
|
|
5589
|
-
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5590
|
-
description: "Fetch issue type forms",
|
|
5591
|
-
method: HttpMethod.GET,
|
|
5592
|
-
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5593
|
-
blockers: [projectId.toString()],
|
|
5543
|
+
url: "/forms/",
|
|
5544
|
+
queryParams: {
|
|
5545
|
+
organization: organizationId.toString()
|
|
5546
|
+
},
|
|
5547
|
+
blockers: [organizationId.toString()],
|
|
5594
5548
|
blocks: []
|
|
5595
5549
|
});
|
|
5596
|
-
for (const form of issueTypeFormsResult.forms)
|
|
5597
|
-
forms.push(form);
|
|
5598
|
-
for (const revision of issueTypeFormsResult.revisions)
|
|
5599
|
-
revisions.push(revision);
|
|
5600
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5601
|
-
attachments.push(attachment);
|
|
5602
5550
|
this.dispatch(initializeForms(forms));
|
|
5603
|
-
this.dispatch(initializeFormRevisions(revisions));
|
|
5604
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5605
5551
|
}
|
|
5606
5552
|
}
|
|
5607
5553
|
const isArrayOfFiles = (value) => {
|
|
@@ -5623,277 +5569,63 @@ const separateFilesFromValues = (values) => {
|
|
|
5623
5569
|
return { values: newValues, files };
|
|
5624
5570
|
};
|
|
5625
5571
|
class FormSubmissionService extends BaseUploadService {
|
|
5626
|
-
|
|
5627
|
-
var _a2;
|
|
5628
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5629
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5630
|
-
const filePayloads = {};
|
|
5631
|
-
const offlineFormSubmissionAttachments = [];
|
|
5632
|
-
const attachmentPayloads = [];
|
|
5633
|
-
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5634
|
-
for (const file of filesArray) {
|
|
5635
|
-
const sha1 = await hashFile(file);
|
|
5636
|
-
if (!(sha1 in filePayloads)) {
|
|
5637
|
-
filePayloads[sha1] = {
|
|
5638
|
-
sha1,
|
|
5639
|
-
file_type: file.type,
|
|
5640
|
-
extension: file.name.split(".").pop(),
|
|
5641
|
-
size: file.size
|
|
5642
|
-
};
|
|
5643
|
-
await this.client.files.addCache(file, sha1);
|
|
5644
|
-
}
|
|
5645
|
-
const offlineFormSubmissionAttachment = offline({
|
|
5646
|
-
file: URL.createObjectURL(file),
|
|
5647
|
-
file_type: file.type,
|
|
5648
|
-
file_name: file.name,
|
|
5649
|
-
file_sha1: sha1,
|
|
5650
|
-
created_by: createdBy,
|
|
5651
|
-
submission: submissionId,
|
|
5652
|
-
submitted_at: submittedAt,
|
|
5653
|
-
field_identifier: fieldIdentifier
|
|
5654
|
-
});
|
|
5655
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5656
|
-
const attachmentPayload = {
|
|
5657
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5658
|
-
name: file.name,
|
|
5659
|
-
sha1,
|
|
5660
|
-
field_identifier: fieldIdentifier
|
|
5661
|
-
};
|
|
5662
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5663
|
-
}
|
|
5664
|
-
}
|
|
5665
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5666
|
-
const promise = this.enqueueRequest({
|
|
5667
|
-
description: "Attach files to form submission",
|
|
5668
|
-
method: HttpMethod.POST,
|
|
5669
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5670
|
-
payload: {
|
|
5671
|
-
submitted_at: submittedAt,
|
|
5672
|
-
attachments: attachmentPayloads,
|
|
5673
|
-
files: Object.values(filePayloads)
|
|
5674
|
-
},
|
|
5675
|
-
blockers: [submissionId],
|
|
5676
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5677
|
-
});
|
|
5678
|
-
promise.then((result) => {
|
|
5679
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5680
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5681
|
-
}).catch(() => {
|
|
5682
|
-
this.dispatch(
|
|
5683
|
-
deleteFormSubmissionAttachments(
|
|
5684
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5685
|
-
)
|
|
5686
|
-
);
|
|
5687
|
-
});
|
|
5688
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5689
|
-
}
|
|
5690
|
-
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5691
|
-
const { store } = this.client;
|
|
5692
|
-
const state = store.getState();
|
|
5693
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5694
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5695
|
-
try {
|
|
5696
|
-
await this.enqueueRequest({
|
|
5697
|
-
description: "Delete form submission attachments",
|
|
5698
|
-
method: HttpMethod.DELETE,
|
|
5699
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5700
|
-
payload: { attachments: attachmentsIds },
|
|
5701
|
-
blockers: [submissionId, ...attachmentsIds],
|
|
5702
|
-
blocks: []
|
|
5703
|
-
});
|
|
5704
|
-
} catch (e) {
|
|
5705
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5706
|
-
throw e;
|
|
5707
|
-
}
|
|
5708
|
-
}
|
|
5709
|
-
// Outer promise is for hashing and caching files for submission attachments
|
|
5710
|
-
async add(payload) {
|
|
5572
|
+
add(payload) {
|
|
5711
5573
|
var _a2;
|
|
5712
5574
|
const { store } = this.client;
|
|
5713
5575
|
const state = store.getState();
|
|
5714
|
-
const { values, files } = separateFilesFromValues(payload.values);
|
|
5715
5576
|
const offlineSubmission = offline({
|
|
5716
5577
|
...payload,
|
|
5717
|
-
values,
|
|
5718
5578
|
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5719
5579
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5720
5580
|
});
|
|
5721
5581
|
const promise = this.enqueueRequest({
|
|
5722
|
-
description: "
|
|
5582
|
+
description: "Add form submission",
|
|
5723
5583
|
method: HttpMethod.POST,
|
|
5724
|
-
url:
|
|
5584
|
+
url: "/form-submissions/",
|
|
5725
5585
|
payload: offlineSubmission,
|
|
5726
|
-
blockers: [
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5586
|
+
blockers: [
|
|
5587
|
+
"add-form-entry",
|
|
5588
|
+
payload.form_revision,
|
|
5589
|
+
...payload.issue ? [payload.issue] : [],
|
|
5590
|
+
...payload.asset ? [payload.asset] : []
|
|
5591
|
+
],
|
|
5592
|
+
blocks: [offlineSubmission.offline_id]
|
|
5730
5593
|
});
|
|
5731
5594
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5732
|
-
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5733
|
-
offlineSubmission.offline_id,
|
|
5734
|
-
files
|
|
5735
|
-
);
|
|
5736
5595
|
promise.then((result) => {
|
|
5737
5596
|
this.dispatch(setFormSubmission(result));
|
|
5738
5597
|
return result;
|
|
5739
5598
|
}).catch(() => {
|
|
5740
5599
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5741
5600
|
});
|
|
5742
|
-
return [offlineSubmission,
|
|
5743
|
-
}
|
|
5744
|
-
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5745
|
-
// TODO: adapt the support bulk adding to any model type
|
|
5746
|
-
async bulkAdd(args, batchSize) {
|
|
5747
|
-
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5748
|
-
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5749
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5750
|
-
const transactionId = v4();
|
|
5751
|
-
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5752
|
-
const bulkAddBatches = await Promise.all(
|
|
5753
|
-
assetIdBatches.map(async (assetIdBatch) => {
|
|
5754
|
-
const batchId = v4();
|
|
5755
|
-
const submissionPayloads = [];
|
|
5756
|
-
const attachmentPayloads = [];
|
|
5757
|
-
const files = { ...commonFiles };
|
|
5758
|
-
for (const assetId of assetIdBatch) {
|
|
5759
|
-
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5760
|
-
Object.assign(files, submissionSpecificFiles);
|
|
5761
|
-
const submissionPayload = offline({
|
|
5762
|
-
asset_id: assetId,
|
|
5763
|
-
form_data: fileSeperatedSubmissionSpecificValues
|
|
5764
|
-
});
|
|
5765
|
-
submissionPayloads.push(submissionPayload);
|
|
5766
|
-
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5767
|
-
for (const file of fileArray) {
|
|
5768
|
-
const sha1 = await hashFile(file);
|
|
5769
|
-
await this.client.files.addCache(file, sha1);
|
|
5770
|
-
const attachmentPayload = offline({
|
|
5771
|
-
submission_id: submissionPayload.offline_id,
|
|
5772
|
-
sha1,
|
|
5773
|
-
name: file.name,
|
|
5774
|
-
field_identifier: fieldIdentifier
|
|
5775
|
-
});
|
|
5776
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5777
|
-
}
|
|
5778
|
-
}
|
|
5779
|
-
}
|
|
5780
|
-
const filePaylods = [];
|
|
5781
|
-
for (const file of Object.values(files).flat()) {
|
|
5782
|
-
const sha1 = await hashFile(file);
|
|
5783
|
-
const filePayload = {
|
|
5784
|
-
sha1,
|
|
5785
|
-
extension: file.name.split(".").pop() || "",
|
|
5786
|
-
file_type: file.type,
|
|
5787
|
-
size: file.size
|
|
5788
|
-
};
|
|
5789
|
-
filePaylods.push(filePayload);
|
|
5790
|
-
}
|
|
5791
|
-
return {
|
|
5792
|
-
batchId,
|
|
5793
|
-
payload: {
|
|
5794
|
-
transaction_id: transactionId,
|
|
5795
|
-
form_data: fileSeperatedCommonFieldValues,
|
|
5796
|
-
submitted_at: submittedAt,
|
|
5797
|
-
submissions: submissionPayloads,
|
|
5798
|
-
attachments: attachmentPayloads,
|
|
5799
|
-
files: filePaylods
|
|
5800
|
-
}
|
|
5801
|
-
};
|
|
5802
|
-
})
|
|
5803
|
-
);
|
|
5804
|
-
const batchPromises = [];
|
|
5805
|
-
let prevBatchId = null;
|
|
5806
|
-
for (const batch of bulkAddBatches) {
|
|
5807
|
-
const { payload, batchId } = batch;
|
|
5808
|
-
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5809
|
-
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5810
|
-
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5811
|
-
const blockers = batchAssetIds;
|
|
5812
|
-
if (prevBatchId)
|
|
5813
|
-
blockers.push(prevBatchId);
|
|
5814
|
-
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5815
|
-
const promise = this.enqueueRequest({
|
|
5816
|
-
description: "Bulk add form submissions",
|
|
5817
|
-
method: HttpMethod.POST,
|
|
5818
|
-
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5819
|
-
payload,
|
|
5820
|
-
blockers,
|
|
5821
|
-
blocks
|
|
5822
|
-
});
|
|
5823
|
-
void promise.then(({ presigned_urls }) => {
|
|
5824
|
-
this.processPresignedUrls(presigned_urls);
|
|
5825
|
-
});
|
|
5826
|
-
prevBatchId = batchId;
|
|
5827
|
-
batchPromises.push(promise);
|
|
5828
|
-
}
|
|
5829
|
-
void Promise.all(batchPromises).then((results) => {
|
|
5830
|
-
const createdSubmissions = [];
|
|
5831
|
-
const createdAttachments = [];
|
|
5832
|
-
for (const result of results) {
|
|
5833
|
-
for (const createdSubmission of result.submissions)
|
|
5834
|
-
createdSubmissions.push(createdSubmission);
|
|
5835
|
-
for (const createdAttachment of result.attachments)
|
|
5836
|
-
createdAttachments.push(createdAttachment);
|
|
5837
|
-
}
|
|
5838
|
-
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5839
|
-
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5840
|
-
});
|
|
5841
|
-
return batchPromises;
|
|
5601
|
+
return [offlineSubmission, promise];
|
|
5842
5602
|
}
|
|
5843
|
-
|
|
5603
|
+
update(payload) {
|
|
5844
5604
|
const { store } = this.client;
|
|
5845
5605
|
const state = store.getState();
|
|
5846
5606
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5847
5607
|
if (!submissionToBeUpdated) {
|
|
5848
5608
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5849
5609
|
}
|
|
5850
|
-
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5851
5610
|
const updatedSubmission = {
|
|
5852
5611
|
...submissionToBeUpdated,
|
|
5853
|
-
...payload
|
|
5854
|
-
// values could also have a partial update
|
|
5855
|
-
values: {
|
|
5856
|
-
...submissionToBeUpdated.values,
|
|
5857
|
-
...values
|
|
5858
|
-
}
|
|
5612
|
+
...payload
|
|
5859
5613
|
};
|
|
5860
5614
|
this.dispatch(updateFormSubmission(updatedSubmission));
|
|
5861
5615
|
const promise = this.enqueueRequest({
|
|
5862
5616
|
description: "Delete user form submissions",
|
|
5863
5617
|
method: HttpMethod.PATCH,
|
|
5864
|
-
url: `/
|
|
5865
|
-
|
|
5866
|
-
payload: updatedSubmission,
|
|
5618
|
+
url: `/form-submissions/${updatedSubmission.offline_id}/`,
|
|
5619
|
+
payload,
|
|
5867
5620
|
blockers: [updatedSubmission.offline_id],
|
|
5868
5621
|
blocks: [updatedSubmission.offline_id]
|
|
5869
5622
|
});
|
|
5870
|
-
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5871
|
-
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5872
|
-
for (const attachment of formSubmissionAttachments) {
|
|
5873
|
-
if (attachment.field_identifier in files) {
|
|
5874
|
-
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5875
|
-
}
|
|
5876
|
-
}
|
|
5877
|
-
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5878
|
-
payload.offline_id,
|
|
5879
|
-
files
|
|
5880
|
-
);
|
|
5881
|
-
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5882
|
-
payload.offline_id,
|
|
5883
|
-
formSubmissionAttachmentIdsToBeDeleted
|
|
5884
|
-
);
|
|
5885
5623
|
promise.then((result) => {
|
|
5886
5624
|
this.dispatch(setFormSubmission(result));
|
|
5887
5625
|
}).catch(() => {
|
|
5888
5626
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5889
5627
|
});
|
|
5890
|
-
return [
|
|
5891
|
-
updatedSubmission,
|
|
5892
|
-
offlineFormSubmissionAttachments,
|
|
5893
|
-
promise,
|
|
5894
|
-
attachmentsPromise,
|
|
5895
|
-
deleteAttachmentsPromise
|
|
5896
|
-
];
|
|
5628
|
+
return [updatedSubmission, promise];
|
|
5897
5629
|
}
|
|
5898
5630
|
async delete(id) {
|
|
5899
5631
|
const { store } = this.client;
|
|
@@ -5909,7 +5641,7 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5909
5641
|
return await this.enqueueRequest({
|
|
5910
5642
|
description: "Delete user form submissions",
|
|
5911
5643
|
method: HttpMethod.DELETE,
|
|
5912
|
-
url: `/
|
|
5644
|
+
url: `/form-submissions/${id}/`,
|
|
5913
5645
|
blockers: [id],
|
|
5914
5646
|
blocks: []
|
|
5915
5647
|
});
|
|
@@ -5920,50 +5652,17 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5920
5652
|
}
|
|
5921
5653
|
}
|
|
5922
5654
|
async refreshStore(projectId) {
|
|
5923
|
-
const
|
|
5924
|
-
|
|
5925
|
-
description: "Fetch model submissions",
|
|
5926
|
-
method: HttpMethod.GET,
|
|
5927
|
-
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
5928
|
-
blockers: [],
|
|
5929
|
-
blocks: []
|
|
5930
|
-
});
|
|
5931
|
-
for (const modelSubmission of modelSubmissions) {
|
|
5932
|
-
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
5933
|
-
}
|
|
5934
|
-
const standaloneSubmissions = await this.enqueueRequest({
|
|
5935
|
-
description: "Fetch standalone submissions",
|
|
5936
|
-
method: HttpMethod.GET,
|
|
5937
|
-
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
5938
|
-
blockers: [],
|
|
5939
|
-
blocks: []
|
|
5940
|
-
});
|
|
5941
|
-
for (const standaloneSubmission of standaloneSubmissions) {
|
|
5942
|
-
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
5943
|
-
}
|
|
5944
|
-
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
5945
|
-
const attachments = {};
|
|
5946
|
-
const modelAttachments = await this.enqueueRequest({
|
|
5947
|
-
description: "Fetch model submission attachments",
|
|
5948
|
-
method: HttpMethod.GET,
|
|
5949
|
-
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
5950
|
-
blockers: [],
|
|
5951
|
-
blocks: []
|
|
5952
|
-
});
|
|
5953
|
-
for (const modelAttachment of modelAttachments) {
|
|
5954
|
-
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
5955
|
-
}
|
|
5956
|
-
const standaloneAttachments = await this.enqueueRequest({
|
|
5957
|
-
description: "Fetch standalone submission attachments",
|
|
5655
|
+
const result = await this.enqueueRequest({
|
|
5656
|
+
description: "Fetch form submissions",
|
|
5958
5657
|
method: HttpMethod.GET,
|
|
5959
|
-
url:
|
|
5658
|
+
url: "/form-submissions/",
|
|
5659
|
+
queryParams: {
|
|
5660
|
+
project: projectId.toString()
|
|
5661
|
+
},
|
|
5960
5662
|
blockers: [],
|
|
5961
5663
|
blocks: []
|
|
5962
5664
|
});
|
|
5963
|
-
|
|
5964
|
-
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
5965
|
-
}
|
|
5966
|
-
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5665
|
+
this.dispatch(initializeFormSubmissions(result));
|
|
5967
5666
|
}
|
|
5968
5667
|
}
|
|
5969
5668
|
class WorkspaceService extends BaseApiService {
|
|
@@ -6029,9 +5728,9 @@ class WorkspaceService extends BaseApiService {
|
|
|
6029
5728
|
blockers: [id],
|
|
6030
5729
|
blocks: []
|
|
6031
5730
|
});
|
|
6032
|
-
void promise.catch((
|
|
5731
|
+
void promise.catch((e) => {
|
|
6033
5732
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
6034
|
-
throw
|
|
5733
|
+
throw e;
|
|
6035
5734
|
});
|
|
6036
5735
|
return promise;
|
|
6037
5736
|
}
|
|
@@ -6092,7 +5791,7 @@ const summarizeEvery = 20;
|
|
|
6092
5791
|
class FileService extends BaseApiService {
|
|
6093
5792
|
constructor() {
|
|
6094
5793
|
super(...arguments);
|
|
6095
|
-
__publicField(this, "host"
|
|
5794
|
+
__publicField(this, "host");
|
|
6096
5795
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6097
5796
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6098
5797
|
__publicField(this, "_dbPromise", openDB("fileCache", 1, {
|
|
@@ -6103,8 +5802,7 @@ class FileService extends BaseApiService {
|
|
|
6103
5802
|
}
|
|
6104
5803
|
async renewUploadUrl(sha1) {
|
|
6105
5804
|
const file = await this.fetchCache(sha1);
|
|
6106
|
-
if (!file)
|
|
6107
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5805
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6108
5806
|
const key = await getFileS3Key(file, sha1);
|
|
6109
5807
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6110
5808
|
description: "Get S3 URL",
|
|
@@ -6174,8 +5872,7 @@ class FileService extends BaseApiService {
|
|
|
6174
5872
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6175
5873
|
async uploadFileToS3(sha1) {
|
|
6176
5874
|
const file = await this.fetchCache(sha1);
|
|
6177
|
-
if (!file)
|
|
6178
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5875
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6179
5876
|
const key = await getFileS3Key(file, sha1);
|
|
6180
5877
|
const dbFileProperties = {
|
|
6181
5878
|
file_name: file.name,
|
|
@@ -6269,7 +5966,7 @@ class FileService extends BaseApiService {
|
|
|
6269
5966
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6270
5967
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6271
5968
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6272
|
-
|
|
5969
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6273
5970
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6274
5971
|
throw new Error(message);
|
|
6275
5972
|
}
|
|
@@ -6665,8 +6362,8 @@ class DocumentService extends BaseApiService {
|
|
|
6665
6362
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6666
6363
|
constructor() {
|
|
6667
6364
|
super(...arguments);
|
|
6668
|
-
__publicField(this, "
|
|
6669
|
-
__publicField(this, "
|
|
6365
|
+
__publicField(this, "name", "Document Attachment");
|
|
6366
|
+
__publicField(this, "url", "/document-attachments");
|
|
6670
6367
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6671
6368
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6672
6369
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6677,17 +6374,23 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6677
6374
|
buildOfflineAttachment(data) {
|
|
6678
6375
|
return offline({
|
|
6679
6376
|
file: URL.createObjectURL(data.file),
|
|
6680
|
-
file_sha1: data.
|
|
6681
|
-
created_by: data.
|
|
6377
|
+
file_sha1: data.file_sha1,
|
|
6378
|
+
created_by: data.created_by,
|
|
6682
6379
|
file_name: data.file.name,
|
|
6683
6380
|
file_type: data.file.type,
|
|
6684
|
-
submitted_at: data.
|
|
6381
|
+
submitted_at: data.submitted_at,
|
|
6685
6382
|
description: data.description,
|
|
6686
6383
|
document: data.modelId
|
|
6687
6384
|
});
|
|
6688
6385
|
}
|
|
6386
|
+
buildAttachmentPayload(data) {
|
|
6387
|
+
return {
|
|
6388
|
+
...data,
|
|
6389
|
+
document: data.modelId
|
|
6390
|
+
};
|
|
6391
|
+
}
|
|
6689
6392
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6690
|
-
async
|
|
6393
|
+
async bulkAdd(payloads) {
|
|
6691
6394
|
var _a2;
|
|
6692
6395
|
const { store } = this.client;
|
|
6693
6396
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6696,40 +6399,37 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6696
6399
|
const attachmentPayloads = [];
|
|
6697
6400
|
const filePayloads = {};
|
|
6698
6401
|
const sha1ToAttachmentIds = {};
|
|
6699
|
-
for (const
|
|
6700
|
-
const
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
extension: file.name.split(".").pop(),
|
|
6706
|
-
size: file.size
|
|
6707
|
-
};
|
|
6708
|
-
sha1ToAttachmentIds[sha1] = [];
|
|
6709
|
-
await this.client.files.addCache(file, sha1);
|
|
6402
|
+
for (const payload of payloads) {
|
|
6403
|
+
const { documentId, file } = payload;
|
|
6404
|
+
const filePayload = await this.getFilePayload(file);
|
|
6405
|
+
if (!(filePayload.sha1 in filePayloads)) {
|
|
6406
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
6407
|
+
sha1ToAttachmentIds[filePayload.sha1] = [];
|
|
6710
6408
|
}
|
|
6711
6409
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6712
6410
|
file,
|
|
6713
|
-
sha1,
|
|
6714
|
-
submittedAt,
|
|
6715
|
-
createdBy,
|
|
6411
|
+
file_sha1: filePayload.sha1,
|
|
6412
|
+
submitted_at: submittedAt,
|
|
6413
|
+
created_by: createdBy,
|
|
6716
6414
|
description: "",
|
|
6717
6415
|
modelId: documentId
|
|
6718
6416
|
});
|
|
6719
6417
|
offlineAttachments.push(offlineAttachment);
|
|
6720
6418
|
attachmentPayloads.push({
|
|
6721
6419
|
offline_id: offlineAttachment.offline_id,
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6420
|
+
file_name: offlineAttachment.file_name,
|
|
6421
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
6422
|
+
file_extension: filePayload.extension,
|
|
6423
|
+
description: offlineAttachment.description,
|
|
6424
|
+
document: documentId
|
|
6725
6425
|
});
|
|
6726
|
-
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6426
|
+
sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
|
|
6727
6427
|
}
|
|
6728
6428
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6729
6429
|
const promise = this.enqueueRequest({
|
|
6730
6430
|
description: "Attach files to document",
|
|
6731
6431
|
method: HttpMethod.POST,
|
|
6732
|
-
url:
|
|
6432
|
+
url: "/document-attachments/bulk/",
|
|
6733
6433
|
payload: {
|
|
6734
6434
|
submitted_at: submittedAt,
|
|
6735
6435
|
attachments: attachmentPayloads,
|
|
@@ -6754,14 +6454,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6754
6454
|
});
|
|
6755
6455
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6756
6456
|
}
|
|
6757
|
-
async
|
|
6758
|
-
return this.
|
|
6457
|
+
async delete(id) {
|
|
6458
|
+
return this._delete(id);
|
|
6759
6459
|
}
|
|
6760
6460
|
makeReadable(attachmnentId) {
|
|
6761
6461
|
void this.enqueueRequest({
|
|
6762
6462
|
description: "Add attachment to AI assistant",
|
|
6763
6463
|
method: HttpMethod.PATCH,
|
|
6764
|
-
url: `/
|
|
6464
|
+
url: `/document-attachments/${attachmnentId}/`,
|
|
6765
6465
|
payload: {
|
|
6766
6466
|
readable_to_assistant: true
|
|
6767
6467
|
},
|
|
@@ -6778,7 +6478,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6778
6478
|
blocks: [],
|
|
6779
6479
|
blockers: []
|
|
6780
6480
|
});
|
|
6781
|
-
this.dispatch(
|
|
6481
|
+
this.dispatch(initializeDocumentAttachments(projectDocumentAttachments));
|
|
6782
6482
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6783
6483
|
description: "Get document attachments",
|
|
6784
6484
|
method: HttpMethod.GET,
|
|
@@ -7014,17 +6714,11 @@ class GeoImageService extends BaseUploadService {
|
|
|
7014
6714
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7015
6715
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7016
6716
|
const projectId = payloadWithoutFile.project;
|
|
7017
|
-
const
|
|
7018
|
-
const filePayload = {
|
|
7019
|
-
sha1,
|
|
7020
|
-
file_type: file.type,
|
|
7021
|
-
extension: file.name.split(".").pop(),
|
|
7022
|
-
size: file.size
|
|
7023
|
-
};
|
|
6717
|
+
const filePayload = await this.getFilePayload(file);
|
|
7024
6718
|
const offlineMapImage = offline({
|
|
7025
6719
|
...payloadWithoutFile,
|
|
7026
6720
|
file_name: file.name,
|
|
7027
|
-
file_sha1: sha1,
|
|
6721
|
+
file_sha1: filePayload.sha1,
|
|
7028
6722
|
file: URL.createObjectURL(file),
|
|
7029
6723
|
submitted_at: submittedAt,
|
|
7030
6724
|
created_by: createdBy
|
|
@@ -7067,23 +6761,15 @@ class GeoImageService extends BaseUploadService {
|
|
|
7067
6761
|
const offlineGeoImages = [];
|
|
7068
6762
|
const offlineIds = [];
|
|
7069
6763
|
const geoImagePayloads = [];
|
|
7070
|
-
const
|
|
6764
|
+
const filePayloads = {};
|
|
7071
6765
|
for (const payloadAndFile of payloads) {
|
|
7072
6766
|
const { file, ...payload } = payloadAndFile;
|
|
7073
|
-
const
|
|
7074
|
-
if (!(sha1 in
|
|
7075
|
-
filePayloadRecord[sha1] = {
|
|
7076
|
-
sha1,
|
|
7077
|
-
file_type: file.type,
|
|
7078
|
-
extension: file.name.split(".").pop(),
|
|
7079
|
-
size: file.size
|
|
7080
|
-
};
|
|
7081
|
-
await this.client.files.addCache(file, sha1);
|
|
7082
|
-
}
|
|
6767
|
+
const filePayload = await this.getFilePayload(file);
|
|
6768
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7083
6769
|
const offlineMapImage = offline({
|
|
7084
6770
|
...payload,
|
|
7085
6771
|
file_name: file.name,
|
|
7086
|
-
file_sha1: sha1,
|
|
6772
|
+
file_sha1: filePayload.sha1,
|
|
7087
6773
|
file: URL.createObjectURL(file),
|
|
7088
6774
|
submitted_at: submittedAt,
|
|
7089
6775
|
created_by: createdBy,
|
|
@@ -7112,7 +6798,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7112
6798
|
submitted_at: submittedAt,
|
|
7113
6799
|
project: projectId,
|
|
7114
6800
|
geo_images: geoImagePayloads,
|
|
7115
|
-
files: Object.values(
|
|
6801
|
+
files: Object.values(filePayloads)
|
|
7116
6802
|
},
|
|
7117
6803
|
blocks: [projectId.toString()],
|
|
7118
6804
|
blockers: offlineIds
|
|
@@ -7180,7 +6866,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7180
6866
|
this.dispatch(initializeGeoImages(result));
|
|
7181
6867
|
}
|
|
7182
6868
|
}
|
|
7183
|
-
class IssueAssociationService extends
|
|
6869
|
+
class IssueAssociationService extends BaseApiService {
|
|
7184
6870
|
add(payload) {
|
|
7185
6871
|
var _a2;
|
|
7186
6872
|
const { store } = this.client;
|
|
@@ -7195,7 +6881,7 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7195
6881
|
const promise = this.enqueueRequest({
|
|
7196
6882
|
description: "Add issue association",
|
|
7197
6883
|
method: HttpMethod.POST,
|
|
7198
|
-
url: "/
|
|
6884
|
+
url: "/issue-associations/",
|
|
7199
6885
|
payload: {
|
|
7200
6886
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7201
6887
|
submitted_at: submittedAt,
|
|
@@ -7225,7 +6911,7 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7225
6911
|
const promise = this.enqueueRequest({
|
|
7226
6912
|
description: "Delete issue association",
|
|
7227
6913
|
method: HttpMethod.DELETE,
|
|
7228
|
-
url: `/
|
|
6914
|
+
url: `/issue-associations/${id}/`,
|
|
7229
6915
|
blockers: [id],
|
|
7230
6916
|
blocks: []
|
|
7231
6917
|
});
|
|
@@ -7238,14 +6924,889 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7238
6924
|
const issueAssociations = await this.enqueueRequest({
|
|
7239
6925
|
description: "Fetch issue associations",
|
|
7240
6926
|
method: HttpMethod.GET,
|
|
7241
|
-
url: "/
|
|
7242
|
-
queryParams: {
|
|
6927
|
+
url: "/issue-associations/",
|
|
6928
|
+
queryParams: { project: projectId.toString() },
|
|
7243
6929
|
blockers: [],
|
|
7244
6930
|
blocks: []
|
|
7245
6931
|
});
|
|
7246
6932
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7247
6933
|
}
|
|
7248
6934
|
}
|
|
6935
|
+
class FormRevisionAttachmentService extends BaseUploadService {
|
|
6936
|
+
async bulkAdd(payloads) {
|
|
6937
|
+
var _a2;
|
|
6938
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6939
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6940
|
+
const filePayloads = {};
|
|
6941
|
+
const offlineFormRevisionAttachments = [];
|
|
6942
|
+
const attachmentPayloads = [];
|
|
6943
|
+
for (const payload of payloads) {
|
|
6944
|
+
const { revisionId, fieldIdentifier, file } = payload;
|
|
6945
|
+
const filePayload = await this.getFilePayload(file);
|
|
6946
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
6947
|
+
const offlineFormRevisionAttachment = offline({
|
|
6948
|
+
file: URL.createObjectURL(file),
|
|
6949
|
+
file_type: file.type,
|
|
6950
|
+
file_name: file.name,
|
|
6951
|
+
file_sha1: filePayload.sha1,
|
|
6952
|
+
created_by: createdBy,
|
|
6953
|
+
form_revision: revisionId,
|
|
6954
|
+
submitted_at: submittedAt,
|
|
6955
|
+
field_identifier: fieldIdentifier
|
|
6956
|
+
});
|
|
6957
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
6958
|
+
const attachmentPayload = {
|
|
6959
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
6960
|
+
file_name: file.name,
|
|
6961
|
+
field_identifier: fieldIdentifier,
|
|
6962
|
+
file_extension: filePayload.extension,
|
|
6963
|
+
file_sha1: filePayload.sha1,
|
|
6964
|
+
form_revision: revisionId
|
|
6965
|
+
};
|
|
6966
|
+
attachmentPayloads.push(attachmentPayload);
|
|
6967
|
+
}
|
|
6968
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
6969
|
+
const promise = this.enqueueRequest({
|
|
6970
|
+
description: "Attach files to form revision",
|
|
6971
|
+
method: HttpMethod.POST,
|
|
6972
|
+
url: "/form-revision-attachments/bulk/",
|
|
6973
|
+
payload: {
|
|
6974
|
+
submitted_at: submittedAt,
|
|
6975
|
+
attachments: attachmentPayloads,
|
|
6976
|
+
files: Object.values(filePayloads)
|
|
6977
|
+
},
|
|
6978
|
+
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
6979
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
6980
|
+
});
|
|
6981
|
+
promise.then((result) => {
|
|
6982
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
6983
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
6984
|
+
}).catch(() => {
|
|
6985
|
+
this.dispatch(
|
|
6986
|
+
deleteFormRevisionAttachments(
|
|
6987
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
6988
|
+
)
|
|
6989
|
+
);
|
|
6990
|
+
});
|
|
6991
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
6992
|
+
}
|
|
6993
|
+
async refreshStore(organizationId) {
|
|
6994
|
+
const formRevisions = await this.enqueueRequest({
|
|
6995
|
+
description: "Fetch organization form revision attachments",
|
|
6996
|
+
method: HttpMethod.GET,
|
|
6997
|
+
url: "/form-revision-attachments/",
|
|
6998
|
+
queryParams: {
|
|
6999
|
+
organization: organizationId.toString()
|
|
7000
|
+
},
|
|
7001
|
+
blockers: [organizationId.toString()],
|
|
7002
|
+
blocks: []
|
|
7003
|
+
});
|
|
7004
|
+
this.dispatch(initializeFormRevisionAttachments(formRevisions));
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
7007
|
+
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
7008
|
+
async bulkAdd(payloads) {
|
|
7009
|
+
var _a2;
|
|
7010
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7011
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7012
|
+
const filePayloads = {};
|
|
7013
|
+
const offlineFormSubmissionAttachments = [];
|
|
7014
|
+
const attachmentPayloads = [];
|
|
7015
|
+
for (const payload of payloads) {
|
|
7016
|
+
const { submissionId, fieldIdentifier, file } = payload;
|
|
7017
|
+
const filePayload = await this.getFilePayload(file);
|
|
7018
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7019
|
+
const offlineFormSubmissionAttachment = offline({
|
|
7020
|
+
file: URL.createObjectURL(file),
|
|
7021
|
+
file_type: file.type,
|
|
7022
|
+
file_name: file.name,
|
|
7023
|
+
file_sha1: filePayload.sha1,
|
|
7024
|
+
created_by: createdBy,
|
|
7025
|
+
form_submission: submissionId,
|
|
7026
|
+
submitted_at: submittedAt,
|
|
7027
|
+
field_identifier: fieldIdentifier
|
|
7028
|
+
});
|
|
7029
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7030
|
+
const attachmentPayload = {
|
|
7031
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7032
|
+
file_name: file.name,
|
|
7033
|
+
file_sha1: filePayload.sha1,
|
|
7034
|
+
file_extension: filePayload.extension,
|
|
7035
|
+
field_identifier: fieldIdentifier,
|
|
7036
|
+
form_submission: submissionId
|
|
7037
|
+
};
|
|
7038
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7039
|
+
}
|
|
7040
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7041
|
+
const promise = this.enqueueRequest({
|
|
7042
|
+
description: "Attach files to form submission",
|
|
7043
|
+
method: HttpMethod.POST,
|
|
7044
|
+
url: "/form-submission-attachments/bulk/",
|
|
7045
|
+
payload: {
|
|
7046
|
+
submitted_at: submittedAt,
|
|
7047
|
+
attachments: attachmentPayloads,
|
|
7048
|
+
files: Object.values(filePayloads)
|
|
7049
|
+
},
|
|
7050
|
+
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7051
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7052
|
+
});
|
|
7053
|
+
promise.then((result) => {
|
|
7054
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7055
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7056
|
+
}).catch((error) => {
|
|
7057
|
+
this.dispatch(
|
|
7058
|
+
deleteFormSubmissionAttachments(
|
|
7059
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7060
|
+
)
|
|
7061
|
+
);
|
|
7062
|
+
throw error;
|
|
7063
|
+
});
|
|
7064
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7065
|
+
}
|
|
7066
|
+
async bulkDelete(attachmentsIds) {
|
|
7067
|
+
const { store } = this.client;
|
|
7068
|
+
const state = store.getState();
|
|
7069
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7070
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7071
|
+
try {
|
|
7072
|
+
await this.enqueueRequest({
|
|
7073
|
+
description: "Delete form submission attachments",
|
|
7074
|
+
method: HttpMethod.DELETE,
|
|
7075
|
+
url: "/form-submission-attachments/bulk/",
|
|
7076
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7077
|
+
blockers: attachmentsIds,
|
|
7078
|
+
blocks: []
|
|
7079
|
+
});
|
|
7080
|
+
} catch (e) {
|
|
7081
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7082
|
+
throw e;
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
async refreshStore(projectId) {
|
|
7086
|
+
const result = await this.enqueueRequest({
|
|
7087
|
+
description: "Get form submission attachments",
|
|
7088
|
+
method: HttpMethod.GET,
|
|
7089
|
+
url: "/form-submission-attachments/",
|
|
7090
|
+
queryParams: {
|
|
7091
|
+
project: projectId.toString()
|
|
7092
|
+
},
|
|
7093
|
+
blockers: [],
|
|
7094
|
+
blocks: []
|
|
7095
|
+
});
|
|
7096
|
+
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7097
|
+
}
|
|
7098
|
+
}
|
|
7099
|
+
class FormRevisionService extends BaseUploadService {
|
|
7100
|
+
add(payload) {
|
|
7101
|
+
var _a2;
|
|
7102
|
+
const { store } = this.client;
|
|
7103
|
+
const state = store.getState();
|
|
7104
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7105
|
+
const offlineFormRevision = offline({
|
|
7106
|
+
...payload,
|
|
7107
|
+
created_by: createdBy,
|
|
7108
|
+
revision: "Pending",
|
|
7109
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7110
|
+
});
|
|
7111
|
+
this.dispatch(addFormRevision(offlineFormRevision));
|
|
7112
|
+
const promise = this.enqueueRequest({
|
|
7113
|
+
description: "Create form revision",
|
|
7114
|
+
method: HttpMethod.POST,
|
|
7115
|
+
url: "/form-revisions/",
|
|
7116
|
+
payload: offlineFormRevision,
|
|
7117
|
+
blockers: [payload.form],
|
|
7118
|
+
blocks: [offlineFormRevision.offline_id]
|
|
7119
|
+
});
|
|
7120
|
+
void promise.then((result) => {
|
|
7121
|
+
this.dispatch(setFormRevision(result));
|
|
7122
|
+
}).catch(() => {
|
|
7123
|
+
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7124
|
+
});
|
|
7125
|
+
return [offlineFormRevision, promise];
|
|
7126
|
+
}
|
|
7127
|
+
async refreshStore(organizationId) {
|
|
7128
|
+
const formRevisions = await this.enqueueRequest({
|
|
7129
|
+
description: "Get organization form revisions",
|
|
7130
|
+
method: HttpMethod.GET,
|
|
7131
|
+
url: "/form-revisions/",
|
|
7132
|
+
queryParams: {
|
|
7133
|
+
organization: organizationId.toString()
|
|
7134
|
+
},
|
|
7135
|
+
blockers: [organizationId.toString()],
|
|
7136
|
+
blocks: []
|
|
7137
|
+
});
|
|
7138
|
+
this.dispatch(initializeFormRevisions(formRevisions));
|
|
7139
|
+
}
|
|
7140
|
+
}
|
|
7141
|
+
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7142
|
+
async bulkAdd(payloads) {
|
|
7143
|
+
var _a2;
|
|
7144
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7145
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7146
|
+
const filePayloads = {};
|
|
7147
|
+
const offlineAssetTypeFieldsAttachments = [];
|
|
7148
|
+
const attachmentPayloads = [];
|
|
7149
|
+
for (const payload of payloads) {
|
|
7150
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7151
|
+
const filePayload = await this.getFilePayload(file);
|
|
7152
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7153
|
+
const offlineAssetTypeFieldsAttachment = offline({
|
|
7154
|
+
file: URL.createObjectURL(file),
|
|
7155
|
+
file_type: file.type,
|
|
7156
|
+
file_name: file.name,
|
|
7157
|
+
file_sha1: filePayload.sha1,
|
|
7158
|
+
created_by: createdBy,
|
|
7159
|
+
fields_revision: fieldsRevisionId,
|
|
7160
|
+
submitted_at: submittedAt,
|
|
7161
|
+
field_identifier: fieldIdentifier
|
|
7162
|
+
});
|
|
7163
|
+
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7164
|
+
const attachmentPayload = {
|
|
7165
|
+
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7166
|
+
file_name: file.name,
|
|
7167
|
+
field_identifier: fieldIdentifier,
|
|
7168
|
+
file_extension: filePayload.extension,
|
|
7169
|
+
file_sha1: filePayload.sha1,
|
|
7170
|
+
fields_revision: fieldsRevisionId
|
|
7171
|
+
};
|
|
7172
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7173
|
+
}
|
|
7174
|
+
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7175
|
+
const promise = this.enqueueRequest({
|
|
7176
|
+
description: "Add asset type fields attachments",
|
|
7177
|
+
method: HttpMethod.POST,
|
|
7178
|
+
url: "/asset-type-fields-attachments/bulk/",
|
|
7179
|
+
payload: {
|
|
7180
|
+
submitted_at: submittedAt,
|
|
7181
|
+
attachments: attachmentPayloads,
|
|
7182
|
+
files: Object.values(filePayloads)
|
|
7183
|
+
},
|
|
7184
|
+
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7185
|
+
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7186
|
+
});
|
|
7187
|
+
promise.then((result) => {
|
|
7188
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7189
|
+
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7190
|
+
}).catch(() => {
|
|
7191
|
+
this.dispatch(
|
|
7192
|
+
deleteAssetTypeFieldsAttachments(
|
|
7193
|
+
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7194
|
+
)
|
|
7195
|
+
);
|
|
7196
|
+
});
|
|
7197
|
+
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7198
|
+
}
|
|
7199
|
+
async refreshStore(organization) {
|
|
7200
|
+
const result = await this.enqueueRequest({
|
|
7201
|
+
description: "Get asset type fields attachments",
|
|
7202
|
+
method: HttpMethod.GET,
|
|
7203
|
+
url: "/asset-type-fields-attachments/",
|
|
7204
|
+
queryParams: {
|
|
7205
|
+
organization: organization.toString()
|
|
7206
|
+
},
|
|
7207
|
+
blockers: [organization.toString()],
|
|
7208
|
+
blocks: []
|
|
7209
|
+
});
|
|
7210
|
+
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
class AssetTypeFieldsService extends BaseApiService {
|
|
7214
|
+
add(payload) {
|
|
7215
|
+
var _a2;
|
|
7216
|
+
const { store } = this.client;
|
|
7217
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7218
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7219
|
+
const offlineAssetTypeFields = offline({
|
|
7220
|
+
...payload,
|
|
7221
|
+
created_by: createdBy,
|
|
7222
|
+
submitted_at: submittedAt
|
|
7223
|
+
});
|
|
7224
|
+
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7225
|
+
const promise = this.enqueueRequest({
|
|
7226
|
+
description: "Add Asset Type Fields",
|
|
7227
|
+
method: HttpMethod.POST,
|
|
7228
|
+
url: "/asset-type-fields/",
|
|
7229
|
+
payload: offlineAssetTypeFields,
|
|
7230
|
+
blockers: [offlineAssetTypeFields.asset_type],
|
|
7231
|
+
blocks: [offlineAssetTypeFields.offline_id]
|
|
7232
|
+
});
|
|
7233
|
+
promise.then((response) => {
|
|
7234
|
+
this.dispatch(updateAssetTypeFields(response));
|
|
7235
|
+
}).catch((error) => {
|
|
7236
|
+
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7237
|
+
throw error;
|
|
7238
|
+
});
|
|
7239
|
+
return [offlineAssetTypeFields, promise];
|
|
7240
|
+
}
|
|
7241
|
+
async refreshStore(organizationId) {
|
|
7242
|
+
const result = await this.enqueueRequest({
|
|
7243
|
+
description: "Get Asset Type Fields",
|
|
7244
|
+
method: HttpMethod.GET,
|
|
7245
|
+
url: "/asset-type-fields/",
|
|
7246
|
+
queryParams: {
|
|
7247
|
+
organization: organizationId.toString()
|
|
7248
|
+
},
|
|
7249
|
+
blockers: [],
|
|
7250
|
+
blocks: []
|
|
7251
|
+
});
|
|
7252
|
+
this.dispatch(initializeAssetTypeFields(result));
|
|
7253
|
+
}
|
|
7254
|
+
}
|
|
7255
|
+
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7256
|
+
add(payload) {
|
|
7257
|
+
var _a2;
|
|
7258
|
+
const { store } = this.client;
|
|
7259
|
+
const state = store.getState();
|
|
7260
|
+
const offlineAssetTypeFieldValues = offline({
|
|
7261
|
+
...payload,
|
|
7262
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7263
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7264
|
+
});
|
|
7265
|
+
const promise = this.enqueueRequest({
|
|
7266
|
+
description: "Add asset type field values",
|
|
7267
|
+
method: HttpMethod.POST,
|
|
7268
|
+
url: "/asset-type-field-values/",
|
|
7269
|
+
payload: offlineAssetTypeFieldValues,
|
|
7270
|
+
blockers: [payload.asset, payload.fields_revision],
|
|
7271
|
+
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7272
|
+
});
|
|
7273
|
+
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7274
|
+
promise.then((result) => {
|
|
7275
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7276
|
+
return result;
|
|
7277
|
+
}).catch(() => {
|
|
7278
|
+
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7279
|
+
});
|
|
7280
|
+
return [offlineAssetTypeFieldValues, promise];
|
|
7281
|
+
}
|
|
7282
|
+
bulkAdd(payload, batchSize) {
|
|
7283
|
+
var _a2;
|
|
7284
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7285
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
7286
|
+
const offlineAssetTypeFieldValuesMany = [];
|
|
7287
|
+
const batches = chunkArray(payload.payloads, batchSize ?? payload.payloads.length);
|
|
7288
|
+
const batchPayloads = [];
|
|
7289
|
+
for (const batch of batches) {
|
|
7290
|
+
const assetTypeFieldValuesPayloads = [];
|
|
7291
|
+
for (const payload2 of batch) {
|
|
7292
|
+
const offlineAssetTypeFieldValues = offline({
|
|
7293
|
+
...payload2,
|
|
7294
|
+
values: separateFilesFromValues(payload2.values).values,
|
|
7295
|
+
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7296
|
+
submitted_at: submittedAt
|
|
7297
|
+
});
|
|
7298
|
+
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7299
|
+
assetTypeFieldValuesPayloads.push({
|
|
7300
|
+
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7301
|
+
asset: payload2.asset,
|
|
7302
|
+
fields_revision: payload2.fields_revision,
|
|
7303
|
+
published_at: payload2.published_at,
|
|
7304
|
+
values: offlineAssetTypeFieldValues.values
|
|
7305
|
+
});
|
|
7306
|
+
}
|
|
7307
|
+
batchPayloads.push({
|
|
7308
|
+
submitted_at: submittedAt,
|
|
7309
|
+
values,
|
|
7310
|
+
field_values: assetTypeFieldValuesPayloads
|
|
7311
|
+
});
|
|
7312
|
+
}
|
|
7313
|
+
this.dispatch(addAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany));
|
|
7314
|
+
const promises = [];
|
|
7315
|
+
for (const payload2 of batchPayloads) {
|
|
7316
|
+
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7317
|
+
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7318
|
+
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7319
|
+
const promise = this.enqueueRequest({
|
|
7320
|
+
description: "Bulk add asset type field values",
|
|
7321
|
+
method: HttpMethod.POST,
|
|
7322
|
+
url: "/asset-type-field-values/bulk/",
|
|
7323
|
+
payload: payload2,
|
|
7324
|
+
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7325
|
+
blocks: assetTypeFieldValuesIds
|
|
7326
|
+
});
|
|
7327
|
+
promises.push(promise);
|
|
7328
|
+
}
|
|
7329
|
+
void Promise.all(promises).then((results) => {
|
|
7330
|
+
this.dispatch(updateAssetTypeFieldValuesMany(results.flat()));
|
|
7331
|
+
}).catch(() => {
|
|
7332
|
+
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7333
|
+
});
|
|
7334
|
+
return [offlineAssetTypeFieldValuesMany, promises];
|
|
7335
|
+
}
|
|
7336
|
+
update(payload) {
|
|
7337
|
+
const { store } = this.client;
|
|
7338
|
+
const state = store.getState();
|
|
7339
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7340
|
+
if (!assetTypeFieldValues) {
|
|
7341
|
+
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7342
|
+
}
|
|
7343
|
+
const updatedAssetTypeFieldValues = {
|
|
7344
|
+
...assetTypeFieldValues,
|
|
7345
|
+
...payload
|
|
7346
|
+
};
|
|
7347
|
+
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7348
|
+
const promise = this.enqueueRequest({
|
|
7349
|
+
description: "Delete asset type field values",
|
|
7350
|
+
method: HttpMethod.PATCH,
|
|
7351
|
+
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7352
|
+
payload,
|
|
7353
|
+
blockers: [
|
|
7354
|
+
updatedAssetTypeFieldValues.offline_id,
|
|
7355
|
+
updatedAssetTypeFieldValues.fields_revision,
|
|
7356
|
+
updatedAssetTypeFieldValues.asset
|
|
7357
|
+
],
|
|
7358
|
+
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7359
|
+
});
|
|
7360
|
+
promise.then((result) => {
|
|
7361
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7362
|
+
}).catch(() => {
|
|
7363
|
+
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7364
|
+
});
|
|
7365
|
+
return [updatedAssetTypeFieldValues, promise];
|
|
7366
|
+
}
|
|
7367
|
+
async delete(id) {
|
|
7368
|
+
const { store } = this.client;
|
|
7369
|
+
const state = store.getState();
|
|
7370
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7371
|
+
if (!assetTypeFieldValues) {
|
|
7372
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7373
|
+
}
|
|
7374
|
+
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7375
|
+
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7376
|
+
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7377
|
+
try {
|
|
7378
|
+
await this.enqueueRequest({
|
|
7379
|
+
description: "Delete asset type field values",
|
|
7380
|
+
method: HttpMethod.DELETE,
|
|
7381
|
+
url: `/asset-type-field-values/${id}/`,
|
|
7382
|
+
blockers: [id],
|
|
7383
|
+
blocks: []
|
|
7384
|
+
});
|
|
7385
|
+
} catch (e) {
|
|
7386
|
+
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7387
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7388
|
+
throw e;
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
async refreshStore(projectId) {
|
|
7392
|
+
const result = await this.enqueueRequest({
|
|
7393
|
+
description: "Get asset type field values",
|
|
7394
|
+
method: HttpMethod.GET,
|
|
7395
|
+
url: "/asset-type-field-values/",
|
|
7396
|
+
queryParams: {
|
|
7397
|
+
project: projectId.toString()
|
|
7398
|
+
},
|
|
7399
|
+
blockers: [],
|
|
7400
|
+
blocks: []
|
|
7401
|
+
});
|
|
7402
|
+
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7406
|
+
async bulkAdd(payloads, batchSize) {
|
|
7407
|
+
var _a2;
|
|
7408
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7409
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7410
|
+
const batches = chunkArray(payloads, batchSize ?? payloads.length);
|
|
7411
|
+
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7412
|
+
const batchPayloads = [];
|
|
7413
|
+
for (const batch of batches) {
|
|
7414
|
+
const filePayloads = {};
|
|
7415
|
+
const attachmentPayloads = [];
|
|
7416
|
+
for (const payload of batch) {
|
|
7417
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7418
|
+
const filePayload = await this.getFilePayload(file);
|
|
7419
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7420
|
+
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7421
|
+
file: URL.createObjectURL(file),
|
|
7422
|
+
file_type: file.type,
|
|
7423
|
+
file_name: file.name,
|
|
7424
|
+
file_sha1: filePayload.sha1,
|
|
7425
|
+
created_by: createdBy,
|
|
7426
|
+
field_values: fieldValuesId,
|
|
7427
|
+
submitted_at: submittedAt,
|
|
7428
|
+
field_identifier: fieldIdentifier
|
|
7429
|
+
});
|
|
7430
|
+
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7431
|
+
const attachmentPayload = {
|
|
7432
|
+
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7433
|
+
file_name: file.name,
|
|
7434
|
+
file_sha1: filePayload.sha1,
|
|
7435
|
+
file_extension: filePayload.extension,
|
|
7436
|
+
field_identifier: fieldIdentifier,
|
|
7437
|
+
field_values: fieldValuesId
|
|
7438
|
+
};
|
|
7439
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7440
|
+
}
|
|
7441
|
+
batchPayloads.push({
|
|
7442
|
+
submitted_at: submittedAt,
|
|
7443
|
+
attachments: attachmentPayloads,
|
|
7444
|
+
files: Object.values(filePayloads)
|
|
7445
|
+
});
|
|
7446
|
+
}
|
|
7447
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7448
|
+
const promises = batchPayloads.map((payload) => {
|
|
7449
|
+
return this.enqueueRequest({
|
|
7450
|
+
description: "Add asset type field values attachments",
|
|
7451
|
+
method: HttpMethod.POST,
|
|
7452
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7453
|
+
payload,
|
|
7454
|
+
blockers: payload.attachments.map((payload2) => payload2.field_values),
|
|
7455
|
+
blocks: payload.attachments.map((payload2) => payload2.offline_id)
|
|
7456
|
+
});
|
|
7457
|
+
});
|
|
7458
|
+
Promise.all(promises).then((result) => {
|
|
7459
|
+
for (const res of result) this.processPresignedUrls(res.presigned_urls);
|
|
7460
|
+
const attachments = result.flatMap((res) => res.attachments);
|
|
7461
|
+
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7462
|
+
}).catch((error) => {
|
|
7463
|
+
this.dispatch(
|
|
7464
|
+
deleteAssetTypeFieldValuesAttachments(
|
|
7465
|
+
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7466
|
+
)
|
|
7467
|
+
);
|
|
7468
|
+
throw error;
|
|
7469
|
+
});
|
|
7470
|
+
return [
|
|
7471
|
+
offlineAssetTypeFieldValuesAttachments,
|
|
7472
|
+
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7473
|
+
];
|
|
7474
|
+
}
|
|
7475
|
+
async bulkDelete(ids) {
|
|
7476
|
+
const { store } = this.client;
|
|
7477
|
+
const state = store.getState();
|
|
7478
|
+
const attachments = selectAssetTypeFieldValuesAttachmentsByIds(ids)(state);
|
|
7479
|
+
this.dispatch(deleteAssetTypeFieldValuesAttachments(ids));
|
|
7480
|
+
try {
|
|
7481
|
+
await this.enqueueRequest({
|
|
7482
|
+
description: "Delete asset type field values attachments",
|
|
7483
|
+
method: HttpMethod.DELETE,
|
|
7484
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7485
|
+
payload: { attachment_ids: ids },
|
|
7486
|
+
blockers: ids,
|
|
7487
|
+
blocks: []
|
|
7488
|
+
});
|
|
7489
|
+
} catch (e) {
|
|
7490
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(attachments));
|
|
7491
|
+
throw e;
|
|
7492
|
+
}
|
|
7493
|
+
}
|
|
7494
|
+
async refreshStore(projectId) {
|
|
7495
|
+
const result = await this.enqueueRequest({
|
|
7496
|
+
description: "Get asset type field values attachments",
|
|
7497
|
+
method: HttpMethod.GET,
|
|
7498
|
+
url: "/asset-type-field-values-attachments/",
|
|
7499
|
+
queryParams: {
|
|
7500
|
+
project: projectId.toString()
|
|
7501
|
+
},
|
|
7502
|
+
blockers: [],
|
|
7503
|
+
blocks: []
|
|
7504
|
+
});
|
|
7505
|
+
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7506
|
+
}
|
|
7507
|
+
}
|
|
7508
|
+
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7509
|
+
async bulkAdd(payloads) {
|
|
7510
|
+
var _a2;
|
|
7511
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7512
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7513
|
+
const filePayloads = {};
|
|
7514
|
+
const offlineIssueTypeFieldsAttachments = [];
|
|
7515
|
+
const attachmentPayloads = [];
|
|
7516
|
+
for (const payload of payloads) {
|
|
7517
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7518
|
+
const filePayload = await this.getFilePayload(file);
|
|
7519
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7520
|
+
const offlineIssueTypeFieldsAttachment = offline({
|
|
7521
|
+
file: URL.createObjectURL(file),
|
|
7522
|
+
file_type: file.type,
|
|
7523
|
+
file_name: file.name,
|
|
7524
|
+
file_sha1: filePayload.sha1,
|
|
7525
|
+
created_by: createdBy,
|
|
7526
|
+
fields_revision: fieldsRevisionId,
|
|
7527
|
+
submitted_at: submittedAt,
|
|
7528
|
+
field_identifier: fieldIdentifier
|
|
7529
|
+
});
|
|
7530
|
+
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7531
|
+
const attachmentPayload = {
|
|
7532
|
+
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7533
|
+
file_name: file.name,
|
|
7534
|
+
file_extension: filePayload.extension,
|
|
7535
|
+
field_identifier: fieldIdentifier,
|
|
7536
|
+
file_sha1: filePayload.sha1,
|
|
7537
|
+
fields_revision: fieldsRevisionId
|
|
7538
|
+
};
|
|
7539
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7540
|
+
}
|
|
7541
|
+
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7542
|
+
const promise = this.enqueueRequest({
|
|
7543
|
+
description: "Add issue type fields attachments",
|
|
7544
|
+
method: HttpMethod.POST,
|
|
7545
|
+
url: "/issue-type-fields-attachments/bulk/",
|
|
7546
|
+
payload: {
|
|
7547
|
+
submitted_at: submittedAt,
|
|
7548
|
+
attachments: attachmentPayloads,
|
|
7549
|
+
files: Object.values(filePayloads)
|
|
7550
|
+
},
|
|
7551
|
+
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7552
|
+
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7553
|
+
});
|
|
7554
|
+
promise.then((result) => {
|
|
7555
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7556
|
+
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7557
|
+
}).catch(() => {
|
|
7558
|
+
this.dispatch(
|
|
7559
|
+
deleteIssueTypeFieldsAttachments(
|
|
7560
|
+
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7561
|
+
)
|
|
7562
|
+
);
|
|
7563
|
+
});
|
|
7564
|
+
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7565
|
+
}
|
|
7566
|
+
async refreshStore(organizationId) {
|
|
7567
|
+
const result = await this.enqueueRequest({
|
|
7568
|
+
description: "get issue type fields attachments",
|
|
7569
|
+
method: HttpMethod.GET,
|
|
7570
|
+
url: "/issue-type-fields-attachments/",
|
|
7571
|
+
queryParams: {
|
|
7572
|
+
organization: organizationId.toString()
|
|
7573
|
+
},
|
|
7574
|
+
blockers: [organizationId.toString()],
|
|
7575
|
+
blocks: []
|
|
7576
|
+
});
|
|
7577
|
+
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7578
|
+
}
|
|
7579
|
+
}
|
|
7580
|
+
class IssueTypeFieldsService extends BaseApiService {
|
|
7581
|
+
add(payload) {
|
|
7582
|
+
var _a2;
|
|
7583
|
+
const { store } = this.client;
|
|
7584
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7585
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7586
|
+
const offlineIssueTypeFields = offline({
|
|
7587
|
+
...payload,
|
|
7588
|
+
created_by: createdBy,
|
|
7589
|
+
submitted_at: submittedAt
|
|
7590
|
+
});
|
|
7591
|
+
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7592
|
+
const promise = this.enqueueRequest({
|
|
7593
|
+
description: "Add Issue Type Fields",
|
|
7594
|
+
method: HttpMethod.POST,
|
|
7595
|
+
url: "/issue-type-fields/",
|
|
7596
|
+
payload: offlineIssueTypeFields,
|
|
7597
|
+
blockers: [offlineIssueTypeFields.issue_type],
|
|
7598
|
+
blocks: [offlineIssueTypeFields.offline_id]
|
|
7599
|
+
});
|
|
7600
|
+
promise.then((response) => {
|
|
7601
|
+
this.dispatch(updateIssueTypeFields(response));
|
|
7602
|
+
}).catch((error) => {
|
|
7603
|
+
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7604
|
+
throw error;
|
|
7605
|
+
});
|
|
7606
|
+
return [offlineIssueTypeFields, promise];
|
|
7607
|
+
}
|
|
7608
|
+
async refreshStore(organizationId) {
|
|
7609
|
+
const result = await this.enqueueRequest({
|
|
7610
|
+
description: "Get Issue Type Fields",
|
|
7611
|
+
method: HttpMethod.GET,
|
|
7612
|
+
url: "/issue-type-fields/",
|
|
7613
|
+
queryParams: {
|
|
7614
|
+
organization: organizationId.toString()
|
|
7615
|
+
},
|
|
7616
|
+
blockers: [],
|
|
7617
|
+
blocks: []
|
|
7618
|
+
});
|
|
7619
|
+
this.dispatch(initializeIssueTypeFields(result));
|
|
7620
|
+
}
|
|
7621
|
+
}
|
|
7622
|
+
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7623
|
+
async bulkAdd(payloads) {
|
|
7624
|
+
var _a2;
|
|
7625
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7626
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7627
|
+
const filePayloads = {};
|
|
7628
|
+
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7629
|
+
const attachmentPayloads = [];
|
|
7630
|
+
for (const payload of payloads) {
|
|
7631
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7632
|
+
const filePayload = await this.getFilePayload(file);
|
|
7633
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7634
|
+
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7635
|
+
file: URL.createObjectURL(file),
|
|
7636
|
+
file_type: file.type,
|
|
7637
|
+
file_name: file.name,
|
|
7638
|
+
file_sha1: filePayload.sha1,
|
|
7639
|
+
created_by: createdBy,
|
|
7640
|
+
field_values: fieldValuesId,
|
|
7641
|
+
submitted_at: submittedAt,
|
|
7642
|
+
field_identifier: fieldIdentifier
|
|
7643
|
+
});
|
|
7644
|
+
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7645
|
+
const attachmentPayload = {
|
|
7646
|
+
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7647
|
+
file_name: file.name,
|
|
7648
|
+
file_sha1: filePayload.sha1,
|
|
7649
|
+
file_extension: filePayload.extension,
|
|
7650
|
+
field_identifier: fieldIdentifier,
|
|
7651
|
+
field_values: fieldValuesId
|
|
7652
|
+
};
|
|
7653
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7654
|
+
}
|
|
7655
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7656
|
+
const promise = this.enqueueRequest({
|
|
7657
|
+
description: "Add issue type field values attachments",
|
|
7658
|
+
method: HttpMethod.POST,
|
|
7659
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7660
|
+
payload: {
|
|
7661
|
+
submitted_at: submittedAt,
|
|
7662
|
+
attachments: attachmentPayloads,
|
|
7663
|
+
files: Object.values(filePayloads)
|
|
7664
|
+
},
|
|
7665
|
+
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7666
|
+
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7667
|
+
});
|
|
7668
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7669
|
+
this.processPresignedUrls(presigned_urls);
|
|
7670
|
+
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7671
|
+
}).catch((error) => {
|
|
7672
|
+
this.dispatch(
|
|
7673
|
+
deleteIssueTypeFieldValuesAttachments(
|
|
7674
|
+
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7675
|
+
)
|
|
7676
|
+
);
|
|
7677
|
+
throw error;
|
|
7678
|
+
});
|
|
7679
|
+
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7680
|
+
}
|
|
7681
|
+
async bulkDelete(attachmentsIds) {
|
|
7682
|
+
const { store } = this.client;
|
|
7683
|
+
const state = store.getState();
|
|
7684
|
+
const attachments = selectIssueTypeFieldValuesAttachmentsByIds(attachmentsIds)(state);
|
|
7685
|
+
this.dispatch(deleteIssueTypeFieldValuesAttachments(attachmentsIds));
|
|
7686
|
+
try {
|
|
7687
|
+
await this.enqueueRequest({
|
|
7688
|
+
description: "Delete issue type field values attachments",
|
|
7689
|
+
method: HttpMethod.DELETE,
|
|
7690
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7691
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7692
|
+
blockers: attachmentsIds,
|
|
7693
|
+
blocks: []
|
|
7694
|
+
});
|
|
7695
|
+
} catch (e) {
|
|
7696
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(attachments));
|
|
7697
|
+
throw e;
|
|
7698
|
+
}
|
|
7699
|
+
}
|
|
7700
|
+
async refreshStore(projectId) {
|
|
7701
|
+
const result = await this.enqueueRequest({
|
|
7702
|
+
description: "Get issue type field values attachments",
|
|
7703
|
+
method: HttpMethod.GET,
|
|
7704
|
+
url: "/issue-type-field-values-attachments/",
|
|
7705
|
+
queryParams: {
|
|
7706
|
+
project: projectId.toString()
|
|
7707
|
+
},
|
|
7708
|
+
blockers: [],
|
|
7709
|
+
blocks: []
|
|
7710
|
+
});
|
|
7711
|
+
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
7712
|
+
}
|
|
7713
|
+
}
|
|
7714
|
+
class IssueTypeFieldValuesService extends BaseApiService {
|
|
7715
|
+
add(payload) {
|
|
7716
|
+
var _a2;
|
|
7717
|
+
const { store } = this.client;
|
|
7718
|
+
const state = store.getState();
|
|
7719
|
+
const offlineIssueTypeFieldValues = offline({
|
|
7720
|
+
...payload,
|
|
7721
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7722
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7723
|
+
});
|
|
7724
|
+
const promise = this.enqueueRequest({
|
|
7725
|
+
description: "Add issue type field values",
|
|
7726
|
+
method: HttpMethod.POST,
|
|
7727
|
+
url: "/issue-type-field-values/",
|
|
7728
|
+
payload: offlineIssueTypeFieldValues,
|
|
7729
|
+
blockers: [payload.issue, payload.fields_revision],
|
|
7730
|
+
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
7731
|
+
});
|
|
7732
|
+
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
7733
|
+
promise.then((result) => {
|
|
7734
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
7735
|
+
return result;
|
|
7736
|
+
}).catch(() => {
|
|
7737
|
+
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
7738
|
+
});
|
|
7739
|
+
return [offlineIssueTypeFieldValues, promise];
|
|
7740
|
+
}
|
|
7741
|
+
update(payload) {
|
|
7742
|
+
const { store } = this.client;
|
|
7743
|
+
const state = store.getState();
|
|
7744
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
7745
|
+
if (!issueTypeFieldValues) {
|
|
7746
|
+
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7747
|
+
}
|
|
7748
|
+
const updatedIssueTypeFieldValues = {
|
|
7749
|
+
...issueTypeFieldValues,
|
|
7750
|
+
...payload
|
|
7751
|
+
};
|
|
7752
|
+
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
7753
|
+
const promise = this.enqueueRequest({
|
|
7754
|
+
description: "Update issue type field values",
|
|
7755
|
+
method: HttpMethod.PATCH,
|
|
7756
|
+
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
7757
|
+
payload,
|
|
7758
|
+
blockers: [
|
|
7759
|
+
updatedIssueTypeFieldValues.offline_id,
|
|
7760
|
+
updatedIssueTypeFieldValues.fields_revision,
|
|
7761
|
+
updatedIssueTypeFieldValues.issue
|
|
7762
|
+
],
|
|
7763
|
+
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
7764
|
+
});
|
|
7765
|
+
promise.then((result) => {
|
|
7766
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
7767
|
+
}).catch(() => {
|
|
7768
|
+
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
7769
|
+
});
|
|
7770
|
+
return [updatedIssueTypeFieldValues, promise];
|
|
7771
|
+
}
|
|
7772
|
+
async delete(id) {
|
|
7773
|
+
const { store } = this.client;
|
|
7774
|
+
const state = store.getState();
|
|
7775
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
7776
|
+
if (!issueTypeFieldValues) {
|
|
7777
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7778
|
+
}
|
|
7779
|
+
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
7780
|
+
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
7781
|
+
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7782
|
+
try {
|
|
7783
|
+
await this.enqueueRequest({
|
|
7784
|
+
description: "Delete issue type field values",
|
|
7785
|
+
method: HttpMethod.DELETE,
|
|
7786
|
+
url: `/issue-type-field-values/${id}/`,
|
|
7787
|
+
blockers: [id],
|
|
7788
|
+
blocks: []
|
|
7789
|
+
});
|
|
7790
|
+
} catch (e) {
|
|
7791
|
+
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
7792
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
7793
|
+
throw e;
|
|
7794
|
+
}
|
|
7795
|
+
}
|
|
7796
|
+
async refreshStore(projectId) {
|
|
7797
|
+
const result = await this.enqueueRequest({
|
|
7798
|
+
description: "Get issue type field values",
|
|
7799
|
+
method: HttpMethod.GET,
|
|
7800
|
+
url: "/issue-type-field-values/",
|
|
7801
|
+
queryParams: {
|
|
7802
|
+
project: projectId.toString()
|
|
7803
|
+
},
|
|
7804
|
+
blockers: [],
|
|
7805
|
+
blocks: []
|
|
7806
|
+
});
|
|
7807
|
+
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
7808
|
+
}
|
|
7809
|
+
}
|
|
7249
7810
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
7250
7811
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
7251
7812
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -7263,6 +7824,10 @@ export {
|
|
|
7263
7824
|
AssetStageCompletionService,
|
|
7264
7825
|
AssetStageService,
|
|
7265
7826
|
AssetTypeAttachmentService,
|
|
7827
|
+
AssetTypeFieldValuesAttachmentService,
|
|
7828
|
+
AssetTypeFieldValuesService,
|
|
7829
|
+
AssetTypeFieldsAttachmentService,
|
|
7830
|
+
AssetTypeFieldsService,
|
|
7266
7831
|
AssetTypeService,
|
|
7267
7832
|
AttachmentModel,
|
|
7268
7833
|
BaseApiService,
|
|
@@ -7278,7 +7843,10 @@ export {
|
|
|
7278
7843
|
EmailDomainsService,
|
|
7279
7844
|
EmailVerificationService,
|
|
7280
7845
|
FileService,
|
|
7846
|
+
FormRevisionAttachmentService,
|
|
7847
|
+
FormRevisionService,
|
|
7281
7848
|
FormService,
|
|
7849
|
+
FormSubmissionAttachmentService,
|
|
7282
7850
|
FormSubmissionService,
|
|
7283
7851
|
GREEN,
|
|
7284
7852
|
GeoImageService,
|
|
@@ -7289,6 +7857,10 @@ export {
|
|
|
7289
7857
|
IssuePriority,
|
|
7290
7858
|
IssueService,
|
|
7291
7859
|
IssueStatus,
|
|
7860
|
+
IssueTypeFieldValuesAttachmentService,
|
|
7861
|
+
IssueTypeFieldValuesService,
|
|
7862
|
+
IssueTypeFieldsAttachmentService,
|
|
7863
|
+
IssueTypeFieldsService,
|
|
7292
7864
|
IssueTypeService,
|
|
7293
7865
|
IssueUpdateChange,
|
|
7294
7866
|
IssueUpdateService,
|
|
@@ -7308,6 +7880,7 @@ export {
|
|
|
7308
7880
|
ProjectFileService,
|
|
7309
7881
|
ProjectService,
|
|
7310
7882
|
TeamService,
|
|
7883
|
+
UNKNOWN_ERROR_MESSAGE,
|
|
7311
7884
|
UserService,
|
|
7312
7885
|
VERSION_REDUCER_KEY,
|
|
7313
7886
|
VerificationCodeType,
|
|
@@ -7326,6 +7899,14 @@ export {
|
|
|
7326
7899
|
addAssetType,
|
|
7327
7900
|
addAssetTypeAttachment,
|
|
7328
7901
|
addAssetTypeAttachments,
|
|
7902
|
+
addAssetTypeFieldValues,
|
|
7903
|
+
addAssetTypeFieldValuesAttachment,
|
|
7904
|
+
addAssetTypeFieldValuesAttachments,
|
|
7905
|
+
addAssetTypeFieldValuesMany,
|
|
7906
|
+
addAssetTypeFields,
|
|
7907
|
+
addAssetTypeFieldsAttachment,
|
|
7908
|
+
addAssetTypeFieldsAttachments,
|
|
7909
|
+
addAssetTypeFieldsMany,
|
|
7329
7910
|
addAssetTypes,
|
|
7330
7911
|
addAssets,
|
|
7331
7912
|
addCategory,
|
|
@@ -7354,6 +7935,14 @@ export {
|
|
|
7354
7935
|
addIssueComment,
|
|
7355
7936
|
addIssueComments,
|
|
7356
7937
|
addIssueType,
|
|
7938
|
+
addIssueTypeFieldValues,
|
|
7939
|
+
addIssueTypeFieldValuesAttachment,
|
|
7940
|
+
addIssueTypeFieldValuesAttachments,
|
|
7941
|
+
addIssueTypeFieldValuesMany,
|
|
7942
|
+
addIssueTypeFields,
|
|
7943
|
+
addIssueTypeFieldsAttachment,
|
|
7944
|
+
addIssueTypeFieldsAttachments,
|
|
7945
|
+
addIssueTypeFieldsMany,
|
|
7357
7946
|
addIssueUpdate,
|
|
7358
7947
|
addIssueUpdates,
|
|
7359
7948
|
addIssues,
|
|
@@ -7378,6 +7967,14 @@ export {
|
|
|
7378
7967
|
assetStageSlice,
|
|
7379
7968
|
assetTypeAttachmentReducer,
|
|
7380
7969
|
assetTypeAttachmentSlice,
|
|
7970
|
+
assetTypeFieldValuesAttachmentReducer,
|
|
7971
|
+
assetTypeFieldValuesAttachmentSlice,
|
|
7972
|
+
assetTypeFieldValuesReducer,
|
|
7973
|
+
assetTypeFieldValuesSlice,
|
|
7974
|
+
assetTypeFieldsAttachmentReducer,
|
|
7975
|
+
assetTypeFieldsAttachmentSlice,
|
|
7976
|
+
assetTypeFieldsReducer,
|
|
7977
|
+
assetTypeFieldsSlice,
|
|
7381
7978
|
assetTypeReducer,
|
|
7382
7979
|
assetTypeSlice,
|
|
7383
7980
|
authReducer,
|
|
@@ -7406,6 +8003,14 @@ export {
|
|
|
7406
8003
|
deleteAssetType,
|
|
7407
8004
|
deleteAssetTypeAttachment,
|
|
7408
8005
|
deleteAssetTypeAttachments,
|
|
8006
|
+
deleteAssetTypeFieldValues,
|
|
8007
|
+
deleteAssetTypeFieldValuesAttachment,
|
|
8008
|
+
deleteAssetTypeFieldValuesAttachments,
|
|
8009
|
+
deleteAssetTypeFieldValuesMany,
|
|
8010
|
+
deleteAssetTypeFields,
|
|
8011
|
+
deleteAssetTypeFieldsAttachment,
|
|
8012
|
+
deleteAssetTypeFieldsAttachments,
|
|
8013
|
+
deleteAssetTypeFieldsMany,
|
|
7409
8014
|
deleteAssetTypes,
|
|
7410
8015
|
deleteAssets,
|
|
7411
8016
|
deleteCategory,
|
|
@@ -7430,6 +8035,14 @@ export {
|
|
|
7430
8035
|
deleteIssueAttachments,
|
|
7431
8036
|
deleteIssueComment,
|
|
7432
8037
|
deleteIssueComments,
|
|
8038
|
+
deleteIssueTypeFieldValues,
|
|
8039
|
+
deleteIssueTypeFieldValuesAttachment,
|
|
8040
|
+
deleteIssueTypeFieldValuesAttachments,
|
|
8041
|
+
deleteIssueTypeFieldValuesMany,
|
|
8042
|
+
deleteIssueTypeFields,
|
|
8043
|
+
deleteIssueTypeFieldsAttachment,
|
|
8044
|
+
deleteIssueTypeFieldsAttachments,
|
|
8045
|
+
deleteIssueTypeFieldsMany,
|
|
7433
8046
|
deleteIssueUpdate,
|
|
7434
8047
|
deleteIssueUpdates,
|
|
7435
8048
|
deleteIssues,
|
|
@@ -7486,6 +8099,10 @@ export {
|
|
|
7486
8099
|
initializeAssetStageCompletions,
|
|
7487
8100
|
initializeAssetStages,
|
|
7488
8101
|
initializeAssetTypeAttachments,
|
|
8102
|
+
initializeAssetTypeFieldValues,
|
|
8103
|
+
initializeAssetTypeFieldValuesAttachments,
|
|
8104
|
+
initializeAssetTypeFields,
|
|
8105
|
+
initializeAssetTypeFieldsAttachments,
|
|
7489
8106
|
initializeAssetTypes,
|
|
7490
8107
|
initializeAssets,
|
|
7491
8108
|
initializeCategories,
|
|
@@ -7500,6 +8117,10 @@ export {
|
|
|
7500
8117
|
initializeGeoImages,
|
|
7501
8118
|
initializeIssueAssociations,
|
|
7502
8119
|
initializeIssueAttachments,
|
|
8120
|
+
initializeIssueTypeFieldValues,
|
|
8121
|
+
initializeIssueTypeFieldValuesAttachments,
|
|
8122
|
+
initializeIssueTypeFields,
|
|
8123
|
+
initializeIssueTypeFieldsAttachments,
|
|
7503
8124
|
initializeIssueTypes,
|
|
7504
8125
|
initializeIssueUpdates,
|
|
7505
8126
|
initializeIssues,
|
|
@@ -7518,6 +8139,14 @@ export {
|
|
|
7518
8139
|
issueCommentSlice,
|
|
7519
8140
|
issueReducer,
|
|
7520
8141
|
issueSlice,
|
|
8142
|
+
issueTypeFieldValuesAttachmentReducer,
|
|
8143
|
+
issueTypeFieldValuesAttachmentSlice,
|
|
8144
|
+
issueTypeFieldValuesReducer,
|
|
8145
|
+
issueTypeFieldValuesSlice,
|
|
8146
|
+
issueTypeFieldsAttachmentReducer,
|
|
8147
|
+
issueTypeFieldsAttachmentSlice,
|
|
8148
|
+
issueTypeFieldsReducer,
|
|
8149
|
+
issueTypeFieldsSlice,
|
|
7521
8150
|
issueTypeReducer,
|
|
7522
8151
|
issueTypeSlice,
|
|
7523
8152
|
issueUpdateReducer,
|
|
@@ -7587,7 +8216,23 @@ export {
|
|
|
7587
8216
|
selectAssetTypeAttachmentMapping,
|
|
7588
8217
|
selectAssetTypeAttachments,
|
|
7589
8218
|
selectAssetTypeById,
|
|
8219
|
+
selectAssetTypeFieldValues,
|
|
8220
|
+
selectAssetTypeFieldValuesAttachmentById,
|
|
8221
|
+
selectAssetTypeFieldValuesAttachments,
|
|
8222
|
+
selectAssetTypeFieldValuesAttachmentsByIds,
|
|
8223
|
+
selectAssetTypeFieldValuesAttachmentsMapping,
|
|
8224
|
+
selectAssetTypeFieldValuesById,
|
|
8225
|
+
selectAssetTypeFieldValuesMapping,
|
|
8226
|
+
selectAssetTypeFieldValuesOfAsset,
|
|
8227
|
+
selectAssetTypeFields,
|
|
8228
|
+
selectAssetTypeFieldsAttachmentById,
|
|
8229
|
+
selectAssetTypeFieldsAttachments,
|
|
8230
|
+
selectAssetTypeFieldsAttachmentsMapping,
|
|
8231
|
+
selectAssetTypeFieldsById,
|
|
8232
|
+
selectAssetTypeFieldsMapping,
|
|
8233
|
+
selectAssetTypeFieldsOfAssetType,
|
|
7590
8234
|
selectAssetTypeStagesMapping,
|
|
8235
|
+
selectAssetTypeValuesOfAssetType,
|
|
7591
8236
|
selectAssetTypes,
|
|
7592
8237
|
selectAssetTypesByIds,
|
|
7593
8238
|
selectAssetTypesMapping,
|
|
@@ -7595,18 +8240,20 @@ export {
|
|
|
7595
8240
|
selectAssetsByIds,
|
|
7596
8241
|
selectAssetsMapping,
|
|
7597
8242
|
selectAssetsOfAssetType,
|
|
7598
|
-
selectAttachedFormSubmissionsOfAsset,
|
|
7599
|
-
selectAttachedFormSubmissionsOfIssue,
|
|
7600
8243
|
selectAttachmentsOfAsset,
|
|
7601
8244
|
selectAttachmentsOfAssetByType,
|
|
7602
8245
|
selectAttachmentsOfAssetType,
|
|
7603
8246
|
selectAttachmentsOfAssetTypeByType,
|
|
8247
|
+
selectAttachmentsOfAssetTypeFieldValues,
|
|
8248
|
+
selectAttachmentsOfAssetTypeFields,
|
|
7604
8249
|
selectAttachmentsOfDocument,
|
|
7605
8250
|
selectAttachmentsOfDocumentByType,
|
|
7606
8251
|
selectAttachmentsOfFormRevision,
|
|
7607
8252
|
selectAttachmentsOfFormSubmission,
|
|
7608
8253
|
selectAttachmentsOfIssue,
|
|
7609
8254
|
selectAttachmentsOfIssueByType,
|
|
8255
|
+
selectAttachmentsOfIssueTypeFieldValues,
|
|
8256
|
+
selectAttachmentsOfIssueTypeFields,
|
|
7610
8257
|
selectAttachmentsOfProject,
|
|
7611
8258
|
selectAttachmentsOfProjectByType,
|
|
7612
8259
|
selectCategories,
|
|
@@ -7634,8 +8281,6 @@ export {
|
|
|
7634
8281
|
selectFilteredForms,
|
|
7635
8282
|
selectFormById,
|
|
7636
8283
|
selectFormMapping,
|
|
7637
|
-
selectFormOfAssetType,
|
|
7638
|
-
selectFormOfIssueType,
|
|
7639
8284
|
selectFormRevisionAttachmentsMapping,
|
|
7640
8285
|
selectFormRevisionById,
|
|
7641
8286
|
selectFormRevisionMapping,
|
|
@@ -7645,16 +8290,11 @@ export {
|
|
|
7645
8290
|
selectFormSubmissionAttachmentsMapping,
|
|
7646
8291
|
selectFormSubmissionById,
|
|
7647
8292
|
selectFormSubmissions,
|
|
7648
|
-
selectFormSubmissionsByAssets,
|
|
7649
|
-
selectFormSubmissionsByFormRevisions,
|
|
7650
|
-
selectFormSubmissionsByIssues,
|
|
7651
8293
|
selectFormSubmissionsMapping,
|
|
7652
8294
|
selectFormSubmissionsOfAsset,
|
|
7653
8295
|
selectFormSubmissionsOfForm,
|
|
7654
8296
|
selectFormSubmissionsOfIssue,
|
|
7655
8297
|
selectForms,
|
|
7656
|
-
selectFormsCount,
|
|
7657
|
-
selectGeneralFormCount,
|
|
7658
8298
|
selectGeoImageById,
|
|
7659
8299
|
selectGeoImageMapping,
|
|
7660
8300
|
selectGeoImages,
|
|
@@ -7676,7 +8316,23 @@ export {
|
|
|
7676
8316
|
selectIssueCountOfCategory,
|
|
7677
8317
|
selectIssueMapping,
|
|
7678
8318
|
selectIssueTypeById,
|
|
8319
|
+
selectIssueTypeFieldValues,
|
|
8320
|
+
selectIssueTypeFieldValuesAttachmentById,
|
|
8321
|
+
selectIssueTypeFieldValuesAttachments,
|
|
8322
|
+
selectIssueTypeFieldValuesAttachmentsByIds,
|
|
8323
|
+
selectIssueTypeFieldValuesAttachmentsMapping,
|
|
8324
|
+
selectIssueTypeFieldValuesById,
|
|
8325
|
+
selectIssueTypeFieldValuesMapping,
|
|
8326
|
+
selectIssueTypeFieldValuesOfIssue,
|
|
8327
|
+
selectIssueTypeFields,
|
|
8328
|
+
selectIssueTypeFieldsAttachmentById,
|
|
8329
|
+
selectIssueTypeFieldsAttachments,
|
|
8330
|
+
selectIssueTypeFieldsAttachmentsMapping,
|
|
8331
|
+
selectIssueTypeFieldsById,
|
|
8332
|
+
selectIssueTypeFieldsMapping,
|
|
8333
|
+
selectIssueTypeFieldsOfIssueType,
|
|
7679
8334
|
selectIssueTypeMapping,
|
|
8335
|
+
selectIssueTypeValuesOfIssueType,
|
|
7680
8336
|
selectIssueTypes,
|
|
7681
8337
|
selectIssueTypesByIds,
|
|
7682
8338
|
selectIssueTypesOfOrganization,
|
|
@@ -7685,8 +8341,9 @@ export {
|
|
|
7685
8341
|
selectIssuesByIds,
|
|
7686
8342
|
selectIssuesOfIssueType,
|
|
7687
8343
|
selectIssuesOfIssueTypeCount,
|
|
7688
|
-
|
|
8344
|
+
selectLatestAssetTypeFieldsOfAssetType,
|
|
7689
8345
|
selectLatestFormRevisionOfForm,
|
|
8346
|
+
selectLatestIssueTypeFieldsOfIssueType,
|
|
7690
8347
|
selectLatestRetryTime,
|
|
7691
8348
|
selectLicense,
|
|
7692
8349
|
selectLicenseForProject,
|
|
@@ -7723,10 +8380,8 @@ export {
|
|
|
7723
8380
|
selectProjectsOfOrganization,
|
|
7724
8381
|
selectRehydrated,
|
|
7725
8382
|
selectRootDocuments,
|
|
7726
|
-
selectSortedFormSubmissionsOfForm,
|
|
7727
8383
|
selectSortedOrganizationUsers,
|
|
7728
8384
|
selectSortedProjectUsers,
|
|
7729
|
-
selectStageFormIdsFromStageIds,
|
|
7730
8385
|
selectStageMapping,
|
|
7731
8386
|
selectStagesOfAssetType,
|
|
7732
8387
|
selectTeamById,
|
|
@@ -7742,6 +8397,8 @@ export {
|
|
|
7742
8397
|
selectWorkspaceById,
|
|
7743
8398
|
selectWorkspaceMapping,
|
|
7744
8399
|
selectWorkspaces,
|
|
8400
|
+
separateFilesFromValues,
|
|
8401
|
+
separateImageFromFields,
|
|
7745
8402
|
setActiveProjectFileId,
|
|
7746
8403
|
setAsset,
|
|
7747
8404
|
setAssetAttachment,
|
|
@@ -7751,6 +8408,14 @@ export {
|
|
|
7751
8408
|
setAssetType,
|
|
7752
8409
|
setAssetTypeAttachment,
|
|
7753
8410
|
setAssetTypeAttachments,
|
|
8411
|
+
setAssetTypeFieldValues,
|
|
8412
|
+
setAssetTypeFieldValuesAttachment,
|
|
8413
|
+
setAssetTypeFieldValuesAttachments,
|
|
8414
|
+
setAssetTypeFieldValuesMany,
|
|
8415
|
+
setAssetTypeFields,
|
|
8416
|
+
setAssetTypeFieldsAttachment,
|
|
8417
|
+
setAssetTypeFieldsAttachments,
|
|
8418
|
+
setAssetTypeFieldsMany,
|
|
7754
8419
|
setAssetTypes,
|
|
7755
8420
|
setAssets,
|
|
7756
8421
|
setConversation,
|
|
@@ -7776,6 +8441,14 @@ export {
|
|
|
7776
8441
|
setIssueComment,
|
|
7777
8442
|
setIssueComments,
|
|
7778
8443
|
setIssueType,
|
|
8444
|
+
setIssueTypeFieldValues,
|
|
8445
|
+
setIssueTypeFieldValuesAttachment,
|
|
8446
|
+
setIssueTypeFieldValuesAttachments,
|
|
8447
|
+
setIssueTypeFieldValuesMany,
|
|
8448
|
+
setIssueTypeFields,
|
|
8449
|
+
setIssueTypeFieldsAttachment,
|
|
8450
|
+
setIssueTypeFieldsAttachments,
|
|
8451
|
+
setIssueTypeFieldsMany,
|
|
7779
8452
|
setIssueUpdate,
|
|
7780
8453
|
setLoggedIn,
|
|
7781
8454
|
setOrganizations,
|
|
@@ -7808,6 +8481,14 @@ export {
|
|
|
7808
8481
|
updateAssetType,
|
|
7809
8482
|
updateAssetTypeAttachment,
|
|
7810
8483
|
updateAssetTypeAttachments,
|
|
8484
|
+
updateAssetTypeFieldValues,
|
|
8485
|
+
updateAssetTypeFieldValuesAttachment,
|
|
8486
|
+
updateAssetTypeFieldValuesAttachments,
|
|
8487
|
+
updateAssetTypeFieldValuesMany,
|
|
8488
|
+
updateAssetTypeFields,
|
|
8489
|
+
updateAssetTypeFieldsAttachment,
|
|
8490
|
+
updateAssetTypeFieldsAttachments,
|
|
8491
|
+
updateAssetTypeFieldsMany,
|
|
7811
8492
|
updateAssetTypes,
|
|
7812
8493
|
updateAssets,
|
|
7813
8494
|
updateCategory,
|
|
@@ -7830,6 +8511,14 @@ export {
|
|
|
7830
8511
|
updateIssueAttachment,
|
|
7831
8512
|
updateIssueAttachments,
|
|
7832
8513
|
updateIssueType,
|
|
8514
|
+
updateIssueTypeFieldValues,
|
|
8515
|
+
updateIssueTypeFieldValuesAttachment,
|
|
8516
|
+
updateIssueTypeFieldValuesAttachments,
|
|
8517
|
+
updateIssueTypeFieldValuesMany,
|
|
8518
|
+
updateIssueTypeFields,
|
|
8519
|
+
updateIssueTypeFieldsAttachment,
|
|
8520
|
+
updateIssueTypeFieldsAttachments,
|
|
8521
|
+
updateIssueTypeFieldsMany,
|
|
7833
8522
|
updateLicense,
|
|
7834
8523
|
updateOrganizationAccess,
|
|
7835
8524
|
updateProject,
|