@overmap-ai/core 1.0.71-project-file-improvements.3 → 1.0.71-remove-login-timeout.0
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 +290 -452
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +299 -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,
|
|
@@ -3752,23 +3657,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3752
3657
|
checkAuth: false,
|
|
3753
3658
|
blockers: [],
|
|
3754
3659
|
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);
|
|
3660
|
+
}).then((tokens) => {
|
|
3661
|
+
this.setTokens(parseTokens(tokens));
|
|
3770
3662
|
});
|
|
3771
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
3772
3663
|
}
|
|
3773
3664
|
}
|
|
3774
3665
|
class BaseApiService extends BaseService {
|
|
@@ -3931,8 +3822,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3931
3822
|
const { store } = this.client;
|
|
3932
3823
|
const state = store.getState();
|
|
3933
3824
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
3934
|
-
if (!assetToBeDeleted)
|
|
3935
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
3825
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
3936
3826
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
3937
3827
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
3938
3828
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -3955,12 +3845,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3955
3845
|
url: `/assets/${id}/`,
|
|
3956
3846
|
blockers: [id],
|
|
3957
3847
|
blocks: []
|
|
3958
|
-
}).catch((
|
|
3848
|
+
}).catch((e) => {
|
|
3959
3849
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
3960
3850
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
3961
3851
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
3962
3852
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
3963
|
-
throw
|
|
3853
|
+
throw e;
|
|
3964
3854
|
});
|
|
3965
3855
|
}
|
|
3966
3856
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -3984,17 +3874,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3984
3874
|
const { batchId, payload } = assetBatch;
|
|
3985
3875
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
3986
3876
|
const blockers = [assetTypeId];
|
|
3987
|
-
if (prevBatchId)
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
blocks2.push(batchId);
|
|
3877
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
3878
|
+
const blocks = batchAssetOfflineIds;
|
|
3879
|
+
blocks.push(batchId);
|
|
3991
3880
|
const promise = this.enqueueRequest({
|
|
3992
3881
|
description: "Batch create assets",
|
|
3993
3882
|
method: HttpMethod.POST,
|
|
3994
3883
|
url: "/assets/bulk/",
|
|
3995
3884
|
payload,
|
|
3996
3885
|
blockers,
|
|
3997
|
-
blocks
|
|
3886
|
+
blocks
|
|
3998
3887
|
});
|
|
3999
3888
|
prevBatchId = assetBatch.batchId;
|
|
4000
3889
|
batchPromises.push(promise);
|
|
@@ -4199,8 +4088,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4199
4088
|
update(payload) {
|
|
4200
4089
|
const { store } = this.client;
|
|
4201
4090
|
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`);
|
|
4091
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4204
4092
|
const updatedAssetStage = {
|
|
4205
4093
|
...assetStage,
|
|
4206
4094
|
...payload
|
|
@@ -4751,7 +4639,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4751
4639
|
created_by: createdBy
|
|
4752
4640
|
});
|
|
4753
4641
|
this.dispatch(addIssue(offlineIssue));
|
|
4754
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4755
4642
|
const promise = this.enqueueRequest({
|
|
4756
4643
|
description: "Create issue",
|
|
4757
4644
|
method: HttpMethod.POST,
|
|
@@ -4768,7 +4655,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4768
4655
|
this.dispatch(updateIssue(result));
|
|
4769
4656
|
}).catch((error) => {
|
|
4770
4657
|
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
4771
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4772
4658
|
throw error;
|
|
4773
4659
|
});
|
|
4774
4660
|
return [offlineIssue, promise];
|
|
@@ -4796,7 +4682,18 @@ var __publicField = (obj, key, value) => {
|
|
|
4796
4682
|
]) {
|
|
4797
4683
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4798
4684
|
switch (issueUpdateChange) {
|
|
4799
|
-
case
|
|
4685
|
+
case IssueUpdateChange.PRIORITY:
|
|
4686
|
+
case IssueUpdateChange.STATUS: {
|
|
4687
|
+
const val = payload[issueUpdateChange];
|
|
4688
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4689
|
+
break;
|
|
4690
|
+
}
|
|
4691
|
+
case IssueUpdateChange.DUE_DATE:
|
|
4692
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
4693
|
+
case IssueUpdateChange.TITLE:
|
|
4694
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4695
|
+
break;
|
|
4696
|
+
case IssueUpdateChange.CATEGORY: {
|
|
4800
4697
|
let categoryOrNull = null;
|
|
4801
4698
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4802
4699
|
if (categoryIdOrNull) {
|
|
@@ -4813,7 +4710,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4813
4710
|
} : null;
|
|
4814
4711
|
break;
|
|
4815
4712
|
}
|
|
4816
|
-
case
|
|
4713
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
4817
4714
|
let userOrNull = null;
|
|
4818
4715
|
const userIdOrNull = payload[issueUpdateChange];
|
|
4819
4716
|
if (userIdOrNull) {
|
|
@@ -4829,20 +4726,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4829
4726
|
} : null;
|
|
4830
4727
|
break;
|
|
4831
4728
|
}
|
|
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
4729
|
}
|
|
4847
4730
|
}
|
|
4848
4731
|
}
|
|
@@ -4884,7 +4767,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4884
4767
|
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
4885
4768
|
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
4886
4769
|
this.dispatch(deleteIssue(id));
|
|
4887
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4888
4770
|
if (attachmentsOfIssue.length > 0)
|
|
4889
4771
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4890
4772
|
if (updatesOfIssue.length > 0)
|
|
@@ -4905,7 +4787,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4905
4787
|
this.dispatch(addIssue(backup));
|
|
4906
4788
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
4907
4789
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
4908
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4909
4790
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
4910
4791
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4911
4792
|
throw e;
|
|
@@ -5047,98 +4928,89 @@ var __publicField = (obj, key, value) => {
|
|
|
5047
4928
|
this.dispatch(initializeProjectAccesses(result));
|
|
5048
4929
|
}
|
|
5049
4930
|
}
|
|
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));
|
|
4931
|
+
class ProjectFileService extends BaseApiService {
|
|
4932
|
+
async saveExisting(file) {
|
|
4933
|
+
if (!file.offline_id) {
|
|
4934
|
+
throw new Error(
|
|
4935
|
+
"You can only use this method to save existing project files. The one provided has no offline_id."
|
|
4936
|
+
);
|
|
4937
|
+
}
|
|
4938
|
+
const editableData = { ...file };
|
|
4939
|
+
delete editableData.file;
|
|
5072
4940
|
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]
|
|
4941
|
+
method: HttpMethod.PATCH,
|
|
4942
|
+
url: `/projects/files/${file.offline_id}/`,
|
|
4943
|
+
payload: editableData,
|
|
4944
|
+
blockers: [file.offline_id],
|
|
4945
|
+
blocks: [file.offline_id]
|
|
5089
4946
|
});
|
|
5090
|
-
promise.then((result) => {
|
|
5091
|
-
this.
|
|
5092
|
-
this.dispatch(updateProjectFile(result.project_file));
|
|
5093
|
-
}).catch(() => {
|
|
5094
|
-
this.dispatch(deleteProjectFile(offlineProjectFile.offline_id));
|
|
4947
|
+
void promise.then((result) => {
|
|
4948
|
+
this.dispatch(addOrReplaceProjectFile(result));
|
|
5095
4949
|
});
|
|
5096
|
-
return
|
|
4950
|
+
return promise;
|
|
5097
4951
|
}
|
|
5098
|
-
update
|
|
4952
|
+
// TODO: This needs to be seperated into a update and create method
|
|
4953
|
+
saveActive() {
|
|
5099
4954
|
const { store } = this.client;
|
|
5100
|
-
const
|
|
5101
|
-
|
|
5102
|
-
|
|
4955
|
+
const state = store.getState();
|
|
4956
|
+
const activeProjectFileId = state.projectFileReducer.activeProjectFileId;
|
|
4957
|
+
if (!activeProjectFileId) {
|
|
4958
|
+
throw new Error("No active project file");
|
|
4959
|
+
}
|
|
4960
|
+
const activeProjectFile = state.projectFileReducer.projectFiles[activeProjectFileId];
|
|
4961
|
+
if (!activeProjectFile) {
|
|
4962
|
+
throw new Error("No active project file");
|
|
4963
|
+
}
|
|
4964
|
+
if (!activeProjectFile.bounds && !activeProjectFile.canvas_bounds) {
|
|
4965
|
+
throw new Error("Project file must either have bounds or canvas_bounds set");
|
|
4966
|
+
}
|
|
4967
|
+
let requestDetails;
|
|
4968
|
+
const existing = typeof activeProjectFile.file === "string" && !activeProjectFile.file.startsWith("blob:");
|
|
4969
|
+
if (existing) {
|
|
4970
|
+
const editableData = { ...activeProjectFile };
|
|
4971
|
+
delete editableData.file;
|
|
4972
|
+
requestDetails = {
|
|
4973
|
+
method: HttpMethod.PATCH,
|
|
4974
|
+
url: `/projects/files/${activeProjectFileId}/`,
|
|
4975
|
+
payload: editableData,
|
|
4976
|
+
blockers: [activeProjectFileId],
|
|
4977
|
+
blocks: [activeProjectFileId]
|
|
4978
|
+
};
|
|
4979
|
+
} else {
|
|
4980
|
+
requestDetails = new Promise((resolve, reject) => {
|
|
4981
|
+
this.client.files.uploadFileToS3(activeProjectFile.file_sha1).then(([fileProps]) => {
|
|
4982
|
+
resolve({
|
|
4983
|
+
method: HttpMethod.POST,
|
|
4984
|
+
url: `/projects/${activeProjectFile.project}/files/`,
|
|
4985
|
+
payload: {
|
|
4986
|
+
...activeProjectFile,
|
|
4987
|
+
...fileProps
|
|
4988
|
+
},
|
|
4989
|
+
blockers: [activeProjectFileId],
|
|
4990
|
+
blocks: [activeProjectFileId]
|
|
4991
|
+
});
|
|
4992
|
+
}).catch(reject);
|
|
4993
|
+
});
|
|
5103
4994
|
}
|
|
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]
|
|
4995
|
+
const promise = Promise.resolve(requestDetails).then((requestDetails2) => {
|
|
4996
|
+
return this.enqueueRequest(requestDetails2);
|
|
5116
4997
|
});
|
|
5117
|
-
promise.then((result) => {
|
|
5118
|
-
this.dispatch(
|
|
5119
|
-
}).catch(() => {
|
|
5120
|
-
this.dispatch(updateProjectFile(projectFile));
|
|
4998
|
+
void promise.then((result) => {
|
|
4999
|
+
this.dispatch(addOrReplaceProjectFile(result));
|
|
5121
5000
|
});
|
|
5122
|
-
|
|
5001
|
+
this.dispatch(saveActiveProjectFileBounds);
|
|
5002
|
+
this.dispatch(setActiveProjectFileId(null));
|
|
5003
|
+
this.dispatch(setIsImportingProjectFile(false));
|
|
5004
|
+
return [activeProjectFile, promise];
|
|
5123
5005
|
}
|
|
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",
|
|
5006
|
+
delete(projectFileId) {
|
|
5007
|
+
this.dispatch(removeProjectFile(projectFileId));
|
|
5008
|
+
return this.enqueueRequest({
|
|
5133
5009
|
method: HttpMethod.DELETE,
|
|
5134
|
-
url: `/projects/files/${
|
|
5135
|
-
blockers: [
|
|
5010
|
+
url: `/projects/files/${projectFileId}`,
|
|
5011
|
+
blockers: [projectFileId],
|
|
5136
5012
|
blocks: []
|
|
5137
5013
|
});
|
|
5138
|
-
promise.catch(() => {
|
|
5139
|
-
this.dispatch(updateProjectFile(projectFileToDelete));
|
|
5140
|
-
});
|
|
5141
|
-
return promise;
|
|
5142
5014
|
}
|
|
5143
5015
|
async refreshStore(projectId) {
|
|
5144
5016
|
const result = await this.enqueueRequest({
|
|
@@ -5148,7 +5020,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5148
5020
|
blockers: [],
|
|
5149
5021
|
blocks: []
|
|
5150
5022
|
});
|
|
5151
|
-
this.dispatch(
|
|
5023
|
+
this.dispatch(addOrReplaceProjectFiles([]));
|
|
5024
|
+
this.dispatch(addOrReplaceProjectFiles(result));
|
|
5152
5025
|
}
|
|
5153
5026
|
}
|
|
5154
5027
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
@@ -5204,7 +5077,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5204
5077
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5205
5078
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5206
5079
|
}
|
|
5207
|
-
this.dispatch(
|
|
5080
|
+
this.dispatch(updateProject(project));
|
|
5208
5081
|
return await this.enqueueRequest({
|
|
5209
5082
|
description: "Update project",
|
|
5210
5083
|
method: HttpMethod.PATCH,
|
|
@@ -5225,8 +5098,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5225
5098
|
if (!project) {
|
|
5226
5099
|
throw new Error("Expected project to exist");
|
|
5227
5100
|
}
|
|
5228
|
-
const
|
|
5229
|
-
this.dispatch(
|
|
5101
|
+
const filesToDelete = selectProjectFiles(state).filter((file) => file.project === projectId);
|
|
5102
|
+
this.dispatch(removeProjectFilesOfProject(project.id));
|
|
5230
5103
|
const attachmentsOfProject = selectAttachmentsOfProject(project.id)(state);
|
|
5231
5104
|
this.dispatch(deleteProjectAttachments(attachmentsOfProject.map(({ offline_id }) => offline_id)));
|
|
5232
5105
|
const projectAccesses = selectProjectAccesses(state);
|
|
@@ -5249,7 +5122,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5249
5122
|
} catch (e) {
|
|
5250
5123
|
this.dispatch(setProjects(Object.values(projects)));
|
|
5251
5124
|
this.dispatch(initializeProjectAccesses(Object.values(projectAccesses)));
|
|
5252
|
-
this.dispatch(
|
|
5125
|
+
this.dispatch(addOrReplaceProjectFiles(filesToDelete));
|
|
5253
5126
|
this.dispatch(setProjectAttachments(attachmentsOfProject));
|
|
5254
5127
|
this.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5255
5128
|
if (license) {
|
|
@@ -5564,12 +5437,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5564
5437
|
blockers: [projectId.toString()],
|
|
5565
5438
|
blocks: []
|
|
5566
5439
|
});
|
|
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);
|
|
5440
|
+
for (const form of projectFormsResult.forms) forms.push(form);
|
|
5441
|
+
for (const revision of projectFormsResult.revisions) revisions.push(revision);
|
|
5442
|
+
for (const attachment of projectFormsResult.attachments) attachments.push(attachment);
|
|
5573
5443
|
const organizationFormsResult = await this.enqueueRequest({
|
|
5574
5444
|
description: "Fetch organization forms",
|
|
5575
5445
|
method: HttpMethod.GET,
|
|
@@ -5577,12 +5447,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5577
5447
|
blockers: [projectId.toString()],
|
|
5578
5448
|
blocks: []
|
|
5579
5449
|
});
|
|
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);
|
|
5450
|
+
for (const form of organizationFormsResult.forms) forms.push(form);
|
|
5451
|
+
for (const revision of organizationFormsResult.revisions) revisions.push(revision);
|
|
5452
|
+
for (const attachment of organizationFormsResult.attachments) attachments.push(attachment);
|
|
5586
5453
|
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5587
5454
|
description: "Fetch asset type forms",
|
|
5588
5455
|
method: HttpMethod.GET,
|
|
@@ -5590,12 +5457,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5590
5457
|
blockers: [projectId.toString()],
|
|
5591
5458
|
blocks: []
|
|
5592
5459
|
});
|
|
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);
|
|
5460
|
+
for (const form of assetTypeFormsResult.forms) forms.push(form);
|
|
5461
|
+
for (const revision of assetTypeFormsResult.revisions) revisions.push(revision);
|
|
5462
|
+
for (const attachment of assetTypeFormsResult.attachments) attachments.push(attachment);
|
|
5599
5463
|
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5600
5464
|
description: "Fetch issue type forms",
|
|
5601
5465
|
method: HttpMethod.GET,
|
|
@@ -5603,12 +5467,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5603
5467
|
blockers: [projectId.toString()],
|
|
5604
5468
|
blocks: []
|
|
5605
5469
|
});
|
|
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);
|
|
5470
|
+
for (const form of issueTypeFormsResult.forms) forms.push(form);
|
|
5471
|
+
for (const revision of issueTypeFormsResult.revisions) revisions.push(revision);
|
|
5472
|
+
for (const attachment of issueTypeFormsResult.attachments) attachments.push(attachment);
|
|
5612
5473
|
this.dispatch(initializeForms(forms));
|
|
5613
5474
|
this.dispatch(initializeFormRevisions(revisions));
|
|
5614
5475
|
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
@@ -5744,12 +5605,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5744
5605
|
files
|
|
5745
5606
|
);
|
|
5746
5607
|
promise.then((result) => {
|
|
5747
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5748
5608
|
this.dispatch(setFormSubmission(result));
|
|
5749
5609
|
return result;
|
|
5750
5610
|
}).catch(() => {
|
|
5751
5611
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5752
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5753
5612
|
});
|
|
5754
5613
|
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5755
5614
|
}
|
|
@@ -5821,16 +5680,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5821
5680
|
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5822
5681
|
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5823
5682
|
const blockers = batchAssetIds;
|
|
5824
|
-
if (prevBatchId)
|
|
5825
|
-
|
|
5826
|
-
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5683
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
5684
|
+
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5827
5685
|
const promise = this.enqueueRequest({
|
|
5828
5686
|
description: "Bulk add form submissions",
|
|
5829
5687
|
method: HttpMethod.POST,
|
|
5830
5688
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5831
5689
|
payload,
|
|
5832
5690
|
blockers,
|
|
5833
|
-
blocks
|
|
5691
|
+
blocks
|
|
5834
5692
|
});
|
|
5835
5693
|
void promise.then(({ presigned_urls }) => {
|
|
5836
5694
|
this.processPresignedUrls(presigned_urls);
|
|
@@ -5842,10 +5700,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5842
5700
|
const createdSubmissions = [];
|
|
5843
5701
|
const createdAttachments = [];
|
|
5844
5702
|
for (const result of results) {
|
|
5845
|
-
for (const createdSubmission of result.submissions)
|
|
5846
|
-
|
|
5847
|
-
for (const createdAttachment of result.attachments)
|
|
5848
|
-
createdAttachments.push(createdAttachment);
|
|
5703
|
+
for (const createdSubmission of result.submissions) createdSubmissions.push(createdSubmission);
|
|
5704
|
+
for (const createdAttachment of result.attachments) createdAttachments.push(createdAttachment);
|
|
5849
5705
|
}
|
|
5850
5706
|
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5851
5707
|
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
@@ -5916,7 +5772,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5916
5772
|
}
|
|
5917
5773
|
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5918
5774
|
this.dispatch(deleteFormSubmission(id));
|
|
5919
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5920
5775
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5921
5776
|
try {
|
|
5922
5777
|
return await this.enqueueRequest({
|
|
@@ -5927,7 +5782,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5927
5782
|
blocks: []
|
|
5928
5783
|
});
|
|
5929
5784
|
} catch (e) {
|
|
5930
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5931
5785
|
this.dispatch(addFormSubmission(submissionToBeDeleted));
|
|
5932
5786
|
this.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
5933
5787
|
throw e;
|
|
@@ -6043,9 +5897,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6043
5897
|
blockers: [id],
|
|
6044
5898
|
blocks: []
|
|
6045
5899
|
});
|
|
6046
|
-
void promise.catch((
|
|
5900
|
+
void promise.catch((e) => {
|
|
6047
5901
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
6048
|
-
throw
|
|
5902
|
+
throw e;
|
|
6049
5903
|
});
|
|
6050
5904
|
return promise;
|
|
6051
5905
|
}
|
|
@@ -6106,7 +5960,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6106
5960
|
class FileService extends BaseApiService {
|
|
6107
5961
|
constructor() {
|
|
6108
5962
|
super(...arguments);
|
|
6109
|
-
__publicField(this, "host"
|
|
5963
|
+
__publicField(this, "host");
|
|
6110
5964
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6111
5965
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6112
5966
|
__publicField(this, "_dbPromise", idb.openDB("fileCache", 1, {
|
|
@@ -6117,8 +5971,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6117
5971
|
}
|
|
6118
5972
|
async renewUploadUrl(sha1) {
|
|
6119
5973
|
const file = await this.fetchCache(sha1);
|
|
6120
|
-
if (!file)
|
|
6121
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5974
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6122
5975
|
const key = await getFileS3Key(file, sha1);
|
|
6123
5976
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6124
5977
|
description: "Get S3 URL",
|
|
@@ -6188,8 +6041,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6188
6041
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6189
6042
|
async uploadFileToS3(sha1) {
|
|
6190
6043
|
const file = await this.fetchCache(sha1);
|
|
6191
|
-
if (!file)
|
|
6192
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6044
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6193
6045
|
const key = await getFileS3Key(file, sha1);
|
|
6194
6046
|
const dbFileProperties = {
|
|
6195
6047
|
file_name: file.name,
|
|
@@ -6283,7 +6135,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6283
6135
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6284
6136
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6285
6137
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6286
|
-
|
|
6138
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6287
6139
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6288
6140
|
throw new Error(message);
|
|
6289
6141
|
}
|
|
@@ -6804,15 +6656,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6804
6656
|
}
|
|
6805
6657
|
}
|
|
6806
6658
|
class AgentService extends BaseApiService {
|
|
6807
|
-
async startConversation(prompt) {
|
|
6808
|
-
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6659
|
+
async startConversation(prompt, projectId) {
|
|
6809
6660
|
return this.enqueueRequest({
|
|
6810
6661
|
description: "Start agent conversation",
|
|
6811
6662
|
method: HttpMethod.POST,
|
|
6812
6663
|
url: "/agents/prompt/",
|
|
6813
6664
|
payload: {
|
|
6814
6665
|
prompt,
|
|
6815
|
-
active_project:
|
|
6666
|
+
active_project: projectId
|
|
6816
6667
|
},
|
|
6817
6668
|
blockers: ["prompt"],
|
|
6818
6669
|
blocks: ["prompt"]
|
|
@@ -6821,21 +6672,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6821
6672
|
return response;
|
|
6822
6673
|
});
|
|
6823
6674
|
}
|
|
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;
|
|
6675
|
+
async continueConversation(prompt, conversationId, projectId) {
|
|
6832
6676
|
return this.enqueueRequest({
|
|
6833
6677
|
description: "Prompt agent",
|
|
6834
6678
|
method: HttpMethod.POST,
|
|
6835
6679
|
url: "/agents/prompt/",
|
|
6836
6680
|
payload: {
|
|
6837
6681
|
prompt,
|
|
6838
|
-
active_project:
|
|
6682
|
+
active_project: projectId
|
|
6839
6683
|
},
|
|
6840
6684
|
blockers: ["prompt"],
|
|
6841
6685
|
blocks: ["prompt"],
|
|
@@ -7329,6 +7173,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7329
7173
|
exports2.ProjectFileService = ProjectFileService;
|
|
7330
7174
|
exports2.ProjectService = ProjectService;
|
|
7331
7175
|
exports2.TeamService = TeamService;
|
|
7176
|
+
exports2.UNKNOWN_ERROR_MESSAGE = UNKNOWN_ERROR_MESSAGE;
|
|
7332
7177
|
exports2.UserService = UserService;
|
|
7333
7178
|
exports2.VERSION_REDUCER_KEY = VERSION_REDUCER_KEY;
|
|
7334
7179
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
@@ -7337,8 +7182,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7337
7182
|
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
7338
7183
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
7339
7184
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
7340
|
-
exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
|
|
7341
|
-
exports2.addActiveProjectIssuesCount = addActiveProjectIssuesCount;
|
|
7342
7185
|
exports2.addAsset = addAsset;
|
|
7343
7186
|
exports2.addAssetAttachment = addAssetAttachment;
|
|
7344
7187
|
exports2.addAssetAttachments = addAssetAttachments;
|
|
@@ -7381,11 +7224,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7381
7224
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
7382
7225
|
exports2.addIssues = addIssues;
|
|
7383
7226
|
exports2.addLicenses = addLicenses;
|
|
7384
|
-
exports2.
|
|
7227
|
+
exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
|
|
7228
|
+
exports2.addOrReplaceProjectFiles = addOrReplaceProjectFiles;
|
|
7385
7229
|
exports2.addProjectAttachment = addProjectAttachment;
|
|
7386
7230
|
exports2.addProjectAttachments = addProjectAttachments;
|
|
7387
|
-
exports2.addProjectFile = addProjectFile;
|
|
7388
|
-
exports2.addProjectFiles = addProjectFiles;
|
|
7389
7231
|
exports2.addTeam = addTeam;
|
|
7390
7232
|
exports2.addUsers = addUsers;
|
|
7391
7233
|
exports2.addWorkspace = addWorkspace;
|
|
@@ -7463,8 +7305,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7463
7305
|
exports2.deleteProjectAccesses = deleteProjectAccesses;
|
|
7464
7306
|
exports2.deleteProjectAttachment = deleteProjectAttachment;
|
|
7465
7307
|
exports2.deleteProjectAttachments = deleteProjectAttachments;
|
|
7466
|
-
exports2.deleteProjectFile = deleteProjectFile;
|
|
7467
|
-
exports2.deleteProjectFiles = deleteProjectFiles;
|
|
7468
7308
|
exports2.deleteTeam = deleteTeam;
|
|
7469
7309
|
exports2.deleteWorkspace = deleteWorkspace;
|
|
7470
7310
|
exports2.dequeue = dequeue;
|
|
@@ -7533,7 +7373,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7533
7373
|
exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
|
|
7534
7374
|
exports2.initializeProjectAccesses = initializeProjectAccesses;
|
|
7535
7375
|
exports2.initializeProjectAttachments = initializeProjectAttachments;
|
|
7536
|
-
exports2.initializeProjectFiles = initializeProjectFiles;
|
|
7537
7376
|
exports2.initializeTeams = initializeTeams;
|
|
7538
7377
|
exports2.initializeWorkspaces = initializeWorkspaces;
|
|
7539
7378
|
exports2.isToday = isToday;
|
|
@@ -7586,14 +7425,16 @@ var __publicField = (obj, key, value) => {
|
|
|
7586
7425
|
exports2.rehydratedSlice = rehydratedSlice;
|
|
7587
7426
|
exports2.removeDocuments = removeDocuments;
|
|
7588
7427
|
exports2.removeIssueType = removeIssueType;
|
|
7428
|
+
exports2.removeProjectFile = removeProjectFile;
|
|
7429
|
+
exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
|
|
7589
7430
|
exports2.removeUser = removeUser;
|
|
7431
|
+
exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
|
|
7590
7432
|
exports2.resetStore = resetStore;
|
|
7591
7433
|
exports2.restructureCreateSelectorWithArgs = restructureCreateSelectorWithArgs;
|
|
7434
|
+
exports2.saveActiveProjectFileBounds = saveActiveProjectFileBounds;
|
|
7592
7435
|
exports2.selectAccessToken = selectAccessToken;
|
|
7593
7436
|
exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
|
|
7594
|
-
exports2.
|
|
7595
|
-
exports2.selectActiveProjectAccess = selectActiveProjectAccess;
|
|
7596
|
-
exports2.selectActiveProjectId = selectActiveProjectId;
|
|
7437
|
+
exports2.selectActiveProjectFileId = selectActiveProjectFileId;
|
|
7597
7438
|
exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
|
|
7598
7439
|
exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
|
|
7599
7440
|
exports2.selectAllProjectAttachments = selectAllProjectAttachments;
|
|
@@ -7684,6 +7525,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7684
7525
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
7685
7526
|
exports2.selectGeoImages = selectGeoImages;
|
|
7686
7527
|
exports2.selectGeoImagesOfProject = selectGeoImagesOfProject;
|
|
7528
|
+
exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
|
|
7687
7529
|
exports2.selectIsLoggedIn = selectIsLoggedIn;
|
|
7688
7530
|
exports2.selectIssueAssociationById = selectIssueAssociationById;
|
|
7689
7531
|
exports2.selectIssueAssociationMapping = selectIssueAssociationMapping;
|
|
@@ -7766,7 +7608,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7766
7608
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
7767
7609
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
7768
7610
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
7769
|
-
exports2.
|
|
7611
|
+
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
7770
7612
|
exports2.setAsset = setAsset;
|
|
7771
7613
|
exports2.setAssetAttachment = setAssetAttachment;
|
|
7772
7614
|
exports2.setAssetAttachments = setAssetAttachments;
|
|
@@ -7792,6 +7634,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7792
7634
|
exports2.setFormSubmissions = setFormSubmissions;
|
|
7793
7635
|
exports2.setGeoImage = setGeoImage;
|
|
7794
7636
|
exports2.setGeoImages = setGeoImages;
|
|
7637
|
+
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
7795
7638
|
exports2.setIssueAssociation = setIssueAssociation;
|
|
7796
7639
|
exports2.setIssueAssociations = setIssueAssociations;
|
|
7797
7640
|
exports2.setIssueAttachment = setIssueAttachment;
|
|
@@ -7805,8 +7648,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7805
7648
|
exports2.setProfilePicture = setProfilePicture;
|
|
7806
7649
|
exports2.setProjectAttachment = setProjectAttachment;
|
|
7807
7650
|
exports2.setProjectAttachments = setProjectAttachments;
|
|
7808
|
-
exports2.setProjectFile = setProjectFile;
|
|
7809
|
-
exports2.setProjectFiles = setProjectFiles;
|
|
7810
7651
|
exports2.setProjects = setProjects;
|
|
7811
7652
|
exports2.setRehydrated = setRehydrated;
|
|
7812
7653
|
exports2.setTeam = setTeam;
|
|
@@ -7856,13 +7697,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7856
7697
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
7857
7698
|
exports2.updateIssueType = updateIssueType;
|
|
7858
7699
|
exports2.updateLicense = updateLicense;
|
|
7859
|
-
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
7860
7700
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
7701
|
+
exports2.updateProject = updateProject;
|
|
7861
7702
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
7862
7703
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
7863
7704
|
exports2.updateProjectAttachments = updateProjectAttachments;
|
|
7864
|
-
exports2.updateProjectFile = updateProjectFile;
|
|
7865
|
-
exports2.updateProjectFiles = updateProjectFiles;
|
|
7866
7705
|
exports2.updateTeam = updateTeam;
|
|
7867
7706
|
exports2.updateWorkspace = updateWorkspace;
|
|
7868
7707
|
exports2.userReducer = userReducer;
|