@overmap-ai/core 1.0.63-org-doc-improvements.2 → 1.0.63-selector-standardization.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 +424 -291
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +424 -291
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/FormSubmissionService.d.ts +9 -1
- package/dist/sdk/services/IssueTypeService.d.ts +1 -1
- package/dist/store/slices/assetSlice.d.ts +2 -1
- package/dist/store/slices/assetStageSlice.d.ts +9 -5
- package/dist/store/slices/assetTypeSlice.d.ts +4 -10
- package/dist/store/slices/categorySlice.d.ts +2 -1
- package/dist/store/slices/documentSlice.d.ts +3 -2
- package/dist/store/slices/formRevisionSlice.d.ts +1 -1
- package/dist/store/slices/formSlice.d.ts +1 -1
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +2 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +1 -1
- package/dist/store/slices/index.d.ts +0 -1
- package/dist/store/slices/issueAssociationSlice.d.ts +5 -0
- package/dist/store/slices/issueSlice.d.ts +2 -1
- package/dist/store/slices/issueTypeSlice.d.ts +2 -1
- package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
- package/dist/store/slices/projectAccessSlice.d.ts +2 -2
- package/dist/store/slices/projectSlice.d.ts +4 -4
- package/dist/store/slices/teamSlice.d.ts +1 -1
- package/dist/store/slices/userSlice.d.ts +4 -2
- package/dist/store/store.d.ts +1 -2
- package/dist/typings/models/forms.d.ts +1 -0
- package/dist/typings/models/store.d.ts +1 -2
- package/package.json +1 -1
- package/dist/store/slices/settingsSlice.d.ts +0 -11
|
@@ -367,15 +367,15 @@ var __publicField = (obj, key, value) => {
|
|
|
367
367
|
};
|
|
368
368
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
369
369
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
370
|
-
const initialState$
|
|
370
|
+
const initialState$B = {
|
|
371
371
|
accessToken: "",
|
|
372
372
|
refreshToken: "",
|
|
373
373
|
isLoggedIn: false
|
|
374
374
|
};
|
|
375
375
|
const authSlice = toolkit.createSlice({
|
|
376
376
|
name: "auth",
|
|
377
|
-
initialState: initialState$
|
|
378
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
377
|
+
initialState: initialState$B,
|
|
378
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
379
379
|
reducers: {
|
|
380
380
|
setTokens: (state, action) => {
|
|
381
381
|
state.accessToken = action.payload.accessToken;
|
|
@@ -845,11 +845,11 @@ var __publicField = (obj, key, value) => {
|
|
|
845
845
|
};
|
|
846
846
|
}
|
|
847
847
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
848
|
-
const initialState$
|
|
848
|
+
const initialState$A = categoryAdapter.getInitialState({});
|
|
849
849
|
const categorySlice = toolkit.createSlice({
|
|
850
850
|
name: "categories",
|
|
851
|
-
initialState: initialState$
|
|
852
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
851
|
+
initialState: initialState$A,
|
|
852
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
|
|
853
853
|
reducers: {
|
|
854
854
|
initializeCategories: categoryAdapter.initialize,
|
|
855
855
|
addCategory: categoryAdapter.addOne,
|
|
@@ -862,28 +862,131 @@ var __publicField = (obj, key, value) => {
|
|
|
862
862
|
const selectCategories = toolkit.createSelector([selectCategoryMapping], (categoryMapping) => {
|
|
863
863
|
return Object.values(categoryMapping);
|
|
864
864
|
});
|
|
865
|
-
const
|
|
865
|
+
const selectCategoryById = (id) => (state) => {
|
|
866
|
+
return state.categoryReducer.instances[id];
|
|
867
|
+
};
|
|
868
|
+
const selectCategoriesByIds = restructureCreateSelectorWithArgs(
|
|
866
869
|
toolkit.createSelector(
|
|
867
|
-
[
|
|
868
|
-
(
|
|
870
|
+
[selectCategoryMapping, (_state, categoryIds) => categoryIds],
|
|
871
|
+
(categoryMapping, categoryIds) => {
|
|
872
|
+
const categories = [];
|
|
873
|
+
for (const categoryId of categoryIds) {
|
|
874
|
+
const category = categoryMapping[categoryId];
|
|
875
|
+
if (category) {
|
|
876
|
+
categories.push(category);
|
|
877
|
+
} else {
|
|
878
|
+
console.warn("selectCategoryByIds: No category exists with the id", categoryId);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return categories;
|
|
882
|
+
}
|
|
869
883
|
)
|
|
870
884
|
);
|
|
871
|
-
const
|
|
885
|
+
const selectCategoriesOfWorkspace = restructureCreateSelectorWithArgs(
|
|
872
886
|
toolkit.createSelector(
|
|
873
|
-
[
|
|
874
|
-
(
|
|
887
|
+
[selectCategories, (_state, workspaceId) => workspaceId],
|
|
888
|
+
(categories, workspaceId) => categories.filter((category) => category.workspace === workspaceId)
|
|
875
889
|
)
|
|
876
890
|
);
|
|
877
891
|
const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
878
892
|
return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
|
|
879
893
|
};
|
|
880
894
|
const categoryReducer = categorySlice.reducer;
|
|
895
|
+
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
896
|
+
const initialState$z = assetStageAdapter.getInitialState({});
|
|
897
|
+
const assetStageSlice = toolkit.createSlice({
|
|
898
|
+
name: "assetStages",
|
|
899
|
+
initialState: initialState$z,
|
|
900
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
901
|
+
reducers: {
|
|
902
|
+
initializeStages: assetStageAdapter.initialize,
|
|
903
|
+
setStage: assetStageAdapter.setOne,
|
|
904
|
+
addStages: assetStageAdapter.addMany,
|
|
905
|
+
updateStage: assetStageAdapter.updateOne,
|
|
906
|
+
updateStages: assetStageAdapter.updateMany,
|
|
907
|
+
removeStages: assetStageAdapter.deleteMany
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
911
|
+
const selectAssetStageById = restructureCreateSelectorWithArgs(
|
|
912
|
+
toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
913
|
+
return stageMapping[stageId];
|
|
914
|
+
})
|
|
915
|
+
);
|
|
916
|
+
const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
|
|
917
|
+
return Object.values(stageMapping);
|
|
918
|
+
});
|
|
919
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
920
|
+
toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
921
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
922
|
+
const ret = {};
|
|
923
|
+
for (const stage of stages) {
|
|
924
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
925
|
+
if (!ret[stage.asset_type]) {
|
|
926
|
+
ret[stage.asset_type] = [];
|
|
927
|
+
}
|
|
928
|
+
ret[stage.asset_type].push(stage);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
for (const key in ret) {
|
|
932
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
933
|
+
}
|
|
934
|
+
return ret;
|
|
935
|
+
})
|
|
936
|
+
);
|
|
937
|
+
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
938
|
+
toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
939
|
+
const assetTypeStagesMapping = {};
|
|
940
|
+
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
941
|
+
if (stage.asset_type === assetTypeId) {
|
|
942
|
+
assetTypeStagesMapping[stageId] = stage;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
return assetTypeStagesMapping;
|
|
946
|
+
})
|
|
947
|
+
);
|
|
948
|
+
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
949
|
+
toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
|
|
950
|
+
return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
|
|
951
|
+
})
|
|
952
|
+
);
|
|
953
|
+
const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
|
|
954
|
+
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
955
|
+
const assetStages = [];
|
|
956
|
+
for (const stageId of stageIds) {
|
|
957
|
+
const stage = stageMapping[stageId];
|
|
958
|
+
if (stage) {
|
|
959
|
+
assetStages.push(stage);
|
|
960
|
+
} else {
|
|
961
|
+
console.warn("selectStagesFromStageIds: No stage exists with the id", stageId);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
return assetStages;
|
|
965
|
+
})
|
|
966
|
+
);
|
|
967
|
+
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
968
|
+
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
969
|
+
const ret = {};
|
|
970
|
+
for (const stageId of stageIds) {
|
|
971
|
+
const stage = stageMapping[stageId];
|
|
972
|
+
if (!stage) {
|
|
973
|
+
throw new Error("No stage exists with the id " + stageId);
|
|
974
|
+
}
|
|
975
|
+
if (stage.form) {
|
|
976
|
+
ret[stageId] = stage.form;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return ret;
|
|
980
|
+
})
|
|
981
|
+
);
|
|
982
|
+
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
983
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
881
984
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
882
|
-
const initialState$
|
|
985
|
+
const initialState$y = assetTypeAdapter.getInitialState({});
|
|
883
986
|
const assetTypeSlice = toolkit.createSlice({
|
|
884
987
|
name: "assetTypes",
|
|
885
|
-
initialState: initialState$
|
|
886
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
988
|
+
initialState: initialState$y,
|
|
989
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
887
990
|
reducers: {
|
|
888
991
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
889
992
|
addAssetType: assetTypeAdapter.addOne,
|
|
@@ -896,43 +999,33 @@ var __publicField = (obj, key, value) => {
|
|
|
896
999
|
[selectAssetTypesMapping],
|
|
897
1000
|
(mapping) => Object.values(mapping)
|
|
898
1001
|
);
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
)
|
|
904
|
-
);
|
|
905
|
-
const selectNumberOfAssetTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
1002
|
+
const selectAssetTypeById = (id) => (state) => {
|
|
1003
|
+
return state.assetTypeReducer.instances[id];
|
|
1004
|
+
};
|
|
1005
|
+
const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
|
|
906
1006
|
toolkit.createSelector(
|
|
907
|
-
[
|
|
908
|
-
(
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
(
|
|
913
|
-
|
|
914
|
-
|
|
1007
|
+
[selectStageMapping, (_state, assetTypeIds) => assetTypeIds],
|
|
1008
|
+
(assetTypeMapping, assetTypeIds) => {
|
|
1009
|
+
const assetTypes = [];
|
|
1010
|
+
for (const stageId of assetTypeIds) {
|
|
1011
|
+
const stage = assetTypeMapping[stageId];
|
|
1012
|
+
if (stage) {
|
|
1013
|
+
assetTypes.push(stage);
|
|
1014
|
+
} else {
|
|
1015
|
+
console.warn("selectAssetTypesByIds: No stage exists with the id", stageId);
|
|
915
1016
|
}
|
|
916
|
-
|
|
1017
|
+
}
|
|
1018
|
+
return assetTypes;
|
|
917
1019
|
}
|
|
918
1020
|
)
|
|
919
1021
|
);
|
|
920
|
-
const selectAssetTypesByName = restructureCreateSelectorWithArgs(
|
|
921
|
-
toolkit.createSelector([selectAssetTypesMapping, (_state, name) => name], (mapping, name) => {
|
|
922
|
-
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
923
|
-
return Object.values(mapping).filter((assetType) => {
|
|
924
|
-
var _a2;
|
|
925
|
-
return (((_a2 = assetType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
926
|
-
});
|
|
927
|
-
})
|
|
928
|
-
);
|
|
929
1022
|
const assetTypeReducer = assetTypeSlice.reducer;
|
|
930
1023
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
931
|
-
const initialState$
|
|
1024
|
+
const initialState$x = assetAdapter.getInitialState({});
|
|
932
1025
|
const assetSlice = toolkit.createSlice({
|
|
933
1026
|
name: "assets",
|
|
934
|
-
initialState: initialState$
|
|
935
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1027
|
+
initialState: initialState$x,
|
|
1028
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
936
1029
|
reducers: {
|
|
937
1030
|
initializeAssets: (state, action) => {
|
|
938
1031
|
assetAdapter.initialize(state, action);
|
|
@@ -996,9 +1089,20 @@ var __publicField = (obj, key, value) => {
|
|
|
996
1089
|
return components.filter((asset) => asset.asset_type === assetTypeId);
|
|
997
1090
|
})
|
|
998
1091
|
);
|
|
999
|
-
const
|
|
1092
|
+
const selectAssetById = (assetId) => (state) => {
|
|
1000
1093
|
return state.assetReducer.instances[assetId];
|
|
1001
1094
|
};
|
|
1095
|
+
const selectAssetsByIds = restructureCreateSelectorWithArgs(
|
|
1096
|
+
toolkit.createSelector([selectAssetsMapping, (_, assetIds) => assetIds], (assetsMapping, assetIds) => {
|
|
1097
|
+
const assets = [];
|
|
1098
|
+
for (const assetId of assetIds) {
|
|
1099
|
+
const asset = assetsMapping[assetId];
|
|
1100
|
+
if (asset)
|
|
1101
|
+
assets.push(asset);
|
|
1102
|
+
}
|
|
1103
|
+
return assets;
|
|
1104
|
+
})
|
|
1105
|
+
);
|
|
1002
1106
|
const selectAssetToAssetTypeMapping = toolkit.createSelector(
|
|
1003
1107
|
[selectAssets, selectAssetTypesMapping],
|
|
1004
1108
|
(assets, assetTypeMapping) => {
|
|
@@ -1035,11 +1139,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1035
1139
|
};
|
|
1036
1140
|
const assetReducer = assetSlice.reducer;
|
|
1037
1141
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1038
|
-
const initialState$
|
|
1142
|
+
const initialState$w = assetAttachmentAdapter.getInitialState({});
|
|
1039
1143
|
const assetAttachmentSlice = toolkit.createSlice({
|
|
1040
1144
|
name: "assetAttachments",
|
|
1041
|
-
initialState: initialState$
|
|
1042
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1145
|
+
initialState: initialState$w,
|
|
1146
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1043
1147
|
reducers: {
|
|
1044
1148
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
1045
1149
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1097,13 +1201,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1097
1201
|
)
|
|
1098
1202
|
);
|
|
1099
1203
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1100
|
-
const initialState$
|
|
1204
|
+
const initialState$v = {
|
|
1101
1205
|
completionsByAssetId: {}
|
|
1102
1206
|
};
|
|
1103
1207
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1104
1208
|
name: "assetStageCompletions",
|
|
1105
|
-
initialState: initialState$
|
|
1106
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1209
|
+
initialState: initialState$v,
|
|
1210
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1107
1211
|
reducers: {
|
|
1108
1212
|
addStageCompletion: (state, action) => {
|
|
1109
1213
|
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
@@ -1154,97 +1258,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1154
1258
|
})
|
|
1155
1259
|
);
|
|
1156
1260
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1157
|
-
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1158
|
-
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1159
|
-
const assetStageSlice = toolkit.createSlice({
|
|
1160
|
-
name: "assetStages",
|
|
1161
|
-
initialState: initialState$w,
|
|
1162
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1163
|
-
reducers: {
|
|
1164
|
-
initializeStages: assetStageAdapter.initialize,
|
|
1165
|
-
setStage: assetStageAdapter.setOne,
|
|
1166
|
-
addStages: assetStageAdapter.addMany,
|
|
1167
|
-
updateStage: assetStageAdapter.updateOne,
|
|
1168
|
-
updateStages: assetStageAdapter.updateMany,
|
|
1169
|
-
removeStages: assetStageAdapter.deleteMany
|
|
1170
|
-
}
|
|
1171
|
-
});
|
|
1172
|
-
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
1173
|
-
const selectStage = restructureCreateSelectorWithArgs(
|
|
1174
|
-
toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
1175
|
-
return stageMapping[stageId];
|
|
1176
|
-
})
|
|
1177
|
-
);
|
|
1178
|
-
const selectStages = toolkit.createSelector(
|
|
1179
|
-
[selectStageMapping],
|
|
1180
|
-
(stageMapping) => {
|
|
1181
|
-
return Object.values(stageMapping);
|
|
1182
|
-
}
|
|
1183
|
-
);
|
|
1184
|
-
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
1185
|
-
toolkit.createSelector([selectStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
1186
|
-
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
1187
|
-
const ret = {};
|
|
1188
|
-
for (const stage of stages) {
|
|
1189
|
-
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
1190
|
-
if (!ret[stage.asset_type]) {
|
|
1191
|
-
ret[stage.asset_type] = [];
|
|
1192
|
-
}
|
|
1193
|
-
ret[stage.asset_type].push(stage);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
for (const key in ret) {
|
|
1197
|
-
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1198
|
-
}
|
|
1199
|
-
return ret;
|
|
1200
|
-
})
|
|
1201
|
-
);
|
|
1202
|
-
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1203
|
-
toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
1204
|
-
const assetTypeStagesMapping = {};
|
|
1205
|
-
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
1206
|
-
if (stage.asset_type === assetTypeId) {
|
|
1207
|
-
assetTypeStagesMapping[stageId] = stage;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
return assetTypeStagesMapping;
|
|
1211
|
-
})
|
|
1212
|
-
);
|
|
1213
|
-
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
1214
|
-
toolkit.createSelector([selectStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
|
|
1215
|
-
return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
|
|
1216
|
-
})
|
|
1217
|
-
);
|
|
1218
|
-
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
1219
|
-
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1220
|
-
return stageIds.map((offline_id) => stageMapping[offline_id]).filter((stage) => !!stage);
|
|
1221
|
-
})
|
|
1222
|
-
);
|
|
1223
|
-
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
1224
|
-
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1225
|
-
const ret = {};
|
|
1226
|
-
for (const stageId of stageIds) {
|
|
1227
|
-
const stage = stageMapping[stageId];
|
|
1228
|
-
if (!stage) {
|
|
1229
|
-
throw new Error("No stage exists with the id " + stageId);
|
|
1230
|
-
}
|
|
1231
|
-
if (stage.form) {
|
|
1232
|
-
ret[stageId] = stage.form;
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
return ret;
|
|
1236
|
-
})
|
|
1237
|
-
);
|
|
1238
|
-
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
1239
|
-
const assetStageReducer = assetStageSlice.reducer;
|
|
1240
1261
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1241
1262
|
(attachment) => attachment.offline_id
|
|
1242
1263
|
);
|
|
1243
|
-
const initialState$
|
|
1264
|
+
const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
|
|
1244
1265
|
const assetTypeAttachmentSlice = toolkit.createSlice({
|
|
1245
1266
|
name: "assetTypeAttachments",
|
|
1246
|
-
initialState: initialState$
|
|
1247
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1267
|
+
initialState: initialState$u,
|
|
1268
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1248
1269
|
reducers: {
|
|
1249
1270
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1250
1271
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1303,10 +1324,10 @@ var __publicField = (obj, key, value) => {
|
|
|
1303
1324
|
);
|
|
1304
1325
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1305
1326
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
1306
|
-
const initialState$
|
|
1327
|
+
const initialState$t = workspaceAdapter.getInitialState({});
|
|
1307
1328
|
const workspaceSlice = toolkit.createSlice({
|
|
1308
1329
|
name: "workspace",
|
|
1309
|
-
initialState: initialState$
|
|
1330
|
+
initialState: initialState$t,
|
|
1310
1331
|
reducers: {
|
|
1311
1332
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
1312
1333
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -1338,14 +1359,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1338
1359
|
const workspaceReducer = workspaceSlice.reducer;
|
|
1339
1360
|
const maxRecentIssues = 10;
|
|
1340
1361
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1341
|
-
const initialState$
|
|
1362
|
+
const initialState$s = issueAdapter.getInitialState({
|
|
1342
1363
|
recentIssueIds: []
|
|
1343
1364
|
});
|
|
1344
1365
|
const issueSlice = toolkit.createSlice({
|
|
1345
1366
|
name: "issues",
|
|
1346
|
-
initialState: initialState$
|
|
1367
|
+
initialState: initialState$s,
|
|
1347
1368
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1348
|
-
Object.assign(state, initialState$
|
|
1369
|
+
Object.assign(state, initialState$s);
|
|
1349
1370
|
}),
|
|
1350
1371
|
reducers: {
|
|
1351
1372
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1393,11 +1414,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1393
1414
|
} = issueSlice.actions;
|
|
1394
1415
|
const selectIssueMapping = (state) => state.issueReducer.instances;
|
|
1395
1416
|
const selectRecentIssueIds = (state) => state.issueReducer.recentIssueIds;
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
})
|
|
1400
|
-
);
|
|
1417
|
+
const selectIssueById = (id) => (state) => {
|
|
1418
|
+
return state.issueReducer.instances[id];
|
|
1419
|
+
};
|
|
1401
1420
|
const searchIssues = restructureCreateSelectorWithArgs(
|
|
1402
1421
|
toolkit.createSelector(
|
|
1403
1422
|
[selectIssueMapping, selectWorkspaceMapping, (_state, searchArgs) => searchArgs],
|
|
@@ -1453,6 +1472,20 @@ var __publicField = (obj, key, value) => {
|
|
|
1453
1472
|
}
|
|
1454
1473
|
)
|
|
1455
1474
|
);
|
|
1475
|
+
const selectIssuesByIds = restructureCreateSelectorWithArgs(
|
|
1476
|
+
toolkit.createSelector([selectIssueMapping, (_, issueIds) => issueIds], (issuesMapping, issueIds) => {
|
|
1477
|
+
const issues = [];
|
|
1478
|
+
for (const issueId of issueIds) {
|
|
1479
|
+
const issue = issuesMapping[issueId];
|
|
1480
|
+
if (issue) {
|
|
1481
|
+
issues.push(issue);
|
|
1482
|
+
} else {
|
|
1483
|
+
console.warn("selectIssuesByIds: No issue exists with the id", issueId);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
return issues;
|
|
1487
|
+
})
|
|
1488
|
+
);
|
|
1456
1489
|
const selectRecentIssuesAsSearchResults = toolkit.createSelector(
|
|
1457
1490
|
[selectIssueMapping, selectRecentIssueIds, selectWorkspaceMapping],
|
|
1458
1491
|
(issueMapping, recentIssueIds, workspaceMapping) => {
|
|
@@ -1489,12 +1522,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1489
1522
|
);
|
|
1490
1523
|
const issueReducer = issueSlice.reducer;
|
|
1491
1524
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1492
|
-
const initialState$
|
|
1525
|
+
const initialState$r = issueTypeAdapter.getInitialState({});
|
|
1493
1526
|
const issueTypeSlice = toolkit.createSlice({
|
|
1494
1527
|
name: "issueTypes",
|
|
1495
|
-
initialState: initialState$
|
|
1528
|
+
initialState: initialState$r,
|
|
1496
1529
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1497
|
-
Object.assign(state, initialState$
|
|
1530
|
+
Object.assign(state, initialState$r);
|
|
1498
1531
|
}),
|
|
1499
1532
|
reducers: {
|
|
1500
1533
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1514,14 +1547,21 @@ var __publicField = (obj, key, value) => {
|
|
|
1514
1547
|
return Object.values(issueTypes);
|
|
1515
1548
|
}
|
|
1516
1549
|
);
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1550
|
+
const selectIssueTypeById = (issueTypeId) => (state) => {
|
|
1551
|
+
return state.issueTypeReducer.instances[issueTypeId];
|
|
1552
|
+
};
|
|
1553
|
+
const selectIssueTypesByIds = (issueTypeIds) => (state) => {
|
|
1554
|
+
const issueTypes = [];
|
|
1555
|
+
for (const issueTypeId of issueTypeIds) {
|
|
1556
|
+
const issueType = state.issueTypeReducer.instances[issueTypeId];
|
|
1557
|
+
if (issueType) {
|
|
1558
|
+
issueTypes.push(issueType);
|
|
1559
|
+
} else {
|
|
1560
|
+
console.warn("selectIssueTypesByIds: No issue type exists with the id", issueTypeId);
|
|
1522
1561
|
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1562
|
+
}
|
|
1563
|
+
return issueTypes;
|
|
1564
|
+
};
|
|
1525
1565
|
const selectIssueTypesOfOrganization = restructureCreateSelectorWithArgs(
|
|
1526
1566
|
toolkit.createSelector(
|
|
1527
1567
|
[selectIssueTypes, (_, organizationId) => organizationId],
|
|
@@ -1543,15 +1583,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1543
1583
|
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
1544
1584
|
};
|
|
1545
1585
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1546
|
-
const initialState$
|
|
1586
|
+
const initialState$q = {
|
|
1547
1587
|
s3Urls: {}
|
|
1548
1588
|
};
|
|
1549
1589
|
const msPerHour = 1e3 * 60 * 60;
|
|
1550
1590
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1551
1591
|
const fileSlice = toolkit.createSlice({
|
|
1552
1592
|
name: "file",
|
|
1553
|
-
initialState: initialState$
|
|
1554
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1593
|
+
initialState: initialState$q,
|
|
1594
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1555
1595
|
reducers: {
|
|
1556
1596
|
setUploadUrl: (state, action) => {
|
|
1557
1597
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1632,7 +1672,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1632
1672
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
1633
1673
|
return LicenseStatus2;
|
|
1634
1674
|
})(LicenseStatus || {});
|
|
1635
|
-
const initialState$
|
|
1675
|
+
const initialState$p = {
|
|
1636
1676
|
users: {},
|
|
1637
1677
|
currentUser: {
|
|
1638
1678
|
id: 0,
|
|
@@ -1643,8 +1683,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1643
1683
|
};
|
|
1644
1684
|
const userSlice = toolkit.createSlice({
|
|
1645
1685
|
name: "users",
|
|
1646
|
-
initialState: initialState$
|
|
1647
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1686
|
+
initialState: initialState$p,
|
|
1687
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1648
1688
|
reducers: {
|
|
1649
1689
|
setUsers: (state, action) => {
|
|
1650
1690
|
const usersMapping = {};
|
|
@@ -1697,23 +1737,40 @@ var __publicField = (obj, key, value) => {
|
|
|
1697
1737
|
setTourStep,
|
|
1698
1738
|
removeUser
|
|
1699
1739
|
} = userSlice.actions;
|
|
1740
|
+
const userReducer = userSlice.reducer;
|
|
1700
1741
|
const selectCurrentUser = (state) => state.userReducer.currentUser;
|
|
1742
|
+
const selectUsersMapping = (state) => state.userReducer.users;
|
|
1701
1743
|
const selectUser = (userId) => (state) => {
|
|
1702
1744
|
if (userId === null)
|
|
1703
1745
|
return void 0;
|
|
1704
1746
|
return state.userReducer.users[userId];
|
|
1705
1747
|
};
|
|
1706
|
-
const
|
|
1748
|
+
const selectUserById = (userId) => (state) => {
|
|
1749
|
+
return state.userReducer.users[userId];
|
|
1750
|
+
};
|
|
1751
|
+
const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
1752
|
+
toolkit.createSelector([selectUsersMapping, (_state, userIds) => userIds], (usersMapping, userIds) => {
|
|
1753
|
+
const users = [];
|
|
1754
|
+
for (const userId of userIds) {
|
|
1755
|
+
const user = usersMapping[userId];
|
|
1756
|
+
if (user) {
|
|
1757
|
+
users.push(user);
|
|
1758
|
+
} else {
|
|
1759
|
+
console.warn("selectUsersByIds: No user exists with the id", userId);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
return users;
|
|
1763
|
+
})
|
|
1764
|
+
);
|
|
1707
1765
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
1708
|
-
const userReducer = userSlice.reducer;
|
|
1709
1766
|
const organizationAccessAdapter = createModelAdapter(
|
|
1710
1767
|
(organizationAccess) => organizationAccess.offline_id
|
|
1711
1768
|
);
|
|
1712
|
-
const initialState$
|
|
1769
|
+
const initialState$o = organizationAccessAdapter.getInitialState({});
|
|
1713
1770
|
const organizationAccessSlice = toolkit.createSlice({
|
|
1714
1771
|
name: "organizationAccess",
|
|
1715
|
-
initialState: initialState$
|
|
1716
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1772
|
+
initialState: initialState$o,
|
|
1773
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1717
1774
|
reducers: {
|
|
1718
1775
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1719
1776
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1724,7 +1781,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1724
1781
|
const selectOrganizationAccesses = (state) => {
|
|
1725
1782
|
return state.organizationAccessReducer.instances;
|
|
1726
1783
|
};
|
|
1727
|
-
const
|
|
1784
|
+
const selectOrganizationAccessById = (organizationAccessId) => (state) => {
|
|
1728
1785
|
return state.organizationAccessReducer.instances[organizationAccessId];
|
|
1729
1786
|
};
|
|
1730
1787
|
const selectActiveOrganizationAccess = toolkit.createSelector(
|
|
@@ -1750,11 +1807,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1750
1807
|
};
|
|
1751
1808
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1752
1809
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1753
|
-
const initialState$
|
|
1810
|
+
const initialState$n = licenseAdapter.getInitialState({});
|
|
1754
1811
|
const licenseSlice = toolkit.createSlice({
|
|
1755
1812
|
name: "license",
|
|
1756
|
-
initialState: initialState$
|
|
1757
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1813
|
+
initialState: initialState$n,
|
|
1814
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1758
1815
|
reducers: {
|
|
1759
1816
|
initializeLicences: licenseAdapter.initialize,
|
|
1760
1817
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1780,11 +1837,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1780
1837
|
);
|
|
1781
1838
|
const licenseReducer = licenseSlice.reducer;
|
|
1782
1839
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1783
|
-
const initialState$
|
|
1840
|
+
const initialState$m = projectAccessAdapter.getInitialState({});
|
|
1784
1841
|
const projectAccessSlice = toolkit.createSlice({
|
|
1785
1842
|
name: "projectAccess",
|
|
1786
|
-
initialState: initialState$
|
|
1787
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1843
|
+
initialState: initialState$m,
|
|
1844
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1788
1845
|
reducers: {
|
|
1789
1846
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1790
1847
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1802,14 +1859,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1802
1859
|
return Object.values(projectAccesses);
|
|
1803
1860
|
}
|
|
1804
1861
|
);
|
|
1805
|
-
const
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
(projectAccesses, projectAccessId) => {
|
|
1809
|
-
return projectAccesses[projectAccessId];
|
|
1810
|
-
}
|
|
1811
|
-
)
|
|
1812
|
-
);
|
|
1862
|
+
const selectProjectAccessById = (projectAccessId) => (state) => {
|
|
1863
|
+
return state.projectAccessReducer.instances[projectAccessId];
|
|
1864
|
+
};
|
|
1813
1865
|
const selectActiveProjectAccess = (state) => {
|
|
1814
1866
|
const currentUser = state.userReducer.currentUser;
|
|
1815
1867
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
@@ -1830,14 +1882,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1830
1882
|
return projectAccesses;
|
|
1831
1883
|
};
|
|
1832
1884
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1833
|
-
const initialState$
|
|
1885
|
+
const initialState$l = {
|
|
1834
1886
|
projects: {},
|
|
1835
1887
|
activeProjectId: null
|
|
1836
1888
|
};
|
|
1837
1889
|
const projectSlice = toolkit.createSlice({
|
|
1838
1890
|
name: "projects",
|
|
1839
|
-
initialState: initialState$
|
|
1840
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1891
|
+
initialState: initialState$l,
|
|
1892
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1841
1893
|
reducers: {
|
|
1842
1894
|
setProjects: (state, action) => {
|
|
1843
1895
|
const projectsMap = {};
|
|
@@ -1902,7 +1954,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1902
1954
|
addActiveProjectIssuesCount,
|
|
1903
1955
|
addActiveProjectFormSubmissionsCount
|
|
1904
1956
|
} = projectSlice.actions;
|
|
1905
|
-
const
|
|
1957
|
+
const projectReducer = projectSlice.reducer;
|
|
1958
|
+
const selectProjectMapping = (state) => state.projectReducer.projects;
|
|
1906
1959
|
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
1907
1960
|
const selectActiveProject = (state) => {
|
|
1908
1961
|
const activeProjectId = selectActiveProjectId(state);
|
|
@@ -1911,23 +1964,19 @@ var __publicField = (obj, key, value) => {
|
|
|
1911
1964
|
}
|
|
1912
1965
|
return state.projectReducer.projects[activeProjectId] ?? null;
|
|
1913
1966
|
};
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
(projects, projectId) => projects[projectId]
|
|
1918
|
-
)
|
|
1919
|
-
);
|
|
1920
|
-
const projectReducer = projectSlice.reducer;
|
|
1967
|
+
const selectProjectById = (projectId) => (state) => {
|
|
1968
|
+
return state.projectReducer.projects[projectId];
|
|
1969
|
+
};
|
|
1921
1970
|
const selectProjectUsersIds = toolkit.createSelector(
|
|
1922
1971
|
[selectProjectAccessMapping],
|
|
1923
1972
|
(projectAccesses) => Object.values(projectAccesses).map((projectAccess) => projectAccess.user)
|
|
1924
1973
|
);
|
|
1925
1974
|
const selectProjectUsersAsMapping = toolkit.createSelector(
|
|
1926
|
-
[selectProjectUsersIds,
|
|
1975
|
+
[selectProjectUsersIds, selectUsersMapping],
|
|
1927
1976
|
(projectUserIds, users) => projectUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
1928
1977
|
);
|
|
1929
1978
|
const selectProjectsWithAccess = toolkit.createSelector(
|
|
1930
|
-
[
|
|
1979
|
+
[selectProjectMapping],
|
|
1931
1980
|
(projects) => Object.values(projects).filter((project) => !project.invited)
|
|
1932
1981
|
);
|
|
1933
1982
|
const selectSortedProjectUsers = toolkit.createSelector(
|
|
@@ -1951,13 +2000,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1951
2000
|
});
|
|
1952
2001
|
}
|
|
1953
2002
|
);
|
|
1954
|
-
const initialState$
|
|
2003
|
+
const initialState$k = {
|
|
1955
2004
|
organizations: {}
|
|
1956
2005
|
};
|
|
1957
2006
|
const organizationSlice = toolkit.createSlice({
|
|
1958
2007
|
name: "organizations",
|
|
1959
|
-
initialState: initialState$
|
|
1960
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2008
|
+
initialState: initialState$k,
|
|
2009
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1961
2010
|
reducers: {
|
|
1962
2011
|
setOrganizations: (state, action) => {
|
|
1963
2012
|
for (const org of action.payload) {
|
|
@@ -1985,9 +2034,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1985
2034
|
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
1986
2035
|
);
|
|
1987
2036
|
const selectProjectsOfOrganization = restructureCreateSelectorWithArgs(
|
|
1988
|
-
toolkit.createSelector(
|
|
1989
|
-
|
|
1990
|
-
|
|
2037
|
+
toolkit.createSelector(
|
|
2038
|
+
[selectProjectMapping, (_, organizationId) => organizationId],
|
|
2039
|
+
(projects, organizationId) => {
|
|
2040
|
+
return Object.values(projects).filter((project) => project.organization_owner === organizationId);
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
1991
2043
|
);
|
|
1992
2044
|
const selectLicensesOfOrganization = restructureCreateSelectorWithArgs(
|
|
1993
2045
|
toolkit.createSelector([selectLicenses, (_, organizationId) => organizationId], (licenses, organizationId) => {
|
|
@@ -1995,7 +2047,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1995
2047
|
})
|
|
1996
2048
|
);
|
|
1997
2049
|
const selectOrganizationUsersAsMapping = toolkit.createSelector(
|
|
1998
|
-
[selectOrganizationUsersIds,
|
|
2050
|
+
[selectOrganizationUsersIds, selectUsersMapping],
|
|
1999
2051
|
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2000
2052
|
);
|
|
2001
2053
|
const selectSortedOrganizationUsers = toolkit.createSelector(
|
|
@@ -2040,14 +2092,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2040
2092
|
}
|
|
2041
2093
|
};
|
|
2042
2094
|
};
|
|
2043
|
-
const initialState$
|
|
2095
|
+
const initialState$j = {
|
|
2044
2096
|
deletedRequests: [],
|
|
2045
2097
|
latestRetryTime: 0
|
|
2046
2098
|
};
|
|
2047
2099
|
const outboxSlice = toolkit.createSlice({
|
|
2048
2100
|
name: "outbox",
|
|
2049
|
-
initialState: initialState$
|
|
2050
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2101
|
+
initialState: initialState$j,
|
|
2102
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
2051
2103
|
reducers: {
|
|
2052
2104
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2053
2105
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -2079,15 +2131,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2079
2131
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2080
2132
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2081
2133
|
const outboxReducer = outboxSlice.reducer;
|
|
2082
|
-
const initialState$
|
|
2134
|
+
const initialState$i = {
|
|
2083
2135
|
projectFiles: {},
|
|
2084
2136
|
activeProjectFileId: null,
|
|
2085
2137
|
isImportingProjectFile: false
|
|
2086
2138
|
};
|
|
2087
2139
|
const projectFileSlice = toolkit.createSlice({
|
|
2088
2140
|
name: "projectFiles",
|
|
2089
|
-
initialState: initialState$
|
|
2090
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2141
|
+
initialState: initialState$i,
|
|
2142
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
2091
2143
|
reducers: {
|
|
2092
2144
|
addOrReplaceProjectFiles: (state, action) => {
|
|
2093
2145
|
for (let fileObj of action.payload) {
|
|
@@ -2172,11 +2224,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2172
2224
|
};
|
|
2173
2225
|
const projectFileReducer = projectFileSlice.reducer;
|
|
2174
2226
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2175
|
-
const initialState$
|
|
2227
|
+
const initialState$h = projectAttachmentAdapter.getInitialState({});
|
|
2176
2228
|
const projectAttachmentSlice = toolkit.createSlice({
|
|
2177
2229
|
name: "projectAttachments",
|
|
2178
|
-
initialState: initialState$
|
|
2179
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2230
|
+
initialState: initialState$h,
|
|
2231
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2180
2232
|
reducers: {
|
|
2181
2233
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
2182
2234
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2234,12 +2286,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2234
2286
|
)
|
|
2235
2287
|
);
|
|
2236
2288
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2237
|
-
const initialState$
|
|
2289
|
+
const initialState$g = {
|
|
2238
2290
|
isRehydrated: false
|
|
2239
2291
|
};
|
|
2240
2292
|
const rehydratedSlice = toolkit.createSlice({
|
|
2241
2293
|
name: "rehydrated",
|
|
2242
|
-
initialState: initialState$
|
|
2294
|
+
initialState: initialState$g,
|
|
2243
2295
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2244
2296
|
reducers: {
|
|
2245
2297
|
setRehydrated: (state, action) => {
|
|
@@ -2250,22 +2302,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2250
2302
|
const { setRehydrated } = rehydratedSlice.actions;
|
|
2251
2303
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
2252
2304
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
2253
|
-
const initialState$g = {
|
|
2254
|
-
isFetchingInitialData: false
|
|
2255
|
-
};
|
|
2256
|
-
const settingSlice = toolkit.createSlice({
|
|
2257
|
-
name: "settings",
|
|
2258
|
-
initialState: initialState$g,
|
|
2259
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2260
|
-
reducers: {
|
|
2261
|
-
setIsFetchingInitialData: (state, action) => {
|
|
2262
|
-
state.isFetchingInitialData = action.payload;
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
});
|
|
2266
|
-
const { setIsFetchingInitialData } = settingSlice.actions;
|
|
2267
|
-
const settingReducer = settingSlice.reducer;
|
|
2268
|
-
const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
|
|
2269
2305
|
const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
2270
2306
|
const revisionA = formRevisionA.revision;
|
|
2271
2307
|
const revisionB = formRevisionB.revision;
|
|
@@ -2307,7 +2343,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2307
2343
|
[selectFormRevisionMapping],
|
|
2308
2344
|
(formRevisions) => Object.values(formRevisions)
|
|
2309
2345
|
);
|
|
2310
|
-
const
|
|
2346
|
+
const selectFormRevisionById = (formRevisionId) => (state) => {
|
|
2311
2347
|
return state.formRevisionReducer.instances[formRevisionId];
|
|
2312
2348
|
};
|
|
2313
2349
|
const _selectLatestFormRevision = (formRevisions, formId) => {
|
|
@@ -2438,12 +2474,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2438
2474
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2439
2475
|
)
|
|
2440
2476
|
);
|
|
2441
|
-
const selectForm = (formId) => (state) => {
|
|
2442
|
-
return state.formReducer.instances[formId];
|
|
2443
|
-
};
|
|
2444
2477
|
const selectFormMapping = (state) => {
|
|
2445
2478
|
return state.formReducer.instances;
|
|
2446
2479
|
};
|
|
2480
|
+
const selectFormById = (formId) => (state) => {
|
|
2481
|
+
return state.formReducer.instances[formId];
|
|
2482
|
+
};
|
|
2447
2483
|
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2448
2484
|
toolkit.createSelector(
|
|
2449
2485
|
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
@@ -2505,7 +2541,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2505
2541
|
return Object.values(submissions);
|
|
2506
2542
|
}
|
|
2507
2543
|
);
|
|
2508
|
-
const
|
|
2544
|
+
const selectFormSubmissionById = (submissionId) => (state) => {
|
|
2509
2545
|
return state.formSubmissionReducer.instances[submissionId];
|
|
2510
2546
|
};
|
|
2511
2547
|
const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
@@ -2711,6 +2747,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2711
2747
|
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
2712
2748
|
return state.formSubmissionAttachmentReducer.instances;
|
|
2713
2749
|
};
|
|
2750
|
+
const selectFormSubmissionAttachemntsByIds = restructureCreateSelectorWithArgs(
|
|
2751
|
+
toolkit.createSelector(
|
|
2752
|
+
[selectFormSubmissionAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
2753
|
+
(mapping, attachmentIds) => {
|
|
2754
|
+
const attachmentIdsSet = new Set(attachmentIds);
|
|
2755
|
+
return Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id));
|
|
2756
|
+
}
|
|
2757
|
+
)
|
|
2758
|
+
);
|
|
2714
2759
|
const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
2715
2760
|
toolkit.createSelector(
|
|
2716
2761
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
@@ -2942,10 +2987,24 @@ var __publicField = (obj, key, value) => {
|
|
|
2942
2987
|
[selectDocumentsMapping],
|
|
2943
2988
|
(mapping) => Object.values(mapping)
|
|
2944
2989
|
);
|
|
2945
|
-
const
|
|
2990
|
+
const selectDocumentById = (documentId) => (state) => {
|
|
2991
|
+
return state.documentsReducer.documents[documentId];
|
|
2992
|
+
};
|
|
2993
|
+
const selectDocumentsByIds = restructureCreateSelectorWithArgs(
|
|
2946
2994
|
toolkit.createSelector(
|
|
2947
|
-
[selectDocumentsMapping, (_state,
|
|
2948
|
-
(mapping,
|
|
2995
|
+
[selectDocumentsMapping, (_state, documentIds) => documentIds],
|
|
2996
|
+
(mapping, documentIds) => {
|
|
2997
|
+
const documents = [];
|
|
2998
|
+
for (const documentId of documentIds) {
|
|
2999
|
+
const document2 = mapping[documentId];
|
|
3000
|
+
if (document2) {
|
|
3001
|
+
documents.push(document2);
|
|
3002
|
+
} else {
|
|
3003
|
+
console.warn("selectDocumentByIds: No document exists with the id", documentId);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
return documents;
|
|
3007
|
+
}
|
|
2949
3008
|
)
|
|
2950
3009
|
);
|
|
2951
3010
|
const selectAncestorIdsOfDocument = restructureCreateSelectorWithArgs(
|
|
@@ -3049,7 +3108,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3049
3108
|
const selectTeams = toolkit.createSelector([selectTeamsMapping], (teams) => {
|
|
3050
3109
|
return Object.values(teams);
|
|
3051
3110
|
});
|
|
3052
|
-
const
|
|
3111
|
+
const selectTeamById = (teamId) => (state) => {
|
|
3053
3112
|
return state.teamReducer.instances[teamId];
|
|
3054
3113
|
};
|
|
3055
3114
|
const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
|
|
@@ -3306,6 +3365,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3306
3365
|
deleteIssueAssociations
|
|
3307
3366
|
} = issueAssociationSlice.actions;
|
|
3308
3367
|
const selectIssueAssociationMapping = (state) => state.issueAssociationReducer.instances;
|
|
3368
|
+
const selectIssueAssociations = toolkit.createSelector([selectIssueAssociationMapping], (associations) => {
|
|
3369
|
+
return Object.values(associations);
|
|
3370
|
+
});
|
|
3309
3371
|
const selectIssueAssociationById = (id) => (state) => {
|
|
3310
3372
|
return state.issueAssociationReducer.instances[id];
|
|
3311
3373
|
};
|
|
@@ -3390,7 +3452,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3390
3452
|
organizationAccessReducer,
|
|
3391
3453
|
projectFileReducer,
|
|
3392
3454
|
rehydratedReducer,
|
|
3393
|
-
settingReducer,
|
|
3394
3455
|
formReducer,
|
|
3395
3456
|
formRevisionReducer,
|
|
3396
3457
|
formRevisionAttachmentReducer,
|
|
@@ -4199,7 +4260,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4199
4260
|
async remove(assetId) {
|
|
4200
4261
|
const { store } = this.client;
|
|
4201
4262
|
const state = store.getState();
|
|
4202
|
-
const assetToBeDeleted =
|
|
4263
|
+
const assetToBeDeleted = selectAssetById(assetId)(state);
|
|
4203
4264
|
if (!assetToBeDeleted)
|
|
4204
4265
|
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
4205
4266
|
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(state);
|
|
@@ -4315,7 +4376,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4315
4376
|
add(assetId, stageId) {
|
|
4316
4377
|
var _a2;
|
|
4317
4378
|
const { store } = this.client;
|
|
4318
|
-
const assetTypeId = (_a2 =
|
|
4379
|
+
const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
|
|
4319
4380
|
if (!assetTypeId) {
|
|
4320
4381
|
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
4321
4382
|
}
|
|
@@ -4421,12 +4482,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4421
4482
|
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
4422
4483
|
const store = this.client.store;
|
|
4423
4484
|
const state = store.getState();
|
|
4424
|
-
const prevStages =
|
|
4425
|
-
stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
4426
|
-
)(state);
|
|
4427
|
-
if (!prevStages) {
|
|
4428
|
-
throw new Error("Could not find the desired stages to update within the store");
|
|
4429
|
-
}
|
|
4485
|
+
const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
|
|
4430
4486
|
this.dispatch(updateStages(stagesToUpdate));
|
|
4431
4487
|
return this.enqueueRequest({
|
|
4432
4488
|
description: "Edit asset stages",
|
|
@@ -4749,7 +4805,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4749
4805
|
async delete(assetTypeId) {
|
|
4750
4806
|
const { store } = this.client;
|
|
4751
4807
|
const state = store.getState();
|
|
4752
|
-
const assetType =
|
|
4808
|
+
const assetType = selectAssetTypeById(assetTypeId)(state);
|
|
4753
4809
|
if (!assetType) {
|
|
4754
4810
|
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
4755
4811
|
}
|
|
@@ -5003,7 +5059,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5003
5059
|
}
|
|
5004
5060
|
update(issue) {
|
|
5005
5061
|
const state = this.client.store.getState();
|
|
5006
|
-
const issueToBeUpdated =
|
|
5062
|
+
const issueToBeUpdated = selectIssueById(issue.offline_id)(state);
|
|
5007
5063
|
if (!issueToBeUpdated) {
|
|
5008
5064
|
throw new Error(
|
|
5009
5065
|
`Attempting to update an issue with offline_id ${issue.offline_id} that doesn't exist in the store`
|
|
@@ -5097,7 +5153,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5097
5153
|
async remove(id) {
|
|
5098
5154
|
const { store } = this.client;
|
|
5099
5155
|
const state = store.getState();
|
|
5100
|
-
const backup =
|
|
5156
|
+
const backup = selectIssueById(id)(state);
|
|
5101
5157
|
if (!backup) {
|
|
5102
5158
|
throw new Error(`No issue with id ${id} found in the store`);
|
|
5103
5159
|
}
|
|
@@ -5178,7 +5234,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5178
5234
|
offline_id: offlineIssueType.offline_id,
|
|
5179
5235
|
submitted_at: offlineIssueType.submitted_at,
|
|
5180
5236
|
icon: offlineIssueType.icon,
|
|
5181
|
-
|
|
5237
|
+
color: offlineIssueType.color,
|
|
5182
5238
|
name: offlineIssueType.name,
|
|
5183
5239
|
description: offlineIssueType.description
|
|
5184
5240
|
},
|
|
@@ -5192,24 +5248,24 @@ var __publicField = (obj, key, value) => {
|
|
|
5192
5248
|
});
|
|
5193
5249
|
return [offlineIssueType, promise];
|
|
5194
5250
|
}
|
|
5195
|
-
update(
|
|
5251
|
+
update(payload) {
|
|
5196
5252
|
const { store } = this.client;
|
|
5197
5253
|
const state = store.getState();
|
|
5198
|
-
const issueTypeToBeUpdated =
|
|
5254
|
+
const issueTypeToBeUpdated = selectIssueTypeById(payload.offline_id)(state);
|
|
5199
5255
|
if (!issueTypeToBeUpdated) {
|
|
5200
|
-
throw new Error(`IssueType with offline_id ${
|
|
5256
|
+
throw new Error(`IssueType with offline_id ${payload.offline_id} does not exist in the store.`);
|
|
5201
5257
|
}
|
|
5202
5258
|
const offlineUpdatedIssueType = {
|
|
5203
5259
|
...issueTypeToBeUpdated,
|
|
5204
|
-
...
|
|
5260
|
+
...payload
|
|
5205
5261
|
};
|
|
5206
5262
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5207
5263
|
const promise = this.enqueueRequest({
|
|
5208
5264
|
method: HttpMethod.PATCH,
|
|
5209
|
-
url: `/issues/types/${
|
|
5210
|
-
payload
|
|
5211
|
-
blockers: [
|
|
5212
|
-
blocks: [
|
|
5265
|
+
url: `/issues/types/${payload.offline_id}/`,
|
|
5266
|
+
payload,
|
|
5267
|
+
blockers: [payload.offline_id],
|
|
5268
|
+
blocks: [payload.offline_id]
|
|
5213
5269
|
});
|
|
5214
5270
|
promise.then((updatedIssueType) => {
|
|
5215
5271
|
this.dispatch(setIssueType(updatedIssueType));
|
|
@@ -5221,7 +5277,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5221
5277
|
delete(issueTypeId) {
|
|
5222
5278
|
const { store } = this.client;
|
|
5223
5279
|
const state = store.getState();
|
|
5224
|
-
const issueTypeToDelete =
|
|
5280
|
+
const issueTypeToDelete = selectIssueTypeById(issueTypeId)(state);
|
|
5225
5281
|
if (!issueTypeToDelete) {
|
|
5226
5282
|
throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
|
|
5227
5283
|
}
|
|
@@ -5469,7 +5525,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5469
5525
|
async delete(projectId) {
|
|
5470
5526
|
const { store } = this.client;
|
|
5471
5527
|
const state = store.getState();
|
|
5472
|
-
const projects =
|
|
5528
|
+
const projects = selectProjectMapping(state);
|
|
5473
5529
|
const project = projects[projectId];
|
|
5474
5530
|
if (!project) {
|
|
5475
5531
|
throw new Error("Expected project to exist");
|
|
@@ -5812,7 +5868,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5812
5868
|
async delete(formId) {
|
|
5813
5869
|
const { store } = this.client;
|
|
5814
5870
|
const state = store.getState();
|
|
5815
|
-
const form =
|
|
5871
|
+
const form = selectFormById(formId)(state);
|
|
5816
5872
|
if (!form) {
|
|
5817
5873
|
throw new Error("Expected form to exist");
|
|
5818
5874
|
}
|
|
@@ -5989,6 +6045,25 @@ var __publicField = (obj, key, value) => {
|
|
|
5989
6045
|
});
|
|
5990
6046
|
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5991
6047
|
}
|
|
6048
|
+
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
6049
|
+
const { store } = this.client;
|
|
6050
|
+
const state = store.getState();
|
|
6051
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
6052
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
6053
|
+
try {
|
|
6054
|
+
await this.enqueueRequest({
|
|
6055
|
+
description: "Delete form submission attachments",
|
|
6056
|
+
method: HttpMethod.DELETE,
|
|
6057
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
6058
|
+
payload: { attachments: attachmentsIds },
|
|
6059
|
+
blockers: [submissionId, ...attachmentsIds],
|
|
6060
|
+
blocks: []
|
|
6061
|
+
});
|
|
6062
|
+
} catch (e) {
|
|
6063
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
6064
|
+
throw e;
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
5992
6067
|
// Outer promise is for hashing and caching files for submission attachments
|
|
5993
6068
|
async add(payload) {
|
|
5994
6069
|
const { store } = this.client;
|
|
@@ -6128,10 +6203,64 @@ var __publicField = (obj, key, value) => {
|
|
|
6128
6203
|
});
|
|
6129
6204
|
return batchPromises;
|
|
6130
6205
|
}
|
|
6206
|
+
async update(payload) {
|
|
6207
|
+
const { store } = this.client;
|
|
6208
|
+
const state = store.getState();
|
|
6209
|
+
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
6210
|
+
if (!submissionToBeUpdated) {
|
|
6211
|
+
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
6212
|
+
}
|
|
6213
|
+
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
6214
|
+
const updatedSubmission = {
|
|
6215
|
+
...submissionToBeUpdated,
|
|
6216
|
+
...payload,
|
|
6217
|
+
// values could also have a partial update
|
|
6218
|
+
values: {
|
|
6219
|
+
...submissionToBeUpdated.values,
|
|
6220
|
+
...values
|
|
6221
|
+
}
|
|
6222
|
+
};
|
|
6223
|
+
this.dispatch(updateFormSubmission(updatedSubmission));
|
|
6224
|
+
const promise = this.enqueueRequest({
|
|
6225
|
+
description: "Delete user form submissions",
|
|
6226
|
+
method: HttpMethod.PATCH,
|
|
6227
|
+
url: `/forms/submissions/${updatedSubmission.offline_id}/`,
|
|
6228
|
+
payload: updatedSubmission,
|
|
6229
|
+
blockers: [updatedSubmission.offline_id],
|
|
6230
|
+
blocks: [updatedSubmission.offline_id]
|
|
6231
|
+
});
|
|
6232
|
+
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
6233
|
+
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
6234
|
+
for (const attachment of formSubmissionAttachments) {
|
|
6235
|
+
if (attachment.field_identifier in files) {
|
|
6236
|
+
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6239
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
6240
|
+
payload.offline_id,
|
|
6241
|
+
files
|
|
6242
|
+
);
|
|
6243
|
+
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
6244
|
+
payload.offline_id,
|
|
6245
|
+
formSubmissionAttachmentIdsToBeDeleted
|
|
6246
|
+
);
|
|
6247
|
+
promise.then((result) => {
|
|
6248
|
+
this.dispatch(setFormSubmission(result));
|
|
6249
|
+
}).catch(() => {
|
|
6250
|
+
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
6251
|
+
});
|
|
6252
|
+
return [
|
|
6253
|
+
updatedSubmission,
|
|
6254
|
+
offlineFormSubmissionAttachments,
|
|
6255
|
+
promise,
|
|
6256
|
+
attachmentsPromise,
|
|
6257
|
+
deleteAttachmentsPromise
|
|
6258
|
+
];
|
|
6259
|
+
}
|
|
6131
6260
|
async delete(submissionId) {
|
|
6132
6261
|
const { store } = this.client;
|
|
6133
6262
|
const state = store.getState();
|
|
6134
|
-
const submissionToBeDeleted =
|
|
6263
|
+
const submissionToBeDeleted = selectFormSubmissionById(submissionId)(state);
|
|
6135
6264
|
if (!submissionToBeDeleted) {
|
|
6136
6265
|
throw new Error(`Expected submission with offline_id ${submissionId} to exist`);
|
|
6137
6266
|
}
|
|
@@ -7021,7 +7150,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7021
7150
|
// TODO: @Audiopolis / Magnus - should we pass a offline_id as one arg and a UpdatedTeamProps as a second arg instead of this set up?
|
|
7022
7151
|
update(team) {
|
|
7023
7152
|
const { store } = this.client;
|
|
7024
|
-
const teamToBeUpdated =
|
|
7153
|
+
const teamToBeUpdated = selectTeamById(team.offline_id)(store.getState());
|
|
7025
7154
|
if (!teamToBeUpdated) {
|
|
7026
7155
|
throw new Error(`Expected team with offline_id ${team.offline_id} to exist`);
|
|
7027
7156
|
}
|
|
@@ -7048,7 +7177,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7048
7177
|
async delete(teamId) {
|
|
7049
7178
|
const { store } = this.client;
|
|
7050
7179
|
const state = store.getState();
|
|
7051
|
-
const team =
|
|
7180
|
+
const team = selectTeamById(teamId)(state);
|
|
7052
7181
|
if (!team) {
|
|
7053
7182
|
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
7054
7183
|
}
|
|
@@ -7068,7 +7197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7068
7197
|
}
|
|
7069
7198
|
async setMembers(teamId, members) {
|
|
7070
7199
|
const { store } = this.client;
|
|
7071
|
-
const team =
|
|
7200
|
+
const team = selectTeamById(teamId)(store.getState());
|
|
7072
7201
|
if (!team) {
|
|
7073
7202
|
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
7074
7203
|
}
|
|
@@ -7093,7 +7222,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7093
7222
|
}
|
|
7094
7223
|
async addMembers(teamId, members) {
|
|
7095
7224
|
const { store } = this.client;
|
|
7096
|
-
const team =
|
|
7225
|
+
const team = selectTeamById(teamId)(store.getState());
|
|
7097
7226
|
if (!team) {
|
|
7098
7227
|
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
7099
7228
|
}
|
|
@@ -7102,7 +7231,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7102
7231
|
}
|
|
7103
7232
|
async removeMembers(teamId, members) {
|
|
7104
7233
|
const { store } = this.client;
|
|
7105
|
-
const team =
|
|
7234
|
+
const team = selectTeamById(teamId)(store.getState());
|
|
7106
7235
|
if (!team) {
|
|
7107
7236
|
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
7108
7237
|
}
|
|
@@ -7714,21 +7843,25 @@ var __publicField = (obj, key, value) => {
|
|
|
7714
7843
|
exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
|
|
7715
7844
|
exports2.selectAllProjectAttachments = selectAllProjectAttachments;
|
|
7716
7845
|
exports2.selectAncestorIdsOfDocument = selectAncestorIdsOfDocument;
|
|
7717
|
-
exports2.selectAsset = selectAsset;
|
|
7718
7846
|
exports2.selectAssetAttachment = selectAssetAttachment;
|
|
7719
7847
|
exports2.selectAssetAttachmentMapping = selectAssetAttachmentMapping;
|
|
7720
7848
|
exports2.selectAssetAttachments = selectAssetAttachments;
|
|
7849
|
+
exports2.selectAssetById = selectAssetById;
|
|
7850
|
+
exports2.selectAssetStageById = selectAssetStageById;
|
|
7851
|
+
exports2.selectAssetStages = selectAssetStages;
|
|
7852
|
+
exports2.selectAssetStagesByIds = selectAssetStagesByIds;
|
|
7721
7853
|
exports2.selectAssetToAssetTypeMapping = selectAssetToAssetTypeMapping;
|
|
7722
|
-
exports2.selectAssetType = selectAssetType;
|
|
7723
7854
|
exports2.selectAssetTypeAttachment = selectAssetTypeAttachment;
|
|
7724
7855
|
exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
|
|
7725
7856
|
exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
|
|
7857
|
+
exports2.selectAssetTypeById = selectAssetTypeById;
|
|
7726
7858
|
exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
|
|
7727
7859
|
exports2.selectAssetTypes = selectAssetTypes;
|
|
7728
|
-
exports2.
|
|
7860
|
+
exports2.selectAssetTypesByIds = selectAssetTypesByIds;
|
|
7729
7861
|
exports2.selectAssetTypesFromIds = selectAssetTypesFromIds;
|
|
7730
7862
|
exports2.selectAssetTypesMapping = selectAssetTypesMapping;
|
|
7731
7863
|
exports2.selectAssets = selectAssets;
|
|
7864
|
+
exports2.selectAssetsByIds = selectAssetsByIds;
|
|
7732
7865
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
7733
7866
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7734
7867
|
exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
|
|
@@ -7746,6 +7879,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7746
7879
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
7747
7880
|
exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
|
|
7748
7881
|
exports2.selectCategories = selectCategories;
|
|
7882
|
+
exports2.selectCategoriesByIds = selectCategoriesByIds;
|
|
7749
7883
|
exports2.selectCategoriesOfWorkspace = selectCategoriesOfWorkspace;
|
|
7750
7884
|
exports2.selectCategoryById = selectCategoryById;
|
|
7751
7885
|
exports2.selectCategoryMapping = selectCategoryMapping;
|
|
@@ -7757,27 +7891,29 @@ var __publicField = (obj, key, value) => {
|
|
|
7757
7891
|
exports2.selectConversations = selectConversations;
|
|
7758
7892
|
exports2.selectCurrentUser = selectCurrentUser;
|
|
7759
7893
|
exports2.selectDeletedRequests = selectDeletedRequests;
|
|
7760
|
-
exports2.selectDocument = selectDocument;
|
|
7761
7894
|
exports2.selectDocumentAttachment = selectDocumentAttachment;
|
|
7762
7895
|
exports2.selectDocumentAttachmentMapping = selectDocumentAttachmentMapping;
|
|
7896
|
+
exports2.selectDocumentById = selectDocumentById;
|
|
7763
7897
|
exports2.selectDocuments = selectDocuments;
|
|
7898
|
+
exports2.selectDocumentsByIds = selectDocumentsByIds;
|
|
7764
7899
|
exports2.selectDocumentsMapping = selectDocumentsMapping;
|
|
7765
7900
|
exports2.selectEmailDomains = selectEmailDomains;
|
|
7766
7901
|
exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
|
|
7767
7902
|
exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
|
|
7768
7903
|
exports2.selectFavouriteProjects = selectFavouriteProjects;
|
|
7769
7904
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
7770
|
-
exports2.
|
|
7905
|
+
exports2.selectFormById = selectFormById;
|
|
7771
7906
|
exports2.selectFormMapping = selectFormMapping;
|
|
7772
7907
|
exports2.selectFormOfAssetType = selectFormOfAssetType;
|
|
7773
7908
|
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
7774
|
-
exports2.selectFormRevision = selectFormRevision;
|
|
7775
7909
|
exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
|
|
7910
|
+
exports2.selectFormRevisionById = selectFormRevisionById;
|
|
7776
7911
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
7777
7912
|
exports2.selectFormRevisions = selectFormRevisions;
|
|
7778
7913
|
exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
|
|
7779
|
-
exports2.
|
|
7914
|
+
exports2.selectFormSubmissionAttachemntsByIds = selectFormSubmissionAttachemntsByIds;
|
|
7780
7915
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
7916
|
+
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
7781
7917
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
7782
7918
|
exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
|
|
7783
7919
|
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
@@ -7793,27 +7929,29 @@ var __publicField = (obj, key, value) => {
|
|
|
7793
7929
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
7794
7930
|
exports2.selectGeoImages = selectGeoImages;
|
|
7795
7931
|
exports2.selectGeoImagesOfProject = selectGeoImagesOfProject;
|
|
7796
|
-
exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
|
|
7797
7932
|
exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
|
|
7798
7933
|
exports2.selectIsLoggedIn = selectIsLoggedIn;
|
|
7799
|
-
exports2.selectIssue = selectIssue;
|
|
7800
7934
|
exports2.selectIssueAssociationById = selectIssueAssociationById;
|
|
7801
7935
|
exports2.selectIssueAssociationMapping = selectIssueAssociationMapping;
|
|
7936
|
+
exports2.selectIssueAssociations = selectIssueAssociations;
|
|
7802
7937
|
exports2.selectIssueAssociationsOfAsset = selectIssueAssociationsOfAsset;
|
|
7803
7938
|
exports2.selectIssueAssociationsOfIssue = selectIssueAssociationsOfIssue;
|
|
7804
7939
|
exports2.selectIssueAssociationsToIssue = selectIssueAssociationsToIssue;
|
|
7805
7940
|
exports2.selectIssueAttachment = selectIssueAttachment;
|
|
7806
7941
|
exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
|
|
7807
7942
|
exports2.selectIssueAttachments = selectIssueAttachments;
|
|
7943
|
+
exports2.selectIssueById = selectIssueById;
|
|
7808
7944
|
exports2.selectIssueCommentMapping = selectIssueCommentMapping;
|
|
7809
7945
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
7810
7946
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
7811
|
-
exports2.
|
|
7947
|
+
exports2.selectIssueTypeById = selectIssueTypeById;
|
|
7812
7948
|
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
7813
7949
|
exports2.selectIssueTypes = selectIssueTypes;
|
|
7950
|
+
exports2.selectIssueTypesByIds = selectIssueTypesByIds;
|
|
7814
7951
|
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
7815
7952
|
exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
|
|
7816
7953
|
exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
|
|
7954
|
+
exports2.selectIssuesByIds = selectIssuesByIds;
|
|
7817
7955
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
7818
7956
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
7819
7957
|
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
@@ -7826,10 +7964,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7826
7964
|
exports2.selectLicensesForProjectsMapping = selectLicensesForProjectsMapping;
|
|
7827
7965
|
exports2.selectLicensesOfOrganization = selectLicensesOfOrganization;
|
|
7828
7966
|
exports2.selectMainWorkspace = selectMainWorkspace;
|
|
7829
|
-
exports2.selectNumberOfAssetTypesMatchingCaseInsensitiveName = selectNumberOfAssetTypesMatchingCaseInsensitiveName;
|
|
7830
7967
|
exports2.selectNumberOfAssetsOfAssetType = selectNumberOfAssetsOfAssetType;
|
|
7831
7968
|
exports2.selectOrganization = selectOrganization;
|
|
7832
|
-
exports2.
|
|
7969
|
+
exports2.selectOrganizationAccessById = selectOrganizationAccessById;
|
|
7833
7970
|
exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
|
|
7834
7971
|
exports2.selectOrganizationAccessUserMapping = selectOrganizationAccessUserMapping;
|
|
7835
7972
|
exports2.selectOrganizationAccesses = selectOrganizationAccesses;
|
|
@@ -7840,20 +7977,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7840
7977
|
exports2.selectOrganizationsMapping = selectOrganizationsMapping;
|
|
7841
7978
|
exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
|
|
7842
7979
|
exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
|
|
7843
|
-
exports2.
|
|
7844
|
-
exports2.selectProjectAccess = selectProjectAccess;
|
|
7980
|
+
exports2.selectProjectAccessById = selectProjectAccessById;
|
|
7845
7981
|
exports2.selectProjectAccessForUser = selectProjectAccessForUser;
|
|
7846
7982
|
exports2.selectProjectAccessMapping = selectProjectAccessMapping;
|
|
7847
7983
|
exports2.selectProjectAccessUserMapping = selectProjectAccessUserMapping;
|
|
7848
7984
|
exports2.selectProjectAccesses = selectProjectAccesses;
|
|
7849
7985
|
exports2.selectProjectAttachment = selectProjectAttachment;
|
|
7850
7986
|
exports2.selectProjectAttachmentMapping = selectProjectAttachmentMapping;
|
|
7987
|
+
exports2.selectProjectById = selectProjectById;
|
|
7851
7988
|
exports2.selectProjectFileById = selectProjectFileById;
|
|
7852
7989
|
exports2.selectProjectFileMapping = selectProjectFileMapping;
|
|
7853
7990
|
exports2.selectProjectFiles = selectProjectFiles;
|
|
7991
|
+
exports2.selectProjectMapping = selectProjectMapping;
|
|
7854
7992
|
exports2.selectProjectUsersAsMapping = selectProjectUsersAsMapping;
|
|
7855
7993
|
exports2.selectProjectUsersIds = selectProjectUsersIds;
|
|
7856
|
-
exports2.selectProjects = selectProjects;
|
|
7857
7994
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
7858
7995
|
exports2.selectProjectsWithAccess = selectProjectsWithAccess;
|
|
7859
7996
|
exports2.selectRecentIssueIds = selectRecentIssueIds;
|
|
@@ -7863,21 +8000,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7863
8000
|
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
7864
8001
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
7865
8002
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
7866
|
-
exports2.selectStage = selectStage;
|
|
7867
8003
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
7868
8004
|
exports2.selectStageMapping = selectStageMapping;
|
|
7869
|
-
exports2.selectStages = selectStages;
|
|
7870
8005
|
exports2.selectStagesFromAssetTypeIds = selectStagesFromAssetTypeIds;
|
|
7871
|
-
exports2.selectStagesFromStageIds = selectStagesFromStageIds;
|
|
7872
8006
|
exports2.selectStagesOfAssetType = selectStagesOfAssetType;
|
|
7873
|
-
exports2.
|
|
8007
|
+
exports2.selectTeamById = selectTeamById;
|
|
7874
8008
|
exports2.selectTeams = selectTeams;
|
|
7875
8009
|
exports2.selectTeamsMapping = selectTeamsMapping;
|
|
7876
8010
|
exports2.selectTeamsOfOrganization = selectTeamsOfOrganization;
|
|
7877
8011
|
exports2.selectTeamsOfUser = selectTeamsOfUser;
|
|
7878
8012
|
exports2.selectUploadUrl = selectUploadUrl;
|
|
7879
8013
|
exports2.selectUser = selectUser;
|
|
7880
|
-
exports2.
|
|
8014
|
+
exports2.selectUserById = selectUserById;
|
|
8015
|
+
exports2.selectUsersByIds = selectUsersByIds;
|
|
8016
|
+
exports2.selectUsersMapping = selectUsersMapping;
|
|
7881
8017
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
7882
8018
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
7883
8019
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
@@ -7904,7 +8040,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7904
8040
|
exports2.setFormSubmissions = setFormSubmissions;
|
|
7905
8041
|
exports2.setGeoImage = setGeoImage;
|
|
7906
8042
|
exports2.setGeoImages = setGeoImages;
|
|
7907
|
-
exports2.setIsFetchingInitialData = setIsFetchingInitialData;
|
|
7908
8043
|
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
7909
8044
|
exports2.setIssueAssociation = setIssueAssociation;
|
|
7910
8045
|
exports2.setIssueAssociations = setIssueAssociations;
|
|
@@ -7929,8 +8064,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7929
8064
|
exports2.setUploadUrl = setUploadUrl;
|
|
7930
8065
|
exports2.setUsers = setUsers;
|
|
7931
8066
|
exports2.setWorkspaces = setWorkspaces;
|
|
7932
|
-
exports2.settingReducer = settingReducer;
|
|
7933
|
-
exports2.settingSlice = settingSlice;
|
|
7934
8067
|
exports2.shallowEqual = shallowEqual;
|
|
7935
8068
|
exports2.slugify = slugify;
|
|
7936
8069
|
exports2.spacesToDashesLower = spacesToDashesLower;
|