@overmap-ai/core 1.0.71-mapbox.0 → 1.0.71-mapbox.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/array.d.ts +1 -0
- package/dist/overmap-core.js +76 -70
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +76 -70
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/slices/assetStageCompletionSlice.d.ts +1 -2
- package/dist/store/slices/categorySlice.d.ts +0 -1
- package/dist/store/slices/geoImageSlice.d.ts +5 -1
- package/dist/store/slices/issueSlice.d.ts +0 -6
- package/dist/store/slices/projectFileSlice.d.ts +1 -1
- package/dist/store/slices/projectSlice.d.ts +5 -1
- package/dist/utils/optimization.d.ts +1 -0
- package/package.json +1 -4
package/dist/overmap-core.js
CHANGED
|
@@ -500,6 +500,7 @@ const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
|
500
500
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
501
501
|
const OUTBOX_RETRY_DELAY = 6e4;
|
|
502
502
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
503
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
503
504
|
let debug = false;
|
|
504
505
|
const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
|
|
505
506
|
if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
|
|
@@ -553,6 +554,9 @@ function areArraysEqual(first, second) {
|
|
|
553
554
|
const fallbackToEmptyArray = (array) => {
|
|
554
555
|
return array.length === 0 ? EMPTY_ARRAY : array;
|
|
555
556
|
};
|
|
557
|
+
const fallbackToEmptyObject = (object) => {
|
|
558
|
+
return Object.keys(object).length === 0 ? EMPTY_OBJECT : object;
|
|
559
|
+
};
|
|
556
560
|
const primaryColor = "#2D55E2";
|
|
557
561
|
const successColor = "#349C55";
|
|
558
562
|
const warningColor = "#FFA620";
|
|
@@ -839,12 +843,6 @@ const selectCategoriesByIds = restructureCreateSelectorWithArgs(
|
|
|
839
843
|
}
|
|
840
844
|
)
|
|
841
845
|
);
|
|
842
|
-
const selectCategoriesOfWorkspace = restructureCreateSelectorWithArgs(
|
|
843
|
-
createSelector(
|
|
844
|
-
[selectCategories, (_state, workspaceId) => workspaceId],
|
|
845
|
-
(categories, workspaceId) => categories.filter((category) => category.workspace === workspaceId)
|
|
846
|
-
)
|
|
847
|
-
);
|
|
848
846
|
const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
849
847
|
return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
|
|
850
848
|
};
|
|
@@ -880,7 +878,7 @@ const {
|
|
|
880
878
|
} = assetSlice.actions;
|
|
881
879
|
const selectAssetsMapping = (state) => state.assetReducer.instances;
|
|
882
880
|
const selectAssets = createSelector([selectAssetsMapping], (assetsMapping) => {
|
|
883
|
-
return Object.values(assetsMapping);
|
|
881
|
+
return fallbackToEmptyArray(Object.values(assetsMapping));
|
|
884
882
|
});
|
|
885
883
|
const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
|
|
886
884
|
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (assets, assetTypeId) => {
|
|
@@ -955,13 +953,17 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
955
953
|
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
956
954
|
(attachments, assetId) => {
|
|
957
955
|
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
958
|
-
const fileAttachments =
|
|
959
|
-
|
|
960
|
-
|
|
956
|
+
const fileAttachments = fallbackToEmptyArray(
|
|
957
|
+
attachmentsOfAsset.filter(
|
|
958
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
959
|
+
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
960
|
+
)
|
|
961
961
|
);
|
|
962
|
-
const imageAttachments =
|
|
963
|
-
|
|
964
|
-
|
|
962
|
+
const imageAttachments = fallbackToEmptyArray(
|
|
963
|
+
attachmentsOfAsset.filter(
|
|
964
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
965
|
+
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
966
|
+
)
|
|
965
967
|
);
|
|
966
968
|
return { fileAttachments, imageAttachments };
|
|
967
969
|
}
|
|
@@ -1008,17 +1010,9 @@ const selectCompletedStagesByAsset = createSelector(
|
|
|
1008
1010
|
completedStagesByAsset[asset] = {};
|
|
1009
1011
|
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1010
1012
|
}
|
|
1011
|
-
return completedStagesByAsset;
|
|
1013
|
+
return fallbackToEmptyObject(completedStagesByAsset);
|
|
1012
1014
|
}
|
|
1013
1015
|
);
|
|
1014
|
-
const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
|
|
1015
|
-
createSelector(
|
|
1016
|
-
[selectAssetStageCompletionMapping, (_state, asset) => asset],
|
|
1017
|
-
(completedStages, asset) => {
|
|
1018
|
-
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1019
|
-
}
|
|
1020
|
-
)
|
|
1021
|
-
);
|
|
1022
1016
|
const selectAssetStageCompletionById = (id) => (state) => {
|
|
1023
1017
|
return state.assetStageCompletionReducer.instances[id];
|
|
1024
1018
|
};
|
|
@@ -1081,7 +1075,7 @@ const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
|
1081
1075
|
assetTypeStagesMapping[stageId] = stage;
|
|
1082
1076
|
}
|
|
1083
1077
|
}
|
|
1084
|
-
return assetTypeStagesMapping;
|
|
1078
|
+
return fallbackToEmptyObject(assetTypeStagesMapping);
|
|
1085
1079
|
})
|
|
1086
1080
|
);
|
|
1087
1081
|
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
@@ -1477,7 +1471,7 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
1477
1471
|
for (const organizationAccess of Object.values(state.organizationAccessReducer.instances)) {
|
|
1478
1472
|
organizationAccesses[organizationAccess.user] = organizationAccess;
|
|
1479
1473
|
}
|
|
1480
|
-
return organizationAccesses;
|
|
1474
|
+
return fallbackToEmptyObject(organizationAccesses);
|
|
1481
1475
|
};
|
|
1482
1476
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1483
1477
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
@@ -1506,7 +1500,9 @@ const selectActiveStatusLicenses = createSelector(
|
|
|
1506
1500
|
);
|
|
1507
1501
|
const selectLicensesForProjectsMapping = createSelector(
|
|
1508
1502
|
[selectLicenses],
|
|
1509
|
-
(licenses) =>
|
|
1503
|
+
(licenses) => fallbackToEmptyObject(
|
|
1504
|
+
Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
1505
|
+
)
|
|
1510
1506
|
);
|
|
1511
1507
|
const licenseReducer = licenseSlice.reducer;
|
|
1512
1508
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
@@ -1552,7 +1548,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1552
1548
|
for (const projectAccess of Object.values(state.projectAccessReducer.instances)) {
|
|
1553
1549
|
projectAccesses[projectAccess.user] = projectAccess;
|
|
1554
1550
|
}
|
|
1555
|
-
return projectAccesses;
|
|
1551
|
+
return fallbackToEmptyObject(projectAccesses);
|
|
1556
1552
|
};
|
|
1557
1553
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1558
1554
|
const initialState$m = {
|
|
@@ -1630,13 +1626,15 @@ const {
|
|
|
1630
1626
|
const projectReducer = projectSlice.reducer;
|
|
1631
1627
|
const selectProjectMapping = (state) => state.projectReducer.projects;
|
|
1632
1628
|
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
1633
|
-
const selectActiveProject = (
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1629
|
+
const selectActiveProject = createSelector(
|
|
1630
|
+
[selectProjectMapping, selectActiveProjectId],
|
|
1631
|
+
(projectsMapping, activeprojectId) => {
|
|
1632
|
+
if (activeprojectId === null) {
|
|
1633
|
+
return null;
|
|
1634
|
+
}
|
|
1635
|
+
return projectsMapping[activeprojectId] ?? null;
|
|
1637
1636
|
}
|
|
1638
|
-
|
|
1639
|
-
};
|
|
1637
|
+
);
|
|
1640
1638
|
const selectProjectById = (id) => (state) => {
|
|
1641
1639
|
return state.projectReducer.projects[id];
|
|
1642
1640
|
};
|
|
@@ -1651,22 +1649,24 @@ const selectProjectUsersAsMapping = createSelector(
|
|
|
1651
1649
|
const selectSortedProjectUsers = createSelector(
|
|
1652
1650
|
[selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
|
|
1653
1651
|
(currentUser, userMapping, projectAccessMapping) => {
|
|
1654
|
-
return
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1652
|
+
return fallbackToEmptyArray(
|
|
1653
|
+
Object.values(userMapping).sort((userA, userB) => {
|
|
1654
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1655
|
+
return -1;
|
|
1656
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1657
|
+
return 1;
|
|
1658
|
+
}
|
|
1659
|
+
const projectAccessesA = projectAccessMapping[userA.id];
|
|
1660
|
+
const projectAccessesB = projectAccessMapping[userB.id];
|
|
1661
|
+
if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === (projectAccessesB == null ? void 0 : projectAccessesB.access_level)) {
|
|
1662
|
+
return userA.username.localeCompare(userB.username);
|
|
1663
|
+
}
|
|
1664
|
+
if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === ProjectAccessLevel.ADMIN) {
|
|
1665
|
+
return -1;
|
|
1666
|
+
}
|
|
1658
1667
|
return 1;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
const projectAccessesB = projectAccessMapping[userB.id];
|
|
1662
|
-
if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === (projectAccessesB == null ? void 0 : projectAccessesB.access_level)) {
|
|
1663
|
-
return userA.username.localeCompare(userB.username);
|
|
1664
|
-
}
|
|
1665
|
-
if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === ProjectAccessLevel.ADMIN) {
|
|
1666
|
-
return -1;
|
|
1667
|
-
}
|
|
1668
|
-
return 1;
|
|
1669
|
-
});
|
|
1668
|
+
})
|
|
1669
|
+
);
|
|
1670
1670
|
}
|
|
1671
1671
|
);
|
|
1672
1672
|
const initialState$l = {
|
|
@@ -1725,27 +1725,31 @@ const selectLicensesOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
1725
1725
|
);
|
|
1726
1726
|
const selectOrganizationUsersAsMapping = createSelector(
|
|
1727
1727
|
[selectOrganizationUsersIds, selectUsersMapping],
|
|
1728
|
-
(organizationUserIds, users) =>
|
|
1728
|
+
(organizationUserIds, users) => fallbackToEmptyObject(
|
|
1729
|
+
organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
1730
|
+
)
|
|
1729
1731
|
);
|
|
1730
1732
|
const selectSortedOrganizationUsers = createSelector(
|
|
1731
1733
|
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
1732
1734
|
(currentUser, userMapping, organizationAccessMapping) => {
|
|
1733
|
-
return
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1735
|
+
return fallbackToEmptyArray(
|
|
1736
|
+
Object.values(userMapping).sort((userA, userB) => {
|
|
1737
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1738
|
+
return -1;
|
|
1739
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1740
|
+
return 1;
|
|
1741
|
+
}
|
|
1742
|
+
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
1743
|
+
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
1744
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
1745
|
+
return userA.username.localeCompare(userB.username);
|
|
1746
|
+
}
|
|
1747
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
1748
|
+
return -1;
|
|
1749
|
+
}
|
|
1737
1750
|
return 1;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
1741
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
1742
|
-
return userA.username.localeCompare(userB.username);
|
|
1743
|
-
}
|
|
1744
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
1745
|
-
return -1;
|
|
1746
|
-
}
|
|
1747
|
-
return 1;
|
|
1748
|
-
});
|
|
1751
|
+
})
|
|
1752
|
+
);
|
|
1749
1753
|
}
|
|
1750
1754
|
);
|
|
1751
1755
|
const organizationReducer = organizationSlice.reducer;
|
|
@@ -1893,11 +1897,11 @@ const selectProjectFiles = createSelector(
|
|
|
1893
1897
|
);
|
|
1894
1898
|
}
|
|
1895
1899
|
);
|
|
1896
|
-
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1897
|
-
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
1898
1900
|
const selectProjectFileById = (id) => (state) => {
|
|
1899
1901
|
return state.projectFileReducer.projectFiles[id];
|
|
1900
1902
|
};
|
|
1903
|
+
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
1904
|
+
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
1901
1905
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1902
1906
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1903
1907
|
const initialState$i = projectAttachmentAdapter.getInitialState({});
|
|
@@ -2667,8 +2671,8 @@ const selectDocuments = createSelector(
|
|
|
2667
2671
|
[selectDocumentsMapping],
|
|
2668
2672
|
(mapping) => Object.values(mapping)
|
|
2669
2673
|
);
|
|
2670
|
-
const selectDocumentById = (
|
|
2671
|
-
return state.documentsReducer.documents[
|
|
2674
|
+
const selectDocumentById = (id) => (state) => {
|
|
2675
|
+
return state.documentsReducer.documents[id];
|
|
2672
2676
|
};
|
|
2673
2677
|
const selectDocumentsByIds = restructureCreateSelectorWithArgs(
|
|
2674
2678
|
createSelector(
|
|
@@ -3022,7 +3026,9 @@ const {
|
|
|
3022
3026
|
deleteGeoImages
|
|
3023
3027
|
} = geoImageSlice.actions;
|
|
3024
3028
|
const selectGeoImageMapping = (state) => state.geoImageReducer.instances;
|
|
3025
|
-
const selectGeoImages = (
|
|
3029
|
+
const selectGeoImages = createSelector([selectGeoImageMapping], (geoImagesMapping) => {
|
|
3030
|
+
return Object.values(geoImagesMapping);
|
|
3031
|
+
});
|
|
3026
3032
|
const selectGeoImageById = (id) => (state) => {
|
|
3027
3033
|
return state.geoImageReducer.instances[id];
|
|
3028
3034
|
};
|
|
@@ -7304,6 +7310,7 @@ export {
|
|
|
7304
7310
|
DocumentAttachmentService,
|
|
7305
7311
|
DocumentService,
|
|
7306
7312
|
EMPTY_ARRAY,
|
|
7313
|
+
EMPTY_OBJECT,
|
|
7307
7314
|
EmailDomainsService,
|
|
7308
7315
|
EmailVerificationService,
|
|
7309
7316
|
FileService,
|
|
@@ -7484,6 +7491,7 @@ export {
|
|
|
7484
7491
|
enqueueRequest,
|
|
7485
7492
|
errorColor,
|
|
7486
7493
|
fallbackToEmptyArray,
|
|
7494
|
+
fallbackToEmptyObject,
|
|
7487
7495
|
fileReducer,
|
|
7488
7496
|
fileSlice,
|
|
7489
7497
|
fileToBlob,
|
|
@@ -7636,11 +7644,9 @@ export {
|
|
|
7636
7644
|
selectAttachmentsOfProjectByType,
|
|
7637
7645
|
selectCategories,
|
|
7638
7646
|
selectCategoriesByIds,
|
|
7639
|
-
selectCategoriesOfWorkspace,
|
|
7640
7647
|
selectCategoryById,
|
|
7641
7648
|
selectCategoryMapping,
|
|
7642
7649
|
selectCommentsOfIssue,
|
|
7643
|
-
selectCompletedStageIdsForAsset,
|
|
7644
7650
|
selectCompletedStagesByAsset,
|
|
7645
7651
|
selectConversation,
|
|
7646
7652
|
selectConversationMapping,
|