@overmap-ai/core 1.0.47 → 1.0.48-activity-history.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +180 -9
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +180 -9
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/services/IssueUpdateService.d.ts +4 -0
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/slices/issueSlice.d.ts +16 -2
- package/dist/typings/models/issues.d.ts +33 -0
- package/package.json +1 -1
|
@@ -2038,6 +2038,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2038
2038
|
issues: {},
|
|
2039
2039
|
attachments: {},
|
|
2040
2040
|
comments: {},
|
|
2041
|
+
updates: {},
|
|
2041
2042
|
visibleStatuses: [IssueStatus.BACKLOG, IssueStatus.SELECTED],
|
|
2042
2043
|
visibleUserIds: null,
|
|
2043
2044
|
recentIssueIds: [],
|
|
@@ -2059,6 +2060,16 @@ var __publicField = (obj, key, value) => {
|
|
|
2059
2060
|
});
|
|
2060
2061
|
},
|
|
2061
2062
|
setIssueAttachments: setAttachments,
|
|
2063
|
+
setIssueUpdates: (state, action) => {
|
|
2064
|
+
if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
|
|
2065
|
+
throw new Error("Tried to use setIssues reducer with duplicate ID's");
|
|
2066
|
+
}
|
|
2067
|
+
const newUpdates = {};
|
|
2068
|
+
for (const update of action.payload) {
|
|
2069
|
+
newUpdates[update.offline_id] = update;
|
|
2070
|
+
}
|
|
2071
|
+
state.updates = newUpdates;
|
|
2072
|
+
},
|
|
2062
2073
|
setActiveIssueId: (state, action) => {
|
|
2063
2074
|
state.activeIssueId = action.payload;
|
|
2064
2075
|
},
|
|
@@ -2070,6 +2081,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2070
2081
|
},
|
|
2071
2082
|
addIssueAttachment: addAttachment,
|
|
2072
2083
|
addIssueAttachments: addAttachments,
|
|
2084
|
+
addIssueUpdate: (state, action) => {
|
|
2085
|
+
if (action.payload.offline_id in state.updates) {
|
|
2086
|
+
throw new Error(`Tried to add duplicate issue update with offline_id: ${action.payload.offline_id}`);
|
|
2087
|
+
}
|
|
2088
|
+
state.updates[action.payload.offline_id] = action.payload;
|
|
2089
|
+
},
|
|
2090
|
+
addIssueUpdates: (state, action) => {
|
|
2091
|
+
for (const update of action.payload) {
|
|
2092
|
+
state.updates[update.offline_id] = update;
|
|
2093
|
+
}
|
|
2094
|
+
},
|
|
2073
2095
|
updateIssue: (state, action) => {
|
|
2074
2096
|
if (action.payload.offline_id in state.issues) {
|
|
2075
2097
|
state.issues[action.payload.offline_id] = {
|
|
@@ -2089,6 +2111,18 @@ var __publicField = (obj, key, value) => {
|
|
|
2089
2111
|
}
|
|
2090
2112
|
},
|
|
2091
2113
|
removeIssueAttachment: removeAttachment,
|
|
2114
|
+
removeIssueUpdate: (state, action) => {
|
|
2115
|
+
if (action.payload in state.updates) {
|
|
2116
|
+
delete state.updates[action.payload];
|
|
2117
|
+
} else {
|
|
2118
|
+
throw new Error(`Failed to remove issue update because offline_id doesn't exist: ${action.payload}`);
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
removeIssueUpdates: (state, action) => {
|
|
2122
|
+
for (const updateId of action.payload) {
|
|
2123
|
+
delete state.updates[updateId];
|
|
2124
|
+
}
|
|
2125
|
+
},
|
|
2092
2126
|
removeAttachmentsOfIssue: (state, action) => {
|
|
2093
2127
|
const attachments = Object.values(state.attachments).filter((a) => a.issue === action.payload);
|
|
2094
2128
|
for (const attachment of attachments) {
|
|
@@ -2145,6 +2179,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2145
2179
|
addIssueAttachment,
|
|
2146
2180
|
addIssueAttachments,
|
|
2147
2181
|
addIssue,
|
|
2182
|
+
addIssueUpdate,
|
|
2183
|
+
addIssueUpdates,
|
|
2148
2184
|
addOrReplaceIssueComment,
|
|
2149
2185
|
addToRecentIssues,
|
|
2150
2186
|
cleanRecentIssues,
|
|
@@ -2152,11 +2188,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2152
2188
|
removeAttachmentsOfIssue,
|
|
2153
2189
|
removeIssue,
|
|
2154
2190
|
removeIssueComment,
|
|
2191
|
+
removeIssueUpdate,
|
|
2192
|
+
removeIssueUpdates,
|
|
2155
2193
|
removeRecentIssue,
|
|
2156
2194
|
resetRecentIssues,
|
|
2157
2195
|
setActiveIssueId,
|
|
2158
2196
|
setIssueAttachments,
|
|
2159
2197
|
setIssueComments,
|
|
2198
|
+
setIssueUpdates,
|
|
2160
2199
|
setIssues,
|
|
2161
2200
|
setVisibleStatuses,
|
|
2162
2201
|
setVisibleUserIds,
|
|
@@ -2232,6 +2271,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2232
2271
|
return Object.values(commentMapping).filter((comment) => comment.issue === issueId);
|
|
2233
2272
|
})
|
|
2234
2273
|
);
|
|
2274
|
+
const selectIssueUpdateMapping = (state) => state.issueReducer.updates;
|
|
2275
|
+
const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
2276
|
+
toolkit.createSelector([selectIssueUpdateMapping, (_state, issueId) => issueId], (updates, issueId) => {
|
|
2277
|
+
return Object.values(updates).filter((update) => update.issue === issueId);
|
|
2278
|
+
})
|
|
2279
|
+
);
|
|
2235
2280
|
const selectAttachmentsOfIssue = restructureCreateSelectorWithArgs(
|
|
2236
2281
|
toolkit.createSelector(
|
|
2237
2282
|
[selectIssueAttachments, (_state, issueId) => issueId],
|
|
@@ -2440,6 +2485,16 @@ var __publicField = (obj, key, value) => {
|
|
|
2440
2485
|
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
2441
2486
|
return OrganizationAccessLevel2;
|
|
2442
2487
|
})(OrganizationAccessLevel || {});
|
|
2488
|
+
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
2489
|
+
IssueUpdateChange2["STATUS"] = "status";
|
|
2490
|
+
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
2491
|
+
IssueUpdateChange2["CATEGORY"] = "category";
|
|
2492
|
+
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
2493
|
+
IssueUpdateChange2["TITLE"] = "title";
|
|
2494
|
+
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
2495
|
+
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
2496
|
+
return IssueUpdateChange2;
|
|
2497
|
+
})(IssueUpdateChange || {});
|
|
2443
2498
|
var ProjectType = /* @__PURE__ */ ((ProjectType2) => {
|
|
2444
2499
|
ProjectType2[ProjectType2["PERSONAL"] = 0] = "PERSONAL";
|
|
2445
2500
|
ProjectType2[ProjectType2["ORGANIZATION"] = 2] = "ORGANIZATION";
|
|
@@ -5758,6 +5813,28 @@ var __publicField = (obj, key, value) => {
|
|
|
5758
5813
|
});
|
|
5759
5814
|
}
|
|
5760
5815
|
}
|
|
5816
|
+
class IssueUpdateService extends BaseApiService {
|
|
5817
|
+
async refreshStore() {
|
|
5818
|
+
const { store } = this.client;
|
|
5819
|
+
const result = await this.enqueueRequest({
|
|
5820
|
+
description: "Get issue updates",
|
|
5821
|
+
method: HttpMethod.GET,
|
|
5822
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
|
|
5823
|
+
blockers: [],
|
|
5824
|
+
blocks: []
|
|
5825
|
+
});
|
|
5826
|
+
let filteredResult = result.filter(onlyUniqueOfflineIds);
|
|
5827
|
+
filteredResult = filteredResult.map((comment) => {
|
|
5828
|
+
return { ...comment };
|
|
5829
|
+
});
|
|
5830
|
+
if (result.length !== filteredResult.length) {
|
|
5831
|
+
console.error(
|
|
5832
|
+
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
5833
|
+
);
|
|
5834
|
+
}
|
|
5835
|
+
store.dispatch(setIssueUpdates(filteredResult));
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5761
5838
|
class IssueService extends BaseApiService {
|
|
5762
5839
|
// Basic CRUD functions
|
|
5763
5840
|
// TODO: Once all models are represented in `Created<TModel>`, use `Created` in `OptimisticModelResult`, so we don't
|
|
@@ -5836,7 +5913,83 @@ var __publicField = (obj, key, value) => {
|
|
|
5836
5913
|
return [offlineIssues, promise];
|
|
5837
5914
|
}
|
|
5838
5915
|
update(issue) {
|
|
5916
|
+
const state = this.client.store.getState();
|
|
5917
|
+
const issueToBeUpdated = state.issueReducer.issues[issue.offline_id];
|
|
5918
|
+
if (!issueToBeUpdated) {
|
|
5919
|
+
throw new Error(
|
|
5920
|
+
`Attempting to update an issue with offline_id ${issue.offline_id} that doesn't exist in the store`
|
|
5921
|
+
);
|
|
5922
|
+
}
|
|
5839
5923
|
this.client.store.dispatch(updateIssue(issue));
|
|
5924
|
+
const changes = {};
|
|
5925
|
+
for (const issueUpdateChange of [
|
|
5926
|
+
IssueUpdateChange.TITLE,
|
|
5927
|
+
IssueUpdateChange.DESCRIPTION,
|
|
5928
|
+
IssueUpdateChange.STATUS,
|
|
5929
|
+
IssueUpdateChange.CATEGORY,
|
|
5930
|
+
IssueUpdateChange.PRIORITY,
|
|
5931
|
+
IssueUpdateChange.ASSIGNED_TO,
|
|
5932
|
+
IssueUpdateChange.DUE_DATE
|
|
5933
|
+
]) {
|
|
5934
|
+
if (issueUpdateChange in issue && issue[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
5935
|
+
switch (issueUpdateChange) {
|
|
5936
|
+
case "category": {
|
|
5937
|
+
let categoryOrNull = null;
|
|
5938
|
+
const categoryIdOrNull = issue[issueUpdateChange];
|
|
5939
|
+
if (categoryIdOrNull) {
|
|
5940
|
+
categoryOrNull = state.categoryReducer.categories[categoryIdOrNull] ?? null;
|
|
5941
|
+
if (!categoryOrNull)
|
|
5942
|
+
throw new Error(
|
|
5943
|
+
`Trying to update issue category to ${categoryIdOrNull} which does not exist in store`
|
|
5944
|
+
);
|
|
5945
|
+
}
|
|
5946
|
+
changes[issueUpdateChange] = categoryOrNull ? {
|
|
5947
|
+
name: categoryOrNull.name,
|
|
5948
|
+
color: categoryOrNull.color,
|
|
5949
|
+
offline_id: categoryOrNull.offline_id
|
|
5950
|
+
} : null;
|
|
5951
|
+
break;
|
|
5952
|
+
}
|
|
5953
|
+
case "assigned_to": {
|
|
5954
|
+
let userOrNull = null;
|
|
5955
|
+
const userIdOrNull = issue[issueUpdateChange];
|
|
5956
|
+
if (userIdOrNull) {
|
|
5957
|
+
userOrNull = state.userReducer.users[userIdOrNull] ?? null;
|
|
5958
|
+
if (!userOrNull)
|
|
5959
|
+
throw new Error(
|
|
5960
|
+
`Trying to update issue assigned_to to ${userIdOrNull} which does not exist in store`
|
|
5961
|
+
);
|
|
5962
|
+
}
|
|
5963
|
+
changes[issueUpdateChange] = userOrNull ? {
|
|
5964
|
+
full_name: userOrNull.username,
|
|
5965
|
+
id: userOrNull.id
|
|
5966
|
+
} : null;
|
|
5967
|
+
break;
|
|
5968
|
+
}
|
|
5969
|
+
case "description":
|
|
5970
|
+
changes[issueUpdateChange] = issue[issueUpdateChange] ?? null;
|
|
5971
|
+
break;
|
|
5972
|
+
case "title":
|
|
5973
|
+
changes[issueUpdateChange] = issue[issueUpdateChange] ?? null;
|
|
5974
|
+
break;
|
|
5975
|
+
case "priority":
|
|
5976
|
+
changes[issueUpdateChange] = issue[issueUpdateChange];
|
|
5977
|
+
break;
|
|
5978
|
+
case "status":
|
|
5979
|
+
changes[issueUpdateChange] = issue[issueUpdateChange];
|
|
5980
|
+
break;
|
|
5981
|
+
case "due_date":
|
|
5982
|
+
changes[issueUpdateChange] = issue[issueUpdateChange] ? issue[issueUpdateChange] : null;
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
const offlineIssueUpdate = offline({
|
|
5987
|
+
created_by: state.userReducer.currentUser.id,
|
|
5988
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5989
|
+
issue: issueToBeUpdated.offline_id,
|
|
5990
|
+
changes
|
|
5991
|
+
});
|
|
5992
|
+
this.client.store.dispatch(addIssueUpdate(offlineIssueUpdate));
|
|
5840
5993
|
const promise = this.enqueueRequest({
|
|
5841
5994
|
description: "Edit issue",
|
|
5842
5995
|
method: HttpMethod.PATCH,
|
|
@@ -5845,23 +5998,30 @@ var __publicField = (obj, key, value) => {
|
|
|
5845
5998
|
blockers: [issue.offline_id],
|
|
5846
5999
|
blocks: [issue.offline_id]
|
|
5847
6000
|
});
|
|
6001
|
+
promise.catch(() => {
|
|
6002
|
+
this.client.store.dispatch(updateIssue(issueToBeUpdated));
|
|
6003
|
+
this.client.store.dispatch(removeIssueUpdate(offlineIssueUpdate.offline_id));
|
|
6004
|
+
});
|
|
5848
6005
|
const fullIssue = this.client.store.getState().issueReducer.issues[issue.offline_id];
|
|
5849
6006
|
return [fullIssue, promise];
|
|
5850
6007
|
}
|
|
5851
6008
|
async remove(id) {
|
|
5852
6009
|
const { store } = this.client;
|
|
5853
6010
|
const state = store.getState();
|
|
6011
|
+
const dispatch = store.dispatch;
|
|
5854
6012
|
const backup = state.issueReducer.issues[id];
|
|
5855
6013
|
if (!backup) {
|
|
5856
6014
|
throw new Error(`No issue with id ${id} found in the store`);
|
|
5857
6015
|
}
|
|
5858
6016
|
const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue === id);
|
|
5859
6017
|
const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
6018
|
+
const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
|
|
6019
|
+
dispatch(removeIssue(id));
|
|
6020
|
+
dispatch(addActiveProjectIssuesCount(-1));
|
|
6021
|
+
if (attachmentsOfIssue.length > 0)
|
|
6022
|
+
dispatch(removeAttachmentsOfIssue(id));
|
|
6023
|
+
if (updatesOfIssue.length > 0)
|
|
6024
|
+
dispatch(removeIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
5865
6025
|
try {
|
|
5866
6026
|
return await this.enqueueRequest({
|
|
5867
6027
|
description: "Delete issue",
|
|
@@ -5871,9 +6031,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5871
6031
|
blocks: []
|
|
5872
6032
|
});
|
|
5873
6033
|
} catch (e) {
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
6034
|
+
dispatch(addIssue(backup));
|
|
6035
|
+
dispatch(addIssueAttachments(attachments));
|
|
6036
|
+
dispatch(addIssueUpdates(updatesOfIssue));
|
|
6037
|
+
dispatch(addActiveProjectIssuesCount(1));
|
|
5877
6038
|
throw e;
|
|
5878
6039
|
}
|
|
5879
6040
|
}
|
|
@@ -6055,6 +6216,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6055
6216
|
store.dispatch(setProjectAttachments(project_attachments));
|
|
6056
6217
|
});
|
|
6057
6218
|
void this.client.documents.refreshStore();
|
|
6219
|
+
void this.client.issueUpdates.refreshStore();
|
|
6058
6220
|
}
|
|
6059
6221
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6060
6222
|
if (overwrite) {
|
|
@@ -6096,7 +6258,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6096
6258
|
async remove(projectAccess) {
|
|
6097
6259
|
const { store } = this.client;
|
|
6098
6260
|
store.dispatch(removeProjectAccess(projectAccess));
|
|
6099
|
-
store.dispatch(removeUser(projectAccess.user));
|
|
6100
6261
|
return this.enqueueRequest({
|
|
6101
6262
|
description: "Delete project access",
|
|
6102
6263
|
method: HttpMethod.DELETE,
|
|
@@ -7490,6 +7651,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7490
7651
|
__publicField(this, "organizationAccess", new OrganizationAccessService(this));
|
|
7491
7652
|
__publicField(this, "issues", new IssueService(this));
|
|
7492
7653
|
__publicField(this, "issueComments", new IssueCommentService(this));
|
|
7654
|
+
__publicField(this, "issueUpdates", new IssueUpdateService(this));
|
|
7493
7655
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
7494
7656
|
__publicField(this, "main", new MainService(this));
|
|
7495
7657
|
__publicField(this, "components", new ComponentService(this));
|
|
@@ -15215,6 +15377,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15215
15377
|
exports2.IssuePriority = IssuePriority;
|
|
15216
15378
|
exports2.IssueService = IssueService;
|
|
15217
15379
|
exports2.IssueStatus = IssueStatus;
|
|
15380
|
+
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
15381
|
+
exports2.IssueUpdateService = IssueUpdateService;
|
|
15218
15382
|
exports2.LicenseLevel = LicenseLevel;
|
|
15219
15383
|
exports2.LicenseService = LicenseService;
|
|
15220
15384
|
exports2.LicenseStatus = LicenseStatus;
|
|
@@ -15278,6 +15442,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15278
15442
|
exports2.addIssue = addIssue;
|
|
15279
15443
|
exports2.addIssueAttachment = addIssueAttachment;
|
|
15280
15444
|
exports2.addIssueAttachments = addIssueAttachments;
|
|
15445
|
+
exports2.addIssueUpdate = addIssueUpdate;
|
|
15446
|
+
exports2.addIssueUpdates = addIssueUpdates;
|
|
15281
15447
|
exports2.addLicenses = addLicenses;
|
|
15282
15448
|
exports2.addOrReplaceCategories = addOrReplaceCategories;
|
|
15283
15449
|
exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
|
|
@@ -15437,6 +15603,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15437
15603
|
exports2.removeIssue = removeIssue;
|
|
15438
15604
|
exports2.removeIssueAttachment = removeIssueAttachment;
|
|
15439
15605
|
exports2.removeIssueComment = removeIssueComment;
|
|
15606
|
+
exports2.removeIssueUpdate = removeIssueUpdate;
|
|
15607
|
+
exports2.removeIssueUpdates = removeIssueUpdates;
|
|
15440
15608
|
exports2.removeOrganizationAccess = removeOrganizationAccess;
|
|
15441
15609
|
exports2.removeProjectAccess = removeProjectAccess;
|
|
15442
15610
|
exports2.removeProjectAccessesOfProject = removeProjectAccessesOfProject;
|
|
@@ -15538,6 +15706,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15538
15706
|
exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
|
|
15539
15707
|
exports2.selectIssueAttachments = selectIssueAttachments;
|
|
15540
15708
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
15709
|
+
exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
|
|
15710
|
+
exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
|
|
15541
15711
|
exports2.selectIssues = selectIssues;
|
|
15542
15712
|
exports2.selectLatestFormRevision = selectLatestFormRevision;
|
|
15543
15713
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
@@ -15634,6 +15804,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15634
15804
|
exports2.setIsLoading = setIsLoading;
|
|
15635
15805
|
exports2.setIssueAttachments = setIssueAttachments;
|
|
15636
15806
|
exports2.setIssueComments = setIssueComments;
|
|
15807
|
+
exports2.setIssueUpdates = setIssueUpdates;
|
|
15637
15808
|
exports2.setIssues = setIssues;
|
|
15638
15809
|
exports2.setLicenses = setLicenses;
|
|
15639
15810
|
exports2.setLoggedIn = setLoggedIn;
|