@overmap-ai/core 1.0.71-mapbox.5 → 1.0.71-mapbox.6
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 +123 -247
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +132 -255
- 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 +13 -12
- package/dist/sdk/services/AssetService.d.ts +5 -4
- package/dist/sdk/services/AssetStageCompletionService.d.ts +5 -4
- package/dist/sdk/services/AssetStageService.d.ts +5 -4
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +13 -12
- package/dist/sdk/services/AssetTypeService.d.ts +5 -4
- package/dist/sdk/services/BaseApiService.d.ts +5 -4
- package/dist/sdk/services/BaseAttachmentService.d.ts +7 -6
- 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 +5 -4
- package/dist/sdk/services/CategoryService.d.ts +5 -4
- package/dist/sdk/services/DocumentAttachmentService.d.ts +13 -12
- 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/FormService.d.ts +5 -4
- package/dist/sdk/services/FormSubmissionService.d.ts +6 -5
- package/dist/sdk/services/GeoImageService.d.ts +5 -4
- package/dist/sdk/services/IssueAssociationService.d.ts +5 -4
- package/dist/sdk/services/IssueAttachmentService.d.ts +13 -12
- package/dist/sdk/services/IssueCommentService.d.ts +5 -4
- package/dist/sdk/services/IssueService.d.ts +5 -4
- 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 +13 -12
- 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 +34 -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 -25
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +16 -21
- 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 -26
- package/dist/store/slices/formSlice.d.ts +35 -21
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/formSubmissionSlice.d.ts +16 -21
- package/dist/store/slices/geoImageSlice.d.ts +35 -24
- package/dist/store/slices/index.d.ts +38 -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/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 +40 -29
- 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 +7 -7
- 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 +3 -2
- package/dist/typings/models/attachments.d.ts +3 -2
- 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/forms.d.ts +4 -3
- package/dist/typings/models/geo.d.ts +2 -1
- package/dist/typings/models/geoImages.d.ts +4 -3
- package/dist/typings/models/index.d.ts +21 -21
- package/dist/typings/models/issueTypes.d.ts +3 -2
- package/dist/typings/models/issues.d.ts +7 -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 +3 -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 +2 -1
- package/dist/utils/file.d.ts +2 -1
- 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 +20 -21
|
@@ -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)}`;
|
|
@@ -356,7 +348,7 @@ var __publicField = (obj, key, value) => {
|
|
|
356
348
|
reader.onload = () => {
|
|
357
349
|
const fileResult = reader.result;
|
|
358
350
|
if (!fileResult) {
|
|
359
|
-
reject();
|
|
351
|
+
reject(new Error("FileReader did not return a valid ArrayBuffer."));
|
|
360
352
|
return;
|
|
361
353
|
}
|
|
362
354
|
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
@@ -370,8 +362,7 @@ var __publicField = (obj, key, value) => {
|
|
|
370
362
|
function getFileIdentifier(file) {
|
|
371
363
|
if (!file.name || !file.type || !file.size) {
|
|
372
364
|
const message = "File has no name, type, and/or size";
|
|
373
|
-
|
|
374
|
-
throw new Error(`${message}.`);
|
|
365
|
+
throw new Error(message);
|
|
375
366
|
}
|
|
376
367
|
return `${file.name}&${file.type}${file.size}`;
|
|
377
368
|
}
|
|
@@ -491,21 +482,19 @@ var __publicField = (obj, key, value) => {
|
|
|
491
482
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
492
483
|
const EMPTY_OBJECT = Object.freeze({});
|
|
493
484
|
let debug = false;
|
|
494
|
-
const REACT_APP_DEBUG_MEMOIZATION =
|
|
485
|
+
const REACT_APP_DEBUG_MEMOIZATION = "";
|
|
495
486
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
496
487
|
debug = true;
|
|
497
488
|
}
|
|
498
489
|
function shallowEqual(objA, objB) {
|
|
499
|
-
if (objA === objB)
|
|
500
|
-
return true;
|
|
490
|
+
if (objA === objB) return true;
|
|
501
491
|
if (typeof objA !== typeof objB) {
|
|
502
492
|
return false;
|
|
503
493
|
}
|
|
504
494
|
const keysA = Object.keys(objA);
|
|
505
495
|
const keysB = Object.keys(objB);
|
|
506
496
|
const keysALength = keysA.length;
|
|
507
|
-
if (keysALength !== keysB.length)
|
|
508
|
-
return false;
|
|
497
|
+
if (keysALength !== keysB.length) return false;
|
|
509
498
|
for (let i = 0; i < keysALength; i++) {
|
|
510
499
|
const key = keysA[i];
|
|
511
500
|
if (!Object.prototype.hasOwnProperty.call(objB, key) || objA[key] !== objB[key]) {
|
|
@@ -532,11 +521,9 @@ var __publicField = (obj, key, value) => {
|
|
|
532
521
|
};
|
|
533
522
|
}
|
|
534
523
|
function areArraysEqual(first, second) {
|
|
535
|
-
if (first.length !== second.length)
|
|
536
|
-
return false;
|
|
524
|
+
if (first.length !== second.length) return false;
|
|
537
525
|
for (let i = 0; i < first.length; i++) {
|
|
538
|
-
if (first[i] !== second[i])
|
|
539
|
-
return false;
|
|
526
|
+
if (first[i] !== second[i]) return false;
|
|
540
527
|
}
|
|
541
528
|
return true;
|
|
542
529
|
}
|
|
@@ -584,13 +571,11 @@ var __publicField = (obj, key, value) => {
|
|
|
584
571
|
return { backgroundColor, textColor };
|
|
585
572
|
};
|
|
586
573
|
const getLocalDateString = memoize((date) => {
|
|
587
|
-
if (!date)
|
|
588
|
-
return "";
|
|
574
|
+
if (!date) return "";
|
|
589
575
|
const asDate = new Date(date);
|
|
590
576
|
const isThisYear = asDate.getFullYear() === today.getFullYear();
|
|
591
577
|
const options = { day: "numeric", month: "short" };
|
|
592
|
-
if (!isThisYear)
|
|
593
|
-
options.year = "numeric";
|
|
578
|
+
if (!isThisYear) options.year = "numeric";
|
|
594
579
|
return asDate.toLocaleDateString([], options);
|
|
595
580
|
});
|
|
596
581
|
const relative = new Intl.RelativeTimeFormat([], { style: "long", numeric: "auto" });
|
|
@@ -601,10 +586,10 @@ var __publicField = (obj, key, value) => {
|
|
|
601
586
|
};
|
|
602
587
|
const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
603
588
|
const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
|
|
604
|
-
if (days < min || days > max)
|
|
605
|
-
return getLocalDateString(date);
|
|
589
|
+
if (days < min || days > max) return getLocalDateString(date);
|
|
606
590
|
return relative.format(days, "days");
|
|
607
591
|
});
|
|
592
|
+
_a = Symbol.toStringTag;
|
|
608
593
|
class DeferredPromise {
|
|
609
594
|
constructor() {
|
|
610
595
|
__publicField(this, _a, "Promise");
|
|
@@ -629,14 +614,12 @@ var __publicField = (obj, key, value) => {
|
|
|
629
614
|
return this._promise.catch(onRejected);
|
|
630
615
|
}
|
|
631
616
|
resolve(value) {
|
|
632
|
-
if (!this._resolve)
|
|
633
|
-
throw new Error("No resolve callback");
|
|
617
|
+
if (!this._resolve) throw new Error("No resolve callback");
|
|
634
618
|
this._resolve(value);
|
|
635
619
|
this._state = "fulfilled";
|
|
636
620
|
}
|
|
637
621
|
reject(reason) {
|
|
638
|
-
if (!this._reject)
|
|
639
|
-
throw reason;
|
|
622
|
+
if (!this._reject) throw reason;
|
|
640
623
|
this._reject(reason);
|
|
641
624
|
this._state = "rejected";
|
|
642
625
|
}
|
|
@@ -644,35 +627,6 @@ var __publicField = (obj, key, value) => {
|
|
|
644
627
|
throw new Error("`finally` not implemented");
|
|
645
628
|
}
|
|
646
629
|
}
|
|
647
|
-
_a = Symbol.toStringTag;
|
|
648
|
-
var randomString = function randomString2() {
|
|
649
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
650
|
-
};
|
|
651
|
-
({
|
|
652
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
653
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
654
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
655
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
function compose() {
|
|
659
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
660
|
-
funcs[_key] = arguments[_key];
|
|
661
|
-
}
|
|
662
|
-
if (funcs.length === 0) {
|
|
663
|
-
return function(arg) {
|
|
664
|
-
return arg;
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
if (funcs.length === 1) {
|
|
668
|
-
return funcs[0];
|
|
669
|
-
}
|
|
670
|
-
return funcs.reduce(function(a, b) {
|
|
671
|
-
return function() {
|
|
672
|
-
return a(b.apply(void 0, arguments));
|
|
673
|
-
};
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
630
|
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
677
631
|
const latestVersion = () => migrations.length - 1;
|
|
678
632
|
const initialVersioning = (state) => {
|
|
@@ -693,8 +647,7 @@ var __publicField = (obj, key, value) => {
|
|
|
693
647
|
if (state === void 0) {
|
|
694
648
|
state = {};
|
|
695
649
|
}
|
|
696
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
697
|
-
return state;
|
|
650
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion()) return state;
|
|
698
651
|
return migrator(state);
|
|
699
652
|
};
|
|
700
653
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
@@ -882,8 +835,7 @@ var __publicField = (obj, key, value) => {
|
|
|
882
835
|
const assets = [];
|
|
883
836
|
for (const assetId of assetIds) {
|
|
884
837
|
const asset = assetsMapping[assetId];
|
|
885
|
-
if (asset)
|
|
886
|
-
assets.push(asset);
|
|
838
|
+
if (asset) assets.push(asset);
|
|
887
839
|
}
|
|
888
840
|
return fallbackToEmptyArray(assets);
|
|
889
841
|
})
|
|
@@ -942,17 +894,13 @@ var __publicField = (obj, key, value) => {
|
|
|
942
894
|
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
943
895
|
(attachments, assetId) => {
|
|
944
896
|
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
945
|
-
const fileAttachments =
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
949
|
-
)
|
|
897
|
+
const fileAttachments = attachmentsOfAsset.filter(
|
|
898
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
899
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
950
900
|
);
|
|
951
|
-
const imageAttachments =
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
955
|
-
)
|
|
901
|
+
const imageAttachments = attachmentsOfAsset.filter(
|
|
902
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
903
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
956
904
|
);
|
|
957
905
|
return { fileAttachments, imageAttachments };
|
|
958
906
|
}
|
|
@@ -995,8 +943,7 @@ var __publicField = (obj, key, value) => {
|
|
|
995
943
|
const completedStagesByAsset = {};
|
|
996
944
|
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
997
945
|
const { asset, stage, submitted_at } = stageCompletion;
|
|
998
|
-
if (!completedStagesByAsset[asset])
|
|
999
|
-
completedStagesByAsset[asset] = {};
|
|
946
|
+
if (!completedStagesByAsset[asset]) completedStagesByAsset[asset] = {};
|
|
1000
947
|
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1001
948
|
}
|
|
1002
949
|
return fallbackToEmptyObject(completedStagesByAsset);
|
|
@@ -1212,11 +1159,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1212
1159
|
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1213
1160
|
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1214
1161
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1215
|
-
({ file_type }) => !file_type
|
|
1162
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1216
1163
|
);
|
|
1217
1164
|
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1218
1165
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1219
|
-
({ file_type }) => file_type
|
|
1166
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1220
1167
|
);
|
|
1221
1168
|
return { fileAttachments, imageAttachments };
|
|
1222
1169
|
}
|
|
@@ -1353,8 +1300,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1353
1300
|
}
|
|
1354
1301
|
const today2 = (/* @__PURE__ */ new Date()).getTime();
|
|
1355
1302
|
const expiringWithinAnHour = (url.exp ?? today2) - today2 < msPerHour;
|
|
1356
|
-
if (expiringWithinAnHour)
|
|
1357
|
-
return void 0;
|
|
1303
|
+
if (expiringWithinAnHour) return void 0;
|
|
1358
1304
|
return url;
|
|
1359
1305
|
};
|
|
1360
1306
|
const fileReducer = fileSlice.reducer;
|
|
@@ -1383,8 +1329,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1383
1329
|
state.currentUser = action.payload;
|
|
1384
1330
|
},
|
|
1385
1331
|
setProfilePicture: (state, action) => {
|
|
1386
|
-
if (!state.currentUser)
|
|
1387
|
-
return;
|
|
1332
|
+
if (!state.currentUser) return;
|
|
1388
1333
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1389
1334
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1390
1335
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1728,8 +1673,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1728
1673
|
},
|
|
1729
1674
|
markAsDeleted(state, action) {
|
|
1730
1675
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1731
|
-
if (index !== -1)
|
|
1732
|
-
state.deletedRequests.splice(index, 1);
|
|
1676
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1733
1677
|
},
|
|
1734
1678
|
_setLatestRetryTime: (state, action) => {
|
|
1735
1679
|
state.latestRetryTime = action.payload;
|
|
@@ -1861,11 +1805,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1861
1805
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1862
1806
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1863
1807
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1864
|
-
({ file_type }) => !file_type
|
|
1808
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1865
1809
|
);
|
|
1866
1810
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1867
1811
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1868
|
-
({ file_type }) => file_type
|
|
1812
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1869
1813
|
);
|
|
1870
1814
|
return { fileAttachments, imageAttachments };
|
|
1871
1815
|
}
|
|
@@ -1949,8 +1893,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1949
1893
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
1950
1894
|
(revisions, formId) => {
|
|
1951
1895
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
1952
|
-
if (revisionsOfForm.length === 0)
|
|
1953
|
-
return void 0;
|
|
1896
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
1954
1897
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
1955
1898
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
1956
1899
|
return revisions[latestRevision.offline_id];
|
|
@@ -2022,7 +1965,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2022
1965
|
return [...regularMatches.slice(0, maxResults)];
|
|
2023
1966
|
},
|
|
2024
1967
|
// as the argument is an object, we check the first level of properties for equality
|
|
2025
|
-
{ memoizeOptions: {
|
|
1968
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2026
1969
|
)
|
|
2027
1970
|
);
|
|
2028
1971
|
const selectFormById = (formId) => (state) => {
|
|
@@ -2101,8 +2044,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2101
2044
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2102
2045
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2103
2046
|
for (const revision of Object.values(revisionMapping)) {
|
|
2104
|
-
if (revision.form !== formId)
|
|
2105
|
-
continue;
|
|
2047
|
+
if (revision.form !== formId) continue;
|
|
2106
2048
|
revisionIds.add(revision.offline_id);
|
|
2107
2049
|
}
|
|
2108
2050
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2169,8 +2111,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2169
2111
|
],
|
|
2170
2112
|
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2171
2113
|
const issue = issues[issueId];
|
|
2172
|
-
if (!issue)
|
|
2173
|
-
return [];
|
|
2114
|
+
if (!issue) return [];
|
|
2174
2115
|
if (!issue.issue_type) {
|
|
2175
2116
|
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2176
2117
|
}
|
|
@@ -2227,8 +2168,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2227
2168
|
],
|
|
2228
2169
|
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2229
2170
|
const asset = assets[assetId];
|
|
2230
|
-
if (!asset)
|
|
2231
|
-
return [];
|
|
2171
|
+
if (!asset) return [];
|
|
2232
2172
|
if (!asset.asset_type) {
|
|
2233
2173
|
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2234
2174
|
}
|
|
@@ -2604,8 +2544,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2604
2544
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2605
2545
|
const listOfAncestors = [];
|
|
2606
2546
|
const document2 = mapping[documentId];
|
|
2607
|
-
if (!document2 || !document2.parent_document)
|
|
2608
|
-
return listOfAncestors;
|
|
2547
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2609
2548
|
let currentAncestor = mapping[document2.parent_document];
|
|
2610
2549
|
while (currentAncestor) {
|
|
2611
2550
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2671,11 +2610,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2671
2610
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2672
2611
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2673
2612
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2674
|
-
({ file_type }) => !file_type
|
|
2613
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2675
2614
|
);
|
|
2676
2615
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2677
2616
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2678
|
-
({ file_type }) => file_type
|
|
2617
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2679
2618
|
);
|
|
2680
2619
|
return { fileAttachments, imageAttachments };
|
|
2681
2620
|
}
|
|
@@ -2881,11 +2820,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2881
2820
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2882
2821
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2883
2822
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2884
|
-
({ file_type }) => !file_type
|
|
2823
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2885
2824
|
);
|
|
2886
2825
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2887
2826
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2888
|
-
({ file_type }) => file_type
|
|
2827
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2889
2828
|
);
|
|
2890
2829
|
return { fileAttachments, imageAttachments };
|
|
2891
2830
|
}
|
|
@@ -3034,6 +2973,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3034
2973
|
async enqueueRequest(requestDetails) {
|
|
3035
2974
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3036
2975
|
}
|
|
2976
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3037
2977
|
dispatch(action) {
|
|
3038
2978
|
this.client.store.dispatch(action);
|
|
3039
2979
|
}
|
|
@@ -3103,9 +3043,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3103
3043
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3104
3044
|
return coordinator;
|
|
3105
3045
|
}
|
|
3106
|
-
const persistCallback = (
|
|
3107
|
-
if (
|
|
3108
|
-
throw err;
|
|
3046
|
+
const persistCallback = (e) => {
|
|
3047
|
+
if (e) throw e;
|
|
3109
3048
|
const clientStore2 = getClientStore();
|
|
3110
3049
|
if (clientStore2) {
|
|
3111
3050
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3163,20 +3102,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3163
3102
|
}
|
|
3164
3103
|
};
|
|
3165
3104
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3166
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3105
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3167
3106
|
function extractResponseFromError(error) {
|
|
3168
3107
|
function isResponse(response) {
|
|
3169
3108
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3170
3109
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3171
3110
|
}
|
|
3172
|
-
if (isResponse(error))
|
|
3173
|
-
return error;
|
|
3111
|
+
if (isResponse(error)) return error;
|
|
3174
3112
|
if (typeof error === "object" && error !== null) {
|
|
3175
3113
|
const typedError = error;
|
|
3176
|
-
if (isResponse(typedError.response))
|
|
3177
|
-
|
|
3178
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3179
|
-
return typedError.response.response;
|
|
3114
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3115
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3180
3116
|
}
|
|
3181
3117
|
return void 0;
|
|
3182
3118
|
}
|
|
@@ -3217,15 +3153,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3217
3153
|
const addPayload = (req) => {
|
|
3218
3154
|
if (attachmentHash) {
|
|
3219
3155
|
const s3url = requestDetails.s3url;
|
|
3220
|
-
if (!s3url)
|
|
3221
|
-
|
|
3222
|
-
if (
|
|
3223
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3224
|
-
if (!file)
|
|
3225
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3156
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3157
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3158
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3226
3159
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3227
|
-
if (!s3Sha1Checksum)
|
|
3228
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3160
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3229
3161
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3230
3162
|
}
|
|
3231
3163
|
return req.send(payload);
|
|
@@ -3285,8 +3217,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3285
3217
|
this.compile = this.compile.bind(this);
|
|
3286
3218
|
}
|
|
3287
3219
|
then(next) {
|
|
3288
|
-
if (this._previous)
|
|
3289
|
-
this._previous.next = next;
|
|
3220
|
+
if (this._previous) this._previous.next = next;
|
|
3290
3221
|
this._all.push(next);
|
|
3291
3222
|
this._previous = next;
|
|
3292
3223
|
return {
|
|
@@ -3314,11 +3245,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3314
3245
|
} else {
|
|
3315
3246
|
console.debug("Middleware finished. Performing request:", action);
|
|
3316
3247
|
const clientStore2 = getClientStore();
|
|
3317
|
-
if (!clientStore2)
|
|
3318
|
-
throw new Error("Client store not set");
|
|
3248
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3319
3249
|
const clientSDK2 = getClientSDK();
|
|
3320
|
-
if (!clientSDK2)
|
|
3321
|
-
throw new Error("Client SDK not set");
|
|
3250
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3322
3251
|
return performRequest(action, clientSDK2);
|
|
3323
3252
|
}
|
|
3324
3253
|
}
|
|
@@ -3339,20 +3268,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3339
3268
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3340
3269
|
}
|
|
3341
3270
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3342
|
-
const statusMessages = {
|
|
3343
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3344
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3345
|
-
405: {
|
|
3346
|
-
title: "Not supported",
|
|
3347
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3348
|
-
accentColor: "red"
|
|
3349
|
-
},
|
|
3350
|
-
500: {
|
|
3351
|
-
title: "Server error",
|
|
3352
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3353
|
-
accentColor: "red"
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
3271
|
function discard(reason, action, retries = 0) {
|
|
3357
3272
|
var _a2;
|
|
3358
3273
|
console.debug(
|
|
@@ -3405,14 +3320,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3405
3320
|
}
|
|
3406
3321
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3407
3322
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3408
|
-
const message = statusMessages[status];
|
|
3409
|
-
if (message) {
|
|
3410
|
-
if (blocks.unsafeShowToast) {
|
|
3411
|
-
blocks.unsafeShowToast(message);
|
|
3412
|
-
} else {
|
|
3413
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3414
|
-
}
|
|
3415
|
-
}
|
|
3416
3323
|
const coordinator2 = getOutboxCoordinator();
|
|
3417
3324
|
if (!coordinator2) {
|
|
3418
3325
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3440,6 +3347,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3440
3347
|
}
|
|
3441
3348
|
class BaseSDK {
|
|
3442
3349
|
constructor(store) {
|
|
3350
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3443
3351
|
__publicField(this, "store");
|
|
3444
3352
|
this.store = store;
|
|
3445
3353
|
}
|
|
@@ -3475,9 +3383,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3475
3383
|
};
|
|
3476
3384
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3477
3385
|
promise.resolve(result.body);
|
|
3478
|
-
}).catch((
|
|
3479
|
-
discard(
|
|
3480
|
-
|
|
3386
|
+
}).catch((e) => {
|
|
3387
|
+
discard(e, fullOfflineAction);
|
|
3388
|
+
if (e instanceof Error) {
|
|
3389
|
+
promise.reject(e);
|
|
3390
|
+
} else {
|
|
3391
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3392
|
+
}
|
|
3481
3393
|
});
|
|
3482
3394
|
} else {
|
|
3483
3395
|
const innerPromise = this.store.dispatch(
|
|
@@ -3531,10 +3443,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3531
3443
|
}
|
|
3532
3444
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3533
3445
|
function parseTokens(response) {
|
|
3534
|
-
if (!response.access)
|
|
3535
|
-
|
|
3536
|
-
if (!response.refresh)
|
|
3537
|
-
throw new Error("Missing refresh token");
|
|
3446
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3447
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3538
3448
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3539
3449
|
}
|
|
3540
3450
|
class JWTService extends BaseAuthService {
|
|
@@ -3571,8 +3481,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3571
3481
|
this.clearAuth();
|
|
3572
3482
|
return void 0;
|
|
3573
3483
|
}
|
|
3574
|
-
if (!response.access)
|
|
3575
|
-
throw new Error("Missing access token");
|
|
3484
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3576
3485
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3577
3486
|
});
|
|
3578
3487
|
}
|
|
@@ -3628,8 +3537,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3628
3537
|
return `Bearer ${accessToken}`;
|
|
3629
3538
|
}
|
|
3630
3539
|
async prepareAuth() {
|
|
3631
|
-
if (!this.tokenIsExpiringSoon())
|
|
3632
|
-
return;
|
|
3540
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3633
3541
|
console.debug(this.constructor.name, "preparing auth");
|
|
3634
3542
|
try {
|
|
3635
3543
|
await this.renewTokens();
|
|
@@ -3637,7 +3545,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3637
3545
|
if (e instanceof APIError) {
|
|
3638
3546
|
this.clearAuth();
|
|
3639
3547
|
}
|
|
3640
|
-
|
|
3548
|
+
if (e instanceof Error) {
|
|
3549
|
+
return Promise.reject(e);
|
|
3550
|
+
} else {
|
|
3551
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3552
|
+
}
|
|
3641
3553
|
}
|
|
3642
3554
|
}
|
|
3643
3555
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -3668,7 +3580,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3668
3580
|
async initAuth(payload) {
|
|
3669
3581
|
const uuid$1 = uuid.v4();
|
|
3670
3582
|
console.debug(this.constructor.name, "Initiating auth");
|
|
3671
|
-
|
|
3583
|
+
return this.enqueueRequest({
|
|
3672
3584
|
uuid: uuid$1,
|
|
3673
3585
|
description: "Get token pair",
|
|
3674
3586
|
method: HttpMethod.POST,
|
|
@@ -3676,25 +3588,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3676
3588
|
payload,
|
|
3677
3589
|
isAuthNeeded: false,
|
|
3678
3590
|
checkAuth: false,
|
|
3591
|
+
immediate: true,
|
|
3679
3592
|
blockers: [],
|
|
3680
3593
|
blocks: []
|
|
3681
|
-
}).then(
|
|
3682
|
-
|
|
3683
|
-
let timedOut = false;
|
|
3684
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3685
|
-
setTimeout(() => {
|
|
3686
|
-
timedOut = true;
|
|
3687
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
3688
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
3689
|
-
}, timeout * 1e3);
|
|
3690
|
-
});
|
|
3691
|
-
const successPromise = promise.then((tokens) => {
|
|
3692
|
-
if (timedOut) {
|
|
3693
|
-
return void 0;
|
|
3694
|
-
}
|
|
3695
|
-
this.setTokens(tokens);
|
|
3594
|
+
}).then((tokens) => {
|
|
3595
|
+
this.setTokens(parseTokens(tokens));
|
|
3696
3596
|
});
|
|
3697
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3698
3597
|
}
|
|
3699
3598
|
}
|
|
3700
3599
|
class BaseApiService extends BaseService {
|
|
@@ -3857,8 +3756,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3857
3756
|
const { store } = this.client;
|
|
3858
3757
|
const state = store.getState();
|
|
3859
3758
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3860
|
-
if (!assetToBeDeleted)
|
|
3861
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
3759
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
3862
3760
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3863
3761
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3864
3762
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3881,12 +3779,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3881
3779
|
url: `/assets/${id}/`,
|
|
3882
3780
|
blockers: [id],
|
|
3883
3781
|
blocks: []
|
|
3884
|
-
}).catch((
|
|
3782
|
+
}).catch((e) => {
|
|
3885
3783
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3886
3784
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3887
3785
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3888
3786
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3889
|
-
throw
|
|
3787
|
+
throw e;
|
|
3890
3788
|
});
|
|
3891
3789
|
}
|
|
3892
3790
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -3910,17 +3808,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3910
3808
|
const { batchId, payload } = assetBatch;
|
|
3911
3809
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3912
3810
|
const blockers = [assetTypeId];
|
|
3913
|
-
if (prevBatchId)
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
blocks2.push(batchId);
|
|
3811
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
3812
|
+
const blocks = batchAssetOfflineIds;
|
|
3813
|
+
blocks.push(batchId);
|
|
3917
3814
|
const promise = this.enqueueRequest({
|
|
3918
3815
|
description: "Batch create assets",
|
|
3919
3816
|
method: HttpMethod.POST,
|
|
3920
3817
|
url: "/assets/bulk/",
|
|
3921
3818
|
payload,
|
|
3922
3819
|
blockers,
|
|
3923
|
-
blocks
|
|
3820
|
+
blocks
|
|
3924
3821
|
});
|
|
3925
3822
|
prevBatchId = assetBatch.batchId;
|
|
3926
3823
|
batchPromises.push(promise);
|
|
@@ -4125,8 +4022,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4125
4022
|
update(payload) {
|
|
4126
4023
|
const { store } = this.client;
|
|
4127
4024
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4128
|
-
if (!assetStage)
|
|
4129
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4025
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4130
4026
|
const updatedAssetStage = {
|
|
4131
4027
|
...assetStage,
|
|
4132
4028
|
...payload
|
|
@@ -4720,7 +4616,18 @@ var __publicField = (obj, key, value) => {
|
|
|
4720
4616
|
]) {
|
|
4721
4617
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4722
4618
|
switch (issueUpdateChange) {
|
|
4723
|
-
case
|
|
4619
|
+
case IssueUpdateChange.PRIORITY:
|
|
4620
|
+
case IssueUpdateChange.STATUS: {
|
|
4621
|
+
const val = payload[issueUpdateChange];
|
|
4622
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4623
|
+
break;
|
|
4624
|
+
}
|
|
4625
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4626
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4627
|
+
case IssueUpdateChange.TITLE:
|
|
4628
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4629
|
+
break;
|
|
4630
|
+
case IssueUpdateChange.CATEGORY: {
|
|
4724
4631
|
let categoryOrNull = null;
|
|
4725
4632
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4726
4633
|
if (categoryIdOrNull) {
|
|
@@ -4737,7 +4644,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4737
4644
|
} : null;
|
|
4738
4645
|
break;
|
|
4739
4646
|
}
|
|
4740
|
-
case
|
|
4647
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4741
4648
|
let userOrNull = null;
|
|
4742
4649
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4743
4650
|
if (userIdOrNull) {
|
|
@@ -4753,20 +4660,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4753
4660
|
} : null;
|
|
4754
4661
|
break;
|
|
4755
4662
|
}
|
|
4756
|
-
case "description":
|
|
4757
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4758
|
-
break;
|
|
4759
|
-
case "title":
|
|
4760
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4761
|
-
break;
|
|
4762
|
-
case "priority":
|
|
4763
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4764
|
-
break;
|
|
4765
|
-
case "status":
|
|
4766
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4767
|
-
break;
|
|
4768
|
-
case "due_date":
|
|
4769
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
4770
4663
|
}
|
|
4771
4664
|
}
|
|
4772
4665
|
}
|
|
@@ -5477,12 +5370,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5477
5370
|
blockers: [projectId.toString()],
|
|
5478
5371
|
blocks: []
|
|
5479
5372
|
});
|
|
5480
|
-
for (const form of projectFormsResult.forms)
|
|
5481
|
-
|
|
5482
|
-
for (const
|
|
5483
|
-
revisions.push(revision);
|
|
5484
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5485
|
-
attachments.push(attachment);
|
|
5373
|
+
for (const form of projectFormsResult.forms) forms.push(form);
|
|
5374
|
+
for (const revision of projectFormsResult.revisions) revisions.push(revision);
|
|
5375
|
+
for (const attachment of projectFormsResult.attachments) attachments.push(attachment);
|
|
5486
5376
|
const organizationFormsResult = await this.enqueueRequest({
|
|
5487
5377
|
description: "Fetch organization forms",
|
|
5488
5378
|
method: HttpMethod.GET,
|
|
@@ -5490,12 +5380,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5490
5380
|
blockers: [projectId.toString()],
|
|
5491
5381
|
blocks: []
|
|
5492
5382
|
});
|
|
5493
|
-
for (const form of organizationFormsResult.forms)
|
|
5494
|
-
|
|
5495
|
-
for (const
|
|
5496
|
-
revisions.push(revision);
|
|
5497
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5498
|
-
attachments.push(attachment);
|
|
5383
|
+
for (const form of organizationFormsResult.forms) forms.push(form);
|
|
5384
|
+
for (const revision of organizationFormsResult.revisions) revisions.push(revision);
|
|
5385
|
+
for (const attachment of organizationFormsResult.attachments) attachments.push(attachment);
|
|
5499
5386
|
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5500
5387
|
description: "Fetch asset type forms",
|
|
5501
5388
|
method: HttpMethod.GET,
|
|
@@ -5503,12 +5390,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5503
5390
|
blockers: [projectId.toString()],
|
|
5504
5391
|
blocks: []
|
|
5505
5392
|
});
|
|
5506
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5507
|
-
|
|
5508
|
-
for (const
|
|
5509
|
-
revisions.push(revision);
|
|
5510
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5511
|
-
attachments.push(attachment);
|
|
5393
|
+
for (const form of assetTypeFormsResult.forms) forms.push(form);
|
|
5394
|
+
for (const revision of assetTypeFormsResult.revisions) revisions.push(revision);
|
|
5395
|
+
for (const attachment of assetTypeFormsResult.attachments) attachments.push(attachment);
|
|
5512
5396
|
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5513
5397
|
description: "Fetch issue type forms",
|
|
5514
5398
|
method: HttpMethod.GET,
|
|
@@ -5516,12 +5400,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5516
5400
|
blockers: [projectId.toString()],
|
|
5517
5401
|
blocks: []
|
|
5518
5402
|
});
|
|
5519
|
-
for (const form of issueTypeFormsResult.forms)
|
|
5520
|
-
|
|
5521
|
-
for (const
|
|
5522
|
-
revisions.push(revision);
|
|
5523
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5524
|
-
attachments.push(attachment);
|
|
5403
|
+
for (const form of issueTypeFormsResult.forms) forms.push(form);
|
|
5404
|
+
for (const revision of issueTypeFormsResult.revisions) revisions.push(revision);
|
|
5405
|
+
for (const attachment of issueTypeFormsResult.attachments) attachments.push(attachment);
|
|
5525
5406
|
this.dispatch(initializeForms(forms));
|
|
5526
5407
|
this.dispatch(initializeFormRevisions(revisions));
|
|
5527
5408
|
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
@@ -5732,16 +5613,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5732
5613
|
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5733
5614
|
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5734
5615
|
const blockers = batchAssetIds;
|
|
5735
|
-
if (prevBatchId)
|
|
5736
|
-
|
|
5737
|
-
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5616
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
5617
|
+
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5738
5618
|
const promise = this.enqueueRequest({
|
|
5739
5619
|
description: "Bulk add form submissions",
|
|
5740
5620
|
method: HttpMethod.POST,
|
|
5741
5621
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5742
5622
|
payload,
|
|
5743
5623
|
blockers,
|
|
5744
|
-
blocks
|
|
5624
|
+
blocks
|
|
5745
5625
|
});
|
|
5746
5626
|
void promise.then(({ presigned_urls }) => {
|
|
5747
5627
|
this.processPresignedUrls(presigned_urls);
|
|
@@ -5753,10 +5633,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5753
5633
|
const createdSubmissions = [];
|
|
5754
5634
|
const createdAttachments = [];
|
|
5755
5635
|
for (const result of results) {
|
|
5756
|
-
for (const createdSubmission of result.submissions)
|
|
5757
|
-
|
|
5758
|
-
for (const createdAttachment of result.attachments)
|
|
5759
|
-
createdAttachments.push(createdAttachment);
|
|
5636
|
+
for (const createdSubmission of result.submissions) createdSubmissions.push(createdSubmission);
|
|
5637
|
+
for (const createdAttachment of result.attachments) createdAttachments.push(createdAttachment);
|
|
5760
5638
|
}
|
|
5761
5639
|
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5762
5640
|
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
@@ -5952,9 +5830,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5952
5830
|
blockers: [id],
|
|
5953
5831
|
blocks: []
|
|
5954
5832
|
});
|
|
5955
|
-
void promise.catch((
|
|
5833
|
+
void promise.catch((e) => {
|
|
5956
5834
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
5957
|
-
throw
|
|
5835
|
+
throw e;
|
|
5958
5836
|
});
|
|
5959
5837
|
return promise;
|
|
5960
5838
|
}
|
|
@@ -6015,7 +5893,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6015
5893
|
class FileService extends BaseApiService {
|
|
6016
5894
|
constructor() {
|
|
6017
5895
|
super(...arguments);
|
|
6018
|
-
__publicField(this, "host"
|
|
5896
|
+
__publicField(this, "host");
|
|
6019
5897
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6020
5898
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6021
5899
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6026,8 +5904,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6026
5904
|
}
|
|
6027
5905
|
async renewUploadUrl(sha1) {
|
|
6028
5906
|
const file = await this.fetchCache(sha1);
|
|
6029
|
-
if (!file)
|
|
6030
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5907
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6031
5908
|
const key = await getFileS3Key(file, sha1);
|
|
6032
5909
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6033
5910
|
description: "Get S3 URL",
|
|
@@ -6097,8 +5974,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6097
5974
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6098
5975
|
async uploadFileToS3(sha1) {
|
|
6099
5976
|
const file = await this.fetchCache(sha1);
|
|
6100
|
-
if (!file)
|
|
6101
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5977
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6102
5978
|
const key = await getFileS3Key(file, sha1);
|
|
6103
5979
|
const dbFileProperties = {
|
|
6104
5980
|
file_name: file.name,
|
|
@@ -6192,7 +6068,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6192
6068
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6193
6069
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6194
6070
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6195
|
-
|
|
6071
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6196
6072
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6197
6073
|
throw new Error(message);
|
|
6198
6074
|
}
|
|
@@ -7231,6 +7107,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7231
7107
|
exports2.ProjectFileService = ProjectFileService;
|
|
7232
7108
|
exports2.ProjectService = ProjectService;
|
|
7233
7109
|
exports2.TeamService = TeamService;
|
|
7110
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
7234
7111
|
exports2.UserService = UserService;
|
|
7235
7112
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
7236
7113
|
exports2.VerificationCodeType = VerificationCodeType;
|