@overmap-ai/core 1.0.65-strip-workspace-access.1 → 1.0.65-strip-workspace-access.2
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 +216 -229
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +216 -229
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/BaseAttachmentService.d.ts +1 -1
- package/dist/sdk/services/CategoryService.d.ts +3 -7
- package/dist/sdk/services/DocumentService.d.ts +4 -4
- package/dist/sdk/services/FormSubmissionService.d.ts +2 -2
- package/dist/sdk/services/IssueCommentService.d.ts +4 -4
- package/dist/sdk/services/IssueService.d.ts +3 -3
- package/dist/sdk/services/IssueTypeService.d.ts +4 -4
- package/dist/sdk/services/ProjectFileService.d.ts +1 -1
- package/dist/sdk/services/TeamService.d.ts +3 -3
- package/dist/sdk/services/WorkspaceService.d.ts +2 -2
- package/dist/store/slices/documentSlice.d.ts +3 -3
- package/dist/store/slices/formSlice.d.ts +2 -2
- package/dist/store/slices/issueCommentSlice.d.ts +2 -1
- package/dist/store/slices/userSlice.d.ts +13 -33
- package/dist/store/slices/workspaceSlice.d.ts +11 -11
- package/dist/typings/models/documents.d.ts +1 -2
- package/dist/typings/models/forms.d.ts +4 -11
- package/dist/typings/models/issueTypes.d.ts +1 -2
- package/dist/typings/models/issues.d.ts +8 -11
- package/dist/typings/models/projects.d.ts +2 -4
- package/dist/typings/models/teams.d.ts +1 -2
- package/package.json +1 -1
|
@@ -1621,12 +1621,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1621
1621
|
})(LicenseStatus || {});
|
|
1622
1622
|
const initialState$p = {
|
|
1623
1623
|
users: {},
|
|
1624
|
-
currentUser:
|
|
1625
|
-
id: 0,
|
|
1626
|
-
username: "",
|
|
1627
|
-
email: "",
|
|
1628
|
-
profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
|
|
1629
|
-
}
|
|
1624
|
+
currentUser: null
|
|
1630
1625
|
};
|
|
1631
1626
|
const userSlice = toolkit.createSlice({
|
|
1632
1627
|
name: "users",
|
|
@@ -1649,6 +1644,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1649
1644
|
state.currentUser = action.payload;
|
|
1650
1645
|
},
|
|
1651
1646
|
setProfilePicture: (state, action) => {
|
|
1647
|
+
if (!state.currentUser)
|
|
1648
|
+
return;
|
|
1652
1649
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1653
1650
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1654
1651
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1658,32 +1655,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1658
1655
|
currentUser.profile.file = action.payload.file ?? null;
|
|
1659
1656
|
currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1660
1657
|
},
|
|
1661
|
-
addFavouriteProjectId: (state, action) => {
|
|
1662
|
-
state.currentUser.profile.favourite_project_ids.push(action.payload);
|
|
1663
|
-
},
|
|
1664
|
-
removeFavouriteProjectId: (state, action) => {
|
|
1665
|
-
state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
|
|
1666
|
-
(id) => id !== action.payload
|
|
1667
|
-
);
|
|
1668
|
-
},
|
|
1669
|
-
setTourStep: (state, action) => {
|
|
1670
|
-
state.currentUser.profile.tour_step = action.payload;
|
|
1671
|
-
},
|
|
1672
1658
|
removeUser: (state, action) => {
|
|
1673
1659
|
delete state.users[action.payload];
|
|
1674
1660
|
}
|
|
1675
1661
|
}
|
|
1676
1662
|
});
|
|
1677
|
-
const {
|
|
1678
|
-
setCurrentUser,
|
|
1679
|
-
setProfilePicture,
|
|
1680
|
-
setUsers,
|
|
1681
|
-
addUsers,
|
|
1682
|
-
addFavouriteProjectId,
|
|
1683
|
-
removeFavouriteProjectId,
|
|
1684
|
-
setTourStep,
|
|
1685
|
-
removeUser
|
|
1686
|
-
} = userSlice.actions;
|
|
1663
|
+
const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
|
|
1687
1664
|
const userReducer = userSlice.reducer;
|
|
1688
1665
|
const selectCurrentUser = (state) => state.userReducer.currentUser;
|
|
1689
1666
|
const selectUsersMapping = (state) => state.userReducer.users;
|
|
@@ -1704,7 +1681,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1704
1681
|
return fallbackToEmptyArray(users);
|
|
1705
1682
|
})
|
|
1706
1683
|
);
|
|
1707
|
-
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
1708
1684
|
const organizationAccessAdapter = createModelAdapter(
|
|
1709
1685
|
(organizationAccess) => organizationAccess.offline_id
|
|
1710
1686
|
);
|
|
@@ -1730,7 +1706,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1730
1706
|
[selectCurrentUser, selectOrganizationAccesses],
|
|
1731
1707
|
(currentUser, organizationAccesses) => {
|
|
1732
1708
|
const activeOrganizationAccess = Object.values(organizationAccesses).find(
|
|
1733
|
-
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
1709
|
+
(organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
|
|
1734
1710
|
);
|
|
1735
1711
|
return activeOrganizationAccess ?? null;
|
|
1736
1712
|
}
|
|
@@ -1807,7 +1783,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1807
1783
|
const currentUser = state.userReducer.currentUser;
|
|
1808
1784
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
1809
1785
|
return Object.values(state.projectAccessReducer.instances).find((projectAccess) => {
|
|
1810
|
-
return projectAccess.user === currentUser.id && projectAccess.project === activeProjectId;
|
|
1786
|
+
return projectAccess.user === (currentUser == null ? void 0 : currentUser.id) && projectAccess.project === activeProjectId;
|
|
1811
1787
|
}) ?? null;
|
|
1812
1788
|
};
|
|
1813
1789
|
const selectProjectAccessForUser = (user) => (state) => {
|
|
@@ -1920,9 +1896,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1920
1896
|
[selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
|
|
1921
1897
|
(currentUser, userMapping, projectAccessMapping) => {
|
|
1922
1898
|
return Object.values(userMapping).sort((userA, userB) => {
|
|
1923
|
-
if (userA.id === currentUser.id) {
|
|
1899
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1924
1900
|
return -1;
|
|
1925
|
-
} else if (userB.id === currentUser.id) {
|
|
1901
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1926
1902
|
return 1;
|
|
1927
1903
|
}
|
|
1928
1904
|
const projectAccessesA = projectAccessMapping[userA.id];
|
|
@@ -1999,9 +1975,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1999
1975
|
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2000
1976
|
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2001
1977
|
return Object.values(userMapping).sort((userA, userB) => {
|
|
2002
|
-
if (userA.id === currentUser.id) {
|
|
1978
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
2003
1979
|
return -1;
|
|
2004
|
-
} else if (userB.id === currentUser.id) {
|
|
1980
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
2005
1981
|
return 1;
|
|
2006
1982
|
}
|
|
2007
1983
|
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
@@ -2371,7 +2347,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2371
2347
|
}
|
|
2372
2348
|
const latestRevision = _selectLatestFormRevision(revisions, formId);
|
|
2373
2349
|
if (latestRevision.title.toLowerCase().includes(searchTerm.toLowerCase())) {
|
|
2374
|
-
regularMatches.push(
|
|
2350
|
+
regularMatches.push(form);
|
|
2375
2351
|
}
|
|
2376
2352
|
}
|
|
2377
2353
|
return [...regularMatches.slice(0, maxResults)];
|
|
@@ -3108,13 +3084,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3108
3084
|
deleteIssueComments
|
|
3109
3085
|
} = issueCommentSlice.actions;
|
|
3110
3086
|
const selectIssueCommentMapping = (state) => state.issueCommentReducer.instances;
|
|
3087
|
+
const selectIssueCommentById = (id) => (state) => {
|
|
3088
|
+
return state.issueCommentReducer.instances[id];
|
|
3089
|
+
};
|
|
3111
3090
|
const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
3112
|
-
toolkit.createSelector(
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
return fallbackToEmptyArray(Object.values(commentMapping).filter((comment) => comment.issue === issueId));
|
|
3116
|
-
}
|
|
3117
|
-
)
|
|
3091
|
+
toolkit.createSelector([selectIssueCommentMapping, (_state, issueId) => issueId], (commentMapping, issueId) => {
|
|
3092
|
+
return fallbackToEmptyArray(Object.values(commentMapping).filter((comment) => comment.issue === issueId));
|
|
3093
|
+
})
|
|
3118
3094
|
);
|
|
3119
3095
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
3120
3096
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
@@ -4024,15 +4000,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4024
4000
|
}
|
|
4025
4001
|
}
|
|
4026
4002
|
class CategoryService extends BaseApiService {
|
|
4027
|
-
add(payload
|
|
4003
|
+
add(payload) {
|
|
4004
|
+
var _a2;
|
|
4028
4005
|
const { store } = this.client;
|
|
4029
|
-
const createdBy = store.getState().userReducer.currentUser.id;
|
|
4006
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
4030
4007
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4031
4008
|
const offlineCategory = offline({
|
|
4032
4009
|
...payload,
|
|
4033
4010
|
created_by: createdBy,
|
|
4034
|
-
submitted_at: submittedAt
|
|
4035
|
-
workspace: workspaceId
|
|
4011
|
+
submitted_at: submittedAt
|
|
4036
4012
|
});
|
|
4037
4013
|
this.dispatch(addCategory(offlineCategory));
|
|
4038
4014
|
const promise = this.enqueueRequest({
|
|
@@ -4040,48 +4016,50 @@ var __publicField = (obj, key, value) => {
|
|
|
4040
4016
|
method: HttpMethod.POST,
|
|
4041
4017
|
url: "/categories/",
|
|
4042
4018
|
queryParams: {
|
|
4043
|
-
workspace_id:
|
|
4019
|
+
workspace_id: payload.workspace.toString()
|
|
4044
4020
|
},
|
|
4045
4021
|
payload: offlineCategory,
|
|
4046
|
-
blockers: [
|
|
4022
|
+
blockers: [payload.workspace],
|
|
4047
4023
|
blocks: [offlineCategory.offline_id]
|
|
4048
4024
|
});
|
|
4049
4025
|
return [offlineCategory, promise];
|
|
4050
4026
|
}
|
|
4051
|
-
update(
|
|
4027
|
+
update(payload) {
|
|
4052
4028
|
const state = this.client.store.getState();
|
|
4053
|
-
const existingCategory = selectCategoryById(
|
|
4029
|
+
const existingCategory = selectCategoryById(payload.offline_id)(state);
|
|
4054
4030
|
if (!existingCategory) {
|
|
4055
|
-
throw new Error(`Expected an existing category with offline_id ${
|
|
4031
|
+
throw new Error(`Expected an existing category with offline_id ${payload.offline_id}`);
|
|
4056
4032
|
}
|
|
4057
|
-
const optimisticCategory = { ...existingCategory, ...
|
|
4033
|
+
const optimisticCategory = { ...existingCategory, ...payload };
|
|
4058
4034
|
this.dispatch(updateCategory(optimisticCategory));
|
|
4059
4035
|
const promise = this.enqueueRequest({
|
|
4060
4036
|
description: "Edit Category",
|
|
4061
4037
|
method: HttpMethod.PATCH,
|
|
4062
|
-
url: `/categories/${
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
payload: category,
|
|
4067
|
-
blockers: [category.offline_id],
|
|
4068
|
-
blocks: [category.offline_id]
|
|
4038
|
+
url: `/categories/${payload.offline_id}/`,
|
|
4039
|
+
payload,
|
|
4040
|
+
blockers: [payload.offline_id],
|
|
4041
|
+
blocks: [payload.offline_id]
|
|
4069
4042
|
});
|
|
4070
4043
|
return [optimisticCategory, promise];
|
|
4071
4044
|
}
|
|
4072
|
-
remove(
|
|
4073
|
-
this.
|
|
4074
|
-
|
|
4045
|
+
remove(id) {
|
|
4046
|
+
const { store } = this.client;
|
|
4047
|
+
const category = selectCategoryById(id)(store.getState());
|
|
4048
|
+
if (!category) {
|
|
4049
|
+
throw new Error(`No category with id ${id} found in the store`);
|
|
4050
|
+
}
|
|
4051
|
+
this.dispatch(deleteCategory(id));
|
|
4052
|
+
const promise = this.enqueueRequest({
|
|
4075
4053
|
description: "Delete Category",
|
|
4076
4054
|
method: HttpMethod.DELETE,
|
|
4077
4055
|
url: `/categories/${category.offline_id}/`,
|
|
4078
|
-
// TODO: Shouldn't be necessary to specify workspace_id here
|
|
4079
|
-
queryParams: {
|
|
4080
|
-
workspace_id: workspaceId.toString()
|
|
4081
|
-
},
|
|
4082
4056
|
blockers: [category.offline_id],
|
|
4083
4057
|
blocks: []
|
|
4084
4058
|
});
|
|
4059
|
+
promise.catch(() => {
|
|
4060
|
+
this.dispatch(addCategory(category));
|
|
4061
|
+
});
|
|
4062
|
+
return promise;
|
|
4085
4063
|
}
|
|
4086
4064
|
async refreshStore(projectId) {
|
|
4087
4065
|
const result = await this.enqueueRequest({
|
|
@@ -4535,8 +4513,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4535
4513
|
};
|
|
4536
4514
|
class BaseAttachmentService extends BaseUploadService {
|
|
4537
4515
|
async attachFiles(files, modelId, buildOfflineAttachment) {
|
|
4516
|
+
var _a2;
|
|
4538
4517
|
const { store } = this.client;
|
|
4539
|
-
const
|
|
4518
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
4540
4519
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4541
4520
|
const offlineAttachments = [];
|
|
4542
4521
|
const attachmentPayloads = [];
|
|
@@ -4556,7 +4535,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4556
4535
|
file,
|
|
4557
4536
|
sha1,
|
|
4558
4537
|
submittedAt,
|
|
4559
|
-
createdBy
|
|
4538
|
+
createdBy,
|
|
4560
4539
|
description: "",
|
|
4561
4540
|
modelId
|
|
4562
4541
|
});
|
|
@@ -4760,21 +4739,21 @@ var __publicField = (obj, key, value) => {
|
|
|
4760
4739
|
}
|
|
4761
4740
|
}
|
|
4762
4741
|
class IssueCommentService extends BaseApiService {
|
|
4763
|
-
|
|
4764
|
-
|
|
4742
|
+
add(payload) {
|
|
4743
|
+
var _a2;
|
|
4765
4744
|
const { store } = this.client;
|
|
4766
4745
|
const offlineComment = offline({
|
|
4767
|
-
...
|
|
4768
|
-
author: store.getState().userReducer.currentUser.id,
|
|
4746
|
+
...payload,
|
|
4747
|
+
author: (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
4769
4748
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4770
4749
|
});
|
|
4771
4750
|
this.dispatch(addIssueComment(offlineComment));
|
|
4772
4751
|
const promise = this.enqueueRequest({
|
|
4773
|
-
description:
|
|
4752
|
+
description: "Add issue comment",
|
|
4774
4753
|
method: HttpMethod.POST,
|
|
4775
|
-
url: `/issues/${
|
|
4754
|
+
url: `/issues/${payload.issue}/comment/`,
|
|
4776
4755
|
payload: offlineComment,
|
|
4777
|
-
blockers: [
|
|
4756
|
+
blockers: [payload.issue],
|
|
4778
4757
|
blocks: [offlineComment.offline_id]
|
|
4779
4758
|
});
|
|
4780
4759
|
promise.catch(() => {
|
|
@@ -4782,37 +4761,41 @@ var __publicField = (obj, key, value) => {
|
|
|
4782
4761
|
});
|
|
4783
4762
|
return [offlineComment, promise];
|
|
4784
4763
|
}
|
|
4785
|
-
update(
|
|
4764
|
+
update(payload) {
|
|
4786
4765
|
const { store } = this.client;
|
|
4787
|
-
const commentToUpdate = store.getState()
|
|
4766
|
+
const commentToUpdate = selectIssueCommentById(payload.offline_id)(store.getState());
|
|
4788
4767
|
if (!commentToUpdate) {
|
|
4789
|
-
throw new Error(`Comment with offline_id ${
|
|
4768
|
+
throw new Error(`Comment with offline_id ${payload.offline_id} not found in store`);
|
|
4790
4769
|
}
|
|
4791
|
-
|
|
4770
|
+
const updatedComment = {
|
|
4771
|
+
...commentToUpdate,
|
|
4772
|
+
...payload
|
|
4773
|
+
};
|
|
4774
|
+
this.dispatch(setIssueComment(updatedComment));
|
|
4792
4775
|
const promise = this.enqueueRequest({
|
|
4793
|
-
description:
|
|
4776
|
+
description: "Edit issue comment",
|
|
4794
4777
|
method: HttpMethod.PATCH,
|
|
4795
|
-
url: `/issues/comments/${
|
|
4796
|
-
payload
|
|
4797
|
-
blockers: [
|
|
4798
|
-
blocks: [
|
|
4778
|
+
url: `/issues/comments/${payload.offline_id}/`,
|
|
4779
|
+
payload,
|
|
4780
|
+
blockers: [payload.offline_id],
|
|
4781
|
+
blocks: [payload.offline_id]
|
|
4799
4782
|
});
|
|
4800
4783
|
promise.catch(() => {
|
|
4801
4784
|
this.dispatch(setIssueComment(commentToUpdate));
|
|
4802
4785
|
});
|
|
4803
|
-
return [
|
|
4786
|
+
return [updatedComment, promise];
|
|
4804
4787
|
}
|
|
4805
|
-
remove(
|
|
4806
|
-
const commentToRemove = this.client.store.getState().issueCommentReducer.instances[
|
|
4788
|
+
remove(id) {
|
|
4789
|
+
const commentToRemove = this.client.store.getState().issueCommentReducer.instances[id];
|
|
4807
4790
|
if (!commentToRemove) {
|
|
4808
|
-
throw new Error(`Comment with offline_id ${
|
|
4791
|
+
throw new Error(`Comment with offline_id ${id} not found in store`);
|
|
4809
4792
|
}
|
|
4810
|
-
this.dispatch(deleteIssueComment(
|
|
4793
|
+
this.dispatch(deleteIssueComment(id));
|
|
4811
4794
|
const promise = this.enqueueRequest({
|
|
4812
4795
|
description: "Delete comment",
|
|
4813
4796
|
method: HttpMethod.DELETE,
|
|
4814
|
-
url: `/issues/comments/${
|
|
4815
|
-
blockers: [
|
|
4797
|
+
url: `/issues/comments/${id}/`,
|
|
4798
|
+
blockers: [id],
|
|
4816
4799
|
blocks: []
|
|
4817
4800
|
});
|
|
4818
4801
|
promise.catch(() => {
|
|
@@ -4885,67 +4868,60 @@ var __publicField = (obj, key, value) => {
|
|
|
4885
4868
|
}
|
|
4886
4869
|
class IssueService extends BaseApiService {
|
|
4887
4870
|
// Basic CRUD functions
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
add(issue, workspaceId, issueType = null) {
|
|
4871
|
+
add(payload) {
|
|
4872
|
+
var _a2;
|
|
4891
4873
|
const { store } = this.client;
|
|
4892
|
-
const dateWithoutMilliseconds = /* @__PURE__ */ new Date();
|
|
4893
4874
|
const state = store.getState();
|
|
4894
|
-
const
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
created_by: currentUserId,
|
|
4904
|
-
status: issue.status ?? DEFAULT_ISSUE_STATUS,
|
|
4905
|
-
priority: issue.priority ?? DEFAULT_ISSUE_PRIORITY
|
|
4906
|
-
});
|
|
4907
|
-
this.dispatch(addIssue(issuePayload));
|
|
4908
|
-
this.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
4875
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4876
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
4877
|
+
const offlineIssue = offline({
|
|
4878
|
+
...payload,
|
|
4879
|
+
submitted_at: submittedAt,
|
|
4880
|
+
created_by: createdBy
|
|
4881
|
+
});
|
|
4882
|
+
this.dispatch(addIssue(offlineIssue));
|
|
4883
|
+
this.dispatch(addToRecentIssues(offlineIssue.offline_id));
|
|
4909
4884
|
this.dispatch(addActiveProjectIssuesCount(1));
|
|
4910
4885
|
const promise = this.enqueueRequest({
|
|
4911
4886
|
description: "Create issue",
|
|
4912
4887
|
method: HttpMethod.POST,
|
|
4913
4888
|
url: "/issues/",
|
|
4914
4889
|
queryParams: {
|
|
4915
|
-
workspace_id:
|
|
4916
|
-
...
|
|
4890
|
+
workspace_id: payload.index_workspace,
|
|
4891
|
+
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4917
4892
|
},
|
|
4918
|
-
payload:
|
|
4919
|
-
blockers: ["add-issue", ...
|
|
4920
|
-
blocks: [
|
|
4893
|
+
payload: offlineIssue,
|
|
4894
|
+
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
4895
|
+
blocks: [offlineIssue.offline_id]
|
|
4921
4896
|
});
|
|
4922
4897
|
void promise.then((result) => {
|
|
4923
4898
|
this.dispatch(updateIssue(result));
|
|
4924
4899
|
}).catch((error) => {
|
|
4925
|
-
var
|
|
4900
|
+
var _a3;
|
|
4926
4901
|
console.error(error);
|
|
4927
4902
|
if (error instanceof APIError) {
|
|
4928
|
-
(
|
|
4903
|
+
(_a3 = blocks.unsafeShowToast) == null ? void 0 : _a3.call(blocks, {
|
|
4929
4904
|
title: "Could not create issue",
|
|
4930
4905
|
description: error.message,
|
|
4931
4906
|
accentColor: "red"
|
|
4932
4907
|
});
|
|
4933
4908
|
}
|
|
4934
|
-
this.dispatch(deleteIssue(
|
|
4909
|
+
this.dispatch(deleteIssue(offlineIssue.offline_id));
|
|
4935
4910
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4936
4911
|
throw error;
|
|
4937
4912
|
});
|
|
4938
|
-
return [
|
|
4913
|
+
return [offlineIssue, promise];
|
|
4939
4914
|
}
|
|
4940
|
-
update(
|
|
4915
|
+
update(payload) {
|
|
4916
|
+
var _a2;
|
|
4941
4917
|
const state = this.client.store.getState();
|
|
4942
|
-
const issueToBeUpdated = selectIssueById(
|
|
4918
|
+
const issueToBeUpdated = selectIssueById(payload.offline_id)(state);
|
|
4943
4919
|
if (!issueToBeUpdated) {
|
|
4944
4920
|
throw new Error(
|
|
4945
|
-
`Attempting to update an issue with offline_id ${
|
|
4921
|
+
`Attempting to update an issue with offline_id ${payload.offline_id} that doesn't exist in the store`
|
|
4946
4922
|
);
|
|
4947
4923
|
}
|
|
4948
|
-
const updatedIssue = { ...issueToBeUpdated, ...
|
|
4924
|
+
const updatedIssue = { ...issueToBeUpdated, ...payload };
|
|
4949
4925
|
this.dispatch(updateIssue(updatedIssue));
|
|
4950
4926
|
const changes = {};
|
|
4951
4927
|
for (const issueUpdateChange of [
|
|
@@ -4957,11 +4933,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4957
4933
|
IssueUpdateChange.ASSIGNED_TO,
|
|
4958
4934
|
IssueUpdateChange.DUE_DATE
|
|
4959
4935
|
]) {
|
|
4960
|
-
if (issueUpdateChange in
|
|
4936
|
+
if (issueUpdateChange in payload && payload[issueUpdateChange] !== issueToBeUpdated[issueUpdateChange]) {
|
|
4961
4937
|
switch (issueUpdateChange) {
|
|
4962
4938
|
case "category": {
|
|
4963
4939
|
let categoryOrNull = null;
|
|
4964
|
-
const categoryIdOrNull =
|
|
4940
|
+
const categoryIdOrNull = payload[issueUpdateChange];
|
|
4965
4941
|
if (categoryIdOrNull) {
|
|
4966
4942
|
categoryOrNull = state.categoryReducer.instances[categoryIdOrNull] ?? null;
|
|
4967
4943
|
if (!categoryOrNull)
|
|
@@ -4978,7 +4954,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4978
4954
|
}
|
|
4979
4955
|
case "assigned_to": {
|
|
4980
4956
|
let userOrNull = null;
|
|
4981
|
-
const userIdOrNull =
|
|
4957
|
+
const userIdOrNull = payload[issueUpdateChange];
|
|
4982
4958
|
if (userIdOrNull) {
|
|
4983
4959
|
userOrNull = state.userReducer.users[userIdOrNull] ?? null;
|
|
4984
4960
|
if (!userOrNull)
|
|
@@ -4993,24 +4969,24 @@ var __publicField = (obj, key, value) => {
|
|
|
4993
4969
|
break;
|
|
4994
4970
|
}
|
|
4995
4971
|
case "description":
|
|
4996
|
-
changes[issueUpdateChange] =
|
|
4972
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
4997
4973
|
break;
|
|
4998
4974
|
case "title":
|
|
4999
|
-
changes[issueUpdateChange] =
|
|
4975
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ?? null;
|
|
5000
4976
|
break;
|
|
5001
4977
|
case "priority":
|
|
5002
|
-
changes[issueUpdateChange] =
|
|
4978
|
+
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5003
4979
|
break;
|
|
5004
4980
|
case "status":
|
|
5005
|
-
changes[issueUpdateChange] =
|
|
4981
|
+
changes[issueUpdateChange] = payload[issueUpdateChange];
|
|
5006
4982
|
break;
|
|
5007
4983
|
case "due_date":
|
|
5008
|
-
changes[issueUpdateChange] =
|
|
4984
|
+
changes[issueUpdateChange] = payload[issueUpdateChange] ? payload[issueUpdateChange] : null;
|
|
5009
4985
|
}
|
|
5010
4986
|
}
|
|
5011
4987
|
}
|
|
5012
4988
|
const offlineIssueUpdate = offline({
|
|
5013
|
-
created_by: state.userReducer.currentUser.id,
|
|
4989
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5014
4990
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5015
4991
|
issue: issueToBeUpdated.offline_id,
|
|
5016
4992
|
changes
|
|
@@ -5019,10 +4995,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5019
4995
|
const promise = this.enqueueRequest({
|
|
5020
4996
|
description: "Edit issue",
|
|
5021
4997
|
method: HttpMethod.PATCH,
|
|
5022
|
-
url: `/issues/${
|
|
5023
|
-
payload
|
|
5024
|
-
blockers: [
|
|
5025
|
-
blocks: [
|
|
4998
|
+
url: `/issues/${payload.offline_id}/`,
|
|
4999
|
+
payload,
|
|
5000
|
+
blockers: [payload.offline_id],
|
|
5001
|
+
blocks: [payload.offline_id]
|
|
5026
5002
|
});
|
|
5027
5003
|
promise.catch(() => {
|
|
5028
5004
|
this.dispatch(updateIssue(issueToBeUpdated));
|
|
@@ -5074,7 +5050,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5074
5050
|
throw e;
|
|
5075
5051
|
}
|
|
5076
5052
|
}
|
|
5077
|
-
// Special functions
|
|
5078
5053
|
async refreshStore(projectId) {
|
|
5079
5054
|
const result = await this.enqueueRequest({
|
|
5080
5055
|
description: "Get issues",
|
|
@@ -5082,33 +5057,24 @@ var __publicField = (obj, key, value) => {
|
|
|
5082
5057
|
url: `/projects/${projectId}/issues/`,
|
|
5083
5058
|
blockers: [],
|
|
5084
5059
|
blocks: []
|
|
5085
|
-
}).then((result2) => {
|
|
5086
|
-
const filteredResult = result2.filter(onlyUniqueOfflineIds);
|
|
5087
|
-
if (result2.length !== filteredResult.length) {
|
|
5088
|
-
console.error(
|
|
5089
|
-
`Received duplicate issues from the API (new length ${filteredResult.length});
|
|
5090
|
-
filtered in browser.`
|
|
5091
|
-
);
|
|
5092
|
-
}
|
|
5093
|
-
return filteredResult;
|
|
5094
5060
|
});
|
|
5095
5061
|
this.dispatch(initializeIssues(result));
|
|
5096
5062
|
}
|
|
5097
5063
|
}
|
|
5098
5064
|
class IssueTypeService extends BaseApiService {
|
|
5099
|
-
add(payload
|
|
5065
|
+
add(payload) {
|
|
5066
|
+
var _a2;
|
|
5100
5067
|
const { store } = this.client;
|
|
5101
5068
|
const state = store.getState();
|
|
5102
5069
|
const offlineIssueType = offline({
|
|
5103
5070
|
...payload,
|
|
5104
5071
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5105
|
-
created_by: state.userReducer.currentUser.id
|
|
5106
|
-
organization: organizationId
|
|
5072
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id
|
|
5107
5073
|
});
|
|
5108
5074
|
this.dispatch(addIssueType(offlineIssueType));
|
|
5109
5075
|
const promise = this.enqueueRequest({
|
|
5110
5076
|
method: HttpMethod.POST,
|
|
5111
|
-
url: `/organizations/${
|
|
5077
|
+
url: `/organizations/${payload.organization}/issue-types/`,
|
|
5112
5078
|
// Sending only whats needed here
|
|
5113
5079
|
payload: {
|
|
5114
5080
|
offline_id: offlineIssueType.offline_id,
|
|
@@ -5154,20 +5120,20 @@ var __publicField = (obj, key, value) => {
|
|
|
5154
5120
|
});
|
|
5155
5121
|
return [offlineUpdatedIssueType, promise];
|
|
5156
5122
|
}
|
|
5157
|
-
delete(
|
|
5123
|
+
delete(id) {
|
|
5158
5124
|
const { store } = this.client;
|
|
5159
5125
|
const state = store.getState();
|
|
5160
|
-
const issueTypeToDelete = selectIssueTypeById(
|
|
5126
|
+
const issueTypeToDelete = selectIssueTypeById(id)(state);
|
|
5161
5127
|
if (!issueTypeToDelete) {
|
|
5162
|
-
throw new Error(`IssueType with offline_id ${
|
|
5128
|
+
throw new Error(`IssueType with offline_id ${id} does not exist in the store.`);
|
|
5163
5129
|
}
|
|
5164
|
-
const issuesOfIssueType = selectIssuesOfIssueType(
|
|
5165
|
-
this.dispatch(removeIssueType(
|
|
5130
|
+
const issuesOfIssueType = selectIssuesOfIssueType(id)(state);
|
|
5131
|
+
this.dispatch(removeIssueType(id));
|
|
5166
5132
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5167
5133
|
const promise = this.enqueueRequest({
|
|
5168
5134
|
method: HttpMethod.DELETE,
|
|
5169
|
-
url: `/issues/types/${
|
|
5170
|
-
blockers: [
|
|
5135
|
+
url: `/issues/types/${id}/`,
|
|
5136
|
+
blockers: [id],
|
|
5171
5137
|
blocks: []
|
|
5172
5138
|
});
|
|
5173
5139
|
promise.catch(() => {
|
|
@@ -5225,17 +5191,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5225
5191
|
}
|
|
5226
5192
|
}
|
|
5227
5193
|
class ProjectFileService extends BaseApiService {
|
|
5228
|
-
async refreshStore(projectId) {
|
|
5229
|
-
const result = await this.enqueueRequest({
|
|
5230
|
-
description: "Get project files",
|
|
5231
|
-
method: HttpMethod.GET,
|
|
5232
|
-
url: `/projects/${projectId}/files/`,
|
|
5233
|
-
blockers: [],
|
|
5234
|
-
blocks: []
|
|
5235
|
-
});
|
|
5236
|
-
this.dispatch(addOrReplaceProjectFiles([]));
|
|
5237
|
-
this.dispatch(addOrReplaceProjectFiles(result));
|
|
5238
|
-
}
|
|
5239
5194
|
async saveExisting(file) {
|
|
5240
5195
|
if (!file.offline_id) {
|
|
5241
5196
|
throw new Error(
|
|
@@ -5323,6 +5278,17 @@ var __publicField = (obj, key, value) => {
|
|
|
5323
5278
|
blocks: []
|
|
5324
5279
|
});
|
|
5325
5280
|
}
|
|
5281
|
+
async refreshStore(projectId) {
|
|
5282
|
+
const result = await this.enqueueRequest({
|
|
5283
|
+
description: "Get project files",
|
|
5284
|
+
method: HttpMethod.GET,
|
|
5285
|
+
url: `/projects/${projectId}/files/`,
|
|
5286
|
+
blockers: [],
|
|
5287
|
+
blocks: []
|
|
5288
|
+
});
|
|
5289
|
+
this.dispatch(addOrReplaceProjectFiles([]));
|
|
5290
|
+
this.dispatch(addOrReplaceProjectFiles(result));
|
|
5291
|
+
}
|
|
5326
5292
|
}
|
|
5327
5293
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5328
5294
|
constructor() {
|
|
@@ -5508,8 +5474,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5508
5474
|
};
|
|
5509
5475
|
class FormService extends BaseUploadService {
|
|
5510
5476
|
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5477
|
+
var _a2;
|
|
5511
5478
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5512
|
-
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
5479
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5513
5480
|
const filePayloads = {};
|
|
5514
5481
|
const offlineFormRevisionAttachments = [];
|
|
5515
5482
|
const attachmentPayloads = [];
|
|
@@ -5611,10 +5578,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5611
5578
|
return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
|
|
5612
5579
|
}
|
|
5613
5580
|
addForOrganization(organizationId, initialRevision) {
|
|
5581
|
+
var _a2;
|
|
5614
5582
|
const state = this.client.store.getState();
|
|
5615
5583
|
const offlineForm = offline({
|
|
5616
5584
|
favorite: false,
|
|
5617
|
-
created_by: state.userReducer.currentUser.id,
|
|
5585
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5618
5586
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5619
5587
|
organization: organizationId
|
|
5620
5588
|
});
|
|
@@ -5626,45 +5594,49 @@ var __publicField = (obj, key, value) => {
|
|
|
5626
5594
|
);
|
|
5627
5595
|
}
|
|
5628
5596
|
addForProject(projectId, initialRevision) {
|
|
5597
|
+
var _a2;
|
|
5629
5598
|
const state = this.client.store.getState();
|
|
5630
5599
|
const offlineForm = offline({
|
|
5631
5600
|
favorite: false,
|
|
5632
|
-
created_by: state.userReducer.currentUser.id,
|
|
5601
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5633
5602
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5634
5603
|
project: projectId
|
|
5635
5604
|
});
|
|
5636
5605
|
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5637
5606
|
}
|
|
5638
5607
|
addForIssueType(issueTypeId, initialRevision) {
|
|
5608
|
+
var _a2;
|
|
5639
5609
|
const state = this.client.store.getState();
|
|
5640
5610
|
const offlineForm = offline({
|
|
5641
5611
|
favorite: false,
|
|
5642
|
-
created_by: state.userReducer.currentUser.id,
|
|
5612
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5643
5613
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5644
5614
|
issue_type: issueTypeId
|
|
5645
5615
|
});
|
|
5646
5616
|
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5647
5617
|
}
|
|
5648
5618
|
addForAssetType(assetTypeId, initialRevision) {
|
|
5619
|
+
var _a2;
|
|
5649
5620
|
const state = this.client.store.getState();
|
|
5650
5621
|
const offlineForm = offline({
|
|
5651
5622
|
favorite: false,
|
|
5652
|
-
created_by: state.userReducer.currentUser.id,
|
|
5623
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5653
5624
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5654
5625
|
asset_type: assetTypeId
|
|
5655
5626
|
});
|
|
5656
5627
|
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5657
5628
|
}
|
|
5658
5629
|
async createRevision(formId, revision) {
|
|
5630
|
+
var _a2;
|
|
5659
5631
|
const offlineRevision = offline(revision);
|
|
5660
5632
|
const { store } = this.client;
|
|
5661
5633
|
const state = store.getState();
|
|
5662
|
-
const
|
|
5634
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5663
5635
|
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5664
5636
|
const fullRevision = {
|
|
5665
5637
|
...offlineRevision,
|
|
5666
5638
|
fields,
|
|
5667
|
-
created_by:
|
|
5639
|
+
created_by: createdBy,
|
|
5668
5640
|
revision: "Pending",
|
|
5669
5641
|
form: formId,
|
|
5670
5642
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -5813,8 +5785,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5813
5785
|
};
|
|
5814
5786
|
class FormSubmissionService extends BaseUploadService {
|
|
5815
5787
|
async bulkAddSubmissionAttachments(submissionId, files) {
|
|
5788
|
+
var _a2;
|
|
5816
5789
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5817
|
-
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
5790
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5818
5791
|
const filePayloads = {};
|
|
5819
5792
|
const offlineFormSubmissionAttachments = [];
|
|
5820
5793
|
const attachmentPayloads = [];
|
|
@@ -5896,13 +5869,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5896
5869
|
}
|
|
5897
5870
|
// Outer promise is for hashing and caching files for submission attachments
|
|
5898
5871
|
async add(payload) {
|
|
5872
|
+
var _a2;
|
|
5899
5873
|
const { store } = this.client;
|
|
5900
5874
|
const state = store.getState();
|
|
5901
5875
|
const { values, files } = separateFilesFromValues(payload.values);
|
|
5902
5876
|
const offlineSubmission = offline({
|
|
5903
5877
|
...payload,
|
|
5904
5878
|
values,
|
|
5905
|
-
created_by: state.userReducer.currentUser.id,
|
|
5879
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5906
5880
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5907
5881
|
});
|
|
5908
5882
|
const promise = this.enqueueRequest({
|
|
@@ -6158,8 +6132,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6158
6132
|
}
|
|
6159
6133
|
class WorkspaceService extends BaseApiService {
|
|
6160
6134
|
add(payload) {
|
|
6135
|
+
var _a2;
|
|
6161
6136
|
const { store } = this.client;
|
|
6162
|
-
const createdBy = store.getState().userReducer.currentUser.id;
|
|
6137
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6163
6138
|
const offlineWorkspace = offline({
|
|
6164
6139
|
...payload,
|
|
6165
6140
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -6181,8 +6156,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6181
6156
|
});
|
|
6182
6157
|
return [offlineWorkspace, promise];
|
|
6183
6158
|
}
|
|
6184
|
-
update(
|
|
6185
|
-
this.
|
|
6159
|
+
update(payload) {
|
|
6160
|
+
const { store } = this.client;
|
|
6161
|
+
const workspace = selectWorkspaceById(payload.offline_id)(store.getState());
|
|
6162
|
+
if (!workspace) {
|
|
6163
|
+
throw new Error(`Expected an existing workspace with offline_id ${payload.offline_id}`);
|
|
6164
|
+
}
|
|
6165
|
+
const updatedWorkspace = { ...workspace, ...payload };
|
|
6166
|
+
this.dispatch(updateWorkspace(updatedWorkspace));
|
|
6186
6167
|
const promise = this.enqueueRequest({
|
|
6187
6168
|
description: "Update Workspace",
|
|
6188
6169
|
method: HttpMethod.PATCH,
|
|
@@ -6191,10 +6172,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6191
6172
|
blockers: [workspace.offline_id],
|
|
6192
6173
|
blocks: [workspace.offline_id]
|
|
6193
6174
|
});
|
|
6175
|
+
promise.then((result) => {
|
|
6176
|
+
this.dispatch(updateWorkspace(result));
|
|
6177
|
+
}).catch(() => {
|
|
6178
|
+
this.dispatch(updateWorkspace(workspace));
|
|
6179
|
+
});
|
|
6194
6180
|
return [workspace, promise];
|
|
6195
6181
|
}
|
|
6196
6182
|
delete(workspaceId) {
|
|
6197
6183
|
const { store } = this.client;
|
|
6184
|
+
const originalWorkspace = selectWorkspaceById(workspaceId)(store.getState());
|
|
6185
|
+
this.dispatch(deleteWorkspace(workspaceId));
|
|
6198
6186
|
const promise = this.enqueueRequest({
|
|
6199
6187
|
description: "Delete Workspace",
|
|
6200
6188
|
method: HttpMethod.DELETE,
|
|
@@ -6202,8 +6190,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6202
6190
|
blockers: [workspaceId],
|
|
6203
6191
|
blocks: []
|
|
6204
6192
|
});
|
|
6205
|
-
const originalWorkspace = store.getState().workspaceReducer.instances[workspaceId];
|
|
6206
|
-
this.dispatch(deleteWorkspace(workspaceId));
|
|
6207
6193
|
void promise.then(() => {
|
|
6208
6194
|
}).catch((reason) => {
|
|
6209
6195
|
if (originalWorkspace) {
|
|
@@ -6705,12 +6691,13 @@ var __publicField = (obj, key, value) => {
|
|
|
6705
6691
|
}
|
|
6706
6692
|
class DocumentService extends BaseApiService {
|
|
6707
6693
|
add(payload) {
|
|
6694
|
+
var _a2;
|
|
6708
6695
|
const { store } = this.client;
|
|
6709
|
-
const
|
|
6696
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6710
6697
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6711
6698
|
const offlineDocument = offline({
|
|
6712
6699
|
...payload,
|
|
6713
|
-
created_by:
|
|
6700
|
+
created_by: createdBy,
|
|
6714
6701
|
submitted_at: submittedAt
|
|
6715
6702
|
});
|
|
6716
6703
|
this.dispatch(addDocuments([offlineDocument]));
|
|
@@ -6739,7 +6726,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6739
6726
|
`attempting to update a document with offline_id ${document2.offline_id} that does not exist in store.documents`
|
|
6740
6727
|
);
|
|
6741
6728
|
}
|
|
6742
|
-
|
|
6729
|
+
const updatedDocument = {
|
|
6730
|
+
...documentToBeUpdated,
|
|
6731
|
+
...document2
|
|
6732
|
+
};
|
|
6733
|
+
this.dispatch(updateDocuments([updatedDocument]));
|
|
6743
6734
|
const promise = this.enqueueRequest({
|
|
6744
6735
|
description: "Update Document",
|
|
6745
6736
|
method: HttpMethod.PATCH,
|
|
@@ -6751,8 +6742,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6751
6742
|
promise.catch(() => {
|
|
6752
6743
|
updateDocuments([documentToBeUpdated]);
|
|
6753
6744
|
});
|
|
6754
|
-
|
|
6755
|
-
return [fullDocument, promise];
|
|
6745
|
+
return [updatedDocument, promise];
|
|
6756
6746
|
}
|
|
6757
6747
|
move(documentId, targetDocumentId, position) {
|
|
6758
6748
|
const { store } = this.client;
|
|
@@ -6799,22 +6789,22 @@ var __publicField = (obj, key, value) => {
|
|
|
6799
6789
|
});
|
|
6800
6790
|
return promise;
|
|
6801
6791
|
}
|
|
6802
|
-
delete(
|
|
6792
|
+
delete(id) {
|
|
6803
6793
|
const { store } = this.client;
|
|
6804
6794
|
const documentsMapping = selectDocumentsMapping(store.getState());
|
|
6805
|
-
const documentToBeDeleted =
|
|
6795
|
+
const documentToBeDeleted = selectDocumentById(id)(store.getState());
|
|
6806
6796
|
if (!documentToBeDeleted) {
|
|
6807
6797
|
throw new Error(
|
|
6808
|
-
`attempting to delete a document with offline_id ${
|
|
6798
|
+
`attempting to delete a document with offline_id ${id} that does not exist in store.documents`
|
|
6809
6799
|
);
|
|
6810
6800
|
}
|
|
6811
6801
|
const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
|
|
6812
|
-
this.dispatch(removeDocuments([
|
|
6802
|
+
this.dispatch(removeDocuments([id]));
|
|
6813
6803
|
const promise = this.enqueueRequest({
|
|
6814
6804
|
description: "Delete Document",
|
|
6815
6805
|
method: HttpMethod.DELETE,
|
|
6816
|
-
url: `/documents/${
|
|
6817
|
-
blockers: [
|
|
6806
|
+
url: `/documents/${id}/`,
|
|
6807
|
+
blockers: [id],
|
|
6818
6808
|
blocks: []
|
|
6819
6809
|
});
|
|
6820
6810
|
promise.then((documentsToUpdate) => {
|
|
@@ -6872,8 +6862,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6872
6862
|
}
|
|
6873
6863
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6874
6864
|
async attachFilesToDocument(files, documentId) {
|
|
6865
|
+
var _a2;
|
|
6875
6866
|
const { store } = this.client;
|
|
6876
|
-
const
|
|
6867
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6877
6868
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6878
6869
|
const offlineAttachments = [];
|
|
6879
6870
|
const attachmentPayloads = [];
|
|
@@ -6895,7 +6886,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6895
6886
|
file,
|
|
6896
6887
|
sha1,
|
|
6897
6888
|
submittedAt,
|
|
6898
|
-
createdBy
|
|
6889
|
+
createdBy,
|
|
6899
6890
|
description: "",
|
|
6900
6891
|
modelId: documentId
|
|
6901
6892
|
});
|
|
@@ -7058,10 +7049,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7058
7049
|
}
|
|
7059
7050
|
}
|
|
7060
7051
|
class TeamService extends BaseApiService {
|
|
7061
|
-
add(
|
|
7052
|
+
add(payload) {
|
|
7062
7053
|
const offlineTeam = offline({
|
|
7063
|
-
...
|
|
7064
|
-
organization: organizationId,
|
|
7054
|
+
...payload,
|
|
7065
7055
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7066
7056
|
// TODO: uncomment once supported
|
|
7067
7057
|
// created_by: state.userReducer.currentUser.id,
|
|
@@ -7070,7 +7060,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7070
7060
|
const promise = this.enqueueRequest({
|
|
7071
7061
|
description: "Create team",
|
|
7072
7062
|
method: HttpMethod.POST,
|
|
7073
|
-
url: `/organizations/${
|
|
7063
|
+
url: `/organizations/${payload.organization}/teams/`,
|
|
7074
7064
|
payload: offlineTeam,
|
|
7075
7065
|
// No blocks since users and organizations are not offline
|
|
7076
7066
|
blockers: [],
|
|
@@ -7083,25 +7073,24 @@ var __publicField = (obj, key, value) => {
|
|
|
7083
7073
|
});
|
|
7084
7074
|
return [offlineTeam, promise];
|
|
7085
7075
|
}
|
|
7086
|
-
|
|
7087
|
-
update(team) {
|
|
7076
|
+
update(payload) {
|
|
7088
7077
|
const { store } = this.client;
|
|
7089
|
-
const teamToBeUpdated = selectTeamById(
|
|
7078
|
+
const teamToBeUpdated = selectTeamById(payload.offline_id)(store.getState());
|
|
7090
7079
|
if (!teamToBeUpdated) {
|
|
7091
|
-
throw new Error(`Expected team with offline_id ${
|
|
7080
|
+
throw new Error(`Expected team with offline_id ${payload.offline_id} to exist`);
|
|
7092
7081
|
}
|
|
7093
7082
|
const offlineUpdatedTeam = {
|
|
7094
7083
|
...teamToBeUpdated,
|
|
7095
|
-
...
|
|
7084
|
+
...payload
|
|
7096
7085
|
};
|
|
7097
7086
|
this.dispatch(updateTeam(offlineUpdatedTeam));
|
|
7098
7087
|
const promise = this.enqueueRequest({
|
|
7099
7088
|
description: "Update team",
|
|
7100
7089
|
method: HttpMethod.PATCH,
|
|
7101
|
-
url: `/organizations/teams/${
|
|
7090
|
+
url: `/organizations/teams/${payload.offline_id}/`,
|
|
7102
7091
|
payload: offlineUpdatedTeam,
|
|
7103
|
-
blockers: [
|
|
7104
|
-
blocks: [
|
|
7092
|
+
blockers: [payload.offline_id],
|
|
7093
|
+
blocks: [payload.offline_id]
|
|
7105
7094
|
});
|
|
7106
7095
|
promise.then((updatedTeam) => {
|
|
7107
7096
|
this.dispatch(setTeam(updatedTeam));
|
|
@@ -7213,10 +7202,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7213
7202
|
}
|
|
7214
7203
|
class GeoImageService extends BaseUploadService {
|
|
7215
7204
|
async add(payload) {
|
|
7205
|
+
var _a2;
|
|
7216
7206
|
const { store } = this.client;
|
|
7217
7207
|
const { file, ...payloadWithoutFile } = payload;
|
|
7218
7208
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7219
|
-
const
|
|
7209
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7220
7210
|
const projectId = payloadWithoutFile.project;
|
|
7221
7211
|
const sha1 = await hashFile(file);
|
|
7222
7212
|
const filePayload = {
|
|
@@ -7231,9 +7221,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7231
7221
|
file_sha1: sha1,
|
|
7232
7222
|
file: URL.createObjectURL(file),
|
|
7233
7223
|
submitted_at: submittedAt,
|
|
7234
|
-
created_by:
|
|
7224
|
+
created_by: createdBy
|
|
7235
7225
|
});
|
|
7236
|
-
|
|
7226
|
+
this.dispatch(addGeoImage(offlineMapImage));
|
|
7237
7227
|
const promise = this.enqueueRequest({
|
|
7238
7228
|
description: "Add geo image",
|
|
7239
7229
|
method: HttpMethod.POST,
|
|
@@ -7257,16 +7247,17 @@ var __publicField = (obj, key, value) => {
|
|
|
7257
7247
|
});
|
|
7258
7248
|
promise.then((result) => {
|
|
7259
7249
|
this.processPresignedUrls(result.presigned_urls);
|
|
7260
|
-
|
|
7250
|
+
this.dispatch(setGeoImage(result.geo_image));
|
|
7261
7251
|
}).catch(() => {
|
|
7262
|
-
|
|
7252
|
+
this.dispatch(deleteGeoImage(offlineMapImage.offline_id));
|
|
7263
7253
|
});
|
|
7264
7254
|
return [offlineMapImage, promise.then((result) => result.geo_image)];
|
|
7265
7255
|
}
|
|
7266
7256
|
async bulkAdd(payloads, projectId) {
|
|
7257
|
+
var _a2;
|
|
7267
7258
|
const { store } = this.client;
|
|
7268
7259
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7269
|
-
const
|
|
7260
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7270
7261
|
const offlineGeoImages = [];
|
|
7271
7262
|
const offlineIds = [];
|
|
7272
7263
|
const geoImagePayloads = [];
|
|
@@ -7289,7 +7280,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7289
7280
|
file_sha1: sha1,
|
|
7290
7281
|
file: URL.createObjectURL(file),
|
|
7291
7282
|
submitted_at: submittedAt,
|
|
7292
|
-
created_by:
|
|
7283
|
+
created_by: createdBy,
|
|
7293
7284
|
project: projectId
|
|
7294
7285
|
});
|
|
7295
7286
|
offlineGeoImages.push(offlineMapImage);
|
|
@@ -7306,7 +7297,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7306
7297
|
original_date: offlineMapImage.original_date
|
|
7307
7298
|
});
|
|
7308
7299
|
}
|
|
7309
|
-
|
|
7300
|
+
this.dispatch(addGeoImages(offlineGeoImages));
|
|
7310
7301
|
const promise = this.enqueueRequest({
|
|
7311
7302
|
description: "Bulk add geo images",
|
|
7312
7303
|
method: HttpMethod.POST,
|
|
@@ -7322,9 +7313,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7322
7313
|
});
|
|
7323
7314
|
promise.then((result) => {
|
|
7324
7315
|
this.processPresignedUrls(result.presigned_urls);
|
|
7325
|
-
|
|
7316
|
+
this.dispatch(setGeoImages(result.geo_images));
|
|
7326
7317
|
}).catch(() => {
|
|
7327
|
-
|
|
7318
|
+
this.dispatch(deleteGeoImages(offlineIds));
|
|
7328
7319
|
});
|
|
7329
7320
|
return [offlineGeoImages, promise.then((result) => result.geo_images)];
|
|
7330
7321
|
}
|
|
@@ -7336,7 +7327,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7336
7327
|
throw new Error(`Map image with offline_id ${payload.offline_id} does not exist in the store`);
|
|
7337
7328
|
}
|
|
7338
7329
|
const updatedGeoImage = { ...geoImageToUpdate, ...payload };
|
|
7339
|
-
|
|
7330
|
+
this.dispatch(updateGeoImage(updatedGeoImage));
|
|
7340
7331
|
const promise = this.enqueueRequest({
|
|
7341
7332
|
description: "Update geo image",
|
|
7342
7333
|
method: HttpMethod.PATCH,
|
|
@@ -7346,9 +7337,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7346
7337
|
blockers: [payload.offline_id]
|
|
7347
7338
|
});
|
|
7348
7339
|
promise.then((result) => {
|
|
7349
|
-
|
|
7340
|
+
this.dispatch(setGeoImage(result));
|
|
7350
7341
|
}).catch(() => {
|
|
7351
|
-
|
|
7342
|
+
this.dispatch(setGeoImage(geoImageToUpdate));
|
|
7352
7343
|
});
|
|
7353
7344
|
return [updatedGeoImage, promise];
|
|
7354
7345
|
}
|
|
@@ -7359,7 +7350,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7359
7350
|
if (!geoImageToDelete) {
|
|
7360
7351
|
throw new Error(`Map image with offline_id ${geoImageId} does not exist in the store`);
|
|
7361
7352
|
}
|
|
7362
|
-
|
|
7353
|
+
this.dispatch(deleteGeoImage(geoImageId));
|
|
7363
7354
|
const promise = this.enqueueRequest({
|
|
7364
7355
|
description: "Delete geo image",
|
|
7365
7356
|
method: HttpMethod.DELETE,
|
|
@@ -7368,12 +7359,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7368
7359
|
blockers: [geoImageId]
|
|
7369
7360
|
});
|
|
7370
7361
|
promise.catch(() => {
|
|
7371
|
-
|
|
7362
|
+
this.dispatch(setGeoImage(geoImageToDelete));
|
|
7372
7363
|
});
|
|
7373
7364
|
return promise;
|
|
7374
7365
|
}
|
|
7375
7366
|
async refreshStore(projectId) {
|
|
7376
|
-
const { store } = this.client;
|
|
7377
7367
|
const result = await this.enqueueRequest({
|
|
7378
7368
|
description: "Get geo images",
|
|
7379
7369
|
method: HttpMethod.GET,
|
|
@@ -7381,14 +7371,15 @@ var __publicField = (obj, key, value) => {
|
|
|
7381
7371
|
blocks: [projectId.toString()],
|
|
7382
7372
|
blockers: []
|
|
7383
7373
|
});
|
|
7384
|
-
|
|
7374
|
+
this.dispatch(initializeGeoImages(result));
|
|
7385
7375
|
}
|
|
7386
7376
|
}
|
|
7387
7377
|
class IssueAssociationService extends BaseUploadService {
|
|
7388
7378
|
add(payload) {
|
|
7379
|
+
var _a2;
|
|
7389
7380
|
const { store } = this.client;
|
|
7390
7381
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7391
|
-
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7382
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7392
7383
|
const offlineIssueAssociation = offline({
|
|
7393
7384
|
...payload,
|
|
7394
7385
|
submitted_at: submittedAt,
|
|
@@ -7402,7 +7393,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7402
7393
|
payload: {
|
|
7403
7394
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7404
7395
|
submitted_at: submittedAt,
|
|
7405
|
-
created_by: createdBy,
|
|
7406
7396
|
...payload
|
|
7407
7397
|
},
|
|
7408
7398
|
blockers: [
|
|
@@ -7526,7 +7516,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7526
7516
|
exports2.addDocumentAttachments = addDocumentAttachments;
|
|
7527
7517
|
exports2.addDocuments = addDocuments;
|
|
7528
7518
|
exports2.addEmailDomain = addEmailDomain;
|
|
7529
|
-
exports2.addFavouriteProjectId = addFavouriteProjectId;
|
|
7530
7519
|
exports2.addForm = addForm;
|
|
7531
7520
|
exports2.addFormRevision = addFormRevision;
|
|
7532
7521
|
exports2.addFormRevisionAttachment = addFormRevisionAttachment;
|
|
@@ -7756,7 +7745,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7756
7745
|
exports2.rehydratedReducer = rehydratedReducer;
|
|
7757
7746
|
exports2.rehydratedSlice = rehydratedSlice;
|
|
7758
7747
|
exports2.removeDocuments = removeDocuments;
|
|
7759
|
-
exports2.removeFavouriteProjectId = removeFavouriteProjectId;
|
|
7760
7748
|
exports2.removeIssueType = removeIssueType;
|
|
7761
7749
|
exports2.removeProjectFile = removeProjectFile;
|
|
7762
7750
|
exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
|
|
@@ -7835,7 +7823,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7835
7823
|
exports2.selectEmailDomains = selectEmailDomains;
|
|
7836
7824
|
exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
|
|
7837
7825
|
exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
|
|
7838
|
-
exports2.selectFavouriteProjects = selectFavouriteProjects;
|
|
7839
7826
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
7840
7827
|
exports2.selectFormById = selectFormById;
|
|
7841
7828
|
exports2.selectFormMapping = selectFormMapping;
|
|
@@ -7876,6 +7863,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7876
7863
|
exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
|
|
7877
7864
|
exports2.selectIssueAttachments = selectIssueAttachments;
|
|
7878
7865
|
exports2.selectIssueById = selectIssueById;
|
|
7866
|
+
exports2.selectIssueCommentById = selectIssueCommentById;
|
|
7879
7867
|
exports2.selectIssueCommentMapping = selectIssueCommentMapping;
|
|
7880
7868
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
7881
7869
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
@@ -7992,7 +7980,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7992
7980
|
exports2.setStageCompletions = setStageCompletions;
|
|
7993
7981
|
exports2.setTeam = setTeam;
|
|
7994
7982
|
exports2.setTokens = setTokens;
|
|
7995
|
-
exports2.setTourStep = setTourStep;
|
|
7996
7983
|
exports2.setUploadUrl = setUploadUrl;
|
|
7997
7984
|
exports2.setUsers = setUsers;
|
|
7998
7985
|
exports2.setWorkspaces = setWorkspaces;
|