@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
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
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
|
-
};
|
|
7
1
|
(function(global, factory) {
|
|
8
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("file-saver"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("
|
|
9
|
-
})(this, function(exports2, dependencyGraph, uuid, fileSaver, ColorCls, colors, reduxOffline, offlineConfig, localforage, createMigration,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("file-saver"), require("color"), require("@radix-ui/colors"), require("@reduxjs/toolkit"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("superagent"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("idb")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "file-saver", "color", "@radix-ui/colors", "@reduxjs/toolkit", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "superagent", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "idb"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.fileSaver, global.ColorCls, global.colors, global.toolkit, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.request, global.constants, global.jwtDecode, global.idb));
|
|
3
|
+
})(this, function(exports2, dependencyGraph, uuid, fileSaver, ColorCls, colors, toolkit, reduxOffline, offlineConfig, localforage, createMigration, request, constants, jwtDecode, idb) {
|
|
4
|
+
"use strict";var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
|
|
10
8
|
var _a;
|
|
11
|
-
"use strict";
|
|
12
9
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
13
10
|
HttpMethod2["GET"] = "GET";
|
|
14
11
|
HttpMethod2["POST"] = "POST";
|
|
@@ -142,8 +139,7 @@ var __publicField = (obj, key, value) => {
|
|
|
142
139
|
return;
|
|
143
140
|
}
|
|
144
141
|
for (const node of this.graph.overallOrder()) {
|
|
145
|
-
if (node === request2.payload.uuid)
|
|
146
|
-
continue;
|
|
142
|
+
if (node === request2.payload.uuid) continue;
|
|
147
143
|
const details = this.graph.getNodeData(node);
|
|
148
144
|
if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
|
|
149
145
|
this._addDependency(request2.payload.uuid, node);
|
|
@@ -160,8 +156,7 @@ var __publicField = (obj, key, value) => {
|
|
|
160
156
|
insertRequest(request2) {
|
|
161
157
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
162
158
|
for (const node of this.graph.overallOrder()) {
|
|
163
|
-
if (node === request2.payload.uuid)
|
|
164
|
-
continue;
|
|
159
|
+
if (node === request2.payload.uuid) continue;
|
|
165
160
|
const details = this.graph.getNodeData(node);
|
|
166
161
|
if (details.payload.blockers.some((blocker) => request2.payload.blocks.includes(blocker))) {
|
|
167
162
|
this._addDependency(node, request2.payload.uuid);
|
|
@@ -197,8 +192,7 @@ var __publicField = (obj, key, value) => {
|
|
|
197
192
|
*/
|
|
198
193
|
peek() {
|
|
199
194
|
const nextNode = this._getNextNode();
|
|
200
|
-
if (!nextNode)
|
|
201
|
-
return void 0;
|
|
195
|
+
if (!nextNode) return void 0;
|
|
202
196
|
return this.graph.getNodeData(nextNode);
|
|
203
197
|
}
|
|
204
198
|
/**
|
|
@@ -270,17 +264,15 @@ var __publicField = (obj, key, value) => {
|
|
|
270
264
|
ret = responseBody.error;
|
|
271
265
|
} else if (typeof responseBody.message === "string") {
|
|
272
266
|
ret = responseBody.message;
|
|
273
|
-
} else
|
|
267
|
+
} else {
|
|
274
268
|
try {
|
|
275
|
-
ret = Object.entries(responseBody
|
|
269
|
+
ret = Object.entries(responseBody).map(([key, value]) => {
|
|
276
270
|
if (typeof value === "string") {
|
|
277
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
278
|
-
return value;
|
|
271
|
+
if (_SPECIAL_KEYS.includes(key)) return value;
|
|
279
272
|
return `${key}: ${value}`;
|
|
280
273
|
}
|
|
281
274
|
if (Array.isArray(value)) {
|
|
282
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
283
|
-
return value.join("\n");
|
|
275
|
+
if (_SPECIAL_KEYS.includes(key)) return value.join("\n");
|
|
284
276
|
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
285
277
|
}
|
|
286
278
|
return `${key}: ${JSON.stringify(value)}`;
|
|
@@ -348,11 +340,9 @@ var __publicField = (obj, key, value) => {
|
|
|
348
340
|
return a[0] === b[0] && a[1] === b[1];
|
|
349
341
|
};
|
|
350
342
|
const coordinatesToText = (coordinates, decimalPlaces) => {
|
|
351
|
-
if (!coordinates)
|
|
352
|
-
return "(No Location)";
|
|
343
|
+
if (!coordinates) return "(No Location)";
|
|
353
344
|
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
354
|
-
if (decimalPlaces)
|
|
355
|
-
return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
345
|
+
if (decimalPlaces) return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
356
346
|
return `${lat}, ${lng}`;
|
|
357
347
|
};
|
|
358
348
|
const coordinatesToUrlText = (coordinates) => {
|
|
@@ -405,7 +395,7 @@ var __publicField = (obj, key, value) => {
|
|
|
405
395
|
reader.onload = () => {
|
|
406
396
|
const fileResult = reader.result;
|
|
407
397
|
if (!fileResult) {
|
|
408
|
-
reject();
|
|
398
|
+
reject(new Error("FileReader did not return a valid ArrayBuffer."));
|
|
409
399
|
return;
|
|
410
400
|
}
|
|
411
401
|
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
@@ -419,8 +409,7 @@ var __publicField = (obj, key, value) => {
|
|
|
419
409
|
function getFileIdentifier(file) {
|
|
420
410
|
if (!file.name || !file.type || !file.size) {
|
|
421
411
|
const message = "File has no name, type, and/or size";
|
|
422
|
-
|
|
423
|
-
throw new Error(`${message}.`);
|
|
412
|
+
throw new Error(message);
|
|
424
413
|
}
|
|
425
414
|
return `${file.name}&${file.type}${file.size}`;
|
|
426
415
|
}
|
|
@@ -542,21 +531,19 @@ var __publicField = (obj, key, value) => {
|
|
|
542
531
|
const OUTBOX_RETRY_DELAY = 6e4;
|
|
543
532
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
544
533
|
let debug = false;
|
|
545
|
-
const REACT_APP_DEBUG_MEMOIZATION =
|
|
534
|
+
const REACT_APP_DEBUG_MEMOIZATION = "";
|
|
546
535
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
547
536
|
debug = true;
|
|
548
537
|
}
|
|
549
538
|
function shallowEqual(objA, objB) {
|
|
550
|
-
if (objA === objB)
|
|
551
|
-
return true;
|
|
539
|
+
if (objA === objB) return true;
|
|
552
540
|
if (typeof objA !== typeof objB) {
|
|
553
541
|
return false;
|
|
554
542
|
}
|
|
555
543
|
const keysA = Object.keys(objA);
|
|
556
544
|
const keysB = Object.keys(objB);
|
|
557
545
|
const keysALength = keysA.length;
|
|
558
|
-
if (keysALength !== keysB.length)
|
|
559
|
-
return false;
|
|
546
|
+
if (keysALength !== keysB.length) return false;
|
|
560
547
|
for (let i = 0; i < keysALength; i++) {
|
|
561
548
|
const key = keysA[i];
|
|
562
549
|
if (!Object.prototype.hasOwnProperty.call(objB, key) || objA[key] !== objB[key]) {
|
|
@@ -583,11 +570,9 @@ var __publicField = (obj, key, value) => {
|
|
|
583
570
|
};
|
|
584
571
|
}
|
|
585
572
|
function areArraysEqual(first, second) {
|
|
586
|
-
if (first.length !== second.length)
|
|
587
|
-
return false;
|
|
573
|
+
if (first.length !== second.length) return false;
|
|
588
574
|
for (let i = 0; i < first.length; i++) {
|
|
589
|
-
if (first[i] !== second[i])
|
|
590
|
-
return false;
|
|
575
|
+
if (first[i] !== second[i]) return false;
|
|
591
576
|
}
|
|
592
577
|
return true;
|
|
593
578
|
}
|
|
@@ -632,13 +617,11 @@ var __publicField = (obj, key, value) => {
|
|
|
632
617
|
return { backgroundColor, textColor };
|
|
633
618
|
};
|
|
634
619
|
const getLocalDateString = memoize((date) => {
|
|
635
|
-
if (!date)
|
|
636
|
-
return "";
|
|
620
|
+
if (!date) return "";
|
|
637
621
|
const asDate = new Date(date);
|
|
638
622
|
const isThisYear = asDate.getFullYear() === today.getFullYear();
|
|
639
623
|
const options = { day: "numeric", month: "short" };
|
|
640
|
-
if (!isThisYear)
|
|
641
|
-
options.year = "numeric";
|
|
624
|
+
if (!isThisYear) options.year = "numeric";
|
|
642
625
|
return asDate.toLocaleDateString([], options);
|
|
643
626
|
});
|
|
644
627
|
const relative = new Intl.RelativeTimeFormat([], { style: "long", numeric: "auto" });
|
|
@@ -649,10 +632,10 @@ var __publicField = (obj, key, value) => {
|
|
|
649
632
|
};
|
|
650
633
|
const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
651
634
|
const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
|
|
652
|
-
if (days < min || days > max)
|
|
653
|
-
return getLocalDateString(date);
|
|
635
|
+
if (days < min || days > max) return getLocalDateString(date);
|
|
654
636
|
return relative.format(days, "days");
|
|
655
637
|
});
|
|
638
|
+
_a = Symbol.toStringTag;
|
|
656
639
|
class DeferredPromise {
|
|
657
640
|
constructor() {
|
|
658
641
|
__publicField(this, _a, "Promise");
|
|
@@ -677,14 +660,12 @@ var __publicField = (obj, key, value) => {
|
|
|
677
660
|
return this._promise.catch(onRejected);
|
|
678
661
|
}
|
|
679
662
|
resolve(value) {
|
|
680
|
-
if (!this._resolve)
|
|
681
|
-
throw new Error("No resolve callback");
|
|
663
|
+
if (!this._resolve) throw new Error("No resolve callback");
|
|
682
664
|
this._resolve(value);
|
|
683
665
|
this._state = "fulfilled";
|
|
684
666
|
}
|
|
685
667
|
reject(reason) {
|
|
686
|
-
if (!this._reject)
|
|
687
|
-
throw reason;
|
|
668
|
+
if (!this._reject) throw reason;
|
|
688
669
|
this._reject(reason);
|
|
689
670
|
this._state = "rejected";
|
|
690
671
|
}
|
|
@@ -692,35 +673,6 @@ var __publicField = (obj, key, value) => {
|
|
|
692
673
|
throw new Error("`finally` not implemented");
|
|
693
674
|
}
|
|
694
675
|
}
|
|
695
|
-
_a = Symbol.toStringTag;
|
|
696
|
-
var randomString = function randomString2() {
|
|
697
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
698
|
-
};
|
|
699
|
-
({
|
|
700
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
701
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
702
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
703
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
function compose() {
|
|
707
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
708
|
-
funcs[_key] = arguments[_key];
|
|
709
|
-
}
|
|
710
|
-
if (funcs.length === 0) {
|
|
711
|
-
return function(arg) {
|
|
712
|
-
return arg;
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
if (funcs.length === 1) {
|
|
716
|
-
return funcs[0];
|
|
717
|
-
}
|
|
718
|
-
return funcs.reduce(function(a, b) {
|
|
719
|
-
return function() {
|
|
720
|
-
return a(b.apply(void 0, arguments));
|
|
721
|
-
};
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
676
|
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
725
677
|
const latestVersion = () => migrations.length - 1;
|
|
726
678
|
const initialVersioning = (state) => {
|
|
@@ -741,21 +693,20 @@ var __publicField = (obj, key, value) => {
|
|
|
741
693
|
if (state === void 0) {
|
|
742
694
|
state = {};
|
|
743
695
|
}
|
|
744
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
745
|
-
return state;
|
|
696
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion()) return state;
|
|
746
697
|
return migrator(state);
|
|
747
698
|
};
|
|
748
699
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
749
700
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
750
|
-
const initialState$
|
|
701
|
+
const initialState$J = {
|
|
751
702
|
accessToken: "",
|
|
752
703
|
refreshToken: "",
|
|
753
704
|
isLoggedIn: false
|
|
754
705
|
};
|
|
755
706
|
const authSlice = toolkit.createSlice({
|
|
756
707
|
name: "auth",
|
|
757
|
-
initialState: initialState$
|
|
758
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
708
|
+
initialState: initialState$J,
|
|
709
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$J)),
|
|
759
710
|
reducers: {
|
|
760
711
|
setTokens: (state, action) => {
|
|
761
712
|
state.accessToken = action.payload.accessToken;
|
|
@@ -843,11 +794,11 @@ var __publicField = (obj, key, value) => {
|
|
|
843
794
|
};
|
|
844
795
|
}
|
|
845
796
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
846
|
-
const initialState$
|
|
797
|
+
const initialState$I = categoryAdapter.getInitialState({});
|
|
847
798
|
const categorySlice = toolkit.createSlice({
|
|
848
799
|
name: "categories",
|
|
849
|
-
initialState: initialState$
|
|
850
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
800
|
+
initialState: initialState$I,
|
|
801
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$I)),
|
|
851
802
|
reducers: {
|
|
852
803
|
initializeCategories: categoryAdapter.initialize,
|
|
853
804
|
addCategory: categoryAdapter.addOne,
|
|
@@ -891,11 +842,11 @@ var __publicField = (obj, key, value) => {
|
|
|
891
842
|
};
|
|
892
843
|
const categoryReducer = categorySlice.reducer;
|
|
893
844
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
894
|
-
const initialState$
|
|
845
|
+
const initialState$H = assetAdapter.getInitialState({});
|
|
895
846
|
const assetSlice = toolkit.createSlice({
|
|
896
847
|
name: "assets",
|
|
897
|
-
initialState: initialState$
|
|
898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
848
|
+
initialState: initialState$H,
|
|
849
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$H)),
|
|
899
850
|
reducers: {
|
|
900
851
|
initializeAssets: assetAdapter.initialize,
|
|
901
852
|
addAsset: assetAdapter.addOne,
|
|
@@ -936,8 +887,7 @@ var __publicField = (obj, key, value) => {
|
|
|
936
887
|
const assets = [];
|
|
937
888
|
for (const assetId of assetIds) {
|
|
938
889
|
const asset = assetsMapping[assetId];
|
|
939
|
-
if (asset)
|
|
940
|
-
assets.push(asset);
|
|
890
|
+
if (asset) assets.push(asset);
|
|
941
891
|
}
|
|
942
892
|
return fallbackToEmptyArray(assets);
|
|
943
893
|
})
|
|
@@ -947,11 +897,11 @@ var __publicField = (obj, key, value) => {
|
|
|
947
897
|
};
|
|
948
898
|
const assetReducer = assetSlice.reducer;
|
|
949
899
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
950
|
-
const initialState$
|
|
900
|
+
const initialState$G = assetAttachmentAdapter.getInitialState({});
|
|
951
901
|
const assetAttachmentSlice = toolkit.createSlice({
|
|
952
902
|
name: "assetAttachments",
|
|
953
|
-
initialState: initialState$
|
|
954
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
903
|
+
initialState: initialState$G,
|
|
904
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$G)),
|
|
955
905
|
reducers: {
|
|
956
906
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
957
907
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -998,11 +948,11 @@ var __publicField = (obj, key, value) => {
|
|
|
998
948
|
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
999
949
|
const fileAttachments = attachmentsOfAsset.filter(
|
|
1000
950
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1001
|
-
({ file_type }) => !file_type
|
|
951
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1002
952
|
);
|
|
1003
953
|
const imageAttachments = attachmentsOfAsset.filter(
|
|
1004
954
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1005
|
-
({ file_type }) => file_type
|
|
955
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1006
956
|
);
|
|
1007
957
|
return { fileAttachments, imageAttachments };
|
|
1008
958
|
}
|
|
@@ -1012,11 +962,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1012
962
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1013
963
|
(stageCompletion) => stageCompletion.offline_id
|
|
1014
964
|
);
|
|
1015
|
-
const initialState$
|
|
965
|
+
const initialState$F = assetStageCompletionAdapter.getInitialState({});
|
|
1016
966
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1017
967
|
name: "assetStageCompletions",
|
|
1018
|
-
initialState: initialState$
|
|
1019
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
968
|
+
initialState: initialState$F,
|
|
969
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$F)),
|
|
1020
970
|
reducers: {
|
|
1021
971
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1022
972
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1045,8 +995,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1045
995
|
const completedStagesByAsset = {};
|
|
1046
996
|
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
1047
997
|
const { asset, stage, submitted_at } = stageCompletion;
|
|
1048
|
-
if (!completedStagesByAsset[asset])
|
|
1049
|
-
completedStagesByAsset[asset] = {};
|
|
998
|
+
if (!completedStagesByAsset[asset]) completedStagesByAsset[asset] = {};
|
|
1050
999
|
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1051
1000
|
}
|
|
1052
1001
|
return completedStagesByAsset;
|
|
@@ -1078,11 +1027,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1078
1027
|
);
|
|
1079
1028
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1080
1029
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1081
|
-
const initialState$
|
|
1030
|
+
const initialState$E = assetStageAdapter.getInitialState({});
|
|
1082
1031
|
const assetStageSlice = toolkit.createSlice({
|
|
1083
1032
|
name: "assetStages",
|
|
1084
|
-
initialState: initialState$
|
|
1085
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1033
|
+
initialState: initialState$E,
|
|
1034
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
|
|
1086
1035
|
reducers: {
|
|
1087
1036
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1088
1037
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1146,27 +1095,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1146
1095
|
return fallbackToEmptyArray(assetStages);
|
|
1147
1096
|
})
|
|
1148
1097
|
);
|
|
1149
|
-
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
1150
|
-
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1151
|
-
const ret = {};
|
|
1152
|
-
for (const stageId of stageIds) {
|
|
1153
|
-
const stage = stageMapping[stageId];
|
|
1154
|
-
if (!stage) {
|
|
1155
|
-
throw new Error("No stage exists with the id " + stageId);
|
|
1156
|
-
}
|
|
1157
|
-
if (stage.form) {
|
|
1158
|
-
ret[stageId] = stage.form;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return ret;
|
|
1162
|
-
})
|
|
1163
|
-
);
|
|
1164
1098
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1165
|
-
const initialState$
|
|
1099
|
+
const initialState$D = assetTypeAdapter.getInitialState({});
|
|
1166
1100
|
const assetTypeSlice = toolkit.createSlice({
|
|
1167
1101
|
name: "assetTypes",
|
|
1168
|
-
initialState: initialState$
|
|
1169
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1102
|
+
initialState: initialState$D,
|
|
1103
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
|
|
1170
1104
|
reducers: {
|
|
1171
1105
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1172
1106
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1219,11 +1153,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1219
1153
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1220
1154
|
(attachment) => attachment.offline_id
|
|
1221
1155
|
);
|
|
1222
|
-
const initialState$
|
|
1156
|
+
const initialState$C = assetTypeAttachmentAdapter.getInitialState({});
|
|
1223
1157
|
const assetTypeAttachmentSlice = toolkit.createSlice({
|
|
1224
1158
|
name: "assetTypeAttachments",
|
|
1225
|
-
initialState: initialState$
|
|
1226
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1159
|
+
initialState: initialState$C,
|
|
1160
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
|
|
1227
1161
|
reducers: {
|
|
1228
1162
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1229
1163
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1270,11 +1204,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1270
1204
|
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1271
1205
|
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1272
1206
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1273
|
-
({ file_type }) => !file_type
|
|
1207
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1274
1208
|
);
|
|
1275
1209
|
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1276
1210
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1277
|
-
({ file_type }) => file_type
|
|
1211
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1278
1212
|
);
|
|
1279
1213
|
return { fileAttachments, imageAttachments };
|
|
1280
1214
|
}
|
|
@@ -1282,12 +1216,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1282
1216
|
);
|
|
1283
1217
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1284
1218
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1285
|
-
const initialState$
|
|
1219
|
+
const initialState$B = issueAdapter.getInitialState({});
|
|
1286
1220
|
const issueSlice = toolkit.createSlice({
|
|
1287
1221
|
name: "issues",
|
|
1288
|
-
initialState: initialState$
|
|
1222
|
+
initialState: initialState$B,
|
|
1289
1223
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1290
|
-
Object.assign(state, initialState$
|
|
1224
|
+
Object.assign(state, initialState$B);
|
|
1291
1225
|
}),
|
|
1292
1226
|
reducers: {
|
|
1293
1227
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1319,12 +1253,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1319
1253
|
);
|
|
1320
1254
|
const issueReducer = issueSlice.reducer;
|
|
1321
1255
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1322
|
-
const initialState$
|
|
1256
|
+
const initialState$A = issueTypeAdapter.getInitialState({});
|
|
1323
1257
|
const issueTypeSlice = toolkit.createSlice({
|
|
1324
1258
|
name: "issueTypes",
|
|
1325
|
-
initialState: initialState$
|
|
1259
|
+
initialState: initialState$A,
|
|
1326
1260
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1327
|
-
Object.assign(state, initialState$
|
|
1261
|
+
Object.assign(state, initialState$A);
|
|
1328
1262
|
}),
|
|
1329
1263
|
reducers: {
|
|
1330
1264
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1381,15 +1315,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1381
1315
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1382
1316
|
};
|
|
1383
1317
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1384
|
-
const initialState$
|
|
1318
|
+
const initialState$z = {
|
|
1385
1319
|
s3Urls: {}
|
|
1386
1320
|
};
|
|
1387
1321
|
const msPerHour = 1e3 * 60 * 60;
|
|
1388
1322
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1389
1323
|
const fileSlice = toolkit.createSlice({
|
|
1390
1324
|
name: "file",
|
|
1391
|
-
initialState: initialState$
|
|
1392
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1325
|
+
initialState: initialState$z,
|
|
1326
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
1393
1327
|
reducers: {
|
|
1394
1328
|
setUploadUrl: (state, action) => {
|
|
1395
1329
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1411,19 +1345,18 @@ var __publicField = (obj, key, value) => {
|
|
|
1411
1345
|
}
|
|
1412
1346
|
const today2 = (/* @__PURE__ */ new Date()).getTime();
|
|
1413
1347
|
const expiringWithinAnHour = (url.exp ?? today2) - today2 < msPerHour;
|
|
1414
|
-
if (expiringWithinAnHour)
|
|
1415
|
-
return void 0;
|
|
1348
|
+
if (expiringWithinAnHour) return void 0;
|
|
1416
1349
|
return url;
|
|
1417
1350
|
};
|
|
1418
1351
|
const fileReducer = fileSlice.reducer;
|
|
1419
|
-
const initialState$
|
|
1352
|
+
const initialState$y = {
|
|
1420
1353
|
users: {},
|
|
1421
1354
|
currentUser: null
|
|
1422
1355
|
};
|
|
1423
1356
|
const userSlice = toolkit.createSlice({
|
|
1424
1357
|
name: "users",
|
|
1425
|
-
initialState: initialState$
|
|
1426
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1358
|
+
initialState: initialState$y,
|
|
1359
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
1427
1360
|
reducers: {
|
|
1428
1361
|
setUsers: (state, action) => {
|
|
1429
1362
|
const usersMapping = {};
|
|
@@ -1441,8 +1374,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1441
1374
|
state.currentUser = action.payload;
|
|
1442
1375
|
},
|
|
1443
1376
|
setProfilePicture: (state, action) => {
|
|
1444
|
-
if (!state.currentUser)
|
|
1445
|
-
return;
|
|
1377
|
+
if (!state.currentUser) return;
|
|
1446
1378
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1447
1379
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1448
1380
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1481,11 +1413,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1481
1413
|
const organizationAccessAdapter = createModelAdapter(
|
|
1482
1414
|
(organizationAccess) => organizationAccess.offline_id
|
|
1483
1415
|
);
|
|
1484
|
-
const initialState$
|
|
1416
|
+
const initialState$x = organizationAccessAdapter.getInitialState({});
|
|
1485
1417
|
const organizationAccessSlice = toolkit.createSlice({
|
|
1486
1418
|
name: "organizationAccess",
|
|
1487
|
-
initialState: initialState$
|
|
1488
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1419
|
+
initialState: initialState$x,
|
|
1420
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1489
1421
|
reducers: {
|
|
1490
1422
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1491
1423
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1522,11 +1454,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1522
1454
|
};
|
|
1523
1455
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1524
1456
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1525
|
-
const initialState$
|
|
1457
|
+
const initialState$w = licenseAdapter.getInitialState({});
|
|
1526
1458
|
const licenseSlice = toolkit.createSlice({
|
|
1527
1459
|
name: "license",
|
|
1528
|
-
initialState: initialState$
|
|
1529
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1460
|
+
initialState: initialState$w,
|
|
1461
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1530
1462
|
reducers: {
|
|
1531
1463
|
initializeLicences: licenseAdapter.initialize,
|
|
1532
1464
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1551,11 +1483,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1551
1483
|
);
|
|
1552
1484
|
const licenseReducer = licenseSlice.reducer;
|
|
1553
1485
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1554
|
-
const initialState$
|
|
1486
|
+
const initialState$v = projectAccessAdapter.getInitialState({});
|
|
1555
1487
|
const projectAccessSlice = toolkit.createSlice({
|
|
1556
1488
|
name: "projectAccess",
|
|
1557
|
-
initialState: initialState$
|
|
1558
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1489
|
+
initialState: initialState$v,
|
|
1490
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1559
1491
|
reducers: {
|
|
1560
1492
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1561
1493
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1589,13 +1521,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1589
1521
|
return projectAccesses;
|
|
1590
1522
|
};
|
|
1591
1523
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1592
|
-
const initialState$
|
|
1524
|
+
const initialState$u = {
|
|
1593
1525
|
projects: {}
|
|
1594
1526
|
};
|
|
1595
1527
|
const projectSlice = toolkit.createSlice({
|
|
1596
1528
|
name: "projects",
|
|
1597
|
-
initialState: initialState$
|
|
1598
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1529
|
+
initialState: initialState$u,
|
|
1530
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1599
1531
|
reducers: {
|
|
1600
1532
|
setProjects: (state, action) => {
|
|
1601
1533
|
const projectsMap = {};
|
|
@@ -1654,13 +1586,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1654
1586
|
});
|
|
1655
1587
|
}
|
|
1656
1588
|
);
|
|
1657
|
-
const initialState$
|
|
1589
|
+
const initialState$t = {
|
|
1658
1590
|
organizations: {}
|
|
1659
1591
|
};
|
|
1660
1592
|
const organizationSlice = toolkit.createSlice({
|
|
1661
1593
|
name: "organizations",
|
|
1662
|
-
initialState: initialState$
|
|
1663
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1594
|
+
initialState: initialState$t,
|
|
1595
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
|
|
1664
1596
|
reducers: {
|
|
1665
1597
|
setOrganizations: (state, action) => {
|
|
1666
1598
|
for (const org of action.payload) {
|
|
@@ -1751,14 +1683,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1751
1683
|
}
|
|
1752
1684
|
};
|
|
1753
1685
|
};
|
|
1754
|
-
const initialState$
|
|
1686
|
+
const initialState$s = {
|
|
1755
1687
|
deletedRequests: [],
|
|
1756
1688
|
latestRetryTime: 0
|
|
1757
1689
|
};
|
|
1758
1690
|
const outboxSlice = toolkit.createSlice({
|
|
1759
1691
|
name: "outbox",
|
|
1760
|
-
initialState: initialState$
|
|
1761
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1692
|
+
initialState: initialState$s,
|
|
1693
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
1762
1694
|
reducers: {
|
|
1763
1695
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1764
1696
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1778,8 +1710,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1778
1710
|
},
|
|
1779
1711
|
markAsDeleted(state, action) {
|
|
1780
1712
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1781
|
-
if (index !== -1)
|
|
1782
|
-
state.deletedRequests.splice(index, 1);
|
|
1713
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1783
1714
|
},
|
|
1784
1715
|
_setLatestRetryTime: (state, action) => {
|
|
1785
1716
|
state.latestRetryTime = action.payload;
|
|
@@ -1790,15 +1721,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1790
1721
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1791
1722
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1792
1723
|
const outboxReducer = outboxSlice.reducer;
|
|
1793
|
-
const initialState$
|
|
1724
|
+
const initialState$r = {
|
|
1794
1725
|
projectFiles: {},
|
|
1795
1726
|
activeProjectFileId: null,
|
|
1796
1727
|
isImportingProjectFile: false
|
|
1797
1728
|
};
|
|
1798
1729
|
const projectFileSlice = toolkit.createSlice({
|
|
1799
1730
|
name: "projectFiles",
|
|
1800
|
-
initialState: initialState$
|
|
1801
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1731
|
+
initialState: initialState$r,
|
|
1732
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1802
1733
|
reducers: {
|
|
1803
1734
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1804
1735
|
for (let fileObj of action.payload) {
|
|
@@ -1880,11 +1811,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1880
1811
|
};
|
|
1881
1812
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1882
1813
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1883
|
-
const initialState$
|
|
1814
|
+
const initialState$q = projectAttachmentAdapter.getInitialState({});
|
|
1884
1815
|
const projectAttachmentSlice = toolkit.createSlice({
|
|
1885
1816
|
name: "projectAttachments",
|
|
1886
|
-
initialState: initialState$
|
|
1887
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1817
|
+
initialState: initialState$q,
|
|
1818
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1888
1819
|
reducers: {
|
|
1889
1820
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1890
1821
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -1928,23 +1859,23 @@ var __publicField = (obj, key, value) => {
|
|
|
1928
1859
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1929
1860
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1930
1861
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1931
|
-
({ file_type }) => !file_type
|
|
1862
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1932
1863
|
);
|
|
1933
1864
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1934
1865
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1935
|
-
({ file_type }) => file_type
|
|
1866
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1936
1867
|
);
|
|
1937
1868
|
return { fileAttachments, imageAttachments };
|
|
1938
1869
|
}
|
|
1939
1870
|
)
|
|
1940
1871
|
);
|
|
1941
1872
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
1942
|
-
const initialState$
|
|
1873
|
+
const initialState$p = {
|
|
1943
1874
|
isRehydrated: false
|
|
1944
1875
|
};
|
|
1945
1876
|
const rehydratedSlice = toolkit.createSlice({
|
|
1946
1877
|
name: "rehydrated",
|
|
1947
|
-
initialState: initialState$
|
|
1878
|
+
initialState: initialState$p,
|
|
1948
1879
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
1949
1880
|
reducers: {
|
|
1950
1881
|
setRehydrated: (state, action) => {
|
|
@@ -1969,11 +1900,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1969
1900
|
}
|
|
1970
1901
|
};
|
|
1971
1902
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
1972
|
-
const initialState$
|
|
1903
|
+
const initialState$o = formRevisionAdapter.getInitialState({});
|
|
1973
1904
|
const formRevisionsSlice = toolkit.createSlice({
|
|
1974
1905
|
name: "formRevisions",
|
|
1975
|
-
initialState: initialState$
|
|
1976
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1906
|
+
initialState: initialState$o,
|
|
1907
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1977
1908
|
reducers: {
|
|
1978
1909
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
1979
1910
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2016,8 +1947,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2016
1947
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2017
1948
|
(revisions, formId) => {
|
|
2018
1949
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2019
|
-
if (revisionsOfForm.length === 0)
|
|
2020
|
-
return void 0;
|
|
1950
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2021
1951
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2022
1952
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2023
1953
|
return revisions[latestRevision.offline_id];
|
|
@@ -2032,24 +1962,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2032
1962
|
}
|
|
2033
1963
|
)
|
|
2034
1964
|
);
|
|
2035
|
-
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2036
|
-
const latestRevisions = {};
|
|
2037
|
-
for (const revision of Object.values(revisions)) {
|
|
2038
|
-
const formId = revision.form;
|
|
2039
|
-
const currentLatestRevision = latestRevisions[formId];
|
|
2040
|
-
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2041
|
-
latestRevisions[formId] = revision;
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
return latestRevisions;
|
|
2045
|
-
});
|
|
2046
1965
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2047
1966
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2048
|
-
const initialState$
|
|
1967
|
+
const initialState$n = formAdapter.getInitialState({});
|
|
2049
1968
|
const formSlice = toolkit.createSlice({
|
|
2050
1969
|
name: "forms",
|
|
2051
|
-
initialState: initialState$
|
|
2052
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1970
|
+
initialState: initialState$n,
|
|
1971
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
2053
1972
|
reducers: {
|
|
2054
1973
|
initializeForms: formAdapter.initialize,
|
|
2055
1974
|
setForm: formAdapter.setOne,
|
|
@@ -2067,6 +1986,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2067
1986
|
const selectForms = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2068
1987
|
return Object.values(formsMapping);
|
|
2069
1988
|
});
|
|
1989
|
+
const selectFormById = (formId) => (state) => {
|
|
1990
|
+
return state.formReducer.instances[formId];
|
|
1991
|
+
};
|
|
2070
1992
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2071
1993
|
toolkit.createSelector(
|
|
2072
1994
|
[
|
|
@@ -2089,40 +2011,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2089
2011
|
return [...regularMatches.slice(0, maxResults)];
|
|
2090
2012
|
},
|
|
2091
2013
|
// as the argument is an object, we check the first level of properties for equality
|
|
2092
|
-
{ memoizeOptions: {
|
|
2093
|
-
)
|
|
2094
|
-
);
|
|
2095
|
-
const selectFormById = (formId) => (state) => {
|
|
2096
|
-
return state.formReducer.instances[formId];
|
|
2097
|
-
};
|
|
2098
|
-
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2099
|
-
toolkit.createSelector(
|
|
2100
|
-
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2101
|
-
(formsMapping, assetTypeId) => {
|
|
2102
|
-
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2103
|
-
}
|
|
2104
|
-
)
|
|
2105
|
-
);
|
|
2106
|
-
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2107
|
-
toolkit.createSelector(
|
|
2108
|
-
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2109
|
-
(formsMapping, issueTypeId) => {
|
|
2110
|
-
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2111
|
-
}
|
|
2014
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2112
2015
|
)
|
|
2113
2016
|
);
|
|
2114
|
-
const selectFormsCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2115
|
-
return Object.keys(formsMapping).length;
|
|
2116
|
-
});
|
|
2117
|
-
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2118
|
-
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2119
|
-
});
|
|
2120
2017
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2121
|
-
const initialState$
|
|
2018
|
+
const initialState$m = submissionAdapter.getInitialState({});
|
|
2122
2019
|
const formSubmissionSlice = toolkit.createSlice({
|
|
2123
2020
|
name: "formSubmissions",
|
|
2124
|
-
initialState: initialState$
|
|
2125
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2021
|
+
initialState: initialState$m,
|
|
2022
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
2126
2023
|
reducers: {
|
|
2127
2024
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2128
2025
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2168,8 +2065,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2168
2065
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2169
2066
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2170
2067
|
for (const revision of Object.values(revisionMapping)) {
|
|
2171
|
-
if (revision.form !== formId)
|
|
2172
|
-
continue;
|
|
2068
|
+
if (revision.form !== formId) continue;
|
|
2173
2069
|
revisionIds.add(revision.offline_id);
|
|
2174
2070
|
}
|
|
2175
2071
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2178,43 +2074,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2178
2074
|
}
|
|
2179
2075
|
)
|
|
2180
2076
|
);
|
|
2181
|
-
const selectFormSubmissionsByFormRevisions = toolkit.createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2182
|
-
var _a2;
|
|
2183
|
-
const submissionMapping = {};
|
|
2184
|
-
for (const revisionId in revisions) {
|
|
2185
|
-
submissionMapping[revisionId] = [];
|
|
2186
|
-
}
|
|
2187
|
-
for (const submission of submissions) {
|
|
2188
|
-
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2189
|
-
}
|
|
2190
|
-
return submissionMapping;
|
|
2191
|
-
});
|
|
2192
|
-
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2193
|
-
toolkit.createSelector(
|
|
2194
|
-
[
|
|
2195
|
-
selectFormRevisionMapping,
|
|
2196
|
-
selectFormSubmissionsByFormRevisions,
|
|
2197
|
-
(_state, formId) => formId
|
|
2198
|
-
],
|
|
2199
|
-
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2200
|
-
const submissionsByFormRevisions = {};
|
|
2201
|
-
for (const revisionId in revisionsMapping) {
|
|
2202
|
-
const revision = revisionsMapping[revisionId];
|
|
2203
|
-
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2204
|
-
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2205
|
-
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2206
|
-
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2207
|
-
);
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2211
|
-
const aRevision = revisionsMapping[a[0]];
|
|
2212
|
-
const bRevision = revisionsMapping[b[0]];
|
|
2213
|
-
return formRevisionSortFn(aRevision, bRevision);
|
|
2214
|
-
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2215
|
-
}
|
|
2216
|
-
)
|
|
2217
|
-
);
|
|
2218
2077
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2219
2078
|
toolkit.createSelector(
|
|
2220
2079
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -2225,54 +2084,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2225
2084
|
}
|
|
2226
2085
|
)
|
|
2227
2086
|
);
|
|
2228
|
-
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2229
|
-
toolkit.createSelector(
|
|
2230
|
-
[
|
|
2231
|
-
(state) => state.issueReducer.instances,
|
|
2232
|
-
(state) => state.formReducer.instances,
|
|
2233
|
-
(state) => state.formRevisionReducer.instances,
|
|
2234
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2235
|
-
(_state, issueId) => issueId
|
|
2236
|
-
],
|
|
2237
|
-
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2238
|
-
const issue = issues[issueId];
|
|
2239
|
-
if (!issue)
|
|
2240
|
-
return [];
|
|
2241
|
-
if (!issue.issue_type) {
|
|
2242
|
-
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2243
|
-
}
|
|
2244
|
-
const issueTypeForms = new Set(
|
|
2245
|
-
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2246
|
-
);
|
|
2247
|
-
const issueTypeFormRevisions = new Set(
|
|
2248
|
-
Object.keys(formRevisions).filter(
|
|
2249
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2250
|
-
)
|
|
2251
|
-
);
|
|
2252
|
-
return Object.values(submissions).filter(
|
|
2253
|
-
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2254
|
-
);
|
|
2255
|
-
}
|
|
2256
|
-
)
|
|
2257
|
-
);
|
|
2258
|
-
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2259
|
-
toolkit.createSelector(
|
|
2260
|
-
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2261
|
-
(submissions, issueIds) => {
|
|
2262
|
-
var _a2;
|
|
2263
|
-
const issueSubmissions = {};
|
|
2264
|
-
for (const issueId of issueIds) {
|
|
2265
|
-
issueSubmissions[issueId] = [];
|
|
2266
|
-
}
|
|
2267
|
-
for (const submission of submissions) {
|
|
2268
|
-
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2269
|
-
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
return issueSubmissions;
|
|
2273
|
-
}
|
|
2274
|
-
)
|
|
2275
|
-
);
|
|
2276
2087
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2277
2088
|
toolkit.createSelector(
|
|
2278
2089
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2283,62 +2094,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2283
2094
|
}
|
|
2284
2095
|
)
|
|
2285
2096
|
);
|
|
2286
|
-
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2287
|
-
toolkit.createSelector(
|
|
2288
|
-
[
|
|
2289
|
-
(state) => state.assetReducer.instances,
|
|
2290
|
-
(state) => state.formReducer.instances,
|
|
2291
|
-
(state) => state.formRevisionReducer.instances,
|
|
2292
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2293
|
-
(_state, assetId) => assetId
|
|
2294
|
-
],
|
|
2295
|
-
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2296
|
-
const asset = assets[assetId];
|
|
2297
|
-
if (!asset)
|
|
2298
|
-
return [];
|
|
2299
|
-
if (!asset.asset_type) {
|
|
2300
|
-
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2301
|
-
}
|
|
2302
|
-
const issueTypeForms = new Set(
|
|
2303
|
-
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2304
|
-
);
|
|
2305
|
-
const issueTypeFormRevisions = new Set(
|
|
2306
|
-
Object.keys(formRevisions).filter(
|
|
2307
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2308
|
-
)
|
|
2309
|
-
);
|
|
2310
|
-
return Object.values(submissions).filter(
|
|
2311
|
-
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2312
|
-
);
|
|
2313
|
-
}
|
|
2314
|
-
)
|
|
2315
|
-
);
|
|
2316
|
-
const selectFormSubmissionsByAssets = toolkit.createSelector(
|
|
2317
|
-
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2318
|
-
(submissions, assets) => {
|
|
2319
|
-
var _a2;
|
|
2320
|
-
const assetSubmissionMapping = {};
|
|
2321
|
-
for (const assetId in assets) {
|
|
2322
|
-
assetSubmissionMapping[assetId] = [];
|
|
2323
|
-
}
|
|
2324
|
-
for (const submissionId in submissions) {
|
|
2325
|
-
const submission = submissions[submissionId];
|
|
2326
|
-
if (submission.asset) {
|
|
2327
|
-
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
return assetSubmissionMapping;
|
|
2331
|
-
}
|
|
2332
|
-
);
|
|
2333
2097
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2334
2098
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2335
2099
|
(attachment) => attachment.offline_id
|
|
2336
2100
|
);
|
|
2337
|
-
const initialState$
|
|
2101
|
+
const initialState$l = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2338
2102
|
const formSubmissionAttachmentSlice = toolkit.createSlice({
|
|
2339
2103
|
name: "formSubmissionAttachments",
|
|
2340
|
-
initialState: initialState$
|
|
2341
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2104
|
+
initialState: initialState$l,
|
|
2105
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
2342
2106
|
reducers: {
|
|
2343
2107
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2344
2108
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2381,7 +2145,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2381
2145
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2382
2146
|
(attachmentsMapping, submissionId) => {
|
|
2383
2147
|
return fallbackToEmptyArray(
|
|
2384
|
-
Object.values(attachmentsMapping).filter(
|
|
2148
|
+
Object.values(attachmentsMapping).filter(
|
|
2149
|
+
(attachment) => attachment.form_submission === submissionId
|
|
2150
|
+
)
|
|
2385
2151
|
);
|
|
2386
2152
|
}
|
|
2387
2153
|
)
|
|
@@ -2390,11 +2156,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2390
2156
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2391
2157
|
(attachment) => attachment.offline_id
|
|
2392
2158
|
);
|
|
2393
|
-
const initialState$
|
|
2159
|
+
const initialState$k = formRevisionAttachmentAdapter.getInitialState({});
|
|
2394
2160
|
const formRevisionAttachmentSlice = toolkit.createSlice({
|
|
2395
2161
|
name: "formRevisionAttachments",
|
|
2396
|
-
initialState: initialState$
|
|
2397
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2162
|
+
initialState: initialState$k,
|
|
2163
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
2398
2164
|
reducers: {
|
|
2399
2165
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2400
2166
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2426,17 +2192,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2426
2192
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2427
2193
|
(attachments, revisionId) => {
|
|
2428
2194
|
return fallbackToEmptyArray(
|
|
2429
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2195
|
+
Object.values(attachments).filter((attachment) => attachment.form_revision === revisionId)
|
|
2430
2196
|
);
|
|
2431
2197
|
}
|
|
2432
2198
|
)
|
|
2433
2199
|
);
|
|
2434
2200
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2435
2201
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2436
|
-
const initialState$
|
|
2202
|
+
const initialState$j = workspaceAdapter.getInitialState({});
|
|
2437
2203
|
const workspaceSlice = toolkit.createSlice({
|
|
2438
2204
|
name: "workspace",
|
|
2439
|
-
initialState: initialState$
|
|
2205
|
+
initialState: initialState$j,
|
|
2440
2206
|
reducers: {
|
|
2441
2207
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2442
2208
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2467,10 +2233,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2467
2233
|
);
|
|
2468
2234
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2469
2235
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2470
|
-
const initialState$
|
|
2236
|
+
const initialState$i = emailDomainAdapter.getInitialState({});
|
|
2471
2237
|
const emailDomainsSlice = toolkit.createSlice({
|
|
2472
2238
|
name: "emailDomains",
|
|
2473
|
-
initialState: initialState$
|
|
2239
|
+
initialState: initialState$i,
|
|
2474
2240
|
reducers: {
|
|
2475
2241
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2476
2242
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2491,14 +2257,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2491
2257
|
)
|
|
2492
2258
|
);
|
|
2493
2259
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2494
|
-
const initialState$
|
|
2260
|
+
const initialState$h = {
|
|
2495
2261
|
documents: {}
|
|
2496
2262
|
};
|
|
2497
2263
|
const documentSlice = toolkit.createSlice({
|
|
2498
2264
|
name: "documents",
|
|
2499
|
-
initialState: initialState$
|
|
2265
|
+
initialState: initialState$h,
|
|
2500
2266
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2501
|
-
Object.assign(state, initialState$
|
|
2267
|
+
Object.assign(state, initialState$h);
|
|
2502
2268
|
}),
|
|
2503
2269
|
reducers: {
|
|
2504
2270
|
setDocuments: (state, action) => {
|
|
@@ -2671,8 +2437,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2671
2437
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2672
2438
|
const listOfAncestors = [];
|
|
2673
2439
|
const document2 = mapping[documentId];
|
|
2674
|
-
if (!document2 || !document2.parent_document)
|
|
2675
|
-
return listOfAncestors;
|
|
2440
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2676
2441
|
let currentAncestor = mapping[document2.parent_document];
|
|
2677
2442
|
while (currentAncestor) {
|
|
2678
2443
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2687,11 +2452,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2687
2452
|
);
|
|
2688
2453
|
const documentsReducer = documentSlice.reducer;
|
|
2689
2454
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2690
|
-
const initialState$
|
|
2455
|
+
const initialState$g = documentAttachmentAdapter.getInitialState({});
|
|
2691
2456
|
const documentAttachmentSlice = toolkit.createSlice({
|
|
2692
2457
|
name: "documentAttachments",
|
|
2693
|
-
initialState: initialState$
|
|
2694
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2458
|
+
initialState: initialState$g,
|
|
2459
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2695
2460
|
reducers: {
|
|
2696
2461
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2697
2462
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2738,11 +2503,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2738
2503
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2739
2504
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2740
2505
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2741
|
-
({ file_type }) => !file_type
|
|
2506
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2742
2507
|
);
|
|
2743
2508
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2744
2509
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2745
|
-
({ file_type }) => file_type
|
|
2510
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2746
2511
|
);
|
|
2747
2512
|
return { fileAttachments, imageAttachments };
|
|
2748
2513
|
}
|
|
@@ -2750,11 +2515,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2750
2515
|
);
|
|
2751
2516
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2752
2517
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2753
|
-
const initialState$
|
|
2518
|
+
const initialState$f = teamAdapter.getInitialState({});
|
|
2754
2519
|
const teamSlice = toolkit.createSlice({
|
|
2755
2520
|
name: "teams",
|
|
2756
|
-
initialState: initialState$
|
|
2757
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2521
|
+
initialState: initialState$f,
|
|
2522
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2758
2523
|
reducers: {
|
|
2759
2524
|
setTeam: teamAdapter.setOne,
|
|
2760
2525
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2805,11 +2570,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2805
2570
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2806
2571
|
(conversation) => conversation.offline_id
|
|
2807
2572
|
);
|
|
2808
|
-
const initialState$
|
|
2573
|
+
const initialState$e = agentUserConversationAdapter.getInitialState({});
|
|
2809
2574
|
const agentsSlice = toolkit.createSlice({
|
|
2810
2575
|
name: "agents",
|
|
2811
|
-
initialState: initialState$
|
|
2812
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2576
|
+
initialState: initialState$e,
|
|
2577
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2813
2578
|
reducers: {
|
|
2814
2579
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2815
2580
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2831,11 +2596,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2831
2596
|
);
|
|
2832
2597
|
const agentsReducer = agentsSlice.reducer;
|
|
2833
2598
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2834
|
-
const initialState$
|
|
2599
|
+
const initialState$d = issueCommentAdapter.getInitialState({});
|
|
2835
2600
|
const issueCommentSlice = toolkit.createSlice({
|
|
2836
2601
|
name: "issueComments",
|
|
2837
|
-
initialState: initialState$
|
|
2838
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2602
|
+
initialState: initialState$d,
|
|
2603
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2839
2604
|
reducers: {
|
|
2840
2605
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2841
2606
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2864,11 +2629,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2864
2629
|
);
|
|
2865
2630
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2866
2631
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2867
|
-
const initialState$
|
|
2632
|
+
const initialState$c = issueUpdateAdapter.getInitialState({});
|
|
2868
2633
|
const issueUpdateSlice = toolkit.createSlice({
|
|
2869
2634
|
name: "issueUpdates",
|
|
2870
|
-
initialState: initialState$
|
|
2871
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2635
|
+
initialState: initialState$c,
|
|
2636
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2872
2637
|
reducers: {
|
|
2873
2638
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2874
2639
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2897,11 +2662,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2897
2662
|
);
|
|
2898
2663
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2899
2664
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2900
|
-
const initialState$
|
|
2665
|
+
const initialState$b = issueAttachmentAdapter.getInitialState({});
|
|
2901
2666
|
const issueAttachmentSlice = toolkit.createSlice({
|
|
2902
2667
|
name: "issueAttachments",
|
|
2903
|
-
initialState: initialState$
|
|
2904
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2668
|
+
initialState: initialState$b,
|
|
2669
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2905
2670
|
reducers: {
|
|
2906
2671
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2907
2672
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -2948,34 +2713,34 @@ var __publicField = (obj, key, value) => {
|
|
|
2948
2713
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2949
2714
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2950
2715
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2951
|
-
({ file_type }) => !file_type
|
|
2716
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2952
2717
|
);
|
|
2953
2718
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2954
2719
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2955
|
-
({ file_type }) => file_type
|
|
2720
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2956
2721
|
);
|
|
2957
2722
|
return { fileAttachments, imageAttachments };
|
|
2958
2723
|
}
|
|
2959
2724
|
)
|
|
2960
2725
|
);
|
|
2961
2726
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
2962
|
-
const initialState$
|
|
2727
|
+
const initialState$a = {
|
|
2963
2728
|
version: 0
|
|
2964
2729
|
};
|
|
2965
2730
|
const versioningSlice = toolkit.createSlice({
|
|
2966
2731
|
name: "versioning",
|
|
2967
|
-
initialState: initialState$
|
|
2732
|
+
initialState: initialState$a,
|
|
2968
2733
|
reducers: {}
|
|
2969
2734
|
});
|
|
2970
2735
|
const versioningReducer = versioningSlice.reducer;
|
|
2971
2736
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
2972
|
-
const initialState$
|
|
2737
|
+
const initialState$9 = geoImageAdapter.getInitialState({});
|
|
2973
2738
|
const geoImageSlice = toolkit.createSlice({
|
|
2974
2739
|
name: "geoImages",
|
|
2975
|
-
initialState: initialState$
|
|
2740
|
+
initialState: initialState$9,
|
|
2976
2741
|
extraReducers: (builder) => {
|
|
2977
2742
|
builder.addCase("RESET", (state) => {
|
|
2978
|
-
Object.assign(state, initialState$
|
|
2743
|
+
Object.assign(state, initialState$9);
|
|
2979
2744
|
});
|
|
2980
2745
|
},
|
|
2981
2746
|
reducers: {
|
|
@@ -3013,11 +2778,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3013
2778
|
);
|
|
3014
2779
|
const geoImageReducer = geoImageSlice.reducer;
|
|
3015
2780
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
3016
|
-
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2781
|
+
const initialState$8 = issueAssociationAdapter.getInitialState({});
|
|
3017
2782
|
const issueAssociationSlice = toolkit.createSlice({
|
|
3018
2783
|
name: "issueAssociations",
|
|
3019
|
-
initialState,
|
|
3020
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2784
|
+
initialState: initialState$8,
|
|
2785
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3021
2786
|
reducers: {
|
|
3022
2787
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
3023
2788
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -3075,36 +2840,459 @@ var __publicField = (obj, key, value) => {
|
|
|
3075
2840
|
)
|
|
3076
2841
|
);
|
|
3077
2842
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3097
|
-
this.client = sdk;
|
|
3098
|
-
}
|
|
3099
|
-
async enqueueRequest(requestDetails) {
|
|
3100
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3101
|
-
}
|
|
3102
|
-
dispatch(action) {
|
|
3103
|
-
this.client.store.dispatch(action);
|
|
2843
|
+
const issueTypeFieldValuesAdapter = createModelAdapter(
|
|
2844
|
+
(fieldValues) => fieldValues.offline_id
|
|
2845
|
+
);
|
|
2846
|
+
const initialState$7 = issueTypeFieldValuesAdapter.getInitialState({});
|
|
2847
|
+
const issueTypeFieldValuesSlice = toolkit.createSlice({
|
|
2848
|
+
name: "issueTypeFieldValues",
|
|
2849
|
+
initialState: initialState$7,
|
|
2850
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2851
|
+
reducers: {
|
|
2852
|
+
initializeIssueTypeFieldValues: issueTypeFieldValuesAdapter.initialize,
|
|
2853
|
+
addIssueTypeFieldValues: issueTypeFieldValuesAdapter.addOne,
|
|
2854
|
+
addIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.addMany,
|
|
2855
|
+
setIssueTypeFieldValues: issueTypeFieldValuesAdapter.setOne,
|
|
2856
|
+
setIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.setMany,
|
|
2857
|
+
updateIssueTypeFieldValues: issueTypeFieldValuesAdapter.updateOne,
|
|
2858
|
+
updateIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.updateMany,
|
|
2859
|
+
deleteIssueTypeFieldValues: issueTypeFieldValuesAdapter.deleteOne,
|
|
2860
|
+
deleteIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.deleteMany
|
|
3104
2861
|
}
|
|
3105
|
-
}
|
|
3106
|
-
const
|
|
3107
|
-
|
|
2862
|
+
});
|
|
2863
|
+
const {
|
|
2864
|
+
initializeIssueTypeFieldValues,
|
|
2865
|
+
addIssueTypeFieldValues,
|
|
2866
|
+
addIssueTypeFieldValuesMany,
|
|
2867
|
+
setIssueTypeFieldValues,
|
|
2868
|
+
setIssueTypeFieldValuesMany,
|
|
2869
|
+
updateIssueTypeFieldValues,
|
|
2870
|
+
updateIssueTypeFieldValuesMany,
|
|
2871
|
+
deleteIssueTypeFieldValues,
|
|
2872
|
+
deleteIssueTypeFieldValuesMany
|
|
2873
|
+
} = issueTypeFieldValuesSlice.actions;
|
|
2874
|
+
const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
|
|
2875
|
+
const selectIssueTypeFieldValues = toolkit.createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
2876
|
+
return Object.values(fieldValuesMapping);
|
|
2877
|
+
});
|
|
2878
|
+
const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
|
|
2879
|
+
toolkit.createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
|
|
2880
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
|
|
2881
|
+
})
|
|
2882
|
+
);
|
|
2883
|
+
const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
2884
|
+
return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
|
|
2885
|
+
};
|
|
2886
|
+
const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
|
|
2887
|
+
const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
2888
|
+
const initialState$6 = issueTypeFieldsAdapter.getInitialState({});
|
|
2889
|
+
const issueTypeFieldsSlice = toolkit.createSlice({
|
|
2890
|
+
name: "issueTypeFields",
|
|
2891
|
+
initialState: initialState$6,
|
|
2892
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2893
|
+
reducers: {
|
|
2894
|
+
initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
|
|
2895
|
+
addIssueTypeFields: issueTypeFieldsAdapter.addOne,
|
|
2896
|
+
addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
|
|
2897
|
+
setIssueTypeFields: issueTypeFieldsAdapter.setOne,
|
|
2898
|
+
setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
|
|
2899
|
+
updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
|
|
2900
|
+
updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
|
|
2901
|
+
deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
|
|
2902
|
+
deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
|
|
2903
|
+
}
|
|
2904
|
+
});
|
|
2905
|
+
const {
|
|
2906
|
+
initializeIssueTypeFields,
|
|
2907
|
+
addIssueTypeFields,
|
|
2908
|
+
addIssueTypeFieldsMany,
|
|
2909
|
+
setIssueTypeFields,
|
|
2910
|
+
setIssueTypeFieldsMany,
|
|
2911
|
+
updateIssueTypeFields,
|
|
2912
|
+
updateIssueTypeFieldsMany,
|
|
2913
|
+
deleteIssueTypeFields,
|
|
2914
|
+
deleteIssueTypeFieldsMany
|
|
2915
|
+
} = issueTypeFieldsSlice.actions;
|
|
2916
|
+
const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
|
|
2917
|
+
const selectIssueTypeFields = toolkit.createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
|
|
2918
|
+
return Object.values(fieldsMapping);
|
|
2919
|
+
});
|
|
2920
|
+
const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
2921
|
+
toolkit.createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
|
|
2922
|
+
return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
|
|
2923
|
+
})
|
|
2924
|
+
);
|
|
2925
|
+
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
2926
|
+
toolkit.createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
2927
|
+
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
2928
|
+
})
|
|
2929
|
+
);
|
|
2930
|
+
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
2931
|
+
toolkit.createSelector(
|
|
2932
|
+
[selectIssueTypeFields, selectIssueTypeFieldValues, (_state, id) => id],
|
|
2933
|
+
(fields, fieldValues, id) => {
|
|
2934
|
+
const fieldsIds = new Set(
|
|
2935
|
+
fields.filter((field) => field.issue_type === id).map((field) => field.offline_id)
|
|
2936
|
+
);
|
|
2937
|
+
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
2938
|
+
}
|
|
2939
|
+
)
|
|
2940
|
+
);
|
|
2941
|
+
const selectIssueTypeFieldsById = (fieldsId) => (state) => {
|
|
2942
|
+
return state.issueTypeFieldsReducer.instances[fieldsId];
|
|
2943
|
+
};
|
|
2944
|
+
const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
|
|
2945
|
+
const issueTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
2946
|
+
(attachment) => attachment.offline_id
|
|
2947
|
+
);
|
|
2948
|
+
const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
|
|
2949
|
+
const issueTypeFieldsAttachmentSlice = toolkit.createSlice({
|
|
2950
|
+
name: "issueTypeFieldsAttachments",
|
|
2951
|
+
initialState: initialState$5,
|
|
2952
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2953
|
+
reducers: {
|
|
2954
|
+
initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
|
|
2955
|
+
addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
|
|
2956
|
+
addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
|
|
2957
|
+
setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
|
|
2958
|
+
setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
|
|
2959
|
+
updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
|
|
2960
|
+
updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
|
|
2961
|
+
deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
|
|
2962
|
+
deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
|
|
2963
|
+
}
|
|
2964
|
+
});
|
|
2965
|
+
const {
|
|
2966
|
+
initializeIssueTypeFieldsAttachments,
|
|
2967
|
+
addIssueTypeFieldsAttachment,
|
|
2968
|
+
addIssueTypeFieldsAttachments,
|
|
2969
|
+
setIssueTypeFieldsAttachment,
|
|
2970
|
+
setIssueTypeFieldsAttachments,
|
|
2971
|
+
updateIssueTypeFieldsAttachment,
|
|
2972
|
+
updateIssueTypeFieldsAttachments,
|
|
2973
|
+
deleteIssueTypeFieldsAttachment,
|
|
2974
|
+
deleteIssueTypeFieldsAttachments
|
|
2975
|
+
} = issueTypeFieldsAttachmentSlice.actions;
|
|
2976
|
+
const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
|
|
2977
|
+
const selectIssueTypeFieldsAttachments = toolkit.createSelector(
|
|
2978
|
+
[selectIssueTypeFieldsAttachmentsMapping],
|
|
2979
|
+
(attachmentsMapping) => {
|
|
2980
|
+
return Object.values(attachmentsMapping);
|
|
2981
|
+
}
|
|
2982
|
+
);
|
|
2983
|
+
const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
|
|
2984
|
+
toolkit.createSelector(
|
|
2985
|
+
[selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
|
|
2986
|
+
(attachments, fieldsRevision) => {
|
|
2987
|
+
return fallbackToEmptyArray(
|
|
2988
|
+
attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
)
|
|
2992
|
+
);
|
|
2993
|
+
const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
2994
|
+
return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
2995
|
+
};
|
|
2996
|
+
const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
|
|
2997
|
+
const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
2998
|
+
(attachment) => attachment.offline_id
|
|
2999
|
+
);
|
|
3000
|
+
const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3001
|
+
const issueTypeFieldValuesAttachmentSlice = toolkit.createSlice({
|
|
3002
|
+
name: "issueTypeFieldValuesAttachments",
|
|
3003
|
+
initialState: initialState$4,
|
|
3004
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3005
|
+
reducers: {
|
|
3006
|
+
initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
|
|
3007
|
+
addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
|
|
3008
|
+
addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
|
|
3009
|
+
setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
|
|
3010
|
+
setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
|
|
3011
|
+
updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3012
|
+
updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3013
|
+
deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3014
|
+
deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3015
|
+
}
|
|
3016
|
+
});
|
|
3017
|
+
const {
|
|
3018
|
+
initializeIssueTypeFieldValuesAttachments,
|
|
3019
|
+
addIssueTypeFieldValuesAttachment,
|
|
3020
|
+
addIssueTypeFieldValuesAttachments,
|
|
3021
|
+
setIssueTypeFieldValuesAttachment,
|
|
3022
|
+
setIssueTypeFieldValuesAttachments,
|
|
3023
|
+
updateIssueTypeFieldValuesAttachment,
|
|
3024
|
+
updateIssueTypeFieldValuesAttachments,
|
|
3025
|
+
deleteIssueTypeFieldValuesAttachment,
|
|
3026
|
+
deleteIssueTypeFieldValuesAttachments
|
|
3027
|
+
} = issueTypeFieldValuesAttachmentSlice.actions;
|
|
3028
|
+
const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
|
|
3029
|
+
const selectIssueTypeFieldValuesAttachments = toolkit.createSelector(
|
|
3030
|
+
[selectIssueTypeFieldValuesAttachmentsMapping],
|
|
3031
|
+
(attachmentsMapping) => {
|
|
3032
|
+
return Object.values(attachmentsMapping);
|
|
3033
|
+
}
|
|
3034
|
+
);
|
|
3035
|
+
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3036
|
+
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3037
|
+
};
|
|
3038
|
+
const selectIssueTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3039
|
+
toolkit.createSelector(
|
|
3040
|
+
[selectIssueTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3041
|
+
(mapping, attachmentIds) => {
|
|
3042
|
+
const attachmentIdsSet = new Set(attachmentIds);
|
|
3043
|
+
return fallbackToEmptyArray(
|
|
3044
|
+
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3045
|
+
);
|
|
3046
|
+
}
|
|
3047
|
+
)
|
|
3048
|
+
);
|
|
3049
|
+
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3050
|
+
toolkit.createSelector(
|
|
3051
|
+
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
3052
|
+
(attachments, fieldValuesId) => {
|
|
3053
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
|
|
3054
|
+
}
|
|
3055
|
+
)
|
|
3056
|
+
);
|
|
3057
|
+
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3058
|
+
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3059
|
+
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
3060
|
+
const assetTypeFieldsSlice = toolkit.createSlice({
|
|
3061
|
+
name: "assetTypeFields",
|
|
3062
|
+
initialState: initialState$3,
|
|
3063
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3064
|
+
reducers: {
|
|
3065
|
+
initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
|
|
3066
|
+
addAssetTypeFields: assetTypeFieldsAdapter.addOne,
|
|
3067
|
+
addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
|
|
3068
|
+
setAssetTypeFields: assetTypeFieldsAdapter.setOne,
|
|
3069
|
+
setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
|
|
3070
|
+
updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
|
|
3071
|
+
updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
|
|
3072
|
+
deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
|
|
3073
|
+
deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
|
|
3074
|
+
}
|
|
3075
|
+
});
|
|
3076
|
+
const {
|
|
3077
|
+
initializeAssetTypeFields,
|
|
3078
|
+
addAssetTypeFields,
|
|
3079
|
+
addAssetTypeFieldsMany,
|
|
3080
|
+
setAssetTypeFields,
|
|
3081
|
+
setAssetTypeFieldsMany,
|
|
3082
|
+
updateAssetTypeFields,
|
|
3083
|
+
updateAssetTypeFieldsMany,
|
|
3084
|
+
deleteAssetTypeFields,
|
|
3085
|
+
deleteAssetTypeFieldsMany
|
|
3086
|
+
} = assetTypeFieldsSlice.actions;
|
|
3087
|
+
const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
|
|
3088
|
+
const selectAssetTypeFields = toolkit.createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
|
|
3089
|
+
return Object.values(fieldsMapping);
|
|
3090
|
+
});
|
|
3091
|
+
const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3092
|
+
toolkit.createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
|
|
3093
|
+
return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
|
|
3094
|
+
})
|
|
3095
|
+
);
|
|
3096
|
+
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3097
|
+
toolkit.createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3098
|
+
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3099
|
+
})
|
|
3100
|
+
);
|
|
3101
|
+
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
3102
|
+
return state.assetTypeFieldsReducer.instances[fieldsId];
|
|
3103
|
+
};
|
|
3104
|
+
const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
|
|
3105
|
+
const assetTypeFieldValuesAdapter = createModelAdapter(
|
|
3106
|
+
(fieldValues) => fieldValues.offline_id
|
|
3107
|
+
);
|
|
3108
|
+
const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
|
|
3109
|
+
const assetTypeFieldValuesSlice = toolkit.createSlice({
|
|
3110
|
+
name: "assetTypeFieldValues",
|
|
3111
|
+
initialState: initialState$2,
|
|
3112
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
3113
|
+
reducers: {
|
|
3114
|
+
initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
|
|
3115
|
+
addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
|
|
3116
|
+
addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
|
|
3117
|
+
setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
|
|
3118
|
+
setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
|
|
3119
|
+
updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
|
|
3120
|
+
updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
|
|
3121
|
+
deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
|
|
3122
|
+
deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
|
|
3123
|
+
}
|
|
3124
|
+
});
|
|
3125
|
+
const {
|
|
3126
|
+
initializeAssetTypeFieldValues,
|
|
3127
|
+
addAssetTypeFieldValues,
|
|
3128
|
+
addAssetTypeFieldValuesMany,
|
|
3129
|
+
setAssetTypeFieldValues,
|
|
3130
|
+
setAssetTypeFieldValuesMany,
|
|
3131
|
+
updateAssetTypeFieldValues,
|
|
3132
|
+
updateAssetTypeFieldValuesMany,
|
|
3133
|
+
deleteAssetTypeFieldValues,
|
|
3134
|
+
deleteAssetTypeFieldValuesMany
|
|
3135
|
+
} = assetTypeFieldValuesSlice.actions;
|
|
3136
|
+
const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
|
|
3137
|
+
const selectAssetTypeFieldValues = toolkit.createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3138
|
+
return Object.values(fieldValuesMapping);
|
|
3139
|
+
});
|
|
3140
|
+
const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
|
|
3141
|
+
toolkit.createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
|
|
3142
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
|
|
3143
|
+
})
|
|
3144
|
+
);
|
|
3145
|
+
const selectAssetTypeValuesOfAssetType = restructureCreateSelectorWithArgs(
|
|
3146
|
+
toolkit.createSelector(
|
|
3147
|
+
[selectAssetTypeFields, selectAssetTypeFieldValues, (_state, id) => id],
|
|
3148
|
+
(fields, fieldValues, id) => {
|
|
3149
|
+
const fieldsIds = new Set(
|
|
3150
|
+
fields.filter((field) => field.asset_type === id).map((field) => field.offline_id)
|
|
3151
|
+
);
|
|
3152
|
+
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3153
|
+
}
|
|
3154
|
+
)
|
|
3155
|
+
);
|
|
3156
|
+
const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3157
|
+
return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3158
|
+
};
|
|
3159
|
+
const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
|
|
3160
|
+
const assetTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3161
|
+
(attachment) => attachment.offline_id
|
|
3162
|
+
);
|
|
3163
|
+
const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3164
|
+
const assetTypeFieldsAttachmentSlice = toolkit.createSlice({
|
|
3165
|
+
name: "assetTypeFieldsAttachments",
|
|
3166
|
+
initialState: initialState$1,
|
|
3167
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
3168
|
+
reducers: {
|
|
3169
|
+
initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
|
|
3170
|
+
addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
|
|
3171
|
+
addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
|
|
3172
|
+
setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
|
|
3173
|
+
setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
|
|
3174
|
+
updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
|
|
3175
|
+
updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
|
|
3176
|
+
deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
|
|
3177
|
+
deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
|
|
3178
|
+
}
|
|
3179
|
+
});
|
|
3180
|
+
const {
|
|
3181
|
+
initializeAssetTypeFieldsAttachments,
|
|
3182
|
+
addAssetTypeFieldsAttachment,
|
|
3183
|
+
addAssetTypeFieldsAttachments,
|
|
3184
|
+
setAssetTypeFieldsAttachment,
|
|
3185
|
+
setAssetTypeFieldsAttachments,
|
|
3186
|
+
updateAssetTypeFieldsAttachment,
|
|
3187
|
+
updateAssetTypeFieldsAttachments,
|
|
3188
|
+
deleteAssetTypeFieldsAttachment,
|
|
3189
|
+
deleteAssetTypeFieldsAttachments
|
|
3190
|
+
} = assetTypeFieldsAttachmentSlice.actions;
|
|
3191
|
+
const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
|
|
3192
|
+
const selectAssetTypeFieldsAttachments = toolkit.createSelector(
|
|
3193
|
+
[selectAssetTypeFieldsAttachmentsMapping],
|
|
3194
|
+
(attachmentsMapping) => {
|
|
3195
|
+
return Object.values(attachmentsMapping);
|
|
3196
|
+
}
|
|
3197
|
+
);
|
|
3198
|
+
const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
|
|
3199
|
+
toolkit.createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
|
|
3200
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
|
|
3201
|
+
})
|
|
3202
|
+
);
|
|
3203
|
+
const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3204
|
+
return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3205
|
+
};
|
|
3206
|
+
const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
|
|
3207
|
+
const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3208
|
+
(attachment) => attachment.offline_id
|
|
3209
|
+
);
|
|
3210
|
+
const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3211
|
+
const assetTypeFieldValuesAttachmentSlice = toolkit.createSlice({
|
|
3212
|
+
name: "assetTypeFieldValuesAttachments",
|
|
3213
|
+
initialState,
|
|
3214
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3215
|
+
reducers: {
|
|
3216
|
+
initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
|
|
3217
|
+
addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
|
|
3218
|
+
addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
|
|
3219
|
+
setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
|
|
3220
|
+
setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
|
|
3221
|
+
updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3222
|
+
updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3223
|
+
deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3224
|
+
deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3225
|
+
}
|
|
3226
|
+
});
|
|
3227
|
+
const {
|
|
3228
|
+
initializeAssetTypeFieldValuesAttachments,
|
|
3229
|
+
addAssetTypeFieldValuesAttachment,
|
|
3230
|
+
addAssetTypeFieldValuesAttachments,
|
|
3231
|
+
setAssetTypeFieldValuesAttachment,
|
|
3232
|
+
setAssetTypeFieldValuesAttachments,
|
|
3233
|
+
updateAssetTypeFieldValuesAttachment,
|
|
3234
|
+
updateAssetTypeFieldValuesAttachments,
|
|
3235
|
+
deleteAssetTypeFieldValuesAttachment,
|
|
3236
|
+
deleteAssetTypeFieldValuesAttachments
|
|
3237
|
+
} = assetTypeFieldValuesAttachmentSlice.actions;
|
|
3238
|
+
const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
|
|
3239
|
+
const selectAssetTypeFieldValuesAttachments = toolkit.createSelector(
|
|
3240
|
+
[selectAssetTypeFieldValuesAttachmentsMapping],
|
|
3241
|
+
(attachmentsMapping) => {
|
|
3242
|
+
return Object.values(attachmentsMapping);
|
|
3243
|
+
}
|
|
3244
|
+
);
|
|
3245
|
+
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3246
|
+
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3247
|
+
};
|
|
3248
|
+
const selectAssetTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3249
|
+
toolkit.createSelector(
|
|
3250
|
+
[selectAssetTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3251
|
+
(mapping, attachmentIds) => {
|
|
3252
|
+
const attachmentIdsSet = new Set(attachmentIds);
|
|
3253
|
+
return fallbackToEmptyArray(
|
|
3254
|
+
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3255
|
+
);
|
|
3256
|
+
}
|
|
3257
|
+
)
|
|
3258
|
+
);
|
|
3259
|
+
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3260
|
+
toolkit.createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3261
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3262
|
+
})
|
|
3263
|
+
);
|
|
3264
|
+
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3265
|
+
let clientStore;
|
|
3266
|
+
function setClientStore(store) {
|
|
3267
|
+
clientStore = store;
|
|
3268
|
+
}
|
|
3269
|
+
function getClientStore() {
|
|
3270
|
+
return clientStore;
|
|
3271
|
+
}
|
|
3272
|
+
let clientSDK;
|
|
3273
|
+
function setClientSDK(sdkCtor) {
|
|
3274
|
+
clientSDK = sdkCtor;
|
|
3275
|
+
}
|
|
3276
|
+
function getClientSDK() {
|
|
3277
|
+
return clientSDK;
|
|
3278
|
+
}
|
|
3279
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3280
|
+
class BaseService {
|
|
3281
|
+
constructor(sdk) {
|
|
3282
|
+
__publicField(this, "client");
|
|
3283
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3284
|
+
this.client = sdk;
|
|
3285
|
+
}
|
|
3286
|
+
async enqueueRequest(requestDetails) {
|
|
3287
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3288
|
+
}
|
|
3289
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3290
|
+
dispatch(action) {
|
|
3291
|
+
this.client.store.dispatch(action);
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
const VERSION_REDUCER_KEY = "versioning";
|
|
3295
|
+
const overmapReducers = {
|
|
3108
3296
|
// TODO: attachmentReducer,
|
|
3109
3297
|
[VERSION_REDUCER_KEY]: versioningReducer,
|
|
3110
3298
|
fileReducer,
|
|
@@ -3143,7 +3331,15 @@ var __publicField = (obj, key, value) => {
|
|
|
3143
3331
|
issueCommentReducer,
|
|
3144
3332
|
issueUpdateReducer,
|
|
3145
3333
|
geoImageReducer,
|
|
3146
|
-
issueAssociationReducer
|
|
3334
|
+
issueAssociationReducer,
|
|
3335
|
+
issueTypeFieldsReducer,
|
|
3336
|
+
issueTypeFieldValuesReducer,
|
|
3337
|
+
issueTypeFieldsAttachmentReducer,
|
|
3338
|
+
issueTypeFieldValuesAttachmentReducer,
|
|
3339
|
+
assetTypeFieldsReducer,
|
|
3340
|
+
assetTypeFieldValuesReducer,
|
|
3341
|
+
assetTypeFieldsAttachmentReducer,
|
|
3342
|
+
assetTypeFieldValuesAttachmentReducer
|
|
3147
3343
|
};
|
|
3148
3344
|
const overmapReducer = toolkit.combineReducers(overmapReducers);
|
|
3149
3345
|
const resetStore = "RESET";
|
|
@@ -3168,9 +3364,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3168
3364
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3169
3365
|
return coordinator;
|
|
3170
3366
|
}
|
|
3171
|
-
const persistCallback = (
|
|
3172
|
-
if (
|
|
3173
|
-
throw err;
|
|
3367
|
+
const persistCallback = (e) => {
|
|
3368
|
+
if (e) throw e;
|
|
3174
3369
|
const clientStore2 = getClientStore();
|
|
3175
3370
|
if (clientStore2) {
|
|
3176
3371
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3228,20 +3423,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3228
3423
|
}
|
|
3229
3424
|
};
|
|
3230
3425
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3231
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3426
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3232
3427
|
function extractResponseFromError(error) {
|
|
3233
3428
|
function isResponse(response) {
|
|
3234
3429
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3235
3430
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3236
3431
|
}
|
|
3237
|
-
if (isResponse(error))
|
|
3238
|
-
return error;
|
|
3432
|
+
if (isResponse(error)) return error;
|
|
3239
3433
|
if (typeof error === "object" && error !== null) {
|
|
3240
3434
|
const typedError = error;
|
|
3241
|
-
if (isResponse(typedError.response))
|
|
3242
|
-
|
|
3243
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3244
|
-
return typedError.response.response;
|
|
3435
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3436
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3245
3437
|
}
|
|
3246
3438
|
return void 0;
|
|
3247
3439
|
}
|
|
@@ -3282,15 +3474,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3282
3474
|
const addPayload = (req) => {
|
|
3283
3475
|
if (attachmentHash) {
|
|
3284
3476
|
const s3url = requestDetails.s3url;
|
|
3285
|
-
if (!s3url)
|
|
3286
|
-
|
|
3287
|
-
if (
|
|
3288
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3289
|
-
if (!file)
|
|
3290
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3477
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3478
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3479
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3291
3480
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3292
|
-
if (!s3Sha1Checksum)
|
|
3293
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3481
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3294
3482
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3295
3483
|
}
|
|
3296
3484
|
return req.send(payload);
|
|
@@ -3350,8 +3538,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3350
3538
|
this.compile = this.compile.bind(this);
|
|
3351
3539
|
}
|
|
3352
3540
|
then(next) {
|
|
3353
|
-
if (this._previous)
|
|
3354
|
-
this._previous.next = next;
|
|
3541
|
+
if (this._previous) this._previous.next = next;
|
|
3355
3542
|
this._all.push(next);
|
|
3356
3543
|
this._previous = next;
|
|
3357
3544
|
return {
|
|
@@ -3379,11 +3566,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3379
3566
|
} else {
|
|
3380
3567
|
console.debug("Middleware finished. Performing request:", action);
|
|
3381
3568
|
const clientStore2 = getClientStore();
|
|
3382
|
-
if (!clientStore2)
|
|
3383
|
-
throw new Error("Client store not set");
|
|
3569
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3384
3570
|
const clientSDK2 = getClientSDK();
|
|
3385
|
-
if (!clientSDK2)
|
|
3386
|
-
throw new Error("Client SDK not set");
|
|
3571
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3387
3572
|
return performRequest(action, clientSDK2);
|
|
3388
3573
|
}
|
|
3389
3574
|
}
|
|
@@ -3404,20 +3589,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3404
3589
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3405
3590
|
}
|
|
3406
3591
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3407
|
-
const statusMessages = {
|
|
3408
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3409
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3410
|
-
405: {
|
|
3411
|
-
title: "Not supported",
|
|
3412
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3413
|
-
accentColor: "red"
|
|
3414
|
-
},
|
|
3415
|
-
500: {
|
|
3416
|
-
title: "Server error",
|
|
3417
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3418
|
-
accentColor: "red"
|
|
3419
|
-
}
|
|
3420
|
-
};
|
|
3421
3592
|
function discard(reason, action, retries = 0) {
|
|
3422
3593
|
var _a2;
|
|
3423
3594
|
console.debug(
|
|
@@ -3470,14 +3641,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3470
3641
|
}
|
|
3471
3642
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3472
3643
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3473
|
-
const message = statusMessages[status];
|
|
3474
|
-
if (message) {
|
|
3475
|
-
if (blocks.unsafeShowToast) {
|
|
3476
|
-
blocks.unsafeShowToast(message);
|
|
3477
|
-
} else {
|
|
3478
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3479
|
-
}
|
|
3480
|
-
}
|
|
3481
3644
|
const coordinator2 = getOutboxCoordinator();
|
|
3482
3645
|
if (!coordinator2) {
|
|
3483
3646
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3505,6 +3668,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3505
3668
|
}
|
|
3506
3669
|
class BaseSDK {
|
|
3507
3670
|
constructor(store) {
|
|
3671
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3508
3672
|
__publicField(this, "store");
|
|
3509
3673
|
this.store = store;
|
|
3510
3674
|
}
|
|
@@ -3540,9 +3704,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3540
3704
|
};
|
|
3541
3705
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3542
3706
|
promise.resolve(result.body);
|
|
3543
|
-
}).catch((
|
|
3544
|
-
discard(
|
|
3545
|
-
|
|
3707
|
+
}).catch((e) => {
|
|
3708
|
+
discard(e, fullOfflineAction);
|
|
3709
|
+
if (e instanceof Error) {
|
|
3710
|
+
promise.reject(e);
|
|
3711
|
+
} else {
|
|
3712
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3713
|
+
}
|
|
3546
3714
|
});
|
|
3547
3715
|
} else {
|
|
3548
3716
|
const innerPromise = this.store.dispatch(
|
|
@@ -3596,10 +3764,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3596
3764
|
}
|
|
3597
3765
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3598
3766
|
function parseTokens(response) {
|
|
3599
|
-
if (!response.access)
|
|
3600
|
-
|
|
3601
|
-
if (!response.refresh)
|
|
3602
|
-
throw new Error("Missing refresh token");
|
|
3767
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3768
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3603
3769
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3604
3770
|
}
|
|
3605
3771
|
class JWTService extends BaseAuthService {
|
|
@@ -3636,8 +3802,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3636
3802
|
this.clearAuth();
|
|
3637
3803
|
return void 0;
|
|
3638
3804
|
}
|
|
3639
|
-
if (!response.access)
|
|
3640
|
-
throw new Error("Missing access token");
|
|
3805
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3641
3806
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3642
3807
|
});
|
|
3643
3808
|
}
|
|
@@ -3693,8 +3858,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3693
3858
|
return `Bearer ${accessToken}`;
|
|
3694
3859
|
}
|
|
3695
3860
|
async prepareAuth() {
|
|
3696
|
-
if (!this.tokenIsExpiringSoon())
|
|
3697
|
-
return;
|
|
3861
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3698
3862
|
console.debug(this.constructor.name, "preparing auth");
|
|
3699
3863
|
try {
|
|
3700
3864
|
await this.renewTokens();
|
|
@@ -3702,7 +3866,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3702
3866
|
if (e instanceof APIError) {
|
|
3703
3867
|
this.clearAuth();
|
|
3704
3868
|
}
|
|
3705
|
-
|
|
3869
|
+
if (e instanceof Error) {
|
|
3870
|
+
return Promise.reject(e);
|
|
3871
|
+
} else {
|
|
3872
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3873
|
+
}
|
|
3706
3874
|
}
|
|
3707
3875
|
}
|
|
3708
3876
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -3733,7 +3901,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3733
3901
|
async initAuth(payload) {
|
|
3734
3902
|
const uuid$1 = uuid.v4();
|
|
3735
3903
|
console.debug(this.constructor.name, "Initiating auth");
|
|
3736
|
-
|
|
3904
|
+
return this.enqueueRequest({
|
|
3737
3905
|
uuid: uuid$1,
|
|
3738
3906
|
description: "Get token pair",
|
|
3739
3907
|
method: HttpMethod.POST,
|
|
@@ -3741,25 +3909,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3741
3909
|
payload,
|
|
3742
3910
|
isAuthNeeded: false,
|
|
3743
3911
|
checkAuth: false,
|
|
3912
|
+
immediate: true,
|
|
3744
3913
|
blockers: [],
|
|
3745
3914
|
blocks: []
|
|
3746
|
-
}).then(
|
|
3747
|
-
|
|
3748
|
-
let timedOut = false;
|
|
3749
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3750
|
-
setTimeout(() => {
|
|
3751
|
-
timedOut = true;
|
|
3752
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
3753
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
3754
|
-
}, timeout * 1e3);
|
|
3755
|
-
});
|
|
3756
|
-
const successPromise = promise.then((tokens) => {
|
|
3757
|
-
if (timedOut) {
|
|
3758
|
-
return void 0;
|
|
3759
|
-
}
|
|
3760
|
-
this.setTokens(tokens);
|
|
3915
|
+
}).then((tokens) => {
|
|
3916
|
+
this.setTokens(parseTokens(tokens));
|
|
3761
3917
|
});
|
|
3762
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3763
3918
|
}
|
|
3764
3919
|
}
|
|
3765
3920
|
class BaseApiService extends BaseService {
|
|
@@ -3785,9 +3940,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3785
3940
|
description: "Create Category",
|
|
3786
3941
|
method: HttpMethod.POST,
|
|
3787
3942
|
url: "/categories/",
|
|
3788
|
-
queryParams: {
|
|
3789
|
-
workspace_id: payload.workspace.toString()
|
|
3790
|
-
},
|
|
3791
3943
|
payload: offlineCategory,
|
|
3792
3944
|
blockers: [payload.workspace],
|
|
3793
3945
|
blocks: [offlineCategory.offline_id]
|
|
@@ -3870,15 +4022,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3870
4022
|
description: "Create asset",
|
|
3871
4023
|
method: HttpMethod.POST,
|
|
3872
4024
|
url: "/assets/",
|
|
3873
|
-
payload:
|
|
3874
|
-
offline_id: offlineAsset.offline_id,
|
|
3875
|
-
submitted_at: offlineAsset.submitted_at,
|
|
3876
|
-
geo_marker: offlineAsset.geo_marker,
|
|
3877
|
-
canvas_marker: offlineAsset.canvas_marker,
|
|
3878
|
-
label: offlineAsset.label,
|
|
3879
|
-
description: offlineAsset.description,
|
|
3880
|
-
asset_type: offlineAsset.asset_type
|
|
3881
|
-
},
|
|
4025
|
+
payload: offlineAsset,
|
|
3882
4026
|
blockers: [offlineAsset.asset_type],
|
|
3883
4027
|
blocks: [offlineAsset.offline_id]
|
|
3884
4028
|
});
|
|
@@ -3922,8 +4066,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3922
4066
|
const { store } = this.client;
|
|
3923
4067
|
const state = store.getState();
|
|
3924
4068
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3925
|
-
if (!assetToBeDeleted)
|
|
3926
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
4069
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
3927
4070
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3928
4071
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3929
4072
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3946,15 +4089,15 @@ var __publicField = (obj, key, value) => {
|
|
|
3946
4089
|
url: `/assets/${id}/`,
|
|
3947
4090
|
blockers: [id],
|
|
3948
4091
|
blocks: []
|
|
3949
|
-
}).catch((
|
|
4092
|
+
}).catch((e) => {
|
|
3950
4093
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3951
4094
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3952
4095
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3953
4096
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3954
|
-
throw
|
|
4097
|
+
throw e;
|
|
3955
4098
|
});
|
|
3956
4099
|
}
|
|
3957
|
-
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
4100
|
+
bulkAdd(payloads, assetTypeId, projectId, batchSize) {
|
|
3958
4101
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3959
4102
|
const transactionId = uuid.v4();
|
|
3960
4103
|
const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
|
|
@@ -3965,6 +4108,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3965
4108
|
transaction_id: transactionId,
|
|
3966
4109
|
submitted_at: submittedAt,
|
|
3967
4110
|
asset_type: assetTypeId,
|
|
4111
|
+
project: projectId,
|
|
3968
4112
|
assets: assetPayloads
|
|
3969
4113
|
}
|
|
3970
4114
|
};
|
|
@@ -3975,17 +4119,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3975
4119
|
const { batchId, payload } = assetBatch;
|
|
3976
4120
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3977
4121
|
const blockers = [assetTypeId];
|
|
3978
|
-
if (prevBatchId)
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
blocks2.push(batchId);
|
|
4122
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
4123
|
+
const blocks = batchAssetOfflineIds;
|
|
4124
|
+
blocks.push(batchId);
|
|
3982
4125
|
const promise = this.enqueueRequest({
|
|
3983
4126
|
description: "Batch create assets",
|
|
3984
4127
|
method: HttpMethod.POST,
|
|
3985
4128
|
url: "/assets/bulk/",
|
|
3986
4129
|
payload,
|
|
3987
4130
|
blockers,
|
|
3988
|
-
blocks
|
|
4131
|
+
blocks
|
|
3989
4132
|
});
|
|
3990
4133
|
prevBatchId = assetBatch.batchId;
|
|
3991
4134
|
batchPromises.push(promise);
|
|
@@ -4000,7 +4143,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4000
4143
|
const result = await this.enqueueRequest({
|
|
4001
4144
|
description: "Get assets",
|
|
4002
4145
|
method: HttpMethod.GET,
|
|
4003
|
-
url:
|
|
4146
|
+
url: "/assets/",
|
|
4147
|
+
queryParams: {
|
|
4148
|
+
project: projectId.toString()
|
|
4149
|
+
},
|
|
4004
4150
|
blockers: [],
|
|
4005
4151
|
blocks: []
|
|
4006
4152
|
});
|
|
@@ -4021,7 +4167,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4021
4167
|
const promise = this.enqueueRequest({
|
|
4022
4168
|
description: "Add asset stage completion",
|
|
4023
4169
|
method: HttpMethod.POST,
|
|
4024
|
-
url: "/
|
|
4170
|
+
url: "/asset-stage-completions/",
|
|
4025
4171
|
payload: {
|
|
4026
4172
|
offline_id: offlineStageCompletion.offline_id,
|
|
4027
4173
|
submitted_at: submittedAt,
|
|
@@ -4048,7 +4194,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4048
4194
|
const promise = this.enqueueRequest({
|
|
4049
4195
|
description: "Delete asset stage completion",
|
|
4050
4196
|
method: HttpMethod.DELETE,
|
|
4051
|
-
url: `/
|
|
4197
|
+
url: `/asset-stage-completions/${id}/`,
|
|
4052
4198
|
blockers: [id],
|
|
4053
4199
|
blocks: []
|
|
4054
4200
|
});
|
|
@@ -4074,7 +4220,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4074
4220
|
const promise = this.enqueueRequest({
|
|
4075
4221
|
description: "Bulk create asset stage completions",
|
|
4076
4222
|
method: HttpMethod.POST,
|
|
4077
|
-
url: "/
|
|
4223
|
+
url: "/asset-stage-completions/bulk/",
|
|
4078
4224
|
payload: {
|
|
4079
4225
|
submitted_at: submittedAt,
|
|
4080
4226
|
completions: payload
|
|
@@ -4096,7 +4242,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4096
4242
|
const promise = this.enqueueRequest({
|
|
4097
4243
|
description: "Deleting asset stage completions",
|
|
4098
4244
|
method: HttpMethod.DELETE,
|
|
4099
|
-
url: "/
|
|
4245
|
+
url: "/asset-stage-completions/bulk/",
|
|
4100
4246
|
payload: {
|
|
4101
4247
|
completion_ids: ids
|
|
4102
4248
|
},
|
|
@@ -4112,7 +4258,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4112
4258
|
const result = await this.enqueueRequest({
|
|
4113
4259
|
description: "Get asset stage completions",
|
|
4114
4260
|
method: HttpMethod.GET,
|
|
4115
|
-
url:
|
|
4261
|
+
url: "/asset-stage-completions/",
|
|
4262
|
+
queryParams: {
|
|
4263
|
+
project: projectId.toString()
|
|
4264
|
+
},
|
|
4116
4265
|
blockers: [],
|
|
4117
4266
|
blocks: []
|
|
4118
4267
|
});
|
|
@@ -4133,7 +4282,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4133
4282
|
const promise = this.enqueueRequest({
|
|
4134
4283
|
description: "Add asset stages",
|
|
4135
4284
|
method: HttpMethod.POST,
|
|
4136
|
-
url: "/
|
|
4285
|
+
url: "/asset-stages/bulk/",
|
|
4137
4286
|
payload: {
|
|
4138
4287
|
submitted_at: submittedAt,
|
|
4139
4288
|
asset_type: assetTypeId,
|
|
@@ -4157,7 +4306,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4157
4306
|
return this.enqueueRequest({
|
|
4158
4307
|
description: "Edit asset stages",
|
|
4159
4308
|
method: HttpMethod.PATCH,
|
|
4160
|
-
url: `/
|
|
4309
|
+
url: `/asset-types/${assetTypeId}/bulk-update-stages/`,
|
|
4161
4310
|
payload: {
|
|
4162
4311
|
stages: stagesToUpdate
|
|
4163
4312
|
},
|
|
@@ -4175,7 +4324,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4175
4324
|
const promise = this.enqueueRequest({
|
|
4176
4325
|
description: "Delete asset stages",
|
|
4177
4326
|
method: HttpMethod.DELETE,
|
|
4178
|
-
url: "/
|
|
4327
|
+
url: "/asset-stages/bulk/",
|
|
4179
4328
|
payload: {
|
|
4180
4329
|
stage_ids: idsToDelete
|
|
4181
4330
|
},
|
|
@@ -4190,8 +4339,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4190
4339
|
update(payload) {
|
|
4191
4340
|
const { store } = this.client;
|
|
4192
4341
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4193
|
-
if (!assetStage)
|
|
4194
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4342
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4195
4343
|
const updatedAssetStage = {
|
|
4196
4344
|
...assetStage,
|
|
4197
4345
|
...payload
|
|
@@ -4200,7 +4348,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4200
4348
|
const promise = this.enqueueRequest({
|
|
4201
4349
|
description: "Update asset stage",
|
|
4202
4350
|
method: HttpMethod.PATCH,
|
|
4203
|
-
url: `/
|
|
4351
|
+
url: `/asset-stages/${assetStage.offline_id}/`,
|
|
4204
4352
|
payload: {
|
|
4205
4353
|
name: payload.name,
|
|
4206
4354
|
description: payload.description,
|
|
@@ -4217,52 +4365,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4217
4365
|
});
|
|
4218
4366
|
return [updatedAssetStage, promise];
|
|
4219
4367
|
}
|
|
4220
|
-
async
|
|
4221
|
-
const { store } = this.client;
|
|
4222
|
-
const stage = store.getState().assetStageReducer.instances[stageId];
|
|
4223
|
-
if (!stage) {
|
|
4224
|
-
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4225
|
-
}
|
|
4226
|
-
this.dispatch(updateAssetStage({ ...stage, form: formId }));
|
|
4227
|
-
try {
|
|
4228
|
-
await this.enqueueRequest({
|
|
4229
|
-
description: "Link asset stage to form",
|
|
4230
|
-
method: HttpMethod.POST,
|
|
4231
|
-
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4232
|
-
payload: { form: formId },
|
|
4233
|
-
blockers: [stageId, formId],
|
|
4234
|
-
blocks: [stageId]
|
|
4235
|
-
});
|
|
4236
|
-
} catch (e) {
|
|
4237
|
-
this.dispatch(setAssetStage(stage));
|
|
4238
|
-
throw e;
|
|
4239
|
-
}
|
|
4240
|
-
}
|
|
4241
|
-
async unlinkForm(stageId, formId) {
|
|
4242
|
-
const { store } = this.client;
|
|
4243
|
-
const stage = store.getState().assetStageReducer.instances[stageId];
|
|
4244
|
-
if (!stage) {
|
|
4245
|
-
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4246
|
-
}
|
|
4247
|
-
this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
|
|
4248
|
-
try {
|
|
4249
|
-
await this.enqueueRequest({
|
|
4250
|
-
description: "Unlink asset stage from form",
|
|
4251
|
-
method: HttpMethod.DELETE,
|
|
4252
|
-
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4253
|
-
blockers: [stageId, formId],
|
|
4254
|
-
blocks: [stageId]
|
|
4255
|
-
});
|
|
4256
|
-
} catch (e) {
|
|
4257
|
-
this.dispatch(setAssetStage(stage));
|
|
4258
|
-
throw e;
|
|
4259
|
-
}
|
|
4260
|
-
}
|
|
4261
|
-
async refreshStore(projectId) {
|
|
4368
|
+
async refreshStore(organizationId) {
|
|
4262
4369
|
const result = await this.enqueueRequest({
|
|
4263
4370
|
description: "Get asset stages",
|
|
4264
4371
|
method: HttpMethod.GET,
|
|
4265
|
-
url:
|
|
4372
|
+
url: "/asset-stages/",
|
|
4373
|
+
queryParams: {
|
|
4374
|
+
organization: organizationId.toString()
|
|
4375
|
+
},
|
|
4266
4376
|
blockers: [],
|
|
4267
4377
|
blocks: []
|
|
4268
4378
|
});
|
|
@@ -4279,7 +4389,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4279
4389
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4280
4390
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4281
4391
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4282
|
-
geoImageReducer: geoImageReducer2
|
|
4392
|
+
geoImageReducer: geoImageReducer2,
|
|
4393
|
+
// fields
|
|
4394
|
+
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4395
|
+
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4396
|
+
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4397
|
+
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4283
4398
|
} = this.client.store.getState();
|
|
4284
4399
|
const objectsWithSha1 = [].concat(
|
|
4285
4400
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4289,7 +4404,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4289
4404
|
Object.values(projectAttachmentReducer2.instances),
|
|
4290
4405
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4291
4406
|
Object.values(formSubmissionAttachmentReducer2.instances),
|
|
4292
|
-
Object.values(geoImageReducer2.instances)
|
|
4407
|
+
Object.values(geoImageReducer2.instances),
|
|
4408
|
+
Object.values(assetTypeFieldsAttachmentReducer2.instances),
|
|
4409
|
+
Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
|
|
4410
|
+
Object.values(issueTypeFieldsAttachmentReducer2.instances),
|
|
4411
|
+
Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
|
|
4293
4412
|
);
|
|
4294
4413
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4295
4414
|
}
|
|
@@ -4311,41 +4430,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4311
4430
|
}
|
|
4312
4431
|
return promisesBySha1;
|
|
4313
4432
|
}
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
attachUrlPrefix: "/assets",
|
|
4325
|
-
deleteUrlPrefix: "/assets",
|
|
4326
|
-
fetchUrlPostfix: "/asset-attachments"
|
|
4327
|
-
},
|
|
4328
|
-
[AttachmentModel.AssetType]: {
|
|
4329
|
-
name: "asset type",
|
|
4330
|
-
attachUrlPrefix: "/assets/types",
|
|
4331
|
-
deleteUrlPrefix: "/assets/types",
|
|
4332
|
-
fetchUrlPostfix: "/asset-type-attachments"
|
|
4333
|
-
},
|
|
4334
|
-
[AttachmentModel.Project]: {
|
|
4335
|
-
name: "project",
|
|
4336
|
-
attachUrlPrefix: "/projects",
|
|
4337
|
-
deleteUrlPrefix: "/projects",
|
|
4338
|
-
fetchUrlPostfix: "/attachments"
|
|
4339
|
-
},
|
|
4340
|
-
[AttachmentModel.Document]: {
|
|
4341
|
-
name: "document",
|
|
4342
|
-
attachUrlPrefix: "/documents",
|
|
4343
|
-
deleteUrlPrefix: "/documents",
|
|
4344
|
-
fetchUrlPostfix: "/document-attachments"
|
|
4433
|
+
async getFilePayload(file) {
|
|
4434
|
+
const sha1 = await hashFile(file);
|
|
4435
|
+
const filePayload = {
|
|
4436
|
+
sha1,
|
|
4437
|
+
file_type: file.type,
|
|
4438
|
+
extension: file.name.split(".").pop(),
|
|
4439
|
+
size: file.size
|
|
4440
|
+
};
|
|
4441
|
+
await this.client.files.addCache(file, sha1);
|
|
4442
|
+
return filePayload;
|
|
4345
4443
|
}
|
|
4346
|
-
}
|
|
4444
|
+
}
|
|
4347
4445
|
class BaseAttachmentService extends BaseUploadService {
|
|
4348
|
-
async
|
|
4446
|
+
async _bulkAdd(payloads) {
|
|
4349
4447
|
var _a2;
|
|
4350
4448
|
const { store } = this.client;
|
|
4351
4449
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4353,39 +4451,35 @@ var __publicField = (obj, key, value) => {
|
|
|
4353
4451
|
const offlineAttachments = [];
|
|
4354
4452
|
const attachmentPayloads = [];
|
|
4355
4453
|
const filePayloads = {};
|
|
4356
|
-
for (const
|
|
4357
|
-
const
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
file_type: file.type,
|
|
4362
|
-
extension: file.name.split(".").pop(),
|
|
4363
|
-
size: file.size
|
|
4364
|
-
};
|
|
4365
|
-
await this.client.files.addCache(file, sha1);
|
|
4366
|
-
}
|
|
4367
|
-
const offlineAttachment = buildOfflineAttachment({
|
|
4454
|
+
for (const payload of payloads) {
|
|
4455
|
+
const { modelId, file } = payload;
|
|
4456
|
+
const filePayload = await this.getFilePayload(file);
|
|
4457
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
4458
|
+
const offlineAttachment = this.buildOfflineAttachment({
|
|
4368
4459
|
file,
|
|
4369
|
-
sha1,
|
|
4370
|
-
submittedAt,
|
|
4371
|
-
createdBy,
|
|
4460
|
+
file_sha1: filePayload.sha1,
|
|
4461
|
+
submitted_at: submittedAt,
|
|
4462
|
+
created_by: createdBy,
|
|
4372
4463
|
description: "",
|
|
4373
4464
|
modelId
|
|
4374
4465
|
});
|
|
4375
4466
|
offlineAttachments.push(offlineAttachment);
|
|
4376
|
-
attachmentPayloads.push(
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4467
|
+
attachmentPayloads.push(
|
|
4468
|
+
this.buildAttachmentPayload({
|
|
4469
|
+
offline_id: offlineAttachment.offline_id,
|
|
4470
|
+
file_name: offlineAttachment.file_name,
|
|
4471
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
4472
|
+
file_extension: filePayload.extension,
|
|
4473
|
+
description: offlineAttachment.description,
|
|
4474
|
+
modelId
|
|
4475
|
+
})
|
|
4476
|
+
);
|
|
4382
4477
|
}
|
|
4383
4478
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4384
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4385
4479
|
const promise = this.enqueueRequest({
|
|
4386
|
-
description: `
|
|
4480
|
+
description: `Add ${this.name}`,
|
|
4387
4481
|
method: HttpMethod.POST,
|
|
4388
|
-
url: `${
|
|
4482
|
+
url: `${this.url}/bulk/`,
|
|
4389
4483
|
payload: {
|
|
4390
4484
|
submitted_at: submittedAt,
|
|
4391
4485
|
attachments: attachmentPayloads,
|
|
@@ -4402,7 +4496,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4402
4496
|
});
|
|
4403
4497
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4404
4498
|
}
|
|
4405
|
-
async
|
|
4499
|
+
async _delete(attachmendId) {
|
|
4406
4500
|
const { store } = this.client;
|
|
4407
4501
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4408
4502
|
if (!attachment) {
|
|
@@ -4411,11 +4505,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4411
4505
|
);
|
|
4412
4506
|
}
|
|
4413
4507
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4414
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4415
4508
|
const promise = this.enqueueRequest({
|
|
4416
|
-
description:
|
|
4509
|
+
description: `Delete ${this.name}`,
|
|
4417
4510
|
method: HttpMethod.DELETE,
|
|
4418
|
-
url: `${
|
|
4511
|
+
url: `${this.url}/${attachmendId}/`,
|
|
4419
4512
|
blockers: [attachmendId],
|
|
4420
4513
|
blocks: []
|
|
4421
4514
|
});
|
|
@@ -4428,24 +4521,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4428
4521
|
});
|
|
4429
4522
|
return promise;
|
|
4430
4523
|
}
|
|
4431
|
-
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4432
|
-
// so for some attachment model services, this method will have to be overridden.
|
|
4433
|
-
async refreshStore(projectId, _organizationId) {
|
|
4434
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4435
|
-
const result = await this.enqueueRequest({
|
|
4436
|
-
description: `Get ${meta.name} attachments`,
|
|
4437
|
-
method: HttpMethod.GET,
|
|
4438
|
-
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4439
|
-
blocks: [],
|
|
4440
|
-
blockers: []
|
|
4441
|
-
});
|
|
4442
|
-
this.dispatch(this.initializeAttachments(result));
|
|
4443
|
-
}
|
|
4444
4524
|
}
|
|
4445
4525
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4446
4526
|
constructor() {
|
|
4447
4527
|
super(...arguments);
|
|
4448
|
-
__publicField(this, "
|
|
4528
|
+
__publicField(this, "name", "Asset Attachment");
|
|
4529
|
+
__publicField(this, "url", "/asset-attachments");
|
|
4449
4530
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4450
4531
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4451
4532
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4457,20 +4538,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4457
4538
|
buildOfflineAttachment(data) {
|
|
4458
4539
|
return offline({
|
|
4459
4540
|
file: URL.createObjectURL(data.file),
|
|
4460
|
-
file_sha1: data.
|
|
4461
|
-
created_by: data.
|
|
4541
|
+
file_sha1: data.file_sha1,
|
|
4542
|
+
created_by: data.created_by,
|
|
4462
4543
|
file_name: data.file.name,
|
|
4463
4544
|
file_type: data.file.type,
|
|
4464
|
-
submitted_at: data.
|
|
4545
|
+
submitted_at: data.submitted_at,
|
|
4465
4546
|
description: data.description,
|
|
4466
4547
|
asset: data.modelId
|
|
4467
4548
|
});
|
|
4468
4549
|
}
|
|
4469
|
-
|
|
4470
|
-
return
|
|
4550
|
+
buildAttachmentPayload(data) {
|
|
4551
|
+
return {
|
|
4552
|
+
...data,
|
|
4553
|
+
asset: data.modelId
|
|
4554
|
+
};
|
|
4555
|
+
}
|
|
4556
|
+
async bulkAdd(payloads) {
|
|
4557
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
|
|
4558
|
+
}
|
|
4559
|
+
async delete(id) {
|
|
4560
|
+
return this._delete(id);
|
|
4471
4561
|
}
|
|
4472
|
-
async
|
|
4473
|
-
|
|
4562
|
+
async refreshStore(projectId) {
|
|
4563
|
+
const result = await this.enqueueRequest({
|
|
4564
|
+
description: "Get asset attachments",
|
|
4565
|
+
method: HttpMethod.GET,
|
|
4566
|
+
url: `${this.url}/`,
|
|
4567
|
+
queryParams: {
|
|
4568
|
+
project: projectId.toString()
|
|
4569
|
+
},
|
|
4570
|
+
blocks: [],
|
|
4571
|
+
blockers: []
|
|
4572
|
+
});
|
|
4573
|
+
this.dispatch(initializeAssetAttachments(result));
|
|
4474
4574
|
}
|
|
4475
4575
|
}
|
|
4476
4576
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4487,8 +4587,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4487
4587
|
const promise = this.enqueueRequest({
|
|
4488
4588
|
description: "Create asset type",
|
|
4489
4589
|
method: HttpMethod.POST,
|
|
4490
|
-
url:
|
|
4491
|
-
payload:
|
|
4590
|
+
url: "/asset-types/",
|
|
4591
|
+
payload: offlineAssetType,
|
|
4492
4592
|
blockers: [],
|
|
4493
4593
|
blocks: [offlineAssetType.offline_id]
|
|
4494
4594
|
});
|
|
@@ -4513,7 +4613,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4513
4613
|
const promise = this.enqueueRequest({
|
|
4514
4614
|
description: "Update asset type",
|
|
4515
4615
|
method: HttpMethod.PATCH,
|
|
4516
|
-
url: `/
|
|
4616
|
+
url: `/asset-types/${payload.offline_id}/`,
|
|
4517
4617
|
payload: {
|
|
4518
4618
|
icon: payload.icon,
|
|
4519
4619
|
color: payload.color,
|
|
@@ -4547,7 +4647,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4547
4647
|
return this.enqueueRequest({
|
|
4548
4648
|
description: "Delete asset type",
|
|
4549
4649
|
method: HttpMethod.DELETE,
|
|
4550
|
-
url: `/
|
|
4650
|
+
url: `/asset-types/${assetTypeId}/`,
|
|
4551
4651
|
blockers: [assetTypeId],
|
|
4552
4652
|
blocks: []
|
|
4553
4653
|
}).catch((e) => {
|
|
@@ -4558,11 +4658,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4558
4658
|
throw e;
|
|
4559
4659
|
});
|
|
4560
4660
|
}
|
|
4561
|
-
async refreshStore(
|
|
4661
|
+
async refreshStore(organizationId) {
|
|
4562
4662
|
const result = await this.enqueueRequest({
|
|
4563
4663
|
description: "Get asset types",
|
|
4564
4664
|
method: HttpMethod.GET,
|
|
4565
|
-
url:
|
|
4665
|
+
url: "/asset-types/",
|
|
4666
|
+
queryParams: {
|
|
4667
|
+
organization: organizationId.toString()
|
|
4668
|
+
},
|
|
4566
4669
|
blockers: [],
|
|
4567
4670
|
blocks: []
|
|
4568
4671
|
});
|
|
@@ -4572,8 +4675,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4572
4675
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4573
4676
|
constructor() {
|
|
4574
4677
|
super(...arguments);
|
|
4575
|
-
__publicField(this, "
|
|
4576
|
-
__publicField(this, "
|
|
4678
|
+
__publicField(this, "name", "Asset Type Attachment");
|
|
4679
|
+
__publicField(this, "url", "/asset-type-attachments");
|
|
4577
4680
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4578
4681
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4579
4682
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4584,20 +4687,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4584
4687
|
buildOfflineAttachment(data) {
|
|
4585
4688
|
return offline({
|
|
4586
4689
|
file: URL.createObjectURL(data.file),
|
|
4587
|
-
file_sha1: data.
|
|
4588
|
-
created_by: data.
|
|
4690
|
+
file_sha1: data.file_sha1,
|
|
4691
|
+
created_by: data.created_by,
|
|
4589
4692
|
file_name: data.file.name,
|
|
4590
4693
|
file_type: data.file.type,
|
|
4591
|
-
submitted_at: data.
|
|
4694
|
+
submitted_at: data.submitted_at,
|
|
4592
4695
|
description: data.description,
|
|
4593
4696
|
asset_type: data.modelId
|
|
4594
4697
|
});
|
|
4595
4698
|
}
|
|
4596
|
-
|
|
4597
|
-
return
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4699
|
+
buildAttachmentPayload(data) {
|
|
4700
|
+
return {
|
|
4701
|
+
...data,
|
|
4702
|
+
asset_type: data.modelId
|
|
4703
|
+
};
|
|
4704
|
+
}
|
|
4705
|
+
async bulkAdd(payloads) {
|
|
4706
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
|
|
4707
|
+
}
|
|
4708
|
+
async delete(attachmentId) {
|
|
4709
|
+
return this._delete(attachmentId);
|
|
4710
|
+
}
|
|
4711
|
+
async refreshStore(organizationId) {
|
|
4712
|
+
const result = await this.enqueueRequest({
|
|
4713
|
+
description: "Get asset type attachments",
|
|
4714
|
+
method: HttpMethod.GET,
|
|
4715
|
+
url: `${this.url}/`,
|
|
4716
|
+
queryParams: {
|
|
4717
|
+
organization: organizationId.toString()
|
|
4718
|
+
},
|
|
4719
|
+
blocks: [],
|
|
4720
|
+
blockers: []
|
|
4721
|
+
});
|
|
4722
|
+
this.dispatch(initializeAssetTypeAttachments(result));
|
|
4601
4723
|
}
|
|
4602
4724
|
}
|
|
4603
4725
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4613,7 +4735,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4613
4735
|
const promise = this.enqueueRequest({
|
|
4614
4736
|
description: "Add issue comment",
|
|
4615
4737
|
method: HttpMethod.POST,
|
|
4616
|
-
url:
|
|
4738
|
+
url: "/issue-comments/",
|
|
4617
4739
|
payload: offlineComment,
|
|
4618
4740
|
blockers: [payload.issue],
|
|
4619
4741
|
blocks: [offlineComment.offline_id]
|
|
@@ -4637,7 +4759,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4637
4759
|
const promise = this.enqueueRequest({
|
|
4638
4760
|
description: "Edit issue comment",
|
|
4639
4761
|
method: HttpMethod.PATCH,
|
|
4640
|
-
url: `/
|
|
4762
|
+
url: `/issue-comments/${payload.offline_id}/`,
|
|
4641
4763
|
payload,
|
|
4642
4764
|
blockers: [payload.offline_id],
|
|
4643
4765
|
blocks: [payload.offline_id]
|
|
@@ -4656,7 +4778,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4656
4778
|
const promise = this.enqueueRequest({
|
|
4657
4779
|
description: "Delete comment",
|
|
4658
4780
|
method: HttpMethod.DELETE,
|
|
4659
|
-
url: `/
|
|
4781
|
+
url: `/issue-comments/${id}/`,
|
|
4660
4782
|
blockers: [id],
|
|
4661
4783
|
blocks: []
|
|
4662
4784
|
});
|
|
@@ -4669,7 +4791,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4669
4791
|
const result = await this.enqueueRequest({
|
|
4670
4792
|
description: "Get comments",
|
|
4671
4793
|
method: HttpMethod.GET,
|
|
4672
|
-
url:
|
|
4794
|
+
url: "/issue-comments/",
|
|
4795
|
+
queryParams: {
|
|
4796
|
+
project: projectId.toString()
|
|
4797
|
+
},
|
|
4673
4798
|
blockers: [],
|
|
4674
4799
|
blocks: []
|
|
4675
4800
|
});
|
|
@@ -4681,27 +4806,21 @@ var __publicField = (obj, key, value) => {
|
|
|
4681
4806
|
const result = await this.enqueueRequest({
|
|
4682
4807
|
description: "Get issue updates",
|
|
4683
4808
|
method: HttpMethod.GET,
|
|
4684
|
-
url:
|
|
4809
|
+
url: "/issue-updates/",
|
|
4810
|
+
queryParams: {
|
|
4811
|
+
project: projectId.toString()
|
|
4812
|
+
},
|
|
4685
4813
|
blockers: [],
|
|
4686
4814
|
blocks: []
|
|
4687
4815
|
});
|
|
4688
|
-
|
|
4689
|
-
filteredResult = filteredResult.map((comment) => {
|
|
4690
|
-
return { ...comment };
|
|
4691
|
-
});
|
|
4692
|
-
if (result.length !== filteredResult.length) {
|
|
4693
|
-
console.error(
|
|
4694
|
-
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4695
|
-
);
|
|
4696
|
-
}
|
|
4697
|
-
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
4816
|
+
this.dispatch(initializeIssueUpdates(result));
|
|
4698
4817
|
}
|
|
4699
4818
|
}
|
|
4700
4819
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
4701
4820
|
constructor() {
|
|
4702
4821
|
super(...arguments);
|
|
4703
|
-
__publicField(this, "
|
|
4704
|
-
__publicField(this, "
|
|
4822
|
+
__publicField(this, "name", "Issue Attachment");
|
|
4823
|
+
__publicField(this, "url", "/issue-attachments");
|
|
4705
4824
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
4706
4825
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
4707
4826
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -4712,24 +4831,42 @@ var __publicField = (obj, key, value) => {
|
|
|
4712
4831
|
buildOfflineAttachment(data) {
|
|
4713
4832
|
return offline({
|
|
4714
4833
|
file: URL.createObjectURL(data.file),
|
|
4715
|
-
file_sha1: data.
|
|
4716
|
-
created_by: data.
|
|
4834
|
+
file_sha1: data.file_sha1,
|
|
4835
|
+
created_by: data.created_by,
|
|
4717
4836
|
file_name: data.file.name,
|
|
4718
4837
|
file_type: data.file.type,
|
|
4719
|
-
submitted_at: data.
|
|
4838
|
+
submitted_at: data.submitted_at,
|
|
4720
4839
|
description: data.description,
|
|
4721
4840
|
issue: data.modelId
|
|
4722
4841
|
});
|
|
4723
4842
|
}
|
|
4724
|
-
|
|
4725
|
-
return
|
|
4843
|
+
buildAttachmentPayload(data) {
|
|
4844
|
+
return {
|
|
4845
|
+
...data,
|
|
4846
|
+
issue: data.modelId
|
|
4847
|
+
};
|
|
4848
|
+
}
|
|
4849
|
+
async bulkAdd(payloads) {
|
|
4850
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
|
|
4851
|
+
}
|
|
4852
|
+
async delete(id) {
|
|
4853
|
+
return this._delete(id);
|
|
4726
4854
|
}
|
|
4727
|
-
async
|
|
4728
|
-
|
|
4855
|
+
async refreshStore(projectId) {
|
|
4856
|
+
const result = await this.enqueueRequest({
|
|
4857
|
+
description: "Get issue attachments",
|
|
4858
|
+
method: HttpMethod.GET,
|
|
4859
|
+
url: `${this.url}/`,
|
|
4860
|
+
queryParams: {
|
|
4861
|
+
project: projectId.toString()
|
|
4862
|
+
},
|
|
4863
|
+
blocks: [],
|
|
4864
|
+
blockers: []
|
|
4865
|
+
});
|
|
4866
|
+
this.dispatch(initializeIssueAttachments(result));
|
|
4729
4867
|
}
|
|
4730
4868
|
}
|
|
4731
4869
|
class IssueService extends BaseApiService {
|
|
4732
|
-
// Basic CRUD functions
|
|
4733
4870
|
add(payload) {
|
|
4734
4871
|
var _a2;
|
|
4735
4872
|
const { store } = this.client;
|
|
@@ -4746,10 +4883,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4746
4883
|
description: "Create issue",
|
|
4747
4884
|
method: HttpMethod.POST,
|
|
4748
4885
|
url: "/issues/",
|
|
4749
|
-
queryParams: {
|
|
4750
|
-
workspace_id: payload.index_workspace,
|
|
4751
|
-
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4752
|
-
},
|
|
4753
4886
|
payload: offlineIssue,
|
|
4754
4887
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
4755
4888
|
blocks: [offlineIssue.offline_id]
|
|
@@ -4785,7 +4918,18 @@ var __publicField = (obj, key, value) => {
|
|
|
4785
4918
|
]) {
|
|
4786
4919
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4787
4920
|
switch (issueUpdateChange) {
|
|
4788
|
-
case
|
|
4921
|
+
case IssueUpdateChange.PRIORITY:
|
|
4922
|
+
case IssueUpdateChange.STATUS: {
|
|
4923
|
+
const val = payload[issueUpdateChange];
|
|
4924
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4925
|
+
break;
|
|
4926
|
+
}
|
|
4927
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4928
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4929
|
+
case IssueUpdateChange.TITLE:
|
|
4930
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4931
|
+
break;
|
|
4932
|
+
case IssueUpdateChange.CATEGORY: {
|
|
4789
4933
|
let categoryOrNull = null;
|
|
4790
4934
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4791
4935
|
if (categoryIdOrNull) {
|
|
@@ -4802,7 +4946,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4802
4946
|
} : null;
|
|
4803
4947
|
break;
|
|
4804
4948
|
}
|
|
4805
|
-
case
|
|
4949
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4806
4950
|
let userOrNull = null;
|
|
4807
4951
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4808
4952
|
if (userIdOrNull) {
|
|
@@ -4818,20 +4962,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4818
4962
|
} : null;
|
|
4819
4963
|
break;
|
|
4820
4964
|
}
|
|
4821
|
-
case "description":
|
|
4822
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4823
|
-
break;
|
|
4824
|
-
case "title":
|
|
4825
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4826
|
-
break;
|
|
4827
|
-
case "priority":
|
|
4828
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4829
|
-
break;
|
|
4830
|
-
case "status":
|
|
4831
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4832
|
-
break;
|
|
4833
|
-
case "due_date":
|
|
4834
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
4835
4965
|
}
|
|
4836
4966
|
}
|
|
4837
4967
|
}
|
|
@@ -4902,7 +5032,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4902
5032
|
const result = await this.enqueueRequest({
|
|
4903
5033
|
description: "Get issues",
|
|
4904
5034
|
method: HttpMethod.GET,
|
|
4905
|
-
url:
|
|
5035
|
+
url: "/issues/",
|
|
5036
|
+
queryParams: {
|
|
5037
|
+
project: projectId.toString()
|
|
5038
|
+
},
|
|
4906
5039
|
blockers: [],
|
|
4907
5040
|
blocks: []
|
|
4908
5041
|
});
|
|
@@ -4922,16 +5055,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4922
5055
|
this.dispatch(addIssueType(offlineIssueType));
|
|
4923
5056
|
const promise = this.enqueueRequest({
|
|
4924
5057
|
method: HttpMethod.POST,
|
|
4925
|
-
url:
|
|
4926
|
-
|
|
4927
|
-
payload: {
|
|
4928
|
-
offline_id: offlineIssueType.offline_id,
|
|
4929
|
-
submitted_at: offlineIssueType.submitted_at,
|
|
4930
|
-
icon: offlineIssueType.icon,
|
|
4931
|
-
color: offlineIssueType.color,
|
|
4932
|
-
name: offlineIssueType.name,
|
|
4933
|
-
description: offlineIssueType.description
|
|
4934
|
-
},
|
|
5058
|
+
url: "/issue-types/",
|
|
5059
|
+
payload: offlineIssueType,
|
|
4935
5060
|
blockers: [],
|
|
4936
5061
|
blocks: [offlineIssueType.offline_id]
|
|
4937
5062
|
});
|
|
@@ -4956,7 +5081,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4956
5081
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
4957
5082
|
const promise = this.enqueueRequest({
|
|
4958
5083
|
method: HttpMethod.PATCH,
|
|
4959
|
-
url: `/
|
|
5084
|
+
url: `/issue-types/${payload.offline_id}/`,
|
|
4960
5085
|
payload,
|
|
4961
5086
|
blockers: [payload.offline_id],
|
|
4962
5087
|
blocks: [payload.offline_id]
|
|
@@ -4980,7 +5105,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4980
5105
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
4981
5106
|
const promise = this.enqueueRequest({
|
|
4982
5107
|
method: HttpMethod.DELETE,
|
|
4983
|
-
url: `/
|
|
5108
|
+
url: `/issue-types/${id}/`,
|
|
4984
5109
|
blockers: [id],
|
|
4985
5110
|
blocks: []
|
|
4986
5111
|
});
|
|
@@ -4993,7 +5118,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4993
5118
|
async refreshStore(organizationId) {
|
|
4994
5119
|
const result = await this.enqueueRequest({
|
|
4995
5120
|
method: HttpMethod.GET,
|
|
4996
|
-
url:
|
|
5121
|
+
url: "/issue-types/",
|
|
5122
|
+
queryParams: {
|
|
5123
|
+
organization: organizationId.toString()
|
|
5124
|
+
},
|
|
4997
5125
|
blockers: [],
|
|
4998
5126
|
blocks: []
|
|
4999
5127
|
});
|
|
@@ -5133,8 +5261,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5133
5261
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5134
5262
|
constructor() {
|
|
5135
5263
|
super(...arguments);
|
|
5136
|
-
__publicField(this, "
|
|
5137
|
-
__publicField(this, "
|
|
5264
|
+
__publicField(this, "name", "Project Attachment");
|
|
5265
|
+
__publicField(this, "url", "/project-attachments");
|
|
5138
5266
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5139
5267
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5140
5268
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5145,20 +5273,39 @@ var __publicField = (obj, key, value) => {
|
|
|
5145
5273
|
buildOfflineAttachment(data) {
|
|
5146
5274
|
return offline({
|
|
5147
5275
|
file: URL.createObjectURL(data.file),
|
|
5148
|
-
file_sha1: data.
|
|
5149
|
-
created_by: data.
|
|
5276
|
+
file_sha1: data.file_sha1,
|
|
5277
|
+
created_by: data.created_by,
|
|
5150
5278
|
file_name: data.file.name,
|
|
5151
5279
|
file_type: data.file.type,
|
|
5152
|
-
submitted_at: data.
|
|
5280
|
+
submitted_at: data.submitted_at,
|
|
5153
5281
|
description: data.description,
|
|
5154
5282
|
project: data.modelId
|
|
5155
5283
|
});
|
|
5156
5284
|
}
|
|
5157
|
-
|
|
5158
|
-
return
|
|
5285
|
+
buildAttachmentPayload(data) {
|
|
5286
|
+
return {
|
|
5287
|
+
...data,
|
|
5288
|
+
project: data.modelId
|
|
5289
|
+
};
|
|
5290
|
+
}
|
|
5291
|
+
async bulkAdd(payloads) {
|
|
5292
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
|
|
5293
|
+
}
|
|
5294
|
+
async delete(attachmentId) {
|
|
5295
|
+
return this._delete(attachmentId);
|
|
5159
5296
|
}
|
|
5160
|
-
async
|
|
5161
|
-
|
|
5297
|
+
async refreshStore(projectId) {
|
|
5298
|
+
const result = await this.enqueueRequest({
|
|
5299
|
+
description: "Get project attachments",
|
|
5300
|
+
method: HttpMethod.GET,
|
|
5301
|
+
url: `${this.url}/`,
|
|
5302
|
+
queryParams: {
|
|
5303
|
+
project: projectId.toString()
|
|
5304
|
+
},
|
|
5305
|
+
blockers: [],
|
|
5306
|
+
blocks: []
|
|
5307
|
+
});
|
|
5308
|
+
this.dispatch(initializeProjectAttachments(result));
|
|
5162
5309
|
}
|
|
5163
5310
|
}
|
|
5164
5311
|
class ProjectService extends BaseApiService {
|
|
@@ -5301,88 +5448,31 @@ var __publicField = (obj, key, value) => {
|
|
|
5301
5448
|
return { fields: newFields, images };
|
|
5302
5449
|
};
|
|
5303
5450
|
class FormService extends BaseUploadService {
|
|
5304
|
-
|
|
5451
|
+
add(payload, initialRevision) {
|
|
5305
5452
|
var _a2;
|
|
5453
|
+
const { store } = this.client;
|
|
5306
5454
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5307
|
-
const createdBy = (_a2 =
|
|
5308
|
-
const
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
const sha1 = await hashFile(file);
|
|
5313
|
-
if (!(sha1 in filePayloads)) {
|
|
5314
|
-
filePayloads[sha1] = {
|
|
5315
|
-
sha1,
|
|
5316
|
-
file_type: file.type,
|
|
5317
|
-
extension: file.name.split(".").pop(),
|
|
5318
|
-
size: file.size
|
|
5319
|
-
};
|
|
5320
|
-
await this.client.files.addCache(file, sha1);
|
|
5321
|
-
}
|
|
5322
|
-
const offlineFormRevisionAttachment = offline({
|
|
5323
|
-
file: URL.createObjectURL(file),
|
|
5324
|
-
file_type: file.type,
|
|
5325
|
-
file_name: file.name,
|
|
5326
|
-
file_sha1: sha1,
|
|
5327
|
-
created_by: createdBy,
|
|
5328
|
-
revision: revisionId,
|
|
5329
|
-
submitted_at: submittedAt,
|
|
5330
|
-
field_identifier: fieldIdentifier
|
|
5331
|
-
});
|
|
5332
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5333
|
-
const attachmentPayload = {
|
|
5334
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5335
|
-
name: file.name,
|
|
5336
|
-
field_identifier: fieldIdentifier,
|
|
5337
|
-
sha1
|
|
5338
|
-
};
|
|
5339
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5340
|
-
}
|
|
5341
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5342
|
-
const promise = this.enqueueRequest({
|
|
5343
|
-
description: "Attach files to form revision",
|
|
5344
|
-
method: HttpMethod.POST,
|
|
5345
|
-
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5346
|
-
payload: {
|
|
5347
|
-
submitted_at: submittedAt,
|
|
5348
|
-
attachments: attachmentPayloads,
|
|
5349
|
-
files: Object.values(filePayloads)
|
|
5350
|
-
},
|
|
5351
|
-
blockers: [revisionId],
|
|
5352
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5353
|
-
});
|
|
5354
|
-
promise.then((result) => {
|
|
5355
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5356
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5357
|
-
}).catch(() => {
|
|
5358
|
-
this.dispatch(
|
|
5359
|
-
deleteFormRevisionAttachments(
|
|
5360
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5361
|
-
)
|
|
5362
|
-
);
|
|
5455
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5456
|
+
const offlineForm = offline({
|
|
5457
|
+
...payload,
|
|
5458
|
+
submitted_at: submittedAt,
|
|
5459
|
+
created_by: createdBy
|
|
5363
5460
|
});
|
|
5364
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5365
|
-
}
|
|
5366
|
-
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5367
|
-
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5368
5461
|
const offlineFormRevision = offline({
|
|
5369
5462
|
...initialRevision,
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
revision: "Pending"
|
|
5463
|
+
form: offlineForm.offline_id,
|
|
5464
|
+
revision: "Pending",
|
|
5465
|
+
submitted_at: submittedAt,
|
|
5466
|
+
created_by: createdBy
|
|
5375
5467
|
});
|
|
5376
|
-
this.dispatch(addForm(
|
|
5468
|
+
this.dispatch(addForm(offlineForm));
|
|
5377
5469
|
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5378
5470
|
const formPromise = this.enqueueRequest({
|
|
5379
5471
|
description: "Create form",
|
|
5380
5472
|
method: HttpMethod.POST,
|
|
5381
|
-
url:
|
|
5473
|
+
url: "/forms/",
|
|
5382
5474
|
payload: {
|
|
5383
|
-
|
|
5384
|
-
offline_id: form.offline_id,
|
|
5385
|
-
submitted_at: form.submitted_at,
|
|
5475
|
+
...offlineForm,
|
|
5386
5476
|
initial_revision: {
|
|
5387
5477
|
offline_id: offlineFormRevision.offline_id,
|
|
5388
5478
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5391,111 +5481,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5391
5481
|
fields: offlineFormRevision.fields
|
|
5392
5482
|
}
|
|
5393
5483
|
},
|
|
5394
|
-
blockers: [
|
|
5395
|
-
blocks: [
|
|
5484
|
+
blockers: [],
|
|
5485
|
+
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5396
5486
|
});
|
|
5397
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5398
|
-
offlineFormRevision.offline_id,
|
|
5399
|
-
images
|
|
5400
|
-
);
|
|
5401
5487
|
void formPromise.catch((e) => {
|
|
5402
|
-
this.dispatch(deleteForm(
|
|
5488
|
+
this.dispatch(deleteForm(offlineForm.offline_id));
|
|
5403
5489
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5404
5490
|
throw e;
|
|
5405
5491
|
});
|
|
5406
|
-
return [
|
|
5407
|
-
}
|
|
5408
|
-
addForOrganization(organizationId, initialRevision) {
|
|
5409
|
-
var _a2;
|
|
5410
|
-
const state = this.client.store.getState();
|
|
5411
|
-
const offlineForm = offline({
|
|
5412
|
-
favorite: false,
|
|
5413
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5414
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5415
|
-
organization: organizationId
|
|
5416
|
-
});
|
|
5417
|
-
return this.add(
|
|
5418
|
-
organizationId.toString(),
|
|
5419
|
-
offlineForm,
|
|
5420
|
-
initialRevision,
|
|
5421
|
-
`/organizations/${organizationId}/create-form/`
|
|
5422
|
-
);
|
|
5423
|
-
}
|
|
5424
|
-
addForProject(projectId, initialRevision) {
|
|
5425
|
-
var _a2;
|
|
5426
|
-
const state = this.client.store.getState();
|
|
5427
|
-
const offlineForm = offline({
|
|
5428
|
-
favorite: false,
|
|
5429
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5430
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5431
|
-
project: projectId
|
|
5432
|
-
});
|
|
5433
|
-
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5434
|
-
}
|
|
5435
|
-
addForIssueType(issueTypeId, 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
|
-
issue_type: issueTypeId
|
|
5443
|
-
});
|
|
5444
|
-
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5445
|
-
}
|
|
5446
|
-
addForAssetType(assetTypeId, 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
|
-
asset_type: assetTypeId
|
|
5454
|
-
});
|
|
5455
|
-
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5456
|
-
}
|
|
5457
|
-
async createRevision(formId, revision) {
|
|
5458
|
-
var _a2;
|
|
5459
|
-
const offlineRevision = offline(revision);
|
|
5460
|
-
const { store } = this.client;
|
|
5461
|
-
const state = store.getState();
|
|
5462
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5463
|
-
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5464
|
-
const fullRevision = {
|
|
5465
|
-
...offlineRevision,
|
|
5466
|
-
fields,
|
|
5467
|
-
created_by: createdBy,
|
|
5468
|
-
revision: "Pending",
|
|
5469
|
-
form: formId,
|
|
5470
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5471
|
-
};
|
|
5472
|
-
this.dispatch(addFormRevision(fullRevision));
|
|
5473
|
-
const promise = this.enqueueRequest({
|
|
5474
|
-
description: "Create form revision",
|
|
5475
|
-
method: HttpMethod.PATCH,
|
|
5476
|
-
url: `/forms/${formId}/`,
|
|
5477
|
-
payload: {
|
|
5478
|
-
initial_revision: {
|
|
5479
|
-
offline_id: fullRevision.offline_id,
|
|
5480
|
-
submitted_at: fullRevision.submitted_at,
|
|
5481
|
-
title: fullRevision.title,
|
|
5482
|
-
description: fullRevision.description,
|
|
5483
|
-
fields: fullRevision.fields
|
|
5484
|
-
}
|
|
5485
|
-
},
|
|
5486
|
-
blockers: [formId],
|
|
5487
|
-
blocks: [offlineRevision.offline_id]
|
|
5488
|
-
});
|
|
5489
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5490
|
-
fullRevision.offline_id,
|
|
5491
|
-
images
|
|
5492
|
-
);
|
|
5493
|
-
void promise.then((result) => {
|
|
5494
|
-
this.dispatch(setFormRevision(result));
|
|
5495
|
-
}).catch(() => {
|
|
5496
|
-
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5497
|
-
});
|
|
5498
|
-
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5492
|
+
return [offlineForm, offlineFormRevision, formPromise];
|
|
5499
5493
|
}
|
|
5500
5494
|
async delete(id) {
|
|
5501
5495
|
const { store } = this.client;
|
|
@@ -5532,65 +5526,18 @@ var __publicField = (obj, key, value) => {
|
|
|
5532
5526
|
throw e;
|
|
5533
5527
|
}
|
|
5534
5528
|
}
|
|
5535
|
-
async refreshStore(
|
|
5536
|
-
const forms =
|
|
5537
|
-
const revisions = [];
|
|
5538
|
-
const attachments = [];
|
|
5539
|
-
const projectFormsResult = await this.enqueueRequest({
|
|
5540
|
-
description: "Fetch project forms",
|
|
5541
|
-
method: HttpMethod.GET,
|
|
5542
|
-
url: `/projects/${projectId}/forms/`,
|
|
5543
|
-
blockers: [projectId.toString()],
|
|
5544
|
-
blocks: []
|
|
5545
|
-
});
|
|
5546
|
-
for (const form of projectFormsResult.forms)
|
|
5547
|
-
forms.push(form);
|
|
5548
|
-
for (const revision of projectFormsResult.revisions)
|
|
5549
|
-
revisions.push(revision);
|
|
5550
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5551
|
-
attachments.push(attachment);
|
|
5552
|
-
const organizationFormsResult = await this.enqueueRequest({
|
|
5529
|
+
async refreshStore(organizationId) {
|
|
5530
|
+
const forms = await this.enqueueRequest({
|
|
5553
5531
|
description: "Fetch organization forms",
|
|
5554
5532
|
method: HttpMethod.GET,
|
|
5555
|
-
url:
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
forms.push(form);
|
|
5561
|
-
for (const revision of organizationFormsResult.revisions)
|
|
5562
|
-
revisions.push(revision);
|
|
5563
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5564
|
-
attachments.push(attachment);
|
|
5565
|
-
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5566
|
-
description: "Fetch asset type forms",
|
|
5567
|
-
method: HttpMethod.GET,
|
|
5568
|
-
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5569
|
-
blockers: [projectId.toString()],
|
|
5570
|
-
blocks: []
|
|
5571
|
-
});
|
|
5572
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5573
|
-
forms.push(form);
|
|
5574
|
-
for (const revision of assetTypeFormsResult.revisions)
|
|
5575
|
-
revisions.push(revision);
|
|
5576
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5577
|
-
attachments.push(attachment);
|
|
5578
|
-
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5579
|
-
description: "Fetch issue type forms",
|
|
5580
|
-
method: HttpMethod.GET,
|
|
5581
|
-
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5582
|
-
blockers: [projectId.toString()],
|
|
5533
|
+
url: "/forms/",
|
|
5534
|
+
queryParams: {
|
|
5535
|
+
organization: organizationId.toString()
|
|
5536
|
+
},
|
|
5537
|
+
blockers: [organizationId.toString()],
|
|
5583
5538
|
blocks: []
|
|
5584
5539
|
});
|
|
5585
|
-
for (const form of issueTypeFormsResult.forms)
|
|
5586
|
-
forms.push(form);
|
|
5587
|
-
for (const revision of issueTypeFormsResult.revisions)
|
|
5588
|
-
revisions.push(revision);
|
|
5589
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5590
|
-
attachments.push(attachment);
|
|
5591
5540
|
this.dispatch(initializeForms(forms));
|
|
5592
|
-
this.dispatch(initializeFormRevisions(revisions));
|
|
5593
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5594
5541
|
}
|
|
5595
5542
|
}
|
|
5596
5543
|
const isArrayOfFiles = (value) => {
|
|
@@ -5612,277 +5559,63 @@ var __publicField = (obj, key, value) => {
|
|
|
5612
5559
|
return { values: newValues, files };
|
|
5613
5560
|
};
|
|
5614
5561
|
class FormSubmissionService extends BaseUploadService {
|
|
5615
|
-
|
|
5616
|
-
var _a2;
|
|
5617
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5618
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5619
|
-
const filePayloads = {};
|
|
5620
|
-
const offlineFormSubmissionAttachments = [];
|
|
5621
|
-
const attachmentPayloads = [];
|
|
5622
|
-
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5623
|
-
for (const file of filesArray) {
|
|
5624
|
-
const sha1 = await hashFile(file);
|
|
5625
|
-
if (!(sha1 in filePayloads)) {
|
|
5626
|
-
filePayloads[sha1] = {
|
|
5627
|
-
sha1,
|
|
5628
|
-
file_type: file.type,
|
|
5629
|
-
extension: file.name.split(".").pop(),
|
|
5630
|
-
size: file.size
|
|
5631
|
-
};
|
|
5632
|
-
await this.client.files.addCache(file, sha1);
|
|
5633
|
-
}
|
|
5634
|
-
const offlineFormSubmissionAttachment = offline({
|
|
5635
|
-
file: URL.createObjectURL(file),
|
|
5636
|
-
file_type: file.type,
|
|
5637
|
-
file_name: file.name,
|
|
5638
|
-
file_sha1: sha1,
|
|
5639
|
-
created_by: createdBy,
|
|
5640
|
-
submission: submissionId,
|
|
5641
|
-
submitted_at: submittedAt,
|
|
5642
|
-
field_identifier: fieldIdentifier
|
|
5643
|
-
});
|
|
5644
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5645
|
-
const attachmentPayload = {
|
|
5646
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5647
|
-
name: file.name,
|
|
5648
|
-
sha1,
|
|
5649
|
-
field_identifier: fieldIdentifier
|
|
5650
|
-
};
|
|
5651
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5652
|
-
}
|
|
5653
|
-
}
|
|
5654
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5655
|
-
const promise = this.enqueueRequest({
|
|
5656
|
-
description: "Attach files to form submission",
|
|
5657
|
-
method: HttpMethod.POST,
|
|
5658
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5659
|
-
payload: {
|
|
5660
|
-
submitted_at: submittedAt,
|
|
5661
|
-
attachments: attachmentPayloads,
|
|
5662
|
-
files: Object.values(filePayloads)
|
|
5663
|
-
},
|
|
5664
|
-
blockers: [submissionId],
|
|
5665
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5666
|
-
});
|
|
5667
|
-
promise.then((result) => {
|
|
5668
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5669
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5670
|
-
}).catch(() => {
|
|
5671
|
-
this.dispatch(
|
|
5672
|
-
deleteFormSubmissionAttachments(
|
|
5673
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5674
|
-
)
|
|
5675
|
-
);
|
|
5676
|
-
});
|
|
5677
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5678
|
-
}
|
|
5679
|
-
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5680
|
-
const { store } = this.client;
|
|
5681
|
-
const state = store.getState();
|
|
5682
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5683
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5684
|
-
try {
|
|
5685
|
-
await this.enqueueRequest({
|
|
5686
|
-
description: "Delete form submission attachments",
|
|
5687
|
-
method: HttpMethod.DELETE,
|
|
5688
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5689
|
-
payload: { attachments: attachmentsIds },
|
|
5690
|
-
blockers: [submissionId, ...attachmentsIds],
|
|
5691
|
-
blocks: []
|
|
5692
|
-
});
|
|
5693
|
-
} catch (e) {
|
|
5694
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5695
|
-
throw e;
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
|
-
// Outer promise is for hashing and caching files for submission attachments
|
|
5699
|
-
async add(payload) {
|
|
5562
|
+
add(payload) {
|
|
5700
5563
|
var _a2;
|
|
5701
5564
|
const { store } = this.client;
|
|
5702
5565
|
const state = store.getState();
|
|
5703
|
-
const { values, files } = separateFilesFromValues(payload.values);
|
|
5704
5566
|
const offlineSubmission = offline({
|
|
5705
5567
|
...payload,
|
|
5706
|
-
values,
|
|
5707
5568
|
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5708
5569
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5709
5570
|
});
|
|
5710
5571
|
const promise = this.enqueueRequest({
|
|
5711
|
-
description: "
|
|
5572
|
+
description: "Add form submission",
|
|
5712
5573
|
method: HttpMethod.POST,
|
|
5713
|
-
url:
|
|
5574
|
+
url: "/form-submissions/",
|
|
5714
5575
|
payload: offlineSubmission,
|
|
5715
|
-
blockers: [
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
);
|
|
5576
|
+
blockers: [
|
|
5577
|
+
"add-form-entry",
|
|
5578
|
+
payload.form_revision,
|
|
5579
|
+
...payload.issue ? [payload.issue] : [],
|
|
5580
|
+
...payload.asset ? [payload.asset] : []
|
|
5581
|
+
],
|
|
5582
|
+
blocks: [offlineSubmission.offline_id]
|
|
5583
|
+
});
|
|
5584
|
+
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5725
5585
|
promise.then((result) => {
|
|
5726
5586
|
this.dispatch(setFormSubmission(result));
|
|
5727
5587
|
return result;
|
|
5728
5588
|
}).catch(() => {
|
|
5729
5589
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5730
5590
|
});
|
|
5731
|
-
return [offlineSubmission,
|
|
5732
|
-
}
|
|
5733
|
-
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5734
|
-
// TODO: adapt the support bulk adding to any model type
|
|
5735
|
-
async bulkAdd(args, batchSize) {
|
|
5736
|
-
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5737
|
-
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5738
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5739
|
-
const transactionId = uuid.v4();
|
|
5740
|
-
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5741
|
-
const bulkAddBatches = await Promise.all(
|
|
5742
|
-
assetIdBatches.map(async (assetIdBatch) => {
|
|
5743
|
-
const batchId = uuid.v4();
|
|
5744
|
-
const submissionPayloads = [];
|
|
5745
|
-
const attachmentPayloads = [];
|
|
5746
|
-
const files = { ...commonFiles };
|
|
5747
|
-
for (const assetId of assetIdBatch) {
|
|
5748
|
-
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5749
|
-
Object.assign(files, submissionSpecificFiles);
|
|
5750
|
-
const submissionPayload = offline({
|
|
5751
|
-
asset_id: assetId,
|
|
5752
|
-
form_data: fileSeperatedSubmissionSpecificValues
|
|
5753
|
-
});
|
|
5754
|
-
submissionPayloads.push(submissionPayload);
|
|
5755
|
-
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5756
|
-
for (const file of fileArray) {
|
|
5757
|
-
const sha1 = await hashFile(file);
|
|
5758
|
-
await this.client.files.addCache(file, sha1);
|
|
5759
|
-
const attachmentPayload = offline({
|
|
5760
|
-
submission_id: submissionPayload.offline_id,
|
|
5761
|
-
sha1,
|
|
5762
|
-
name: file.name,
|
|
5763
|
-
field_identifier: fieldIdentifier
|
|
5764
|
-
});
|
|
5765
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5766
|
-
}
|
|
5767
|
-
}
|
|
5768
|
-
}
|
|
5769
|
-
const filePaylods = [];
|
|
5770
|
-
for (const file of Object.values(files).flat()) {
|
|
5771
|
-
const sha1 = await hashFile(file);
|
|
5772
|
-
const filePayload = {
|
|
5773
|
-
sha1,
|
|
5774
|
-
extension: file.name.split(".").pop() || "",
|
|
5775
|
-
file_type: file.type,
|
|
5776
|
-
size: file.size
|
|
5777
|
-
};
|
|
5778
|
-
filePaylods.push(filePayload);
|
|
5779
|
-
}
|
|
5780
|
-
return {
|
|
5781
|
-
batchId,
|
|
5782
|
-
payload: {
|
|
5783
|
-
transaction_id: transactionId,
|
|
5784
|
-
form_data: fileSeperatedCommonFieldValues,
|
|
5785
|
-
submitted_at: submittedAt,
|
|
5786
|
-
submissions: submissionPayloads,
|
|
5787
|
-
attachments: attachmentPayloads,
|
|
5788
|
-
files: filePaylods
|
|
5789
|
-
}
|
|
5790
|
-
};
|
|
5791
|
-
})
|
|
5792
|
-
);
|
|
5793
|
-
const batchPromises = [];
|
|
5794
|
-
let prevBatchId = null;
|
|
5795
|
-
for (const batch of bulkAddBatches) {
|
|
5796
|
-
const { payload, batchId } = batch;
|
|
5797
|
-
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5798
|
-
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5799
|
-
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5800
|
-
const blockers = batchAssetIds;
|
|
5801
|
-
if (prevBatchId)
|
|
5802
|
-
blockers.push(prevBatchId);
|
|
5803
|
-
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5804
|
-
const promise = this.enqueueRequest({
|
|
5805
|
-
description: "Bulk add form submissions",
|
|
5806
|
-
method: HttpMethod.POST,
|
|
5807
|
-
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5808
|
-
payload,
|
|
5809
|
-
blockers,
|
|
5810
|
-
blocks: blocks2
|
|
5811
|
-
});
|
|
5812
|
-
void promise.then(({ presigned_urls }) => {
|
|
5813
|
-
this.processPresignedUrls(presigned_urls);
|
|
5814
|
-
});
|
|
5815
|
-
prevBatchId = batchId;
|
|
5816
|
-
batchPromises.push(promise);
|
|
5817
|
-
}
|
|
5818
|
-
void Promise.all(batchPromises).then((results) => {
|
|
5819
|
-
const createdSubmissions = [];
|
|
5820
|
-
const createdAttachments = [];
|
|
5821
|
-
for (const result of results) {
|
|
5822
|
-
for (const createdSubmission of result.submissions)
|
|
5823
|
-
createdSubmissions.push(createdSubmission);
|
|
5824
|
-
for (const createdAttachment of result.attachments)
|
|
5825
|
-
createdAttachments.push(createdAttachment);
|
|
5826
|
-
}
|
|
5827
|
-
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5828
|
-
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5829
|
-
});
|
|
5830
|
-
return batchPromises;
|
|
5591
|
+
return [offlineSubmission, promise];
|
|
5831
5592
|
}
|
|
5832
|
-
|
|
5593
|
+
update(payload) {
|
|
5833
5594
|
const { store } = this.client;
|
|
5834
5595
|
const state = store.getState();
|
|
5835
5596
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5836
5597
|
if (!submissionToBeUpdated) {
|
|
5837
5598
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5838
5599
|
}
|
|
5839
|
-
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5840
5600
|
const updatedSubmission = {
|
|
5841
5601
|
...submissionToBeUpdated,
|
|
5842
|
-
...payload
|
|
5843
|
-
// values could also have a partial update
|
|
5844
|
-
values: {
|
|
5845
|
-
...submissionToBeUpdated.values,
|
|
5846
|
-
...values
|
|
5847
|
-
}
|
|
5602
|
+
...payload
|
|
5848
5603
|
};
|
|
5849
5604
|
this.dispatch(updateFormSubmission(updatedSubmission));
|
|
5850
5605
|
const promise = this.enqueueRequest({
|
|
5851
5606
|
description: "Delete user form submissions",
|
|
5852
5607
|
method: HttpMethod.PATCH,
|
|
5853
|
-
url: `/
|
|
5854
|
-
|
|
5855
|
-
payload: updatedSubmission,
|
|
5608
|
+
url: `/form-submissions/${updatedSubmission.offline_id}/`,
|
|
5609
|
+
payload,
|
|
5856
5610
|
blockers: [updatedSubmission.offline_id],
|
|
5857
5611
|
blocks: [updatedSubmission.offline_id]
|
|
5858
5612
|
});
|
|
5859
|
-
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5860
|
-
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5861
|
-
for (const attachment of formSubmissionAttachments) {
|
|
5862
|
-
if (attachment.field_identifier in files) {
|
|
5863
|
-
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5864
|
-
}
|
|
5865
|
-
}
|
|
5866
|
-
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5867
|
-
payload.offline_id,
|
|
5868
|
-
files
|
|
5869
|
-
);
|
|
5870
|
-
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5871
|
-
payload.offline_id,
|
|
5872
|
-
formSubmissionAttachmentIdsToBeDeleted
|
|
5873
|
-
);
|
|
5874
5613
|
promise.then((result) => {
|
|
5875
5614
|
this.dispatch(setFormSubmission(result));
|
|
5876
5615
|
}).catch(() => {
|
|
5877
5616
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5878
5617
|
});
|
|
5879
|
-
return [
|
|
5880
|
-
updatedSubmission,
|
|
5881
|
-
offlineFormSubmissionAttachments,
|
|
5882
|
-
promise,
|
|
5883
|
-
attachmentsPromise,
|
|
5884
|
-
deleteAttachmentsPromise
|
|
5885
|
-
];
|
|
5618
|
+
return [updatedSubmission, promise];
|
|
5886
5619
|
}
|
|
5887
5620
|
async delete(id) {
|
|
5888
5621
|
const { store } = this.client;
|
|
@@ -5898,7 +5631,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5898
5631
|
return await this.enqueueRequest({
|
|
5899
5632
|
description: "Delete user form submissions",
|
|
5900
5633
|
method: HttpMethod.DELETE,
|
|
5901
|
-
url: `/
|
|
5634
|
+
url: `/form-submissions/${id}/`,
|
|
5902
5635
|
blockers: [id],
|
|
5903
5636
|
blocks: []
|
|
5904
5637
|
});
|
|
@@ -5909,50 +5642,17 @@ var __publicField = (obj, key, value) => {
|
|
|
5909
5642
|
}
|
|
5910
5643
|
}
|
|
5911
5644
|
async refreshStore(projectId) {
|
|
5912
|
-
const
|
|
5913
|
-
|
|
5914
|
-
description: "Fetch model submissions",
|
|
5915
|
-
method: HttpMethod.GET,
|
|
5916
|
-
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
5917
|
-
blockers: [],
|
|
5918
|
-
blocks: []
|
|
5919
|
-
});
|
|
5920
|
-
for (const modelSubmission of modelSubmissions) {
|
|
5921
|
-
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
5922
|
-
}
|
|
5923
|
-
const standaloneSubmissions = await this.enqueueRequest({
|
|
5924
|
-
description: "Fetch standalone submissions",
|
|
5925
|
-
method: HttpMethod.GET,
|
|
5926
|
-
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
5927
|
-
blockers: [],
|
|
5928
|
-
blocks: []
|
|
5929
|
-
});
|
|
5930
|
-
for (const standaloneSubmission of standaloneSubmissions) {
|
|
5931
|
-
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
5932
|
-
}
|
|
5933
|
-
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
5934
|
-
const attachments = {};
|
|
5935
|
-
const modelAttachments = await this.enqueueRequest({
|
|
5936
|
-
description: "Fetch model submission attachments",
|
|
5937
|
-
method: HttpMethod.GET,
|
|
5938
|
-
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
5939
|
-
blockers: [],
|
|
5940
|
-
blocks: []
|
|
5941
|
-
});
|
|
5942
|
-
for (const modelAttachment of modelAttachments) {
|
|
5943
|
-
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
5944
|
-
}
|
|
5945
|
-
const standaloneAttachments = await this.enqueueRequest({
|
|
5946
|
-
description: "Fetch standalone submission attachments",
|
|
5645
|
+
const result = await this.enqueueRequest({
|
|
5646
|
+
description: "Fetch form submissions",
|
|
5947
5647
|
method: HttpMethod.GET,
|
|
5948
|
-
url:
|
|
5648
|
+
url: "/form-submissions/",
|
|
5649
|
+
queryParams: {
|
|
5650
|
+
project: projectId.toString()
|
|
5651
|
+
},
|
|
5949
5652
|
blockers: [],
|
|
5950
5653
|
blocks: []
|
|
5951
5654
|
});
|
|
5952
|
-
|
|
5953
|
-
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
5954
|
-
}
|
|
5955
|
-
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5655
|
+
this.dispatch(initializeFormSubmissions(result));
|
|
5956
5656
|
}
|
|
5957
5657
|
}
|
|
5958
5658
|
class WorkspaceService extends BaseApiService {
|
|
@@ -6018,9 +5718,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6018
5718
|
blockers: [id],
|
|
6019
5719
|
blocks: []
|
|
6020
5720
|
});
|
|
6021
|
-
void promise.catch((
|
|
5721
|
+
void promise.catch((e) => {
|
|
6022
5722
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
6023
|
-
throw
|
|
5723
|
+
throw e;
|
|
6024
5724
|
});
|
|
6025
5725
|
return promise;
|
|
6026
5726
|
}
|
|
@@ -6081,7 +5781,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6081
5781
|
class FileService extends BaseApiService {
|
|
6082
5782
|
constructor() {
|
|
6083
5783
|
super(...arguments);
|
|
6084
|
-
__publicField(this, "host"
|
|
5784
|
+
__publicField(this, "host");
|
|
6085
5785
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6086
5786
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6087
5787
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6092,8 +5792,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6092
5792
|
}
|
|
6093
5793
|
async renewUploadUrl(sha1) {
|
|
6094
5794
|
const file = await this.fetchCache(sha1);
|
|
6095
|
-
if (!file)
|
|
6096
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5795
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6097
5796
|
const key = await getFileS3Key(file, sha1);
|
|
6098
5797
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6099
5798
|
description: "Get S3 URL",
|
|
@@ -6163,8 +5862,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6163
5862
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6164
5863
|
async uploadFileToS3(sha1) {
|
|
6165
5864
|
const file = await this.fetchCache(sha1);
|
|
6166
|
-
if (!file)
|
|
6167
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5865
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6168
5866
|
const key = await getFileS3Key(file, sha1);
|
|
6169
5867
|
const dbFileProperties = {
|
|
6170
5868
|
file_name: file.name,
|
|
@@ -6258,7 +5956,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6258
5956
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6259
5957
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6260
5958
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6261
|
-
|
|
5959
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6262
5960
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6263
5961
|
throw new Error(message);
|
|
6264
5962
|
}
|
|
@@ -6654,8 +6352,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6654
6352
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6655
6353
|
constructor() {
|
|
6656
6354
|
super(...arguments);
|
|
6657
|
-
__publicField(this, "
|
|
6658
|
-
__publicField(this, "
|
|
6355
|
+
__publicField(this, "name", "Document Attachment");
|
|
6356
|
+
__publicField(this, "url", "/document-attachments");
|
|
6659
6357
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6660
6358
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6661
6359
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6666,17 +6364,23 @@ var __publicField = (obj, key, value) => {
|
|
|
6666
6364
|
buildOfflineAttachment(data) {
|
|
6667
6365
|
return offline({
|
|
6668
6366
|
file: URL.createObjectURL(data.file),
|
|
6669
|
-
file_sha1: data.
|
|
6670
|
-
created_by: data.
|
|
6367
|
+
file_sha1: data.file_sha1,
|
|
6368
|
+
created_by: data.created_by,
|
|
6671
6369
|
file_name: data.file.name,
|
|
6672
6370
|
file_type: data.file.type,
|
|
6673
|
-
submitted_at: data.
|
|
6371
|
+
submitted_at: data.submitted_at,
|
|
6674
6372
|
description: data.description,
|
|
6675
6373
|
document: data.modelId
|
|
6676
6374
|
});
|
|
6677
6375
|
}
|
|
6376
|
+
buildAttachmentPayload(data) {
|
|
6377
|
+
return {
|
|
6378
|
+
...data,
|
|
6379
|
+
document: data.modelId
|
|
6380
|
+
};
|
|
6381
|
+
}
|
|
6678
6382
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6679
|
-
async
|
|
6383
|
+
async bulkAdd(payloads) {
|
|
6680
6384
|
var _a2;
|
|
6681
6385
|
const { store } = this.client;
|
|
6682
6386
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6685,40 +6389,37 @@ var __publicField = (obj, key, value) => {
|
|
|
6685
6389
|
const attachmentPayloads = [];
|
|
6686
6390
|
const filePayloads = {};
|
|
6687
6391
|
const sha1ToAttachmentIds = {};
|
|
6688
|
-
for (const
|
|
6689
|
-
const
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
extension: file.name.split(".").pop(),
|
|
6695
|
-
size: file.size
|
|
6696
|
-
};
|
|
6697
|
-
sha1ToAttachmentIds[sha1] = [];
|
|
6698
|
-
await this.client.files.addCache(file, sha1);
|
|
6392
|
+
for (const payload of payloads) {
|
|
6393
|
+
const { documentId, file } = payload;
|
|
6394
|
+
const filePayload = await this.getFilePayload(file);
|
|
6395
|
+
if (!(filePayload.sha1 in filePayloads)) {
|
|
6396
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
6397
|
+
sha1ToAttachmentIds[filePayload.sha1] = [];
|
|
6699
6398
|
}
|
|
6700
6399
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6701
6400
|
file,
|
|
6702
|
-
sha1,
|
|
6703
|
-
submittedAt,
|
|
6704
|
-
createdBy,
|
|
6401
|
+
file_sha1: filePayload.sha1,
|
|
6402
|
+
submitted_at: submittedAt,
|
|
6403
|
+
created_by: createdBy,
|
|
6705
6404
|
description: "",
|
|
6706
6405
|
modelId: documentId
|
|
6707
6406
|
});
|
|
6708
6407
|
offlineAttachments.push(offlineAttachment);
|
|
6709
6408
|
attachmentPayloads.push({
|
|
6710
6409
|
offline_id: offlineAttachment.offline_id,
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6410
|
+
file_name: offlineAttachment.file_name,
|
|
6411
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
6412
|
+
file_extension: filePayload.extension,
|
|
6413
|
+
description: offlineAttachment.description,
|
|
6414
|
+
document: documentId
|
|
6714
6415
|
});
|
|
6715
|
-
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6416
|
+
sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
|
|
6716
6417
|
}
|
|
6717
6418
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6718
6419
|
const promise = this.enqueueRequest({
|
|
6719
6420
|
description: "Attach files to document",
|
|
6720
6421
|
method: HttpMethod.POST,
|
|
6721
|
-
url:
|
|
6422
|
+
url: "/document-attachments/bulk/",
|
|
6722
6423
|
payload: {
|
|
6723
6424
|
submitted_at: submittedAt,
|
|
6724
6425
|
attachments: attachmentPayloads,
|
|
@@ -6743,14 +6444,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6743
6444
|
});
|
|
6744
6445
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6745
6446
|
}
|
|
6746
|
-
async
|
|
6747
|
-
return this.
|
|
6447
|
+
async delete(id) {
|
|
6448
|
+
return this._delete(id);
|
|
6748
6449
|
}
|
|
6749
6450
|
makeReadable(attachmnentId) {
|
|
6750
6451
|
void this.enqueueRequest({
|
|
6751
6452
|
description: "Add attachment to AI assistant",
|
|
6752
6453
|
method: HttpMethod.PATCH,
|
|
6753
|
-
url: `/
|
|
6454
|
+
url: `/document-attachments/${attachmnentId}/`,
|
|
6754
6455
|
payload: {
|
|
6755
6456
|
readable_to_assistant: true
|
|
6756
6457
|
},
|
|
@@ -6767,7 +6468,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6767
6468
|
blocks: [],
|
|
6768
6469
|
blockers: []
|
|
6769
6470
|
});
|
|
6770
|
-
this.dispatch(
|
|
6471
|
+
this.dispatch(initializeDocumentAttachments(projectDocumentAttachments));
|
|
6771
6472
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6772
6473
|
description: "Get document attachments",
|
|
6773
6474
|
method: HttpMethod.GET,
|
|
@@ -7003,17 +6704,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7003
6704
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7004
6705
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7005
6706
|
const projectId = payloadWithoutFile.project;
|
|
7006
|
-
const
|
|
7007
|
-
const filePayload = {
|
|
7008
|
-
sha1,
|
|
7009
|
-
file_type: file.type,
|
|
7010
|
-
extension: file.name.split(".").pop(),
|
|
7011
|
-
size: file.size
|
|
7012
|
-
};
|
|
6707
|
+
const filePayload = await this.getFilePayload(file);
|
|
7013
6708
|
const offlineMapImage = offline({
|
|
7014
6709
|
...payloadWithoutFile,
|
|
7015
6710
|
file_name: file.name,
|
|
7016
|
-
file_sha1: sha1,
|
|
6711
|
+
file_sha1: filePayload.sha1,
|
|
7017
6712
|
file: URL.createObjectURL(file),
|
|
7018
6713
|
submitted_at: submittedAt,
|
|
7019
6714
|
created_by: createdBy
|
|
@@ -7056,23 +6751,15 @@ var __publicField = (obj, key, value) => {
|
|
|
7056
6751
|
const offlineGeoImages = [];
|
|
7057
6752
|
const offlineIds = [];
|
|
7058
6753
|
const geoImagePayloads = [];
|
|
7059
|
-
const
|
|
6754
|
+
const filePayloads = {};
|
|
7060
6755
|
for (const payloadAndFile of payloads) {
|
|
7061
6756
|
const { file, ...payload } = payloadAndFile;
|
|
7062
|
-
const
|
|
7063
|
-
if (!(sha1 in
|
|
7064
|
-
filePayloadRecord[sha1] = {
|
|
7065
|
-
sha1,
|
|
7066
|
-
file_type: file.type,
|
|
7067
|
-
extension: file.name.split(".").pop(),
|
|
7068
|
-
size: file.size
|
|
7069
|
-
};
|
|
7070
|
-
await this.client.files.addCache(file, sha1);
|
|
7071
|
-
}
|
|
6757
|
+
const filePayload = await this.getFilePayload(file);
|
|
6758
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7072
6759
|
const offlineMapImage = offline({
|
|
7073
6760
|
...payload,
|
|
7074
6761
|
file_name: file.name,
|
|
7075
|
-
file_sha1: sha1,
|
|
6762
|
+
file_sha1: filePayload.sha1,
|
|
7076
6763
|
file: URL.createObjectURL(file),
|
|
7077
6764
|
submitted_at: submittedAt,
|
|
7078
6765
|
created_by: createdBy,
|
|
@@ -7101,7 +6788,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7101
6788
|
submitted_at: submittedAt,
|
|
7102
6789
|
project: projectId,
|
|
7103
6790
|
geo_images: geoImagePayloads,
|
|
7104
|
-
files: Object.values(
|
|
6791
|
+
files: Object.values(filePayloads)
|
|
7105
6792
|
},
|
|
7106
6793
|
blocks: [projectId.toString()],
|
|
7107
6794
|
blockers: offlineIds
|
|
@@ -7169,7 +6856,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7169
6856
|
this.dispatch(initializeGeoImages(result));
|
|
7170
6857
|
}
|
|
7171
6858
|
}
|
|
7172
|
-
class IssueAssociationService extends
|
|
6859
|
+
class IssueAssociationService extends BaseApiService {
|
|
7173
6860
|
add(payload) {
|
|
7174
6861
|
var _a2;
|
|
7175
6862
|
const { store } = this.client;
|
|
@@ -7184,7 +6871,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7184
6871
|
const promise = this.enqueueRequest({
|
|
7185
6872
|
description: "Add issue association",
|
|
7186
6873
|
method: HttpMethod.POST,
|
|
7187
|
-
url: "/
|
|
6874
|
+
url: "/issue-associations/",
|
|
7188
6875
|
payload: {
|
|
7189
6876
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7190
6877
|
submitted_at: submittedAt,
|
|
@@ -7214,7 +6901,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7214
6901
|
const promise = this.enqueueRequest({
|
|
7215
6902
|
description: "Delete issue association",
|
|
7216
6903
|
method: HttpMethod.DELETE,
|
|
7217
|
-
url: `/
|
|
6904
|
+
url: `/issue-associations/${id}/`,
|
|
7218
6905
|
blockers: [id],
|
|
7219
6906
|
blocks: []
|
|
7220
6907
|
});
|
|
@@ -7227,14 +6914,889 @@ var __publicField = (obj, key, value) => {
|
|
|
7227
6914
|
const issueAssociations = await this.enqueueRequest({
|
|
7228
6915
|
description: "Fetch issue associations",
|
|
7229
6916
|
method: HttpMethod.GET,
|
|
7230
|
-
url: "/
|
|
7231
|
-
queryParams: {
|
|
6917
|
+
url: "/issue-associations/",
|
|
6918
|
+
queryParams: { project: projectId.toString() },
|
|
7232
6919
|
blockers: [],
|
|
7233
6920
|
blocks: []
|
|
7234
6921
|
});
|
|
7235
6922
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7236
6923
|
}
|
|
7237
6924
|
}
|
|
6925
|
+
class FormRevisionAttachmentService extends BaseUploadService {
|
|
6926
|
+
async bulkAdd(payloads) {
|
|
6927
|
+
var _a2;
|
|
6928
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6929
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6930
|
+
const filePayloads = {};
|
|
6931
|
+
const offlineFormRevisionAttachments = [];
|
|
6932
|
+
const attachmentPayloads = [];
|
|
6933
|
+
for (const payload of payloads) {
|
|
6934
|
+
const { revisionId, fieldIdentifier, file } = payload;
|
|
6935
|
+
const filePayload = await this.getFilePayload(file);
|
|
6936
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
6937
|
+
const offlineFormRevisionAttachment = offline({
|
|
6938
|
+
file: URL.createObjectURL(file),
|
|
6939
|
+
file_type: file.type,
|
|
6940
|
+
file_name: file.name,
|
|
6941
|
+
file_sha1: filePayload.sha1,
|
|
6942
|
+
created_by: createdBy,
|
|
6943
|
+
form_revision: revisionId,
|
|
6944
|
+
submitted_at: submittedAt,
|
|
6945
|
+
field_identifier: fieldIdentifier
|
|
6946
|
+
});
|
|
6947
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
6948
|
+
const attachmentPayload = {
|
|
6949
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
6950
|
+
file_name: file.name,
|
|
6951
|
+
field_identifier: fieldIdentifier,
|
|
6952
|
+
file_extension: filePayload.extension,
|
|
6953
|
+
file_sha1: filePayload.sha1,
|
|
6954
|
+
form_revision: revisionId
|
|
6955
|
+
};
|
|
6956
|
+
attachmentPayloads.push(attachmentPayload);
|
|
6957
|
+
}
|
|
6958
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
6959
|
+
const promise = this.enqueueRequest({
|
|
6960
|
+
description: "Attach files to form revision",
|
|
6961
|
+
method: HttpMethod.POST,
|
|
6962
|
+
url: "/form-revision-attachments/bulk/",
|
|
6963
|
+
payload: {
|
|
6964
|
+
submitted_at: submittedAt,
|
|
6965
|
+
attachments: attachmentPayloads,
|
|
6966
|
+
files: Object.values(filePayloads)
|
|
6967
|
+
},
|
|
6968
|
+
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
6969
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
6970
|
+
});
|
|
6971
|
+
promise.then((result) => {
|
|
6972
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
6973
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
6974
|
+
}).catch(() => {
|
|
6975
|
+
this.dispatch(
|
|
6976
|
+
deleteFormRevisionAttachments(
|
|
6977
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
6978
|
+
)
|
|
6979
|
+
);
|
|
6980
|
+
});
|
|
6981
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
6982
|
+
}
|
|
6983
|
+
async refreshStore(organizationId) {
|
|
6984
|
+
const formRevisions = await this.enqueueRequest({
|
|
6985
|
+
description: "Fetch organization form revision attachments",
|
|
6986
|
+
method: HttpMethod.GET,
|
|
6987
|
+
url: "/form-revision-attachments/",
|
|
6988
|
+
queryParams: {
|
|
6989
|
+
organization: organizationId.toString()
|
|
6990
|
+
},
|
|
6991
|
+
blockers: [organizationId.toString()],
|
|
6992
|
+
blocks: []
|
|
6993
|
+
});
|
|
6994
|
+
this.dispatch(initializeFormRevisionAttachments(formRevisions));
|
|
6995
|
+
}
|
|
6996
|
+
}
|
|
6997
|
+
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
6998
|
+
async bulkAdd(payloads) {
|
|
6999
|
+
var _a2;
|
|
7000
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7001
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7002
|
+
const filePayloads = {};
|
|
7003
|
+
const offlineFormSubmissionAttachments = [];
|
|
7004
|
+
const attachmentPayloads = [];
|
|
7005
|
+
for (const payload of payloads) {
|
|
7006
|
+
const { submissionId, fieldIdentifier, file } = payload;
|
|
7007
|
+
const filePayload = await this.getFilePayload(file);
|
|
7008
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7009
|
+
const offlineFormSubmissionAttachment = offline({
|
|
7010
|
+
file: URL.createObjectURL(file),
|
|
7011
|
+
file_type: file.type,
|
|
7012
|
+
file_name: file.name,
|
|
7013
|
+
file_sha1: filePayload.sha1,
|
|
7014
|
+
created_by: createdBy,
|
|
7015
|
+
form_submission: submissionId,
|
|
7016
|
+
submitted_at: submittedAt,
|
|
7017
|
+
field_identifier: fieldIdentifier
|
|
7018
|
+
});
|
|
7019
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7020
|
+
const attachmentPayload = {
|
|
7021
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7022
|
+
file_name: file.name,
|
|
7023
|
+
file_sha1: filePayload.sha1,
|
|
7024
|
+
file_extension: filePayload.extension,
|
|
7025
|
+
field_identifier: fieldIdentifier,
|
|
7026
|
+
form_submission: submissionId
|
|
7027
|
+
};
|
|
7028
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7029
|
+
}
|
|
7030
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7031
|
+
const promise = this.enqueueRequest({
|
|
7032
|
+
description: "Attach files to form submission",
|
|
7033
|
+
method: HttpMethod.POST,
|
|
7034
|
+
url: "/form-submission-attachments/bulk/",
|
|
7035
|
+
payload: {
|
|
7036
|
+
submitted_at: submittedAt,
|
|
7037
|
+
attachments: attachmentPayloads,
|
|
7038
|
+
files: Object.values(filePayloads)
|
|
7039
|
+
},
|
|
7040
|
+
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7041
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7042
|
+
});
|
|
7043
|
+
promise.then((result) => {
|
|
7044
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7045
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7046
|
+
}).catch((error) => {
|
|
7047
|
+
this.dispatch(
|
|
7048
|
+
deleteFormSubmissionAttachments(
|
|
7049
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7050
|
+
)
|
|
7051
|
+
);
|
|
7052
|
+
throw error;
|
|
7053
|
+
});
|
|
7054
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7055
|
+
}
|
|
7056
|
+
async bulkDelete(attachmentsIds) {
|
|
7057
|
+
const { store } = this.client;
|
|
7058
|
+
const state = store.getState();
|
|
7059
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7060
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7061
|
+
try {
|
|
7062
|
+
await this.enqueueRequest({
|
|
7063
|
+
description: "Delete form submission attachments",
|
|
7064
|
+
method: HttpMethod.DELETE,
|
|
7065
|
+
url: "/form-submission-attachments/bulk/",
|
|
7066
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7067
|
+
blockers: attachmentsIds,
|
|
7068
|
+
blocks: []
|
|
7069
|
+
});
|
|
7070
|
+
} catch (e) {
|
|
7071
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7072
|
+
throw e;
|
|
7073
|
+
}
|
|
7074
|
+
}
|
|
7075
|
+
async refreshStore(projectId) {
|
|
7076
|
+
const result = await this.enqueueRequest({
|
|
7077
|
+
description: "Get form submission attachments",
|
|
7078
|
+
method: HttpMethod.GET,
|
|
7079
|
+
url: "/form-submission-attachments/",
|
|
7080
|
+
queryParams: {
|
|
7081
|
+
project: projectId.toString()
|
|
7082
|
+
},
|
|
7083
|
+
blockers: [],
|
|
7084
|
+
blocks: []
|
|
7085
|
+
});
|
|
7086
|
+
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7087
|
+
}
|
|
7088
|
+
}
|
|
7089
|
+
class FormRevisionService extends BaseUploadService {
|
|
7090
|
+
add(payload) {
|
|
7091
|
+
var _a2;
|
|
7092
|
+
const { store } = this.client;
|
|
7093
|
+
const state = store.getState();
|
|
7094
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7095
|
+
const offlineFormRevision = offline({
|
|
7096
|
+
...payload,
|
|
7097
|
+
created_by: createdBy,
|
|
7098
|
+
revision: "Pending",
|
|
7099
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7100
|
+
});
|
|
7101
|
+
this.dispatch(addFormRevision(offlineFormRevision));
|
|
7102
|
+
const promise = this.enqueueRequest({
|
|
7103
|
+
description: "Create form revision",
|
|
7104
|
+
method: HttpMethod.POST,
|
|
7105
|
+
url: "/form-revisions/",
|
|
7106
|
+
payload: offlineFormRevision,
|
|
7107
|
+
blockers: [payload.form],
|
|
7108
|
+
blocks: [offlineFormRevision.offline_id]
|
|
7109
|
+
});
|
|
7110
|
+
void promise.then((result) => {
|
|
7111
|
+
this.dispatch(setFormRevision(result));
|
|
7112
|
+
}).catch(() => {
|
|
7113
|
+
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7114
|
+
});
|
|
7115
|
+
return [offlineFormRevision, promise];
|
|
7116
|
+
}
|
|
7117
|
+
async refreshStore(organizationId) {
|
|
7118
|
+
const formRevisions = await this.enqueueRequest({
|
|
7119
|
+
description: "Get organization form revisions",
|
|
7120
|
+
method: HttpMethod.GET,
|
|
7121
|
+
url: "/form-revisions/",
|
|
7122
|
+
queryParams: {
|
|
7123
|
+
organization: organizationId.toString()
|
|
7124
|
+
},
|
|
7125
|
+
blockers: [organizationId.toString()],
|
|
7126
|
+
blocks: []
|
|
7127
|
+
});
|
|
7128
|
+
this.dispatch(initializeFormRevisions(formRevisions));
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
7131
|
+
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7132
|
+
async bulkAdd(payloads) {
|
|
7133
|
+
var _a2;
|
|
7134
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7135
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7136
|
+
const filePayloads = {};
|
|
7137
|
+
const offlineAssetTypeFieldsAttachments = [];
|
|
7138
|
+
const attachmentPayloads = [];
|
|
7139
|
+
for (const payload of payloads) {
|
|
7140
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7141
|
+
const filePayload = await this.getFilePayload(file);
|
|
7142
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7143
|
+
const offlineAssetTypeFieldsAttachment = offline({
|
|
7144
|
+
file: URL.createObjectURL(file),
|
|
7145
|
+
file_type: file.type,
|
|
7146
|
+
file_name: file.name,
|
|
7147
|
+
file_sha1: filePayload.sha1,
|
|
7148
|
+
created_by: createdBy,
|
|
7149
|
+
fields_revision: fieldsRevisionId,
|
|
7150
|
+
submitted_at: submittedAt,
|
|
7151
|
+
field_identifier: fieldIdentifier
|
|
7152
|
+
});
|
|
7153
|
+
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7154
|
+
const attachmentPayload = {
|
|
7155
|
+
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7156
|
+
file_name: file.name,
|
|
7157
|
+
field_identifier: fieldIdentifier,
|
|
7158
|
+
file_extension: filePayload.extension,
|
|
7159
|
+
file_sha1: filePayload.sha1,
|
|
7160
|
+
fields_revision: fieldsRevisionId
|
|
7161
|
+
};
|
|
7162
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7163
|
+
}
|
|
7164
|
+
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7165
|
+
const promise = this.enqueueRequest({
|
|
7166
|
+
description: "Add asset type fields attachments",
|
|
7167
|
+
method: HttpMethod.POST,
|
|
7168
|
+
url: "/asset-type-fields-attachments/bulk/",
|
|
7169
|
+
payload: {
|
|
7170
|
+
submitted_at: submittedAt,
|
|
7171
|
+
attachments: attachmentPayloads,
|
|
7172
|
+
files: Object.values(filePayloads)
|
|
7173
|
+
},
|
|
7174
|
+
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7175
|
+
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7176
|
+
});
|
|
7177
|
+
promise.then((result) => {
|
|
7178
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7179
|
+
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7180
|
+
}).catch(() => {
|
|
7181
|
+
this.dispatch(
|
|
7182
|
+
deleteAssetTypeFieldsAttachments(
|
|
7183
|
+
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7184
|
+
)
|
|
7185
|
+
);
|
|
7186
|
+
});
|
|
7187
|
+
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7188
|
+
}
|
|
7189
|
+
async refreshStore(organization) {
|
|
7190
|
+
const result = await this.enqueueRequest({
|
|
7191
|
+
description: "Get asset type fields attachments",
|
|
7192
|
+
method: HttpMethod.GET,
|
|
7193
|
+
url: "/asset-type-fields-attachments/",
|
|
7194
|
+
queryParams: {
|
|
7195
|
+
organization: organization.toString()
|
|
7196
|
+
},
|
|
7197
|
+
blockers: [organization.toString()],
|
|
7198
|
+
blocks: []
|
|
7199
|
+
});
|
|
7200
|
+
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7201
|
+
}
|
|
7202
|
+
}
|
|
7203
|
+
class AssetTypeFieldsService extends BaseApiService {
|
|
7204
|
+
add(payload) {
|
|
7205
|
+
var _a2;
|
|
7206
|
+
const { store } = this.client;
|
|
7207
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7208
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7209
|
+
const offlineAssetTypeFields = offline({
|
|
7210
|
+
...payload,
|
|
7211
|
+
created_by: createdBy,
|
|
7212
|
+
submitted_at: submittedAt
|
|
7213
|
+
});
|
|
7214
|
+
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7215
|
+
const promise = this.enqueueRequest({
|
|
7216
|
+
description: "Add Asset Type Fields",
|
|
7217
|
+
method: HttpMethod.POST,
|
|
7218
|
+
url: "/asset-type-fields/",
|
|
7219
|
+
payload: offlineAssetTypeFields,
|
|
7220
|
+
blockers: [offlineAssetTypeFields.asset_type],
|
|
7221
|
+
blocks: [offlineAssetTypeFields.offline_id]
|
|
7222
|
+
});
|
|
7223
|
+
promise.then((response) => {
|
|
7224
|
+
this.dispatch(updateAssetTypeFields(response));
|
|
7225
|
+
}).catch((error) => {
|
|
7226
|
+
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7227
|
+
throw error;
|
|
7228
|
+
});
|
|
7229
|
+
return [offlineAssetTypeFields, promise];
|
|
7230
|
+
}
|
|
7231
|
+
async refreshStore(organizationId) {
|
|
7232
|
+
const result = await this.enqueueRequest({
|
|
7233
|
+
description: "Get Asset Type Fields",
|
|
7234
|
+
method: HttpMethod.GET,
|
|
7235
|
+
url: "/asset-type-fields/",
|
|
7236
|
+
queryParams: {
|
|
7237
|
+
organization: organizationId.toString()
|
|
7238
|
+
},
|
|
7239
|
+
blockers: [],
|
|
7240
|
+
blocks: []
|
|
7241
|
+
});
|
|
7242
|
+
this.dispatch(initializeAssetTypeFields(result));
|
|
7243
|
+
}
|
|
7244
|
+
}
|
|
7245
|
+
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7246
|
+
add(payload) {
|
|
7247
|
+
var _a2;
|
|
7248
|
+
const { store } = this.client;
|
|
7249
|
+
const state = store.getState();
|
|
7250
|
+
const offlineAssetTypeFieldValues = offline({
|
|
7251
|
+
...payload,
|
|
7252
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7253
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7254
|
+
});
|
|
7255
|
+
const promise = this.enqueueRequest({
|
|
7256
|
+
description: "Add asset type field values",
|
|
7257
|
+
method: HttpMethod.POST,
|
|
7258
|
+
url: "/asset-type-field-values/",
|
|
7259
|
+
payload: offlineAssetTypeFieldValues,
|
|
7260
|
+
blockers: [payload.asset, payload.fields_revision],
|
|
7261
|
+
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7262
|
+
});
|
|
7263
|
+
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7264
|
+
promise.then((result) => {
|
|
7265
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7266
|
+
return result;
|
|
7267
|
+
}).catch(() => {
|
|
7268
|
+
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7269
|
+
});
|
|
7270
|
+
return [offlineAssetTypeFieldValues, promise];
|
|
7271
|
+
}
|
|
7272
|
+
bulkAdd(payload, batchSize) {
|
|
7273
|
+
var _a2;
|
|
7274
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7275
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
7276
|
+
const offlineAssetTypeFieldValuesMany = [];
|
|
7277
|
+
const batches = chunkArray(payload.payloads, batchSize ?? payload.payloads.length);
|
|
7278
|
+
const batchPayloads = [];
|
|
7279
|
+
for (const batch of batches) {
|
|
7280
|
+
const assetTypeFieldValuesPayloads = [];
|
|
7281
|
+
for (const payload2 of batch) {
|
|
7282
|
+
const offlineAssetTypeFieldValues = offline({
|
|
7283
|
+
...payload2,
|
|
7284
|
+
values: separateFilesFromValues(payload2.values).values,
|
|
7285
|
+
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7286
|
+
submitted_at: submittedAt
|
|
7287
|
+
});
|
|
7288
|
+
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7289
|
+
assetTypeFieldValuesPayloads.push({
|
|
7290
|
+
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7291
|
+
asset: payload2.asset,
|
|
7292
|
+
fields_revision: payload2.fields_revision,
|
|
7293
|
+
published_at: payload2.published_at,
|
|
7294
|
+
values: offlineAssetTypeFieldValues.values
|
|
7295
|
+
});
|
|
7296
|
+
}
|
|
7297
|
+
batchPayloads.push({
|
|
7298
|
+
submitted_at: submittedAt,
|
|
7299
|
+
values,
|
|
7300
|
+
field_values: assetTypeFieldValuesPayloads
|
|
7301
|
+
});
|
|
7302
|
+
}
|
|
7303
|
+
this.dispatch(addAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany));
|
|
7304
|
+
const promises = [];
|
|
7305
|
+
for (const payload2 of batchPayloads) {
|
|
7306
|
+
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7307
|
+
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7308
|
+
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7309
|
+
const promise = this.enqueueRequest({
|
|
7310
|
+
description: "Bulk add asset type field values",
|
|
7311
|
+
method: HttpMethod.POST,
|
|
7312
|
+
url: "/asset-type-field-values/bulk/",
|
|
7313
|
+
payload: payload2,
|
|
7314
|
+
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7315
|
+
blocks: assetTypeFieldValuesIds
|
|
7316
|
+
});
|
|
7317
|
+
promises.push(promise);
|
|
7318
|
+
}
|
|
7319
|
+
void Promise.all(promises).then((results) => {
|
|
7320
|
+
this.dispatch(updateAssetTypeFieldValuesMany(results.flat()));
|
|
7321
|
+
}).catch(() => {
|
|
7322
|
+
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7323
|
+
});
|
|
7324
|
+
return [offlineAssetTypeFieldValuesMany, promises];
|
|
7325
|
+
}
|
|
7326
|
+
update(payload) {
|
|
7327
|
+
const { store } = this.client;
|
|
7328
|
+
const state = store.getState();
|
|
7329
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7330
|
+
if (!assetTypeFieldValues) {
|
|
7331
|
+
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7332
|
+
}
|
|
7333
|
+
const updatedAssetTypeFieldValues = {
|
|
7334
|
+
...assetTypeFieldValues,
|
|
7335
|
+
...payload
|
|
7336
|
+
};
|
|
7337
|
+
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7338
|
+
const promise = this.enqueueRequest({
|
|
7339
|
+
description: "Delete asset type field values",
|
|
7340
|
+
method: HttpMethod.PATCH,
|
|
7341
|
+
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7342
|
+
payload,
|
|
7343
|
+
blockers: [
|
|
7344
|
+
updatedAssetTypeFieldValues.offline_id,
|
|
7345
|
+
updatedAssetTypeFieldValues.fields_revision,
|
|
7346
|
+
updatedAssetTypeFieldValues.asset
|
|
7347
|
+
],
|
|
7348
|
+
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7349
|
+
});
|
|
7350
|
+
promise.then((result) => {
|
|
7351
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7352
|
+
}).catch(() => {
|
|
7353
|
+
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7354
|
+
});
|
|
7355
|
+
return [updatedAssetTypeFieldValues, promise];
|
|
7356
|
+
}
|
|
7357
|
+
async delete(id) {
|
|
7358
|
+
const { store } = this.client;
|
|
7359
|
+
const state = store.getState();
|
|
7360
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7361
|
+
if (!assetTypeFieldValues) {
|
|
7362
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7363
|
+
}
|
|
7364
|
+
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7365
|
+
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7366
|
+
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7367
|
+
try {
|
|
7368
|
+
await this.enqueueRequest({
|
|
7369
|
+
description: "Delete asset type field values",
|
|
7370
|
+
method: HttpMethod.DELETE,
|
|
7371
|
+
url: `/asset-type-field-values/${id}/`,
|
|
7372
|
+
blockers: [id],
|
|
7373
|
+
blocks: []
|
|
7374
|
+
});
|
|
7375
|
+
} catch (e) {
|
|
7376
|
+
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7377
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7378
|
+
throw e;
|
|
7379
|
+
}
|
|
7380
|
+
}
|
|
7381
|
+
async refreshStore(projectId) {
|
|
7382
|
+
const result = await this.enqueueRequest({
|
|
7383
|
+
description: "Get asset type field values",
|
|
7384
|
+
method: HttpMethod.GET,
|
|
7385
|
+
url: "/asset-type-field-values/",
|
|
7386
|
+
queryParams: {
|
|
7387
|
+
project: projectId.toString()
|
|
7388
|
+
},
|
|
7389
|
+
blockers: [],
|
|
7390
|
+
blocks: []
|
|
7391
|
+
});
|
|
7392
|
+
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7393
|
+
}
|
|
7394
|
+
}
|
|
7395
|
+
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7396
|
+
async bulkAdd(payloads, batchSize) {
|
|
7397
|
+
var _a2;
|
|
7398
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7399
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7400
|
+
const batches = chunkArray(payloads, batchSize ?? payloads.length);
|
|
7401
|
+
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7402
|
+
const batchPayloads = [];
|
|
7403
|
+
for (const batch of batches) {
|
|
7404
|
+
const filePayloads = {};
|
|
7405
|
+
const attachmentPayloads = [];
|
|
7406
|
+
for (const payload of batch) {
|
|
7407
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7408
|
+
const filePayload = await this.getFilePayload(file);
|
|
7409
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7410
|
+
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7411
|
+
file: URL.createObjectURL(file),
|
|
7412
|
+
file_type: file.type,
|
|
7413
|
+
file_name: file.name,
|
|
7414
|
+
file_sha1: filePayload.sha1,
|
|
7415
|
+
created_by: createdBy,
|
|
7416
|
+
field_values: fieldValuesId,
|
|
7417
|
+
submitted_at: submittedAt,
|
|
7418
|
+
field_identifier: fieldIdentifier
|
|
7419
|
+
});
|
|
7420
|
+
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7421
|
+
const attachmentPayload = {
|
|
7422
|
+
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7423
|
+
file_name: file.name,
|
|
7424
|
+
file_sha1: filePayload.sha1,
|
|
7425
|
+
file_extension: filePayload.extension,
|
|
7426
|
+
field_identifier: fieldIdentifier,
|
|
7427
|
+
field_values: fieldValuesId
|
|
7428
|
+
};
|
|
7429
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7430
|
+
}
|
|
7431
|
+
batchPayloads.push({
|
|
7432
|
+
submitted_at: submittedAt,
|
|
7433
|
+
attachments: attachmentPayloads,
|
|
7434
|
+
files: Object.values(filePayloads)
|
|
7435
|
+
});
|
|
7436
|
+
}
|
|
7437
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7438
|
+
const promises = batchPayloads.map((payload) => {
|
|
7439
|
+
return this.enqueueRequest({
|
|
7440
|
+
description: "Add asset type field values attachments",
|
|
7441
|
+
method: HttpMethod.POST,
|
|
7442
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7443
|
+
payload,
|
|
7444
|
+
blockers: payload.attachments.map((payload2) => payload2.field_values),
|
|
7445
|
+
blocks: payload.attachments.map((payload2) => payload2.offline_id)
|
|
7446
|
+
});
|
|
7447
|
+
});
|
|
7448
|
+
Promise.all(promises).then((result) => {
|
|
7449
|
+
for (const res of result) this.processPresignedUrls(res.presigned_urls);
|
|
7450
|
+
const attachments = result.flatMap((res) => res.attachments);
|
|
7451
|
+
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7452
|
+
}).catch((error) => {
|
|
7453
|
+
this.dispatch(
|
|
7454
|
+
deleteAssetTypeFieldValuesAttachments(
|
|
7455
|
+
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7456
|
+
)
|
|
7457
|
+
);
|
|
7458
|
+
throw error;
|
|
7459
|
+
});
|
|
7460
|
+
return [
|
|
7461
|
+
offlineAssetTypeFieldValuesAttachments,
|
|
7462
|
+
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7463
|
+
];
|
|
7464
|
+
}
|
|
7465
|
+
async bulkDelete(ids) {
|
|
7466
|
+
const { store } = this.client;
|
|
7467
|
+
const state = store.getState();
|
|
7468
|
+
const attachments = selectAssetTypeFieldValuesAttachmentsByIds(ids)(state);
|
|
7469
|
+
this.dispatch(deleteAssetTypeFieldValuesAttachments(ids));
|
|
7470
|
+
try {
|
|
7471
|
+
await this.enqueueRequest({
|
|
7472
|
+
description: "Delete asset type field values attachments",
|
|
7473
|
+
method: HttpMethod.DELETE,
|
|
7474
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7475
|
+
payload: { attachment_ids: ids },
|
|
7476
|
+
blockers: ids,
|
|
7477
|
+
blocks: []
|
|
7478
|
+
});
|
|
7479
|
+
} catch (e) {
|
|
7480
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(attachments));
|
|
7481
|
+
throw e;
|
|
7482
|
+
}
|
|
7483
|
+
}
|
|
7484
|
+
async refreshStore(projectId) {
|
|
7485
|
+
const result = await this.enqueueRequest({
|
|
7486
|
+
description: "Get asset type field values attachments",
|
|
7487
|
+
method: HttpMethod.GET,
|
|
7488
|
+
url: "/asset-type-field-values-attachments/",
|
|
7489
|
+
queryParams: {
|
|
7490
|
+
project: projectId.toString()
|
|
7491
|
+
},
|
|
7492
|
+
blockers: [],
|
|
7493
|
+
blocks: []
|
|
7494
|
+
});
|
|
7495
|
+
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7496
|
+
}
|
|
7497
|
+
}
|
|
7498
|
+
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7499
|
+
async bulkAdd(payloads) {
|
|
7500
|
+
var _a2;
|
|
7501
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7502
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7503
|
+
const filePayloads = {};
|
|
7504
|
+
const offlineIssueTypeFieldsAttachments = [];
|
|
7505
|
+
const attachmentPayloads = [];
|
|
7506
|
+
for (const payload of payloads) {
|
|
7507
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7508
|
+
const filePayload = await this.getFilePayload(file);
|
|
7509
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7510
|
+
const offlineIssueTypeFieldsAttachment = offline({
|
|
7511
|
+
file: URL.createObjectURL(file),
|
|
7512
|
+
file_type: file.type,
|
|
7513
|
+
file_name: file.name,
|
|
7514
|
+
file_sha1: filePayload.sha1,
|
|
7515
|
+
created_by: createdBy,
|
|
7516
|
+
fields_revision: fieldsRevisionId,
|
|
7517
|
+
submitted_at: submittedAt,
|
|
7518
|
+
field_identifier: fieldIdentifier
|
|
7519
|
+
});
|
|
7520
|
+
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7521
|
+
const attachmentPayload = {
|
|
7522
|
+
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7523
|
+
file_name: file.name,
|
|
7524
|
+
file_extension: filePayload.extension,
|
|
7525
|
+
field_identifier: fieldIdentifier,
|
|
7526
|
+
file_sha1: filePayload.sha1,
|
|
7527
|
+
fields_revision: fieldsRevisionId
|
|
7528
|
+
};
|
|
7529
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7530
|
+
}
|
|
7531
|
+
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7532
|
+
const promise = this.enqueueRequest({
|
|
7533
|
+
description: "Add issue type fields attachments",
|
|
7534
|
+
method: HttpMethod.POST,
|
|
7535
|
+
url: "/issue-type-fields-attachments/bulk/",
|
|
7536
|
+
payload: {
|
|
7537
|
+
submitted_at: submittedAt,
|
|
7538
|
+
attachments: attachmentPayloads,
|
|
7539
|
+
files: Object.values(filePayloads)
|
|
7540
|
+
},
|
|
7541
|
+
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7542
|
+
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7543
|
+
});
|
|
7544
|
+
promise.then((result) => {
|
|
7545
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7546
|
+
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7547
|
+
}).catch(() => {
|
|
7548
|
+
this.dispatch(
|
|
7549
|
+
deleteIssueTypeFieldsAttachments(
|
|
7550
|
+
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7551
|
+
)
|
|
7552
|
+
);
|
|
7553
|
+
});
|
|
7554
|
+
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7555
|
+
}
|
|
7556
|
+
async refreshStore(organizationId) {
|
|
7557
|
+
const result = await this.enqueueRequest({
|
|
7558
|
+
description: "get issue type fields attachments",
|
|
7559
|
+
method: HttpMethod.GET,
|
|
7560
|
+
url: "/issue-type-fields-attachments/",
|
|
7561
|
+
queryParams: {
|
|
7562
|
+
organization: organizationId.toString()
|
|
7563
|
+
},
|
|
7564
|
+
blockers: [organizationId.toString()],
|
|
7565
|
+
blocks: []
|
|
7566
|
+
});
|
|
7567
|
+
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7568
|
+
}
|
|
7569
|
+
}
|
|
7570
|
+
class IssueTypeFieldsService extends BaseApiService {
|
|
7571
|
+
add(payload) {
|
|
7572
|
+
var _a2;
|
|
7573
|
+
const { store } = this.client;
|
|
7574
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7575
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7576
|
+
const offlineIssueTypeFields = offline({
|
|
7577
|
+
...payload,
|
|
7578
|
+
created_by: createdBy,
|
|
7579
|
+
submitted_at: submittedAt
|
|
7580
|
+
});
|
|
7581
|
+
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7582
|
+
const promise = this.enqueueRequest({
|
|
7583
|
+
description: "Add Issue Type Fields",
|
|
7584
|
+
method: HttpMethod.POST,
|
|
7585
|
+
url: "/issue-type-fields/",
|
|
7586
|
+
payload: offlineIssueTypeFields,
|
|
7587
|
+
blockers: [offlineIssueTypeFields.issue_type],
|
|
7588
|
+
blocks: [offlineIssueTypeFields.offline_id]
|
|
7589
|
+
});
|
|
7590
|
+
promise.then((response) => {
|
|
7591
|
+
this.dispatch(updateIssueTypeFields(response));
|
|
7592
|
+
}).catch((error) => {
|
|
7593
|
+
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7594
|
+
throw error;
|
|
7595
|
+
});
|
|
7596
|
+
return [offlineIssueTypeFields, promise];
|
|
7597
|
+
}
|
|
7598
|
+
async refreshStore(organizationId) {
|
|
7599
|
+
const result = await this.enqueueRequest({
|
|
7600
|
+
description: "Get Issue Type Fields",
|
|
7601
|
+
method: HttpMethod.GET,
|
|
7602
|
+
url: "/issue-type-fields/",
|
|
7603
|
+
queryParams: {
|
|
7604
|
+
organization: organizationId.toString()
|
|
7605
|
+
},
|
|
7606
|
+
blockers: [],
|
|
7607
|
+
blocks: []
|
|
7608
|
+
});
|
|
7609
|
+
this.dispatch(initializeIssueTypeFields(result));
|
|
7610
|
+
}
|
|
7611
|
+
}
|
|
7612
|
+
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7613
|
+
async bulkAdd(payloads) {
|
|
7614
|
+
var _a2;
|
|
7615
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7616
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7617
|
+
const filePayloads = {};
|
|
7618
|
+
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7619
|
+
const attachmentPayloads = [];
|
|
7620
|
+
for (const payload of payloads) {
|
|
7621
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7622
|
+
const filePayload = await this.getFilePayload(file);
|
|
7623
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7624
|
+
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7625
|
+
file: URL.createObjectURL(file),
|
|
7626
|
+
file_type: file.type,
|
|
7627
|
+
file_name: file.name,
|
|
7628
|
+
file_sha1: filePayload.sha1,
|
|
7629
|
+
created_by: createdBy,
|
|
7630
|
+
field_values: fieldValuesId,
|
|
7631
|
+
submitted_at: submittedAt,
|
|
7632
|
+
field_identifier: fieldIdentifier
|
|
7633
|
+
});
|
|
7634
|
+
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7635
|
+
const attachmentPayload = {
|
|
7636
|
+
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7637
|
+
file_name: file.name,
|
|
7638
|
+
file_sha1: filePayload.sha1,
|
|
7639
|
+
file_extension: filePayload.extension,
|
|
7640
|
+
field_identifier: fieldIdentifier,
|
|
7641
|
+
field_values: fieldValuesId
|
|
7642
|
+
};
|
|
7643
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7644
|
+
}
|
|
7645
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7646
|
+
const promise = this.enqueueRequest({
|
|
7647
|
+
description: "Add issue type field values attachments",
|
|
7648
|
+
method: HttpMethod.POST,
|
|
7649
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7650
|
+
payload: {
|
|
7651
|
+
submitted_at: submittedAt,
|
|
7652
|
+
attachments: attachmentPayloads,
|
|
7653
|
+
files: Object.values(filePayloads)
|
|
7654
|
+
},
|
|
7655
|
+
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7656
|
+
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7657
|
+
});
|
|
7658
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7659
|
+
this.processPresignedUrls(presigned_urls);
|
|
7660
|
+
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7661
|
+
}).catch((error) => {
|
|
7662
|
+
this.dispatch(
|
|
7663
|
+
deleteIssueTypeFieldValuesAttachments(
|
|
7664
|
+
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7665
|
+
)
|
|
7666
|
+
);
|
|
7667
|
+
throw error;
|
|
7668
|
+
});
|
|
7669
|
+
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7670
|
+
}
|
|
7671
|
+
async bulkDelete(attachmentsIds) {
|
|
7672
|
+
const { store } = this.client;
|
|
7673
|
+
const state = store.getState();
|
|
7674
|
+
const attachments = selectIssueTypeFieldValuesAttachmentsByIds(attachmentsIds)(state);
|
|
7675
|
+
this.dispatch(deleteIssueTypeFieldValuesAttachments(attachmentsIds));
|
|
7676
|
+
try {
|
|
7677
|
+
await this.enqueueRequest({
|
|
7678
|
+
description: "Delete issue type field values attachments",
|
|
7679
|
+
method: HttpMethod.DELETE,
|
|
7680
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7681
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7682
|
+
blockers: attachmentsIds,
|
|
7683
|
+
blocks: []
|
|
7684
|
+
});
|
|
7685
|
+
} catch (e) {
|
|
7686
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(attachments));
|
|
7687
|
+
throw e;
|
|
7688
|
+
}
|
|
7689
|
+
}
|
|
7690
|
+
async refreshStore(projectId) {
|
|
7691
|
+
const result = await this.enqueueRequest({
|
|
7692
|
+
description: "Get issue type field values attachments",
|
|
7693
|
+
method: HttpMethod.GET,
|
|
7694
|
+
url: "/issue-type-field-values-attachments/",
|
|
7695
|
+
queryParams: {
|
|
7696
|
+
project: projectId.toString()
|
|
7697
|
+
},
|
|
7698
|
+
blockers: [],
|
|
7699
|
+
blocks: []
|
|
7700
|
+
});
|
|
7701
|
+
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
class IssueTypeFieldValuesService extends BaseApiService {
|
|
7705
|
+
add(payload) {
|
|
7706
|
+
var _a2;
|
|
7707
|
+
const { store } = this.client;
|
|
7708
|
+
const state = store.getState();
|
|
7709
|
+
const offlineIssueTypeFieldValues = offline({
|
|
7710
|
+
...payload,
|
|
7711
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7712
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7713
|
+
});
|
|
7714
|
+
const promise = this.enqueueRequest({
|
|
7715
|
+
description: "Add issue type field values",
|
|
7716
|
+
method: HttpMethod.POST,
|
|
7717
|
+
url: "/issue-type-field-values/",
|
|
7718
|
+
payload: offlineIssueTypeFieldValues,
|
|
7719
|
+
blockers: [payload.issue, payload.fields_revision],
|
|
7720
|
+
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
7721
|
+
});
|
|
7722
|
+
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
7723
|
+
promise.then((result) => {
|
|
7724
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
7725
|
+
return result;
|
|
7726
|
+
}).catch(() => {
|
|
7727
|
+
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
7728
|
+
});
|
|
7729
|
+
return [offlineIssueTypeFieldValues, promise];
|
|
7730
|
+
}
|
|
7731
|
+
update(payload) {
|
|
7732
|
+
const { store } = this.client;
|
|
7733
|
+
const state = store.getState();
|
|
7734
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
7735
|
+
if (!issueTypeFieldValues) {
|
|
7736
|
+
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7737
|
+
}
|
|
7738
|
+
const updatedIssueTypeFieldValues = {
|
|
7739
|
+
...issueTypeFieldValues,
|
|
7740
|
+
...payload
|
|
7741
|
+
};
|
|
7742
|
+
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
7743
|
+
const promise = this.enqueueRequest({
|
|
7744
|
+
description: "Update issue type field values",
|
|
7745
|
+
method: HttpMethod.PATCH,
|
|
7746
|
+
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
7747
|
+
payload,
|
|
7748
|
+
blockers: [
|
|
7749
|
+
updatedIssueTypeFieldValues.offline_id,
|
|
7750
|
+
updatedIssueTypeFieldValues.fields_revision,
|
|
7751
|
+
updatedIssueTypeFieldValues.issue
|
|
7752
|
+
],
|
|
7753
|
+
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
7754
|
+
});
|
|
7755
|
+
promise.then((result) => {
|
|
7756
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
7757
|
+
}).catch(() => {
|
|
7758
|
+
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
7759
|
+
});
|
|
7760
|
+
return [updatedIssueTypeFieldValues, promise];
|
|
7761
|
+
}
|
|
7762
|
+
async delete(id) {
|
|
7763
|
+
const { store } = this.client;
|
|
7764
|
+
const state = store.getState();
|
|
7765
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
7766
|
+
if (!issueTypeFieldValues) {
|
|
7767
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7768
|
+
}
|
|
7769
|
+
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
7770
|
+
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
7771
|
+
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7772
|
+
try {
|
|
7773
|
+
await this.enqueueRequest({
|
|
7774
|
+
description: "Delete issue type field values",
|
|
7775
|
+
method: HttpMethod.DELETE,
|
|
7776
|
+
url: `/issue-type-field-values/${id}/`,
|
|
7777
|
+
blockers: [id],
|
|
7778
|
+
blocks: []
|
|
7779
|
+
});
|
|
7780
|
+
} catch (e) {
|
|
7781
|
+
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
7782
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
7783
|
+
throw e;
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7786
|
+
async refreshStore(projectId) {
|
|
7787
|
+
const result = await this.enqueueRequest({
|
|
7788
|
+
description: "Get issue type field values",
|
|
7789
|
+
method: HttpMethod.GET,
|
|
7790
|
+
url: "/issue-type-field-values/",
|
|
7791
|
+
queryParams: {
|
|
7792
|
+
project: projectId.toString()
|
|
7793
|
+
},
|
|
7794
|
+
blockers: [],
|
|
7795
|
+
blocks: []
|
|
7796
|
+
});
|
|
7797
|
+
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
7798
|
+
}
|
|
7799
|
+
}
|
|
7238
7800
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
7239
7801
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
7240
7802
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -7251,6 +7813,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7251
7813
|
exports2.AssetStageCompletionService = AssetStageCompletionService;
|
|
7252
7814
|
exports2.AssetStageService = AssetStageService;
|
|
7253
7815
|
exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
|
|
7816
|
+
exports2.AssetTypeFieldValuesAttachmentService = AssetTypeFieldValuesAttachmentService;
|
|
7817
|
+
exports2.AssetTypeFieldValuesService = AssetTypeFieldValuesService;
|
|
7818
|
+
exports2.AssetTypeFieldsAttachmentService = AssetTypeFieldsAttachmentService;
|
|
7819
|
+
exports2.AssetTypeFieldsService = AssetTypeFieldsService;
|
|
7254
7820
|
exports2.AssetTypeService = AssetTypeService;
|
|
7255
7821
|
exports2.AttachmentModel = AttachmentModel;
|
|
7256
7822
|
exports2.BaseApiService = BaseApiService;
|
|
@@ -7266,7 +7832,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7266
7832
|
exports2.EmailDomainsService = EmailDomainsService;
|
|
7267
7833
|
exports2.EmailVerificationService = EmailVerificationService;
|
|
7268
7834
|
exports2.FileService = FileService;
|
|
7835
|
+
exports2.FormRevisionAttachmentService = FormRevisionAttachmentService;
|
|
7836
|
+
exports2.FormRevisionService = FormRevisionService;
|
|
7269
7837
|
exports2.FormService = FormService;
|
|
7838
|
+
exports2.FormSubmissionAttachmentService = FormSubmissionAttachmentService;
|
|
7270
7839
|
exports2.FormSubmissionService = FormSubmissionService;
|
|
7271
7840
|
exports2.GREEN = GREEN;
|
|
7272
7841
|
exports2.GeoImageService = GeoImageService;
|
|
@@ -7277,6 +7846,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7277
7846
|
exports2.IssuePriority = IssuePriority;
|
|
7278
7847
|
exports2.IssueService = IssueService;
|
|
7279
7848
|
exports2.IssueStatus = IssueStatus;
|
|
7849
|
+
exports2.IssueTypeFieldValuesAttachmentService = IssueTypeFieldValuesAttachmentService;
|
|
7850
|
+
exports2.IssueTypeFieldValuesService = IssueTypeFieldValuesService;
|
|
7851
|
+
exports2.IssueTypeFieldsAttachmentService = IssueTypeFieldsAttachmentService;
|
|
7852
|
+
exports2.IssueTypeFieldsService = IssueTypeFieldsService;
|
|
7280
7853
|
exports2.IssueTypeService = IssueTypeService;
|
|
7281
7854
|
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
7282
7855
|
exports2.IssueUpdateService = IssueUpdateService;
|
|
@@ -7296,6 +7869,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7296
7869
|
exports2.ProjectFileService = ProjectFileService;
|
|
7297
7870
|
exports2.ProjectService = ProjectService;
|
|
7298
7871
|
exports2.TeamService = TeamService;
|
|
7872
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
7299
7873
|
exports2.UserService = UserService;
|
|
7300
7874
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
7301
7875
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
@@ -7314,6 +7888,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7314
7888
|
exports2.addAssetType = addAssetType;
|
|
7315
7889
|
exports2.addAssetTypeAttachment = addAssetTypeAttachment;
|
|
7316
7890
|
exports2.addAssetTypeAttachments = addAssetTypeAttachments;
|
|
7891
|
+
exports2.addAssetTypeFieldValues = addAssetTypeFieldValues;
|
|
7892
|
+
exports2.addAssetTypeFieldValuesAttachment = addAssetTypeFieldValuesAttachment;
|
|
7893
|
+
exports2.addAssetTypeFieldValuesAttachments = addAssetTypeFieldValuesAttachments;
|
|
7894
|
+
exports2.addAssetTypeFieldValuesMany = addAssetTypeFieldValuesMany;
|
|
7895
|
+
exports2.addAssetTypeFields = addAssetTypeFields;
|
|
7896
|
+
exports2.addAssetTypeFieldsAttachment = addAssetTypeFieldsAttachment;
|
|
7897
|
+
exports2.addAssetTypeFieldsAttachments = addAssetTypeFieldsAttachments;
|
|
7898
|
+
exports2.addAssetTypeFieldsMany = addAssetTypeFieldsMany;
|
|
7317
7899
|
exports2.addAssetTypes = addAssetTypes;
|
|
7318
7900
|
exports2.addAssets = addAssets;
|
|
7319
7901
|
exports2.addCategory = addCategory;
|
|
@@ -7342,6 +7924,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7342
7924
|
exports2.addIssueComment = addIssueComment;
|
|
7343
7925
|
exports2.addIssueComments = addIssueComments;
|
|
7344
7926
|
exports2.addIssueType = addIssueType;
|
|
7927
|
+
exports2.addIssueTypeFieldValues = addIssueTypeFieldValues;
|
|
7928
|
+
exports2.addIssueTypeFieldValuesAttachment = addIssueTypeFieldValuesAttachment;
|
|
7929
|
+
exports2.addIssueTypeFieldValuesAttachments = addIssueTypeFieldValuesAttachments;
|
|
7930
|
+
exports2.addIssueTypeFieldValuesMany = addIssueTypeFieldValuesMany;
|
|
7931
|
+
exports2.addIssueTypeFields = addIssueTypeFields;
|
|
7932
|
+
exports2.addIssueTypeFieldsAttachment = addIssueTypeFieldsAttachment;
|
|
7933
|
+
exports2.addIssueTypeFieldsAttachments = addIssueTypeFieldsAttachments;
|
|
7934
|
+
exports2.addIssueTypeFieldsMany = addIssueTypeFieldsMany;
|
|
7345
7935
|
exports2.addIssueUpdate = addIssueUpdate;
|
|
7346
7936
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
7347
7937
|
exports2.addIssues = addIssues;
|
|
@@ -7366,6 +7956,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7366
7956
|
exports2.assetStageSlice = assetStageSlice;
|
|
7367
7957
|
exports2.assetTypeAttachmentReducer = assetTypeAttachmentReducer;
|
|
7368
7958
|
exports2.assetTypeAttachmentSlice = assetTypeAttachmentSlice;
|
|
7959
|
+
exports2.assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentReducer;
|
|
7960
|
+
exports2.assetTypeFieldValuesAttachmentSlice = assetTypeFieldValuesAttachmentSlice;
|
|
7961
|
+
exports2.assetTypeFieldValuesReducer = assetTypeFieldValuesReducer;
|
|
7962
|
+
exports2.assetTypeFieldValuesSlice = assetTypeFieldValuesSlice;
|
|
7963
|
+
exports2.assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentReducer;
|
|
7964
|
+
exports2.assetTypeFieldsAttachmentSlice = assetTypeFieldsAttachmentSlice;
|
|
7965
|
+
exports2.assetTypeFieldsReducer = assetTypeFieldsReducer;
|
|
7966
|
+
exports2.assetTypeFieldsSlice = assetTypeFieldsSlice;
|
|
7369
7967
|
exports2.assetTypeReducer = assetTypeReducer;
|
|
7370
7968
|
exports2.assetTypeSlice = assetTypeSlice;
|
|
7371
7969
|
exports2.authReducer = authReducer;
|
|
@@ -7394,6 +7992,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7394
7992
|
exports2.deleteAssetType = deleteAssetType;
|
|
7395
7993
|
exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
|
|
7396
7994
|
exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
|
|
7995
|
+
exports2.deleteAssetTypeFieldValues = deleteAssetTypeFieldValues;
|
|
7996
|
+
exports2.deleteAssetTypeFieldValuesAttachment = deleteAssetTypeFieldValuesAttachment;
|
|
7997
|
+
exports2.deleteAssetTypeFieldValuesAttachments = deleteAssetTypeFieldValuesAttachments;
|
|
7998
|
+
exports2.deleteAssetTypeFieldValuesMany = deleteAssetTypeFieldValuesMany;
|
|
7999
|
+
exports2.deleteAssetTypeFields = deleteAssetTypeFields;
|
|
8000
|
+
exports2.deleteAssetTypeFieldsAttachment = deleteAssetTypeFieldsAttachment;
|
|
8001
|
+
exports2.deleteAssetTypeFieldsAttachments = deleteAssetTypeFieldsAttachments;
|
|
8002
|
+
exports2.deleteAssetTypeFieldsMany = deleteAssetTypeFieldsMany;
|
|
7397
8003
|
exports2.deleteAssetTypes = deleteAssetTypes;
|
|
7398
8004
|
exports2.deleteAssets = deleteAssets;
|
|
7399
8005
|
exports2.deleteCategory = deleteCategory;
|
|
@@ -7418,6 +8024,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7418
8024
|
exports2.deleteIssueAttachments = deleteIssueAttachments;
|
|
7419
8025
|
exports2.deleteIssueComment = deleteIssueComment;
|
|
7420
8026
|
exports2.deleteIssueComments = deleteIssueComments;
|
|
8027
|
+
exports2.deleteIssueTypeFieldValues = deleteIssueTypeFieldValues;
|
|
8028
|
+
exports2.deleteIssueTypeFieldValuesAttachment = deleteIssueTypeFieldValuesAttachment;
|
|
8029
|
+
exports2.deleteIssueTypeFieldValuesAttachments = deleteIssueTypeFieldValuesAttachments;
|
|
8030
|
+
exports2.deleteIssueTypeFieldValuesMany = deleteIssueTypeFieldValuesMany;
|
|
8031
|
+
exports2.deleteIssueTypeFields = deleteIssueTypeFields;
|
|
8032
|
+
exports2.deleteIssueTypeFieldsAttachment = deleteIssueTypeFieldsAttachment;
|
|
8033
|
+
exports2.deleteIssueTypeFieldsAttachments = deleteIssueTypeFieldsAttachments;
|
|
8034
|
+
exports2.deleteIssueTypeFieldsMany = deleteIssueTypeFieldsMany;
|
|
7421
8035
|
exports2.deleteIssueUpdate = deleteIssueUpdate;
|
|
7422
8036
|
exports2.deleteIssueUpdates = deleteIssueUpdates;
|
|
7423
8037
|
exports2.deleteIssues = deleteIssues;
|
|
@@ -7474,6 +8088,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7474
8088
|
exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
|
|
7475
8089
|
exports2.initializeAssetStages = initializeAssetStages;
|
|
7476
8090
|
exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
|
|
8091
|
+
exports2.initializeAssetTypeFieldValues = initializeAssetTypeFieldValues;
|
|
8092
|
+
exports2.initializeAssetTypeFieldValuesAttachments = initializeAssetTypeFieldValuesAttachments;
|
|
8093
|
+
exports2.initializeAssetTypeFields = initializeAssetTypeFields;
|
|
8094
|
+
exports2.initializeAssetTypeFieldsAttachments = initializeAssetTypeFieldsAttachments;
|
|
7477
8095
|
exports2.initializeAssetTypes = initializeAssetTypes;
|
|
7478
8096
|
exports2.initializeAssets = initializeAssets;
|
|
7479
8097
|
exports2.initializeCategories = initializeCategories;
|
|
@@ -7488,6 +8106,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7488
8106
|
exports2.initializeGeoImages = initializeGeoImages;
|
|
7489
8107
|
exports2.initializeIssueAssociations = initializeIssueAssociations;
|
|
7490
8108
|
exports2.initializeIssueAttachments = initializeIssueAttachments;
|
|
8109
|
+
exports2.initializeIssueTypeFieldValues = initializeIssueTypeFieldValues;
|
|
8110
|
+
exports2.initializeIssueTypeFieldValuesAttachments = initializeIssueTypeFieldValuesAttachments;
|
|
8111
|
+
exports2.initializeIssueTypeFields = initializeIssueTypeFields;
|
|
8112
|
+
exports2.initializeIssueTypeFieldsAttachments = initializeIssueTypeFieldsAttachments;
|
|
7491
8113
|
exports2.initializeIssueTypes = initializeIssueTypes;
|
|
7492
8114
|
exports2.initializeIssueUpdates = initializeIssueUpdates;
|
|
7493
8115
|
exports2.initializeIssues = initializeIssues;
|
|
@@ -7506,6 +8128,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7506
8128
|
exports2.issueCommentSlice = issueCommentSlice;
|
|
7507
8129
|
exports2.issueReducer = issueReducer;
|
|
7508
8130
|
exports2.issueSlice = issueSlice;
|
|
8131
|
+
exports2.issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentReducer;
|
|
8132
|
+
exports2.issueTypeFieldValuesAttachmentSlice = issueTypeFieldValuesAttachmentSlice;
|
|
8133
|
+
exports2.issueTypeFieldValuesReducer = issueTypeFieldValuesReducer;
|
|
8134
|
+
exports2.issueTypeFieldValuesSlice = issueTypeFieldValuesSlice;
|
|
8135
|
+
exports2.issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentReducer;
|
|
8136
|
+
exports2.issueTypeFieldsAttachmentSlice = issueTypeFieldsAttachmentSlice;
|
|
8137
|
+
exports2.issueTypeFieldsReducer = issueTypeFieldsReducer;
|
|
8138
|
+
exports2.issueTypeFieldsSlice = issueTypeFieldsSlice;
|
|
7509
8139
|
exports2.issueTypeReducer = issueTypeReducer;
|
|
7510
8140
|
exports2.issueTypeSlice = issueTypeSlice;
|
|
7511
8141
|
exports2.issueUpdateReducer = issueUpdateReducer;
|
|
@@ -7575,7 +8205,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7575
8205
|
exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
|
|
7576
8206
|
exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
|
|
7577
8207
|
exports2.selectAssetTypeById = selectAssetTypeById;
|
|
8208
|
+
exports2.selectAssetTypeFieldValues = selectAssetTypeFieldValues;
|
|
8209
|
+
exports2.selectAssetTypeFieldValuesAttachmentById = selectAssetTypeFieldValuesAttachmentById;
|
|
8210
|
+
exports2.selectAssetTypeFieldValuesAttachments = selectAssetTypeFieldValuesAttachments;
|
|
8211
|
+
exports2.selectAssetTypeFieldValuesAttachmentsByIds = selectAssetTypeFieldValuesAttachmentsByIds;
|
|
8212
|
+
exports2.selectAssetTypeFieldValuesAttachmentsMapping = selectAssetTypeFieldValuesAttachmentsMapping;
|
|
8213
|
+
exports2.selectAssetTypeFieldValuesById = selectAssetTypeFieldValuesById;
|
|
8214
|
+
exports2.selectAssetTypeFieldValuesMapping = selectAssetTypeFieldValuesMapping;
|
|
8215
|
+
exports2.selectAssetTypeFieldValuesOfAsset = selectAssetTypeFieldValuesOfAsset;
|
|
8216
|
+
exports2.selectAssetTypeFields = selectAssetTypeFields;
|
|
8217
|
+
exports2.selectAssetTypeFieldsAttachmentById = selectAssetTypeFieldsAttachmentById;
|
|
8218
|
+
exports2.selectAssetTypeFieldsAttachments = selectAssetTypeFieldsAttachments;
|
|
8219
|
+
exports2.selectAssetTypeFieldsAttachmentsMapping = selectAssetTypeFieldsAttachmentsMapping;
|
|
8220
|
+
exports2.selectAssetTypeFieldsById = selectAssetTypeFieldsById;
|
|
8221
|
+
exports2.selectAssetTypeFieldsMapping = selectAssetTypeFieldsMapping;
|
|
8222
|
+
exports2.selectAssetTypeFieldsOfAssetType = selectAssetTypeFieldsOfAssetType;
|
|
7578
8223
|
exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
|
|
8224
|
+
exports2.selectAssetTypeValuesOfAssetType = selectAssetTypeValuesOfAssetType;
|
|
7579
8225
|
exports2.selectAssetTypes = selectAssetTypes;
|
|
7580
8226
|
exports2.selectAssetTypesByIds = selectAssetTypesByIds;
|
|
7581
8227
|
exports2.selectAssetTypesMapping = selectAssetTypesMapping;
|
|
@@ -7583,18 +8229,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7583
8229
|
exports2.selectAssetsByIds = selectAssetsByIds;
|
|
7584
8230
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
7585
8231
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7586
|
-
exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
|
|
7587
|
-
exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
|
|
7588
8232
|
exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
|
|
7589
8233
|
exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
|
|
7590
8234
|
exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
|
|
7591
8235
|
exports2.selectAttachmentsOfAssetTypeByType = selectAttachmentsOfAssetTypeByType;
|
|
8236
|
+
exports2.selectAttachmentsOfAssetTypeFieldValues = selectAttachmentsOfAssetTypeFieldValues;
|
|
8237
|
+
exports2.selectAttachmentsOfAssetTypeFields = selectAttachmentsOfAssetTypeFields;
|
|
7592
8238
|
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
7593
8239
|
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
7594
8240
|
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
7595
8241
|
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
7596
8242
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
7597
8243
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
8244
|
+
exports2.selectAttachmentsOfIssueTypeFieldValues = selectAttachmentsOfIssueTypeFieldValues;
|
|
8245
|
+
exports2.selectAttachmentsOfIssueTypeFields = selectAttachmentsOfIssueTypeFields;
|
|
7598
8246
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
7599
8247
|
exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
|
|
7600
8248
|
exports2.selectCategories = selectCategories;
|
|
@@ -7622,8 +8270,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7622
8270
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
7623
8271
|
exports2.selectFormById = selectFormById;
|
|
7624
8272
|
exports2.selectFormMapping = selectFormMapping;
|
|
7625
|
-
exports2.selectFormOfAssetType = selectFormOfAssetType;
|
|
7626
|
-
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
7627
8273
|
exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
|
|
7628
8274
|
exports2.selectFormRevisionById = selectFormRevisionById;
|
|
7629
8275
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
@@ -7633,16 +8279,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7633
8279
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
7634
8280
|
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
7635
8281
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
7636
|
-
exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
|
|
7637
|
-
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
7638
|
-
exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
|
|
7639
8282
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
7640
8283
|
exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
|
|
7641
8284
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
7642
8285
|
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
7643
8286
|
exports2.selectForms = selectForms;
|
|
7644
|
-
exports2.selectFormsCount = selectFormsCount;
|
|
7645
|
-
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
7646
8287
|
exports2.selectGeoImageById = selectGeoImageById;
|
|
7647
8288
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
7648
8289
|
exports2.selectGeoImages = selectGeoImages;
|
|
@@ -7664,7 +8305,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7664
8305
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
7665
8306
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
7666
8307
|
exports2.selectIssueTypeById = selectIssueTypeById;
|
|
8308
|
+
exports2.selectIssueTypeFieldValues = selectIssueTypeFieldValues;
|
|
8309
|
+
exports2.selectIssueTypeFieldValuesAttachmentById = selectIssueTypeFieldValuesAttachmentById;
|
|
8310
|
+
exports2.selectIssueTypeFieldValuesAttachments = selectIssueTypeFieldValuesAttachments;
|
|
8311
|
+
exports2.selectIssueTypeFieldValuesAttachmentsByIds = selectIssueTypeFieldValuesAttachmentsByIds;
|
|
8312
|
+
exports2.selectIssueTypeFieldValuesAttachmentsMapping = selectIssueTypeFieldValuesAttachmentsMapping;
|
|
8313
|
+
exports2.selectIssueTypeFieldValuesById = selectIssueTypeFieldValuesById;
|
|
8314
|
+
exports2.selectIssueTypeFieldValuesMapping = selectIssueTypeFieldValuesMapping;
|
|
8315
|
+
exports2.selectIssueTypeFieldValuesOfIssue = selectIssueTypeFieldValuesOfIssue;
|
|
8316
|
+
exports2.selectIssueTypeFields = selectIssueTypeFields;
|
|
8317
|
+
exports2.selectIssueTypeFieldsAttachmentById = selectIssueTypeFieldsAttachmentById;
|
|
8318
|
+
exports2.selectIssueTypeFieldsAttachments = selectIssueTypeFieldsAttachments;
|
|
8319
|
+
exports2.selectIssueTypeFieldsAttachmentsMapping = selectIssueTypeFieldsAttachmentsMapping;
|
|
8320
|
+
exports2.selectIssueTypeFieldsById = selectIssueTypeFieldsById;
|
|
8321
|
+
exports2.selectIssueTypeFieldsMapping = selectIssueTypeFieldsMapping;
|
|
8322
|
+
exports2.selectIssueTypeFieldsOfIssueType = selectIssueTypeFieldsOfIssueType;
|
|
7667
8323
|
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
8324
|
+
exports2.selectIssueTypeValuesOfIssueType = selectIssueTypeValuesOfIssueType;
|
|
7668
8325
|
exports2.selectIssueTypes = selectIssueTypes;
|
|
7669
8326
|
exports2.selectIssueTypesByIds = selectIssueTypesByIds;
|
|
7670
8327
|
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
@@ -7673,8 +8330,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7673
8330
|
exports2.selectIssuesByIds = selectIssuesByIds;
|
|
7674
8331
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
7675
8332
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
7676
|
-
exports2.
|
|
8333
|
+
exports2.selectLatestAssetTypeFieldsOfAssetType = selectLatestAssetTypeFieldsOfAssetType;
|
|
7677
8334
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
8335
|
+
exports2.selectLatestIssueTypeFieldsOfIssueType = selectLatestIssueTypeFieldsOfIssueType;
|
|
7678
8336
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
7679
8337
|
exports2.selectLicense = selectLicense;
|
|
7680
8338
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
@@ -7711,10 +8369,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7711
8369
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
7712
8370
|
exports2.selectRehydrated = selectRehydrated;
|
|
7713
8371
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
7714
|
-
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
7715
8372
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
7716
8373
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
7717
|
-
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
7718
8374
|
exports2.selectStageMapping = selectStageMapping;
|
|
7719
8375
|
exports2.selectStagesOfAssetType = selectStagesOfAssetType;
|
|
7720
8376
|
exports2.selectTeamById = selectTeamById;
|
|
@@ -7730,6 +8386,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7730
8386
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
7731
8387
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
7732
8388
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
8389
|
+
exports2.separateFilesFromValues = separateFilesFromValues;
|
|
8390
|
+
exports2.separateImageFromFields = separateImageFromFields;
|
|
7733
8391
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
7734
8392
|
exports2.setAsset = setAsset;
|
|
7735
8393
|
exports2.setAssetAttachment = setAssetAttachment;
|
|
@@ -7739,6 +8397,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7739
8397
|
exports2.setAssetType = setAssetType;
|
|
7740
8398
|
exports2.setAssetTypeAttachment = setAssetTypeAttachment;
|
|
7741
8399
|
exports2.setAssetTypeAttachments = setAssetTypeAttachments;
|
|
8400
|
+
exports2.setAssetTypeFieldValues = setAssetTypeFieldValues;
|
|
8401
|
+
exports2.setAssetTypeFieldValuesAttachment = setAssetTypeFieldValuesAttachment;
|
|
8402
|
+
exports2.setAssetTypeFieldValuesAttachments = setAssetTypeFieldValuesAttachments;
|
|
8403
|
+
exports2.setAssetTypeFieldValuesMany = setAssetTypeFieldValuesMany;
|
|
8404
|
+
exports2.setAssetTypeFields = setAssetTypeFields;
|
|
8405
|
+
exports2.setAssetTypeFieldsAttachment = setAssetTypeFieldsAttachment;
|
|
8406
|
+
exports2.setAssetTypeFieldsAttachments = setAssetTypeFieldsAttachments;
|
|
8407
|
+
exports2.setAssetTypeFieldsMany = setAssetTypeFieldsMany;
|
|
7742
8408
|
exports2.setAssetTypes = setAssetTypes;
|
|
7743
8409
|
exports2.setAssets = setAssets;
|
|
7744
8410
|
exports2.setConversation = setConversation;
|
|
@@ -7764,6 +8430,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7764
8430
|
exports2.setIssueComment = setIssueComment;
|
|
7765
8431
|
exports2.setIssueComments = setIssueComments;
|
|
7766
8432
|
exports2.setIssueType = setIssueType;
|
|
8433
|
+
exports2.setIssueTypeFieldValues = setIssueTypeFieldValues;
|
|
8434
|
+
exports2.setIssueTypeFieldValuesAttachment = setIssueTypeFieldValuesAttachment;
|
|
8435
|
+
exports2.setIssueTypeFieldValuesAttachments = setIssueTypeFieldValuesAttachments;
|
|
8436
|
+
exports2.setIssueTypeFieldValuesMany = setIssueTypeFieldValuesMany;
|
|
8437
|
+
exports2.setIssueTypeFields = setIssueTypeFields;
|
|
8438
|
+
exports2.setIssueTypeFieldsAttachment = setIssueTypeFieldsAttachment;
|
|
8439
|
+
exports2.setIssueTypeFieldsAttachments = setIssueTypeFieldsAttachments;
|
|
8440
|
+
exports2.setIssueTypeFieldsMany = setIssueTypeFieldsMany;
|
|
7767
8441
|
exports2.setIssueUpdate = setIssueUpdate;
|
|
7768
8442
|
exports2.setLoggedIn = setLoggedIn;
|
|
7769
8443
|
exports2.setOrganizations = setOrganizations;
|
|
@@ -7796,6 +8470,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7796
8470
|
exports2.updateAssetType = updateAssetType;
|
|
7797
8471
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
7798
8472
|
exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
|
|
8473
|
+
exports2.updateAssetTypeFieldValues = updateAssetTypeFieldValues;
|
|
8474
|
+
exports2.updateAssetTypeFieldValuesAttachment = updateAssetTypeFieldValuesAttachment;
|
|
8475
|
+
exports2.updateAssetTypeFieldValuesAttachments = updateAssetTypeFieldValuesAttachments;
|
|
8476
|
+
exports2.updateAssetTypeFieldValuesMany = updateAssetTypeFieldValuesMany;
|
|
8477
|
+
exports2.updateAssetTypeFields = updateAssetTypeFields;
|
|
8478
|
+
exports2.updateAssetTypeFieldsAttachment = updateAssetTypeFieldsAttachment;
|
|
8479
|
+
exports2.updateAssetTypeFieldsAttachments = updateAssetTypeFieldsAttachments;
|
|
8480
|
+
exports2.updateAssetTypeFieldsMany = updateAssetTypeFieldsMany;
|
|
7799
8481
|
exports2.updateAssetTypes = updateAssetTypes;
|
|
7800
8482
|
exports2.updateAssets = updateAssets;
|
|
7801
8483
|
exports2.updateCategory = updateCategory;
|
|
@@ -7818,6 +8500,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7818
8500
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
7819
8501
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
7820
8502
|
exports2.updateIssueType = updateIssueType;
|
|
8503
|
+
exports2.updateIssueTypeFieldValues = updateIssueTypeFieldValues;
|
|
8504
|
+
exports2.updateIssueTypeFieldValuesAttachment = updateIssueTypeFieldValuesAttachment;
|
|
8505
|
+
exports2.updateIssueTypeFieldValuesAttachments = updateIssueTypeFieldValuesAttachments;
|
|
8506
|
+
exports2.updateIssueTypeFieldValuesMany = updateIssueTypeFieldValuesMany;
|
|
8507
|
+
exports2.updateIssueTypeFields = updateIssueTypeFields;
|
|
8508
|
+
exports2.updateIssueTypeFieldsAttachment = updateIssueTypeFieldsAttachment;
|
|
8509
|
+
exports2.updateIssueTypeFieldsAttachments = updateIssueTypeFieldsAttachments;
|
|
8510
|
+
exports2.updateIssueTypeFieldsMany = updateIssueTypeFieldsMany;
|
|
7821
8511
|
exports2.updateLicense = updateLicense;
|
|
7822
8512
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
7823
8513
|
exports2.updateProject = updateProject;
|