@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.
@@ -489,6 +489,7 @@ var __publicField = (obj, key, value) => {
489
489
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
490
490
  const OUTBOX_RETRY_DELAY = 6e4;
491
491
  const EMPTY_ARRAY = Object.freeze([]);
492
+ const EMPTY_OBJECT = Object.freeze({});
492
493
  let debug = false;
493
494
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
494
495
  if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
@@ -542,6 +543,9 @@ var __publicField = (obj, key, value) => {
542
543
  const fallbackToEmptyArray = (array) => {
543
544
  return array.length === 0 ? EMPTY_ARRAY : array;
544
545
  };
546
+ const fallbackToEmptyObject = (object) => {
547
+ return Object.keys(object).length === 0 ? EMPTY_OBJECT : object;
548
+ };
545
549
  const primaryColor = "#2D55E2";
546
550
  const successColor = "#349C55";
547
551
  const warningColor = "#FFA620";
@@ -828,12 +832,6 @@ var __publicField = (obj, key, value) => {
828
832
  }
829
833
  )
830
834
  );
831
- const selectCategoriesOfWorkspace = restructureCreateSelectorWithArgs(
832
- toolkit.createSelector(
833
- [selectCategories, (_state, workspaceId) => workspaceId],
834
- (categories, workspaceId) => categories.filter((category) => category.workspace === workspaceId)
835
- )
836
- );
837
835
  const selectIssueCountOfCategory = (categoryId) => (state) => {
838
836
  return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
839
837
  };
@@ -869,7 +867,7 @@ var __publicField = (obj, key, value) => {
869
867
  } = assetSlice.actions;
870
868
  const selectAssetsMapping = (state) => state.assetReducer.instances;
871
869
  const selectAssets = toolkit.createSelector([selectAssetsMapping], (assetsMapping) => {
872
- return Object.values(assetsMapping);
870
+ return fallbackToEmptyArray(Object.values(assetsMapping));
873
871
  });
874
872
  const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
875
873
  toolkit.createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (assets, assetTypeId) => {
@@ -944,13 +942,17 @@ var __publicField = (obj, key, value) => {
944
942
  [selectAssetAttachments, (_state, assetId) => assetId],
945
943
  (attachments, assetId) => {
946
944
  const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
947
- const fileAttachments = attachmentsOfAsset.filter(
948
- // this null check here is necessary, there are cases where file_type is null or undefined
949
- ({ file_type }) => !file_type || !file_type.startsWith("image/")
945
+ const fileAttachments = fallbackToEmptyArray(
946
+ attachmentsOfAsset.filter(
947
+ // this null check here is necessary, there are cases where file_type is null or undefined
948
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
949
+ )
950
950
  );
951
- const imageAttachments = attachmentsOfAsset.filter(
952
- // this null check here is necessary, there are cases where file_type is null or undefined
953
- ({ file_type }) => file_type && file_type.startsWith("image/")
951
+ const imageAttachments = fallbackToEmptyArray(
952
+ attachmentsOfAsset.filter(
953
+ // this null check here is necessary, there are cases where file_type is null or undefined
954
+ ({ file_type }) => file_type && file_type.startsWith("image/")
955
+ )
954
956
  );
955
957
  return { fileAttachments, imageAttachments };
956
958
  }
@@ -997,17 +999,9 @@ var __publicField = (obj, key, value) => {
997
999
  completedStagesByAsset[asset] = {};
998
1000
  completedStagesByAsset[asset][stage] = submitted_at;
999
1001
  }
1000
- return completedStagesByAsset;
1002
+ return fallbackToEmptyObject(completedStagesByAsset);
1001
1003
  }
1002
1004
  );
1003
- const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1004
- toolkit.createSelector(
1005
- [selectAssetStageCompletionMapping, (_state, asset) => asset],
1006
- (completedStages, asset) => {
1007
- return Object.keys(completedStages[asset.offline_id] ?? {});
1008
- }
1009
- )
1010
- );
1011
1005
  const selectAssetStageCompletionById = (id) => (state) => {
1012
1006
  return state.assetStageCompletionReducer.instances[id];
1013
1007
  };
@@ -1070,7 +1064,7 @@ var __publicField = (obj, key, value) => {
1070
1064
  assetTypeStagesMapping[stageId] = stage;
1071
1065
  }
1072
1066
  }
1073
- return assetTypeStagesMapping;
1067
+ return fallbackToEmptyObject(assetTypeStagesMapping);
1074
1068
  })
1075
1069
  );
1076
1070
  const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
@@ -1466,7 +1460,7 @@ var __publicField = (obj, key, value) => {
1466
1460
  for (const organizationAccess of Object.values(state.organizationAccessReducer.instances)) {
1467
1461
  organizationAccesses[organizationAccess.user] = organizationAccess;
1468
1462
  }
1469
- return organizationAccesses;
1463
+ return fallbackToEmptyObject(organizationAccesses);
1470
1464
  };
