@overmap-ai/core 1.0.64 → 1.0.65-filters.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.
@@ -904,51 +904,12 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
904
904
  return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
905
905
  };
906
906
  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
907
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
947
- const initialState$y = assetAdapter.getInitialState({});
908
+ const initialState$z = assetAdapter.getInitialState({});
948
909
  const assetSlice = createSlice({
949
910
  name: "assets",
950
- initialState: initialState$y,
951
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
911
+ initialState: initialState$z,
912
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
952
913
  reducers: {
953
914
  initializeAssets: assetAdapter.initialize,
954
915
  addAsset: assetAdapter.addOne,
@@ -995,35 +956,16 @@ const selectAssetsByIds = restructureCreateSelectorWithArgs(
995
956
  return assets;
996
957
  })
997
958
  );
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
959
  const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
1018
960
  return selectAssetsOfAssetType(assetTypeId)(state).length;
1019
961
  };
1020
962
  const assetReducer = assetSlice.reducer;
1021
963
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1022
- const initialState$x = assetAttachmentAdapter.getInitialState({});
964
+ const initialState$y = assetAttachmentAdapter.getInitialState({});
1023
965
  const assetAttachmentSlice = createSlice({
1024
966
  name: "assetAttachments",
1025
- initialState: initialState$x,
1026
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
967
+ initialState: initialState$y,
968
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1027
969
  reducers: {
1028
970
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
1029
971
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1081,13 +1023,13 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
1081
1023
  )
1082
1024
  );
1083
1025
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
1084
- const initialState$w = {
1026
+ const initialState$x = {
1085
1027
  completionsByAssetId: {}
1086
1028
  };
1087
1029
  const assetStageCompletionSlice = createSlice({
1088
1030
  name: "assetStageCompletions",
1089
- initialState: initialState$w,
1090
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1031
+ initialState: initialState$x,
1032
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1091
1033
  reducers: {
1092
1034
  addStageCompletion: (state, action) => {
1093
1035
  let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
@@ -1139,11 +1081,11 @@ const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1139
1081
  );
1140
1082
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1141
1083
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1142
- const initialState$v = assetStageAdapter.getInitialState({});
1084
+ const initialState$w = assetStageAdapter.getInitialState({});
1143
1085
  const assetStageSlice = createSlice({
1144
1086
  name: "assetStages",
1145
- initialState: initialState$v,
1146
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1087
+ initialState: initialState$w,
1088
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1147
1089
  reducers: {
1148
1090
  initializeStages: assetStageAdapter.initialize,
1149
1091
  setStage: assetStageAdapter.setOne,
@@ -1227,6 +1169,45 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
1227
1169
  );
1228
1170
  const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1229
1171
  const assetStageReducer = assetStageSlice.reducer;
1172
+ const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1173
+ const initialState$v = assetTypeAdapter.getInitialState({});
1174
+ const assetTypeSlice = createSlice({
1175
+ name: "assetTypes",
1176
+ initialState: initialState$v,
1177
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1178
+ reducers: {
1179
+ initializeAssetTypes: assetTypeAdapter.initialize,
1180
+ addAssetType: assetTypeAdapter.addOne,
1181
+ deleteAssetType: assetTypeAdapter.deleteOne
1182
+ }
1183
+ });
1184
+ const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1185
+ const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1186
+ const selectAssetTypes = createSelector(
1187
+ [selectAssetTypesMapping],
1188
+ (mapping) => Object.values(mapping)
1189
+ );
1190
+ const selectAssetTypeById = (id) => (state) => {
1191
+ return state.assetTypeReducer.instances[id];
1192
+ };
1193
+ const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
1194
+ createSelector(
1195
+ [selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
1196
+ (assetTypeMapping, assetTypeIds) => {
1197
+ const assetTypes = [];
1198
+ for (const assetTypeId of assetTypeIds) {
1199
+ const assetType = assetTypeMapping[assetTypeId];
1200
+ if (assetType) {
1201
+ assetTypes.push(assetType);
1202
+ } else {
1203
+ console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
1204
+ }
1205
+ }
1206
+ return assetTypes;
1207
+ }
1208
+ )
1209
+ );
1210
+ const assetTypeReducer = assetTypeSlice.reducer;
1230
1211
  const assetTypeAttachmentAdapter = createModelAdapter(
1231
1212
  (attachment) => attachment.offline_id
1232
1213
  );
@@ -2479,12 +2460,20 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
2479
2460
  selectFormRevisionMapping,
2480
2461
  (_state, formId) => formId
2481
2462
  ],
2482
- (submissions, revisionMapping, formId) => {
2483
- const revisionsOfForm = Object.values(revisionMapping).filter((revision) => revision.form === formId);
2484
- const revisionIds = new Set(revisionsOfForm.map((revision) => revision.offline_id));
2485
- return Object.values(submissions).filter((submission) => {
2486
- return revisionIds.has(submission.form_revision);
2487
- });
2463
+ (submissionsMapping, revisionMapping, formId) => {
2464
+ const revisionIds = /* @__PURE__ */ new Set();
2465
+ for (const revision of Object.values(revisionMapping)) {
2466
+ if (revision.form !== formId)
2467
+ continue;
2468
+ revisionIds.add(revision.offline_id);
2469
+ }
2470
+ const submissions = [];
2471
+ for (const submission of Object.values(submissionsMapping)) {
2472
+ if (!revisionIds.has(submission.form_revision))
2473
+ continue;
2474
+ submissions.push(submission);
2475
+ }
2476
+ return submissions;
2488
2477
  }
2489
2478
  )
2490
2479
  );
@@ -7843,7 +7832,6 @@ export {
7843
7832
  selectAssetStageById,
7844
7833
  selectAssetStages,
7845
7834
  selectAssetStagesByIds,
7846
- selectAssetToAssetTypeMapping,
7847
7835
  selectAssetTypeAttachmentById,
7848
7836
  selectAssetTypeAttachmentMapping,
7849
7837
  selectAssetTypeAttachments,