@overmap-ai/core 1.0.63-selector-standardization.1 → 1.0.63-selector-standardization.3

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.
Files changed (37) hide show
  1. package/dist/overmap-core.js +36 -53
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +36 -53
  4. package/dist/overmap-core.umd.cjs.map +1 -1
  5. package/dist/sdk/services/AssetAttachmentService.d.ts +1 -1
  6. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +1 -1
  7. package/dist/sdk/services/BaseAttachmentService.d.ts +1 -1
  8. package/dist/sdk/services/DocumentAttachmentService.d.ts +1 -1
  9. package/dist/sdk/services/IssueAttachmentService.d.ts +1 -1
  10. package/dist/sdk/services/ProjectAttachmentService.d.ts +1 -1
  11. package/dist/store/slices/assetAttachmentSlice.d.ts +1 -1
  12. package/dist/store/slices/assetSlice.d.ts +2 -3
  13. package/dist/store/slices/assetTypeAttachmentSlice.d.ts +1 -1
  14. package/dist/store/slices/assetTypeSlice.d.ts +1 -1
  15. package/dist/store/slices/categorySlice.d.ts +1 -1
  16. package/dist/store/slices/documentAttachmentSlice.d.ts +1 -1
  17. package/dist/store/slices/documentSlice.d.ts +1 -1
  18. package/dist/store/slices/fileSlice.d.ts +1 -1
  19. package/dist/store/slices/formRevisionSlice.d.ts +2 -2
  20. package/dist/store/slices/formSlice.d.ts +3 -3
  21. package/dist/store/slices/formSubmissionSlice.d.ts +1 -1
  22. package/dist/store/slices/issueAssociationSlice.d.ts +1 -1
  23. package/dist/store/slices/issueAttachmentSlice.d.ts +1 -1
  24. package/dist/store/slices/issueSlice.d.ts +1 -1
  25. package/dist/store/slices/issueTypeSlice.d.ts +1 -1
  26. package/dist/store/slices/licenseSlice.d.ts +1 -1
  27. package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
  28. package/dist/store/slices/organizationSlice.d.ts +1 -1
  29. package/dist/store/slices/projectAccessSlice.d.ts +1 -1
  30. package/dist/store/slices/projectAttachmentSlice.d.ts +2 -2
  31. package/dist/store/slices/projectFileSlice.d.ts +1 -1
  32. package/dist/store/slices/projectSlice.d.ts +1 -1
  33. package/dist/store/slices/teamSlice.d.ts +1 -1
  34. package/dist/store/slices/userSlice.d.ts +2 -2
  35. package/dist/store/slices/workspaceSlice.d.ts +1 -1
  36. package/dist/typings/store.d.ts +1 -1
  37. package/package.json +1 -1
@@ -1135,19 +1135,7 @@ const selectAssetToAssetTypeMapping = createSelector(
1135
1135
  }
1136
1136
  );
1137
1137
  const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
1138
- var _a2;
1139
- if (!assetTypeId)
1140
- return 0;
1141
- return (_a2 = selectAssetsOfAssetType(assetTypeId)(state)) == null ? void 0 : _a2.length;
1142
- };
1143
- const selectAssetTypesFromIds = (assetTypeIds) => (state) => {
1144
- return assetTypeIds.reduce((acc, assetTypeId) => {
1145
- const assetType = state.assetTypeReducer.instances[assetTypeId];
1146
- if (assetType) {
1147
- acc.push(assetType);
1148
- }
1149
- return acc;
1150
- }, []);
1138
+ return selectAssetsOfAssetType(assetTypeId)(state).length;
1151
1139
  };
1152
1140
  const assetReducer = assetSlice.reducer;
1153
1141
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
@@ -1357,8 +1345,8 @@ const selectMainWorkspace = createSelector(
1357
1345
  return workspaces.find((workspace) => workspace.name.toLowerCase() === "main");
1358
1346
  }
1359
1347
  );
