@overmap-ai/core 1.0.71-fields.14 → 1.0.71-fields.15
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 +113 -227
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +120 -233
- 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 +18 -19
- 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 +17 -18
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +4 -3
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +6 -5
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +5 -4
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +5 -4
- 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 +8 -7
- 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 +17 -18
- 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 +5 -4
- package/dist/sdk/services/FormRevisionService.d.ts +5 -4
- package/dist/sdk/services/FormService.d.ts +5 -4
- package/dist/sdk/services/FormSubmissionAttachmentService.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 +17 -18
- package/dist/sdk/services/IssueCommentService.d.ts +5 -4
- package/dist/sdk/services/IssueService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldsService.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 +17 -18
- 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 -45
- 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/assetTypeFieldValuesAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +43 -32
- 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 +16 -21
- package/dist/store/slices/index.d.ts +46 -46
- 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 +35 -24
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +35 -24
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +43 -32
- 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 +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 +5 -4
- 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/fields.d.ts +3 -2
- package/dist/typings/models/forms.d.ts +4 -3
- package/dist/typings/models/geoImages.d.ts +4 -3
- package/dist/typings/models/index.d.ts +22 -22
- package/dist/typings/models/issueTypes.d.ts +3 -2
- package/dist/typings/models/issues.d.ts +9 -8
- 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 +3 -2
- 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 +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,8 +693,7 @@ 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];
|
|
@@ -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
|
})
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -1270,11 +1219,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1270
1219
|
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1271
1220
|
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1272
1221
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1273
|
-
({ file_type }) => !file_type
|
|
1222
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1274
1223
|
);
|
|
1275
1224
|
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1276
1225
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1277
|
-
({ file_type }) => file_type
|
|
1226
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1278
1227
|
);
|
|
1279
1228
|
return { fileAttachments, imageAttachments };
|
|
1280
1229
|
}
|
|
@@ -1411,8 +1360,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1411
1360
|
}
|
|
1412
1361
|
const today2 = (/* @__PURE__ */ new Date()).getTime();
|
|
1413
1362
|
const expiringWithinAnHour = (url.exp ?? today2) - today2 < msPerHour;
|
|
1414
|
-
if (expiringWithinAnHour)
|
|
1415
|
-
return void 0;
|
|
1363
|
+
if (expiringWithinAnHour) return void 0;
|
|
1416
1364
|
return url;
|
|
1417
1365
|
};
|
|
1418
1366
|
const fileReducer = fileSlice.reducer;
|
|
@@ -1441,8 +1389,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1441
1389
|
state.currentUser = action.payload;
|
|
1442
1390
|
},
|
|
1443
1391
|
setProfilePicture: (state, action) => {
|
|
1444
|
-
if (!state.currentUser)
|
|
1445
|
-
return;
|
|
1392
|
+
if (!state.currentUser) return;
|
|
1446
1393
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1447
1394
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1448
1395
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1778,8 +1725,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1778
1725
|
},
|
|
1779
1726
|
markAsDeleted(state, action) {
|
|
1780
1727
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1781
|
-
if (index !== -1)
|
|
1782
|
-
state.deletedRequests.splice(index, 1);
|
|
1728
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1783
1729
|
},
|
|
1784
1730
|
_setLatestRetryTime: (state, action) => {
|
|
1785
1731
|
state.latestRetryTime = action.payload;
|
|
@@ -1928,11 +1874,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1928
1874
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1929
1875
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1930
1876
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1931
|
-
({ file_type }) => !file_type
|
|
1877
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1932
1878
|
);
|
|
1933
1879
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1934
1880
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1935
|
-
({ file_type }) => file_type
|
|
1881
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1936
1882
|
);
|
|
1937
1883
|
return { fileAttachments, imageAttachments };
|
|
1938
1884
|
}
|
|
@@ -2016,8 +1962,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2016
1962
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2017
1963
|
(revisions, formId) => {
|
|
2018
1964
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2019
|
-
if (revisionsOfForm.length === 0)
|
|
2020
|
-
return void 0;
|
|
1965
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2021
1966
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2022
1967
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2023
1968
|
return revisions[latestRevision.offline_id];
|
|
@@ -2081,7 +2026,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2081
2026
|
return [...regularMatches.slice(0, maxResults)];
|
|
2082
2027
|
},
|
|
2083
2028
|
// as the argument is an object, we check the first level of properties for equality
|
|
2084
|
-
{ memoizeOptions: {
|
|
2029
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2085
2030
|
)
|
|
2086
2031
|
);
|
|
2087
2032
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
@@ -2135,8 +2080,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2135
2080
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2136
2081
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2137
2082
|
for (const revision of Object.values(revisionMapping)) {
|
|
2138
|
-
if (revision.form !== formId)
|
|
2139
|
-
continue;
|
|
2083
|
+
if (revision.form !== formId) continue;
|
|
2140
2084
|
revisionIds.add(revision.offline_id);
|
|
2141
2085
|
}
|
|
2142
2086
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2508,8 +2452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2508
2452
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2509
2453
|
const listOfAncestors = [];
|
|
2510
2454
|
const document2 = mapping[documentId];
|
|
2511
|
-
if (!document2 || !document2.parent_document)
|
|
2512
|
-
return listOfAncestors;
|
|
2455
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2513
2456
|
let currentAncestor = mapping[document2.parent_document];
|
|
2514
2457
|
while (currentAncestor) {
|
|
2515
2458
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2575,11 +2518,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2575
2518
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2576
2519
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2577
2520
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2578
|
-
({ file_type }) => !file_type
|
|
2521
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2579
2522
|
);
|
|
2580
2523
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2581
2524
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2582
|
-
({ file_type }) => file_type
|
|
2525
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2583
2526
|
);
|
|
2584
2527
|
return { fileAttachments, imageAttachments };
|
|
2585
2528
|
}
|
|
@@ -2785,11 +2728,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2785
2728
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2786
2729
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2787
2730
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2788
|
-
({ file_type }) => !file_type
|
|
2731
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2789
2732
|
);
|
|
2790
2733
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2791
2734
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2792
|
-
({ file_type }) => file_type
|
|
2735
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2793
2736
|
);
|
|
2794
2737
|
return { fileAttachments, imageAttachments };
|
|
2795
2738
|
}
|
|
@@ -3358,6 +3301,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3358
3301
|
async enqueueRequest(requestDetails) {
|
|
3359
3302
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3360
3303
|
}
|
|
3304
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3361
3305
|
dispatch(action) {
|
|
3362
3306
|
this.client.store.dispatch(action);
|
|
3363
3307
|
}
|
|
@@ -3435,9 +3379,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3435
3379
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3436
3380
|
return coordinator;
|
|
3437
3381
|
}
|
|
3438
|
-
const persistCallback = (
|
|
3439
|
-
if (
|
|
3440
|
-
throw err;
|
|
3382
|
+
const persistCallback = (e) => {
|
|
3383
|
+
if (e) throw e;
|
|
3441
3384
|
const clientStore2 = getClientStore();
|
|
3442
3385
|
if (clientStore2) {
|
|
3443
3386
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3495,20 +3438,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3495
3438
|
}
|
|
3496
3439
|
};
|
|
3497
3440
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3498
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3441
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3499
3442
|
function extractResponseFromError(error) {
|
|
3500
3443
|
function isResponse(response) {
|
|
3501
3444
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3502
3445
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3503
3446
|
}
|
|
3504
|
-
if (isResponse(error))
|
|
3505
|
-
return error;
|
|
3447
|
+
if (isResponse(error)) return error;
|
|
3506
3448
|
if (typeof error === "object" && error !== null) {
|
|
3507
3449
|
const typedError = error;
|
|
3508
|
-
if (isResponse(typedError.response))
|
|
3509
|
-
|
|
3510
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3511
|
-
return typedError.response.response;
|
|
3450
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3451
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3512
3452
|
}
|
|
3513
3453
|
return void 0;
|
|
3514
3454
|
}
|
|
@@ -3549,15 +3489,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3549
3489
|
const addPayload = (req) => {
|
|
3550
3490
|
if (attachmentHash) {
|
|
3551
3491
|
const s3url = requestDetails.s3url;
|
|
3552
|
-
if (!s3url)
|
|
3553
|
-
|
|
3554
|
-
if (
|
|
3555
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3556
|
-
if (!file)
|
|
3557
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3492
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3493
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3494
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3558
3495
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3559
|
-
if (!s3Sha1Checksum)
|
|
3560
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3496
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3561
3497
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3562
3498
|
}
|
|
3563
3499
|
return req.send(payload);
|
|
@@ -3617,8 +3553,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3617
3553
|
this.compile = this.compile.bind(this);
|
|
3618
3554
|
}
|
|
3619
3555
|
then(next) {
|
|
3620
|
-
if (this._previous)
|
|
3621
|
-
this._previous.next = next;
|
|
3556
|
+
if (this._previous) this._previous.next = next;
|
|
3622
3557
|
this._all.push(next);
|
|
3623
3558
|
this._previous = next;
|
|
3624
3559
|
return {
|
|
@@ -3646,11 +3581,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3646
3581
|
} else {
|
|
3647
3582
|
console.debug("Middleware finished. Performing request:", action);
|
|
3648
3583
|
const clientStore2 = getClientStore();
|
|
3649
|
-
if (!clientStore2)
|
|
3650
|
-
throw new Error("Client store not set");
|
|
3584
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3651
3585
|
const clientSDK2 = getClientSDK();
|
|
3652
|
-
if (!clientSDK2)
|
|
3653
|
-
throw new Error("Client SDK not set");
|
|
3586
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3654
3587
|
return performRequest(action, clientSDK2);
|
|
3655
3588
|
}
|
|
3656
3589
|
}
|
|
@@ -3671,20 +3604,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3671
3604
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3672
3605
|
}
|
|
3673
3606
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3674
|
-
const statusMessages = {
|
|
3675
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3676
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3677
|
-
405: {
|
|
3678
|
-
title: "Not supported",
|
|
3679
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3680
|
-
accentColor: "red"
|
|
3681
|
-
},
|
|
3682
|
-
500: {
|
|
3683
|
-
title: "Server error",
|
|
3684
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3685
|
-
accentColor: "red"
|
|
3686
|
-
}
|
|
3687
|
-
};
|
|
3688
3607
|
function discard(reason, action, retries = 0) {
|
|
3689
3608
|
var _a2;
|
|
3690
3609
|
console.debug(
|
|
@@ -3737,14 +3656,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3737
3656
|
}
|
|
3738
3657
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3739
3658
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3740
|
-
const message = statusMessages[status];
|
|
3741
|
-
if (message) {
|
|
3742
|
-
if (blocks.unsafeShowToast) {
|
|
3743
|
-
blocks.unsafeShowToast(message);
|
|
3744
|
-
} else {
|
|
3745
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
3659
|
const coordinator2 = getOutboxCoordinator();
|
|
3749
3660
|
if (!coordinator2) {
|
|
3750
3661
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3772,6 +3683,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3772
3683
|
}
|
|
3773
3684
|
class BaseSDK {
|
|
3774
3685
|
constructor(store) {
|
|
3686
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3775
3687
|
__publicField(this, "store");
|
|
3776
3688
|
this.store = store;
|
|
3777
3689
|
}
|
|
@@ -3807,9 +3719,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3807
3719
|
};
|
|
3808
3720
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3809
3721
|
promise.resolve(result.body);
|
|
3810
|
-
}).catch((
|
|
3811
|
-
discard(
|
|
3812
|
-
|
|
3722
|
+
}).catch((e) => {
|
|
3723
|
+
discard(e, fullOfflineAction);
|
|
3724
|
+
if (e instanceof Error) {
|
|
3725
|
+
promise.reject(e);
|
|
3726
|
+
} else {
|
|
3727
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3728
|
+
}
|
|
3813
3729
|
});
|
|
3814
3730
|
} else {
|
|
3815
3731
|
const innerPromise = this.store.dispatch(
|
|
@@ -3863,10 +3779,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3863
3779
|
}
|
|
3864
3780
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3865
3781
|
function parseTokens(response) {
|
|
3866
|
-
if (!response.access)
|
|
3867
|
-
|
|
3868
|
-
if (!response.refresh)
|
|
3869
|
-
throw new Error("Missing refresh token");
|
|
3782
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3783
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3870
3784
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3871
3785
|
}
|
|
3872
3786
|
class JWTService extends BaseAuthService {
|
|
@@ -3903,8 +3817,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3903
3817
|
this.clearAuth();
|
|
3904
3818
|
return void 0;
|
|
3905
3819
|
}
|
|
3906
|
-
if (!response.access)
|
|
3907
|
-
throw new Error("Missing access token");
|
|
3820
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3908
3821
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3909
3822
|
});
|
|
3910
3823
|
}
|
|
@@ -3960,8 +3873,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3960
3873
|
return `Bearer ${accessToken}`;
|
|
3961
3874
|
}
|
|
3962
3875
|
async prepareAuth() {
|
|
3963
|
-
if (!this.tokenIsExpiringSoon())
|
|
3964
|
-
return;
|
|
3876
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3965
3877
|
console.debug(this.constructor.name, "preparing auth");
|
|
3966
3878
|
try {
|
|
3967
3879
|
await this.renewTokens();
|
|
@@ -3969,7 +3881,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3969
3881
|
if (e instanceof APIError) {
|
|
3970
3882
|
this.clearAuth();
|
|
3971
3883
|
}
|
|
3972
|
-
|
|
3884
|
+
if (e instanceof Error) {
|
|
3885
|
+
return Promise.reject(e);
|
|
3886
|
+
} else {
|
|
3887
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3888
|
+
}
|
|
3973
3889
|
}
|
|
3974
3890
|
}
|
|
3975
3891
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -4000,7 +3916,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4000
3916
|
async initAuth(payload) {
|
|
4001
3917
|
const uuid$1 = uuid.v4();
|
|
4002
3918
|
console.debug(this.constructor.name, "Initiating auth");
|
|
4003
|
-
|
|
3919
|
+
return this.enqueueRequest({
|
|
4004
3920
|
uuid: uuid$1,
|
|
4005
3921
|
description: "Get token pair",
|
|
4006
3922
|
method: HttpMethod.POST,
|
|
@@ -4008,25 +3924,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4008
3924
|
payload,
|
|
4009
3925
|
isAuthNeeded: false,
|
|
4010
3926
|
checkAuth: false,
|
|
3927
|
+
immediate: true,
|
|
4011
3928
|
blockers: [],
|
|
4012
3929
|
blocks: []
|
|
4013
|
-
}).then(
|
|
4014
|
-
|
|
4015
|
-
let timedOut = false;
|
|
4016
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
4017
|
-
setTimeout(() => {
|
|
4018
|
-
timedOut = true;
|
|
4019
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
4020
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
4021
|
-
}, timeout * 1e3);
|
|
4022
|
-
});
|
|
4023
|
-
const successPromise = promise.then((tokens) => {
|
|
4024
|
-
if (timedOut) {
|
|
4025
|
-
return void 0;
|
|
4026
|
-
}
|
|
4027
|
-
this.setTokens(tokens);
|
|
3930
|
+
}).then((tokens) => {
|
|
3931
|
+
this.setTokens(parseTokens(tokens));
|
|
4028
3932
|
});
|
|
4029
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
4030
3933
|
}
|
|
4031
3934
|
}
|
|
4032
3935
|
class BaseApiService extends BaseService {
|
|
@@ -4186,8 +4089,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4186
4089
|
const { store } = this.client;
|
|
4187
4090
|
const state = store.getState();
|
|
4188
4091
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
4189
|
-
if (!assetToBeDeleted)
|
|
4190
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
4092
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
4191
4093
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
4192
4094
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
4193
4095
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -4210,12 +4112,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4210
4112
|
url: `/assets/${id}/`,
|
|
4211
4113
|
blockers: [id],
|
|
4212
4114
|
blocks: []
|
|
4213
|
-
}).catch((
|
|
4115
|
+
}).catch((e) => {
|
|
4214
4116
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
4215
4117
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4216
4118
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4217
4119
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4218
|
-
throw
|
|
4120
|
+
throw e;
|
|
4219
4121
|
});
|
|
4220
4122
|
}
|
|
4221
4123
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -4239,17 +4141,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4239
4141
|
const { batchId, payload } = assetBatch;
|
|
4240
4142
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
4241
4143
|
const blockers = [assetTypeId];
|
|
4242
|
-
if (prevBatchId)
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
blocks2.push(batchId);
|
|
4144
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
4145
|
+
const blocks = batchAssetOfflineIds;
|
|
4146
|
+
blocks.push(batchId);
|
|
4246
4147
|
const promise = this.enqueueRequest({
|
|
4247
4148
|
description: "Batch create assets",
|
|
4248
4149
|
method: HttpMethod.POST,
|
|
4249
4150
|
url: "/assets/bulk/",
|
|
4250
4151
|
payload,
|
|
4251
4152
|
blockers,
|
|
4252
|
-
blocks
|
|
4153
|
+
blocks
|
|
4253
4154
|
});
|
|
4254
4155
|
prevBatchId = assetBatch.batchId;
|
|
4255
4156
|
batchPromises.push(promise);
|
|
@@ -4460,8 +4361,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4460
4361
|
update(payload) {
|
|
4461
4362
|
const { store } = this.client;
|
|
4462
4363
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4463
|
-
if (!assetStage)
|
|
4464
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4364
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4465
4365
|
const updatedAssetStage = {
|
|
4466
4366
|
...assetStage,
|
|
4467
4367
|
...payload
|
|
@@ -4617,8 +4517,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4617
4517
|
for (const payload of payloads) {
|
|
4618
4518
|
const { modelId, file } = payload;
|
|
4619
4519
|
const filePayload = await this.getFilePayload(file);
|
|
4620
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
4621
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
4520
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
4622
4521
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
4623
4522
|
file,
|
|
4624
4523
|
file_sha1: filePayload.sha1,
|
|
@@ -5082,7 +4981,18 @@ var __publicField = (obj, key, value) => {
|
|
|
5082
4981
|
]) {
|
|
5083
4982
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
5084
4983
|
switch (issueUpdateChange) {
|
|
5085
|
-
case
|
|
4984
|
+
case IssueUpdateChange.PRIORITY:
|
|
4985
|
+
case IssueUpdateChange.STATUS: {
|
|
4986
|
+
const val = payload[issueUpdateChange];
|
|
4987
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4988
|
+
break;
|
|
4989
|
+
}
|
|
4990
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4991
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4992
|
+
case IssueUpdateChange.TITLE:
|
|
4993
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4994
|
+
break;
|
|
4995
|
+
case IssueUpdateChange.CATEGORY: {
|
|
5086
4996
|
let categoryOrNull = null;
|
|
5087
4997
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
5088
4998
|
if (categoryIdOrNull) {
|
|
@@ -5099,7 +5009,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5099
5009
|
} : null;
|
|
5100
5010
|
break;
|
|
5101
5011
|
}
|
|
5102
|
-
case
|
|
5012
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
5103
5013
|
let userOrNull = null;
|
|
5104
5014
|
const userIdOrNull = payload[issueUpdateChange];
|
|
5105
5015
|
if (userIdOrNull) {
|
|
@@ -5115,20 +5025,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5115
5025
|
} : null;
|
|
5116
5026
|
break;
|
|
5117
5027
|
}
|
|
5118
|
-
case "description":
|
|
5119
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5120
|
-
break;
|
|
5121
|
-
case "title":
|
|
5122
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5123
|
-
break;
|
|
5124
|
-
case "priority":
|
|
5125
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5126
|
-
break;
|
|
5127
|
-
case "status":
|
|
5128
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5129
|
-
break;
|
|
5130
|
-
case "due_date":
|
|
5131
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
5132
5028
|
}
|
|
5133
5029
|
}
|
|
5134
5030
|
}
|
|
@@ -5904,9 +5800,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5904
5800
|
blockers: [id],
|
|
5905
5801
|
blocks: []
|
|
5906
5802
|
});
|
|
5907
|
-
void promise.catch((
|
|
5803
|
+
void promise.catch((e) => {
|
|
5908
5804
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
5909
|
-
throw
|
|
5805
|
+
throw e;
|
|
5910
5806
|
});
|
|
5911
5807
|
return promise;
|
|
5912
5808
|
}
|
|
@@ -5967,7 +5863,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5967
5863
|
class FileService extends BaseApiService {
|
|
5968
5864
|
constructor() {
|
|
5969
5865
|
super(...arguments);
|
|
5970
|
-
__publicField(this, "host"
|
|
5866
|
+
__publicField(this, "host");
|
|
5971
5867
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
5972
5868
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
5973
5869
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -5978,8 +5874,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5978
5874
|
}
|
|
5979
5875
|
async renewUploadUrl(sha1) {
|
|
5980
5876
|
const file = await this.fetchCache(sha1);
|
|
5981
|
-
if (!file)
|
|
5982
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5877
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5983
5878
|
const key = await getFileS3Key(file, sha1);
|
|
5984
5879
|
const s3UploadUrl = await this.enqueueRequest({
|
|
5985
5880
|
description: "Get S3 URL",
|
|
@@ -6049,8 +5944,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6049
5944
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6050
5945
|
async uploadFileToS3(sha1) {
|
|
6051
5946
|
const file = await this.fetchCache(sha1);
|
|
6052
|
-
if (!file)
|
|
6053
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5947
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6054
5948
|
const key = await getFileS3Key(file, sha1);
|
|
6055
5949
|
const dbFileProperties = {
|
|
6056
5950
|
file_name: file.name,
|
|
@@ -6144,7 +6038,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6144
6038
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6145
6039
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6146
6040
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6147
|
-
|
|
6041
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6148
6042
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6149
6043
|
throw new Error(message);
|
|
6150
6044
|
}
|
|
@@ -6943,8 +6837,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6943
6837
|
for (const payloadAndFile of payloads) {
|
|
6944
6838
|
const { file, ...payload } = payloadAndFile;
|
|
6945
6839
|
const filePayload = await this.getFilePayload(file);
|
|
6946
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
6947
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
6840
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
6948
6841
|
const offlineMapImage = offline({
|
|
6949
6842
|
...payload,
|
|
6950
6843
|
file_name: file.name,
|
|
@@ -7122,8 +7015,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7122
7015
|
for (const payload of payloads) {
|
|
7123
7016
|
const { revisionId, fieldIdentifier, file } = payload;
|
|
7124
7017
|
const filePayload = await this.getFilePayload(file);
|
|
7125
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7126
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7018
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7127
7019
|
const offlineFormRevisionAttachment = offline({
|
|
7128
7020
|
file: URL.createObjectURL(file),
|
|
7129
7021
|
file_type: file.type,
|
|
@@ -7208,8 +7100,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7208
7100
|
for (const payload of payloads) {
|
|
7209
7101
|
const { submissionId, fieldIdentifier, file } = payload;
|
|
7210
7102
|
const filePayload = await this.getFilePayload(file);
|
|
7211
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7212
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7103
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7213
7104
|
const offlineFormSubmissionAttachment = offline({
|
|
7214
7105
|
file: URL.createObjectURL(file),
|
|
7215
7106
|
file_type: file.type,
|
|
@@ -7356,8 +7247,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7356
7247
|
for (const payload of payloads) {
|
|
7357
7248
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7358
7249
|
const filePayload = await this.getFilePayload(file);
|
|
7359
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7360
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7250
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7361
7251
|
const offlineAssetTypeFieldsAttachment = offline({
|
|
7362
7252
|
file: URL.createObjectURL(file),
|
|
7363
7253
|
file_type: file.type,
|
|
@@ -7638,8 +7528,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7638
7528
|
for (const payload of batch) {
|
|
7639
7529
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7640
7530
|
const filePayload = await this.getFilePayload(file);
|
|
7641
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7642
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7531
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7643
7532
|
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7644
7533
|
file: URL.createObjectURL(file),
|
|
7645
7534
|
file_type: file.type,
|
|
@@ -7679,8 +7568,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7679
7568
|
});
|
|
7680
7569
|
});
|
|
7681
7570
|
Promise.all(promises).then((result) => {
|
|
7682
|
-
for (const res of result)
|
|
7683
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7571
|
+
for (const res of result) this.processPresignedUrls(res.presigned_urls);
|
|
7684
7572
|
const attachments = result.flatMap((res) => res.attachments);
|
|
7685
7573
|
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7686
7574
|
}).catch((error) => {
|
|
@@ -7740,8 +7628,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7740
7628
|
for (const payload of payloads) {
|
|
7741
7629
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7742
7630
|
const filePayload = await this.getFilePayload(file);
|
|
7743
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7744
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7631
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7745
7632
|
const offlineIssueTypeFieldsAttachment = offline({
|
|
7746
7633
|
file: URL.createObjectURL(file),
|
|
7747
7634
|
file_type: file.type,
|
|
@@ -7855,8 +7742,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7855
7742
|
for (const payload of payloads) {
|
|
7856
7743
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7857
7744
|
const filePayload = await this.getFilePayload(file);
|
|
7858
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7859
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7745
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7860
7746
|
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7861
7747
|
file: URL.createObjectURL(file),
|
|
7862
7748
|
file_type: file.type,
|
|
@@ -8119,6 +8005,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8119
8005
|
exports2.ProjectFileService = ProjectFileService;
|
|
8120
8006
|
exports2.ProjectService = ProjectService;
|
|
8121
8007
|
exports2.TeamService = TeamService;
|
|
8008
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
8122
8009
|
exports2.UserService = UserService;
|
|
8123
8010
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
8124
8011
|
exports2.VerificationCodeType = VerificationCodeType;
|