@overmap-ai/core 1.0.71-project-file-improvements.4 → 1.0.71-remove-login-timeout.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/defaults.d.ts +2 -1
- package/dist/constants/index.d.ts +3 -3
- package/dist/enums/index.d.ts +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/overmap-core.js +291 -452
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +300 -460
- 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 +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 +9 -8
- 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 +16 -21
- 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 -17
- package/dist/store/slices/projectAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/projectFileSlice.d.ts +56 -44
- 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 +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/geoImages.d.ts +5 -4
- 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 +5 -7
- 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
|
/**
|
|
@@ -274,13 +268,11 @@ var __publicField = (obj, key, value) => {
|
|
|
274
268
|
try {
|
|
275
269
|
ret = Object.entries(responseBody.body).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$m = {
|
|
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;
|
|
@@ -1846,46 +1736,93 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1736
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1847
1737
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1848
1738
|
const outboxReducer = outboxSlice.reducer;
|
|
1849
|
-
const
|
|
1850
|
-
|
|
1739
|
+
const initialState$j = {
|
|
1740
|
+
projectFiles: {},
|
|
1741
|
+
activeProjectFileId: null,
|
|
1742
|
+
isImportingProjectFile: false
|
|
1743
|
+
};
|
|
1851
1744
|
const projectFileSlice = toolkit.createSlice({
|
|
1852
1745
|
name: "projectFiles",
|
|
1853
1746
|
initialState: initialState$j,
|
|
1854
1747
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1855
1748
|
reducers: {
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1749
|
+
addOrReplaceProjectFiles: (state, action) => {
|
|
1750
|
+
for (let fileObj of action.payload) {
|
|
1751
|
+
let file = fileObj.file;
|
|
1752
|
+
if (file.includes("+")) {
|
|
1753
|
+
console.warn("Attempting to apply fix for image URL with '+' character:", file);
|
|
1754
|
+
const parts = file.split("/");
|
|
1755
|
+
if (parts.length < 2) {
|
|
1756
|
+
throw new Error("Invalid URL: " + file);
|
|
1757
|
+
}
|
|
1758
|
+
const lastPart = encodeURIComponent(parts[parts.length - 1]);
|
|
1759
|
+
file = parts.slice(0, -1).join("/") + "/" + lastPart;
|
|
1760
|
+
console.warn("Fixed URL:", file);
|
|
1761
|
+
fileObj = { ...fileObj, file };
|
|
1762
|
+
}
|
|
1763
|
+
state.projectFiles[fileObj.offline_id] = fileObj;
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
addOrReplaceProjectFile: (state, action) => {
|
|
1767
|
+
if (!action.payload.project) {
|
|
1768
|
+
throw new Error("ProjectFile has no project. A project must be set before storing.");
|
|
1769
|
+
}
|
|
1770
|
+
state.projectFiles[action.payload.offline_id] = action.payload;
|
|
1771
|
+
},
|
|
1772
|
+
setIsImportingProjectFile: (state, action) => {
|
|
1773
|
+
state.isImportingProjectFile = action.payload;
|
|
1774
|
+
},
|
|
1775
|
+
saveActiveProjectFileBounds: (state, action) => {
|
|
1776
|
+
const activeProjectFileId = state.activeProjectFileId;
|
|
1777
|
+
if (!activeProjectFileId) {
|
|
1778
|
+
throw new Error("Tried to save bounds for active project file, but no active project file was set.");
|
|
1779
|
+
}
|
|
1780
|
+
if (!state.projectFiles[activeProjectFileId]) {
|
|
1781
|
+
throw new Error(
|
|
1782
|
+
`Tried to save bounds for active project file, but project file with ID ${activeProjectFileId}
|
|
1783
|
+
doesn't exist.`
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
state.projectFiles[activeProjectFileId].bounds = action.payload;
|
|
1787
|
+
},
|
|
1788
|
+
// TODO: Move to MapContext. Should not be persisted.
|
|
1789
|
+
setActiveProjectFileId: (state, action) => {
|
|
1790
|
+
state.activeProjectFileId = action.payload;
|
|
1791
|
+
},
|
|
1792
|
+
removeProjectFile: (state, action) => {
|
|
1793
|
+
delete state.projectFiles[action.payload];
|
|
1794
|
+
},
|
|
1795
|
+
removeProjectFilesOfProject: (state, action) => {
|
|
1796
|
+
const filesToDelete = Object.values(state.projectFiles).filter((file) => file.project === action.payload);
|
|
1797
|
+
for (const file of filesToDelete) {
|
|
1798
|
+
delete state.projectFiles[file.offline_id];
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1801
|
+
resetProjectFileObjectUrls: (state, ..._args) => {
|
|
1802
|
+
for (const key in state.projectFiles) {
|
|
1803
|
+
delete state.projectFiles[key].objectURL;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1865
1806
|
}
|
|
1866
1807
|
});
|
|
1867
1808
|
const {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
deleteProjectFiles
|
|
1809
|
+
addOrReplaceProjectFiles,
|
|
1810
|
+
addOrReplaceProjectFile,
|
|
1811
|
+
setIsImportingProjectFile,
|
|
1812
|
+
setActiveProjectFileId,
|
|
1813
|
+
saveActiveProjectFileBounds,
|
|
1814
|
+
removeProjectFile,
|
|
1815
|
+
removeProjectFilesOfProject,
|
|
1816
|
+
resetProjectFileObjectUrls
|
|
1877
1817
|
} = projectFileSlice.actions;
|
|
1878
|
-
const selectProjectFileMapping = (state) => state.projectFileReducer.
|
|
1879
|
-
const selectProjectFiles = toolkit.createSelector(
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
);
|
|
1885
|
-
}
|
|
1886
|
-
);
|
|
1818
|
+
const selectProjectFileMapping = (state) => state.projectFileReducer.projectFiles;
|
|
1819
|
+
const selectProjectFiles = toolkit.createSelector([selectProjectFileMapping], (mapping) => {
|
|
1820
|
+
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1821
|
+
});
|
|
1822
|
+
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1823
|
+
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
1887
1824
|
const selectProjectFileById = (id) => (state) => {
|
|
1888
|
-
return state.projectFileReducer.
|
|
1825
|
+
return state.projectFileReducer.projectFiles[id];
|
|
1889
1826
|
};
|
|
1890
1827
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1891
1828
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
@@ -1937,11 +1874,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1937
1874
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
1938
1875
|
const fileAttachments = attachmentsOfProject.filter(
|
|
1939
1876
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1940
|
-
({ file_type }) => !file_type
|
|
1877
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1941
1878
|
);
|
|
1942
1879
|
const imageAttachments = attachmentsOfProject.filter(
|
|
1943
1880
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1944
|
-
({ file_type }) => file_type
|
|
1881
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1945
1882
|
);
|
|
1946
1883
|
return { fileAttachments, imageAttachments };
|
|
1947
1884
|
}
|
|
@@ -2025,8 +1962,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2025
1962
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2026
1963
|
(revisions, formId) => {
|
|
2027
1964
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2028
|
-
if (revisionsOfForm.length === 0)
|
|
2029
|
-
return void 0;
|
|
1965
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2030
1966
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2031
1967
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2032
1968
|
return revisions[latestRevision.offline_id];
|
|
@@ -2098,7 +2034,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2098
2034
|
return [...regularMatches.slice(0, maxResults)];
|
|
2099
2035
|
},
|
|
2100
2036
|
// as the argument is an object, we check the first level of properties for equality
|
|
2101
|
-
{ memoizeOptions: {
|
|
2037
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2102
2038
|
)
|
|
2103
2039
|
);
|
|
2104
2040
|
const selectFormById = (formId) => (state) => {
|
|
@@ -2177,8 +2113,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2177
2113
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2178
2114
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2179
2115
|
for (const revision of Object.values(revisionMapping)) {
|
|
2180
|
-
if (revision.form !== formId)
|
|
2181
|
-
continue;
|
|
2116
|
+
if (revision.form !== formId) continue;
|
|
2182
2117
|
revisionIds.add(revision.offline_id);
|
|
2183
2118
|
}
|
|
2184
2119
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2245,8 +2180,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2245
2180
|
],
|
|
2246
2181
|
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2247
2182
|
const issue = issues[issueId];
|
|
2248
|
-
if (!issue)
|
|
2249
|
-
return [];
|
|
2183
|
+
if (!issue) return [];
|
|
2250
2184
|
if (!issue.issue_type) {
|
|
2251
2185
|
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2252
2186
|
}
|
|
@@ -2303,8 +2237,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2303
2237
|
],
|
|
2304
2238
|
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2305
2239
|
const asset = assets[assetId];
|
|
2306
|
-
if (!asset)
|
|
2307
|
-
return [];
|
|
2240
|
+
if (!asset) return [];
|
|
2308
2241
|
if (!asset.asset_type) {
|
|
2309
2242
|
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2310
2243
|
}
|
|
@@ -2680,8 +2613,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2680
2613
|
toolkit.createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2681
2614
|
const listOfAncestors = [];
|
|
2682
2615
|
const document2 = mapping[documentId];
|
|
2683
|
-
if (!document2 || !document2.parent_document)
|
|
2684
|
-
return listOfAncestors;
|
|
2616
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2685
2617
|
let currentAncestor = mapping[document2.parent_document];
|
|
2686
2618
|
while (currentAncestor) {
|
|
2687
2619
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2747,11 +2679,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2747
2679
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2748
2680
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2749
2681
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2750
|
-
({ file_type }) => !file_type
|
|
2682
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2751
2683
|
);
|
|
2752
2684
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2753
2685
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2754
|
-
({ file_type }) => file_type
|
|
2686
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2755
2687
|
);
|
|
2756
2688
|
return { fileAttachments, imageAttachments };
|
|
2757
2689
|
}
|
|
@@ -2957,11 +2889,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2957
2889
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2958
2890
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2959
2891
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2960
|
-
({ file_type }) => !file_type
|
|
2892
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2961
2893
|
);
|
|
2962
2894
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2963
2895
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2964
|
-
({ file_type }) => file_type
|
|
2896
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2965
2897
|
);
|
|
2966
2898
|
return { fileAttachments, imageAttachments };
|
|
2967
2899
|
}
|
|
@@ -3108,6 +3040,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3108
3040
|
async enqueueRequest(requestDetails) {
|
|
3109
3041
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3110
3042
|
}
|
|
3043
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3111
3044
|
dispatch(action) {
|
|
3112
3045
|
this.client.store.dispatch(action);
|
|
3113
3046
|
}
|
|
@@ -3177,9 +3110,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3177
3110
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3178
3111
|
return coordinator;
|
|
3179
3112
|
}
|
|
3180
|
-
const persistCallback = (
|
|
3181
|
-
if (
|
|
3182
|
-
throw err;
|
|
3113
|
+
const persistCallback = (e) => {
|
|
3114
|
+
if (e) throw e;
|
|
3183
3115
|
const clientStore2 = getClientStore();
|
|
3184
3116
|
if (clientStore2) {
|
|
3185
3117
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3237,20 +3169,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3237
3169
|
}
|
|
3238
3170
|
};
|
|
3239
3171
|
const migration = createMigration(manifest, VERSION_REDUCER_KEY);
|
|
3240
|
-
const overmapEnhancer = compose(reduxOffline.offline(customConfig), migration);
|
|
3172
|
+
const overmapEnhancer = toolkit.compose(reduxOffline.offline(customConfig), migration);
|
|
3241
3173
|
function extractResponseFromError(error) {
|
|
3242
3174
|
function isResponse(response) {
|
|
3243
3175
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3244
3176
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3245
3177
|
}
|
|
3246
|
-
if (isResponse(error))
|
|
3247
|
-
return error;
|
|
3178
|
+
if (isResponse(error)) return error;
|
|
3248
3179
|
if (typeof error === "object" && error !== null) {
|
|
3249
3180
|
const typedError = error;
|
|
3250
|
-
if (isResponse(typedError.response))
|
|
3251
|
-
|
|
3252
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3253
|
-
return typedError.response.response;
|
|
3181
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3182
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3254
3183
|
}
|
|
3255
3184
|
return void 0;
|
|
3256
3185
|
}
|
|
@@ -3291,15 +3220,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3291
3220
|
const addPayload = (req) => {
|
|
3292
3221
|
if (attachmentHash) {
|
|
3293
3222
|
const s3url = requestDetails.s3url;
|
|
3294
|
-
if (!s3url)
|
|
3295
|
-
|
|
3296
|
-
if (
|
|
3297
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3298
|
-
if (!file)
|
|
3299
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3223
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3224
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3225
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3300
3226
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3301
|
-
if (!s3Sha1Checksum)
|
|
3302
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3227
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3303
3228
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3304
3229
|
}
|
|
3305
3230
|
return req.send(payload);
|
|
@@ -3359,8 +3284,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3359
3284
|
this.compile = this.compile.bind(this);
|
|
3360
3285
|
}
|
|
3361
3286
|
then(next) {
|
|
3362
|
-
if (this._previous)
|
|
3363
|
-
this._previous.next = next;
|
|
3287
|
+
if (this._previous) this._previous.next = next;
|
|
3364
3288
|
this._all.push(next);
|
|
3365
3289
|
this._previous = next;
|
|
3366
3290
|
return {
|
|
@@ -3388,11 +3312,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3388
3312
|
} else {
|
|
3389
3313
|
console.debug("Middleware finished. Performing request:", action);
|
|
3390
3314
|
const clientStore2 = getClientStore();
|
|
3391
|
-
if (!clientStore2)
|
|
3392
|
-
throw new Error("Client store not set");
|
|
3315
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3393
3316
|
const clientSDK2 = getClientSDK();
|
|
3394
|
-
if (!clientSDK2)
|
|
3395
|
-
throw new Error("Client SDK not set");
|
|
3317
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3396
3318
|
return performRequest(action, clientSDK2);
|
|
3397
3319
|
}
|
|
3398
3320
|
}
|
|
@@ -3413,20 +3335,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3413
3335
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3414
3336
|
}
|
|
3415
3337
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3416
|
-
const statusMessages = {
|
|
3417
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3418
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3419
|
-
405: {
|
|
3420
|
-
title: "Not supported",
|
|
3421
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3422
|
-
accentColor: "red"
|
|
3423
|
-
},
|
|
3424
|
-
500: {
|
|
3425
|
-
title: "Server error",
|
|
3426
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3427
|
-
accentColor: "red"
|
|
3428
|
-
}
|
|
3429
|
-
};
|
|
3430
3338
|
function discard(reason, action, retries = 0) {
|
|
3431
3339
|
var _a2;
|
|
3432
3340
|
console.debug(
|
|
@@ -3479,14 +3387,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3479
3387
|
}
|
|
3480
3388
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3481
3389
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3482
|
-
const message = statusMessages[status];
|
|
3483
|
-
if (message) {
|
|
3484
|
-
if (blocks.unsafeShowToast) {
|
|
3485
|
-
blocks.unsafeShowToast(message);
|
|
3486
|
-
} else {
|
|
3487
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
3390
|
const coordinator2 = getOutboxCoordinator();
|
|
3491
3391
|
if (!coordinator2) {
|
|
3492
3392
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3514,6 +3414,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3514
3414
|
}
|
|
3515
3415
|
class BaseSDK {
|
|
3516
3416
|
constructor(store) {
|
|
3417
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3517
3418
|
__publicField(this, "store");
|
|
3518
3419
|
this.store = store;
|
|
3519
3420
|
}
|
|
@@ -3549,9 +3450,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3549
3450
|
};
|
|
3550
3451
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3551
3452
|
promise.resolve(result.body);
|
|
3552
|
-
}).catch((
|
|
3553
|
-
discard(
|
|
3554
|
-
|
|
3453
|
+
}).catch((e) => {
|
|
3454
|
+
discard(e, fullOfflineAction);
|
|
3455
|
+
if (e instanceof Error) {
|
|
3456
|
+
promise.reject(e);
|
|
3457
|
+
} else {
|
|
3458
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3459
|
+
}
|
|
3555
3460
|
});
|
|
3556
3461
|
} else {
|
|
3557
3462
|
const innerPromise = this.store.dispatch(
|
|
@@ -3605,10 +3510,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3605
3510
|
}
|
|
3606
3511
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3607
3512
|
function parseTokens(response) {
|
|
3608
|
-
if (!response.access)
|
|
3609
|
-
|
|
3610
|
-
if (!response.refresh)
|
|
3611
|
-
throw new Error("Missing refresh token");
|
|
3513
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3514
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3612
3515
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3613
3516
|
}
|
|
3614
3517
|
class JWTService extends BaseAuthService {
|
|
@@ -3645,8 +3548,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3645
3548
|
this.clearAuth();
|
|
3646
3549
|
return void 0;
|
|
3647
3550
|
}
|
|
3648
|
-
if (!response.access)
|
|
3649
|
-
throw new Error("Missing access token");
|
|
3551
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3650
3552
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3651
3553
|
});
|
|
3652
3554
|
}
|
|
@@ -3702,8 +3604,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3702
3604
|
return `Bearer ${accessToken}`;
|
|
3703
3605
|
}
|
|
3704
3606
|
async prepareAuth() {
|
|
3705
|
-
if (!this.tokenIsExpiringSoon())
|
|
3706
|
-
return;
|
|
3607
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
3707
3608
|
console.debug(this.constructor.name, "preparing auth");
|
|
3708
3609
|
try {
|
|
3709
3610
|
await this.renewTokens();
|
|
@@ -3711,7 +3612,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3711
3612
|
if (e instanceof APIError) {
|
|
3712
3613
|
this.clearAuth();
|
|
3713
3614
|
}
|
|
3714
|
-
|
|
3615
|
+
if (e instanceof Error) {
|
|
3616
|
+
return Promise.reject(e);
|
|
3617
|
+
} else {
|
|
3618
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3619
|
+
}
|
|
3715
3620
|
}
|
|
3716
3621
|
}
|
|
3717
3622
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -3742,7 +3647,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3742
3647
|
async initAuth(payload) {
|
|
3743
3648
|
const uuid$1 = uuid.v4();
|
|
3744
3649
|
console.debug(this.constructor.name, "Initiating auth");
|
|
3745
|
-
|
|
3650
|
+
return this.enqueueRequest({
|
|
3746
3651
|
uuid: uuid$1,
|
|
3747
3652
|
description: "Get token pair",
|
|
3748
3653
|
method: HttpMethod.POST,
|
|
@@ -3750,25 +3655,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3750
3655
|
payload,
|
|
3751
3656
|
isAuthNeeded: false,
|
|
3752
3657
|
checkAuth: false,
|
|
3658
|
+
immediate: true,
|
|
3753
3659
|
blockers: [],
|
|
3754
3660
|
blocks: []
|
|
3755
|
-
}).then(
|
|
3756
|
-
|
|
3757
|
-
let timedOut = false;
|
|
3758
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
3759
|
-
setTimeout(() => {
|
|
3760
|
-
timedOut = true;
|
|
3761
|
-
this.dispatch(markForDeletion(uuid$1));
|
|
3762
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
3763
|
-
}, timeout * 1e3);
|
|
3764
|
-
});
|
|
3765
|
-
const successPromise = promise.then((tokens) => {
|
|
3766
|
-
if (timedOut) {
|
|
3767
|
-
return void 0;
|
|
3768
|
-
}
|
|
3769
|
-
this.setTokens(tokens);
|
|
3661
|
+
}).then((tokens) => {
|
|
3662
|
+
this.setTokens(parseTokens(tokens));
|
|
3770
3663
|
});
|
|
3771
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3772
3664
|
}
|
|
3773
3665
|
}
|
|
3774
3666
|
class BaseApiService extends BaseService {
|
|
@@ -3931,8 +3823,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3931
3823
|
const { store } = this.client;
|
|
3932
3824
|
const state = store.getState();
|
|
3933
3825
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3934
|
-
if (!assetToBeDeleted)
|
|
3935
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
3826
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
3936
3827
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3937
3828
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3938
3829
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3955,12 +3846,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3955
3846
|
url: `/assets/${id}/`,
|
|
3956
3847
|
blockers: [id],
|
|
3957
3848
|
blocks: []
|
|
3958
|
-
}).catch((
|
|
3849
|
+
}).catch((e) => {
|
|
3959
3850
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3960
3851
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3961
3852
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3962
3853
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3963
|
-
throw
|
|
3854
|
+
throw e;
|
|
3964
3855
|
});
|
|
3965
3856
|
}
|
|
3966
3857
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -3984,17 +3875,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3984
3875
|
const { batchId, payload } = assetBatch;
|
|
3985
3876
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3986
3877
|
const blockers = [assetTypeId];
|
|
3987
|
-
if (prevBatchId)
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
blocks2.push(batchId);
|
|
3878
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
3879
|
+
const blocks = batchAssetOfflineIds;
|
|
3880
|
+
blocks.push(batchId);
|
|
3991
3881
|
const promise = this.enqueueRequest({
|
|
3992
3882
|
description: "Batch create assets",
|
|
3993
3883
|
method: HttpMethod.POST,
|
|
3994
3884
|
url: "/assets/bulk/",
|
|
3995
3885
|
payload,
|
|
3996
3886
|
blockers,
|
|
3997
|
-
blocks
|
|
3887
|
+
blocks
|
|
3998
3888
|
});
|
|
3999
3889
|
prevBatchId = assetBatch.batchId;
|
|
4000
3890
|
batchPromises.push(promise);
|
|
@@ -4199,8 +4089,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4199
4089
|
update(payload) {
|
|
4200
4090
|
const { store } = this.client;
|
|
4201
4091
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4202
|
-
if (!assetStage)
|
|
4203
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4092
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4204
4093
|
const updatedAssetStage = {
|
|
4205
4094
|
...assetStage,
|
|
4206
4095
|
...payload
|
|
@@ -4751,7 +4640,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4751
4640
|
created_by: createdBy
|
|
4752
4641
|
});
|
|
4753
4642
|
this.dispatch(addIssue(offlineIssue));
|
|
4754
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4755
4643
|
const promise = this.enqueueRequest({
|
|
4756
4644
|
description: "Create issue",
|
|
4757
4645
|
method: HttpMethod.POST,
|
|
@@ -4768,7 +4656,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4768
4656
|
this.dispatch(updateIssue(result));
|
|
4769
4657
|
}).catch((error) => {
|
|
4770
4658
|
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
4771
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4772
4659
|
throw error;
|
|
4773
4660
|
});
|
|
4774
4661
|
return [offlineIssue, promise];
|
|
@@ -4796,7 +4683,18 @@ var __publicField = (obj, key, value) => {
|
|
|
4796
4683
|
]) {
|
|
4797
4684
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4798
4685
|
switch (issueUpdateChange) {
|
|
4799
|
-
case
|
|
4686
|
+
case IssueUpdateChange.PRIORITY:
|
|
4687
|
+
case IssueUpdateChange.STATUS: {
|
|
4688
|
+
const val = payload[issueUpdateChange];
|
|
4689
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4690
|
+
break;
|
|
4691
|
+
}
|
|
4692
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4693
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4694
|
+
case IssueUpdateChange.TITLE:
|
|
4695
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4696
|
+
break;
|
|
4697
|
+
case IssueUpdateChange.CATEGORY: {
|
|
4800
4698
|
let categoryOrNull = null;
|
|
4801
4699
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4802
4700
|
if (categoryIdOrNull) {
|
|
@@ -4813,7 +4711,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4813
4711
|
} : null;
|
|
4814
4712
|
break;
|
|
4815
4713
|
}
|
|
4816
|
-
case
|
|
4714
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4817
4715
|
let userOrNull = null;
|
|
4818
4716
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4819
4717
|
if (userIdOrNull) {
|
|
@@ -4829,20 +4727,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4829
4727
|
} : null;
|
|
4830
4728
|
break;
|
|
4831
4729
|
}
|
|
4832
|
-
case "description":
|
|
4833
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4834
|
-
break;
|
|
4835
|
-
case "title":
|
|
4836
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4837
|
-
break;
|
|
4838
|
-
case "priority":
|
|
4839
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4840
|
-
break;
|
|
4841
|
-
case "status":
|
|
4842
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
4843
|
-
break;
|
|
4844
|
-
case "due_date":
|
|
4845
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
4846
4730
|
}
|
|
4847
4731
|
}
|
|
4848
4732
|
}
|
|
@@ -4884,7 +4768,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4884
4768
|
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
4885
4769
|
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
4886
4770
|
this.dispatch(deleteIssue(id));
|
|
4887
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4888
4771
|
if (attachmentsOfIssue.length > 0)
|
|
4889
4772
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4890
4773
|
if (updatesOfIssue.length > 0)
|
|
@@ -4905,7 +4788,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4905
4788
|
this.dispatch(addIssue(backup));
|
|
4906
4789
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
4907
4790
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
4908
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4909
4791
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
4910
4792
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4911
4793
|
throw e;
|
|
@@ -5047,98 +4929,89 @@ var __publicField = (obj, key, value) => {
|
|
|
5047
4929
|
this.dispatch(initializeProjectAccesses(result));
|
|
5048
4930
|
}
|
|
5049
4931
|
}
|
|
5050
|
-
class ProjectFileService extends
|
|
5051
|
-
async
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
const
|
|
5058
|
-
|
|
5059
|
-
file_type: file.type,
|
|
5060
|
-
extension: file.name.split(".").pop(),
|
|
5061
|
-
size: file.size
|
|
5062
|
-
};
|
|
5063
|
-
const offlineProjectFile = offline({
|
|
5064
|
-
...payloadWithoutFile,
|
|
5065
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5066
|
-
created_by: createdBy,
|
|
5067
|
-
file_name: file.name,
|
|
5068
|
-
file_sha1: sha1,
|
|
5069
|
-
file: URL.createObjectURL(file)
|
|
5070
|
-
});
|
|
5071
|
-
this.dispatch(addProjectFile(offlineProjectFile));
|
|
4932
|
+
class ProjectFileService extends BaseApiService {
|
|
4933
|
+
async saveExisting(file) {
|
|
4934
|
+
if (!file.offline_id) {
|
|
4935
|
+
throw new Error(
|
|
4936
|
+
"You can only use this method to save existing project files. The one provided has no offline_id."
|
|
4937
|
+
);
|
|
4938
|
+
}
|
|
4939
|
+
const editableData = { ...file };
|
|
4940
|
+
delete editableData.file;
|
|
5072
4941
|
const promise = this.enqueueRequest({
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
submitted_at: offlineProjectFile.submitted_at,
|
|
5079
|
-
z_index: offlineProjectFile.z_index,
|
|
5080
|
-
canvas_bounds: offlineProjectFile.canvas_bounds,
|
|
5081
|
-
bounds: offlineProjectFile.bounds,
|
|
5082
|
-
file_name: offlineProjectFile.file_name,
|
|
5083
|
-
file_sha1: offlineProjectFile.file_sha1,
|
|
5084
|
-
file: offlineProjectFile.file,
|
|
5085
|
-
file_payload: filePayload
|
|
5086
|
-
},
|
|
5087
|
-
blockers: [],
|
|
5088
|
-
blocks: [offlineProjectFile.offline_id]
|
|
4942
|
+
method: HttpMethod.PATCH,
|
|
4943
|
+
url: `/projects/files/${file.offline_id}/`,
|
|
4944
|
+
payload: editableData,
|
|
4945
|
+
blockers: [file.offline_id],
|
|
4946
|
+
blocks: [file.offline_id]
|
|
5089
4947
|
});
|
|
5090
|
-
promise.then((result) => {
|
|
5091
|
-
this.
|
|
5092
|
-
this.dispatch(updateProjectFile(result.project_file));
|
|
5093
|
-
}).catch(() => {
|
|
5094
|
-
this.dispatch(deleteProjectFile(offlineProjectFile.offline_id));
|
|
4948
|
+
void promise.then((result) => {
|
|
4949
|
+
this.dispatch(addOrReplaceProjectFile(result));
|
|
5095
4950
|
});
|
|
5096
|
-
return
|
|
4951
|
+
return promise;
|
|
5097
4952
|
}
|
|
5098
|
-
update
|
|
4953
|
+
// TODO: This needs to be seperated into a update and create method
|
|
4954
|
+
saveActive() {
|
|
5099
4955
|
const { store } = this.client;
|
|
5100
|
-
const
|
|
5101
|
-
|
|
5102
|
-
|
|
4956
|
+
const state = store.getState();
|
|
4957
|
+
const activeProjectFileId = state.projectFileReducer.activeProjectFileId;
|
|
4958
|
+
if (!activeProjectFileId) {
|
|
4959
|
+
throw new Error("No active project file");
|
|
4960
|
+
}
|
|
4961
|
+
const activeProjectFile = state.projectFileReducer.projectFiles[activeProjectFileId];
|
|
4962
|
+
if (!activeProjectFile) {
|
|
4963
|
+
throw new Error("No active project file");
|
|
4964
|
+
}
|
|
4965
|
+
if (!activeProjectFile.bounds && !activeProjectFile.canvas_bounds) {
|
|
4966
|
+
throw new Error("Project file must either have bounds or canvas_bounds set");
|
|
4967
|
+
}
|
|
4968
|
+
let requestDetails;
|
|
4969
|
+
const existing = typeof activeProjectFile.file === "string" && !activeProjectFile.file.startsWith("blob:");
|
|
4970
|
+
if (existing) {
|
|
4971
|
+
const editableData = { ...activeProjectFile };
|
|
4972
|
+
delete editableData.file;
|
|
4973
|
+
requestDetails = {
|
|
4974
|
+
method: HttpMethod.PATCH,
|
|
4975
|
+
url: `/projects/files/${activeProjectFileId}/`,
|
|
4976
|
+
payload: editableData,
|
|
4977
|
+
blockers: [activeProjectFileId],
|
|
4978
|
+
blocks: [activeProjectFileId]
|
|
4979
|
+
};
|
|
4980
|
+
} else {
|
|
4981
|
+
requestDetails = new Promise((resolve, reject) => {
|
|
4982
|
+
this.client.files.uploadFileToS3(activeProjectFile.file_sha1).then(([fileProps]) => {
|
|
4983
|
+
resolve({
|
|
4984
|
+
method: HttpMethod.POST,
|
|
4985
|
+
url: `/projects/${activeProjectFile.project}/files/`,
|
|
4986
|
+
payload: {
|
|
4987
|
+
...activeProjectFile,
|
|
4988
|
+
...fileProps
|
|
4989
|
+
},
|
|
4990
|
+
blockers: [activeProjectFileId],
|
|
4991
|
+
blocks: [activeProjectFileId]
|
|
4992
|
+
});
|
|
4993
|
+
}).catch(reject);
|
|
4994
|
+
});
|
|
5103
4995
|
}
|
|
5104
|
-
const
|
|
5105
|
-
|
|
5106
|
-
...payload
|
|
5107
|
-
};
|
|
5108
|
-
this.dispatch(updateProjectFile(updatedProjectFile));
|
|
5109
|
-
const promise = this.enqueueRequest({
|
|
5110
|
-
description: "Update project file",
|
|
5111
|
-
method: HttpMethod.PATCH,
|
|
5112
|
-
url: `/projects/files/${payload.offline_id}/`,
|
|
5113
|
-
payload,
|
|
5114
|
-
blockers: [payload.offline_id],
|
|
5115
|
-
blocks: [payload.offline_id]
|
|
4996
|
+
const promise = Promise.resolve(requestDetails).then((requestDetails2) => {
|
|
4997
|
+
return this.enqueueRequest(requestDetails2);
|
|
5116
4998
|
});
|
|
5117
|
-
promise.then((result) => {
|
|
5118
|
-
this.dispatch(
|
|
5119
|
-
}).catch(() => {
|
|
5120
|
-
this.dispatch(updateProjectFile(projectFile));
|
|
4999
|
+
void promise.then((result) => {
|
|
5000
|
+
this.dispatch(addOrReplaceProjectFile(result));
|
|
5121
5001
|
});
|
|
5122
|
-
|
|
5002
|
+
this.dispatch(saveActiveProjectFileBounds);
|
|
5003
|
+
this.dispatch(setActiveProjectFileId(null));
|
|
5004
|
+
this.dispatch(setIsImportingProjectFile(false));
|
|
5005
|
+
return [activeProjectFile, promise];
|
|
5123
5006
|
}
|
|
5124
|
-
delete(
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
if (!projectFileToDelete) {
|
|
5128
|
-
throw new Error(`Project file with id ${id} not found`);
|
|
5129
|
-
}
|
|
5130
|
-
this.dispatch(deleteProjectFile(id));
|
|
5131
|
-
const promise = this.enqueueRequest({
|
|
5132
|
-
description: "Delete project file",
|
|
5007
|
+
delete(projectFileId) {
|
|
5008
|
+
this.dispatch(removeProjectFile(projectFileId));
|
|
5009
|
+
return this.enqueueRequest({
|
|
5133
5010
|
method: HttpMethod.DELETE,
|
|
5134
|
-
url: `/projects/files/${
|
|
5135
|
-
blockers: [
|
|
5011
|
+
url: `/projects/files/${projectFileId}`,
|
|
5012
|
+
blockers: [projectFileId],
|
|
5136
5013
|
blocks: []
|
|
5137
5014
|
});
|
|
5138
|
-
promise.catch(() => {
|
|
5139
|
-
this.dispatch(updateProjectFile(projectFileToDelete));
|
|
5140
|
-
});
|
|
5141
|
-
return promise;
|
|
5142
5015
|
}
|
|
5143
5016
|
async refreshStore(projectId) {
|
|
5144
5017
|
const result = await this.enqueueRequest({
|
|
@@ -5148,7 +5021,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5148
5021
|
blockers: [],
|
|
5149
5022
|
blocks: []
|
|
5150
5023
|
});
|
|
5151
|
-
this.dispatch(
|
|
5024
|
+
this.dispatch(addOrReplaceProjectFiles([]));
|
|
5025
|
+
this.dispatch(addOrReplaceProjectFiles(result));
|
|
5152
5026
|
}
|
|
5153
5027
|
}
|
|
5154
5028
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
@@ -5204,7 +5078,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5204
5078
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5205
5079
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5206
5080
|
}
|
|
5207
|
-
this.dispatch(
|
|
5081
|
+
this.dispatch(updateProject(project));
|
|
5208
5082
|
return await this.enqueueRequest({
|
|
5209
5083
|
description: "Update project",
|
|
5210
5084
|
method: HttpMethod.PATCH,
|
|
@@ -5225,8 +5099,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5225
5099
|
if (!project) {
|
|
5226
5100
|
throw new Error("Expected project to exist");
|
|
5227
5101
|
}
|
|
5228
|
-
const
|
|
5229
|
-
this.dispatch(
|
|
5102
|
+
const filesToDelete = selectProjectFiles(state).filter((file) => file.project === projectId);
|
|
5103
|
+
this.dispatch(removeProjectFilesOfProject(project.id));
|
|
5230
5104
|
const attachmentsOfProject = selectAttachmentsOfProject(project.id)(state);
|
|
5231
5105
|
this.dispatch(deleteProjectAttachments(attachmentsOfProject.map(({ offline_id }) => offline_id)));
|
|
5232
5106
|
const projectAccesses = selectProjectAccesses(state);
|
|
@@ -5249,7 +5123,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5249
5123
|
} catch (e) {
|
|
5250
5124
|
this.dispatch(setProjects(Object.values(projects)));
|
|
5251
5125
|
this.dispatch(initializeProjectAccesses(Object.values(projectAccesses)));
|
|
5252
|
-
this.dispatch(
|
|
5126
|
+
this.dispatch(addOrReplaceProjectFiles(filesToDelete));
|
|
5253
5127
|
this.dispatch(setProjectAttachments(attachmentsOfProject));
|
|
5254
5128
|
this.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5255
5129
|
if (license) {
|
|
@@ -5564,12 +5438,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5564
5438
|
blockers: [projectId.toString()],
|
|
5565
5439
|
blocks: []
|
|
5566
5440
|
});
|
|
5567
|
-
for (const form of projectFormsResult.forms)
|
|
5568
|
-
|
|
5569
|
-
for (const
|
|
5570
|
-
revisions.push(revision);
|
|
5571
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5572
|
-
attachments.push(attachment);
|
|
5441
|
+
for (const form of projectFormsResult.forms) forms.push(form);
|
|
5442
|
+
for (const revision of projectFormsResult.revisions) revisions.push(revision);
|
|
5443
|
+
for (const attachment of projectFormsResult.attachments) attachments.push(attachment);
|
|
5573
5444
|
const organizationFormsResult = await this.enqueueRequest({
|
|
5574
5445
|
description: "Fetch organization forms",
|
|
5575
5446
|
method: HttpMethod.GET,
|
|
@@ -5577,12 +5448,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5577
5448
|
blockers: [projectId.toString()],
|
|
5578
5449
|
blocks: []
|
|
5579
5450
|
});
|
|
5580
|
-
for (const form of organizationFormsResult.forms)
|
|
5581
|
-
|
|
5582
|
-
for (const
|
|
5583
|
-
revisions.push(revision);
|
|
5584
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5585
|
-
attachments.push(attachment);
|
|
5451
|
+
for (const form of organizationFormsResult.forms) forms.push(form);
|
|
5452
|
+
for (const revision of organizationFormsResult.revisions) revisions.push(revision);
|
|
5453
|
+
for (const attachment of organizationFormsResult.attachments) attachments.push(attachment);
|
|
5586
5454
|
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5587
5455
|
description: "Fetch asset type forms",
|
|
5588
5456
|
method: HttpMethod.GET,
|
|
@@ -5590,12 +5458,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5590
5458
|
blockers: [projectId.toString()],
|
|
5591
5459
|
blocks: []
|
|
5592
5460
|
});
|
|
5593
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5594
|
-
|
|
5595
|
-
for (const
|
|
5596
|
-
revisions.push(revision);
|
|
5597
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5598
|
-
attachments.push(attachment);
|
|
5461
|
+
for (const form of assetTypeFormsResult.forms) forms.push(form);
|
|
5462
|
+
for (const revision of assetTypeFormsResult.revisions) revisions.push(revision);
|
|
5463
|
+
for (const attachment of assetTypeFormsResult.attachments) attachments.push(attachment);
|
|
5599
5464
|
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5600
5465
|
description: "Fetch issue type forms",
|
|
5601
5466
|
method: HttpMethod.GET,
|
|
@@ -5603,12 +5468,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5603
5468
|
blockers: [projectId.toString()],
|
|
5604
5469
|
blocks: []
|
|
5605
5470
|
});
|
|
5606
|
-
for (const form of issueTypeFormsResult.forms)
|
|
5607
|
-
|
|
5608
|
-
for (const
|
|
5609
|
-
revisions.push(revision);
|
|
5610
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5611
|
-
attachments.push(attachment);
|
|
5471
|
+
for (const form of issueTypeFormsResult.forms) forms.push(form);
|
|
5472
|
+
for (const revision of issueTypeFormsResult.revisions) revisions.push(revision);
|
|
5473
|
+
for (const attachment of issueTypeFormsResult.attachments) attachments.push(attachment);
|
|
5612
5474
|
this.dispatch(initializeForms(forms));
|
|
5613
5475
|
this.dispatch(initializeFormRevisions(revisions));
|
|
5614
5476
|
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
@@ -5744,12 +5606,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5744
5606
|
files
|
|
5745
5607
|
);
|
|
5746
5608
|
promise.then((result) => {
|
|
5747
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5748
5609
|
this.dispatch(setFormSubmission(result));
|
|
5749
5610
|
return result;
|
|
5750
5611
|
}).catch(() => {
|
|
5751
5612
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5752
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5753
5613
|
});
|
|
5754
5614
|
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5755
5615
|
}
|
|
@@ -5821,16 +5681,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5821
5681
|
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5822
5682
|
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5823
5683
|
const blockers = batchAssetIds;
|
|
5824
|
-
if (prevBatchId)
|
|
5825
|
-
|
|
5826
|
-
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5684
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
5685
|
+
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5827
5686
|
const promise = this.enqueueRequest({
|
|
5828
5687
|
description: "Bulk add form submissions",
|
|
5829
5688
|
method: HttpMethod.POST,
|
|
5830
5689
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5831
5690
|
payload,
|
|
5832
5691
|
blockers,
|
|
5833
|
-
blocks
|
|
5692
|
+
blocks
|
|
5834
5693
|
});
|
|
5835
5694
|
void promise.then(({ presigned_urls }) => {
|
|
5836
5695
|
this.processPresignedUrls(presigned_urls);
|
|
@@ -5842,10 +5701,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5842
5701
|
const createdSubmissions = [];
|
|
5843
5702
|
const createdAttachments = [];
|
|
5844
5703
|
for (const result of results) {
|
|
5845
|
-
for (const createdSubmission of result.submissions)
|
|
5846
|
-
|
|
5847
|
-
for (const createdAttachment of result.attachments)
|
|
5848
|
-
createdAttachments.push(createdAttachment);
|
|
5704
|
+
for (const createdSubmission of result.submissions) createdSubmissions.push(createdSubmission);
|
|
5705
|
+
for (const createdAttachment of result.attachments) createdAttachments.push(createdAttachment);
|
|
5849
5706
|
}
|
|
5850
5707
|
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5851
5708
|
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
@@ -5916,7 +5773,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5916
5773
|
}
|
|
5917
5774
|
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5918
5775
|
this.dispatch(deleteFormSubmission(id));
|
|
5919
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5920
5776
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5921
5777
|
try {
|
|
5922
5778
|
return await this.enqueueRequest({
|
|
@@ -5927,7 +5783,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5927
5783
|
blocks: []
|
|
5928
5784
|
});
|
|
5929
5785
|
} catch (e) {
|
|
5930
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5931
5786
|
this.dispatch(addFormSubmission(submissionToBeDeleted));
|
|
5932
5787
|
this.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
5933
5788
|
throw e;
|
|
@@ -6043,9 +5898,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6043
5898
|
blockers: [id],
|
|
6044
5899
|
blocks: []
|
|
6045
5900
|
});
|
|
6046
|
-
void promise.catch((
|
|
5901
|
+
void promise.catch((e) => {
|
|
6047
5902
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
6048
|
-
throw
|
|
5903
|
+
throw e;
|
|
6049
5904
|
});
|
|
6050
5905
|
return promise;
|
|
6051
5906
|
}
|
|
@@ -6106,7 +5961,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6106
5961
|
class FileService extends BaseApiService {
|
|
6107
5962
|
constructor() {
|
|
6108
5963
|
super(...arguments);
|
|
6109
|
-
__publicField(this, "host"
|
|
5964
|
+
__publicField(this, "host");
|
|
6110
5965
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6111
5966
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6112
5967
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6117,8 +5972,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6117
5972
|
}
|
|
6118
5973
|
async renewUploadUrl(sha1) {
|
|
6119
5974
|
const file = await this.fetchCache(sha1);
|
|
6120
|
-
if (!file)
|
|
6121
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5975
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6122
5976
|
const key = await getFileS3Key(file, sha1);
|
|
6123
5977
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6124
5978
|
description: "Get S3 URL",
|
|
@@ -6188,8 +6042,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6188
6042
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6189
6043
|
async uploadFileToS3(sha1) {
|
|
6190
6044
|
const file = await this.fetchCache(sha1);
|
|
6191
|
-
if (!file)
|
|
6192
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6045
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6193
6046
|
const key = await getFileS3Key(file, sha1);
|
|
6194
6047
|
const dbFileProperties = {
|
|
6195
6048
|
file_name: file.name,
|
|
@@ -6283,7 +6136,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6283
6136
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6284
6137
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6285
6138
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6286
|
-
|
|
6139
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6287
6140
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6288
6141
|
throw new Error(message);
|
|
6289
6142
|
}
|
|
@@ -6804,15 +6657,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6804
6657
|
}
|
|
6805
6658
|
}
|
|
6806
6659
|
class AgentService extends BaseApiService {
|
|
6807
|
-
async startConversation(prompt) {
|
|
6808
|
-
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6660
|
+
async startConversation(prompt, projectId) {
|
|
6809
6661
|
return this.enqueueRequest({
|
|
6810
6662
|
description: "Start agent conversation",
|
|
6811
6663
|
method: HttpMethod.POST,
|
|
6812
6664
|
url: "/agents/prompt/",
|
|
6813
6665
|
payload: {
|
|
6814
6666
|
prompt,
|
|
6815
|
-
active_project:
|
|
6667
|
+
active_project: projectId
|
|
6816
6668
|
},
|
|
6817
6669
|
blockers: ["prompt"],
|
|
6818
6670
|
blocks: ["prompt"]
|
|
@@ -6821,21 +6673,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6821
6673
|
return response;
|
|
6822
6674
|
});
|
|
6823
6675
|
}
|
|
6824
|
-
|
|
6825
|
-
* Prompt the agent with a message.
|
|
6826
|
-
* @param prompt The message to prompt the agent with.
|
|
6827
|
-
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
6828
|
-
*/
|
|
6829
|
-
async continueConversation(prompt, conversationId) {
|
|
6830
|
-
const { store } = this.client;
|
|
6831
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
6676
|
+
async continueConversation(prompt, conversationId, projectId) {
|
|
6832
6677
|
return this.enqueueRequest({
|
|
6833
6678
|
description: "Prompt agent",
|
|
6834
6679
|
method: HttpMethod.POST,
|
|
6835
6680
|
url: "/agents/prompt/",
|
|
6836
6681
|
payload: {
|
|
6837
6682
|
prompt,
|
|
6838
|
-
active_project:
|
|
6683
|
+
active_project: projectId
|
|
6839
6684
|
},
|
|
6840
6685
|
blockers: ["prompt"],
|
|
6841
6686
|
blocks: ["prompt"],
|
|
@@ -7329,6 +7174,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7329
7174
|
exports2.ProjectFileService = ProjectFileService;
|
|
7330
7175
|
exports2.ProjectService = ProjectService;
|
|
7331
7176
|
exports2.TeamService = TeamService;
|
|
7177
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
7332
7178
|
exports2.UserService = UserService;
|
|
7333
7179
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
7334
7180
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
@@ -7337,8 +7183,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7337
7183
|
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
7338
7184
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
7339
7185
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
7340
|
-
exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
|
|
7341
|
-
exports2.addActiveProjectIssuesCount = addActiveProjectIssuesCount;
|
|
7342
7186
|
exports2.addAsset = addAsset;
|
|
7343
7187
|
exports2.addAssetAttachment = addAssetAttachment;
|
|
7344
7188
|
exports2.addAssetAttachments = addAssetAttachments;
|
|
@@ -7381,11 +7225,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7381
7225
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
7382
7226
|
exports2.addIssues = addIssues;
|
|
7383
7227
|
exports2.addLicenses = addLicenses;
|
|
7384
|
-
exports2.
|
|
7228
|
+
exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
|
|
7229
|
+
exports2.addOrReplaceProjectFiles = addOrReplaceProjectFiles;
|
|
7385
7230
|
exports2.addProjectAttachment = addProjectAttachment;
|
|
7386
7231
|
exports2.addProjectAttachments = addProjectAttachments;
|
|
7387
|
-
exports2.addProjectFile = addProjectFile;
|
|
7388
|
-
exports2.addProjectFiles = addProjectFiles;
|
|
7389
7232
|
exports2.addTeam = addTeam;
|
|
7390
7233
|
exports2.addUsers = addUsers;
|
|
7391
7234
|
exports2.addWorkspace = addWorkspace;
|
|
@@ -7463,8 +7306,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7463
7306
|
exports2.deleteProjectAccesses = deleteProjectAccesses;
|
|
7464
7307
|
exports2.deleteProjectAttachment = deleteProjectAttachment;
|
|
7465
7308
|
exports2.deleteProjectAttachments = deleteProjectAttachments;
|
|
7466
|
-
exports2.deleteProjectFile = deleteProjectFile;
|
|
7467
|
-
exports2.deleteProjectFiles = deleteProjectFiles;
|
|
7468
7309
|
exports2.deleteTeam = deleteTeam;
|
|
7469
7310
|
exports2.deleteWorkspace = deleteWorkspace;
|
|
7470
7311
|
exports2.dequeue = dequeue;
|
|
@@ -7533,7 +7374,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7533
7374
|
exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
|
|
7534
7375
|
exports2.initializeProjectAccesses = initializeProjectAccesses;
|
|
7535
7376
|
exports2.initializeProjectAttachments = initializeProjectAttachments;
|
|
7536
|
-
exports2.initializeProjectFiles = initializeProjectFiles;
|
|
7537
7377
|
exports2.initializeTeams = initializeTeams;
|
|
7538
7378
|
exports2.initializeWorkspaces = initializeWorkspaces;
|
|
7539
7379
|
exports2.isToday = isToday;
|
|
@@ -7586,14 +7426,16 @@ var __publicField = (obj, key, value) => {
|
|
|
7586
7426
|
exports2.rehydratedSlice = rehydratedSlice;
|
|
7587
7427
|
exports2.removeDocuments = removeDocuments;
|
|
7588
7428
|
exports2.removeIssueType = removeIssueType;
|
|
7429
|
+
exports2.removeProjectFile = removeProjectFile;
|
|
7430
|
+
exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
|
|
7589
7431
|
exports2.removeUser = removeUser;
|
|
7432
|
+
exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
|
|
7590
7433
|
exports2.resetStore = resetStore;
|
|
7591
7434
|
exports2.restructureCreateSelectorWithArgs = restructureCreateSelectorWithArgs;
|
|
7435
|
+
exports2.saveActiveProjectFileBounds = saveActiveProjectFileBounds;
|
|
7592
7436
|
exports2.selectAccessToken = selectAccessToken;
|
|
7593
7437
|
exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
|
|
7594
|
-
exports2.
|
|
7595
|
-
exports2.selectActiveProjectAccess = selectActiveProjectAccess;
|
|
7596
|
-
exports2.selectActiveProjectId = selectActiveProjectId;
|
|
7438
|
+
exports2.selectActiveProjectFileId = selectActiveProjectFileId;
|
|
7597
7439
|
exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
|
|
7598
7440
|
exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
|
|
7599
7441
|
exports2.selectAllProjectAttachments = selectAllProjectAttachments;
|
|
@@ -7684,6 +7526,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7684
7526
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
7685
7527
|
exports2.selectGeoImages = selectGeoImages;
|
|
7686
7528
|
exports2.selectGeoImagesOfProject = selectGeoImagesOfProject;
|
|
7529
|
+
exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
|
|
7687
7530
|
exports2.selectIsLoggedIn = selectIsLoggedIn;
|
|
7688
7531
|
exports2.selectIssueAssociationById = selectIssueAssociationById;
|
|
7689
7532
|
exports2.selectIssueAssociationMapping = selectIssueAssociationMapping;
|
|
@@ -7766,7 +7609,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7766
7609
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
7767
7610
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
7768
7611
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
7769
|
-
exports2.
|
|
7612
|
+
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
7770
7613
|
exports2.setAsset = setAsset;
|
|
7771
7614
|
exports2.setAssetAttachment = setAssetAttachment;
|
|
7772
7615
|
exports2.setAssetAttachments = setAssetAttachments;
|
|
@@ -7792,6 +7635,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7792
7635
|
exports2.setFormSubmissions = setFormSubmissions;
|
|
7793
7636
|
exports2.setGeoImage = setGeoImage;
|
|
7794
7637
|
exports2.setGeoImages = setGeoImages;
|
|
7638
|
+
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
7795
7639
|
exports2.setIssueAssociation = setIssueAssociation;
|
|
7796
7640
|
exports2.setIssueAssociations = setIssueAssociations;
|
|
7797
7641
|
exports2.setIssueAttachment = setIssueAttachment;
|
|
@@ -7805,8 +7649,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7805
7649
|
exports2.setProfilePicture = setProfilePicture;
|
|
7806
7650
|
exports2.setProjectAttachment = setProjectAttachment;
|
|
7807
7651
|
exports2.setProjectAttachments = setProjectAttachments;
|
|
7808
|
-
exports2.setProjectFile = setProjectFile;
|
|
7809
|
-
exports2.setProjectFiles = setProjectFiles;
|
|
7810
7652
|
exports2.setProjects = setProjects;
|
|
7811
7653
|
exports2.setRehydrated = setRehydrated;
|
|
7812
7654
|
exports2.setTeam = setTeam;
|
|
@@ -7856,13 +7698,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7856
7698
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
7857
7699
|
exports2.updateIssueType = updateIssueType;
|
|
7858
7700
|
exports2.updateLicense = updateLicense;
|
|
7859
|
-
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
7860
7701
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
7702
|
+
exports2.updateProject = updateProject;
|
|
7861
7703
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
7862
7704
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
7863
7705
|
exports2.updateProjectAttachments = updateProjectAttachments;
|
|
7864
|
-
exports2.updateProjectFile = updateProjectFile;
|
|
7865
|
-
exports2.updateProjectFiles = updateProjectFiles;
|
|
7866
7706
|
exports2.updateTeam = updateTeam;
|
|
7867
7707
|
exports2.updateWorkspace = updateWorkspace;
|
|
7868
7708
|
exports2.userReducer = userReducer;
|