1360
- const selectWorkspaceById = (workspaceId) => (state) => {
1361
- return state.workspaceReducer.instances[workspaceId];
1348
+ const selectWorkspaceById = (id) => (state) => {
1349
+ return state.workspaceReducer.instances[id];
1362
1350
  };
1363
1351
  const selectPermittedWorkspaceIds = createSelector(
1364
1352
  [selectWorkspaceMapping],
@@ -1559,8 +1547,8 @@ const selectIssueTypes = createSelector(
1559
1547
  return Object.values(issueTypes);
1560
1548
  }
1561
1549
  );
1562
- const selectIssueTypeById = (issueTypeId) => (state) => {
1563
- return state.issueTypeReducer.instances[issueTypeId];
1550
+ const selectIssueTypeById = (id) => (state) => {
1551
+ return state.issueTypeReducer.instances[id];
1564
1552
  };
1565
1553
  const selectIssueTypesByIds = (issueTypeIds) => (state) => {
1566
1554
  const issueTypes = [];
@@ -1591,8 +1579,7 @@ const selectIssuesOfIssueType = restructureCreateSelectorWithArgs(
1591
1579
  )
1592
1580
  );
1593
1581
  const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
1594
- var _a2;
1595
- return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
1582
+ return selectIssuesOfIssueType(issueTypeId)(state).length;
1596
1583
  };
1597
1584
  const issueTypeReducer = issueTypeSlice.reducer;
1598
1585
  const initialState$q = {
@@ -1757,8 +1744,8 @@ const selectUser = (userId) => (state) => {
1757
1744
  return void 0;
1758
1745
  return state.userReducer.users[userId];
1759
1746
  };
1760
- const selectUserById = (userId) => (state) => {
1761
- return state.userReducer.users[userId];
1747
+ const selectUserById = (id) => (state) => {
1748
+ return state.userReducer.users[id];
1762
1749
  };
1763
1750
  const selectUsersByIds = restructureCreateSelectorWithArgs(
1764
1751
  createSelector([selectUsersMapping, (_state, userIds) => userIds], (usersMapping, userIds) => {
@@ -1793,8 +1780,8 @@ const { initializeOrganizationAccesses, updateOrganizationAccess, deleteOrganiza
1793
1780
  const selectOrganizationAccesses = (state) => {
1794
1781
  return state.organizationAccessReducer.instances;
1795
1782
  };
1796
- const selectOrganizationAccessById = (organizationAccessId) => (state) => {
1797
- return state.organizationAccessReducer.instances[organizationAccessId];
1783
+ const selectOrganizationAccessById = (id) => (state) => {
1784
+ return state.organizationAccessReducer.instances[id];
1798
1785
  };
1799
1786
  const selectActiveOrganizationAccess = createSelector(
1800
1787
  [selectCurrentUser, selectOrganizationAccesses],
@@ -1834,7 +1821,7 @@ const { initializeLicences, addLicenses, updateLicense } = licenseSlice.actions;
1834
1821
  const selectLicenses = (state) => {
1835
1822
  return state.licenseReducer.instances;
1836
1823
  };
1837
- const selectLicense = (licenseId) => (state) => state.licenseReducer.instances[licenseId];
1824
+ const selectLicense = (id) => (state) => state.licenseReducer.instances[id];
1838
1825
  const selectActiveLicense = (state) => Object.values(state.licenseReducer.instances).find(
1839
1826
  (license) => license.project === state.projectReducer.activeProjectId
1840
1827
  ) ?? null;
@@ -1871,8 +1858,8 @@ const selectProjectAccesses = createSelector(
1871
1858
  return Object.values(projectAccesses);
1872
1859
  }
1873
1860
  );
1874
- const selectProjectAccessById = (projectAccessId) => (state) => {
1875
- return state.projectAccessReducer.instances[projectAccessId];
1861
+ const selectProjectAccessById = (id) => (state) => {
1862
+ return state.projectAccessReducer.instances[id];
1876
1863
  };
1877
1864
  const selectActiveProjectAccess = (state) => {
1878
1865
  const currentUser = state.userReducer.currentUser;
@@ -1976,8 +1963,8 @@ const selectActiveProject = (state) => {
1976
1963
  }
1977
1964
  return state.projectReducer.projects[activeProjectId] ?? null;
1978
1965
  };
1979
- const selectProjectById = (projectId) => (state) => {
1980
- return state.projectReducer.projects[projectId];
1966
+ const selectProjectById = (id) => (state) => {
1967
+ return state.projectReducer.projects[id];
1981
1968
  };
1982
1969
  const selectProjectUsersIds = createSelector(
1983
1970
  [selectProjectAccessMapping],
@@ -2038,8 +2025,8 @@ const selectOrganizationsWithAccess = createSelector(
2038
2025
  [selectOrganizations],
2039
2026
  (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2040
2027
  );
2041
- const selectOrganizationById = (organizationId) => (state) => {
2042
- return state.organizationReducer.organizations[organizationId];
2028
+ const selectOrganizationById = (id) => (state) => {
2029
+ return state.organizationReducer.organizations[id];
2043
2030
  };
2044
2031
  const selectOrganizationUsersIds = createSelector(
2045
2032
  [selectOrganizationAccesses],
@@ -2269,16 +2256,13 @@ const selectAllProjectAttachments = createSelector(
2269
2256
  [selectProjectAttachmentMapping],
2270
2257
  (mapping) => Object.values(mapping)
2271
2258
  );
2272
- const selectProjectAttachment = (attachmentId) => (state) => {
2273
- return state.projectAttachmentReducer.instances[attachmentId];
2259
+ const selectProjectAttachment = (id) => (state) => {
2260
+ return state.projectAttachmentReducer.instances[id];
2274
2261
  };
2275
2262
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
2276
- createSelector(
2277
- [selectAllProjectAttachments, (_state, projectId) => projectId],
2278
- (attachments, projectId) => {
2279
- return attachments.filter(({ project }) => projectId === project);
2280
- }
2281
- )
2263
+ createSelector([selectAllProjectAttachments, (_, projectId) => projectId], (attachments, projectId) => {
2264
+ return attachments.filter(({ project }) => projectId === project);
2265
+ })
2282
2266
  );
2283
2267
  const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
2284
2268
  createSelector(
@@ -3120,8 +3104,8 @@ const selectTeamsMapping = (state) => state.teamReducer.instances;
3120
3104
  const selectTeams = createSelector([selectTeamsMapping], (teams) => {
3121
3105
  return Object.values(teams);
3122
3106
  });
3123
- const selectTeamById = (teamId) => (state) => {
3124
- return state.teamReducer.instances[teamId];
3107
+ const selectTeamById = (id) => (state) => {
3108
+ return state.teamReducer.instances[id];
3125
3109
  };
3126
3110
  const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
3127
3111
  createSelector(
@@ -3273,8 +3257,8 @@ const selectAttachmentsOfIssue = restructureCreateSelectorWithArgs(
3273
3257
  }
3274
3258
  )
3275
3259
  );
3276
- const selectIssueAttachment = (attachmentId) => (root) => {
3277
- return root.issueAttachmentReducer.instances[attachmentId];
3260
+ const selectIssueAttachmentById = (id) => (root) => {
3261
+ return root.issueAttachmentReducer.instances[id];
3278
3262
  };
3279
3263
  const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
3280
3264
  createSelector(
@@ -3497,7 +3481,7 @@ function handleWorkspaceRemoval(draft, action) {
3497
3481
  throw new Error("Tried to delete main workspace");
3498
3482
  }
3499
3483
  const categoriesInThisWorkspace = new Set(
3500
- (selectCategoriesOfWorkspace(workspaceId)(draft) ?? []).map((category) => category.offline_id)
3484
+ selectCategoriesOfWorkspace(workspaceId)(draft).map((category) => category.offline_id)
3501
3485
  );
3502
3486
  for (const issue of issuesVisibleInWorkspace) {
3503
3487
  if (issue.category && categoriesInThisWorkspace.has(issue.category)) {
@@ -4308,7 +4292,7 @@ class AssetService extends BaseApiService {
4308
4292
  async deleteAllAssetsOfAssetType(assetTypeId) {
4309
4293
  const { store } = this.client;
4310
4294
  const state = store.getState();
4311
- const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state) ?? [];
4295
+ const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4312
4296
  const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4313
4297
  const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4314
4298
  store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
@@ -4821,7 +4805,7 @@ class AssetTypeService extends BaseApiService {
4821
4805
  if (!assetType) {
4822
4806
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4823
4807
  }
4824
- const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state) ?? [];
4808
+ const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
4825
4809
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4826
4810
  this.dispatch(deleteAssetType(assetTypeId));
4827
4811
  if (stagesOfAssetType.length > 0) {
@@ -4990,7 +4974,7 @@ class IssueAttachmentService extends BaseAttachmentService {
4990
4974
  __publicField(this, "removeAttachments", deleteIssueAttachments);
4991
4975
  __publicField(this, "removeAttachment", deleteIssueAttachment);
4992
4976
  __publicField(this, "setAttachment", setIssueAttachment);
4993
- __publicField(this, "selectAttachment", selectIssueAttachment);
4977
+ __publicField(this, "selectAttachment", selectIssueAttachmentById);
4994
4978
  }
4995
4979
  buildOfflineAttachment(data) {
4996
4980
  return offline({
@@ -5293,7 +5277,7 @@ class IssueTypeService extends BaseApiService {
5293
5277
  if (!issueTypeToDelete) {
5294
5278
  throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
5295
5279
  }
5296
- const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
5280
+ const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state);
5297
5281
  this.dispatch(removeIssueType(issueTypeId));
5298
5282
  this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
5299
5283
  const promise = this.enqueueRequest({
@@ -5885,11 +5869,11 @@ class FormService extends BaseUploadService {
5885
5869
  throw new Error("Expected form to exist");
5886
5870
  }
5887
5871
  const formSubmissions = selectFormSubmissionsOfForm(formId)(state);
5888
- if (formSubmissions && formSubmissions.length > 0) {
5872
+ if (formSubmissions.length > 0) {
5889
5873
  this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
5890
5874
  }
5891
5875
  const formRevisions = selectFormRevisionsOfForm(formId)(state);
5892
- if (formRevisions && formRevisions.length > 0) {
5876
+ if (formRevisions.length > 0) {
5893
5877
  this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
5894
5878
  }
5895
5879
  this.dispatch(deleteForm(formId));
@@ -5903,10 +5887,10 @@ class FormService extends BaseUploadService {
5903
5887
  });
5904
5888
  } catch (e) {
5905
5889
  this.dispatch(addForm(form));
5906
- if (formRevisions && formRevisions.length > 0) {
5890
+ if (formRevisions.length > 0) {
5907
5891
  this.dispatch(addFormRevisions(formRevisions));
5908
5892
  }
5909
- if (formSubmissions && formSubmissions.length > 0) {
5893
+ if (formSubmissions.length > 0) {
5910
5894
  this.dispatch(addFormSubmissions(formSubmissions));
5911
5895
  }
5912
5896
  throw e;
@@ -7871,7 +7855,6 @@ export {
7871
7855
  selectAssetTypeStagesMapping,
7872
7856
  selectAssetTypes,
7873
7857
  selectAssetTypesByIds,
7874
- selectAssetTypesFromIds,
7875
7858
  selectAssetTypesMapping,
7876
7859
  selectAssets,
7877
7860
  selectAssetsByIds,
@@ -7950,7 +7933,7 @@ export {
7950
7933
  selectIssueAssociationsOfAsset,
7951
7934
  selectIssueAssociationsOfIssue,
7952
7935
  selectIssueAssociationsToIssue,
7953
- selectIssueAttachment,
7936
+ selectIssueAttachmentById,
7954
7937
  selectIssueAttachmentMapping,
7955
7938
  selectIssueAttachments,
7956
7939
  selectIssueById,