1471
1465
  const organizationAccessReducer = organizationAccessSlice.reducer;
1472
1466
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
@@ -1495,7 +1489,9 @@ var __publicField = (obj, key, value) => {
1495
1489
  );
1496
1490
  const selectLicensesForProjectsMapping = toolkit.createSelector(
1497
1491
  [selectLicenses],
1498
- (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
1492
+ (licenses) => fallbackToEmptyObject(
1493
+ Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
1494
+ )
1499
1495
  );
1500
1496
  const licenseReducer = licenseSlice.reducer;
1501
1497
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
@@ -1541,7 +1537,7 @@ var __publicField = (obj, key, value) => {
1541
1537
  for (const projectAccess of Object.values(state.projectAccessReducer.instances)) {
1542
1538
  projectAccesses[projectAccess.user] = projectAccess;
1543
1539
  }
1544
- return projectAccesses;
1540
+ return fallbackToEmptyObject(projectAccesses);
1545
1541
  };
1546
1542
  const projectAccessReducer = projectAccessSlice.reducer;
1547
1543
  const initialState$m = {
@@ -1619,13 +1615,15 @@ var __publicField = (obj, key, value) => {
1619
1615
  const projectReducer = projectSlice.reducer;
1620
1616
  const selectProjectMapping = (state) => state.projectReducer.projects;
1621
1617
  const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
1622
- const selectActiveProject = (state) => {
1623
- const activeProjectId = selectActiveProjectId(state);
1624
- if (!activeProjectId) {
1625
- return null;
1618
+ const selectActiveProject = toolkit.createSelector(
1619
+ [selectProjectMapping, selectActiveProjectId],
1620
+ (projectsMapping, activeprojectId) => {
1621
+ if (activeprojectId === null) {
1622
+ return null;
1623
+ }
1624
+ return projectsMapping[activeprojectId] ?? null;
1626
1625
  }
1627
- return state.projectReducer.projects[activeProjectId] ?? null;
1628
- };
1626
+ );
1629
1627
  const selectProjectById = (id) => (state) => {
1630
1628
  return state.projectReducer.projects[id];
1631
1629
  };
@@ -1640,22 +1638,24 @@ var __publicField = (obj, key, value) => {
1640
1638
  const selectSortedProjectUsers = toolkit.createSelector(
1641
1639
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1642
1640
  (currentUser, userMapping, projectAccessMapping) => {
1643
- return Object.values(userMapping).sort((userA, userB) => {
1644
- if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1645
- return -1;
1646
- } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1641
+ return fallbackToEmptyArray(
1642
+ Object.values(userMapping).sort((userA, userB) => {
1643
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1644
+ return -1;
1645
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1646
+ return 1;
1647
+ }
1648
+ const projectAccessesA = projectAccessMapping[userA.id];
1649
+ const projectAccessesB = projectAccessMapping[userB.id];
1650
+ if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === (projectAccessesB == null ? void 0 : projectAccessesB.access_level)) {
1651
+ return userA.username.localeCompare(userB.username);
1652
+ }
1653
+ if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === ProjectAccessLevel.ADMIN) {
1654
+ return -1;
1655
+ }
1647
1656
  return 1;
1648
- }
1649
- const projectAccessesA = projectAccessMapping[userA.id];
1650
- const projectAccessesB = projectAccessMapping[userB.id];
1651
- if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === (projectAccessesB == null ? void 0 : projectAccessesB.access_level)) {
1652
- return userA.username.localeCompare(userB.username);
1653
- }
1654
- if ((projectAccessesA == null ? void 0 : projectAccessesA.access_level) === ProjectAccessLevel.ADMIN) {
1655
- return -1;
1656
- }
1657
- return 1;
1658
- });
1657
+ })
1658
+ );
1659
1659
  }
1660
1660
  );
1661
1661
  const initialState$l = {
@@ -1714,27 +1714,31 @@ var __publicField = (obj, key, value) => {
1714
1714
  );
1715
1715
  const selectOrganizationUsersAsMapping = toolkit.createSelector(
1716
1716
  [selectOrganizationUsersIds, selectUsersMapping],
1717
- (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
1717
+ (organizationUserIds, users) => fallbackToEmptyObject(
1718
+ organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
1719
+ )
1718
1720
  );
1719
1721
  const selectSortedOrganizationUsers = toolkit.createSelector(
1720
1722
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
1721
1723
  (currentUser, userMapping, organizationAccessMapping) => {
1722
- return Object.values(userMapping).sort((userA, userB) => {
1723
- if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1724
- return -1;
1725
- } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1724
+ return fallbackToEmptyArray(
1725
+ Object.values(userMapping).sort((userA, userB) => {
1726
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1727
+ return -1;
1728
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1729
+ return 1;
1730
+ }
1731
+ const organizationAccessesA = organizationAccessMapping[userA.id];
1732
+ const organizationAccessesB = organizationAccessMapping[userB.id];
1733
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
1734
+ return userA.username.localeCompare(userB.username);
1735
+ }
1736
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
1737
+ return -1;
1738
+ }
1726
1739
  return 1;
1727
- }
1728
- const organizationAccessesA = organizationAccessMapping[userA.id];
1729
- const organizationAccessesB = organizationAccessMapping[userB.id];
1730
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
1731
- return userA.username.localeCompare(userB.username);
1732
- }
1733
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
1734
- return -1;
1735
- }
1736
- return 1;
1737
- });
1740
+ })
1741
+ );
1738
1742
  }
