@overmap-ai/core 1.0.71-fields.13 → 1.0.71-fields.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/defaults.d.ts +2 -1
- package/dist/constants/index.d.ts +3 -3
- package/dist/enums/index.d.ts +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/overmap-core.js +126 -328
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +133 -334
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/base.d.ts +8 -6
- package/dist/sdk/classes/OutboxCoordinator.d.ts +4 -4
- package/dist/sdk/classes/index.d.ts +1 -1
- package/dist/sdk/errors.d.ts +3 -1
- package/dist/sdk/globals.d.ts +7 -5
- package/dist/sdk/index.d.ts +6 -6
- package/dist/sdk/sdk.d.ts +6 -5
- package/dist/sdk/services/AgentService.d.ts +6 -10
- package/dist/sdk/services/AssetAttachmentService.d.ts +18 -19
- package/dist/sdk/services/AssetService.d.ts +5 -4
- package/dist/sdk/services/AssetStageCompletionService.d.ts +5 -4
- package/dist/sdk/services/AssetStageService.d.ts +5 -4
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +17 -18
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +4 -3
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +6 -5
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +5 -4
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +5 -4
- package/dist/sdk/services/AssetTypeService.d.ts +5 -4
- package/dist/sdk/services/BaseApiService.d.ts +5 -4
- package/dist/sdk/services/BaseAttachmentService.d.ts +8 -7
- package/dist/sdk/services/BaseAuthService.d.ts +5 -4
- package/dist/sdk/services/BaseService.d.ts +7 -5
- package/dist/sdk/services/BaseUploadService.d.ts +5 -4
- package/dist/sdk/services/CategoryService.d.ts +5 -4
- package/dist/sdk/services/DocumentAttachmentService.d.ts +17 -18
- package/dist/sdk/services/DocumentService.d.ts +5 -4
- package/dist/sdk/services/EmailDomainsService.d.ts +4 -3
- package/dist/sdk/services/EmailVerificationService.d.ts +4 -3
- package/dist/sdk/services/FileService.d.ts +5 -4
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +5 -4
- package/dist/sdk/services/FormRevisionService.d.ts +5 -4
- package/dist/sdk/services/FormService.d.ts +5 -4
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +5 -4
- package/dist/sdk/services/FormSubmissionService.d.ts +6 -5
- package/dist/sdk/services/GeoImageService.d.ts +5 -4
- package/dist/sdk/services/IssueAssociationService.d.ts +5 -4
- package/dist/sdk/services/IssueAttachmentService.d.ts +17 -18
- package/dist/sdk/services/IssueCommentService.d.ts +5 -4
- package/dist/sdk/services/IssueService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +5 -4
- package/dist/sdk/services/IssueTypeService.d.ts +5 -4
- package/dist/sdk/services/IssueUpdateService.d.ts +4 -3
- package/dist/sdk/services/JWTAuthService.d.ts +7 -6
- package/dist/sdk/services/LicenseService.d.ts +4 -3
- package/dist/sdk/services/OrganizationAccessService.d.ts +4 -3
- package/dist/sdk/services/OrganizationService.d.ts +4 -3
- package/dist/sdk/services/ProjectAccessService.d.ts +4 -3
- package/dist/sdk/services/ProjectAttachmentService.d.ts +17 -18
- package/dist/sdk/services/ProjectFileService.d.ts +5 -4
- package/dist/sdk/services/ProjectService.d.ts +4 -3
- package/dist/sdk/services/TeamService.d.ts +5 -4
- package/dist/sdk/services/UserService.d.ts +4 -3
- package/dist/sdk/services/WorkspaceService.d.ts +5 -4
- package/dist/sdk/services/index.d.ts +45 -45
- package/dist/sdk/typings.d.ts +9 -8
- package/dist/store/adapter.d.ts +12 -11
- package/dist/store/index.d.ts +2 -2
- package/dist/store/migrations.d.ts +2 -1
- package/dist/store/slices/agentsSlice.d.ts +11 -10
- package/dist/store/slices/assetAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/assetSlice.d.ts +35 -24
- package/dist/store/slices/assetStageCompletionSlice.d.ts +33 -22
- package/dist/store/slices/assetStageSlice.d.ts +36 -25
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +43 -32
- package/dist/store/slices/assetTypeSlice.d.ts +16 -21
- package/dist/store/slices/authSlice.d.ts +10 -9
- package/dist/store/slices/categorySlice.d.ts +30 -16
- package/dist/store/slices/documentAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/documentSlice.d.ts +30 -13
- package/dist/store/slices/emailDomainsSlice.d.ts +29 -15
- package/dist/store/slices/fileSlice.d.ts +7 -6
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/formRevisionSlice.d.ts +37 -26
- package/dist/store/slices/formSlice.d.ts +35 -21
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/formSubmissionSlice.d.ts +16 -21
- package/dist/store/slices/geoImageSlice.d.ts +16 -21
- package/dist/store/slices/index.d.ts +46 -46
- package/dist/store/slices/issueAssociationSlice.d.ts +35 -24
- package/dist/store/slices/issueAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/issueCommentSlice.d.ts +13 -18
- package/dist/store/slices/issueSlice.d.ts +13 -18
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +35 -24
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +35 -24
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +43 -32
- package/dist/store/slices/issueTypeSlice.d.ts +12 -14
- package/dist/store/slices/issueUpdateSlice.d.ts +13 -18
- package/dist/store/slices/licenseSlice.d.ts +10 -9
- package/dist/store/slices/organizationAccessSlice.d.ts +11 -13
- package/dist/store/slices/organizationSlice.d.ts +27 -10
- package/dist/store/slices/outboxSlice.d.ts +15 -15
- package/dist/store/slices/projectAccessSlice.d.ts +11 -17
- package/dist/store/slices/projectAttachmentSlice.d.ts +16 -21
- package/dist/store/slices/projectFileSlice.d.ts +33 -16
- package/dist/store/slices/projectSlice.d.ts +10 -24
- package/dist/store/slices/rehydratedSlice.d.ts +7 -6
- package/dist/store/slices/teamSlice.d.ts +12 -14
- package/dist/store/slices/userSlice.d.ts +14 -13
- package/dist/store/slices/versioningSlice.d.ts +3 -2
- package/dist/store/slices/workspaceSlice.d.ts +31 -17
- package/dist/store/store.d.ts +7 -7
- package/dist/typings/index.d.ts +6 -6
- package/dist/typings/models/access.d.ts +3 -2
- package/dist/typings/models/agents.d.ts +3 -2
- package/dist/typings/models/assets.d.ts +5 -4
- package/dist/typings/models/attachments.d.ts +3 -2
- package/dist/typings/models/base.d.ts +3 -2
- package/dist/typings/models/categories.d.ts +3 -2
- package/dist/typings/models/documents.d.ts +2 -1
- package/dist/typings/models/emailDomain.d.ts +2 -1
- package/dist/typings/models/emailVerification.d.ts +3 -2
- package/dist/typings/models/fields.d.ts +3 -2
- package/dist/typings/models/forms.d.ts +4 -3
- package/dist/typings/models/geoImages.d.ts +4 -3
- package/dist/typings/models/index.d.ts +22 -22
- package/dist/typings/models/issueTypes.d.ts +3 -2
- package/dist/typings/models/issues.d.ts +9 -8
- package/dist/typings/models/license.d.ts +3 -2
- package/dist/typings/models/organizations.d.ts +2 -1
- package/dist/typings/models/projects.d.ts +4 -3
- package/dist/typings/models/store.d.ts +3 -3
- package/dist/typings/models/teams.d.ts +4 -3
- package/dist/typings/models/users.d.ts +2 -1
- package/dist/typings/models/workspace.d.ts +2 -1
- package/dist/typings/search.d.ts +1 -1
- package/dist/typings/store.d.ts +2 -1
- package/dist/utils/async/DeferredPromise.d.ts +1 -1
- package/dist/utils/colors.d.ts +2 -1
- package/dist/utils/coordinates.d.ts +3 -2
- package/dist/utils/file.d.ts +2 -1
- package/dist/utils/forms.d.ts +2 -1
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/offline.d.ts +2 -1
- package/dist/utils/utils.d.ts +2 -1
- package/package.json +18 -20
package/dist/overmap-core.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
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
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
var _a;
|
|
8
5
|
import { DepGraph } from "dependency-graph";
|
|
9
6
|
import { v4 } from "uuid";
|
|
10
7
|
import { saveAs } from "file-saver";
|
|
11
8
|
import ColorCls from "color";
|
|
12
|
-
import {
|
|
9
|
+
import { sky, mint, lime, grass, jade, cyan, blue, indigo, iris, violet, purple, plum, pink, crimson, red, orange, amber, yellow, brown, gold, gray } from "@radix-ui/colors";
|
|
10
|
+
import { createSlice, createSelector, combineReducers, compose } from "@reduxjs/toolkit";
|
|
13
11
|
import { offline as offline$1 } from "@redux-offline/redux-offline";
|
|
14
12
|
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
|
|
15
13
|
import localforage from "localforage";
|
|
16
14
|
import createMigration from "redux-persist-migrate";
|
|
17
|
-
import { createSlice, createSelector, combineReducers } from "@reduxjs/toolkit";
|
|
18
15
|
import request from "superagent";
|
|
19
16
|
import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
|
|
20
17
|
import jwtDecode from "jwt-decode";
|
|
21
18
|
import { openDB } from "idb";
|
|
22
|
-
import { unsafeShowToast } from "@overmap-ai/blocks";
|
|
23
19
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
24
20
|
HttpMethod2["GET"] = "GET";
|
|
25
21
|
HttpMethod2["POST"] = "POST";
|
|
@@ -153,8 +149,7 @@ class OutboxCoordinator {
|
|
|
153
149
|
return;
|
|
154
150
|
}
|
|
155
151
|
for (const node of this.graph.overallOrder()) {
|
|
156
|
-
if (node === request2.payload.uuid)
|
|
157
|
-
continue;
|
|
152
|
+
if (node === request2.payload.uuid) continue;
|
|
158
153
|
const details = this.graph.getNodeData(node);
|
|
159
154
|
if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
|
|
160
155
|
this._addDependency(request2.payload.uuid, node);
|
|
@@ -171,8 +166,7 @@ class OutboxCoordinator {
|
|
|
171
166
|
insertRequest(request2) {
|
|
172
167
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
173
168
|
for (const node of this.graph.overallOrder()) {
|
|
174
|
-
if (node === request2.payload.uuid)
|
|
175
|
-
continue;
|
|
169
|
+
if (node === request2.payload.uuid) continue;
|
|
176
170
|
const details = this.graph.getNodeData(node);
|
|
177
171
|
if (details.payload.blockers.some((blocker) => request2.payload.blocks.includes(blocker))) {
|
|
178
172
|
this._addDependency(node, request2.payload.uuid);
|
|
@@ -208,8 +202,7 @@ class OutboxCoordinator {
|
|
|
208
202
|
*/
|
|
209
203
|
peek() {
|
|
210
204
|
const nextNode = this._getNextNode();
|
|
211
|
-
if (!nextNode)
|
|
212
|
-
return void 0;
|
|
205
|
+
if (!nextNode) return void 0;
|
|
213
206
|
return this.graph.getNodeData(nextNode);
|
|
214
207
|
}
|
|
215
208
|
/**
|
|
@@ -281,17 +274,15 @@ function extractErrorMessage(errorRes, err) {
|
|
|
281
274
|
ret = responseBody.error;
|
|
282
275
|
} else if (typeof responseBody.message === "string") {
|
|
283
276
|
ret = responseBody.message;
|
|
284
|
-
} else
|
|
277
|
+
} else {
|
|
285
278
|
try {
|
|
286
|
-
ret = Object.entries(responseBody
|
|
279
|
+
ret = Object.entries(responseBody).map(([key, value]) => {
|
|
287
280
|
if (typeof value === "string") {
|
|
288
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
289
|
-
return value;
|
|
281
|
+
if (_SPECIAL_KEYS.includes(key)) return value;
|
|
290
282
|
return `${key}: ${value}`;
|
|
291
283
|
}
|
|
292
284
|
if (Array.isArray(value)) {
|
|
293
|
-
if (_SPECIAL_KEYS.includes(key))
|
|
294
|
-
return value.join("\n");
|
|
285
|
+
if (_SPECIAL_KEYS.includes(key)) return value.join("\n");
|
|
295
286
|
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
296
287
|
}
|
|
297
288
|
return `${key}: ${JSON.stringify(value)}`;
|
|
@@ -359,11 +350,9 @@ const coordinatesAreEqual = (a, b) => {
|
|
|
359
350
|
return a[0] === b[0] && a[1] === b[1];
|
|
360
351
|
};
|
|
361
352
|
const coordinatesToText = (coordinates, decimalPlaces) => {
|
|
362
|
-
if (!coordinates)
|
|
363
|
-
return "(No Location)";
|
|
353
|
+
if (!coordinates) return "(No Location)";
|
|
364
354
|
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
365
|
-
if (decimalPlaces)
|
|
366
|
-
return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
355
|
+
if (decimalPlaces) return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
367
356
|
return `${lat}, ${lng}`;
|
|
368
357
|
};
|
|
369
358
|
const coordinatesToUrlText = (coordinates) => {
|
|
@@ -416,7 +405,7 @@ function hashFile(file) {
|
|
|
416
405
|
reader.onload = () => {
|
|
417
406
|
const fileResult = reader.result;
|
|
418
407
|
if (!fileResult) {
|
|
419
|
-
reject();
|
|
408
|
+
reject(new Error("FileReader did not return a valid ArrayBuffer."));
|
|
420
409
|
return;
|
|
421
410
|
}
|
|
422
411
|
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
@@ -430,8 +419,7 @@ function hashFile(file) {
|
|
|
430
419
|
function getFileIdentifier(file) {
|
|
431
420
|
if (!file.name || !file.type || !file.size) {
|
|
432
421
|
const message = "File has no name, type, and/or size";
|
|
433
|
-
|
|
434
|
-
throw new Error(`${message}.`);
|
|
422
|
+
throw new Error(message);
|
|
435
423
|
}
|
|
436
424
|
return `${file.name}&${file.type}${file.size}`;
|
|
437
425
|
}
|
|
@@ -553,21 +541,19 @@ const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
|
553
541
|
const OUTBOX_RETRY_DELAY = 6e4;
|
|
554
542
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
555
543
|
let debug = false;
|
|
556
|
-
const REACT_APP_DEBUG_MEMOIZATION =
|
|
544
|
+
const REACT_APP_DEBUG_MEMOIZATION = "";
|
|
557
545
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
558
546
|
debug = true;
|
|
559
547
|
}
|
|
560
548
|
function shallowEqual(objA, objB) {
|
|
561
|
-
if (objA === objB)
|
|
562
|
-
return true;
|
|
549
|
+
if (objA === objB) return true;
|
|
563
550
|
if (typeof objA !== typeof objB) {
|
|
564
551
|
return false;
|
|
565
552
|
}
|
|
566
553
|
const keysA = Object.keys(objA);
|
|
567
554
|
const keysB = Object.keys(objB);
|
|
568
555
|
const keysALength = keysA.length;
|
|
569
|
-
if (keysALength !== keysB.length)
|
|
570
|
-
return false;
|
|
556
|
+
if (keysALength !== keysB.length) return false;
|
|
571
557
|
for (let i = 0; i < keysALength; i++) {
|
|
572
558
|
const key = keysA[i];
|
|
573
559
|
if (!Object.prototype.hasOwnProperty.call(objB, key) || objA[key] !== objB[key]) {
|
|
@@ -594,11 +580,9 @@ function memoize(func) {
|
|
|
594
580
|
};
|
|
595
581
|
}
|
|
596
582
|
function areArraysEqual(first, second) {
|
|
597
|
-
if (first.length !== second.length)
|
|
598
|
-
return false;
|
|
583
|
+
if (first.length !== second.length) return false;
|
|
599
584
|
for (let i = 0; i < first.length; i++) {
|
|
600
|
-
if (first[i] !== second[i])
|
|
601
|
-
return false;
|
|
585
|
+
if (first[i] !== second[i]) return false;
|
|
602
586
|
}
|
|
603
587
|
return true;
|
|
604
588
|
}
|
|
@@ -643,13 +627,11 @@ const generateBadgeColors = (rawColor) => {
|
|
|
643
627
|
return { backgroundColor, textColor };
|
|
644
628
|
};
|
|
645
629
|
const getLocalDateString = memoize((date) => {
|
|
646
|
-
if (!date)
|
|
647
|
-
return "";
|
|
630
|
+
if (!date) return "";
|
|
648
631
|
const asDate = new Date(date);
|
|
649
632
|
const isThisYear = asDate.getFullYear() === today.getFullYear();
|
|
650
633
|
const options = { day: "numeric", month: "short" };
|
|
651
|
-
if (!isThisYear)
|
|
652
|
-
options.year = "numeric";
|
|
634
|
+
if (!isThisYear) options.year = "numeric";
|
|
653
635
|
return asDate.toLocaleDateString([], options);
|
|
654
636
|
});
|
|
655
637
|
const relative = new Intl.RelativeTimeFormat([], { style: "long", numeric: "auto" });
|
|
@@ -660,10 +642,10 @@ const isToday = (date) => {
|
|
|
660
642
|
};
|
|
661
643
|
const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
662
644
|
const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
|
|
663
|
-
if (days < min || days > max)
|
|
664
|
-
return getLocalDateString(date);
|
|
645
|
+
if (days < min || days > max) return getLocalDateString(date);
|
|
665
646
|
return relative.format(days, "days");
|
|
666
647
|
});
|
|
648
|
+
_a = Symbol.toStringTag;
|
|
667
649
|
class DeferredPromise {
|
|
668
650
|
constructor() {
|
|
669
651
|
__publicField(this, _a, "Promise");
|
|
@@ -688,14 +670,12 @@ class DeferredPromise {
|
|
|
688
670
|
return this._promise.catch(onRejected);
|
|
689
671
|
}
|
|
690
672
|
resolve(value) {
|
|
691
|
-
if (!this._resolve)
|
|
692
|
-
throw new Error("No resolve callback");
|
|
673
|
+
if (!this._resolve) throw new Error("No resolve callback");
|
|
693
674
|
this._resolve(value);
|
|
694
675
|
this._state = "fulfilled";
|
|
695
676
|
}
|
|
696
677
|
reject(reason) {
|
|
697
|
-
if (!this._reject)
|
|
698
|
-
throw reason;
|
|
678
|
+
if (!this._reject) throw reason;
|
|
699
679
|
this._reject(reason);
|
|
700
680
|
this._state = "rejected";
|
|
701
681
|
}
|
|
@@ -703,35 +683,6 @@ class DeferredPromise {
|
|
|
703
683
|
throw new Error("`finally` not implemented");
|
|
704
684
|
}
|
|
705
685
|
}
|
|
706
|
-
_a = Symbol.toStringTag;
|
|
707
|
-
var randomString = function randomString2() {
|
|
708
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
709
|
-
};
|
|
710
|
-
({
|
|
711
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
712
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
713
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
714
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
function compose() {
|
|
718
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
719
|
-
funcs[_key] = arguments[_key];
|
|
720
|
-
}
|
|
721
|
-
if (funcs.length === 0) {
|
|
722
|
-
return function(arg) {
|
|
723
|
-
return arg;
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
if (funcs.length === 1) {
|
|
727
|
-
return funcs[0];
|
|
728
|
-
}
|
|
729
|
-
return funcs.reduce(function(a, b) {
|
|
730
|
-
return function() {
|
|
731
|
-
return a(b.apply(void 0, arguments));
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
686
|
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
736
687
|
const latestVersion = () => migrations.length - 1;
|
|
737
688
|
const initialVersioning = (state) => {
|
|
@@ -752,8 +703,7 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
752
703
|
if (state === void 0) {
|
|
753
704
|
state = {};
|
|
754
705
|
}
|
|
755
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
756
|
-
return state;
|
|
706
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion()) return state;
|
|
757
707
|
return migrator(state);
|
|
758
708
|
};
|
|
759
709
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
@@ -947,8 +897,7 @@ const selectAssetsByIds = restructureCreateSelectorWithArgs(
|
|
|
947
897
|
const assets = [];
|
|
948
898
|
for (const assetId of assetIds) {
|
|
949
899
|
const asset = assetsMapping[assetId];
|
|
950
|
-
if (asset)
|
|
951
|
-
assets.push(asset);
|
|
900
|
+
if (asset) assets.push(asset);
|
|
952
901
|
}
|
|
953
902
|
return fallbackToEmptyArray(assets);
|
|
954
903
|
})
|
|
@@ -1009,11 +958,11 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1009
958
|
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
1010
959
|
const fileAttachments = attachmentsOfAsset.filter(
|
|
1011
960
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1012
|
-
({ file_type }) => !file_type
|
|
961
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1013
962
|
);
|
|
1014
963
|
const imageAttachments = attachmentsOfAsset.filter(
|
|
1015
964
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1016
|
-
({ file_type }) => file_type
|
|
965
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1017
966
|
);
|
|
1018
967
|
return { fileAttachments, imageAttachments };
|
|
1019
968
|
}
|
|
@@ -1056,8 +1005,7 @@ const selectCompletedStagesByAsset = createSelector(
|
|
|
1056
1005
|
const completedStagesByAsset = {};
|
|
1057
1006
|
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
1058
1007
|
const { asset, stage, submitted_at } = stageCompletion;
|
|
1059
|
-
if (!completedStagesByAsset[asset])
|
|
1060
|
-
completedStagesByAsset[asset] = {};
|
|
1008
|
+
if (!completedStagesByAsset[asset]) completedStagesByAsset[asset] = {};
|
|
1061
1009
|
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1062
1010
|
}
|
|
1063
1011
|
return completedStagesByAsset;
|
|
@@ -1281,11 +1229,11 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1281
1229
|
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1282
1230
|
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1283
1231
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1284
|
-
({ file_type }) => !file_type
|
|
1232
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
1285
1233
|
);
|
|
1286
1234
|
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1287
1235
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1288
|
-
({ file_type }) => file_type
|
|
1236
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
1289
1237
|
);
|
|
1290
1238
|
return { fileAttachments, imageAttachments };
|
|
1291
1239
|
}
|
|
@@ -1422,8 +1370,7 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1422
1370
|
}
|
|
1423
1371
|
const today2 = (/* @__PURE__ */ new Date()).getTime();
|
|
1424
1372
|
const expiringWithinAnHour = (url.exp ?? today2) - today2 < msPerHour;
|
|
1425
|
-
if (expiringWithinAnHour)
|
|
1426
|
-
return void 0;
|
|
1373
|
+
if (expiringWithinAnHour) return void 0;
|
|
1427
1374
|
return url;
|
|
1428
1375
|
};
|
|
1429
1376
|
const fileReducer = fileSlice.reducer;
|
|
@@ -1452,8 +1399,7 @@ const userSlice = createSlice({
|
|
|
1452
1399
|
state.currentUser = action.payload;
|
|
1453
1400
|
},
|
|
1454
1401
|
setProfilePicture: (state, action) => {
|
|
1455
|
-
if (!state.currentUser)
|
|
1456
|
-
return;
|
|
1402
|
+
if (!state.currentUser) return;
|
|
1457
1403
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1458
1404
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1459
1405
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1587,13 +1533,6 @@ const selectProjectAccesses = createSelector(
|
|
|
1587
1533
|
const selectProjectAccessById = (id) => (state) => {
|
|
1588
1534
|
return state.projectAccessReducer.instances[id];
|
|
1589
1535
|
};
|
|
1590
|
-
const selectActiveProjectAccess = (state) => {
|
|
1591
|
-
const currentUser = state.userReducer.currentUser;
|
|
1592
|
-
const activeProjectId = state.projectReducer.activeProjectId;
|
|
1593
|
-
return Object.values(state.projectAccessReducer.instances).find((projectAccess) => {
|
|
1594
|
-
return projectAccess.user === (currentUser == null ? void 0 : currentUser.id) && projectAccess.project === activeProjectId;
|
|
1595
|
-
}) ?? null;
|
|
1596
|
-
};
|
|
1597
1536
|
const selectProjectAccessForUser = (user) => (state) => {
|
|
1598
1537
|
return Object.values(state.projectAccessReducer.instances).find(
|
|
1599
1538
|
(projectAccess) => projectAccess.user === user.id
|
|
@@ -1608,8 +1547,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1608
1547
|
};
|
|
1609
1548
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1610
1549
|
const initialState$u = {
|
|
1611
|
-
projects: {}
|
|
1612
|
-
activeProjectId: null
|
|
1550
|
+
projects: {}
|
|
1613
1551
|
};
|
|
1614
1552
|
const projectSlice = createSlice({
|
|
1615
1553
|
name: "projects",
|
|
@@ -1623,19 +1561,9 @@ const projectSlice = createSlice({
|
|
|
1623
1561
|
});
|
|
1624
1562
|
state.projects = projectsMap;
|
|
1625
1563
|
},
|
|
1626
|
-
|
|
1627
|
-
state.activeProjectId = action.payload;
|
|
1628
|
-
},
|
|
1629
|
-
updateOrCreateProject: (state, action) => {
|
|
1564
|
+
updateProject: (state, action) => {
|
|
1630
1565
|
state.projects[action.payload.id] = action.payload;
|
|
1631
1566
|
},
|
|
1632
|
-
// Takes a list of Projects and updates existing ones to match the payload, or adds them
|
|
1633
|
-
// to the store if they are not already present
|
|
1634
|
-
updateOrCreateProjects: (state, action) => {
|
|
1635
|
-
action.payload.forEach((project) => {
|
|
1636
|
-
state.projects[project.id] = project;
|
|
1637
|
-
});
|
|
1638
|
-
},
|
|
1639
1567
|
deleteProject: (state, action) => {
|
|
1640
1568
|
delete state.projects[action.payload.id];
|
|
1641
1569
|
},
|
|
@@ -1645,50 +1573,12 @@ const projectSlice = createSlice({
|
|
|
1645
1573
|
} else {
|
|
1646
1574
|
throw new Error("Accept project invite: user is not in this project");
|
|
1647
1575
|
}
|
|
1648
|
-
},
|
|
1649
|
-
addActiveProjectIssuesCount: (state, action) => {
|
|
1650
|
-
if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
|
|
1651
|
-
throw new Error("Update issues count: no active project");
|
|
1652
|
-
}
|
|
1653
|
-
if (!state.projects[state.activeProjectId].issues_count) {
|
|
1654
|
-
state.projects[state.activeProjectId].issues_count = action.payload;
|
|
1655
|
-
} else {
|
|
1656
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
1657
|
-
}
|
|
1658
|
-
},
|
|
1659
|
-
addActiveProjectFormSubmissionsCount: (state, action) => {
|
|
1660
|
-
if (state.activeProjectId && state.activeProjectId in state.projects) {
|
|
1661
|
-
if (!state.projects[state.activeProjectId].form_submissions_count) {
|
|
1662
|
-
state.projects[state.activeProjectId].form_submissions_count = action.payload;
|
|
1663
|
-
} else {
|
|
1664
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
1665
|
-
}
|
|
1666
|
-
} else {
|
|
1667
|
-
throw new Error("Update form submissions count: no active project");
|
|
1668
|
-
}
|
|
1669
1576
|
}
|
|
1670
1577
|
}
|
|
1671
1578
|
});
|
|
1672
|
-
const {
|
|
1673
|
-
setProjects,
|
|
1674
|
-
updateOrCreateProject,
|
|
1675
|
-
updateOrCreateProjects: addOrReplaceProjects,
|
|
1676
|
-
setActiveProjectId,
|
|
1677
|
-
deleteProject,
|
|
1678
|
-
acceptProjectInvite,
|
|
1679
|
-
addActiveProjectIssuesCount,
|
|
1680
|
-
addActiveProjectFormSubmissionsCount
|
|
1681
|
-
} = projectSlice.actions;
|
|
1579
|
+
const { setProjects, updateProject, deleteProject, acceptProjectInvite } = projectSlice.actions;
|
|
1682
1580
|
const projectReducer = projectSlice.reducer;
|
|
1683
1581
|
const selectProjectMapping = (state) => state.projectReducer.projects;
|
|
1684
|
-
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
1685
|
-
const selectActiveProject = (state) => {
|
|
1686
|
-
const activeProjectId = selectActiveProjectId(state);
|
|
1687
|
-
if (!activeProjectId) {
|
|
1688
|
-
return null;
|
|
1689
|
-
}
|
|
1690
|
-
return state.projectReducer.projects[activeProjectId] ?? null;
|
|
1691
|
-
};
|
|
1692
1582
|
const selectProjectById = (id) => (state) => {
|
|
1693
1583
|
return state.projectReducer.projects[id];
|
|
1694
1584
|
};
|
|
@@ -1845,8 +1735,7 @@ const outboxSlice = createSlice({
|
|
|
1845
1735
|
},
|
|
1846
1736
|
markAsDeleted(state, action) {
|
|
1847
1737
|
const index = state.deletedRequests.indexOf(action.payload);
|
|
1848
|
-
if (index !== -1)
|
|
1849
|
-
state.deletedRequests.splice(index, 1);
|
|
1738
|
+
if (index !== -1) state.deletedRequests.splice(index, 1);
|
|
1850
1739
|
},
|
|
1851
1740
|
_setLatestRetryTime: (state, action) => {
|
|
1852
1741
|
state.latestRetryTime = action.payload;
|
|
@@ -1937,14 +1826,9 @@ const {
|
|
|
1937
1826
|
resetProjectFileObjectUrls
|
|
1938
1827
|
} = projectFileSlice.actions;
|
|
1939
1828
|
const selectProjectFileMapping = (state) => state.projectFileReducer.projectFiles;
|
|
1940
|
-
const selectProjectFiles = createSelector(
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
return fallbackToEmptyArray(
|
|
1944
|
-
Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
|
|
1945
|
-
);
|
|
1946
|
-
}
|
|
1947
|
-
);
|
|
1829
|
+
const selectProjectFiles = createSelector([selectProjectFileMapping], (mapping) => {
|
|
1830
|
+
return fallbackToEmptyArray(Object.values(mapping).sort((a, b) => a.z_index - b.z_index));
|
|
1831
|
+
});
|
|
1948
1832
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1949
1833
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
1950
1834
|
const selectProjectFileById = (id) => (state) => {
|
|
@@ -2000,11 +1884,11 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
2000
1884
|
const attachmentsOfProject = attachments.filter(({ project }) => projectId === project);
|
|
2001
1885
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2002
1886
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2003
|
-
({ file_type }) => !file_type
|
|
1887
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2004
1888
|
);
|
|
2005
1889
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2006
1890
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2007
|
-
({ file_type }) => file_type
|
|
1891
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2008
1892
|
);
|
|
2009
1893
|
return { fileAttachments, imageAttachments };
|
|
2010
1894
|
}
|
|
@@ -2088,8 +1972,7 @@ const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
|
|
|
2088
1972
|
[selectFormRevisionMapping, (_state, formId) => formId],
|
|
2089
1973
|
(revisions, formId) => {
|
|
2090
1974
|
const revisionsOfForm = Object.values(revisions).filter((revision) => revision.form === formId);
|
|
2091
|
-
if (revisionsOfForm.length === 0)
|
|
2092
|
-
return void 0;
|
|
1975
|
+
if (revisionsOfForm.length === 0) return void 0;
|
|
2093
1976
|
const sortedRevisions = revisionsOfForm.sort(formRevisionSortFn);
|
|
2094
1977
|
const latestRevision = sortedRevisions[revisionsOfForm.length - 1];
|
|
2095
1978
|
return revisions[latestRevision.offline_id];
|
|
@@ -2153,7 +2036,7 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2153
2036
|
return [...regularMatches.slice(0, maxResults)];
|
|
2154
2037
|
},
|
|
2155
2038
|
// as the argument is an object, we check the first level of properties for equality
|
|
2156
|
-
{ memoizeOptions: {
|
|
2039
|
+
{ memoizeOptions: { resultEqualityCheck: shallowEqual } }
|
|
2157
2040
|
)
|
|
2158
2041
|
);
|
|
2159
2042
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
@@ -2207,8 +2090,7 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2207
2090
|
(submissionsMapping, revisionMapping, formId) => {
|
|
2208
2091
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
2209
2092
|
for (const revision of Object.values(revisionMapping)) {
|
|
2210
|
-
if (revision.form !== formId)
|
|
2211
|
-
continue;
|
|
2093
|
+
if (revision.form !== formId) continue;
|
|
2212
2094
|
revisionIds.add(revision.offline_id);
|
|
2213
2095
|
}
|
|
2214
2096
|
return Object.values(submissionsMapping).filter(
|
|
@@ -2580,8 +2462,7 @@ const selectAncestorIdsOfDocument = restructureCreateSelectorWithArgs(
|
|
|
2580
2462
|
createSelector([selectDocumentsMapping, (_state, documentId) => documentId], (mapping, documentId) => {
|
|
2581
2463
|
const listOfAncestors = [];
|
|
2582
2464
|
const document2 = mapping[documentId];
|
|
2583
|
-
if (!document2 || !document2.parent_document)
|
|
2584
|
-
return listOfAncestors;
|
|
2465
|
+
if (!document2 || !document2.parent_document) return listOfAncestors;
|
|
2585
2466
|
let currentAncestor = mapping[document2.parent_document];
|
|
2586
2467
|
while (currentAncestor) {
|
|
2587
2468
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
@@ -2647,11 +2528,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
2647
2528
|
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
2648
2529
|
const fileAttachments = attachmentsOfProject.filter(
|
|
2649
2530
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2650
|
-
({ file_type }) => !file_type
|
|
2531
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2651
2532
|
);
|
|
2652
2533
|
const imageAttachments = attachmentsOfProject.filter(
|
|
2653
2534
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2654
|
-
({ file_type }) => file_type
|
|
2535
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2655
2536
|
);
|
|
2656
2537
|
return { fileAttachments, imageAttachments };
|
|
2657
2538
|
}
|
|
@@ -2857,11 +2738,11 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
|
2857
2738
|
const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
|
|
2858
2739
|
const fileAttachments = attachmentsOfIssue.filter(
|
|
2859
2740
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2860
|
-
({ file_type }) => !file_type
|
|
2741
|
+
({ file_type }) => !file_type.startsWith("image/")
|
|
2861
2742
|
);
|
|
2862
2743
|
const imageAttachments = attachmentsOfIssue.filter(
|
|
2863
2744
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2864
|
-
({ file_type }) => file_type
|
|
2745
|
+
({ file_type }) => file_type.startsWith("image/")
|
|
2865
2746
|
);
|
|
2866
2747
|
return { fileAttachments, imageAttachments };
|
|
2867
2748
|
}
|
|
@@ -3430,6 +3311,7 @@ class BaseService {
|
|
|
3430
3311
|
async enqueueRequest(requestDetails) {
|
|
3431
3312
|
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3432
3313
|
}
|
|
3314
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3433
3315
|
dispatch(action) {
|
|
3434
3316
|
this.client.store.dispatch(action);
|
|
3435
3317
|
}
|
|
@@ -3507,9 +3389,8 @@ function getOutboxCoordinator() {
|
|
|
3507
3389
|
__OUTBOX_COORDINATOR = coordinator;
|
|
3508
3390
|
return coordinator;
|
|
3509
3391
|
}
|
|
3510
|
-
const persistCallback = (
|
|
3511
|
-
if (
|
|
3512
|
-
throw err;
|
|
3392
|
+
const persistCallback = (e) => {
|
|
3393
|
+
if (e) throw e;
|
|
3513
3394
|
const clientStore2 = getClientStore();
|
|
3514
3395
|
if (clientStore2) {
|
|
3515
3396
|
clientStore2.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
@@ -3573,14 +3454,11 @@ function extractResponseFromError(error) {
|
|
|
3573
3454
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3574
3455
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3575
3456
|
}
|
|
3576
|
-
if (isResponse(error))
|
|
3577
|
-
return error;
|
|
3457
|
+
if (isResponse(error)) return error;
|
|
3578
3458
|
if (typeof error === "object" && error !== null) {
|
|
3579
3459
|
const typedError = error;
|
|
3580
|
-
if (isResponse(typedError.response))
|
|
3581
|
-
|
|
3582
|
-
if (typedError.response && isResponse(typedError.response.response))
|
|
3583
|
-
return typedError.response.response;
|
|
3460
|
+
if (isResponse(typedError.response)) return typedError.response;
|
|
3461
|
+
if (typedError.response && isResponse(typedError.response.response)) return typedError.response.response;
|
|
3584
3462
|
}
|
|
3585
3463
|
return void 0;
|
|
3586
3464
|
}
|
|
@@ -3621,15 +3499,11 @@ async function performRequest(action, client) {
|
|
|
3621
3499
|
const addPayload = (req) => {
|
|
3622
3500
|
if (attachmentHash) {
|
|
3623
3501
|
const s3url = requestDetails.s3url;
|
|
3624
|
-
if (!s3url)
|
|
3625
|
-
|
|
3626
|
-
if (
|
|
3627
|
-
throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3628
|
-
if (!file)
|
|
3629
|
-
throw new Error(`No file for file ${attachmentHash}`);
|
|
3502
|
+
if (!s3url) throw new Error(`No S3 URL for file ${attachmentHash}`);
|
|
3503
|
+
if ("warning" in s3url) throw new Error(`S3 URL warning for file ${attachmentHash}`);
|
|
3504
|
+
if (!file) throw new Error(`No file for file ${attachmentHash}`);
|
|
3630
3505
|
const s3Sha1Checksum = s3url.fields["x-amz-checksum-sha1"];
|
|
3631
|
-
if (!s3Sha1Checksum)
|
|
3632
|
-
throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3506
|
+
if (!s3Sha1Checksum) throw new Error(`No checksum for file ${attachmentHash}`);
|
|
3633
3507
|
return req.set("x-amz-checksum-sha1", s3Sha1Checksum).field({ ...payload, ...s3url.fields }).attach("file", file);
|
|
3634
3508
|
}
|
|
3635
3509
|
return req.send(payload);
|
|
@@ -3689,8 +3563,7 @@ class MiddlewareChainerPrivate {
|
|
|
3689
3563
|
this.compile = this.compile.bind(this);
|
|
3690
3564
|
}
|
|
3691
3565
|
then(next) {
|
|
3692
|
-
if (this._previous)
|
|
3693
|
-
this._previous.next = next;
|
|
3566
|
+
if (this._previous) this._previous.next = next;
|
|
3694
3567
|
this._all.push(next);
|
|
3695
3568
|
this._previous = next;
|
|
3696
3569
|
return {
|
|
@@ -3718,11 +3591,9 @@ class OfflineMiddleware {
|
|
|
3718
3591
|
} else {
|
|
3719
3592
|
console.debug("Middleware finished. Performing request:", action);
|
|
3720
3593
|
const clientStore2 = getClientStore();
|
|
3721
|
-
if (!clientStore2)
|
|
3722
|
-
throw new Error("Client store not set");
|
|
3594
|
+
if (!clientStore2) throw new Error("Client store not set");
|
|
3723
3595
|
const clientSDK2 = getClientSDK();
|
|
3724
|
-
if (!clientSDK2)
|
|
3725
|
-
throw new Error("Client SDK not set");
|
|
3596
|
+
if (!clientSDK2) throw new Error("Client SDK not set");
|
|
3726
3597
|
return performRequest(action, clientSDK2);
|
|
3727
3598
|
}
|
|
3728
3599
|
}
|
|
@@ -3743,20 +3614,6 @@ function runMiddleware(action) {
|
|
|
3743
3614
|
return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
|
|
3744
3615
|
}
|
|
3745
3616
|
const discardStatuses = [400, 409, 403, 404, 405, 500];
|
|
3746
|
-
const statusMessages = {
|
|
3747
|
-
403: { title: "Forbidden", description: "You are not authorized to perform this action.", accentColor: "red" },
|
|
3748
|
-
404: { title: "Not found", description: "The requested resource was not found.", accentColor: "red" },
|
|
3749
|
-
405: {
|
|
3750
|
-
title: "Not supported",
|
|
3751
|
-
description: "It's not you. It's us. Sorry for the inconvenience.",
|
|
3752
|
-
accentColor: "red"
|
|
3753
|
-
},
|
|
3754
|
-
500: {
|
|
3755
|
-
title: "Server error",
|
|
3756
|
-
description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
|
|
3757
|
-
accentColor: "red"
|
|
3758
|
-
}
|
|
3759
|
-
};
|
|
3760
3617
|
function discard(reason, action, retries = 0) {
|
|
3761
3618
|
var _a2;
|
|
3762
3619
|
console.debug(
|
|
@@ -3809,14 +3666,6 @@ function discard(reason, action, retries = 0) {
|
|
|
3809
3666
|
}
|
|
3810
3667
|
if (status !== void 0 && discardStatuses.includes(status)) {
|
|
3811
3668
|
console.warn("Discarding request due to error:", reason, "\nAction:", action);
|
|
3812
|
-
const message = statusMessages[status];
|
|
3813
|
-
if (message) {
|
|
3814
|
-
if (unsafeShowToast) {
|
|
3815
|
-
unsafeShowToast(message);
|
|
3816
|
-
} else {
|
|
3817
|
-
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
3818
|
-
}
|
|
3819
|
-
}
|
|
3820
3669
|
const coordinator2 = getOutboxCoordinator();
|
|
3821
3670
|
if (!coordinator2) {
|
|
3822
3671
|
throw new Error("Outbox coordinator not set");
|
|
@@ -3844,6 +3693,7 @@ function retry(_action, _retries) {
|
|
|
3844
3693
|
}
|
|
3845
3694
|
class BaseSDK {
|
|
3846
3695
|
constructor(store) {
|
|
3696
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3847
3697
|
__publicField(this, "store");
|
|
3848
3698
|
this.store = store;
|
|
3849
3699
|
}
|
|
@@ -3879,9 +3729,13 @@ class BaseSDK {
|
|
|
3879
3729
|
};
|
|
3880
3730
|
performRequest(fullOfflineAction, this).then((result) => {
|
|
3881
3731
|
promise.resolve(result.body);
|
|
3882
|
-
}).catch((
|
|
3883
|
-
discard(
|
|
3884
|
-
|
|
3732
|
+
}).catch((e) => {
|
|
3733
|
+
discard(e, fullOfflineAction);
|
|
3734
|
+
if (e instanceof Error) {
|
|
3735
|
+
promise.reject(e);
|
|
3736
|
+
} else {
|
|
3737
|
+
promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3738
|
+
}
|
|
3885
3739
|
});
|
|
3886
3740
|
} else {
|
|
3887
3741
|
const innerPromise = this.store.dispatch(
|
|
@@ -3935,10 +3789,8 @@ class BaseAuthService extends BaseService {
|
|
|
3935
3789
|
}
|
|
3936
3790
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
3937
3791
|
function parseTokens(response) {
|
|
3938
|
-
if (!response.access)
|
|
3939
|
-
|
|
3940
|
-
if (!response.refresh)
|
|
3941
|
-
throw new Error("Missing refresh token");
|
|
3792
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3793
|
+
if (!response.refresh) throw new Error("Missing refresh token");
|
|
3942
3794
|
return { accessToken: response.access, refreshToken: response.refresh };
|
|
3943
3795
|
}
|
|
3944
3796
|
class JWTService extends BaseAuthService {
|
|
@@ -3975,8 +3827,7 @@ class JWTService extends BaseAuthService {
|
|
|
3975
3827
|
this.clearAuth();
|
|
3976
3828
|
return void 0;
|
|
3977
3829
|
}
|
|
3978
|
-
if (!response.access)
|
|
3979
|
-
throw new Error("Missing access token");
|
|
3830
|
+
if (!response.access) throw new Error("Missing access token");
|
|
3980
3831
|
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
3981
3832
|
});
|
|
3982
3833
|
}
|
|
@@ -4032,8 +3883,7 @@ class JWTService extends BaseAuthService {
|
|
|
4032
3883
|
return `Bearer ${accessToken}`;
|
|
4033
3884
|
}
|
|
4034
3885
|
async prepareAuth() {
|
|
4035
|
-
if (!this.tokenIsExpiringSoon())
|
|
4036
|
-
return;
|
|
3886
|
+
if (!this.tokenIsExpiringSoon()) return;
|
|
4037
3887
|
console.debug(this.constructor.name, "preparing auth");
|
|
4038
3888
|
try {
|
|
4039
3889
|
await this.renewTokens();
|
|
@@ -4041,7 +3891,11 @@ class JWTService extends BaseAuthService {
|
|
|
4041
3891
|
if (e instanceof APIError) {
|
|
4042
3892
|
this.clearAuth();
|
|
4043
3893
|
}
|
|
4044
|
-
|
|
3894
|
+
if (e instanceof Error) {
|
|
3895
|
+
return Promise.reject(e);
|
|
3896
|
+
} else {
|
|
3897
|
+
return Promise.reject(new Error((e ?? UNKNOWN_ERROR_MESSAGE).toString()));
|
|
3898
|
+
}
|
|
4045
3899
|
}
|
|
4046
3900
|
}
|
|
4047
3901
|
/* if not successfull in gracefully handling an unauthorized response, throw and APIError */
|
|
@@ -4072,7 +3926,7 @@ class JWTService extends BaseAuthService {
|
|
|
4072
3926
|
async initAuth(payload) {
|
|
4073
3927
|
const uuid = v4();
|
|
4074
3928
|
console.debug(this.constructor.name, "Initiating auth");
|
|
4075
|
-
|
|
3929
|
+
return this.enqueueRequest({
|
|
4076
3930
|
uuid,
|
|
4077
3931
|
description: "Get token pair",
|
|
4078
3932
|
method: HttpMethod.POST,
|
|
@@ -4080,25 +3934,12 @@ class JWTService extends BaseAuthService {
|
|
|
4080
3934
|
payload,
|
|
4081
3935
|
isAuthNeeded: false,
|
|
4082
3936
|
checkAuth: false,
|
|
3937
|
+
immediate: true,
|
|
4083
3938
|
blockers: [],
|
|
4084
3939
|
blocks: []
|
|
4085
|
-
}).then(
|
|
4086
|
-
|
|
4087
|
-
let timedOut = false;
|
|
4088
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
4089
|
-
setTimeout(() => {
|
|
4090
|
-
timedOut = true;
|
|
4091
|
-
this.dispatch(markForDeletion(uuid));
|
|
4092
|
-
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
4093
|
-
}, timeout * 1e3);
|
|
4094
|
-
});
|
|
4095
|
-
const successPromise = promise.then((tokens) => {
|
|
4096
|
-
if (timedOut) {
|
|
4097
|
-
return void 0;
|
|
4098
|
-
}
|
|
4099
|
-
this.setTokens(tokens);
|
|
3940
|
+
}).then((tokens) => {
|
|
3941
|
+
this.setTokens(parseTokens(tokens));
|
|
4100
3942
|
});
|
|
4101
|
-
return Promise.race([timeoutPromise, successPromise]);
|
|
4102
3943
|
}
|
|
4103
3944
|
}
|
|
4104
3945
|
class BaseApiService extends BaseService {
|
|
@@ -4258,8 +4099,7 @@ class AssetService extends BaseApiService {
|
|
|
4258
4099
|
const { store } = this.client;
|
|
4259
4100
|
const state = store.getState();
|
|
4260
4101
|
const assetToBeDeleted = selectAssetById(id)(state);
|
|
4261
|
-
if (!assetToBeDeleted)
|
|
4262
|
-
throw new Error(`No asset with id ${id} found in the store`);
|
|
4102
|
+
if (!assetToBeDeleted) throw new Error(`No asset with id ${id} found in the store`);
|
|
4263
4103
|
const attachmentsOfAssets = selectAttachmentsOfAsset(id)(state);
|
|
4264
4104
|
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(id)(state);
|
|
4265
4105
|
const issueAssociations = selectIssueAssociationsOfAsset(id)(state);
|
|
@@ -4282,12 +4122,12 @@ class AssetService extends BaseApiService {
|
|
|
4282
4122
|
url: `/assets/${id}/`,
|
|
4283
4123
|
blockers: [id],
|
|
4284
4124
|
blocks: []
|
|
4285
|
-
}).catch((
|
|
4125
|
+
}).catch((e) => {
|
|
4286
4126
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
4287
4127
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4288
4128
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4289
4129
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4290
|
-
throw
|
|
4130
|
+
throw e;
|
|
4291
4131
|
});
|
|
4292
4132
|
}
|
|
4293
4133
|
bulkAdd(payloads, assetTypeId, batchSize) {
|
|
@@ -4311,8 +4151,7 @@ class AssetService extends BaseApiService {
|
|
|
4311
4151
|
const { batchId, payload } = assetBatch;
|
|
4312
4152
|
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
4313
4153
|
const blockers = [assetTypeId];
|
|
4314
|
-
if (prevBatchId)
|
|
4315
|
-
blockers.push(prevBatchId);
|
|
4154
|
+
if (prevBatchId) blockers.push(prevBatchId);
|
|
4316
4155
|
const blocks = batchAssetOfflineIds;
|
|
4317
4156
|
blocks.push(batchId);
|
|
4318
4157
|
const promise = this.enqueueRequest({
|
|
@@ -4532,8 +4371,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4532
4371
|
update(payload) {
|
|
4533
4372
|
const { store } = this.client;
|
|
4534
4373
|
const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
|
|
4535
|
-
if (!assetStage)
|
|
4536
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4374
|
+
if (!assetStage) throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4537
4375
|
const updatedAssetStage = {
|
|
4538
4376
|
...assetStage,
|
|
4539
4377
|
...payload
|
|
@@ -4689,8 +4527,7 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4689
4527
|
for (const payload of payloads) {
|
|
4690
4528
|
const { modelId, file } = payload;
|
|
4691
4529
|
const filePayload = await this.getFilePayload(file);
|
|
4692
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
4693
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
4530
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
4694
4531
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
4695
4532
|
file,
|
|
4696
4533
|
file_sha1: filePayload.sha1,
|
|
@@ -5115,7 +4952,6 @@ class IssueService extends BaseApiService {
|
|
|
5115
4952
|
created_by: createdBy
|
|
5116
4953
|
});
|
|
5117
4954
|
this.dispatch(addIssue(offlineIssue));
|
|
5118
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5119
4955
|
const promise = this.enqueueRequest({
|
|
5120
4956
|
description: "Create issue",
|
|
5121
4957
|
method: HttpMethod.POST,
|
|
@@ -5128,7 +4964,6 @@ class IssueService extends BaseApiService {
|
|
|
5128
4964
|
this.dispatch(updateIssue(result));
|
|
5129
4965
|
}).catch((error) => {
|
|
5130
4966
|
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
5131
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5132
4967
|
throw error;
|
|
5133
4968
|
});
|
|
5134
4969
|
return [offlineIssue, promise];
|
|
@@ -5156,7 +4991,18 @@ class IssueService extends BaseApiService {
|
|
|
5156
4991
|
]) {
|
|
5157
4992
|
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
5158
4993
|
switch (issueUpdateChange) {
|
|
5159
|
-
case
|
|
4994
|
+
case IssueUpdateChange.PRIORITY:
|
|
4995
|
+
case IssueUpdateChange.STATUS: {
|
|
4996
|
+
const val = payload[issueUpdateChange];
|
|
4997
|
+
changes[issueUpdateChange] = val !== void 0 ? Number(val) : null;
|
|
4998
|
+
break;
|
|
4999
|
+
}
|
|
5000
|
+
case IssueUpdateChange.DUE_DATE:
|
|
5001
|
+
case IssueUpdateChange.DESCRIPTION:
|
|
5002
|
+
case IssueUpdateChange.TITLE:
|
|
5003
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5004
|
+
break;
|
|
5005
|
+
case IssueUpdateChange.CATEGORY: {
|
|
5160
5006
|
let categoryOrNull = null;
|
|
5161
5007
|
const categoryIdOrNull = payload[issueUpdateChange];
|
|
5162
5008
|
if (categoryIdOrNull) {
|
|
@@ -5173,7 +5019,7 @@ class IssueService extends BaseApiService {
|
|
|
5173
5019
|
} : null;
|
|
5174
5020
|
break;
|
|
5175
5021
|
}
|
|
5176
|
-
case
|
|
5022
|
+
case IssueUpdateChange.ASSIGNED_TO: {
|
|
5177
5023
|
let userOrNull = null;
|
|
5178
5024
|
const userIdOrNull = payload[issueUpdateChange];
|
|
5179
5025
|
if (userIdOrNull) {
|
|
@@ -5189,20 +5035,6 @@ class IssueService extends BaseApiService {
|
|
|
5189
5035
|
} : null;
|
|
5190
5036
|
break;
|
|
5191
5037
|
}
|
|
5192
|
-
case "description":
|
|
5193
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5194
|
-
break;
|
|
5195
|
-
case "title":
|
|
5196
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5197
|
-
break;
|
|
5198
|
-
case "priority":
|
|
5199
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5200
|
-
break;
|
|
5201
|
-
case "status":
|
|
5202
|
-
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5203
|
-
break;
|
|
5204
|
-
case "due_date":
|
|
5205
|
-
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
5206
5038
|
}
|
|
5207
5039
|
}
|
|
5208
5040
|
}
|
|
@@ -5244,7 +5076,6 @@ class IssueService extends BaseApiService {
|
|
|
5244
5076
|
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
5245
5077
|
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
5246
5078
|
this.dispatch(deleteIssue(id));
|
|
5247
|
-
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5248
5079
|
if (attachmentsOfIssue.length > 0)
|
|
5249
5080
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
5250
5081
|
if (updatesOfIssue.length > 0)
|
|
@@ -5265,7 +5096,6 @@ class IssueService extends BaseApiService {
|
|
|
5265
5096
|
this.dispatch(addIssue(backup));
|
|
5266
5097
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
5267
5098
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
5268
|
-
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5269
5099
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
5270
5100
|
this.dispatch(addIssueAssociations(issueAssociations));
|
|
5271
5101
|
throw e;
|
|
@@ -5431,13 +5261,9 @@ class ProjectFileService extends BaseApiService {
|
|
|
5431
5261
|
const { store } = this.client;
|
|
5432
5262
|
const state = store.getState();
|
|
5433
5263
|
const activeProjectFileId = state.projectFileReducer.activeProjectFileId;
|
|
5434
|
-
const activeProjectId = state.projectReducer.activeProjectId;
|
|
5435
5264
|
if (!activeProjectFileId) {
|
|
5436
5265
|
throw new Error("No active project file");
|
|
5437
5266
|
}
|
|
5438
|
-
if (!activeProjectId) {
|
|
5439
|
-
throw new Error("No active project");
|
|
5440
|
-
}
|
|
5441
5267
|
const activeProjectFile = state.projectFileReducer.projectFiles[activeProjectFileId];
|
|
5442
5268
|
if (!activeProjectFile) {
|
|
5443
5269
|
throw new Error("No active project file");
|
|
@@ -5462,7 +5288,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
5462
5288
|
this.client.files.uploadFileToS3(activeProjectFile.file_sha1).then(([fileProps]) => {
|
|
5463
5289
|
resolve({
|
|
5464
5290
|
method: HttpMethod.POST,
|
|
5465
|
-
url: `/projects/${
|
|
5291
|
+
url: `/projects/${activeProjectFile.project}/files/`,
|
|
5466
5292
|
payload: {
|
|
5467
5293
|
...activeProjectFile,
|
|
5468
5294
|
...fileProps
|
|
@@ -5577,7 +5403,7 @@ class ProjectService extends BaseApiService {
|
|
|
5577
5403
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5578
5404
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5579
5405
|
}
|
|
5580
|
-
this.dispatch(
|
|
5406
|
+
this.dispatch(updateProject(project));
|
|
5581
5407
|
return await this.enqueueRequest({
|
|
5582
5408
|
description: "Update project",
|
|
5583
5409
|
method: HttpMethod.PATCH,
|
|
@@ -5842,12 +5668,10 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5842
5668
|
});
|
|
5843
5669
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5844
5670
|
promise.then((result) => {
|
|
5845
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5846
5671
|
this.dispatch(setFormSubmission(result));
|
|
5847
5672
|
return result;
|
|
5848
5673
|
}).catch(() => {
|
|
5849
5674
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5850
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5851
5675
|
});
|
|
5852
5676
|
return [offlineSubmission, promise];
|
|
5853
5677
|
}
|
|
@@ -5894,7 +5718,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5894
5718
|
}
|
|
5895
5719
|
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5896
5720
|
this.dispatch(deleteFormSubmission(id));
|
|
5897
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5898
5721
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5899
5722
|
try {
|
|
5900
5723
|
return await this.enqueueRequest({
|
|
@@ -5905,7 +5728,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5905
5728
|
blocks: []
|
|
5906
5729
|
});
|
|
5907
5730
|
} catch (e) {
|
|
5908
|
-
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5909
5731
|
this.dispatch(addFormSubmission(submissionToBeDeleted));
|
|
5910
5732
|
this.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
5911
5733
|
throw e;
|
|
@@ -5988,9 +5810,9 @@ class WorkspaceService extends BaseApiService {
|
|
|
5988
5810
|
blockers: [id],
|
|
5989
5811
|
blocks: []
|
|
5990
5812
|
});
|
|
5991
|
-
void promise.catch((
|
|
5813
|
+
void promise.catch((e) => {
|
|
5992
5814
|
this.dispatch(addWorkspace(originalWorkspace));
|
|
5993
|
-
throw
|
|
5815
|
+
throw e;
|
|
5994
5816
|
});
|
|
5995
5817
|
return promise;
|
|
5996
5818
|
}
|
|
@@ -6051,7 +5873,7 @@ const summarizeEvery = 20;
|
|
|
6051
5873
|
class FileService extends BaseApiService {
|
|
6052
5874
|
constructor() {
|
|
6053
5875
|
super(...arguments);
|
|
6054
|
-
__publicField(this, "host"
|
|
5876
|
+
__publicField(this, "host");
|
|
6055
5877
|
// NOTE: If you alter the schema (of the IndexedDB database) in any way, you must increment the version in order to
|
|
6056
5878
|
// migrate the store. This allows idb to automatically migrate the user's existing data to the new schema.
|
|
6057
5879
|
__publicField(this, "_dbPromise", openDB("fileCache", 1, {
|
|
@@ -6062,8 +5884,7 @@ class FileService extends BaseApiService {
|
|
|
6062
5884
|
}
|
|
6063
5885
|
async renewUploadUrl(sha1) {
|
|
6064
5886
|
const file = await this.fetchCache(sha1);
|
|
6065
|
-
if (!file)
|
|
6066
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5887
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6067
5888
|
const key = await getFileS3Key(file, sha1);
|
|
6068
5889
|
const s3UploadUrl = await this.enqueueRequest({
|
|
6069
5890
|
description: "Get S3 URL",
|
|
@@ -6133,8 +5954,7 @@ class FileService extends BaseApiService {
|
|
|
6133
5954
|
/** Ensure the file has been added to the file cache before calling `uploadFileToS3()` */
|
|
6134
5955
|
async uploadFileToS3(sha1) {
|
|
6135
5956
|
const file = await this.fetchCache(sha1);
|
|
6136
|
-
if (!file)
|
|
6137
|
-
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
5957
|
+
if (!file) throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
6138
5958
|
const key = await getFileS3Key(file, sha1);
|
|
6139
5959
|
const dbFileProperties = {
|
|
6140
5960
|
file_name: file.name,
|
|
@@ -6228,7 +6048,7 @@ class FileService extends BaseApiService {
|
|
|
6228
6048
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
6229
6049
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
6230
6050
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
6231
|
-
|
|
6051
|
+
import.meta.env.PROD, which will result in some file requests being treated as
|
|
6232
6052
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
6233
6053
|
throw new Error(message);
|
|
6234
6054
|
}
|
|
@@ -6752,15 +6572,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6752
6572
|
}
|
|
6753
6573
|
}
|
|
6754
6574
|
class AgentService extends BaseApiService {
|
|
6755
|
-
async startConversation(prompt) {
|
|
6756
|
-
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6575
|
+
async startConversation(prompt, projectId) {
|
|
6757
6576
|
return this.enqueueRequest({
|
|
6758
6577
|
description: "Start agent conversation",
|
|
6759
6578
|
method: HttpMethod.POST,
|
|
6760
6579
|
url: "/agents/prompt/",
|
|
6761
6580
|
payload: {
|
|
6762
6581
|
prompt,
|
|
6763
|
-
active_project:
|
|
6582
|
+
active_project: projectId
|
|
6764
6583
|
},
|
|
6765
6584
|
blockers: ["prompt"],
|
|
6766
6585
|
blocks: ["prompt"]
|
|
@@ -6769,21 +6588,14 @@ class AgentService extends BaseApiService {
|
|
|
6769
6588
|
return response;
|
|
6770
6589
|
});
|
|
6771
6590
|
}
|
|
6772
|
-
|
|
6773
|
-
* Prompt the agent with a message.
|
|
6774
|
-
* @param prompt The message to prompt the agent with.
|
|
6775
|
-
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
6776
|
-
*/
|
|
6777
|
-
async continueConversation(prompt, conversationId) {
|
|
6778
|
-
const { store } = this.client;
|
|
6779
|
-
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
6591
|
+
async continueConversation(prompt, conversationId, projectId) {
|
|
6780
6592
|
return this.enqueueRequest({
|
|
6781
6593
|
description: "Prompt agent",
|
|
6782
6594
|
method: HttpMethod.POST,
|
|
6783
6595
|
url: "/agents/prompt/",
|
|
6784
6596
|
payload: {
|
|
6785
6597
|
prompt,
|
|
6786
|
-
active_project:
|
|
6598
|
+
active_project: projectId
|
|
6787
6599
|
},
|
|
6788
6600
|
blockers: ["prompt"],
|
|
6789
6601
|
blocks: ["prompt"],
|
|
@@ -7035,8 +6847,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7035
6847
|
for (const payloadAndFile of payloads) {
|
|
7036
6848
|
const { file, ...payload } = payloadAndFile;
|
|
7037
6849
|
const filePayload = await this.getFilePayload(file);
|
|
7038
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7039
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
6850
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7040
6851
|
const offlineMapImage = offline({
|
|
7041
6852
|
...payload,
|
|
7042
6853
|
file_name: file.name,
|
|
@@ -7214,8 +7025,7 @@ class FormRevisionAttachmentService extends BaseUploadService {
|
|
|
7214
7025
|
for (const payload of payloads) {
|
|
7215
7026
|
const { revisionId, fieldIdentifier, file } = payload;
|
|
7216
7027
|
const filePayload = await this.getFilePayload(file);
|
|
7217
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7218
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7028
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7219
7029
|
const offlineFormRevisionAttachment = offline({
|
|
7220
7030
|
file: URL.createObjectURL(file),
|
|
7221
7031
|
file_type: file.type,
|
|
@@ -7300,8 +7110,7 @@ class FormSubmissionAttachmentService extends BaseUploadService {
|
|
|
7300
7110
|
for (const payload of payloads) {
|
|
7301
7111
|
const { submissionId, fieldIdentifier, file } = payload;
|
|
7302
7112
|
const filePayload = await this.getFilePayload(file);
|
|
7303
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7304
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7113
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7305
7114
|
const offlineFormSubmissionAttachment = offline({
|
|
7306
7115
|
file: URL.createObjectURL(file),
|
|
7307
7116
|
file_type: file.type,
|
|
@@ -7448,8 +7257,7 @@ class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
|
7448
7257
|
for (const payload of payloads) {
|
|
7449
7258
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7450
7259
|
const filePayload = await this.getFilePayload(file);
|
|
7451
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7452
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7260
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7453
7261
|
const offlineAssetTypeFieldsAttachment = offline({
|
|
7454
7262
|
file: URL.createObjectURL(file),
|
|
7455
7263
|
file_type: file.type,
|
|
@@ -7730,8 +7538,7 @@ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7730
7538
|
for (const payload of batch) {
|
|
7731
7539
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7732
7540
|
const filePayload = await this.getFilePayload(file);
|
|
7733
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7734
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7541
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7735
7542
|
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7736
7543
|
file: URL.createObjectURL(file),
|
|
7737
7544
|
file_type: file.type,
|
|
@@ -7771,8 +7578,7 @@ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7771
7578
|
});
|
|
7772
7579
|
});
|
|
7773
7580
|
Promise.all(promises).then((result) => {
|
|
7774
|
-
for (const res of result)
|
|
7775
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7581
|
+
for (const res of result) this.processPresignedUrls(res.presigned_urls);
|
|
7776
7582
|
const attachments = result.flatMap((res) => res.attachments);
|
|
7777
7583
|
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7778
7584
|
}).catch((error) => {
|
|
@@ -7832,8 +7638,7 @@ class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
|
7832
7638
|
for (const payload of payloads) {
|
|
7833
7639
|
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7834
7640
|
const filePayload = await this.getFilePayload(file);
|
|
7835
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7836
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7641
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7837
7642
|
const offlineIssueTypeFieldsAttachment = offline({
|
|
7838
7643
|
file: URL.createObjectURL(file),
|
|
7839
7644
|
file_type: file.type,
|
|
@@ -7947,8 +7752,7 @@ class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7947
7752
|
for (const payload of payloads) {
|
|
7948
7753
|
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7949
7754
|
const filePayload = await this.getFilePayload(file);
|
|
7950
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7951
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7755
|
+
if (!(filePayload.sha1 in filePayloads)) filePayloads[filePayload.sha1] = filePayload;
|
|
7952
7756
|
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7953
7757
|
file: URL.createObjectURL(file),
|
|
7954
7758
|
file_type: file.type,
|
|
@@ -8212,6 +8016,7 @@ export {
|
|
|
8212
8016
|
ProjectFileService,
|
|
8213
8017
|
ProjectService,
|
|
8214
8018
|
TeamService,
|
|
8019
|
+
UNKNOWN_ERROR_MESSAGE,
|
|
8215
8020
|
UserService,
|
|
8216
8021
|
VERSION_REDUCER_KEY,
|
|
8217
8022
|
VerificationCodeType,
|
|
@@ -8220,8 +8025,6 @@ export {
|
|
|
8220
8025
|
_selectLatestFormRevision,
|
|
8221
8026
|
_setLatestRetryTime,
|
|
8222
8027
|
acceptProjectInvite,
|
|
8223
|
-
addActiveProjectFormSubmissionsCount,
|
|
8224
|
-
addActiveProjectIssuesCount,
|
|
8225
8028
|
addAsset,
|
|
8226
8029
|
addAssetAttachment,
|
|
8227
8030
|
addAssetAttachments,
|
|
@@ -8282,7 +8085,6 @@ export {
|
|
|
8282
8085
|
addLicenses,
|
|
8283
8086
|
addOrReplaceProjectFile,
|
|
8284
8087
|
addOrReplaceProjectFiles,
|
|
8285
|
-
addOrReplaceProjects,
|
|
8286
8088
|
addProjectAttachment,
|
|
8287
8089
|
addProjectAttachments,
|
|
8288
8090
|
addTeam,
|
|
@@ -8531,10 +8333,7 @@ export {
|
|
|
8531
8333
|
saveActiveProjectFileBounds,
|
|
8532
8334
|
selectAccessToken,
|
|
8533
8335
|
selectActiveOrganizationAccess,
|
|
8534
|
-
selectActiveProject,
|
|
8535
|
-
selectActiveProjectAccess,
|
|
8536
8336
|
selectActiveProjectFileId,
|
|
8537
|
-
selectActiveProjectId,
|
|
8538
8337
|
selectActiveStatusLicenses,
|
|
8539
8338
|
selectAllDocumentAttachments,
|
|
8540
8339
|
selectAllProjectAttachments,
|
|
@@ -8738,7 +8537,6 @@ export {
|
|
|
8738
8537
|
separateFilesFromValues,
|
|
8739
8538
|
separateImageFromFields,
|
|
8740
8539
|
setActiveProjectFileId,
|
|
8741
|
-
setActiveProjectId,
|
|
8742
8540
|
setAsset,
|
|
8743
8541
|
setAssetAttachment,
|
|
8744
8542
|
setAssetAttachments,
|
|
@@ -8859,8 +8657,8 @@ export {
|
|
|
8859
8657
|
updateIssueTypeFieldsAttachments,
|
|
8860
8658
|
updateIssueTypeFieldsMany,
|
|
8861
8659
|
updateLicense,
|
|
8862
|
-
updateOrCreateProject,
|
|
8863
8660
|
updateOrganizationAccess,
|
|
8661
|
+
updateProject,
|
|
8864
8662
|
updateProjectAccess,
|
|
8865
8663
|
updateProjectAttachment,
|
|
8866
8664
|
updateProjectAttachments,
|