@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
@@ -1123,19 +1123,7 @@ var __publicField = (obj, key, value) => {
1123
1123
  }
1124
1124
  );
1125
1125
  const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
1126
- var _a2;
1127
- if (!assetTypeId)
1128
- return 0;
1129
- return (_a2 = selectAssetsOfAssetType(assetTypeId)(state)) == null ? void 0 : _a2.length;
1130
- };
1131
- const selectAssetTypesFromIds = (assetTypeIds) => (state) => {
1132
- return assetTypeIds.reduce((acc, assetTypeId) => {
1133
- const assetType = state.assetTypeReducer.instances[assetTypeId];
1134
- if (assetType) {
1135
- acc.push(assetType);
1136
- }
1137
- return acc;
1138
- }, []);
1126
+ return selectAssetsOfAssetType(assetTypeId)(state).length;
1139
1127
  };
1140
1128
  const assetReducer = assetSlice.reducer;
1141
1129
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
@@ -1345,8 +1333,8 @@ var __publicField = (obj, key, value) => {
1345
1333
  return workspaces.find((workspace) => workspace.name.toLowerCase() === "main");
1346
1334
  }
1347
1335
  );
1348
- const selectWorkspaceById = (workspaceId) => (state) => {
1349
- return state.workspaceReducer.instances[workspaceId];
1336
+ const selectWorkspaceById = (id) => (state) => {
1337
+ return state.workspaceReducer.instances[id];
1350
1338
  };
1351
1339
  const selectPermittedWorkspaceIds = toolkit.createSelector(
1352
1340
  [selectWorkspaceMapping],
@@ -1547,8 +1535,8 @@ var __publicField = (obj, key, value) => {
1547
1535
  return Object.values(issueTypes);
1548
1536
  }
1549
1537
  );
1550
- const selectIssueTypeById = (issueTypeId) => (state) => {
1551
- return state.issueTypeReducer.instances[issueTypeId];
1538
+ const selectIssueTypeById = (id) => (state) => {
1539
+ return state.issueTypeReducer.instances[id];
1552
1540
  };
1553
1541
  const selectIssueTypesByIds = (issueTypeIds) => (state) => {
1554
1542
  const issueTypes = [];
@@ -1579,8 +1567,7 @@ var __publicField = (obj, key, value) => {
1579
1567
  )
1580
1568
  );
1581
1569
  const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
1582
- var _a2;
1583
- return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
1570
+ return selectIssuesOfIssueType(issueTypeId)(state).length;
1584
1571
  };
1585
1572
  const issueTypeReducer = issueTypeSlice.reducer;
1586
1573
  const initialState$q = {
@@ -1745,8 +1732,8 @@ var __publicField = (obj, key, value) => {
1745
1732
  return void 0;
1746
1733
  return state.userReducer.users[userId];
1747
1734
  };
1748
- const selectUserById = (userId) => (state) => {
1749
- return state.userReducer.users[userId];
1735
+ const selectUserById = (id) => (state) => {
1736
+ return state.userReducer.users[id];
1750
1737
  };
1751
1738
  const selectUsersByIds = restructureCreateSelectorWithArgs(
1752
1739
  toolkit.createSelector([selectUsersMapping, (_state, userIds) => userIds], (usersMapping, userIds) => {
@@ -1781,8 +1768,8 @@ var __publicField = (obj, key, value) => {
1781
1768
  const selectOrganizationAccesses = (state) => {
1782
1769
  return state.organizationAccessReducer.instances;
1783
1770
  };
1784
- const selectOrganizationAccessById = (organizationAccessId) => (state) => {
1785
- return state.organizationAccessReducer.instances[organizationAccessId];
1771
+ const selectOrganizationAccessById = (id) => (state) => {
1772
+ return state.organizationAccessReducer.instances[id];
1786
1773
  };
1787
1774
  const selectActiveOrganizationAccess = toolkit.createSelector(
1788
1775
  [selectCurrentUser, selectOrganizationAccesses],
@@ -1822,7 +1809,7 @@ var __publicField = (obj, key, value) => {
1822
1809
  const selectLicenses = (state) => {
1823
1810
  return state.licenseReducer.instances;
1824
1811
  };
1825
- const selectLicense = (licenseId) => (state) => state.licenseReducer.instances[licenseId];
1812
+ const selectLicense = (id) => (state) => state.licenseReducer.instances[id];
1826
1813
  const selectActiveLicense = (state) => Object.values(state.licenseReducer.instances).find(
1827
1814
  (license) => license.project === state.projectReducer.activeProjectId
1828
1815
  ) ?? null;
@@ -1859,8 +1846,8 @@ var __publicField = (obj, key, value) => {
1859
1846
  return Object.values(projectAccesses);
1860
1847
  }
1861
1848
  );
1862
- const selectProjectAccessById = (projectAccessId) => (state) => {
1863
- return state.projectAccessReducer.instances[projectAccessId];
1849
+ const selectProjectAccessById = (id) => (state) => {
1850
+ return state.projectAccessReducer.instances[id];
1864
1851
  };
1865
1852
  const selectActiveProjectAccess = (state) => {
1866
1853
  const currentUser = state.userReducer.currentUser;
@@ -1964,8 +1951,8 @@ var __publicField = (obj, key, value) => {
1964
1951
  }
1965
1952
  return state.projectReducer.projects[activeProjectId] ?? null;
1966
1953
  };
1967
- const selectProjectById = (projectId) => (state) => {
1968
- return state.projectReducer.projects[projectId];
1954
+ const selectProjectById = (id) => (state) => {
1955
+ return state.projectReducer.projects[id];
1969
1956
  };
1970
1957
  const selectProjectUsersIds = toolkit.createSelector(
1971
1958
  [selectProjectAccessMapping],
@@ -2026,8 +2013,8 @@ var __publicField = (obj, key, value) => {
2026
2013
  [selectOrganizations],
2027
2014
  (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2028
2015
  );
2029
- const selectOrganizationById = (organizationId) => (state) => {
2030
- return state.organizationReducer.organizations[organizationId];
2016
+ const selectOrganizationById = (id) => (state) => {
2017
+ return state.organizationReducer.organizations[id];
2031
2018
  };
2032
2019
  const selectOrganizationUsersIds = toolkit.createSelector(
2033
2020
  [selectOrganizationAccesses],
@@ -2257,16 +2244,13 @@ var __publicField = (obj, key, value) => {
2257
2244
  [selectProjectAttachmentMapping],
2258
2245
  (mapping) => Object.values(mapping)
2259
2246
  );
2260
- const selectProjectAttachment = (attachmentId) => (state) => {
2261
- return state.projectAttachmentReducer.instances[attachmentId];
2247
+ const selectProjectAttachment = (id) => (state) => {
2248
+ return state.projectAttachmentReducer.instances[id];
2262
2249
  };
2263
2250
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
2264
- toolkit.createSelector(
2265
- [selectAllProjectAttachments, (_state, projectId) => projectId],
2266
- (attachments, projectId) => {
2267
- return attachments.filter(({ project }) => projectId === project);
2268
- }
2269
- )
2251
+ toolkit.createSelector([selectAllProjectAttachments, (_, projectId) => projectId], (attachments, projectId) => {
2252
+ return attachments.filter(({ project }) => projectId === project);
2253
+ })
2270
2254
  );
2271
2255
  const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
2272
2256
  toolkit.createSelector(
@@ -3108,8 +3092,8 @@ var __publicField = (obj, key, value) => {
3108
3092
  const selectTeams = toolkit.createSelector([selectTeamsMapping], (teams) => {
3109
3093
  return Object.values(teams);
3110
3094
  });
3111
- const selectTeamById = (teamId) => (state) => {
3112
- return state.teamReducer.instances[teamId];
3095
+ const selectTeamById = (id) => (state) => {
3096
+ return state.teamReducer.instances[id];
3113
3097
  };
3114
3098
  const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
3115
3099
  toolkit.createSelector(
@@ -3261,8 +3245,8 @@ var __publicField = (obj, key, value) => {
3261
3245
  }
3262
3246
  )
3263
3247
  );
3264
- const selectIssueAttachment = (attachmentId) => (root) => {
3265
- return root.issueAttachmentReducer.instances[attachmentId];
3248
+ const selectIssueAttachmentById = (id) => (root) => {
3249
+ return root.issueAttachmentReducer.instances[id];
3266
3250
  };
3267
3251
  const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
3268
3252
  toolkit.createSelector(
@@ -3485,7 +3469,7 @@ var __publicField = (obj, key, value) => {
3485
3469
  throw new Error("Tried to delete main workspace");
3486
3470
  }
3487
3471
  const categoriesInThisWorkspace = new Set(
3488
- (selectCategoriesOfWorkspace(workspaceId)(draft) ?? []).map((category) => category.offline_id)
3472
+ selectCategoriesOfWorkspace(workspaceId)(draft).map((category) => category.offline_id)
3489
3473
  );
3490
3474
  for (const issue of issuesVisibleInWorkspace) {
3491
3475
  if (issue.category && categoriesInThisWorkspace.has(issue.category)) {
@@ -4296,7 +4280,7 @@ var __publicField = (obj, key, value) => {
4296
4280
  async deleteAllAssetsOfAssetType(assetTypeId) {
4297
4281
  const { store } = this.client;
4298
4282
  const state = store.getState();
4299
- const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state) ?? [];
4283
+ const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4300
4284
  const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4301
4285
  const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4302
4286
  store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
@@ -4809,7 +4793,7 @@ var __publicField = (obj, key, value) => {
4809
4793
  if (!assetType) {
4810
4794
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4811
4795
  }
4812
- const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state) ?? [];
4796
+ const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
4813
4797
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4814
4798
  this.dispatch(deleteAssetType(assetTypeId));
4815
4799
  if (stagesOfAssetType.length > 0) {
@@ -4978,7 +4962,7 @@ var __publicField = (obj, key, value) => {
4978
4962
  __publicField(this, "removeAttachments", deleteIssueAttachments);
4979
4963
  __publicField(this, "removeAttachment", deleteIssueAttachment);
4980
4964
  __publicField(this, "setAttachment", setIssueAttachment);
4981
- __publicField(this, "selectAttachment", selectIssueAttachment);
4965
+ __publicField(this, "selectAttachment", selectIssueAttachmentById);
4982
4966
  }
4983
4967
  buildOfflineAttachment(data) {
4984
4968
  return offline({
@@ -5281,7 +5265,7 @@ var __publicField = (obj, key, value) => {
5281
5265
  if (!issueTypeToDelete) {
5282
5266
  throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
5283
5267
  }
5284
- const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
5268
+ const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state);
5285
5269
  this.dispatch(removeIssueType(issueTypeId));
5286
5270
  this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
5287
5271
  const promise = this.enqueueRequest({
@@ -5873,11 +5857,11 @@ var __publicField = (obj, key, value) => {
5873
5857
  throw new Error("Expected form to exist");
5874
5858
  }
5875
5859
  const formSubmissions = selectFormSubmissionsOfForm(formId)(state);
5876
- if (formSubmissions && formSubmissions.length > 0) {
5860
+ if (formSubmissions.length > 0) {
5877
5861
  this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
5878
5862
  }
5879
5863
  const formRevisions = selectFormRevisionsOfForm(formId)(state);
5880
- if (formRevisions && formRevisions.length > 0) {
5864
+ if (formRevisions.length > 0) {
5881
5865
  this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
5882
5866
  }
5883
5867
  this.dispatch(deleteForm(formId));
@@ -5891,10 +5875,10 @@ var __publicField = (obj, key, value) => {
5891
5875
  });
5892
5876
  } catch (e) {
5893
5877
  this.dispatch(addForm(form));
5894
- if (formRevisions && formRevisions.length > 0) {
5878
+ if (formRevisions.length > 0) {
5895
5879
  this.dispatch(addFormRevisions(formRevisions));
5896
5880
  }
5897
- if (formSubmissions && formSubmissions.length > 0) {
5881
+ if (formSubmissions.length > 0) {
5898
5882
  this.dispatch(addFormSubmissions(formSubmissions));
5899
5883
  }
5900
5884
  throw e;
@@ -7858,7 +7842,6 @@ var __publicField = (obj, key, value) => {
7858
7842
  exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
7859
7843
  exports2.selectAssetTypes = selectAssetTypes;
7860
7844
  exports2.selectAssetTypesByIds = selectAssetTypesByIds;
7861
- exports2.selectAssetTypesFromIds = selectAssetTypesFromIds;
7862
7845
  exports2.selectAssetTypesMapping = selectAssetTypesMapping;
7863
7846
  exports2.selectAssets = selectAssets;
7864
7847
  exports2.selectAssetsByIds = selectAssetsByIds;
@@ -7937,7 +7920,7 @@ var __publicField = (obj, key, value) => {
7937
7920
  exports2.selectIssueAssociationsOfAsset = selectIssueAssociationsOfAsset;
7938
7921
  exports2.selectIssueAssociationsOfIssue = selectIssueAssociationsOfIssue;
7939
7922
  exports2.selectIssueAssociationsToIssue = selectIssueAssociationsToIssue;
7940
- exports2.selectIssueAttachment = selectIssueAttachment;
7923
+ exports2.selectIssueAttachmentById = selectIssueAttachmentById;
7941
7924
  exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
7942
7925
  exports2.selectIssueAttachments = selectIssueAttachments;
7943
7926
  exports2.selectIssueById = selectIssueById;