1739
1743
  );
1740
1744
  const organizationReducer = organizationSlice.reducer;
@@ -1882,11 +1886,11 @@ var __publicField = (obj, key, value) => {
1882
1886
  );
1883
1887
  }
1884
1888
  );
1885
- const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
1886
- const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
1887
1889
  const selectProjectFileById = (id) => (state) => {
1888
1890
  return state.projectFileReducer.projectFiles[id];
1889
1891
  };
1892
+ const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
1893
+ const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
1890
1894
  const projectFileReducer = projectFileSlice.reducer;
1891
1895
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1892
1896
  const initialState$i = projectAttachmentAdapter.getInitialState({});
@@ -2656,8 +2660,8 @@ var __publicField = (obj, key, value) => {
2656
2660
  [selectDocumentsMapping],
2657
2661
  (mapping) => Object.values(mapping)
2658
2662
  );
2659
- const selectDocumentById = (documentId) => (state) => {
2660
- return state.documentsReducer.documents[documentId];
2663
+ const selectDocumentById = (id) => (state) => {
2664
+ return state.documentsReducer.documents[id];
2661
2665
  };
2662
2666
  const selectDocumentsByIds = restructureCreateSelectorWithArgs(
2663
2667
  toolkit.createSelector(
@@ -3011,7 +3015,9 @@ var __publicField = (obj, key, value) => {
3011
3015
  deleteGeoImages
3012
3016
  } = geoImageSlice.actions;
3013
3017
  const selectGeoImageMapping = (state) => state.geoImageReducer.instances;
3014
- const selectGeoImages = (state) => Object.values(state.geoImageReducer.instances);
3018
+ const selectGeoImages = toolkit.createSelector([selectGeoImageMapping], (geoImagesMapping) => {
3019
+ return Object.values(geoImagesMapping);
3020
+ });
3015
3021
  const selectGeoImageById = (id) => (state) => {
3016
3022
  return state.geoImageReducer.instances[id];
3017
3023
  };
@@ -7292,6 +7298,7 @@ var __publicField = (obj, key, value) => {
7292
7298
  exports2.DocumentAttachmentService = DocumentAttachmentService;
7293
7299
  exports2.DocumentService = DocumentService;
7294
7300
  exports2.EMPTY_ARRAY = EMPTY_ARRAY;
7301
+ exports2.EMPTY_OBJECT = EMPTY_OBJECT;
7295
7302
  exports2.EmailDomainsService = EmailDomainsService;
7296
7303
  exports2.EmailVerificationService = EmailVerificationService;
7297
7304
  exports2.FileService = FileService;
@@ -7472,6 +7479,7 @@ var __publicField = (obj, key, value) => {
7472
7479
  exports2.enqueueRequest = enqueueRequest;
7473
7480
  exports2.errorColor = errorColor;
7474
7481
  exports2.fallbackToEmptyArray = fallbackToEmptyArray;
7482
+ exports2.fallbackToEmptyObject = fallbackToEmptyObject;
7475
7483
  exports2.fileReducer = fileReducer;
7476
7484
  exports2.fileSlice = fileSlice;
7477
7485
  exports2.fileToBlob = fileToBlob;
@@ -7624,11 +7632,9 @@ var __publicField = (obj, key, value) => {
7624
7632
  exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
7625
7633
  exports2.selectCategories = selectCategories;
7626
7634
  exports2.selectCategoriesByIds = selectCategoriesByIds;
7627
- exports2.selectCategoriesOfWorkspace = selectCategoriesOfWorkspace;
7628
7635
  exports2.selectCategoryById = selectCategoryById;
7629
7636
  exports2.selectCategoryMapping = selectCategoryMapping;
7630
7637
  exports2.selectCommentsOfIssue = selectCommentsOfIssue;
7631
- exports2.selectCompletedStageIdsForAsset = selectCompletedStageIdsForAsset;
7632
7638
  exports2.selectCompletedStagesByAsset = selectCompletedStagesByAsset;
7633
7639
  exports2.selectConversation = selectConversation;
7634
7640
  exports2.selectConversationMapping = selectConversationMapping;