@overmap-ai/core 1.0.63 → 1.0.65-bulk-form-submit.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/array.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/overmap-core.js +156 -133
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +156 -133
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/slices/assetSlice.d.ts +1 -2
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +1 -1
- package/dist/store/slices/projectSlice.d.ts +0 -1
- package/dist/store/slices/teamSlice.d.ts +2 -1
- package/dist/utils/optimization.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EMPTY_ARRAY: any[];
|
package/dist/overmap-core.js
CHANGED
|
@@ -654,6 +654,11 @@ function boundsContainPoint(bounds, coordinates) {
|
|
|
654
654
|
return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
|
|
655
655
|
}
|
|
656
656
|
const emailRegex = /^.+@.+\..+$/;
|
|
657
|
+
const fullAssetMarkerSize = 45;
|
|
658
|
+
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
659
|
+
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
660
|
+
const OUTBOX_RETRY_DELAY = 5e3;
|
|
661
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
657
662
|
let debug = false;
|
|
658
663
|
const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
|
|
659
664
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
@@ -716,6 +721,9 @@ function areArraysEqual(first, second) {
|
|
|
716
721
|
return true;
|
|
717
722
|
}
|
|
718
723
|
const genericMemo = React.memo;
|
|
724
|
+
const fallbackToEmptyArray = (array) => {
|
|
725
|
+
return array.length === 0 ? EMPTY_ARRAY : array;
|
|
726
|
+
};
|
|
719
727
|
const primaryColor = "#2D55E2";
|
|
720
728
|
const successColor = "#349C55";
|
|
721
729
|
const warningColor = "#FFA620";
|
|
@@ -890,7 +898,7 @@ const selectCategoriesByIds = restructureCreateSelectorWithArgs(
|
|
|
890
898
|
console.warn("selectCategoryByIds: No category exists with the id", categoryId);
|
|
891
899
|
}
|
|
892
900
|
}
|
|
893
|
-
return categories;
|
|
901
|
+
return fallbackToEmptyArray(categories);
|
|
894
902
|
}
|
|
895
903
|
)
|
|
896
904
|
);
|
|
@@ -904,51 +912,12 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
|
904
912
|
return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
|
|
905
913
|
};
|
|
906
914
|
const categoryReducer = categorySlice.reducer;
|
|
907
|
-
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
908
|
-
const initialState$z = assetTypeAdapter.getInitialState({});
|
|
909
|
-
const assetTypeSlice = createSlice({
|
|
910
|
-
name: "assetTypes",
|
|
911
|
-
initialState: initialState$z,
|
|
912
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
913
|
-
reducers: {
|
|
914
|
-
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
915
|
-
addAssetType: assetTypeAdapter.addOne,
|
|
916
|
-
deleteAssetType: assetTypeAdapter.deleteOne
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
|
|
920
|
-
const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
|
|
921
|
-
const selectAssetTypes = createSelector(
|
|
922
|
-
[selectAssetTypesMapping],
|
|
923
|
-
(mapping) => Object.values(mapping)
|
|
924
|
-
);
|
|
925
|
-
const selectAssetTypeById = (id) => (state) => {
|
|
926
|
-
return state.assetTypeReducer.instances[id];
|
|
927
|
-
};
|
|
928
|
-
const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
|
|
929
|
-
createSelector(
|
|
930
|
-
[selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
|
|
931
|
-
(assetTypeMapping, assetTypeIds) => {
|
|
932
|
-
const assetTypes = [];
|
|
933
|
-
for (const assetTypeId of assetTypeIds) {
|
|
934
|
-
const assetType = assetTypeMapping[assetTypeId];
|
|
935
|
-
if (assetType) {
|
|
936
|
-
assetTypes.push(assetType);
|
|
937
|
-
} else {
|
|
938
|
-
console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return assetTypes;
|
|
942
|
-
}
|
|
943
|
-
)
|
|
944
|
-
);
|
|
945
|
-
const assetTypeReducer = assetTypeSlice.reducer;
|
|
946
915
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
947
|
-
const initialState$
|
|
916
|
+
const initialState$z = assetAdapter.getInitialState({});
|
|
948
917
|
const assetSlice = createSlice({
|
|
949
918
|
name: "assets",
|
|
950
|
-
initialState: initialState$
|
|
951
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
919
|
+
initialState: initialState$z,
|
|
920
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
952
921
|
reducers: {
|
|
953
922
|
initializeAssets: assetAdapter.initialize,
|
|
954
923
|
addAsset: assetAdapter.addOne,
|
|
@@ -977,8 +946,8 @@ const selectAssets = createSelector([selectAssetsMapping], (assetsMapping) => {
|
|
|
977
946
|
return Object.values(assetsMapping);
|
|
978
947
|
});
|
|
979
948
|
const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
|
|
980
|
-
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (
|
|
981
|
-
return
|
|
949
|
+
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (assets, assetTypeId) => {
|
|
950
|
+
return fallbackToEmptyArray(assets.filter((asset) => asset.asset_type === assetTypeId));
|
|
982
951
|
})
|
|
983
952
|
);
|
|
984
953
|
const selectAssetById = (assetId) => (state) => {
|
|
@@ -992,38 +961,19 @@ const selectAssetsByIds = restructureCreateSelectorWithArgs(
|
|
|
992
961
|
if (asset)
|
|
993
962
|
assets.push(asset);
|
|
994
963
|
}
|
|
995
|
-
return assets;
|
|
964
|
+
return fallbackToEmptyArray(assets);
|
|
996
965
|
})
|
|
997
966
|
);
|
|
998
|
-
const selectAssetToAssetTypeMapping = createSelector(
|
|
999
|
-
[selectAssets, selectAssetTypesMapping],
|
|
1000
|
-
(assets, assetTypeMapping) => {
|
|
1001
|
-
const ret = {};
|
|
1002
|
-
for (const asset of assets) {
|
|
1003
|
-
const assetType = assetTypeMapping[asset.asset_type];
|
|
1004
|
-
if (!assetType) {
|
|
1005
|
-
console.error(
|
|
1006
|
-
`Asset type with ID ${asset.asset_type} not found.
|
|
1007
|
-
Expected all referenced asset types to be populated.
|
|
1008
|
-
Returning empty object to avoid fatal errors.`
|
|
1009
|
-
);
|
|
1010
|
-
return {};
|
|
1011
|
-
}
|
|
1012
|
-
ret[asset.offline_id] = assetType;
|
|
1013
|
-
}
|
|
1014
|
-
return ret;
|
|
1015
|
-
}
|
|
1016
|
-
);
|
|
1017
967
|
const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
1018
968
|
return selectAssetsOfAssetType(assetTypeId)(state).length;
|
|
1019
969
|
};
|
|
1020
970
|
const assetReducer = assetSlice.reducer;
|
|
1021
971
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1022
|
-
const initialState$
|
|
972
|
+
const initialState$y = assetAttachmentAdapter.getInitialState({});
|
|
1023
973
|
const assetAttachmentSlice = createSlice({
|
|
1024
974
|
name: "assetAttachments",
|
|
1025
|
-
initialState: initialState$
|
|
1026
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
975
|
+
initialState: initialState$y,
|
|
976
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
1027
977
|
reducers: {
|
|
1028
978
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
1029
979
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1059,7 +1009,7 @@ const selectAttachmentsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
1059
1009
|
createSelector(
|
|
1060
1010
|
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
1061
1011
|
(attachments, assetId) => {
|
|
1062
|
-
return attachments.filter(({ asset }) => assetId === asset);
|
|
1012
|
+
return fallbackToEmptyArray(attachments.filter(({ asset }) => assetId === asset));
|
|
1063
1013
|
}
|
|
1064
1014
|
)
|
|
1065
1015
|
);
|
|
@@ -1081,13 +1031,13 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1081
1031
|
)
|
|
1082
1032
|
);
|
|
1083
1033
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1084
|
-
const initialState$
|
|
1034
|
+
const initialState$x = {
|
|
1085
1035
|
completionsByAssetId: {}
|
|
1086
1036
|
};
|
|
1087
1037
|
const assetStageCompletionSlice = createSlice({
|
|
1088
1038
|
name: "assetStageCompletions",
|
|
1089
|
-
initialState: initialState$
|
|
1090
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1039
|
+
initialState: initialState$x,
|
|
1040
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1091
1041
|
reducers: {
|
|
1092
1042
|
addStageCompletion: (state, action) => {
|
|
1093
1043
|
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
@@ -1139,11 +1089,11 @@ const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
|
|
|
1139
1089
|
);
|
|
1140
1090
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1141
1091
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1142
|
-
const initialState$
|
|
1092
|
+
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1143
1093
|
const assetStageSlice = createSlice({
|
|
1144
1094
|
name: "assetStages",
|
|
1145
|
-
initialState: initialState$
|
|
1146
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1095
|
+
initialState: initialState$w,
|
|
1096
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1147
1097
|
reducers: {
|
|
1148
1098
|
initializeStages: assetStageAdapter.initialize,
|
|
1149
1099
|
setStage: assetStageAdapter.setOne,
|
|
@@ -1154,11 +1104,9 @@ const assetStageSlice = createSlice({
|
|
|
1154
1104
|
}
|
|
1155
1105
|
});
|
|
1156
1106
|
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
1157
|
-
const selectAssetStageById =
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
})
|
|
1161
|
-
);
|
|
1107
|
+
const selectAssetStageById = (id) => (state) => {
|
|
1108
|
+
return state.assetStageReducer.instances[id];
|
|
1109
|
+
};
|
|
1162
1110
|
const selectAssetStages = createSelector([selectStageMapping], (stageMapping) => {
|
|
1163
1111
|
return Object.values(stageMapping);
|
|
1164
1112
|
});
|
|
@@ -1193,7 +1141,9 @@ const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
|
1193
1141
|
);
|
|
1194
1142
|
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
1195
1143
|
createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
|
|
1196
|
-
return
|
|
1144
|
+
return fallbackToEmptyArray(
|
|
1145
|
+
stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority)
|
|
1146
|
+
);
|
|
1197
1147
|
})
|
|
1198
1148
|
);
|
|
1199
1149
|
const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
|
|
@@ -1207,7 +1157,7 @@ const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
|
|
|
1207
1157
|
console.warn("selectStagesFromStageIds: No stage exists with the id", stageId);
|
|
1208
1158
|
}
|
|
1209
1159
|
}
|
|
1210
|
-
return assetStages;
|
|
1160
|
+
return fallbackToEmptyArray(assetStages);
|
|
1211
1161
|
})
|
|
1212
1162
|
);
|
|
1213
1163
|
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
@@ -1227,6 +1177,45 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1227
1177
|
);
|
|
1228
1178
|
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
1229
1179
|
const assetStageReducer = assetStageSlice.reducer;
|
|
1180
|
+
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1181
|
+
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1182
|
+
const assetTypeSlice = createSlice({
|
|
1183
|
+
name: "assetTypes",
|
|
1184
|
+
initialState: initialState$v,
|
|
1185
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1186
|
+
reducers: {
|
|
1187
|
+
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1188
|
+
addAssetType: assetTypeAdapter.addOne,
|
|
1189
|
+
deleteAssetType: assetTypeAdapter.deleteOne
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
|
|
1193
|
+
const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
|
|
1194
|
+
const selectAssetTypes = createSelector(
|
|
1195
|
+
[selectAssetTypesMapping],
|
|
1196
|
+
(mapping) => Object.values(mapping)
|
|
1197
|
+
);
|
|
1198
|
+
const selectAssetTypeById = (id) => (state) => {
|
|
1199
|
+
return state.assetTypeReducer.instances[id];
|
|
1200
|
+
};
|
|
1201
|
+
const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
|
|
1202
|
+
createSelector(
|
|
1203
|
+
[selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
|
|
1204
|
+
(assetTypeMapping, assetTypeIds) => {
|
|
1205
|
+
const assetTypes = [];
|
|
1206
|
+
for (const assetTypeId of assetTypeIds) {
|
|
1207
|
+
const assetType = assetTypeMapping[assetTypeId];
|
|
1208
|
+
if (assetType) {
|
|
1209
|
+
assetTypes.push(assetType);
|
|
1210
|
+
} else {
|
|
1211
|
+
console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return fallbackToEmptyArray(assetTypes);
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
);
|
|
1218
|
+
const assetTypeReducer = assetTypeSlice.reducer;
|
|
1230
1219
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1231
1220
|
(attachment) => attachment.offline_id
|
|
1232
1221
|
);
|
|
@@ -1270,7 +1259,7 @@ const selectAttachmentsOfAssetType = restructureCreateSelectorWithArgs(
|
|
|
1270
1259
|
createSelector(
|
|
1271
1260
|
[selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
|
|
1272
1261
|
(attachments, assetTypeId) => {
|
|
1273
|
-
return attachments.filter(({ asset_type }) => assetTypeId === asset_type);
|
|
1262
|
+
return fallbackToEmptyArray(attachments.filter(({ asset_type }) => assetTypeId === asset_type));
|
|
1274
1263
|
}
|
|
1275
1264
|
)
|
|
1276
1265
|
);
|
|
@@ -1452,7 +1441,7 @@ const selectIssuesByIds = restructureCreateSelectorWithArgs(
|
|
|
1452
1441
|
console.warn("selectIssuesByIds: No issue exists with the id", issueId);
|
|
1453
1442
|
}
|
|
1454
1443
|
}
|
|
1455
|
-
return issues;
|
|
1444
|
+
return fallbackToEmptyArray(issues);
|
|
1456
1445
|
})
|
|
1457
1446
|
);
|
|
1458
1447
|
const selectRecentIssuesAsSearchResults = createSelector(
|
|
@@ -1535,7 +1524,7 @@ const selectIssueTypesOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
1535
1524
|
createSelector(
|
|
1536
1525
|
[selectIssueTypes, (_, organizationId) => organizationId],
|
|
1537
1526
|
(issueTypes, organizationId) => {
|
|
1538
|
-
return issueTypes.filter((issueType) => issueType.organization === organizationId);
|
|
1527
|
+
return fallbackToEmptyArray(issueTypes.filter((issueType) => issueType.organization === organizationId));
|
|
1539
1528
|
}
|
|
1540
1529
|
)
|
|
1541
1530
|
);
|
|
@@ -1543,7 +1532,9 @@ const selectIssuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
|
1543
1532
|
createSelector(
|
|
1544
1533
|
[(state) => state.issueReducer.instances, (_, issueTypeId) => issueTypeId],
|
|
1545
1534
|
(issuesMapping, issueTypeId) => {
|
|
1546
|
-
return
|
|
1535
|
+
return fallbackToEmptyArray(
|
|
1536
|
+
Object.values(issuesMapping).filter((issue) => issue.issue_type === issueTypeId)
|
|
1537
|
+
);
|
|
1547
1538
|
}
|
|
1548
1539
|
)
|
|
1549
1540
|
);
|
|
@@ -1722,7 +1713,7 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
|
1722
1713
|
console.warn("selectUsersByIds: No user exists with the id", userId);
|
|
1723
1714
|
}
|
|
1724
1715
|
}
|
|
1725
|
-
return users;
|
|
1716
|
+
return fallbackToEmptyArray(users);
|
|
1726
1717
|
})
|
|
1727
1718
|
);
|
|
1728
1719
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
@@ -1789,7 +1780,9 @@ const selectLicense = (id) => (state) => state.licenseReducer.instances[id];
|
|
|
1789
1780
|
const selectLicenseForProject = (projectId) => (state) => Object.values(state.licenseReducer.instances).find((license) => license.project === projectId);
|
|
1790
1781
|
const selectActiveStatusLicenses = createSelector(
|
|
1791
1782
|
[selectLicenses],
|
|
1792
|
-
(licenses) =>
|
|
1783
|
+
(licenses) => {
|
|
1784
|
+
return fallbackToEmptyArray(Object.values(licenses).filter((license) => license.is_active));
|
|
1785
|
+
}
|
|
1793
1786
|
);
|
|
1794
1787
|
const selectLicensesForProjectsMapping = createSelector(
|
|
1795
1788
|
[selectLicenses],
|
|
@@ -1935,10 +1928,6 @@ const selectProjectUsersAsMapping = createSelector(
|
|
|
1935
1928
|
[selectProjectUsersIds, selectUsersMapping],
|
|
1936
1929
|
(projectUserIds, users) => projectUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
1937
1930
|
);
|
|
1938
|
-
const selectProjectsWithAccess = createSelector(
|
|
1939
|
-
[selectProjectMapping],
|
|
1940
|
-
(projects) => Object.values(projects).filter((project) => !project.invited)
|
|
1941
|
-
);
|
|
1942
1931
|
const selectSortedProjectUsers = createSelector(
|
|
1943
1932
|
[selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
|
|
1944
1933
|
(currentUser, userMapping, projectAccessMapping) => {
|
|
@@ -1987,7 +1976,11 @@ const selectOrganizationById = (id) => (state) => {
|
|
|
1987
1976
|
};
|
|
1988
1977
|
const selectOrganizationsWithAccess = createSelector(
|
|
1989
1978
|
[selectOrganizations],
|
|
1990
|
-
(organizations) =>
|
|
1979
|
+
(organizations) => {
|
|
1980
|
+
return fallbackToEmptyArray(
|
|
1981
|
+
Object.values(organizations).filter((organization) => organization.has_access)
|
|
1982
|
+
);
|
|
1983
|
+
}
|
|
1991
1984
|
);
|
|
1992
1985
|
const selectOrganizationUsersIds = createSelector(
|
|
1993
1986
|
[selectOrganizationAccesses],
|
|
@@ -1997,13 +1990,17 @@ const selectProjectsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
1997
1990
|
createSelector(
|
|
1998
1991
|
[selectProjectMapping, (_, organizationId) => organizationId],
|
|
1999
1992
|
(projects, organizationId) => {
|
|
2000
|
-
return
|
|
1993
|
+
return fallbackToEmptyArray(
|
|
1994
|
+
Object.values(projects).filter((project) => project.organization_owner === organizationId)
|
|
1995
|
+
);
|
|
2001
1996
|
}
|
|
2002
1997
|
)
|
|
2003
1998
|
);
|
|
2004
1999
|
const selectLicensesOfOrganization = restructureCreateSelectorWithArgs(
|
|
2005
2000
|
createSelector([selectLicenses, (_, organizationId) => organizationId], (licenses, organizationId) => {
|
|
2006
|
-
return
|
|
2001
|
+
return fallbackToEmptyArray(
|
|
2002
|
+
Object.values(licenses).filter((license) => license.organization_owner === organizationId)
|
|
2003
|
+
);
|
|
2007
2004
|
})
|
|
2008
2005
|
);
|
|
2009
2006
|
const selectOrganizationUsersAsMapping = createSelector(
|
|
@@ -2171,7 +2168,9 @@ const selectProjectFileMapping = (state) => state.projectFileReducer.projectFile
|
|
|
2171
2168
|
const selectProjectFiles = createSelector(
|
|
2172
2169
|
[selectProjectFileMapping, selectActiveProjectId],
|
|
2173
2170
|
(mapping, activeProjectId) => {
|
|
2174
|
-
return
|
|
2171
|
+
return fallbackToEmptyArray(
|
|
2172
|
+
Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
|
|
2173
|
+
);
|
|
2175
2174
|
}
|
|
2176
2175
|
);
|
|
2177
2176
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
@@ -2219,7 +2218,7 @@ const selectProjectAttachmentById = (id) => (state) => {
|
|
|
2219
2218
|
};
|
|
2220
2219
|
const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
|
|
2221
2220
|
createSelector([selectAllProjectAttachments, (_, projectId) => projectId], (attachments, projectId) => {
|
|
2222
|
-
return attachments.filter(({ project }) => projectId === project);
|
|
2221
|
+
return fallbackToEmptyArray(attachments.filter(({ project }) => projectId === project));
|
|
2223
2222
|
})
|
|
2224
2223
|
);
|
|
2225
2224
|
const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
@@ -2329,9 +2328,7 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2329
2328
|
createSelector(
|
|
2330
2329
|
[selectFormRevisions, (_state, formId) => formId],
|
|
2331
2330
|
(revisions, formId) => {
|
|
2332
|
-
return revisions.filter((revision) =>
|
|
2333
|
-
return revision.form === formId;
|
|
2334
|
-
});
|
|
2331
|
+
return fallbackToEmptyArray(revisions.filter((revision) => revision.form === formId));
|
|
2335
2332
|
}
|
|
2336
2333
|
)
|
|
2337
2334
|
);
|
|
@@ -2479,12 +2476,16 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2479
2476
|
selectFormRevisionMapping,
|
|
2480
2477
|
(_state, formId) => formId
|
|
2481
2478
|
],
|
|
2482
|
-
(
|
|
2483
|
-
const
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2479
|
+
(submissionsMapping, revisionMapping, formId) => {
|
|
2480
|
+
const revisionIds = /* @__PURE__ */ new Set();
|
|
2481
|
+
for (const revision of Object.values(revisionMapping)) {
|
|
2482
|
+
if (revision.form !== formId)
|
|
2483
|
+
continue;
|
|
2484
|
+
revisionIds.add(revision.offline_id);
|
|
2485
|
+
}
|
|
2486
|
+
return Object.values(submissionsMapping).filter(
|
|
2487
|
+
(submission) => revisionIds.has(submission.form_revision)
|
|
2488
|
+
);
|
|
2488
2489
|
}
|
|
2489
2490
|
)
|
|
2490
2491
|
);
|
|
@@ -2680,7 +2681,9 @@ const selectFormSubmissionAttachemntsByIds = restructureCreateSelectorWithArgs(
|
|
|
2680
2681
|
[selectFormSubmissionAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
2681
2682
|
(mapping, attachmentIds) => {
|
|
2682
2683
|
const attachmentIdsSet = new Set(attachmentIds);
|
|
2683
|
-
return
|
|
2684
|
+
return fallbackToEmptyArray(
|
|
2685
|
+
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
2686
|
+
);
|
|
2684
2687
|
}
|
|
2685
2688
|
)
|
|
2686
2689
|
);
|
|
@@ -2688,7 +2691,9 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
2688
2691
|
createSelector(
|
|
2689
2692
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2690
2693
|
(attachmentsMapping, submissionId) => {
|
|
2691
|
-
return
|
|
2694
|
+
return fallbackToEmptyArray(
|
|
2695
|
+
Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
|
|
2696
|
+
);
|
|
2692
2697
|
}
|
|
2693
2698
|
)
|
|
2694
2699
|
);
|
|
@@ -2731,7 +2736,9 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
2731
2736
|
createSelector(
|
|
2732
2737
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2733
2738
|
(attachments, revisionId) => {
|
|
2734
|
-
return
|
|
2739
|
+
return fallbackToEmptyArray(
|
|
2740
|
+
Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
|
|
2741
|
+
);
|
|
2735
2742
|
}
|
|
2736
2743
|
)
|
|
2737
2744
|
);
|
|
@@ -2754,7 +2761,9 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
2754
2761
|
createSelector(
|
|
2755
2762
|
[selectEmailDomains, (_, organizationId) => organizationId],
|
|
2756
2763
|
(emailDomains, organizationId) => {
|
|
2757
|
-
return
|
|
2764
|
+
return fallbackToEmptyArray(
|
|
2765
|
+
emailDomains.filter((emailDomain) => emailDomain.organization === organizationId)
|
|
2766
|
+
);
|
|
2758
2767
|
}
|
|
2759
2768
|
)
|
|
2760
2769
|
);
|
|
@@ -2931,7 +2940,7 @@ const selectDocumentsByIds = restructureCreateSelectorWithArgs(
|
|
|
2931
2940
|
console.warn("selectDocumentByIds: No document exists with the id", documentId);
|
|
2932
2941
|
}
|
|
2933
2942
|
}
|
|
2934
|
-
return documents;
|
|
2943
|
+
return fallbackToEmptyArray(documents);
|
|
2935
2944
|
}
|
|
2936
2945
|
)
|
|
2937
2946
|
);
|
|
@@ -2946,12 +2955,12 @@ const selectAncestorIdsOfDocument = restructureCreateSelectorWithArgs(
|
|
|
2946
2955
|
listOfAncestors.push(currentAncestor.offline_id);
|
|
2947
2956
|
currentAncestor = mapping[currentAncestor.parent_document ?? ""];
|
|
2948
2957
|
}
|
|
2949
|
-
return listOfAncestors;
|
|
2958
|
+
return fallbackToEmptyArray(listOfAncestors);
|
|
2950
2959
|
})
|
|
2951
2960
|
);
|
|
2952
2961
|
const selectRootDocuments = createSelector(
|
|
2953
2962
|
[selectDocuments],
|
|
2954
|
-
(documents) => documents.filter((document2) => !document2.parent_document)
|
|
2963
|
+
(documents) => fallbackToEmptyArray(documents.filter((document2) => !document2.parent_document))
|
|
2955
2964
|
);
|
|
2956
2965
|
const documentsReducer = documentSlice.reducer;
|
|
2957
2966
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
@@ -2995,7 +3004,7 @@ const selectAttachmentsOfDocument = restructureCreateSelectorWithArgs(
|
|
|
2995
3004
|
createSelector(
|
|
2996
3005
|
[selectAllDocumentAttachments, (_state, documentId) => documentId],
|
|
2997
3006
|
(attachments, documentId) => {
|
|
2998
|
-
return attachments.filter(({ document: document2 }) => documentId === document2);
|
|
3007
|
+
return fallbackToEmptyArray(attachments.filter(({ document: document2 }) => documentId === document2));
|
|
2999
3008
|
}
|
|
3000
3009
|
)
|
|
3001
3010
|
);
|
|
@@ -3039,17 +3048,34 @@ const selectTeams = createSelector([selectTeamsMapping], (teams) => {
|
|
|
3039
3048
|
const selectTeamById = (id) => (state) => {
|
|
3040
3049
|
return state.teamReducer.instances[id];
|
|
3041
3050
|
};
|
|
3051
|
+
const selectTeamsByIds = restructureCreateSelectorWithArgs(
|
|
3052
|
+
createSelector(
|
|
3053
|
+
[selectTeamsMapping, (_state, teamIds) => teamIds],
|
|
3054
|
+
(mapping, teamIds) => {
|
|
3055
|
+
const teams = [];
|
|
3056
|
+
for (const teamId of teamIds) {
|
|
3057
|
+
const team = mapping[teamId];
|
|
3058
|
+
if (team) {
|
|
3059
|
+
teams.push(team);
|
|
3060
|
+
} else {
|
|
3061
|
+
console.warn("selectTeamsByIds: No team exists with the id", teamId);
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
return fallbackToEmptyArray(teams);
|
|
3065
|
+
}
|
|
3066
|
+
)
|
|
3067
|
+
);
|
|
3042
3068
|
const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
|
|
3043
3069
|
createSelector(
|
|
3044
3070
|
[selectTeams, (_state, organizationId) => organizationId],
|
|
3045
3071
|
(teams, organizationId) => {
|
|
3046
|
-
return teams.filter((team) => team.organization === organizationId);
|
|
3072
|
+
return fallbackToEmptyArray(teams.filter((team) => team.organization === organizationId));
|
|
3047
3073
|
}
|
|
3048
3074
|
)
|
|
3049
3075
|
);
|
|
3050
3076
|
const selectTeamsOfUser = restructureCreateSelectorWithArgs(
|
|
3051
3077
|
createSelector([selectTeams, (_state, userId) => userId], (teams, userId) => {
|
|
3052
|
-
return teams.filter((team) => team.members.includes(userId));
|
|
3078
|
+
return fallbackToEmptyArray(teams.filter((team) => team.members.includes(userId)));
|
|
3053
3079
|
})
|
|
3054
3080
|
);
|
|
3055
3081
|
const teamReducer = teamSlice.reducer;
|
|
@@ -3109,7 +3135,7 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3109
3135
|
createSelector(
|
|
3110
3136
|
[selectIssueCommentMapping, (_state, issueId) => issueId],
|
|
3111
3137
|
(commentMapping, issueId) => {
|
|
3112
|
-
return Object.values(commentMapping).filter((comment) => comment.issue === issueId);
|
|
3138
|
+
return fallbackToEmptyArray(Object.values(commentMapping).filter((comment) => comment.issue === issueId));
|
|
3113
3139
|
}
|
|
3114
3140
|
)
|
|
3115
3141
|
);
|
|
@@ -3142,7 +3168,7 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3142
3168
|
createSelector(
|
|
3143
3169
|
[selectIssueUpdateMapping, (_state, issueId) => issueId],
|
|
3144
3170
|
(updates, issueId) => {
|
|
3145
|
-
return Object.values(updates).filter((update) => update.issue === issueId);
|
|
3171
|
+
return fallbackToEmptyArray(Object.values(updates).filter((update) => update.issue === issueId));
|
|
3146
3172
|
}
|
|
3147
3173
|
)
|
|
3148
3174
|
);
|
|
@@ -3185,7 +3211,7 @@ const selectAttachmentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3185
3211
|
createSelector(
|
|
3186
3212
|
[selectIssueAttachments, (_state, issueId) => issueId],
|
|
3187
3213
|
(attachments, issueId) => {
|
|
3188
|
-
return attachments.filter(({ issue }) => issueId === issue);
|
|
3214
|
+
return fallbackToEmptyArray(attachments.filter(({ issue }) => issueId === issue));
|
|
3189
3215
|
}
|
|
3190
3216
|
)
|
|
3191
3217
|
);
|
|
@@ -3259,7 +3285,7 @@ const selectGeoImageById = (id) => (state) => {
|
|
|
3259
3285
|
};
|
|
3260
3286
|
const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
|
|
3261
3287
|
createSelector([selectGeoImages, (_, projectId) => projectId], (mapImages, projectId) => {
|
|
3262
|
-
return mapImages.filter((mapImage) => mapImage.project === projectId);
|
|
3288
|
+
return fallbackToEmptyArray(mapImages.filter((mapImage) => mapImage.project === projectId));
|
|
3263
3289
|
})
|
|
3264
3290
|
);
|
|
3265
3291
|
const geoImageReducer = geoImageSlice.reducer;
|
|
@@ -3303,7 +3329,9 @@ const selectIssueAssociationsToIssue = restructureCreateSelectorWithArgs(
|
|
|
3303
3329
|
createSelector(
|
|
3304
3330
|
[selectIssueAssociationMapping, (_state, issueId) => issueId],
|
|
3305
3331
|
(associationMapping, issueId) => {
|
|
3306
|
-
return
|
|
3332
|
+
return fallbackToEmptyArray(
|
|
3333
|
+
Object.values(associationMapping).filter((assoc) => assoc.associated_issue === issueId)
|
|
3334
|
+
);
|
|
3307
3335
|
}
|
|
3308
3336
|
)
|
|
3309
3337
|
);
|
|
@@ -3311,7 +3339,7 @@ const selectIssueAssociationsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3311
3339
|
createSelector(
|
|
3312
3340
|
[selectIssueAssociationMapping, (_state, issueId) => issueId],
|
|
3313
3341
|
(associationMapping, issueId) => {
|
|
3314
|
-
return Object.values(associationMapping).filter((assoc) => assoc.issue === issueId);
|
|
3342
|
+
return fallbackToEmptyArray(Object.values(associationMapping).filter((assoc) => assoc.issue === issueId));
|
|
3315
3343
|
}
|
|
3316
3344
|
)
|
|
3317
3345
|
);
|
|
@@ -3319,15 +3347,11 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
3319
3347
|
createSelector(
|
|
3320
3348
|
[selectIssueAssociationMapping, (_state, assetId) => assetId],
|
|
3321
3349
|
(associationMapping, assetId) => {
|
|
3322
|
-
return Object.values(associationMapping).filter((assoc) => assoc.asset === assetId);
|
|
3350
|
+
return fallbackToEmptyArray(Object.values(associationMapping).filter((assoc) => assoc.asset === assetId));
|
|
3323
3351
|
}
|
|
3324
3352
|
)
|
|
3325
3353
|
);
|
|
3326
3354
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
3327
|
-
const fullAssetMarkerSize = 45;
|
|
3328
|
-
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
3329
|
-
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
3330
|
-
const OUTBOX_RETRY_DELAY = 5e3;
|
|
3331
3355
|
let clientStore;
|
|
3332
3356
|
function setClientStore(store) {
|
|
3333
3357
|
clientStore = store;
|
|
@@ -5890,13 +5914,11 @@ const separateFilesFromValues = (values) => {
|
|
|
5890
5914
|
const newValues = {};
|
|
5891
5915
|
for (const key in values) {
|
|
5892
5916
|
const value = values[key];
|
|
5893
|
-
if (value === void 0)
|
|
5894
|
-
throw new Error("Expected value to be defined");
|
|
5895
5917
|
if (value instanceof File) {
|
|
5896
5918
|
files[key] = [value];
|
|
5897
5919
|
} else if (isArrayOfFiles(value)) {
|
|
5898
5920
|
files[key] = value;
|
|
5899
|
-
} else {
|
|
5921
|
+
} else if (value !== void 0) {
|
|
5900
5922
|
newValues[key] = value;
|
|
5901
5923
|
}
|
|
5902
5924
|
}
|
|
@@ -7001,7 +7023,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
7001
7023
|
void this.enqueueRequest({
|
|
7002
7024
|
description: "Add attachment to AI assistant",
|
|
7003
7025
|
method: HttpMethod.PATCH,
|
|
7004
|
-
url: `/
|
|
7026
|
+
url: `/documents/attachments/${attachmnentId}/`,
|
|
7005
7027
|
payload: {
|
|
7006
7028
|
readable_to_assistant: true
|
|
7007
7029
|
},
|
|
@@ -7527,6 +7549,7 @@ export {
|
|
|
7527
7549
|
DeferredPromise,
|
|
7528
7550
|
DocumentAttachmentService,
|
|
7529
7551
|
DocumentService,
|
|
7552
|
+
EMPTY_ARRAY,
|
|
7530
7553
|
EmailDomainsService,
|
|
7531
7554
|
EmailVerificationService,
|
|
7532
7555
|
FileService,
|
|
@@ -7707,6 +7730,7 @@ export {
|
|
|
7707
7730
|
enqueue,
|
|
7708
7731
|
enqueueRequest,
|
|
7709
7732
|
errorColor,
|
|
7733
|
+
fallbackToEmptyArray,
|
|
7710
7734
|
fileReducer,
|
|
7711
7735
|
fileSlice,
|
|
7712
7736
|
fileToBlob,
|
|
@@ -7843,7 +7867,6 @@ export {
|
|
|
7843
7867
|
selectAssetStageById,
|
|
7844
7868
|
selectAssetStages,
|
|
7845
7869
|
selectAssetStagesByIds,
|
|
7846
|
-
selectAssetToAssetTypeMapping,
|
|
7847
7870
|
selectAssetTypeAttachmentById,
|
|
7848
7871
|
selectAssetTypeAttachmentMapping,
|
|
7849
7872
|
selectAssetTypeAttachments,
|
|
@@ -7982,7 +8005,6 @@ export {
|
|
|
7982
8005
|
selectProjectUsersAsMapping,
|
|
7983
8006
|
selectProjectUsersIds,
|
|
7984
8007
|
selectProjectsOfOrganization,
|
|
7985
|
-
selectProjectsWithAccess,
|
|
7986
8008
|
selectRecentIssueIds,
|
|
7987
8009
|
selectRecentIssuesAsSearchResults,
|
|
7988
8010
|
selectRehydrated,
|
|
@@ -7996,6 +8018,7 @@ export {
|
|
|
7996
8018
|
selectStagesOfAssetType,
|
|
7997
8019
|
selectTeamById,
|
|
7998
8020
|
selectTeams,
|
|
8021
|
+
selectTeamsByIds,
|
|
7999
8022
|
selectTeamsMapping,
|
|
8000
8023
|
selectTeamsOfOrganization,
|
|
8001
8024
|
selectTeamsOfUser,
|