@overmap-ai/core 1.0.71-mapbox.4 → 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 +168 -305
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +177 -313
- 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 +61 -30
- 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;
|
|
@@ -1740,39 +1684,26 @@ var __publicField = (obj, key, value) => {
|
|
|
1740
1684
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1741
1685
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1742
1686
|
const outboxReducer = outboxSlice.reducer;
|
|
1743
|
-
const
|
|
1744
|
-
|
|
1687
|
+
const projectFileModelAdapter = createModelAdapter((projectFile) => projectFile.offline_id);
|
|
1688
|
+
const initialState$j = projectFileModelAdapter.getInitialState({
|
|
1745
1689
|
activeProjectFileId: null,
|
|
1746
1690
|
isImportingProjectFile: false
|
|
1747
|
-
};
|
|
1691
|
+
});
|
|
1748
1692
|
const projectFileSlice = toolkit.createSlice({
|
|
1749
1693
|
name: "projectFiles",
|
|
1750
1694
|
initialState: initialState$j,
|
|
1751
1695
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1752
1696
|
reducers: {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
file = parts.slice(0, -1).join("/") + "/" + lastPart;
|
|
1764
|
-
console.warn("Fixed URL:", file);
|
|
1765
|
-
fileObj = { ...fileObj, file };
|
|
1766
|
-
}
|
|
1767
|
-
state.projectFiles[fileObj.offline_id] = fileObj;
|
|
1768
|
-
}
|
|
1769
|
-
},
|
|
1770
|
-
addOrReplaceProjectFile: (state, action) => {
|
|
1771
|
-
if (!action.payload.project) {
|
|
1772
|
-
throw new Error("ProjectFile has no project. A project must be set before storing.");
|
|
1773
|
-
}
|
|
1774
|
-
state.projectFiles[action.payload.offline_id] = action.payload;
|
|
1775
|
-
},
|
|
1697
|
+
initializeProjectFiles: projectFileModelAdapter.initialize,
|
|
1698
|
+
setProjectFile: projectFileModelAdapter.setOne,
|
|
1699
|
+
setProjectFiles: projectFileModelAdapter.setMany,
|
|
1700
|
+
addProjectFile: projectFileModelAdapter.addOne,
|
|
1701
|
+
addProjectFiles: projectFileModelAdapter.addMany,
|
|
1702
|
+
updateProjectFile: projectFileModelAdapter.updateOne,
|
|
1703
|
+
updateProjectFiles: projectFileModelAdapter.updateMany,
|
|
1704
|
+
deleteProjectFile: projectFileModelAdapter.deleteOne,
|
|
1705
|
+
deleteProjectFiles: projectFileModelAdapter.deleteMany,
|
|
1706
|
+
// TODO: move following to /web
|
|
1776
1707
|
setIsImportingProjectFile: (state, action) => {
|
|
1777
1708
|
state.isImportingProjectFile = action.payload;
|
|
1778
1709
|
},
|
|
@@ -1781,50 +1712,46 @@ var __publicField = (obj, key, value) => {
|
|
|
1781
1712
|
if (!activeProjectFileId) {
|
|
1782
1713
|
throw new Error("Tried to save bounds for active project file, but no active project file was set.");
|
|
1783
1714
|
}
|
|
1784
|
-
if (!state.
|
|
1715
|
+
if (!state.instances[activeProjectFileId]) {
|
|
1785
1716
|
throw new Error(
|
|
1786
1717
|
`Tried to save bounds for active project file, but project file with ID ${activeProjectFileId}
|
|
1787
1718
|
doesn't exist.`
|
|
1788
1719
|
);
|
|
1789
1720
|
}
|
|
1790
|
-
state.
|
|
1721
|
+
state.instances[activeProjectFileId].bounds = action.payload;
|
|
1791
1722
|
},
|
|
1792
|
-
// TODO: Move to MapContext. Should not be persisted.
|
|
1793
1723
|
setActiveProjectFileId: (state, action) => {
|
|
1794
1724
|
state.activeProjectFileId = action.payload;
|
|
1795
1725
|
},
|
|
1796
|
-
removeProjectFile: (state, action) => {
|
|
1797
|
-
delete state.projectFiles[action.payload];
|
|
1798
|
-
},
|
|
1799
|
-
removeProjectFilesOfProject: (state, action) => {
|
|
1800
|
-
const filesToDelete = Object.values(state.projectFiles).filter((file) => file.project === action.payload);
|
|
1801
|
-
for (const file of filesToDelete) {
|
|
1802
|
-
delete state.projectFiles[file.offline_id];
|
|
1803
|
-
}
|
|
1804
|
-
},
|
|
1805
1726
|
resetProjectFileObjectUrls: (state, ..._args) => {
|
|
1806
|
-
for (const key in state.
|
|
1807
|
-
delete state.
|
|
1727
|
+
for (const key in state.instances) {
|
|
1728
|
+
delete state.instances[key].objectURL;
|
|
1808
1729
|
}
|
|
1809
1730
|
}
|
|
1810
1731
|
}
|
|
1811
1732
|
});
|
|
1812
1733
|
const {
|
|
1813
|
-
|
|
1814
|
-
|
|
1734
|
+
initializeProjectFiles,
|
|
1735
|
+
setProjectFile,
|
|
1736
|
+
setProjectFiles,
|
|
1737
|
+
addProjectFile,
|
|
1738
|
+
addProjectFiles,
|
|
1739
|
+
updateProjectFile,
|
|
1740
|
+
updateProjectFiles,
|
|
1741
|
+
deleteProjectFile,
|
|
1742
|
+
deleteProjectFiles,
|
|
1743
|
+
// TODO: move following to /web
|
|
1815
1744
|
setIsImportingProjectFile,
|
|
1816
1745
|
setActiveProjectFileId,
|
|
1817
1746
|
saveActiveProjectFileBounds,
|
|
1818
|
-
removeProjectFile,
|
|
1819
|
-
removeProjectFilesOfProject,
|
|
1820
1747
|
resetProjectFileObjectUrls
|
|
1821
1748
|
} = projectFileSlice.actions;
|
|
1822
|
-
const selectProjectFileMapping = (state) => state.projectFileReducer.
|
|
1749
|
+
const selectProjectFileMapping = (state) => state.projectFileReducer.instances;
|
|
1823
1750
|
const selectProjectFiles = toolkit.createSelector([selectProjectFileMapping], (mapping) => {
|
|
1824
1751
|
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1825
1752
|
});
|
|
1826
1753
|
const selectProjectFileById = (id) => (state) => {
|
|
1827
|
-
return state.projectFileReducer.
|
|
1754
|
+
return state.projectFileReducer.instances[id];
|
|
1828
1755
|
};
|
|
1829
1756
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1830
1757
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
@@ -1878,11 +1805,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1878
1805
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1879
1806
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1880
1807
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1881
|
-
({ file_type }) => !file_type
|
|
1808
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1882
1809
|
);
|
|
1883
1810
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1884
1811
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1885
|
-
({ file_type }) => file_type
|
|
1812
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1886
1813
|
);
|
|
1887
1814
|
return { fileAttachments, imageAttachments };
|
|
1888
1815
|
}
|
|
@@ -1966,8 +1893,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1966
1893
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
1967
1894
|
(revisions, formId) => {
|
|
1968
1895
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
1969
|
-
if (revisionsOfForm.length === 0)
|
|
1970
|
-
return void 0;
|
|
1896
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
1971
1897
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
1972
1898
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
1973
1899
|
return revisions[latestRevision.offline_id];
|
|
@@ -2039,7 +1965,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2039
1965
|
return [...regularMatches.slice(0, maxResults)];
|
|
2040
1966
|
},
|
|
2041
1967
|
// as the argument is an object, we check the first level of properties for equality
|
|
2042
|
-
{ memoizeOptions: {
|
|
1968
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2043
1969
|
)
|
|
2044
1970
|
);
|
|
2045
1971
|
const selectFormById = (formId) => (state) => {
|
|
@@ -2118,8 +2044,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2118
2044
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2119
2045
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2120
2046
|
for (const revision of Object.values(revisionMapping)) {
|
|
2121
|
-
if (revision.form !== formId)
|
|
2122
|
-
continue;
|
|
2047
|
+
if (revision.form !== formId) continue;
|
|
2123
2048
|
revisionIds.add(revision.offline_id);
|
|
2124
2049
|
}
|
|
2125
2050
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2186,8 +2111,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2186
2111
|
],
|
|
2187
2112
|
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2188
2113
|
const issue = issues[issueId];
|
|
2189
|
-
if (!issue)
|
|
2190
|
-
return [];
|
|
2114
|
+
if (!issue) return [];
|
|
2191
2115
|
if (!issue.issue_type) {
|
|
2192
2116
|
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2193
2117
|
}
|
|
@@ -2244,8 +2168,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2244
2168
|
],
|
|
2245
2169
|
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2246
2170
|
const asset = assets[assetId];
|
|
2247
|
-
if (!asset)
|
|
2248
|
-
return [];
|
|
2171
|
+
if (!asset) return [];
|
|
2249
2172
|
if (!asset.asset_type) {
|
|
2250
2173
|
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2251
2174
|
}
|
|
@@ -2621,8 +2544,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2621
2544
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2622
2545
|
const listOfAncestors = [];
|
|
2623
2546
|
const document2 = mapping[documentId];
|
|
2624
|
-
if (!document2 || !document2.parent_document)
|
|
2625
|
-
return listOfAncestors;
|
|
2547
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2626
2548
|
let currentAncestor = mapping[document2.parent_document];
|
|
2627
2549
|
while (currentAncestor) {
|
|
2628
2550
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2688,11 +2610,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2688
2610
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2689
2611
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2690
2612
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2691
|
-
({ file_type }) => !file_type
|
|
2613
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2692
2614
|
);
|
|
2693
2615
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2694
2616
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2695
|
-
({ file_type }) => file_type
|
|
2617
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2696
2618
|
);
|
|
2697
2619
|
return { fileAttachments, imageAttachments };
|
|
2698
2620
|
}
|
|
@@ -2898,11 +2820,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2898
2820
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2899
2821
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2900
2822
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2901
|
-
({ file_type }) => !file_type
|
|
2823
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2902
2824
|
);
|
|
2903
2825
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2904
2826
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2905
|
-
({ file_type }) => file_type
|
|
2827
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2906
2828
|
);
|
|
2907
2829
|
return { fileAttachments, imageAttachments };
|
|
2908
2830
|
}
|
|
@@ -3051,6 +2973,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3051
2973
|
async enqueueRequest(requestDetails) {
|
|
3052
2974
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3053
2975
|
}
|
|
2976
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3054
2977
|
dispatch(action) {
|
|
3055
2978
|
this.client.store.dispatch(action);
|
|
3056
2979
|
}
|
|
@@ -3120,9 +3043,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3120
3043
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3121
3044
|
return coordinator;
|
|
3122
3045
|
}
|
|
3123
|
-
const persistCallback = (
|
|
3124
|
-
if (
|
|
3125
|
-
throw err;
|
|
3046
|
+
const persistCallback = (e) => {
|
|
3047
|
+
if (e) throw e;
|
|
3126
3048
|
const clientStore2 = getClientStore();
|
|
3127
3049
|
if (clientStore2) {
|
|
3128
3050
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3180,20 +3102,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3180
3102
|
}
|
|
3181
3103
|
};
|
|
3182
3104
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3183
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3105
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3184
3106
|
function extractResponseFromError(error) {
|
|
3185
3107
|
function isResponse(response) {
|
|
3186
3108
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3187
3109
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3188
3110
|
}
|
|
3189
|
-
if (isResponse(error))
|
|
3190
|
-
return error;
|
|
3111
|
+
if (isResponse(error)) return error;
|
|
3191
3112
|
if (typeof error === "object" && error !== null) {
|
|
3192
3113
|
const typedError = error;
|
|
3193
|
-
if (isResponse(typedError.response))
|
|
3194
|
-
|
|
3195
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3196
|
-
return typedError.response.response;
|
|
3114
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3115
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3197
3116
|
}
|
|
3198
3117
|
return void 0;
|
|
3199
3118
|
}
|
|
@@ -3234,15 +3153,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3234
3153
|
const addPayload = (req) => {
|
|
3235
3154
|
if (attachmentHash) {
|
|
3236
3155
|
const s3url = requestDetails.s3url;
|
|
3237
|
-
if (!s3url)
|
|
3238
|
-
|
|
3239
|
-
if (
|
|
3240
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3241
|
-
if (!file)
|
|
3242
|
-
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}`);
|
|
3243
3159
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3244
|
-
if (!s3Sha1Checksum)
|
|
3245
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3160
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3246
3161
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3247
3162
|
}
|
|
3248
3163
|
return req.send(payload);
|
|
@@ -3302,8 +3217,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3302
3217
|
this.compile = this.compile.bind(this);
|
|
3303
3218
|
}
|
|
3304
3219
|
then(next) {
|
|
3305
|
-
if (this._previous)
|
|
3306
|
-
this._previous.next = next;
|
|
3220
|
+
if (this._previous) this._previous.next = next;
|
|
3307
3221
|
this._all.push(next);
|
|
3308
3222
|
this._previous = next;
|
|
3309
3223
|
return {
|
|
@@ -3331,11 +3245,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3331
3245
|
} else {
|
|
3332
3246
|
console.debug("Middleware finished. Performing request:", action);
|
|
3333
3247
|
const clientStore2 = getClientStore();
|
|
3334
|
-
if (!clientStore2)
|
|
3335
|
-
throw new Error("Client store not set");
|
|
3248
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3336
3249
|
const clientSDK2 = getClientSDK();
|
|
3337
|
-
if (!clientSDK2)
|
|
3338
|
-
throw new Error("Client SDK not set");
|
|
3250
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3339
3251
|
return performRequest(action, clientSDK2);
|
|
3340
3252
|
}
|
|
3341
3253
|
}
|
|
@@ -3356,20 +3268,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3356
3268
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3357
3269
|
}
|
|
3358
3270
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3359
|
-
const statusMessages = {
|
|
3360
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3361
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3362
|
-
405: {
|
|
3363
|
-
title: "Not supported",
|
|
3364
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3365
|
-
accentColor: "red"
|
|
3366
|
-
},
|
|
3367
|
-
500: {
|
|
3368
|
-
title: "Server error",
|
|
3369
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3370
|
-
accentColor: "red"
|
|
3371
|
-
}
|
|
3372
|
-
};
|
|
3373
3271
|
function discard(reason, action, retries = 0) {
|
|
3374
3272
|
var _a2;
|
|
3375
3273
|
console.debug(
|
|
@@ -3422,14 +3320,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3422
3320
|
}
|
|
3423
3321
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3424
3322
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3425
|
-
const message = statusMessages[status];
|
|
3426
|
-
if (message) {
|
|
3427
|
-
if (blocks.unsafeShowToast) {
|
|
3428
|
-
blocks.unsafeShowToast(message);
|
|
3429
|
-
} else {
|
|
3430
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3431
|
-
}
|
|
3432
|
-
}
|
|
3433
3323
|
const coordinator2 = getOutboxCoordinator();
|
|
3434
3324
|
if (!coordinator2) {
|
|
3435
3325
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3457,6 +3347,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3457
3347
|
}
|
|
3458
3348
|
class BaseSDK {
|
|
3459
3349
|
constructor(store) {
|
|
3350
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3460
3351
|
__publicField(this, "store");
|
|
3461
3352
|
this.store = store;
|
|
3462
3353
|
}
|
|
@@ -3492,9 +3383,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3492
3383
|
};
|
|
3493
3384
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3494
3385
|
promise.resolve(result.body);
|
|
3495
|
-
}).catch((
|
|
3496
|
-
discard(
|
|
3497
|
-
|
|
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
|
+
}
|
|
3498
3393
|
});
|
|
3499
3394
|
} else {
|
|
3500
3395
|
const innerPromise = this.store.dispatch(
|
|
@@ -3548,10 +3443,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3548
3443
|
}
|
|
3549
3444
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3550
3445
|
function parseTokens(response) {
|
|
3551
|
-
if (!response.access)
|
|
3552
|
-
|
|
3553
|
-
if (!response.refresh)
|
|
3554
|
-
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");
|
|
3555
3448
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3556
3449
|
}
|
|
3557
3450
|
class JWTService extends BaseAuthService {
|
|
@@ -3588,8 +3481,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3588
3481
|
this.clearAuth();
|
|
3589
3482
|
return void 0;
|
|
3590
3483
|
}
|
|
3591
|
-
if (!response.access)
|
|
3592
|
-
throw new Error("Missing access token");
|
|
3484
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3593
3485
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3594
3486
|
});
|
|
3595
3487
|
}
|
|
@@ -3645,8 +3537,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3645
3537
|
return `Bearer ${accessToken}`;
|
|
3646
3538
|
}
|
|
3647
3539
|
async prepareAuth() {
|
|
3648
|
-
if (!this.tokenIsExpiringSoon())
|
|
3649
|
-
return;
|
|
3540
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3650
3541
|
console.debug(this.constructor.name, "preparing auth");
|
|
3651
3542
|
try {
|
|
3652
3543
|
await this.renewTokens();
|
|
@@ -3654,7 +3545,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3654
3545
|
if (e instanceof APIError) {
|
|
3655
3546
|
this.clearAuth();
|
|
3656
3547
|
}
|
|
3657
|
-
|
|
3548
|
+
if (e instanceof Error) {
|
|
3549
|
+
return Promise.reject(e);
|
|
3550
|
+
} else {
|
|
3551
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3552
|
+
}
|
|
3658
3553
|
}
|
|
3659
3554
|
}
|
|
3660
3555
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -3685,7 +3580,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3685
3580
|
async initAuth(payload) {
|
|
3686
3581
|
const uuid$1 = uuid.v4();
|
|
3687
3582
|
console.debug(this.constructor.name, "Initiating auth");
|
|
3688
|
-
|
|
3583
|
+
return this.enqueueRequest({
|
|
3689
3584
|
uuid: uuid$1,
|
|
3690
3585
|
description: "Get token pair",
|
|
3691
3586
|
method: HttpMethod.POST,
|
|
@@ -3693,25 +3588,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3693
3588
|
payload,
|
|
3694
3589
|
isAuthNeeded: false,
|
|
3695
3590
|
checkAuth: false,
|
|
3591
|
+
immediate: true,
|
|
3696
3592
|
blockers: [],
|
|
3697
3593
|
blocks: []
|
|
3698
|
-
}).then(
|
|
3699
|
-
|
|
3700
|
-
let timedOut = false;
|
|
3701
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3702
|
-
setTimeout(() => {
|
|
3703
|
-
timedOut = true;
|
|
3704
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
3705
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
3706
|
-
}, timeout * 1e3);
|
|
3707
|
-
});
|
|
3708
|
-
const successPromise = promise.then((tokens) => {
|
|
3709
|
-
if (timedOut) {
|
|
3710
|
-
return void 0;
|
|
3711
|
-
}
|
|
3712
|
-
this.setTokens(tokens);
|
|
3594
|
+
}).then((tokens) => {
|
|
3595
|
+
this.setTokens(parseTokens(tokens));
|
|
3713
3596
|
});
|
|
3714
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3715
3597
|
}
|
|
3716
3598
|
}
|
|
3717
3599
|
class BaseApiService extends BaseService {
|
|
@@ -3874,8 +3756,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3874
3756
|
const { store } = this.client;
|
|
3875
3757
|
const state = store.getState();
|
|
3876
3758
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3877
|
-
if (!assetToBeDeleted)
|
|
3878
|
-
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`);
|
|
3879
3760
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3880
3761
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3881
3762
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3898,12 +3779,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3898
3779
|
url: `/assets/${id}/`,
|
|
3899
3780
|
blockers: [id],
|
|
3900
3781
|
blocks: []
|
|
3901
|
-
}).catch((
|
|
3782
|
+
}).catch((e) => {
|
|
3902
3783
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3903
3784
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3904
3785
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3905
3786
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3906
|
-
throw
|
|
3787
|
+
throw e;
|
|
3907
3788
|
});
|
|
3908
3789
|
}
|
|
3909
3790
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -3927,17 +3808,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3927
3808
|
const { batchId, payload } = assetBatch;
|
|
3928
3809
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3929
3810
|
const blockers = [assetTypeId];
|
|
3930
|
-
if (prevBatchId)
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
blocks2.push(batchId);
|
|
3811
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
3812
|
+
const blocks = batchAssetOfflineIds;
|
|
3813
|
+
blocks.push(batchId);
|
|
3934
3814
|
const promise = this.enqueueRequest({
|
|
3935
3815
|
description: "Batch create assets",
|
|
3936
3816
|
method: HttpMethod.POST,
|
|
3937
3817
|
url: "/assets/bulk/",
|
|
3938
3818
|
payload,
|
|
3939
3819
|
blockers,
|
|
3940
|
-
blocks
|
|
3820
|
+
blocks
|
|
3941
3821
|
});
|
|
3942
3822
|
prevBatchId = assetBatch.batchId;
|
|
3943
3823
|
batchPromises.push(promise);
|
|
@@ -4142,8 +4022,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4142
4022
|
update(payload) {
|
|
4143
4023
|
const { store } = this.client;
|
|
4144
4024
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4145
|
-
if (!assetStage)
|
|
4146
|
-
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`);
|
|
4147
4026
|
const updatedAssetStage = {
|
|
4148
4027
|
...assetStage,
|
|
4149
4028
|
...payload
|
|
@@ -4737,7 +4616,18 @@ var __publicField = (obj, key, value) => {
|
|
|
4737
4616
|
]) {
|
|
4738
4617
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4739
4618
|
switch (issueUpdateChange) {
|
|
4740
|
-
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: {
|
|
4741
4631
|
let categoryOrNull = null;
|
|
4742
4632
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4743
4633
|
if (categoryIdOrNull) {
|
|
@@ -4754,7 +4644,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4754
4644
|
} : null;
|
|
4755
4645
|
break;
|
|
4756
4646
|
}
|
|
4757
|
-
case
|
|
4647
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4758
4648
|
let userOrNull = null;
|
|
4759
4649
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4760
4650
|
if (userIdOrNull) {
|
|
@@ -4770,20 +4660,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4770
4660
|
} : null;
|
|
4771
4661
|
break;
|
|
4772
4662
|
}
|
|
4773
|
-
case "description":
|
|
4774
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4775
|
-
break;
|
|
4776
|
-
case "title":
|
|
4777
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4778
|
-
break;
|
|
4779
|
-
case "priority":
|
|
4780
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4781
|
-
break;
|
|
4782
|
-
case "status":
|
|
4783
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4784
|
-
break;
|
|
4785
|
-
case "due_date":
|
|
4786
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
4787
4663
|
}
|
|
4788
4664
|
}
|
|
4789
4665
|
}
|
|
@@ -5003,7 +4879,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5003
4879
|
blocks: [file.offline_id]
|
|
5004
4880
|
});
|
|
5005
4881
|
void promise.then((result) => {
|
|
5006
|
-
this.dispatch(
|
|
4882
|
+
this.dispatch(updateProjectFile(result));
|
|
5007
4883
|
});
|
|
5008
4884
|
return promise;
|
|
5009
4885
|
}
|
|
@@ -5015,7 +4891,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5015
4891
|
if (!activeProjectFileId) {
|
|
5016
4892
|
throw new Error("No active project file");
|
|
5017
4893
|
}
|
|
5018
|
-
const activeProjectFile = state.projectFileReducer.
|
|
4894
|
+
const activeProjectFile = state.projectFileReducer.instances[activeProjectFileId];
|
|
5019
4895
|
if (!activeProjectFile) {
|
|
5020
4896
|
throw new Error("No active project file");
|
|
5021
4897
|
}
|
|
@@ -5054,7 +4930,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5054
4930
|
return this.enqueueRequest(requestDetails2);
|
|
5055
4931
|
});
|
|
5056
4932
|
void promise.then((result) => {
|
|
5057
|
-
this.dispatch(
|
|
4933
|
+
this.dispatch(updateProjectFile(result));
|
|
5058
4934
|
});
|
|
5059
4935
|
this.dispatch(saveActiveProjectFileBounds);
|
|
5060
4936
|
this.dispatch(setActiveProjectFileId(null));
|
|
@@ -5062,7 +4938,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5062
4938
|
return [activeProjectFile, promise];
|
|
5063
4939
|
}
|
|
5064
4940
|
delete(projectFileId) {
|
|
5065
|
-
this.dispatch(
|
|
4941
|
+
this.dispatch(deleteProjectFile(projectFileId));
|
|
5066
4942
|
return this.enqueueRequest({
|
|
5067
4943
|
method: HttpMethod.DELETE,
|
|
5068
4944
|
url: `/projects/files/${projectFileId}`,
|
|
@@ -5078,8 +4954,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5078
4954
|
blockers: [],
|
|
5079
4955
|
blocks: []
|
|
5080
4956
|
});
|
|
5081
|
-
this.dispatch(
|
|
5082
|
-
this.dispatch(addOrReplaceProjectFiles(result));
|
|
4957
|
+
this.dispatch(initializeProjectFiles(result));
|
|
5083
4958
|
}
|
|
5084
4959
|
}
|
|
5085
4960
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
@@ -5157,7 +5032,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5157
5032
|
throw new Error("Expected project to exist");
|
|
5158
5033
|
}
|
|
5159
5034
|
const filesToDelete = selectProjectFiles(state).filter((file) => file.project === projectId);
|
|
5160
|
-
this.dispatch(
|
|
5035
|
+
this.dispatch(deleteProjectFiles(filesToDelete.map(({ offline_id }) => offline_id)));
|
|
5161
5036
|
const attachmentsOfProject = selectAttachmentsOfProject(project.id)(state);
|
|
5162
5037
|
this.dispatch(deleteProjectAttachments(attachmentsOfProject.map(({ offline_id }) => offline_id)));
|
|
5163
5038
|
const projectAccesses = selectProjectAccesses(state);
|
|
@@ -5180,7 +5055,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5180
5055
|
} catch (e) {
|
|
5181
5056
|
this.dispatch(setProjects(Object.values(projects)));
|
|
5182
5057
|
this.dispatch(initializeProjectAccesses(Object.values(projectAccesses)));
|
|
5183
|
-
this.dispatch(
|
|
5058
|
+
this.dispatch(addProjectFiles(filesToDelete));
|
|
5184
5059
|
this.dispatch(setProjectAttachments(attachmentsOfProject));
|
|
5185
5060
|
this.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5186
5061
|
if (license) {
|
|
@@ -5495,12 +5370,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5495
5370
|
blockers: [projectId.toString()],
|
|
5496
5371
|
blocks: []
|
|
5497
5372
|
});
|
|
5498
|
-
for (const form of projectFormsResult.forms)
|
|
5499
|
-
|
|
5500
|
-
for (const
|
|
5501
|
-
revisions.push(revision);
|
|
5502
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5503
|
-
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);
|
|
5504
5376
|
const organizationFormsResult = await this.enqueueRequest({
|
|
5505
5377
|
description: "Fetch organization forms",
|
|
5506
5378
|
method: HttpMethod.GET,
|
|
@@ -5508,12 +5380,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5508
5380
|
blockers: [projectId.toString()],
|
|
5509
5381
|
blocks: []
|
|
5510
5382
|
});
|
|
5511
|
-
for (const form of organizationFormsResult.forms)
|
|
5512
|
-
|
|
5513
|
-
for (const
|
|
5514
|
-
revisions.push(revision);
|
|
5515
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5516
|
-
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);
|
|
5517
5386
|
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5518
5387
|
description: "Fetch asset type forms",
|
|
5519
5388
|
method: HttpMethod.GET,
|
|
@@ -5521,12 +5390,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5521
5390
|
blockers: [projectId.toString()],
|
|
5522
5391
|
blocks: []
|
|
5523
5392
|
});
|
|
5524
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5525
|
-
|
|
5526
|
-
for (const
|
|
5527
|
-
revisions.push(revision);
|
|
5528
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5529
|
-
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);
|
|
5530
5396
|
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5531
5397
|
description: "Fetch issue type forms",
|
|
5532
5398
|
method: HttpMethod.GET,
|
|
@@ -5534,12 +5400,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5534
5400
|
blockers: [projectId.toString()],
|
|
5535
5401
|
blocks: []
|
|
5536
5402
|
});
|
|
5537
|
-
for (const form of issueTypeFormsResult.forms)
|
|
5538
|
-
|
|
5539
|
-
for (const
|
|
5540
|
-
revisions.push(revision);
|
|
5541
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5542
|
-
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);
|
|
5543
5406
|
this.dispatch(initializeForms(forms));
|
|
5544
5407
|
this.dispatch(initializeFormRevisions(revisions));
|
|
5545
5408
|
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
@@ -5750,16 +5613,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5750
5613
|
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5751
5614
|
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5752
5615
|
const blockers = batchAssetIds;
|
|
5753
|
-
if (prevBatchId)
|
|
5754
|
-
|
|
5755
|
-
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5616
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
5617
|
+
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5756
5618
|
const promise = this.enqueueRequest({
|
|
5757
5619
|
description: "Bulk add form submissions",
|
|
5758
5620
|
method: HttpMethod.POST,
|
|
5759
5621
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5760
5622
|
payload,
|
|
5761
5623
|
blockers,
|
|
5762
|
-
blocks
|
|
5624
|
+
blocks
|
|
5763
5625
|
});
|
|
5764
5626
|
void promise.then(({ presigned_urls }) => {
|
|
5765
5627
|
this.processPresignedUrls(presigned_urls);
|
|
@@ -5771,10 +5633,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5771
5633
|
const createdSubmissions = [];
|
|
5772
5634
|
const createdAttachments = [];
|
|
5773
5635
|
for (const result of results) {
|
|
5774
|
-
for (const createdSubmission of result.submissions)
|
|
5775
|
-
|
|
5776
|
-
for (const createdAttachment of result.attachments)
|
|
5777
|
-
createdAttachments.push(createdAttachment);
|
|
5636
|
+
for (const createdSubmission of result.submissions) createdSubmissions.push(createdSubmission);
|
|
5637
|
+
for (const createdAttachment of result.attachments) createdAttachments.push(createdAttachment);
|
|
5778
5638
|
}
|
|
5779
5639
|
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5780
5640
|
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
@@ -5970,9 +5830,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5970
5830
|
blockers: [id],
|
|
5971
5831
|
blocks: []
|
|
5972
5832
|
});
|
|
5973
|
-
void promise.catch((
|
|
5833
|
+
void promise.catch((e) => {
|
|
5974
5834
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
5975
|
-
throw
|
|
5835
|
+
throw e;
|
|
5976
5836
|
});
|
|
5977
5837
|
return promise;
|
|
5978
5838
|
}
|
|
@@ -6033,7 +5893,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6033
5893
|
class FileService extends BaseApiService {
|
|
6034
5894
|
constructor() {
|
|
6035
5895
|
super(...arguments);
|
|
6036
|
-
__publicField(this, "host"
|
|
5896
|
+
__publicField(this, "host");
|
|
6037
5897
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6038
5898
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6039
5899
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6044,8 +5904,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6044
5904
|
}
|
|
6045
5905
|
async renewUploadUrl(sha1) {
|
|
6046
5906
|
const file = await this.fetchCache(sha1);
|
|
6047
|
-
if (!file)
|
|
6048
|
-
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`);
|
|
6049
5908
|
const key = await getFileS3Key(file, sha1);
|
|
6050
5909
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6051
5910
|
description: "Get S3 URL",
|
|
@@ -6115,8 +5974,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6115
5974
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6116
5975
|
async uploadFileToS3(sha1) {
|
|
6117
5976
|
const file = await this.fetchCache(sha1);
|
|
6118
|
-
if (!file)
|
|
6119
|
-
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`);
|
|
6120
5978
|
const key = await getFileS3Key(file, sha1);
|
|
6121
5979
|
const dbFileProperties = {
|
|
6122
5980
|
file_name: file.name,
|
|
@@ -6210,7 +6068,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6210
6068
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6211
6069
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6212
6070
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6213
|
-
|
|
6071
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6214
6072
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6215
6073
|
throw new Error(message);
|
|
6216
6074
|
}
|
|
@@ -7249,6 +7107,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7249
7107
|
exports2.ProjectFileService = ProjectFileService;
|
|
7250
7108
|
exports2.ProjectService = ProjectService;
|
|
7251
7109
|
exports2.TeamService = TeamService;
|
|
7110
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
7252
7111
|
exports2.UserService = UserService;
|
|
7253
7112
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
7254
7113
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
@@ -7299,10 +7158,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7299
7158
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
7300
7159
|
exports2.addIssues = addIssues;
|
|
7301
7160
|
exports2.addLicenses = addLicenses;
|
|
7302
|
-
exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
|
|
7303
|
-
exports2.addOrReplaceProjectFiles = addOrReplaceProjectFiles;
|
|
7304
7161
|
exports2.addProjectAttachment = addProjectAttachment;
|
|
7305
7162
|
exports2.addProjectAttachments = addProjectAttachments;
|
|
7163
|
+
exports2.addProjectFile = addProjectFile;
|
|
7164
|
+
exports2.addProjectFiles = addProjectFiles;
|
|
7306
7165
|
exports2.addTeam = addTeam;
|
|
7307
7166
|
exports2.addUsers = addUsers;
|
|
7308
7167
|
exports2.addWorkspace = addWorkspace;
|
|
@@ -7376,6 +7235,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7376
7235
|
exports2.deleteProjectAccesses = deleteProjectAccesses;
|
|
7377
7236
|
exports2.deleteProjectAttachment = deleteProjectAttachment;
|
|
7378
7237
|
exports2.deleteProjectAttachments = deleteProjectAttachments;
|
|
7238
|
+
exports2.deleteProjectFile = deleteProjectFile;
|
|
7239
|
+
exports2.deleteProjectFiles = deleteProjectFiles;
|
|
7379
7240
|
exports2.deleteTeam = deleteTeam;
|
|
7380
7241
|
exports2.deleteWorkspace = deleteWorkspace;
|
|
7381
7242
|
exports2.dequeue = dequeue;
|
|
@@ -7443,6 +7304,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7443
7304
|
exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
|
|
7444
7305
|
exports2.initializeProjectAccesses = initializeProjectAccesses;
|
|
7445
7306
|
exports2.initializeProjectAttachments = initializeProjectAttachments;
|
|
7307
|
+
exports2.initializeProjectFiles = initializeProjectFiles;
|
|
7446
7308
|
exports2.initializeTeams = initializeTeams;
|
|
7447
7309
|
exports2.initializeWorkspaces = initializeWorkspaces;
|
|
7448
7310
|
exports2.isToday = isToday;
|
|
@@ -7491,8 +7353,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7491
7353
|
exports2.rehydratedSlice = rehydratedSlice;
|
|
7492
7354
|
exports2.removeDocuments = removeDocuments;
|
|
7493
7355
|
exports2.removeIssueType = removeIssueType;
|
|
7494
|
-
exports2.removeProjectFile = removeProjectFile;
|
|
7495
|
-
exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
|
|
7496
7356
|
exports2.removeUser = removeUser;
|
|
7497
7357
|
exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
|
|
7498
7358
|
exports2.resetStore = resetStore;
|
|
@@ -7712,6 +7572,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7712
7572
|
exports2.setProfilePicture = setProfilePicture;
|
|
7713
7573
|
exports2.setProjectAttachment = setProjectAttachment;
|
|
7714
7574
|
exports2.setProjectAttachments = setProjectAttachments;
|
|
7575
|
+
exports2.setProjectFile = setProjectFile;
|
|
7576
|
+
exports2.setProjectFiles = setProjectFiles;
|
|
7715
7577
|
exports2.setProjects = setProjects;
|
|
7716
7578
|
exports2.setRehydrated = setRehydrated;
|
|
7717
7579
|
exports2.setTeam = setTeam;
|
|
@@ -7766,6 +7628,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7766
7628
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
7767
7629
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
7768
7630
|
exports2.updateProjectAttachments = updateProjectAttachments;
|
|
7631
|
+
exports2.updateProjectFile = updateProjectFile;
|
|
7632
|
+
exports2.updateProjectFiles = updateProjectFiles;
|
|
7769
7633
|
exports2.updateTeam = updateTeam;
|
|
7770
7634
|
exports2.updateWorkspace = updateWorkspace;
|
|
7771
7635
|
exports2.userReducer = userReducer;
|