@overmap-ai/core 1.0.65-asset-models-improvements.3 → 1.0.65-error-message-fix.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/enums/index.d.ts +0 -3
- package/dist/enums/issue.d.ts +0 -9
- package/dist/overmap-core.js +460 -556
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +449 -545
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/base.d.ts +1 -1
- package/dist/sdk/globals.d.ts +2 -2
- package/dist/sdk/sdk.d.ts +3 -3
- package/dist/sdk/services/AgentService.d.ts +1 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +2 -3
- package/dist/sdk/services/AssetService.d.ts +6 -5
- package/dist/sdk/services/AssetStageCompletionService.d.ts +12 -6
- package/dist/sdk/services/AssetStageService.d.ts +4 -5
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +2 -3
- package/dist/sdk/services/AssetTypeService.d.ts +4 -4
- package/dist/sdk/services/BaseApiService.d.ts +1 -1
- package/dist/sdk/services/BaseAttachmentService.d.ts +2 -3
- package/dist/sdk/services/BaseAuthService.d.ts +1 -1
- package/dist/sdk/services/BaseService.d.ts +2 -2
- package/dist/sdk/services/BaseUploadService.d.ts +2 -2
- package/dist/sdk/services/CategoryService.d.ts +2 -2
- package/dist/sdk/services/DocumentAttachmentService.d.ts +2 -3
- package/dist/sdk/services/DocumentService.d.ts +2 -2
- package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
- package/dist/sdk/services/EmailVerificationService.d.ts +1 -1
- package/dist/sdk/services/FileService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +2 -1
- package/dist/sdk/services/FormSubmissionService.d.ts +3 -2
- package/dist/sdk/services/GeoImageService.d.ts +2 -2
- package/dist/sdk/services/IssueAttachmentService.d.ts +2 -3
- package/dist/sdk/services/IssueCommentService.d.ts +2 -2
- package/dist/sdk/services/IssueService.d.ts +2 -2
- package/dist/sdk/services/IssueTypeService.d.ts +2 -2
- package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
- package/dist/sdk/services/JWTAuthService.d.ts +2 -2
- package/dist/sdk/services/LicenseService.d.ts +1 -1
- package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
- package/dist/sdk/services/OrganizationService.d.ts +1 -1
- package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
- package/dist/sdk/services/ProjectAttachmentService.d.ts +2 -3
- package/dist/sdk/services/ProjectFileService.d.ts +3 -2
- package/dist/sdk/services/ProjectService.d.ts +2 -1
- package/dist/sdk/services/TeamService.d.ts +2 -2
- package/dist/sdk/services/UserService.d.ts +2 -2
- package/dist/sdk/services/WorkspaceService.d.ts +4 -2
- package/dist/store/slices/assetStageCompletionSlice.d.ts +11 -41
- package/dist/store/slices/assetStageSlice.d.ts +9 -20
- package/dist/store/slices/assetTypeSlice.d.ts +3 -27
- package/dist/typings/models/access.d.ts +9 -2
- package/dist/typings/models/agents.d.ts +1 -1
- package/dist/typings/models/assets.d.ts +9 -8
- package/dist/typings/models/attachments.d.ts +9 -2
- package/dist/typings/models/base.d.ts +2 -2
- package/dist/typings/models/categories.d.ts +2 -2
- package/dist/typings/models/documents.d.ts +1 -1
- package/dist/typings/models/emailDomain.d.ts +1 -1
- package/dist/typings/models/emailVerification.d.ts +2 -2
- package/dist/typings/models/forms.d.ts +2 -2
- package/dist/typings/models/geoImages.d.ts +3 -3
- package/dist/typings/models/issueTypes.d.ts +2 -2
- package/dist/typings/models/issues.d.ts +10 -1
- package/dist/typings/models/license.d.ts +15 -2
- package/dist/typings/models/organizations.d.ts +1 -1
- package/dist/typings/models/projects.d.ts +3 -3
- package/dist/typings/models/store.d.ts +1 -1
- package/dist/typings/models/teams.d.ts +3 -3
- package/dist/typings/models/users.d.ts +1 -1
- package/dist/typings/models/workspace.d.ts +1 -1
- package/dist/typings/store.d.ts +1 -1
- package/dist/utils/colors.d.ts +2 -0
- package/package.json +1 -1
- package/dist/enums/access.d.ts +0 -8
- package/dist/enums/attachments.d.ts +0 -7
- package/dist/enums/licenses.d.ts +0 -14
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
(function(global, factory) {
|
|
8
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("
|
|
9
|
-
})(this, function(exports2, dependencyGraph, uuid,
|
|
8
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("file-saver"), require("react"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("@overmap-ai/blocks"), require("idb")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "file-saver", "react", "color", "@radix-ui/colors", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "@overmap-ai/blocks", "idb"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.toolkit, global.request, global.fileSaver, global.React, global.ColorCls, global.colors, global.constants, global.jwtDecode, global.blocks, global.idb));
|
|
9
|
+
})(this, function(exports2, dependencyGraph, uuid, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, fileSaver, React, ColorCls, colors, constants, jwtDecode, blocks, idb) {
|
|
10
10
|
var _a;
|
|
11
11
|
"use strict";
|
|
12
12
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
@@ -17,14 +17,6 @@ var __publicField = (obj, key, value) => {
|
|
|
17
17
|
HttpMethod2["DELETE"] = "DELETE";
|
|
18
18
|
return HttpMethod2;
|
|
19
19
|
})(HttpMethod || {});
|
|
20
|
-
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
21
|
-
AttachmentModel2["Issue"] = "issue";
|
|
22
|
-
AttachmentModel2["Asset"] = "asset";
|
|
23
|
-
AttachmentModel2["AssetType"] = "asset_type";
|
|
24
|
-
AttachmentModel2["Project"] = "project";
|
|
25
|
-
AttachmentModel2["Document"] = "document";
|
|
26
|
-
return AttachmentModel2;
|
|
27
|
-
})(AttachmentModel || {});
|
|
28
20
|
var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
|
|
29
21
|
IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
|
|
30
22
|
IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
|
|
@@ -39,43 +31,6 @@ var __publicField = (obj, key, value) => {
|
|
|
39
31
|
IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
|
|
40
32
|
return IssueStatus2;
|
|
41
33
|
})(IssueStatus || {});
|
|
42
|
-
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
43
|
-
IssueUpdateChange2["STATUS"] = "status";
|
|
44
|
-
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
45
|
-
IssueUpdateChange2["CATEGORY"] = "category";
|
|
46
|
-
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
47
|
-
IssueUpdateChange2["TITLE"] = "title";
|
|
48
|
-
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
49
|
-
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
50
|
-
return IssueUpdateChange2;
|
|
51
|
-
})(IssueUpdateChange || {});
|
|
52
|
-
var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
|
|
53
|
-
ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
54
|
-
ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
55
|
-
return ProjectAccessLevel2;
|
|
56
|
-
})(ProjectAccessLevel || {});
|
|
57
|
-
var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
58
|
-
OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
59
|
-
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
60
|
-
return OrganizationAccessLevel2;
|
|
61
|
-
})(OrganizationAccessLevel || {});
|
|
62
|
-
var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
|
|
63
|
-
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
64
|
-
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
65
|
-
return PaddleCheckoutEvent2;
|
|
66
|
-
})(PaddleCheckoutEvent || {});
|
|
67
|
-
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
68
|
-
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
69
|
-
return LicenseLevel2;
|
|
70
|
-
})(LicenseLevel || {});
|
|
71
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
72
|
-
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
73
|
-
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
74
|
-
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
75
|
-
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
76
|
-
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
77
|
-
return LicenseStatus2;
|
|
78
|
-
})(LicenseStatus || {});
|
|
79
34
|
class OutboxCoordinator {
|
|
80
35
|
constructor() {
|
|
81
36
|
__publicField(this, "graph");
|
|
@@ -262,13 +217,16 @@ var __publicField = (obj, key, value) => {
|
|
|
262
217
|
const MAX_ERROR_MESSAGE_LENGTH = 500;
|
|
263
218
|
const _SPECIAL_KEYS = ["non_field_errors", "detail"];
|
|
264
219
|
function extractErrorMessage(errorRes, err) {
|
|
220
|
+
console.debug("extracting error message from response", errorRes, err);
|
|
265
221
|
let ret;
|
|
266
222
|
if (errorRes == null ? void 0 : errorRes.body) {
|
|
267
223
|
if (typeof errorRes.body === "object") {
|
|
268
224
|
const responseBody = errorRes.body;
|
|
269
225
|
if (typeof responseBody.error === "string") {
|
|
226
|
+
console.debug("body.error is string", responseBody.error);
|
|
270
227
|
ret = responseBody.error;
|
|
271
228
|
} else if (typeof responseBody.message === "string") {
|
|
229
|
+
console.debug("body.message is string", responseBody.message);
|
|
272
230
|
ret = responseBody.message;
|
|
273
231
|
} else if (responseBody.body) {
|
|
274
232
|
try {
|
|
@@ -285,11 +243,13 @@ var __publicField = (obj, key, value) => {
|
|
|
285
243
|
}
|
|
286
244
|
return `${key}: ${JSON.stringify(value)}`;
|
|
287
245
|
}).join("\n");
|
|
246
|
+
console.debug("parsing error body", ret);
|
|
288
247
|
} catch (e) {
|
|
289
248
|
console.error("Failed to extract error message from response body", e);
|
|
290
249
|
}
|
|
291
250
|
}
|
|
292
251
|
} else if (typeof errorRes.body === "string") {
|
|
252
|
+
console.debug("error body is string", errorRes.body);
|
|
293
253
|
ret = errorRes.body;
|
|
294
254
|
}
|
|
295
255
|
} else if (errorRes == null ? void 0 : errorRes.text) {
|
|
@@ -318,6 +278,130 @@ var __publicField = (obj, key, value) => {
|
|
|
318
278
|
this.options = options;
|
|
319
279
|
}
|
|
320
280
|
}
|
|
281
|
+
class DeferredPromise {
|
|
282
|
+
constructor() {
|
|
283
|
+
__publicField(this, _a, "Promise");
|
|
284
|
+
__publicField(this, "_promise");
|
|
285
|
+
__publicField(this, "_resolve");
|
|
286
|
+
__publicField(this, "_reject");
|
|
287
|
+
__publicField(this, "_state", "pending");
|
|
288
|
+
this._resolve = null;
|
|
289
|
+
this._reject = null;
|
|
290
|
+
this._promise = new Promise((resolve, reject) => {
|
|
291
|
+
this._resolve = resolve;
|
|
292
|
+
this._reject = reject;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
get state() {
|
|
296
|
+
return this._state;
|
|
297
|
+
}
|
|
298
|
+
then(onFulfilled, onRejected) {
|
|
299
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
300
|
+
}
|
|
301
|
+
catch(onRejected) {
|
|
302
|
+
return this._promise.catch(onRejected);
|
|
303
|
+
}
|
|
304
|
+
resolve(value) {
|
|
305
|
+
if (!this._resolve)
|
|
306
|
+
throw new Error("No resolve callback");
|
|
307
|
+
this._resolve(value);
|
|
308
|
+
this._state = "fulfilled";
|
|
309
|
+
}
|
|
310
|
+
reject(reason) {
|
|
311
|
+
if (!this._reject)
|
|
312
|
+
throw reason;
|
|
313
|
+
this._reject(reason);
|
|
314
|
+
this._state = "rejected";
|
|
315
|
+
}
|
|
316
|
+
finally(_onFinally) {
|
|
317
|
+
throw new Error("`finally` not implemented");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
_a = Symbol.toStringTag;
|
|
321
|
+
var randomString = function randomString2() {
|
|
322
|
+
return Math.random().toString(36).substring(7).split("").join(".");
|
|
323
|
+
};
|
|
324
|
+
({
|
|
325
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
326
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
327
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
328
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
function compose() {
|
|
332
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
333
|
+
funcs[_key] = arguments[_key];
|
|
334
|
+
}
|
|
335
|
+
if (funcs.length === 0) {
|
|
336
|
+
return function(arg) {
|
|
337
|
+
return arg;
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
if (funcs.length === 1) {
|
|
341
|
+
return funcs[0];
|
|
342
|
+
}
|
|
343
|
+
return funcs.reduce(function(a, b) {
|
|
344
|
+
return function() {
|
|
345
|
+
return a(b.apply(void 0, arguments));
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
350
|
+
const latestVersion = () => migrations.length - 1;
|
|
351
|
+
const initialVersioning = (state) => {
|
|
352
|
+
state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
|
|
353
|
+
return state;
|
|
354
|
+
};
|
|
355
|
+
const signOut = () => {
|
|
356
|
+
return initialVersioning({});
|
|
357
|
+
};
|
|
358
|
+
const createOutboxState = (state) => {
|
|
359
|
+
if (state.outboxReducer) {
|
|
360
|
+
state.outboxReducer.deletedRequests = [];
|
|
361
|
+
}
|
|
362
|
+
return state;
|
|
363
|
+
};
|
|
364
|
+
const wrapMigration = (migrator) => (state) => {
|
|
365
|
+
var _a2;
|
|
366
|
+
if (state === void 0) {
|
|
367
|
+
state = {};
|
|
368
|
+
}
|
|
369
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
370
|
+
return state;
|
|
371
|
+
return migrator(state);
|
|
372
|
+
};
|
|
373
|
+
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
374
|
+
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
375
|
+
const initialState$B = {
|
|
376
|
+
accessToken: "",
|
|
377
|
+
refreshToken: "",
|
|
378
|
+
isLoggedIn: false
|
|
379
|
+
};
|
|
380
|
+
const authSlice = toolkit.createSlice({
|
|
381
|
+
name: "auth",
|
|
382
|
+
initialState: initialState$B,
|
|
383
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
384
|
+
reducers: {
|
|
385
|
+
setTokens: (state, action) => {
|
|
386
|
+
state.accessToken = action.payload.accessToken;
|
|
387
|
+
state.refreshToken = action.payload.refreshToken;
|
|
388
|
+
},
|
|
389
|
+
clearTokens: (state) => {
|
|
390
|
+
state.accessToken = "";
|
|
391
|
+
state.refreshToken = "";
|
|
392
|
+
},
|
|
393
|
+
setLoggedIn: (state, action) => {
|
|
394
|
+
if (!action.payload) {
|
|
395
|
+
authSlice.caseReducers.clearTokens(state);
|
|
396
|
+
}
|
|
397
|
+
state.isLoggedIn = action.payload;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
402
|
+
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
403
|
+
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
404
|
+
const authReducer = authSlice.reducer;
|
|
321
405
|
const coordinatesToLiteral = (coordinates) => {
|
|
322
406
|
return { lng: coordinates[0], lat: coordinates[1] };
|
|
323
407
|
};
|
|
@@ -662,6 +746,19 @@ var __publicField = (obj, key, value) => {
|
|
|
662
746
|
mint: colors.mint.mint9,
|
|
663
747
|
sky: colors.sky.sky9
|
|
664
748
|
};
|
|
749
|
+
const AssetStageColors = {
|
|
750
|
+
indigo: colors.indigo.indigo9,
|
|
751
|
+
red: colors.red.red9,
|
|
752
|
+
violet: colors.violet.violet9,
|
|
753
|
+
yellow: colors.yellow.yellow9,
|
|
754
|
+
jade: colors.jade.jade9,
|
|
755
|
+
cyan: colors.cyan.cyan9,
|
|
756
|
+
gold: colors.gold.gold9,
|
|
757
|
+
orange: colors.orange.orange9,
|
|
758
|
+
lime: colors.lime.lime9,
|
|
759
|
+
sky: colors.sky.sky9,
|
|
760
|
+
pink: colors.pink.pink9
|
|
761
|
+
};
|
|
665
762
|
const defaultBadgeColor = "#868686";
|
|
666
763
|
const generateBadgeColors = (rawColor) => {
|
|
667
764
|
const color = ColorCls(rawColor);
|
|
@@ -670,6 +767,9 @@ var __publicField = (obj, key, value) => {
|
|
|
670
767
|
const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
|
|
671
768
|
return { backgroundColor, textColor };
|
|
672
769
|
};
|
|
770
|
+
function getStageColor(index) {
|
|
771
|
+
return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
|
|
772
|
+
}
|
|
673
773
|
const getLocalDateString = memoize((date) => {
|
|
674
774
|
if (!date)
|
|
675
775
|
return "";
|
|
@@ -692,130 +792,6 @@ var __publicField = (obj, key, value) => {
|
|
|
692
792
|
return getLocalDateString(date);
|
|
693
793
|
return relative.format(days, "days");
|
|
694
794
|
});
|
|
695
|
-
class DeferredPromise {
|
|
696
|
-
constructor() {
|
|
697
|
-
__publicField(this, _a, "Promise");
|
|
698
|
-
__publicField(this, "_promise");
|
|
699
|
-
__publicField(this, "_resolve");
|
|
700
|
-
__publicField(this, "_reject");
|
|
701
|
-
__publicField(this, "_state", "pending");
|
|
702
|
-
this._resolve = null;
|
|
703
|
-
this._reject = null;
|
|
704
|
-
this._promise = new Promise((resolve, reject) => {
|
|
705
|
-
this._resolve = resolve;
|
|
706
|
-
this._reject = reject;
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
get state() {
|
|
710
|
-
return this._state;
|
|
711
|
-
}
|
|
712
|
-
then(onFulfilled, onRejected) {
|
|
713
|
-
return this._promise.then(onFulfilled, onRejected);
|
|
714
|
-
}
|
|
715
|
-
catch(onRejected) {
|
|
716
|
-
return this._promise.catch(onRejected);
|
|
717
|
-
}
|
|
718
|
-
resolve(value) {
|
|
719
|
-
if (!this._resolve)
|
|
720
|
-
throw new Error("No resolve callback");
|
|
721
|
-
this._resolve(value);
|
|
722
|
-
this._state = "fulfilled";
|
|
723
|
-
}
|
|
724
|
-
reject(reason) {
|
|
725
|
-
if (!this._reject)
|
|
726
|
-
throw reason;
|
|
727
|
-
this._reject(reason);
|
|
728
|
-
this._state = "rejected";
|
|
729
|
-
}
|
|
730
|
-
finally(_onFinally) {
|
|
731
|
-
throw new Error("`finally` not implemented");
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
_a = Symbol.toStringTag;
|
|
735
|
-
var randomString = function randomString2() {
|
|
736
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
737
|
-
};
|
|
738
|
-
({
|
|
739
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
740
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
741
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
742
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
function compose() {
|
|
746
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
747
|
-
funcs[_key] = arguments[_key];
|
|
748
|
-
}
|
|
749
|
-
if (funcs.length === 0) {
|
|
750
|
-
return function(arg) {
|
|
751
|
-
return arg;
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
if (funcs.length === 1) {
|
|
755
|
-
return funcs[0];
|
|
756
|
-
}
|
|
757
|
-
return funcs.reduce(function(a, b) {
|
|
758
|
-
return function() {
|
|
759
|
-
return a(b.apply(void 0, arguments));
|
|
760
|
-
};
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
764
|
-
const latestVersion = () => migrations.length - 1;
|
|
765
|
-
const initialVersioning = (state) => {
|
|
766
|
-
state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
|
|
767
|
-
return state;
|
|
768
|
-
};
|
|
769
|
-
const signOut = () => {
|
|
770
|
-
return initialVersioning({});
|
|
771
|
-
};
|
|
772
|
-
const createOutboxState = (state) => {
|
|
773
|
-
if (state.outboxReducer) {
|
|
774
|
-
state.outboxReducer.deletedRequests = [];
|
|
775
|
-
}
|
|
776
|
-
return state;
|
|
777
|
-
};
|
|
778
|
-
const wrapMigration = (migrator) => (state) => {
|
|
779
|
-
var _a2;
|
|
780
|
-
if (state === void 0) {
|
|
781
|
-
state = {};
|
|
782
|
-
}
|
|
783
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
784
|
-
return state;
|
|
785
|
-
return migrator(state);
|
|
786
|
-
};
|
|
787
|
-
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
788
|
-
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
789
|
-
const initialState$B = {
|
|
790
|
-
accessToken: "",
|
|
791
|
-
refreshToken: "",
|
|
792
|
-
isLoggedIn: false
|
|
793
|
-
};
|
|
794
|
-
const authSlice = toolkit.createSlice({
|
|
795
|
-
name: "auth",
|
|
796
|
-
initialState: initialState$B,
|
|
797
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
798
|
-
reducers: {
|
|
799
|
-
setTokens: (state, action) => {
|
|
800
|
-
state.accessToken = action.payload.accessToken;
|
|
801
|
-
state.refreshToken = action.payload.refreshToken;
|
|
802
|
-
},
|
|
803
|
-
clearTokens: (state) => {
|
|
804
|
-
state.accessToken = "";
|
|
805
|
-
state.refreshToken = "";
|
|
806
|
-
},
|
|
807
|
-
setLoggedIn: (state, action) => {
|
|
808
|
-
if (!action.payload) {
|
|
809
|
-
authSlice.caseReducers.clearTokens(state);
|
|
810
|
-
}
|
|
811
|
-
state.isLoggedIn = action.payload;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
816
|
-
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
817
|
-
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
818
|
-
const authReducer = authSlice.reducer;
|
|
819
795
|
function createModelAdapter(computeModelId) {
|
|
820
796
|
const addOne = (state, action) => {
|
|
821
797
|
const id = computeModelId(action.payload);
|
|
@@ -1048,72 +1024,61 @@ var __publicField = (obj, key, value) => {
|
|
|
1048
1024
|
)
|
|
1049
1025
|
);
|
|
1050
1026
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
const initialState$x = assetStageCompletionAdapter.getInitialState({});
|
|
1027
|
+
const initialState$x = {
|
|
1028
|
+
completionsByAssetId: {}
|
|
1029
|
+
};
|
|
1055
1030
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1056
1031
|
name: "assetStageCompletions",
|
|
1057
1032
|
initialState: initialState$x,
|
|
1058
1033
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1059
1034
|
reducers: {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1035
|
+
addStageCompletion: (state, action) => {
|
|
1036
|
+
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
1037
|
+
if (!stageToCompletionDateMapping) {
|
|
1038
|
+
stageToCompletionDateMapping = {};
|
|
1039
|
+
state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
|
|
1040
|
+
}
|
|
1041
|
+
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1042
|
+
},
|
|
1043
|
+
addStageCompletions: (state, action) => {
|
|
1044
|
+
for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1045
|
+
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1046
|
+
throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
|
|
1047
|
+
let thisAssetCompletions = state.completionsByAssetId[assetId];
|
|
1048
|
+
if (thisAssetCompletions === void 0) {
|
|
1049
|
+
thisAssetCompletions = {};
|
|
1050
|
+
}
|
|
1051
|
+
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1052
|
+
thisAssetCompletions[stageId] = completionDate;
|
|
1053
|
+
}
|
|
1054
|
+
state.completionsByAssetId[assetId] = thisAssetCompletions;
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
removeStageCompletions: (state, action) => {
|
|
1058
|
+
for (const completion of action.payload) {
|
|
1059
|
+
const thisAssetCompletions = state.completionsByAssetId[completion.asset];
|
|
1060
|
+
if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
|
|
1061
|
+
console.warn(
|
|
1062
|
+
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1063
|
+
);
|
|
1064
|
+
continue;
|
|
1065
|
+
}
|
|
1066
|
+
delete thisAssetCompletions[completion.stage];
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
setStageCompletions: (state, action) => {
|
|
1070
|
+
state.completionsByAssetId = action.payload;
|
|
1071
|
+
}
|
|
1067
1072
|
}
|
|
1068
1073
|
});
|
|
1069
|
-
const {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
addAssetStageCompletions,
|
|
1073
|
-
updateAssetStageCompletion,
|
|
1074
|
-
updateAssetStageCompletions,
|
|
1075
|
-
deleteAssetStageCompletion,
|
|
1076
|
-
deleteAssetStageCompletions
|
|
1077
|
-
} = assetStageCompletionSlice.actions;
|
|
1078
|
-
const selectAssetStageCompletionMapping = (state) => {
|
|
1079
|
-
return state.assetStageCompletionReducer.instances;
|
|
1074
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
|
|
1075
|
+
const selectCompletedStages = (state) => {
|
|
1076
|
+
return state.assetStageCompletionReducer.completionsByAssetId;
|
|
1080
1077
|
};
|
|
1081
|
-
const selectCompletedStagesByAsset = toolkit.createSelector(
|
|
1082
|
-
[selectAssetStageCompletionMapping],
|
|
1083
|
-
(completedStagesMapping) => {
|
|
1084
|
-
const completedStagesByAsset = {};
|
|
1085
|
-
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
1086
|
-
const { asset, stage, submitted_at } = stageCompletion;
|
|
1087
|
-
if (!completedStagesByAsset[asset])
|
|
1088
|
-
completedStagesByAsset[asset] = {};
|
|
1089
|
-
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1090
|
-
}
|
|
1091
|
-
return completedStagesByAsset;
|
|
1092
|
-
}
|
|
1093
|
-
);
|
|
1094
1078
|
const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
|
|
1095
|
-
toolkit.createSelector(
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1099
|
-
}
|
|
1100
|
-
)
|
|
1101
|
-
);
|
|
1102
|
-
const selectAssetStageCompletionById = (id) => (state) => {
|
|
1103
|
-
return state.assetStageCompletionReducer.instances[id];
|
|
1104
|
-
};
|
|
1105
|
-
const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
|
|
1106
|
-
toolkit.createSelector(
|
|
1107
|
-
[selectAssetStageCompletionMapping, (_, stageCompletionIds) => stageCompletionIds],
|
|
1108
|
-
(stageCompletionMapping, stageCompletionIds) => {
|
|
1109
|
-
const stageCompletionIdsSet = new Set(stageCompletionIds);
|
|
1110
|
-
return fallbackToEmptyArray(
|
|
1111
|
-
Object.values(stageCompletionMapping).filter(
|
|
1112
|
-
(stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
|
|
1113
|
-
)
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
)
|
|
1079
|
+
toolkit.createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
|
|
1080
|
+
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1081
|
+
})
|
|
1117
1082
|
);
|
|
1118
1083
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1119
1084
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
@@ -1123,29 +1088,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1123
1088
|
initialState: initialState$w,
|
|
1124
1089
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1125
1090
|
reducers: {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
updateAssetStages: assetStageAdapter.updateMany,
|
|
1133
|
-
deleteAssetStage: assetStageAdapter.deleteOne,
|
|
1134
|
-
deleteAssetStages: assetStageAdapter.deleteMany
|
|
1091
|
+
initializeStages: assetStageAdapter.initialize,
|
|
1092
|
+
setStage: assetStageAdapter.setOne,
|
|
1093
|
+
addStages: assetStageAdapter.addMany,
|
|
1094
|
+
updateStage: assetStageAdapter.updateOne,
|
|
1095
|
+
updateStages: assetStageAdapter.updateMany,
|
|
1096
|
+
removeStages: assetStageAdapter.deleteMany
|
|
1135
1097
|
}
|
|
1136
1098
|
});
|
|
1137
|
-
const {
|
|
1138
|
-
initializeAssetStages,
|
|
1139
|
-
setAssetStage,
|
|
1140
|
-
setAssetStages,
|
|
1141
|
-
addAssetStage,
|
|
1142
|
-
addAssetStages,
|
|
1143
|
-
updateAssetStage,
|
|
1144
|
-
updateAssetStages,
|
|
1145
|
-
deleteAssetStage,
|
|
1146
|
-
deleteAssetStages
|
|
1147
|
-
} = assetStageSlice.actions;
|
|
1148
|
-
const assetStageReducer = assetStageSlice.reducer;
|
|
1149
1099
|
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
1150
1100
|
const selectAssetStageById = (id) => (state) => {
|
|
1151
1101
|
return state.assetStageReducer.instances[id];
|
|
@@ -1153,6 +1103,24 @@ var __publicField = (obj, key, value) => {
|
|
|
1153
1103
|
const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
|
|
1154
1104
|
return Object.values(stageMapping);
|
|
1155
1105
|
});
|
|
1106
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
1107
|
+
toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
1108
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
1109
|
+
const ret = {};
|
|
1110
|
+
for (const stage of stages) {
|
|
1111
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
1112
|
+
if (!ret[stage.asset_type]) {
|
|
1113
|
+
ret[stage.asset_type] = [];
|
|
1114
|
+
}
|
|
1115
|
+
ret[stage.asset_type].push(stage);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
for (const key in ret) {
|
|
1119
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1120
|
+
}
|
|
1121
|
+
return ret;
|
|
1122
|
+
})
|
|
1123
|
+
);
|
|
1156
1124
|
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1157
1125
|
toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
1158
1126
|
const assetTypeStagesMapping = {};
|
|
@@ -1200,6 +1168,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1200
1168
|
return ret;
|
|
1201
1169
|
})
|
|
1202
1170
|
);
|
|
1171
|
+
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
1172
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
1203
1173
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1204
1174
|
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1205
1175
|
const assetTypeSlice = toolkit.createSlice({
|
|
@@ -1208,27 +1178,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1208
1178
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1209
1179
|
reducers: {
|
|
1210
1180
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1211
|
-
setAssetType: assetTypeAdapter.setOne,
|
|
1212
|
-
setAssetTypes: assetTypeAdapter.setMany,
|
|
1213
1181
|
addAssetType: assetTypeAdapter.addOne,
|
|
1214
|
-
|
|
1215
|
-
updateAssetType: assetTypeAdapter.updateOne,
|
|
1216
|
-
updateAssetTypes: assetTypeAdapter.updateMany,
|
|
1217
|
-
deleteAssetType: assetTypeAdapter.deleteOne,
|
|
1218
|
-
deleteAssetTypes: assetTypeAdapter.deleteMany
|
|
1182
|
+
deleteAssetType: assetTypeAdapter.deleteOne
|
|
1219
1183
|
}
|
|
1220
1184
|
});
|
|
1221
|
-
const {
|
|
1222
|
-
initializeAssetTypes,
|
|
1223
|
-
setAssetType,
|
|
1224
|
-
setAssetTypes,
|
|
1225
|
-
addAssetType,
|
|
1226
|
-
addAssetTypes,
|
|
1227
|
-
updateAssetType,
|
|
1228
|
-
updateAssetTypes,
|
|
1229
|
-
deleteAssetType,
|
|
1230
|
-
deleteAssetTypes
|
|
1231
|
-
} = assetTypeSlice.actions;
|
|
1185
|
+
const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
|
|
1232
1186
|
const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
|
|
1233
1187
|
const selectAssetTypes = toolkit.createSelector(
|
|
1234
1188
|
[selectAssetTypesMapping],
|
|
@@ -1616,6 +1570,60 @@ var __publicField = (obj, key, value) => {
|
|
|
1616
1570
|
return url;
|
|
1617
1571
|
};
|
|
1618
1572
|
const fileReducer = fileSlice.reducer;
|
|
1573
|
+
var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
|
|
1574
|
+
ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1575
|
+
ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1576
|
+
return ProjectAccessLevel2;
|
|
1577
|
+
})(ProjectAccessLevel || {});
|
|
1578
|
+
var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
1579
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1580
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1581
|
+
return OrganizationAccessLevel2;
|
|
1582
|
+
})(OrganizationAccessLevel || {});
|
|
1583
|
+
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
1584
|
+
AttachmentModel2["Issue"] = "issue";
|
|
1585
|
+
AttachmentModel2["Asset"] = "asset";
|
|
1586
|
+
AttachmentModel2["AssetType"] = "asset_type";
|
|
1587
|
+
AttachmentModel2["Project"] = "project";
|
|
1588
|
+
AttachmentModel2["Document"] = "document";
|
|
1589
|
+
return AttachmentModel2;
|
|
1590
|
+
})(AttachmentModel || {});
|
|
1591
|
+
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
1592
|
+
IssueUpdateChange2["STATUS"] = "status";
|
|
1593
|
+
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
1594
|
+
IssueUpdateChange2["CATEGORY"] = "category";
|
|
1595
|
+
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
1596
|
+
IssueUpdateChange2["TITLE"] = "title";
|
|
1597
|
+
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
1598
|
+
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
1599
|
+
return IssueUpdateChange2;
|
|
1600
|
+
})(IssueUpdateChange || {});
|
|
1601
|
+
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
1602
|
+
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
1603
|
+
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
1604
|
+
VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
|
|
1605
|
+
VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
|
|
1606
|
+
VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
|
|
1607
|
+
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
1608
|
+
return VerificationCodeType2;
|
|
1609
|
+
})(VerificationCodeType || {});
|
|
1610
|
+
var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
|
|
1611
|
+
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
1612
|
+
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
1613
|
+
return PaddleCheckoutEvent2;
|
|
1614
|
+
})(PaddleCheckoutEvent || {});
|
|
1615
|
+
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
1616
|
+
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
1617
|
+
return LicenseLevel2;
|
|
1618
|
+
})(LicenseLevel || {});
|
|
1619
|
+
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
1620
|
+
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
1621
|
+
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
1622
|
+
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
1623
|
+
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
1624
|
+
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
1625
|
+
return LicenseStatus2;
|
|
1626
|
+
})(LicenseStatus || {});
|
|
1619
1627
|
const initialState$p = {
|
|
1620
1628
|
users: {},
|
|
1621
1629
|
currentUser: {
|
|
@@ -4157,70 +4165,42 @@ var __publicField = (obj, key, value) => {
|
|
|
4157
4165
|
}
|
|
4158
4166
|
class AssetService extends BaseApiService {
|
|
4159
4167
|
// Basic CRUD functions
|
|
4160
|
-
add(
|
|
4161
|
-
|
|
4162
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4168
|
+
add(asset, workspaceId) {
|
|
4169
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4163
4170
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4164
4171
|
}
|
|
4165
|
-
const
|
|
4166
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4167
|
-
const offlineAsset = offline({
|
|
4168
|
-
...payload,
|
|
4169
|
-
created_by: createdBy,
|
|
4170
|
-
submitted_at: submittedAt
|
|
4171
|
-
});
|
|
4172
|
+
const offlineAsset = offline(asset);
|
|
4172
4173
|
this.dispatch(addAsset(offlineAsset));
|
|
4173
4174
|
const promise = this.enqueueRequest({
|
|
4174
4175
|
description: "Create asset",
|
|
4175
4176
|
method: HttpMethod.POST,
|
|
4176
|
-
url:
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
submitted_at: offlineAsset.submitted_at,
|
|
4180
|
-
geo_marker: offlineAsset.geo_marker,
|
|
4181
|
-
canvas_marker: offlineAsset.canvas_marker,
|
|
4182
|
-
label: offlineAsset.label,
|
|
4183
|
-
description: offlineAsset.description,
|
|
4184
|
-
asset_type: offlineAsset.asset_type
|
|
4177
|
+
url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
|
|
4178
|
+
queryParams: {
|
|
4179
|
+
workspace_id: workspaceId.toString()
|
|
4185
4180
|
},
|
|
4186
|
-
|
|
4181
|
+
payload: { assets: [offlineAsset] },
|
|
4182
|
+
blockers: [],
|
|
4187
4183
|
blocks: [offlineAsset.offline_id]
|
|
4188
4184
|
});
|
|
4189
|
-
promise.then((createdAsset) => {
|
|
4190
|
-
this.dispatch(updateAsset(createdAsset));
|
|
4191
|
-
}).catch(() => {
|
|
4192
|
-
this.dispatch(deleteAsset(offlineAsset.offline_id));
|
|
4193
|
-
});
|
|
4194
4185
|
return [offlineAsset, promise];
|
|
4195
4186
|
}
|
|
4196
|
-
update(
|
|
4197
|
-
|
|
4198
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4187
|
+
update(asset, workspaceId) {
|
|
4188
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4199
4189
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4200
4190
|
}
|
|
4201
|
-
|
|
4202
|
-
if (!asset) {
|
|
4203
|
-
throw new Error(`No asset with id ${payload.offline_id} found in the store`);
|
|
4204
|
-
}
|
|
4205
|
-
const updatedAsset = {
|
|
4206
|
-
...asset,
|
|
4207
|
-
...payload
|
|
4208
|
-
};
|
|
4209
|
-
this.dispatch(updateAsset(updatedAsset));
|
|
4191
|
+
this.client.store.dispatch(updateAsset(asset));
|
|
4210
4192
|
const promise = this.enqueueRequest({
|
|
4211
4193
|
description: "Edit asset",
|
|
4212
4194
|
method: HttpMethod.PATCH,
|
|
4213
|
-
url: `/assets/${
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
}).catch(() => {
|
|
4221
|
-
this.dispatch(updateAsset(asset));
|
|
4195
|
+
url: `/assets/${asset.offline_id}/`,
|
|
4196
|
+
queryParams: {
|
|
4197
|
+
workspace_id: workspaceId.toString()
|
|
4198
|
+
},
|
|
4199
|
+
payload: asset,
|
|
4200
|
+
blockers: [asset.offline_id],
|
|
4201
|
+
blocks: [asset.offline_id]
|
|
4222
4202
|
});
|
|
4223
|
-
return [
|
|
4203
|
+
return [asset, promise];
|
|
4224
4204
|
}
|
|
4225
4205
|
async remove(assetId) {
|
|
4226
4206
|
const { store } = this.client;
|
|
@@ -4258,17 +4238,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4258
4238
|
throw err;
|
|
4259
4239
|
});
|
|
4260
4240
|
}
|
|
4261
|
-
|
|
4241
|
+
async deleteAllAssetsOfAssetType(assetTypeId) {
|
|
4242
|
+
const { store } = this.client;
|
|
4243
|
+
const state = store.getState();
|
|
4244
|
+
const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4245
|
+
const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
|
|
4246
|
+
const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
|
|
4247
|
+
store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
|
|
4248
|
+
return this.enqueueRequest({
|
|
4249
|
+
description: "Delete all assets of asset type",
|
|
4250
|
+
method: HttpMethod.DELETE,
|
|
4251
|
+
url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
|
|
4252
|
+
blockers: affectedOfflineIds,
|
|
4253
|
+
blocks: affectedOfflineIds
|
|
4254
|
+
}).catch((err) => {
|
|
4255
|
+
store.dispatch(addAssets(allAssetsOfAssetType));
|
|
4256
|
+
throw err;
|
|
4257
|
+
});
|
|
4258
|
+
}
|
|
4259
|
+
// TODO: payload does not require asset_type
|
|
4260
|
+
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
4262
4261
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4263
4262
|
const transactionId = uuid.v4();
|
|
4264
|
-
const assetBatches = chunkArray(
|
|
4265
|
-
const assetPayloads = assetBatch.map((assetPayload) =>
|
|
4263
|
+
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
4264
|
+
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
4265
|
+
return offline({
|
|
4266
|
+
...assetPayload,
|
|
4267
|
+
submitted_at: submittedAt
|
|
4268
|
+
});
|
|
4269
|
+
});
|
|
4266
4270
|
return {
|
|
4267
4271
|
batchId: uuid.v4(),
|
|
4268
4272
|
payload: {
|
|
4269
4273
|
transaction_id: transactionId,
|
|
4270
|
-
submitted_at: submittedAt,
|
|
4271
|
-
asset_type: assetTypeId,
|
|
4272
4274
|
assets: assetPayloads
|
|
4273
4275
|
}
|
|
4274
4276
|
};
|
|
@@ -4286,7 +4288,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4286
4288
|
const promise = this.enqueueRequest({
|
|
4287
4289
|
description: "Batch create assets",
|
|
4288
4290
|
method: HttpMethod.POST,
|
|
4289
|
-
url:
|
|
4291
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
4292
|
+
queryParams: {
|
|
4293
|
+
workspace_id: workspaceId.toString()
|
|
4294
|
+
},
|
|
4290
4295
|
payload,
|
|
4291
4296
|
blockers,
|
|
4292
4297
|
blocks: blocks2
|
|
@@ -4312,152 +4317,117 @@ var __publicField = (obj, key, value) => {
|
|
|
4312
4317
|
}
|
|
4313
4318
|
}
|
|
4314
4319
|
class AssetStageCompletionService extends BaseApiService {
|
|
4315
|
-
add(
|
|
4320
|
+
add(assetId, stageId) {
|
|
4321
|
+
var _a2;
|
|
4316
4322
|
const { store } = this.client;
|
|
4317
|
-
const
|
|
4318
|
-
|
|
4323
|
+
const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
|
|
4324
|
+
if (!assetTypeId) {
|
|
4325
|
+
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
4326
|
+
}
|
|
4319
4327
|
const offlineStageCompletion = offline({
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
submitted_at: submittedAt
|
|
4328
|
+
asset: assetId,
|
|
4329
|
+
stage: stageId
|
|
4323
4330
|
});
|
|
4324
|
-
this.dispatch(
|
|
4331
|
+
this.dispatch(addStageCompletion(offlineStageCompletion));
|
|
4325
4332
|
const promise = this.enqueueRequest({
|
|
4326
|
-
description: "
|
|
4333
|
+
description: "Complete stage",
|
|
4327
4334
|
method: HttpMethod.POST,
|
|
4328
|
-
url:
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
asset: payload.asset,
|
|
4333
|
-
stage: payload.stage
|
|
4334
|
-
},
|
|
4335
|
-
blockers: [payload.asset, payload.stage],
|
|
4335
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4336
|
+
// TODO: Add submitted_at to model
|
|
4337
|
+
payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
4338
|
+
blockers: [assetId, stageId],
|
|
4336
4339
|
blocks: [offlineStageCompletion.offline_id]
|
|
4337
4340
|
});
|
|
4338
|
-
promise.then((result) => {
|
|
4339
|
-
this.dispatch(updateAssetStageCompletion(result));
|
|
4340
|
-
}).catch(() => {
|
|
4341
|
-
this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
|
|
4342
|
-
});
|
|
4343
4341
|
return [offlineStageCompletion, promise];
|
|
4344
4342
|
}
|
|
4345
|
-
|
|
4346
|
-
const
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
this.dispatch(deleteAssetStageCompletion(id));
|
|
4352
|
-
const promise = this.enqueueRequest({
|
|
4353
|
-
description: "Delete asset stage completion",
|
|
4354
|
-
method: HttpMethod.DELETE,
|
|
4355
|
-
url: `/assets/completions/${id}/`,
|
|
4356
|
-
blockers: [id],
|
|
4343
|
+
async refreshStore(projectId) {
|
|
4344
|
+
const result = await this.enqueueRequest({
|
|
4345
|
+
description: "Get stage completions",
|
|
4346
|
+
method: HttpMethod.GET,
|
|
4347
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4348
|
+
blockers: [],
|
|
4357
4349
|
blocks: []
|
|
4358
4350
|
});
|
|
4359
|
-
|
|
4360
|
-
this.dispatch(addAssetStageCompletion(assetStageCompletion));
|
|
4361
|
-
});
|
|
4362
|
-
return promise;
|
|
4351
|
+
this.dispatch(addStageCompletions(result));
|
|
4363
4352
|
}
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
}
|
|
4376
|
-
const
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4353
|
+
/**
|
|
4354
|
+
* Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
|
|
4355
|
+
* assets. It's REQUIRED that all assets referenced all have the SAME asset type.
|
|
4356
|
+
* @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
|
|
4357
|
+
* stages for one asset type at a time)
|
|
4358
|
+
* @param stageCompletions
|
|
4359
|
+
*/
|
|
4360
|
+
async bulkAdd(assetTypeId, stageCompletions) {
|
|
4361
|
+
const offlineStageCompletions = stageCompletions.map((completion) => {
|
|
4362
|
+
return offline(completion);
|
|
4363
|
+
});
|
|
4364
|
+
const asMapping = {};
|
|
4365
|
+
for (const completion of stageCompletions) {
|
|
4366
|
+
const stageToCompletionDateMapping = asMapping[completion.asset] || {};
|
|
4367
|
+
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
4368
|
+
asMapping[completion.asset] = stageToCompletionDateMapping;
|
|
4369
|
+
}
|
|
4370
|
+
this.dispatch(addStageCompletions(asMapping));
|
|
4371
|
+
await this.enqueueRequest({
|
|
4372
|
+
description: "Bulk complete stages",
|
|
4380
4373
|
method: HttpMethod.POST,
|
|
4381
|
-
url:
|
|
4374
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4382
4375
|
payload: {
|
|
4383
|
-
|
|
4384
|
-
completions: payload
|
|
4376
|
+
completions: offlineStageCompletions
|
|
4385
4377
|
},
|
|
4386
|
-
blockers: [...
|
|
4387
|
-
blocks:
|
|
4388
|
-
});
|
|
4389
|
-
promise.then((result) => {
|
|
4390
|
-
this.dispatch(updateAssetStageCompletions(result));
|
|
4391
|
-
}).catch(() => {
|
|
4392
|
-
this.dispatch(deleteAssetStageCompletions(offlineIds));
|
|
4378
|
+
blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
|
|
4379
|
+
blocks: offlineStageCompletions.map((c) => c.offline_id)
|
|
4393
4380
|
});
|
|
4394
|
-
return [offlineStageCompletions, promise];
|
|
4395
4381
|
}
|
|
4396
|
-
bulkDelete(
|
|
4397
|
-
const
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4382
|
+
bulkDelete(stageId, assetIds) {
|
|
4383
|
+
const stageCompletionsToRemove = assetIds.map((assetId) => {
|
|
4384
|
+
return {
|
|
4385
|
+
asset: assetId,
|
|
4386
|
+
stage: stageId
|
|
4387
|
+
};
|
|
4388
|
+
});
|
|
4389
|
+
this.dispatch(removeStageCompletions(stageCompletionsToRemove));
|
|
4390
|
+
return this.enqueueRequest({
|
|
4391
|
+
description: `Undo stage for ${assetIds.length} assets(s)`,
|
|
4392
|
+
// TODO: Rename to setCompletedStages
|
|
4402
4393
|
method: HttpMethod.DELETE,
|
|
4403
|
-
url:
|
|
4394
|
+
url: `/assets/stages/${stageId}/undo-stages/`,
|
|
4404
4395
|
payload: {
|
|
4405
|
-
|
|
4396
|
+
assets: assetIds
|
|
4406
4397
|
},
|
|
4407
|
-
blockers:
|
|
4408
|
-
blocks: []
|
|
4409
|
-
});
|
|
4410
|
-
promise.catch(() => {
|
|
4411
|
-
this.dispatch(addAssetStageCompletions(assetStageCompletions));
|
|
4412
|
-
});
|
|
4413
|
-
return promise;
|
|
4414
|
-
}
|
|
4415
|
-
async refreshStore(projectId) {
|
|
4416
|
-
const result = await this.enqueueRequest({
|
|
4417
|
-
description: "Get asset stage completions",
|
|
4418
|
-
method: HttpMethod.GET,
|
|
4419
|
-
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4420
|
-
blockers: [],
|
|
4398
|
+
blockers: [stageId, ...assetIds],
|
|
4421
4399
|
blocks: []
|
|
4422
4400
|
});
|
|
4423
|
-
this.dispatch(initializeAssetStageCompletions(result));
|
|
4424
4401
|
}
|
|
4425
4402
|
}
|
|
4426
4403
|
class AssetStageService extends BaseApiService {
|
|
4427
|
-
|
|
4428
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4429
|
-
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
4404
|
+
async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
|
|
4430
4405
|
const payload = stagesToSubmit.map((stage) => {
|
|
4431
4406
|
return offline(stage);
|
|
4432
4407
|
});
|
|
4433
|
-
const
|
|
4434
|
-
return { ...stage, asset_type: assetTypeId
|
|
4408
|
+
const fullStages = payload.map((stage) => {
|
|
4409
|
+
return { ...stage, asset_type: assetTypeId };
|
|
4435
4410
|
});
|
|
4436
|
-
this.dispatch(
|
|
4437
|
-
|
|
4411
|
+
this.dispatch(addStages(fullStages));
|
|
4412
|
+
return this.enqueueRequest({
|
|
4438
4413
|
description: "Add asset stages",
|
|
4439
4414
|
method: HttpMethod.POST,
|
|
4440
|
-
url:
|
|
4415
|
+
url: `/assets/types/${assetTypeId}/add-stages/`,
|
|
4441
4416
|
payload: {
|
|
4442
|
-
submitted_at: submittedAt,
|
|
4443
|
-
asset_type: assetTypeId,
|
|
4444
4417
|
stages: payload
|
|
4445
4418
|
},
|
|
4446
|
-
|
|
4419
|
+
queryParams: {
|
|
4420
|
+
workspace_id: workspaceId.toString()
|
|
4421
|
+
},
|
|
4422
|
+
blockers: [assetTypeId, workspaceId],
|
|
4447
4423
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
4448
4424
|
});
|
|
4449
|
-
promise.then((result) => {
|
|
4450
|
-
this.dispatch(updateAssetStages(result));
|
|
4451
|
-
}).catch(() => {
|
|
4452
|
-
this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
|
|
4453
|
-
});
|
|
4454
|
-
return [offlineStages, promise];
|
|
4455
4425
|
}
|
|
4456
|
-
async
|
|
4426
|
+
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
4457
4427
|
const store = this.client.store;
|
|
4458
4428
|
const state = store.getState();
|
|
4459
4429
|
const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
|
|
4460
|
-
this.dispatch(
|
|
4430
|
+
this.dispatch(updateStages(stagesToUpdate));
|
|
4461
4431
|
return this.enqueueRequest({
|
|
4462
4432
|
description: "Edit asset stages",
|
|
4463
4433
|
method: HttpMethod.PATCH,
|
|
@@ -4468,58 +4438,33 @@ var __publicField = (obj, key, value) => {
|
|
|
4468
4438
|
blockers: [assetTypeId],
|
|
4469
4439
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
4470
4440
|
}).catch((e) => {
|
|
4471
|
-
|
|
4441
|
+
store.dispatch(updateStages(prevStages));
|
|
4472
4442
|
throw e;
|
|
4473
4443
|
});
|
|
4474
4444
|
}
|
|
4475
4445
|
async bulkDelete(idsToDelete) {
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
this.dispatch(deleteAssetStages(idsToDelete));
|
|
4479
|
-
const promise = this.enqueueRequest({
|
|
4446
|
+
this.dispatch(removeStages(idsToDelete));
|
|
4447
|
+
return this.enqueueRequest({
|
|
4480
4448
|
description: "Delete asset stages",
|
|
4481
4449
|
method: HttpMethod.DELETE,
|
|
4482
|
-
url: "/assets/stages/bulk/",
|
|
4450
|
+
url: "/assets/stages/bulk-delete/",
|
|
4483
4451
|
payload: {
|
|
4484
4452
|
stage_ids: idsToDelete
|
|
4485
4453
|
},
|
|
4486
4454
|
blockers: idsToDelete,
|
|
4487
4455
|
blocks: []
|
|
4488
4456
|
});
|
|
4489
|
-
promise.catch(() => {
|
|
4490
|
-
this.dispatch(addAssetStages(assetStages));
|
|
4491
|
-
});
|
|
4492
|
-
return promise;
|
|
4493
4457
|
}
|
|
4494
|
-
update(
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
if (!assetStage)
|
|
4498
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4499
|
-
const updatedAssetStage = {
|
|
4500
|
-
...assetStage,
|
|
4501
|
-
...payload
|
|
4502
|
-
};
|
|
4503
|
-
this.dispatch(updateAssetStage(updatedAssetStage));
|
|
4504
|
-
const promise = this.enqueueRequest({
|
|
4458
|
+
async update(assetStage) {
|
|
4459
|
+
this.dispatch(addStages([assetStage]));
|
|
4460
|
+
return this.enqueueRequest({
|
|
4505
4461
|
description: "Update asset stage",
|
|
4506
4462
|
method: HttpMethod.PATCH,
|
|
4507
4463
|
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
4508
|
-
payload:
|
|
4509
|
-
name: payload.name,
|
|
4510
|
-
description: payload.description,
|
|
4511
|
-
priority: payload.priority,
|
|
4512
|
-
color: payload.color
|
|
4513
|
-
},
|
|
4464
|
+
payload: assetStage,
|
|
4514
4465
|
blockers: [assetStage.offline_id],
|
|
4515
4466
|
blocks: [assetStage.offline_id]
|
|
4516
4467
|
});
|
|
4517
|
-
promise.then((result) => {
|
|
4518
|
-
this.dispatch(updateAssetStage(result));
|
|
4519
|
-
}).catch(() => {
|
|
4520
|
-
this.dispatch(setAssetStage(assetStage));
|
|
4521
|
-
});
|
|
4522
|
-
return [updatedAssetStage, promise];
|
|
4523
4468
|
}
|
|
4524
4469
|
async linkForm(stageId, formId) {
|
|
4525
4470
|
const { store } = this.client;
|
|
@@ -4527,7 +4472,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4527
4472
|
if (!stage) {
|
|
4528
4473
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4529
4474
|
}
|
|
4530
|
-
this.dispatch(
|
|
4475
|
+
this.dispatch(updateStage({ ...stage, form: formId }));
|
|
4531
4476
|
try {
|
|
4532
4477
|
await this.enqueueRequest({
|
|
4533
4478
|
description: "Link asset stage to form",
|
|
@@ -4538,7 +4483,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4538
4483
|
blocks: [stageId]
|
|
4539
4484
|
});
|
|
4540
4485
|
} catch (e) {
|
|
4541
|
-
this.dispatch(
|
|
4486
|
+
this.dispatch(setStage(stage));
|
|
4542
4487
|
throw e;
|
|
4543
4488
|
}
|
|
4544
4489
|
}
|
|
@@ -4548,7 +4493,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4548
4493
|
if (!stage) {
|
|
4549
4494
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4550
4495
|
}
|
|
4551
|
-
this.dispatch(
|
|
4496
|
+
this.dispatch(updateStage({ ...stage, form: void 0 }));
|
|
4552
4497
|
try {
|
|
4553
4498
|
await this.enqueueRequest({
|
|
4554
4499
|
description: "Unlink asset stage from form",
|
|
@@ -4558,7 +4503,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4558
4503
|
blocks: [stageId]
|
|
4559
4504
|
});
|
|
4560
4505
|
} catch (e) {
|
|
4561
|
-
this.dispatch(
|
|
4506
|
+
this.dispatch(setStage(stage));
|
|
4562
4507
|
throw e;
|
|
4563
4508
|
}
|
|
4564
4509
|
}
|
|
@@ -4570,7 +4515,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4570
4515
|
blockers: [],
|
|
4571
4516
|
blocks: []
|
|
4572
4517
|
});
|
|
4573
|
-
this.dispatch(
|
|
4518
|
+
this.dispatch(initializeStages(result));
|
|
4574
4519
|
}
|
|
4575
4520
|
}
|
|
4576
4521
|
class BaseUploadService extends BaseApiService {
|
|
@@ -4777,61 +4722,29 @@ var __publicField = (obj, key, value) => {
|
|
|
4777
4722
|
}
|
|
4778
4723
|
}
|
|
4779
4724
|
class AssetTypeService extends BaseApiService {
|
|
4780
|
-
add(
|
|
4781
|
-
const
|
|
4782
|
-
const createdBy = store.getState().userReducer.currentUser.id;
|
|
4783
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4784
|
-
const offlineAssetType = offline({
|
|
4785
|
-
...payload,
|
|
4786
|
-
created_by: createdBy,
|
|
4787
|
-
submitted_at: submittedAt
|
|
4788
|
-
});
|
|
4725
|
+
add(assetType) {
|
|
4726
|
+
const offlineAssetType = offline(assetType);
|
|
4789
4727
|
this.dispatch(addAssetType(offlineAssetType));
|
|
4790
4728
|
const promise = this.enqueueRequest({
|
|
4791
4729
|
description: "Create asset type",
|
|
4792
4730
|
method: HttpMethod.POST,
|
|
4793
|
-
url: `/projects/${
|
|
4731
|
+
url: `/projects/${assetType.project}/asset-types/`,
|
|
4794
4732
|
payload: { ...offlineAssetType },
|
|
4795
4733
|
blockers: [],
|
|
4796
4734
|
blocks: [offlineAssetType.offline_id]
|
|
4797
4735
|
});
|
|
4798
|
-
promise.then((result) => {
|
|
4799
|
-
this.dispatch(updateAssetType(result));
|
|
4800
|
-
}).catch(() => {
|
|
4801
|
-
this.dispatch(deleteAssetType(offlineAssetType.offline_id));
|
|
4802
|
-
});
|
|
4803
4736
|
return [offlineAssetType, promise];
|
|
4804
4737
|
}
|
|
4805
|
-
update(
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
if (!assetType) {
|
|
4809
|
-
throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
|
|
4810
|
-
}
|
|
4811
|
-
const updatedAssetType = {
|
|
4812
|
-
...assetType,
|
|
4813
|
-
...payload
|
|
4814
|
-
};
|
|
4815
|
-
this.dispatch(updateAssetType(updatedAssetType));
|
|
4816
|
-
const promise = this.enqueueRequest({
|
|
4738
|
+
update(assetType) {
|
|
4739
|
+
this.dispatch(addAssetType(assetType));
|
|
4740
|
+
return this.enqueueRequest({
|
|
4817
4741
|
description: "Update asset type",
|
|
4818
4742
|
method: HttpMethod.PATCH,
|
|
4819
|
-
url: `/assets/types/${
|
|
4820
|
-
payload:
|
|
4821
|
-
icon: payload.icon,
|
|
4822
|
-
color: payload.color,
|
|
4823
|
-
name: payload.name,
|
|
4824
|
-
description: payload.description
|
|
4825
|
-
},
|
|
4743
|
+
url: `/assets/types/${assetType.offline_id}/`,
|
|
4744
|
+
payload: assetType,
|
|
4826
4745
|
blockers: [assetType.offline_id],
|
|
4827
4746
|
blocks: [assetType.offline_id]
|
|
4828
4747
|
});
|
|
4829
|
-
promise.then((result) => {
|
|
4830
|
-
this.dispatch(updateAssetType(result));
|
|
4831
|
-
}).catch(() => {
|
|
4832
|
-
this.dispatch(updateAssetType(assetType));
|
|
4833
|
-
});
|
|
4834
|
-
return [updatedAssetType, promise];
|
|
4835
4748
|
}
|
|
4836
4749
|
async delete(assetTypeId) {
|
|
4837
4750
|
const { store } = this.client;
|
|
@@ -4840,13 +4753,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4840
4753
|
if (!assetType) {
|
|
4841
4754
|
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
4842
4755
|
}
|
|
4843
|
-
const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4844
4756
|
const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
|
|
4845
4757
|
const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
|
|
4846
4758
|
this.dispatch(deleteAssetType(assetTypeId));
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4759
|
+
if (stagesOfAssetType.length > 0) {
|
|
4760
|
+
const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
|
|
4761
|
+
this.dispatch(removeStages(stagesOfAssetTypeIds));
|
|
4762
|
+
}
|
|
4763
|
+
if (attachmentsOfAssetType.length > 0) {
|
|
4764
|
+
const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
|
|
4765
|
+
this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
|
|
4766
|
+
}
|
|
4850
4767
|
return this.enqueueRequest({
|
|
4851
4768
|
description: "Delete asset type",
|
|
4852
4769
|
method: HttpMethod.DELETE,
|
|
@@ -4855,8 +4772,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4855
4772
|
blocks: []
|
|
4856
4773
|
}).catch((e) => {
|
|
4857
4774
|
this.dispatch(addAssetType(assetType));
|
|
4858
|
-
this.dispatch(
|
|
4859
|
-
this.dispatch(addAssetStages(stagesOfAssetType));
|
|
4775
|
+
this.dispatch(addStages(stagesOfAssetType));
|
|
4860
4776
|
this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
|
|
4861
4777
|
throw e;
|
|
4862
4778
|
});
|
|
@@ -5070,6 +4986,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5070
4986
|
void promise.then((result) => {
|
|
5071
4987
|
this.dispatch(updateIssue(result));
|
|
5072
4988
|
}).catch((error) => {
|
|
4989
|
+
var _a2;
|
|
4990
|
+
console.error(error);
|
|
4991
|
+
if (error instanceof APIError) {
|
|
4992
|
+
(_a2 = blocks.unsafeShowToast) == null ? void 0 : _a2.call(blocks, {
|
|
4993
|
+
title: "Could not create issue",
|
|
4994
|
+
description: error.message,
|
|
4995
|
+
accentColor: "red"
|
|
4996
|
+
});
|
|
4997
|
+
}
|
|
5073
4998
|
this.dispatch(deleteIssue(issuePayload.offline_id));
|
|
5074
4999
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5075
5000
|
throw error;
|
|
@@ -7625,19 +7550,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7625
7550
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7626
7551
|
}
|
|
7627
7552
|
}
|
|
7628
|
-
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
7629
|
-
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
7630
|
-
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
7631
|
-
VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
|
|
7632
|
-
VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
|
|
7633
|
-
VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
|
|
7634
|
-
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
7635
|
-
return VerificationCodeType2;
|
|
7636
|
-
})(VerificationCodeType || {});
|
|
7637
7553
|
exports2.APIError = APIError;
|
|
7638
7554
|
exports2.AgentService = AgentService;
|
|
7639
7555
|
exports2.AssetAttachmentService = AssetAttachmentService;
|
|
7640
7556
|
exports2.AssetService = AssetService;
|
|
7557
|
+
exports2.AssetStageColors = AssetStageColors;
|
|
7641
7558
|
exports2.AssetStageCompletionService = AssetStageCompletionService;
|
|
7642
7559
|
exports2.AssetStageService = AssetStageService;
|
|
7643
7560
|
exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
|
|
@@ -7699,14 +7616,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7699
7616
|
exports2.addAsset = addAsset;
|
|
7700
7617
|
exports2.addAssetAttachment = addAssetAttachment;
|
|
7701
7618
|
exports2.addAssetAttachments = addAssetAttachments;
|
|
7702
|
-
exports2.addAssetStage = addAssetStage;
|
|
7703
|
-
exports2.addAssetStageCompletion = addAssetStageCompletion;
|
|
7704
|
-
exports2.addAssetStageCompletions = addAssetStageCompletions;
|
|
7705
|
-
exports2.addAssetStages = addAssetStages;
|
|
7706
7619
|
exports2.addAssetType = addAssetType;
|
|
7707
7620
|
exports2.addAssetTypeAttachment = addAssetTypeAttachment;
|
|
7708
7621
|
exports2.addAssetTypeAttachments = addAssetTypeAttachments;
|
|
7709
|
-
exports2.addAssetTypes = addAssetTypes;
|
|
7710
7622
|
exports2.addAssets = addAssets;
|
|
7711
7623
|
exports2.addCategory = addCategory;
|
|
7712
7624
|
exports2.addConversation = addConversation;
|
|
@@ -7744,6 +7656,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7744
7656
|
exports2.addOrReplaceProjects = addOrReplaceProjects;
|
|
7745
7657
|
exports2.addProjectAttachment = addProjectAttachment;
|
|
7746
7658
|
exports2.addProjectAttachments = addProjectAttachments;
|
|
7659
|
+
exports2.addStageCompletion = addStageCompletion;
|
|
7660
|
+
exports2.addStageCompletions = addStageCompletions;
|
|
7661
|
+
exports2.addStages = addStages;
|
|
7747
7662
|
exports2.addTeam = addTeam;
|
|
7748
7663
|
exports2.addToRecentIssues = addToRecentIssues;
|
|
7749
7664
|
exports2.addUsers = addUsers;
|
|
@@ -7784,14 +7699,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7784
7699
|
exports2.deleteAsset = deleteAsset;
|
|
7785
7700
|
exports2.deleteAssetAttachment = deleteAssetAttachment;
|
|
7786
7701
|
exports2.deleteAssetAttachments = deleteAssetAttachments;
|
|
7787
|
-
exports2.deleteAssetStage = deleteAssetStage;
|
|
7788
|
-
exports2.deleteAssetStageCompletion = deleteAssetStageCompletion;
|
|
7789
|
-
exports2.deleteAssetStageCompletions = deleteAssetStageCompletions;
|
|
7790
|
-
exports2.deleteAssetStages = deleteAssetStages;
|
|
7791
7702
|
exports2.deleteAssetType = deleteAssetType;
|
|
7792
7703
|
exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
|
|
7793
7704
|
exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
|
|
7794
|
-
exports2.deleteAssetTypes = deleteAssetTypes;
|
|
7795
7705
|
exports2.deleteAssets = deleteAssets;
|
|
7796
7706
|
exports2.deleteCategory = deleteCategory;
|
|
7797
7707
|
exports2.deleteDocumentAttachment = deleteDocumentAttachment;
|
|
@@ -7867,11 +7777,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7867
7777
|
exports2.getLocalRelativeDateString = getLocalRelativeDateString;
|
|
7868
7778
|
exports2.getOutboxCoordinator = getOutboxCoordinator;
|
|
7869
7779
|
exports2.getRenamedFile = getRenamedFile;
|
|
7780
|
+
exports2.getStageColor = getStageColor;
|
|
7870
7781
|
exports2.hashFile = hashFile;
|
|
7871
7782
|
exports2.initSDK = initSDK;
|
|
7872
7783
|
exports2.initializeAssetAttachments = initializeAssetAttachments;
|
|
7873
|
-
exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
|
|
7874
|
-
exports2.initializeAssetStages = initializeAssetStages;
|
|
7875
7784
|
exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
|
|
7876
7785
|
exports2.initializeAssetTypes = initializeAssetTypes;
|
|
7877
7786
|
exports2.initializeAssets = initializeAssets;
|
|
@@ -7894,6 +7803,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7894
7803
|
exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
|
|
7895
7804
|
exports2.initializeProjectAccesses = initializeProjectAccesses;
|
|
7896
7805
|
exports2.initializeProjectAttachments = initializeProjectAttachments;
|
|
7806
|
+
exports2.initializeStages = initializeStages;
|
|
7897
7807
|
exports2.initializeTeams = initializeTeams;
|
|
7898
7808
|
exports2.initializeWorkspaces = initializeWorkspaces;
|
|
7899
7809
|
exports2.isToday = isToday;
|
|
@@ -7951,6 +7861,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7951
7861
|
exports2.removeProjectFile = removeProjectFile;
|
|
7952
7862
|
exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
|
|
7953
7863
|
exports2.removeRecentIssue = removeRecentIssue;
|
|
7864
|
+
exports2.removeStageCompletions = removeStageCompletions;
|
|
7865
|
+
exports2.removeStages = removeStages;
|
|
7954
7866
|
exports2.removeUser = removeUser;
|
|
7955
7867
|
exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
|
|
7956
7868
|
exports2.resetRecentIssues = resetRecentIssues;
|
|
@@ -7973,9 +7885,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7973
7885
|
exports2.selectAssetAttachments = selectAssetAttachments;
|
|
7974
7886
|
exports2.selectAssetById = selectAssetById;
|
|
7975
7887
|
exports2.selectAssetStageById = selectAssetStageById;
|
|
7976
|
-
exports2.selectAssetStageCompletionById = selectAssetStageCompletionById;
|
|
7977
|
-
exports2.selectAssetStageCompletionMapping = selectAssetStageCompletionMapping;
|
|
7978
|
-
exports2.selectAssetStageCompletionsByIds = selectAssetStageCompletionsByIds;
|
|
7979
7888
|
exports2.selectAssetStages = selectAssetStages;
|
|
7980
7889
|
exports2.selectAssetStagesByIds = selectAssetStagesByIds;
|
|
7981
7890
|
exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
|
|
@@ -8011,7 +7920,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8011
7920
|
exports2.selectCategoryMapping = selectCategoryMapping;
|
|
8012
7921
|
exports2.selectCommentsOfIssue = selectCommentsOfIssue;
|
|
8013
7922
|
exports2.selectCompletedStageIdsForAsset = selectCompletedStageIdsForAsset;
|
|
8014
|
-
exports2.
|
|
7923
|
+
exports2.selectCompletedStages = selectCompletedStages;
|
|
8015
7924
|
exports2.selectConversation = selectConversation;
|
|
8016
7925
|
exports2.selectConversationMapping = selectConversationMapping;
|
|
8017
7926
|
exports2.selectConversations = selectConversations;
|
|
@@ -8125,6 +8034,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8125
8034
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
8126
8035
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
8127
8036
|
exports2.selectStageMapping = selectStageMapping;
|
|
8037
|
+
exports2.selectStagesFromAssetTypeIds = selectStagesFromAssetTypeIds;
|
|
8128
8038
|
exports2.selectStagesOfAssetType = selectStagesOfAssetType;
|
|
8129
8039
|
exports2.selectTeamById = selectTeamById;
|
|
8130
8040
|
exports2.selectTeams = selectTeams;
|
|
@@ -8144,12 +8054,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8144
8054
|
exports2.setAsset = setAsset;
|
|
8145
8055
|
exports2.setAssetAttachment = setAssetAttachment;
|
|
8146
8056
|
exports2.setAssetAttachments = setAssetAttachments;
|
|
8147
|
-
exports2.setAssetStage = setAssetStage;
|
|
8148
|
-
exports2.setAssetStages = setAssetStages;
|
|
8149
|
-
exports2.setAssetType = setAssetType;
|
|
8150
8057
|
exports2.setAssetTypeAttachment = setAssetTypeAttachment;
|
|
8151
8058
|
exports2.setAssetTypeAttachments = setAssetTypeAttachments;
|
|
8152
|
-
exports2.setAssetTypes = setAssetTypes;
|
|
8153
8059
|
exports2.setAssets = setAssets;
|
|
8154
8060
|
exports2.setConversation = setConversation;
|
|
8155
8061
|
exports2.setCurrentUser = setCurrentUser;
|
|
@@ -8182,6 +8088,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8182
8088
|
exports2.setProjectAttachments = setProjectAttachments;
|
|
8183
8089
|
exports2.setProjects = setProjects;
|
|
8184
8090
|
exports2.setRehydrated = setRehydrated;
|
|
8091
|
+
exports2.setStage = setStage;
|
|
8092
|
+
exports2.setStageCompletions = setStageCompletions;
|
|
8185
8093
|
exports2.setTeam = setTeam;
|
|
8186
8094
|
exports2.setTokens = setTokens;
|
|
8187
8095
|
exports2.setTourStep = setTourStep;
|
|
@@ -8200,14 +8108,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8200
8108
|
exports2.updateAsset = updateAsset;
|
|
8201
8109
|
exports2.updateAssetAttachment = updateAssetAttachment;
|
|
8202
8110
|
exports2.updateAssetAttachments = updateAssetAttachments;
|
|
8203
|
-
exports2.updateAssetStage = updateAssetStage;
|
|
8204
|
-
exports2.updateAssetStageCompletion = updateAssetStageCompletion;
|
|
8205
|
-
exports2.updateAssetStageCompletions = updateAssetStageCompletions;
|
|
8206
|
-
exports2.updateAssetStages = updateAssetStages;
|
|
8207
|
-
exports2.updateAssetType = updateAssetType;
|
|
8208
8111
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
8209
8112
|
exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
|
|
8210
|
-
exports2.updateAssetTypes = updateAssetTypes;
|
|
8211
8113
|
exports2.updateAssets = updateAssets;
|
|
8212
8114
|
exports2.updateCategory = updateCategory;
|
|
8213
8115
|
exports2.updateConversation = updateConversation;
|
|
@@ -8235,6 +8137,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8235
8137
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
8236
8138
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
8237
8139
|
exports2.updateProjectAttachments = updateProjectAttachments;
|
|
8140
|
+
exports2.updateStage = updateStage;
|
|
8141
|
+
exports2.updateStages = updateStages;
|
|
8238
8142
|
exports2.updateTeam = updateTeam;
|
|
8239
8143
|
exports2.updateWorkspace = updateWorkspace;
|
|
8240
8144
|
exports2.useMemoCompare = useMemoCompare;
|