@overmap-ai/core 1.0.71-fields.13 → 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 +126 -328
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +133 -334
- 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 +6 -10
- 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 -17
- 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 -24
- 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];
|
|
@@ -1576,13 +1523,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1576
1523
|
const selectProjectAccessById = (id) => (state) => {
|
|
1577
1524
|
return state.projectAccessReducer.instances[id];
|
|
1578
1525
|
};
|
|
1579
|
-
const selectActiveProjectAccess = (state) => {
|
|
1580
|
-
const currentUser = state.userReducer.currentUser;
|
|
1581
|
-
const activeProjectId = state.projectReducer.activeProjectId;
|
|
1582
|
-
return Object.values(state.projectAccessReducer.instances).find((projectAccess) => {
|
|
1583
|
-
return projectAccess.user === (currentUser == null ? void 0 : currentUser.id) && projectAccess.project === activeProjectId;
|
|
1584
|
-
}) ?? null;
|
|
1585
|
-
};
|
|
1586
1526
|
const selectProjectAccessForUser = (user) => (state) => {
|
|
1587
1527
|
return Object.values(state.projectAccessReducer.instances).find(
|
|
1588
1528
|
(projectAccess) => projectAccess.user === user.id
|
|
@@ -1597,8 +1537,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1597
1537
|
};
|
|
1598
1538
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1599
1539
|
const initialState$u = {
|
|
1600
|
-
projects: {}
|
|
1601
|
-
activeProjectId: null
|
|
1540
|
+
projects: {}
|
|
1602
1541
|
};
|
|
1603
1542
|
const projectSlice = toolkit.createSlice({
|
|
1604
1543
|
name: "projects",
|
|
@@ -1612,19 +1551,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1612
1551
|
});
|
|
1613
1552
|
state.projects = projectsMap;
|
|
1614
1553
|
},
|
|
1615
|
-
|
|
1616
|
-
state.activeProjectId = action.payload;
|
|
1617
|
-
},
|
|
1618
|
-
updateOrCreateProject: (state, action) => {
|
|
1554
|
+
updateProject: (state, action) => {
|
|
1619
1555
|
state.projects[action.payload.id] = action.payload;
|
|
1620
1556
|
},
|
|
1621
|
-
// Takes a list of Projects and updates existing ones to match the payload, or adds them
|
|
1622
|
-
// to the store if they are not already present
|
|
1623
|
-
updateOrCreateProjects: (state, action) => {
|
|
1624
|
-
action.payload.forEach((project) => {
|
|
1625
|
-
state.projects[project.id] = project;
|
|
1626
|
-
});
|
|
1627
|
-
},
|
|
1628
1557
|
deleteProject: (state, action) => {
|
|
1629
1558
|
delete state.projects[action.payload.id];
|
|
1630
1559
|
},
|
|
@@ -1634,50 +1563,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1634
1563
|
} else {
|
|
1635
1564
|
throw new Error("Accept project invite: user is not in this project");
|
|
1636
1565
|
}
|
|
1637
|
-
},
|
|
1638
|
-
addActiveProjectIssuesCount: (state, action) => {
|
|
1639
|
-
if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
|
|
1640
|
-
throw new Error("Update issues count: no active project");
|
|
1641
|
-
}
|
|
1642
|
-
if (!state.projects[state.activeProjectId].issues_count) {
|
|
1643
|
-
state.projects[state.activeProjectId].issues_count = action.payload;
|
|
1644
|
-
} else {
|
|
1645
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
1646
|
-
}
|
|
1647
|
-
},
|
|
1648
|
-
addActiveProjectFormSubmissionsCount: (state, action) => {
|
|
1649
|
-
if (state.activeProjectId && state.activeProjectId in state.projects) {
|
|
1650
|
-
if (!state.projects[state.activeProjectId].form_submissions_count) {
|
|
1651
|
-
state.projects[state.activeProjectId].form_submissions_count = action.payload;
|
|
1652
|
-
} else {
|
|
1653
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
1654
|
-
}
|
|
1655
|
-
} else {
|
|
1656
|
-
throw new Error("Update form submissions count: no active project");
|
|
1657
|
-
}
|
|
1658
1566
|
}
|
|
1659
1567
|
}
|
|
1660
1568
|
});
|
|
1661
|
-
const {
|
|
1662
|
-
setProjects,
|
|
1663
|
-
updateOrCreateProject,
|
|
1664
|
-
updateOrCreateProjects: addOrReplaceProjects,
|
|
1665
|
-
setActiveProjectId,
|
|
1666
|
-
deleteProject,
|
|
1667
|
-
acceptProjectInvite,
|
|
1668
|
-
addActiveProjectIssuesCount,
|
|
1669
|
-
addActiveProjectFormSubmissionsCount
|
|
1670
|
-
} = projectSlice.actions;
|
|
1569
|
+
const { setProjects, updateProject, deleteProject, acceptProjectInvite } = projectSlice.actions;
|
|
1671
1570
|
const projectReducer = projectSlice.reducer;
|
|
1672
1571
|
const selectProjectMapping = (state) => state.projectReducer.projects;
|
|
1673
|
-
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
1674
|
-
const selectActiveProject = (state) => {
|
|
1675
|
-
const activeProjectId = selectActiveProjectId(state);
|
|
1676
|
-
if (!activeProjectId) {
|
|
1677
|
-
return null;
|
|
1678
|
-
}
|
|
1679
|
-
return state.projectReducer.projects[activeProjectId] ?? null;
|
|
1680
|
-
};
|
|
1681
1572
|
const selectProjectById = (id) => (state) => {
|
|
1682
1573
|
return state.projectReducer.projects[id];
|
|
1683
1574
|
};
|
|
@@ -1834,8 +1725,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1834
1725
|
},
|
|
1835
1726
|
markAsDeleted(state, action) {
|
|
1836
1727
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1837
|
-
if (index !== -1)
|
|
1838
|
-
state.deletedRequests.splice(index, 1);
|
|
1728
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1839
1729
|
},
|
|
1840
1730
|
_setLatestRetryTime: (state, action) => {
|
|
1841
1731
|
state.latestRetryTime = action.payload;
|
|
@@ -1926,14 +1816,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1926
1816
|
resetProjectFileObjectUrls
|
|
1927
1817
|
} = projectFileSlice.actions;
|
|
1928
1818
|
const selectProjectFileMapping = (state) => state.projectFileReducer.projectFiles;
|
|
1929
|
-
const selectProjectFiles = toolkit.createSelector(
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
return fallbackToEmptyArray(
|
|
1933
|
-
Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
|
|
1934
|
-
);
|
|
1935
|
-
}
|
|
1936
|
-
);
|
|
1819
|
+
const selectProjectFiles = toolkit.createSelector([selectProjectFileMapping], (mapping) => {
|
|
1820
|
+
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1821
|
+
});
|
|
1937
1822
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1938
1823
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
1939
1824
|
const selectProjectFileById = (id) => (state) => {
|
|
@@ -1989,11 +1874,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1989
1874
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1990
1875
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1991
1876
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1992
|
-
({ file_type }) => !file_type
|
|
1877
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1993
1878
|
);
|
|
1994
1879
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1995
1880
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1996
|
-
({ file_type }) => file_type
|
|
1881
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1997
1882
|
);
|
|
1998
1883
|
return { fileAttachments, imageAttachments };
|
|
1999
1884
|
}
|
|
@@ -2077,8 +1962,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2077
1962
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2078
1963
|
(revisions, formId) => {
|
|
2079
1964
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2080
|
-
if (revisionsOfForm.length === 0)
|
|
2081
|
-
return void 0;
|
|
1965
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2082
1966
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2083
1967
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2084
1968
|
return revisions[latestRevision.offline_id];
|
|
@@ -2142,7 +2026,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2142
2026
|
return [...regularMatches.slice(0, maxResults)];
|
|
2143
2027
|
},
|
|
2144
2028
|
// as the argument is an object, we check the first level of properties for equality
|
|
2145
|
-
{ memoizeOptions: {
|
|
2029
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2146
2030
|
)
|
|
2147
2031
|
);
|
|
2148
2032
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
@@ -2196,8 +2080,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2196
2080
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2197
2081
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2198
2082
|
for (const revision of Object.values(revisionMapping)) {
|
|
2199
|
-
if (revision.form !== formId)
|
|
2200
|
-
continue;
|
|
2083
|
+
if (revision.form !== formId) continue;
|
|
2201
2084
|
revisionIds.add(revision.offline_id);
|
|
2202
2085
|
}
|
|
2203
2086
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2569,8 +2452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2569
2452
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2570
2453
|
const listOfAncestors = [];
|
|
2571
2454
|
const document2 = mapping[documentId];
|
|
2572
|
-
if (!document2 || !document2.parent_document)
|
|
2573
|
-
return listOfAncestors;
|
|
2455
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2574
2456
|
let currentAncestor = mapping[document2.parent_document];
|
|
2575
2457
|
while (currentAncestor) {
|
|
2576
2458
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2636,11 +2518,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2636
2518
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2637
2519
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2638
2520
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2639
|
-
({ file_type }) => !file_type
|
|
2521
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2640
2522
|
);
|
|
2641
2523
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2642
2524
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2643
|
-
({ file_type }) => file_type
|
|
2525
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2644
2526
|
);
|
|
2645
2527
|
return { fileAttachments, imageAttachments };
|
|
2646
2528
|
}
|
|
@@ -2846,11 +2728,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2846
2728
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2847
2729
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2848
2730
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2849
|
-
({ file_type }) => !file_type
|
|
2731
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2850
2732
|
);
|
|
2851
2733
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2852
2734
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2853
|
-
({ file_type }) => file_type
|
|
2735
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2854
2736
|
);
|
|
2855
2737
|
return { fileAttachments, imageAttachments };
|
|
2856
2738
|
}
|
|
@@ -3419,6 +3301,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3419
3301
|
async enqueueRequest(requestDetails) {
|
|
3420
3302
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3421
3303
|
}
|
|
3304
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3422
3305
|
dispatch(action) {
|
|
3423
3306
|
this.client.store.dispatch(action);
|
|
3424
3307
|
}
|
|
@@ -3496,9 +3379,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3496
3379
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3497
3380
|
return coordinator;
|
|
3498
3381
|
}
|
|
3499
|
-
const persistCallback = (
|
|
3500
|
-
if (
|
|
3501
|
-
throw err;
|
|
3382
|
+
const persistCallback = (e) => {
|
|
3383
|
+
if (e) throw e;
|
|
3502
3384
|
const clientStore2 = getClientStore();
|
|
3503
3385
|
if (clientStore2) {
|
|
3504
3386
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3556,20 +3438,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3556
3438
|
}
|
|
3557
3439
|
};
|
|
3558
3440
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3559
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3441
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3560
3442
|
function extractResponseFromError(error) {
|
|
3561
3443
|
function isResponse(response) {
|
|
3562
3444
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3563
3445
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3564
3446
|
}
|
|
3565
|
-
if (isResponse(error))
|
|
3566
|
-
return error;
|
|
3447
|
+
if (isResponse(error)) return error;
|
|
3567
3448
|
if (typeof error === "object" && error !== null) {
|
|
3568
3449
|
const typedError = error;
|
|
3569
|
-
if (isResponse(typedError.response))
|
|
3570
|
-
|
|
3571
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3572
|
-
return typedError.response.response;
|
|
3450
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3451
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3573
3452
|
}
|
|
3574
3453
|
return void 0;
|
|
3575
3454
|
}
|
|
@@ -3610,15 +3489,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3610
3489
|
const addPayload = (req) => {
|
|
3611
3490
|
if (attachmentHash) {
|
|
3612
3491
|
const s3url = requestDetails.s3url;
|
|
3613
|
-
if (!s3url)
|
|
3614
|
-
|
|
3615
|
-
if (
|
|
3616
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3617
|
-
if (!file)
|
|
3618
|
-
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}`);
|
|
3619
3495
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3620
|
-
if (!s3Sha1Checksum)
|
|
3621
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3496
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3622
3497
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3623
3498
|
}
|
|
3624
3499
|
return req.send(payload);
|
|
@@ -3678,8 +3553,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3678
3553
|
this.compile = this.compile.bind(this);
|
|
3679
3554
|
}
|
|
3680
3555
|
then(next) {
|
|
3681
|
-
if (this._previous)
|
|
3682
|
-
this._previous.next = next;
|
|
3556
|
+
if (this._previous) this._previous.next = next;
|
|
3683
3557
|
this._all.push(next);
|
|
3684
3558
|
this._previous = next;
|
|
3685
3559
|
return {
|
|
@@ -3707,11 +3581,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3707
3581
|
} else {
|
|
3708
3582
|
console.debug("Middleware finished. Performing request:", action);
|
|
3709
3583
|
const clientStore2 = getClientStore();
|
|
3710
|
-
if (!clientStore2)
|
|
3711
|
-
throw new Error("Client store not set");
|
|
3584
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3712
3585
|
const clientSDK2 = getClientSDK();
|
|
3713
|
-
if (!clientSDK2)
|
|
3714
|
-
throw new Error("Client SDK not set");
|
|
3586
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3715
3587
|
return performRequest(action, clientSDK2);
|
|
3716
3588
|
}
|
|
3717
3589
|
}
|
|
@@ -3732,20 +3604,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3732
3604
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3733
3605
|
}
|
|
3734
3606
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3735
|
-
const statusMessages = {
|
|
3736
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3737
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3738
|
-
405: {
|
|
3739
|
-
title: "Not supported",
|
|
3740
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3741
|
-
accentColor: "red"
|
|
3742
|
-
},
|
|
3743
|
-
500: {
|
|
3744
|
-
title: "Server error",
|
|
3745
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3746
|
-
accentColor: "red"
|
|
3747
|
-
}
|
|
3748
|
-
};
|
|
3749
3607
|
function discard(reason, action, retries = 0) {
|
|
3750
3608
|
var _a2;
|
|
3751
3609
|
console.debug(
|
|
@@ -3798,14 +3656,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3798
3656
|
}
|
|
3799
3657
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3800
3658
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3801
|
-
const message = statusMessages[status];
|
|
3802
|
-
if (message) {
|
|
3803
|
-
if (blocks.unsafeShowToast) {
|
|
3804
|
-
blocks.unsafeShowToast(message);
|
|
3805
|
-
} else {
|
|
3806
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3807
|
-
}
|
|
3808
|
-
}
|
|
3809
3659
|
const coordinator2 = getOutboxCoordinator();
|
|
3810
3660
|
if (!coordinator2) {
|
|
3811
3661
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3833,6 +3683,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3833
3683
|
}
|
|
3834
3684
|
class BaseSDK {
|
|
3835
3685
|
constructor(store) {
|
|
3686
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3836
3687
|
__publicField(this, "store");
|
|
3837
3688
|
this.store = store;
|
|
3838
3689
|
}
|
|
@@ -3868,9 +3719,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3868
3719
|
};
|
|
3869
3720
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3870
3721
|
promise.resolve(result.body);
|
|
3871
|
-
}).catch((
|
|
3872
|
-
discard(
|
|
3873
|
-
|
|
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
|
+
}
|
|
3874
3729
|
});
|
|
3875
3730
|
} else {
|
|
3876
3731
|
const innerPromise = this.store.dispatch(
|
|
@@ -3924,10 +3779,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3924
3779
|
}
|
|
3925
3780
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3926
3781
|
function parseTokens(response) {
|
|
3927
|
-
if (!response.access)
|
|
3928
|
-
|
|
3929
|
-
if (!response.refresh)
|
|
3930
|
-
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");
|
|
3931
3784
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3932
3785
|
}
|
|
3933
3786
|
class JWTService extends BaseAuthService {
|
|
@@ -3964,8 +3817,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3964
3817
|
this.clearAuth();
|
|
3965
3818
|
return void 0;
|
|
3966
3819
|
}
|
|
3967
|
-
if (!response.access)
|
|
3968
|
-
throw new Error("Missing access token");
|
|
3820
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3969
3821
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3970
3822
|
});
|
|
3971
3823
|
}
|
|
@@ -4021,8 +3873,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4021
3873
|
return `Bearer ${accessToken}`;
|
|
4022
3874
|
}
|
|
4023
3875
|
async prepareAuth() {
|
|
4024
|
-
if (!this.tokenIsExpiringSoon())
|
|
4025
|
-
return;
|
|
3876
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
4026
3877
|
console.debug(this.constructor.name, "preparing auth");
|
|
4027
3878
|
try {
|
|
4028
3879
|
await this.renewTokens();
|
|
@@ -4030,7 +3881,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4030
3881
|
if (e instanceof APIError) {
|
|
4031
3882
|
this.clearAuth();
|
|
4032
3883
|
}
|
|
4033
|
-
|
|
3884
|
+
if (e instanceof Error) {
|
|
3885
|
+
return Promise.reject(e);
|
|
3886
|
+
} else {
|
|
3887
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3888
|
+
}
|
|
4034
3889
|
}
|
|
4035
3890
|
}
|
|
4036
3891
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -4061,7 +3916,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4061
3916
|
async initAuth(payload) {
|
|
4062
3917
|
const uuid$1 = uuid.v4();
|
|
4063
3918
|
console.debug(this.constructor.name, "Initiating auth");
|
|
4064
|
-
|
|
3919
|
+
return this.enqueueRequest({
|
|
4065
3920
|
uuid: uuid$1,
|
|
4066
3921
|
description: "Get token pair",
|
|
4067
3922
|
method: HttpMethod.POST,
|
|
@@ -4069,25 +3924,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4069
3924
|
payload,
|
|
4070
3925
|
isAuthNeeded: false,
|
|
4071
3926
|
checkAuth: false,
|
|
3927
|
+
immediate: true,
|
|
4072
3928
|
blockers: [],
|
|
4073
3929
|
blocks: []
|
|
4074
|
-
}).then(
|
|
4075
|
-
|
|
4076
|
-
let timedOut = false;
|
|
4077
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
4078
|
-
setTimeout(() => {
|
|
4079
|
-
timedOut = true;
|
|
4080
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
4081
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
4082
|
-
}, timeout * 1e3);
|
|
4083
|
-
});
|
|
4084
|
-
const successPromise = promise.then((tokens) => {
|
|
4085
|
-
if (timedOut) {
|
|
4086
|
-
return void 0;
|
|
4087
|
-
}
|
|
4088
|
-
this.setTokens(tokens);
|
|
3930
|
+
}).then((tokens) => {
|
|
3931
|
+
this.setTokens(parseTokens(tokens));
|
|
4089
3932
|
});
|
|
4090
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
4091
3933
|
}
|
|
4092
3934
|
}
|
|
4093
3935
|
class BaseApiService extends BaseService {
|
|
@@ -4247,8 +4089,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4247
4089
|
const { store } = this.client;
|
|
4248
4090
|
const state = store.getState();
|
|
4249
4091
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
4250
|
-
if (!assetToBeDeleted)
|
|
4251
|
-
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`);
|
|
4252
4093
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
4253
4094
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
4254
4095
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -4271,12 +4112,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4271
4112
|
url: `/assets/${id}/`,
|
|
4272
4113
|
blockers: [id],
|
|
4273
4114
|
blocks: []
|
|
4274
|
-
}).catch((
|
|
4115
|
+
}).catch((e) => {
|
|
4275
4116
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
4276
4117
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4277
4118
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4278
4119
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4279
|
-
throw
|
|
4120
|
+
throw e;
|
|
4280
4121
|
});
|
|
4281
4122
|
}
|
|
4282
4123
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -4300,17 +4141,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4300
4141
|
const { batchId, payload } = assetBatch;
|
|
4301
4142
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
4302
4143
|
const blockers = [assetTypeId];
|
|
4303
|
-
if (prevBatchId)
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
blocks2.push(batchId);
|
|
4144
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
4145
|
+
const blocks = batchAssetOfflineIds;
|
|
4146
|
+
blocks.push(batchId);
|
|
4307
4147
|
const promise = this.enqueueRequest({
|
|
4308
4148
|
description: "Batch create assets",
|
|
4309
4149
|
method: HttpMethod.POST,
|
|
4310
4150
|
url: "/assets/bulk/",
|
|
4311
4151
|
payload,
|
|
4312
4152
|
blockers,
|
|
4313
|
-
blocks
|
|
4153
|
+
blocks
|
|
4314
4154
|
});
|
|
4315
4155
|
prevBatchId = assetBatch.batchId;
|
|
4316
4156
|
batchPromises.push(promise);
|
|
@@ -4521,8 +4361,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4521
4361
|
update(payload) {
|
|
4522
4362
|
const { store } = this.client;
|
|
4523
4363
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4524
|
-
if (!assetStage)
|
|
4525
|
-
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`);
|
|
4526
4365
|
const updatedAssetStage = {
|
|
4527
4366
|
...assetStage,
|
|
4528
4367
|
...payload
|
|
@@ -4678,8 +4517,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4678
4517
|
for (const payload of payloads) {
|
|
4679
4518
|
const { modelId, file } = payload;
|
|
4680
4519
|
const filePayload = await this.getFilePayload(file);
|
|
4681
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
4682
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
4520
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
4683
4521
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
4684
4522
|
file,
|
|
4685
4523
|
file_sha1: filePayload.sha1,
|
|
@@ -5104,7 +4942,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5104
4942
|
created_by: createdBy
|
|
5105
4943
|
});
|
|
5106
4944
|
this.dispatch(addIssue(offlineIssue));
|
|
5107
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5108
4945
|
const promise = this.enqueueRequest({
|
|
5109
4946
|
description: "Create issue",
|
|
5110
4947
|
method: HttpMethod.POST,
|
|
@@ -5117,7 +4954,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5117
4954
|
this.dispatch(updateIssue(result));
|
|
5118
4955
|
}).catch((error) => {
|
|
5119
4956
|
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
5120
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5121
4957
|
throw error;
|
|
5122
4958
|
});
|
|
5123
4959
|
return [offlineIssue, promise];
|
|
@@ -5145,7 +4981,18 @@ var __publicField = (obj, key, value) => {
|
|
|
5145
4981
|
]) {
|
|
5146
4982
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
5147
4983
|
switch (issueUpdateChange) {
|
|
5148
|
-
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: {
|
|
5149
4996
|
let categoryOrNull = null;
|
|
5150
4997
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
5151
4998
|
if (categoryIdOrNull) {
|
|
@@ -5162,7 +5009,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5162
5009
|
} : null;
|
|
5163
5010
|
break;
|
|
5164
5011
|
}
|
|
5165
|
-
case
|
|
5012
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
5166
5013
|
let userOrNull = null;
|
|
5167
5014
|
const userIdOrNull = payload[issueUpdateChange];
|
|
5168
5015
|
if (userIdOrNull) {
|
|
@@ -5178,20 +5025,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5178
5025
|
} : null;
|
|
5179
5026
|
break;
|
|
5180
5027
|
}
|
|
5181
|
-
case "description":
|
|
5182
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5183
|
-
break;
|
|
5184
|
-
case "title":
|
|
5185
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5186
|
-
break;
|
|
5187
|
-
case "priority":
|
|
5188
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5189
|
-
break;
|
|
5190
|
-
case "status":
|
|
5191
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5192
|
-
break;
|
|
5193
|
-
case "due_date":
|
|
5194
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
5195
5028
|
}
|
|
5196
5029
|
}
|
|
5197
5030
|
}
|
|
@@ -5233,7 +5066,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5233
5066
|
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
5234
5067
|
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
5235
5068
|
this.dispatch(deleteIssue(id));
|
|
5236
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5237
5069
|
if (attachmentsOfIssue.length > 0)
|
|
5238
5070
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
5239
5071
|
if (updatesOfIssue.length > 0)
|
|
@@ -5254,7 +5086,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5254
5086
|
this.dispatch(addIssue(backup));
|
|
5255
5087
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
5256
5088
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
5257
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5258
5089
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
5259
5090
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
5260
5091
|
throw e;
|
|
@@ -5420,13 +5251,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5420
5251
|
const { store } = this.client;
|
|
5421
5252
|
const state = store.getState();
|
|
5422
5253
|
const activeProjectFileId = state.projectFileReducer.activeProjectFileId;
|
|
5423
|
-
const activeProjectId = state.projectReducer.activeProjectId;
|
|
5424
5254
|
if (!activeProjectFileId) {
|
|
5425
5255
|
throw new Error("No active project file");
|
|
5426
5256
|
}
|
|
5427
|
-
if (!activeProjectId) {
|
|
5428
|
-
throw new Error("No active project");
|
|
5429
|
-
}
|
|
5430
5257
|
const activeProjectFile = state.projectFileReducer.projectFiles[activeProjectFileId];
|
|
5431
5258
|
if (!activeProjectFile) {
|
|
5432
5259
|
throw new Error("No active project file");
|
|
@@ -5451,7 +5278,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5451
5278
|
this.client.files.uploadFileToS3(activeProjectFile.file_sha1).then(([fileProps]) => {
|
|
5452
5279
|
resolve({
|
|
5453
5280
|
method: HttpMethod.POST,
|
|
5454
|
-
url: `/projects/${
|
|
5281
|
+
url: `/projects/${activeProjectFile.project}/files/`,
|
|
5455
5282
|
payload: {
|
|
5456
5283
|
...activeProjectFile,
|
|
5457
5284
|
...fileProps
|
|
@@ -5566,7 +5393,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5566
5393
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5567
5394
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5568
5395
|
}
|
|
5569
|
-
this.dispatch(
|
|
5396
|
+
this.dispatch(updateProject(project));
|
|
5570
5397
|
return await this.enqueueRequest({
|
|
5571
5398
|
description: "Update project",
|
|
5572
5399
|
method: HttpMethod.PATCH,
|
|
@@ -5831,12 +5658,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5831
5658
|
});
|
|
5832
5659
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5833
5660
|
promise.then((result) => {
|
|
5834
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5835
5661
|
this.dispatch(setFormSubmission(result));
|
|
5836
5662
|
return result;
|
|
5837
5663
|
}).catch(() => {
|
|
5838
5664
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5839
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5840
5665
|
});
|
|
5841
5666
|
return [offlineSubmission, promise];
|
|
5842
5667
|
}
|
|
@@ -5883,7 +5708,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5883
5708
|
}
|
|
5884
5709
|
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5885
5710
|
this.dispatch(deleteFormSubmission(id));
|
|
5886
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5887
5711
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5888
5712
|
try {
|
|
5889
5713
|
return await this.enqueueRequest({
|
|
@@ -5894,7 +5718,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5894
5718
|
blocks: []
|
|
5895
5719
|
});
|
|
5896
5720
|
} catch (e) {
|
|
5897
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5898
5721
|
this.dispatch(addFormSubmission(submissionToBeDeleted));
|
|
5899
5722
|
this.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
5900
5723
|
throw e;
|
|
@@ -5977,9 +5800,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5977
5800
|
blockers: [id],
|
|
5978
5801
|
blocks: []
|
|
5979
5802
|
});
|
|
5980
|
-
void promise.catch((
|
|
5803
|
+
void promise.catch((e) => {
|
|
5981
5804
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
5982
|
-
throw
|
|
5805
|
+
throw e;
|
|
5983
5806
|
});
|
|
5984
5807
|
return promise;
|
|
5985
5808
|
}
|
|
@@ -6040,7 +5863,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6040
5863
|
class FileService extends BaseApiService {
|
|
6041
5864
|
constructor() {
|
|
6042
5865
|
super(...arguments);
|
|
6043
|
-
__publicField(this, "host"
|
|
5866
|
+
__publicField(this, "host");
|
|
6044
5867
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6045
5868
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6046
5869
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6051,8 +5874,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6051
5874
|
}
|
|
6052
5875
|
async renewUploadUrl(sha1) {
|
|
6053
5876
|
const file = await this.fetchCache(sha1);
|
|
6054
|
-
if (!file)
|
|
6055
|
-
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`);
|
|
6056
5878
|
const key = await getFileS3Key(file, sha1);
|
|
6057
5879
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6058
5880
|
description: "Get S3 URL",
|
|
@@ -6122,8 +5944,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6122
5944
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6123
5945
|
async uploadFileToS3(sha1) {
|
|
6124
5946
|
const file = await this.fetchCache(sha1);
|
|
6125
|
-
if (!file)
|
|
6126
|
-
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`);
|
|
6127
5948
|
const key = await getFileS3Key(file, sha1);
|
|
6128
5949
|
const dbFileProperties = {
|
|
6129
5950
|
file_name: file.name,
|
|
@@ -6217,7 +6038,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6217
6038
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6218
6039
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6219
6040
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6220
|
-
|
|
6041
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6221
6042
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6222
6043
|
throw new Error(message);
|
|
6223
6044
|
}
|
|
@@ -6741,15 +6562,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6741
6562
|
}
|
|
6742
6563
|
}
|
|
6743
6564
|
class AgentService extends BaseApiService {
|
|
6744
|
-
async startConversation(prompt) {
|
|
6745
|
-
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6565
|
+
async startConversation(prompt, projectId) {
|
|
6746
6566
|
return this.enqueueRequest({
|
|
6747
6567
|
description: "Start agent conversation",
|
|
6748
6568
|
method: HttpMethod.POST,
|
|
6749
6569
|
url: "/agents/prompt/",
|
|
6750
6570
|
payload: {
|
|
6751
6571
|
prompt,
|
|
6752
|
-
active_project:
|
|
6572
|
+
active_project: projectId
|
|
6753
6573
|
},
|
|
6754
6574
|
blockers: ["prompt"],
|
|
6755
6575
|
blocks: ["prompt"]
|
|
@@ -6758,21 +6578,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6758
6578
|
return response;
|
|
6759
6579
|
});
|
|
6760
6580
|
}
|
|
6761
|
-
|
|
6762
|
-
* Prompt the agent with a message.
|
|
6763
|
-
* @param prompt The message to prompt the agent with.
|
|
6764
|
-
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
6765
|
-
*/
|
|
6766
|
-
async continueConversation(prompt, conversationId) {
|
|
6767
|
-
const { store } = this.client;
|
|
6768
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
6581
|
+
async continueConversation(prompt, conversationId, projectId) {
|
|
6769
6582
|
return this.enqueueRequest({
|
|
6770
6583
|
description: "Prompt agent",
|
|
6771
6584
|
method: HttpMethod.POST,
|
|
6772
6585
|
url: "/agents/prompt/",
|
|
6773
6586
|
payload: {
|
|
6774
6587
|
prompt,
|
|
6775
|
-
active_project:
|
|
6588
|
+
active_project: projectId
|
|
6776
6589
|
},
|
|
6777
6590
|
blockers: ["prompt"],
|
|
6778
6591
|
blocks: ["prompt"],
|
|
@@ -7024,8 +6837,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7024
6837
|
for (const payloadAndFile of payloads) {
|
|
7025
6838
|
const { file, ...payload } = payloadAndFile;
|
|
7026
6839
|
const filePayload = await this.getFilePayload(file);
|
|
7027
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7028
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
6840
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7029
6841
|
const offlineMapImage = offline({
|
|
7030
6842
|
...payload,
|
|
7031
6843
|
file_name: file.name,
|
|
@@ -7203,8 +7015,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7203
7015
|
for (const payload of payloads) {
|
|
7204
7016
|
const { revisionId, fieldIdentifier, file } = payload;
|
|
7205
7017
|
const filePayload = await this.getFilePayload(file);
|
|
7206
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7207
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7018
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7208
7019
|
const offlineFormRevisionAttachment = offline({
|
|
7209
7020
|
file: URL.createObjectURL(file),
|
|
7210
7021
|
file_type: file.type,
|
|
@@ -7289,8 +7100,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7289
7100
|
for (const payload of payloads) {
|
|
7290
7101
|
const { submissionId, fieldIdentifier, file } = payload;
|
|
7291
7102
|
const filePayload = await this.getFilePayload(file);
|
|
7292
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7293
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7103
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7294
7104
|
const offlineFormSubmissionAttachment = offline({
|
|
7295
7105
|
file: URL.createObjectURL(file),
|
|
7296
7106
|
file_type: file.type,
|
|
@@ -7437,8 +7247,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7437
7247
|
for (const payload of payloads) {
|
|
7438
7248
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7439
7249
|
const filePayload = await this.getFilePayload(file);
|
|
7440
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7441
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7250
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7442
7251
|
const offlineAssetTypeFieldsAttachment = offline({
|
|
7443
7252
|
file: URL.createObjectURL(file),
|
|
7444
7253
|
file_type: file.type,
|
|
@@ -7719,8 +7528,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7719
7528
|
for (const payload of batch) {
|
|
7720
7529
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7721
7530
|
const filePayload = await this.getFilePayload(file);
|
|
7722
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7723
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7531
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7724
7532
|
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7725
7533
|
file: URL.createObjectURL(file),
|
|
7726
7534
|
file_type: file.type,
|
|
@@ -7760,8 +7568,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7760
7568
|
});
|
|
7761
7569
|
});
|
|
7762
7570
|
Promise.all(promises).then((result) => {
|
|
7763
|
-
for (const res of result)
|
|
7764
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7571
|
+
for (const res of result) this.processPresignedUrls(res.presigned_urls);
|
|
7765
7572
|
const attachments = result.flatMap((res) => res.attachments);
|
|
7766
7573
|
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7767
7574
|
}).catch((error) => {
|
|
@@ -7821,8 +7628,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7821
7628
|
for (const payload of payloads) {
|
|
7822
7629
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7823
7630
|
const filePayload = await this.getFilePayload(file);
|
|
7824
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7825
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7631
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7826
7632
|
const offlineIssueTypeFieldsAttachment = offline({
|
|
7827
7633
|
file: URL.createObjectURL(file),
|
|
7828
7634
|
file_type: file.type,
|
|
@@ -7936,8 +7742,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7936
7742
|
for (const payload of payloads) {
|
|
7937
7743
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7938
7744
|
const filePayload = await this.getFilePayload(file);
|
|
7939
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7940
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7745
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7941
7746
|
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7942
7747
|
file: URL.createObjectURL(file),
|
|
7943
7748
|
file_type: file.type,
|
|
@@ -8200,6 +8005,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8200
8005
|
exports2.ProjectFileService = ProjectFileService;
|
|
8201
8006
|
exports2.ProjectService = ProjectService;
|
|
8202
8007
|
exports2.TeamService = TeamService;
|
|
8008
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
8203
8009
|
exports2.UserService = UserService;
|
|
8204
8010
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
8205
8011
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
@@ -8208,8 +8014,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8208
8014
|
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
8209
8015
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
8210
8016
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
8211
|
-
exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
|
|
8212
|
-
exports2.addActiveProjectIssuesCount = addActiveProjectIssuesCount;
|
|
8213
8017
|
exports2.addAsset = addAsset;
|
|
8214
8018
|
exports2.addAssetAttachment = addAssetAttachment;
|
|
8215
8019
|
exports2.addAssetAttachments = addAssetAttachments;
|
|
@@ -8270,7 +8074,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8270
8074
|
exports2.addLicenses = addLicenses;
|
|
8271
8075
|
exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
|
|
8272
8076
|
exports2.addOrReplaceProjectFiles = addOrReplaceProjectFiles;
|
|
8273
|
-
exports2.addOrReplaceProjects = addOrReplaceProjects;
|
|
8274
8077
|
exports2.addProjectAttachment = addProjectAttachment;
|
|
8275
8078
|
exports2.addProjectAttachments = addProjectAttachments;
|
|
8276
8079
|
exports2.addTeam = addTeam;
|
|
@@ -8519,10 +8322,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8519
8322
|
exports2.saveActiveProjectFileBounds = saveActiveProjectFileBounds;
|
|
8520
8323
|
exports2.selectAccessToken = selectAccessToken;
|
|
8521
8324
|
exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
|
|
8522
|
-
exports2.selectActiveProject = selectActiveProject;
|
|
8523
|
-
exports2.selectActiveProjectAccess = selectActiveProjectAccess;
|
|
8524
8325
|
exports2.selectActiveProjectFileId = selectActiveProjectFileId;
|
|
8525
|
-
exports2.selectActiveProjectId = selectActiveProjectId;
|
|
8526
8326
|
exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
|
|
8527
8327
|
exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
|
|
8528
8328
|
exports2.selectAllProjectAttachments = selectAllProjectAttachments;
|
|
@@ -8726,7 +8526,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8726
8526
|
exports2.separateFilesFromValues = separateFilesFromValues;
|
|
8727
8527
|
exports2.separateImageFromFields = separateImageFromFields;
|
|
8728
8528
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
8729
|
-
exports2.setActiveProjectId = setActiveProjectId;
|
|
8730
8529
|
exports2.setAsset = setAsset;
|
|
8731
8530
|
exports2.setAssetAttachment = setAssetAttachment;
|
|
8732
8531
|
exports2.setAssetAttachments = setAssetAttachments;
|
|
@@ -8847,8 +8646,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8847
8646
|
exports2.updateIssueTypeFieldsAttachments = updateIssueTypeFieldsAttachments;
|
|
8848
8647
|
exports2.updateIssueTypeFieldsMany = updateIssueTypeFieldsMany;
|
|
8849
8648
|
exports2.updateLicense = updateLicense;
|
|
8850
|
-
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
8851
8649
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
8650
|
+
exports2.updateProject = updateProject;
|
|
8852
8651
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
8853
8652
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
8854
8653
|
exports2.updateProjectAttachments = updateProjectAttachments;
|