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

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.
@@ -892,101 +892,12 @@ var __publicField = (obj, key, value) => {
892
892
  return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
893
893
  };
894
894
  const categoryReducer = categorySlice.reducer;
895
- const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
896
- const initialState$z = assetStageAdapter.getInitialState({});
897
- const assetStageSlice = toolkit.createSlice({
898
- name: "assetStages",
899
- initialState: initialState$z,
900
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
901
- reducers: {
902
- initializeStages: assetStageAdapter.initialize,
903
- setStage: assetStageAdapter.setOne,
904
- addStages: assetStageAdapter.addMany,
905
- updateStage: assetStageAdapter.updateOne,
906
- updateStages: assetStageAdapter.updateMany,
907
- removeStages: assetStageAdapter.deleteMany
908
- }
909
- });
910
- const selectStageMapping = (state) => state.assetStageReducer.instances;
911
- const selectAssetStageById = restructureCreateSelectorWithArgs(
912
- toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
913
- return stageMapping[stageId];
914
- })
915
- );
916
- const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
917
- return Object.values(stageMapping);
918
- });
919
- const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
920
- toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
921
- const assetTypeIdsSet = new Set(assetTypeIds);
922
- const ret = {};
923
- for (const stage of stages) {
924
- if (assetTypeIdsSet.has(stage.asset_type)) {
925
- if (!ret[stage.asset_type]) {
926
- ret[stage.asset_type] = [];
927
- }
928
- ret[stage.asset_type].push(stage);
929
- }
930
- }
931
- for (const key in ret) {
932
- ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
933
- }
934
- return ret;
935
- })
936
- );
937
- const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
938
- toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
939
- const assetTypeStagesMapping = {};
940
- for (const [stageId, stage] of Object.entries(stagesMapping)) {
941
- if (stage.asset_type === assetTypeId) {
942
- assetTypeStagesMapping[stageId] = stage;
943
- }
944
- }
945
- return assetTypeStagesMapping;
946
- })
947
- );
948
- const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
949
- toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
950
- return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
951
- })
952
- );
953
- const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
954
- toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
955
- const assetStages = [];
956
- for (const stageId of stageIds) {
957
- const stage = stageMapping[stageId];
958
- if (stage) {
959
- assetStages.push(stage);
960
- } else {
961
- console.warn("selectStagesFromStageIds: No stage exists with the id", stageId);
962
- }
963
- }
964
- return assetStages;
965
- })
966
- );
967
- const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
968
- toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
969
- const ret = {};
970
- for (const stageId of stageIds) {
971
- const stage = stageMapping[stageId];
972
- if (!stage) {
973
- throw new Error("No stage exists with the id " + stageId);
974
- }
975
- if (stage.form) {
976
- ret[stageId] = stage.form;
977
- }
978
- }
979
- return ret;
980
- })
981
- );
982
- const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
983
- const assetStageReducer = assetStageSlice.reducer;
984
895
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
985
- const initialState$y = assetTypeAdapter.getInitialState({});
896
+ const initialState$z = assetTypeAdapter.getInitialState({});
986
897
  const assetTypeSlice = toolkit.createSlice({
987
898
  name: "assetTypes",
988
- initialState: initialState$y,
989
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
899
+ initialState: initialState$z,
900
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
990
901
  reducers: {
991
902
  initializeAssetTypes: assetTypeAdapter.initialize,
992
903
  addAssetType: assetTypeAdapter.addOne,
@@ -1004,15 +915,15 @@ var __publicField = (obj, key, value) => {
1004
915
  };
1005
916
  const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
1006
917
  toolkit.createSelector(
1007
- [selectStageMapping, (_state, assetTypeIds) => assetTypeIds],
918
+ [selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
1008
919
  (assetTypeMapping, assetTypeIds) => {
1009
920
  const assetTypes = [];
1010
- for (const stageId of assetTypeIds) {
1011
- const stage = assetTypeMapping[stageId];
1012
- if (stage) {
1013
- assetTypes.push(stage);
921
+ for (const assetTypeId of assetTypeIds) {
922
+ const assetType = assetTypeMapping[assetTypeId];
923
+ if (assetType) {
924
+ assetTypes.push(assetType);
1014
925
  } else {
1015
- console.warn("selectAssetTypesByIds: No stage exists with the id", stageId);
926
+ console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
1016
927
  }
1017
928
  }
1018
929
  return assetTypes;
@@ -1021,11 +932,11 @@ var __publicField = (obj, key, value) => {
1021
932
  );
1022
933
  const assetTypeReducer = assetTypeSlice.reducer;
1023
934
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
1024
- const initialState$x = assetAdapter.getInitialState({});
935
+ const initialState$y = assetAdapter.getInitialState({});
1025
936
  const assetSlice = toolkit.createSlice({
1026
937
  name: "assets",
1027
- initialState: initialState$x,
1028
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
938
+ initialState: initialState$y,
939
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1029
940
  reducers: {
1030
941
  initializeAssets: (state, action) => {
1031
942
  assetAdapter.initialize(state, action);
@@ -1127,11 +1038,11 @@ var __publicField = (obj, key, value) => {
1127
1038
  };
1128
1039
  const assetReducer = assetSlice.reducer;
1129
1040
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1130
- const initialState$w = assetAttachmentAdapter.getInitialState({});
1041
+ const initialState$x = assetAttachmentAdapter.getInitialState({});
1131
1042
  const assetAttachmentSlice = toolkit.createSlice({
1132
1043
  name: "assetAttachments",
1133
- initialState: initialState$w,
1134
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1044
+ initialState: initialState$x,
1045
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1135
1046
  reducers: {
1136
1047
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
1137
1048
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1160,8 +1071,8 @@ var __publicField = (obj, key, value) => {
1160
1071
  [selectAssetAttachmentMapping],
1161
1072
  (mapping) => Object.values(mapping)
1162
1073
  );
1163
- const selectAssetAttachment = (attachmentId) => (state) => {
1164
- return state.assetAttachmentReducer.instances[attachmentId];
1074
+ const selectAssetAttachmentById = (id) => (state) => {
1075
+ return state.assetAttachmentReducer.instances[id];
1165
1076
  };
1166
1077
  const selectAttachmentsOfAsset = restructureCreateSelectorWithArgs(
1167
1078
  toolkit.createSelector(
@@ -1189,13 +1100,13 @@ var __publicField = (obj, key, value) => {
1189
1100
  )
1190
1101
  );
1191
1102
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
1192
- const initialState$v = {
1103
+ const initialState$w = {
1193
1104
  completionsByAssetId: {}
1194
1105
  };
1195
1106
  const assetStageCompletionSlice = toolkit.createSlice({
1196
1107
  name: "assetStageCompletions",
1197
- initialState: initialState$v,
1198
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1108
+ initialState: initialState$w,
1109
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1199
1110
  reducers: {
1200
1111
  addStageCompletion: (state, action) => {
1201
1112
  let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
@@ -1246,6 +1157,95 @@ var __publicField = (obj, key, value) => {
1246
1157
  })
1247
1158
  );
1248
1159
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1160
+ const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1161
+ const initialState$v = assetStageAdapter.getInitialState({});
1162
+ const assetStageSlice = toolkit.createSlice({
1163
+ name: "assetStages",
1164
+ initialState: initialState$v,
1165
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1166
+ reducers: {
1167
+ initializeStages: assetStageAdapter.initialize,
1168
+ setStage: assetStageAdapter.setOne,
1169
+ addStages: assetStageAdapter.addMany,
1170
+ updateStage: assetStageAdapter.updateOne,
1171
+ updateStages: assetStageAdapter.updateMany,
1172
+ removeStages: assetStageAdapter.deleteMany
1173
+ }
1174
+ });
1175
+ const selectStageMapping = (state) => state.assetStageReducer.instances;
1176
+ const selectAssetStageById = restructureCreateSelectorWithArgs(
1177
+ toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
1178
+ return stageMapping[stageId];
1179
+ })
1180
+ );
1181
+ const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1182
+ return Object.values(stageMapping);
1183
+ });
1184
+ const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
1185
+ toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
1186
+ const assetTypeIdsSet = new Set(assetTypeIds);
1187
+ const ret = {};
1188
+ for (const stage of stages) {
1189
+ if (assetTypeIdsSet.has(stage.asset_type)) {
1190
+ if (!ret[stage.asset_type]) {
1191
+ ret[stage.asset_type] = [];
1192
+ }
1193
+ ret[stage.asset_type].push(stage);
1194
+ }
1195
+ }
1196
+ for (const key in ret) {
1197
+ ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
1198
+ }
1199
+ return ret;
1200
+ })
1201
+ );
1202
+ const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1203
+ toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
1204
+ const assetTypeStagesMapping = {};
1205
+ for (const [stageId, stage] of Object.entries(stagesMapping)) {
1206
+ if (stage.asset_type === assetTypeId) {
1207
+ assetTypeStagesMapping[stageId] = stage;
1208
+ }
1209
+ }
1210
+ return assetTypeStagesMapping;
1211
+ })
1212
+ );
1213
+ const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1214
+ toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1215
+ return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
1216
+ })
1217
+ );
1218
+ const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
1219
+ toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
1220
+ const assetStages = [];
1221
+ for (const stageId of stageIds) {
1222
+ const stage = stageMapping[stageId];
1223
+ if (stage) {
1224
+ assetStages.push(stage);
1225
+ } else {
1226
+ console.warn("selectStagesFromStageIds: No stage exists with the id", stageId);
1227
+ }
1228
+ }
1229
+ return assetStages;
1230
+ })
1231
+ );
1232
+ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
1233
+ toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
1234
+ const ret = {};
1235
+ for (const stageId of stageIds) {
1236
+ const stage = stageMapping[stageId];
1237
+ if (!stage) {
1238
+ throw new Error("No stage exists with the id " + stageId);
1239
+ }
1240
+ if (stage.form) {
1241
+ ret[stageId] = stage.form;
1242
+ }
1243
+ }
1244
+ return ret;
1245
+ })
1246
+ );
1247
+ const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1248
+ const assetStageReducer = assetStageSlice.reducer;
1249
1249
  const assetTypeAttachmentAdapter = createModelAdapter(
1250
1250
  (attachment) => attachment.offline_id
1251
1251
  );
@@ -1282,8 +1282,8 @@ var __publicField = (obj, key, value) => {
1282
1282
  [selectAssetTypeAttachmentMapping],
1283
1283
  (mapping) => Object.values(mapping)
1284
1284
  );
1285
- const selectAssetTypeAttachment = (attachmentId) => (state) => {
1286
- return state.assetTypeAttachmentReducer.instances[attachmentId];
1285
+ const selectAssetTypeAttachmentById = (id) => (state) => {
1286
+ return state.assetTypeAttachmentReducer.instances[id];
1287
1287
  };
1288
1288
  const selectAttachmentsOfAssetType = restructureCreateSelectorWithArgs(
1289
1289
  toolkit.createSelector(
@@ -2244,7 +2244,7 @@ var __publicField = (obj, key, value) => {
2244
2244
  [selectProjectAttachmentMapping],
2245
2245
  (mapping) => Object.values(mapping)
2246
2246
  );
2247
- const selectProjectAttachment = (id) => (state) => {
2247
+ const selectProjectAttachmentById = (id) => (state) => {
2248
2248
  return state.projectAttachmentReducer.instances[id];
2249
2249
  };
2250
2250
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
@@ -3044,8 +3044,8 @@ var __publicField = (obj, key, value) => {
3044
3044
  [selectDocumentAttachmentMapping],
3045
3045
  (mapping) => Object.values(mapping)
3046
3046
  );
3047
- const selectDocumentAttachment = (attachmentId) => (state) => {
3048
- return state.documentAttachmentReducer.instances[attachmentId];
3047
+ const selectDocumentAttachmentById = (id) => (state) => {
3048
+ return state.documentAttachmentReducer.instances[id];
3049
3049
  };
3050
3050
  const selectAttachmentsOfDocument = restructureCreateSelectorWithArgs(
3051
3051
  toolkit.createSelector(
@@ -4738,7 +4738,7 @@ var __publicField = (obj, key, value) => {
4738
4738
  __publicField(this, "removeAttachments", deleteAssetAttachments);
4739
4739
  __publicField(this, "removeAttachment", deleteAssetAttachment);
4740
4740
  __publicField(this, "setAttachment", setAssetAttachment);
4741
- __publicField(this, "selectAttachment", selectAssetAttachment);
4741
+ __publicField(this, "selectAttachment", selectAssetAttachmentById);
4742
4742
  }
4743
4743
  buildOfflineAttachment(data) {
4744
4744
  return offline({
@@ -4838,7 +4838,7 @@ var __publicField = (obj, key, value) => {
4838
4838
  __publicField(this, "removeAttachments", deleteAssetTypeAttachments);
4839
4839
  __publicField(this, "removeAttachment", deleteAssetTypeAttachment);
4840
4840
  __publicField(this, "setAttachment", setAssetTypeAttachment);
4841
- __publicField(this, "selectAttachment", selectAssetTypeAttachment);
4841
+ __publicField(this, "selectAttachment", selectAssetTypeAttachmentById);
4842
4842
  }
4843
4843
  buildOfflineAttachment(data) {
4844
4844
  return offline({
@@ -5438,7 +5438,7 @@ var __publicField = (obj, key, value) => {
5438
5438
  __publicField(this, "removeAttachments", deleteProjectAttachments);
5439
5439
  __publicField(this, "removeAttachment", deleteProjectAttachment);
5440
5440
  __publicField(this, "setAttachment", setProjectAttachment);
5441
- __publicField(this, "selectAttachment", selectProjectAttachment);
5441
+ __publicField(this, "selectAttachment", selectProjectAttachmentById);
5442
5442
  }
5443
5443
  buildOfflineAttachment(data) {
5444
5444
  return offline({
@@ -6981,7 +6981,7 @@ var __publicField = (obj, key, value) => {
6981
6981
  __publicField(this, "removeAttachments", deleteDocumentAttachments);
6982
6982
  __publicField(this, "removeAttachment", deleteDocumentAttachment);
6983
6983
  __publicField(this, "setAttachment", setDocumentAttachment);
6984
- __publicField(this, "selectAttachment", selectDocumentAttachment);
6984
+ __publicField(this, "selectAttachment", selectDocumentAttachmentById);
6985
6985
  }
6986
6986
  buildOfflineAttachment(data) {
6987
6987
  return offline({
@@ -7827,7 +7827,7 @@ var __publicField = (obj, key, value) => {
7827
7827
  exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
7828
7828
  exports2.selectAllProjectAttachments = selectAllProjectAttachments;
7829
7829
  exports2.selectAncestorIdsOfDocument = selectAncestorIdsOfDocument;
7830
- exports2.selectAssetAttachment = selectAssetAttachment;
7830
+ exports2.selectAssetAttachmentById = selectAssetAttachmentById;
7831
7831
  exports2.selectAssetAttachmentMapping = selectAssetAttachmentMapping;
7832
7832
  exports2.selectAssetAttachments = selectAssetAttachments;
7833
7833
  exports2.selectAssetById = selectAssetById;
@@ -7835,7 +7835,7 @@ var __publicField = (obj, key, value) => {
7835
7835
  exports2.selectAssetStages = selectAssetStages;
7836
7836
  exports2.selectAssetStagesByIds = selectAssetStagesByIds;
7837
7837
  exports2.selectAssetToAssetTypeMapping = selectAssetToAssetTypeMapping;
7838
- exports2.selectAssetTypeAttachment = selectAssetTypeAttachment;
7838
+ exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
7839
7839
  exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
7840
7840
  exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
7841
7841
  exports2.selectAssetTypeById = selectAssetTypeById;
@@ -7874,7 +7874,7 @@ var __publicField = (obj, key, value) => {
7874
7874
  exports2.selectConversations = selectConversations;
7875
7875
  exports2.selectCurrentUser = selectCurrentUser;
7876
7876
  exports2.selectDeletedRequests = selectDeletedRequests;
7877
- exports2.selectDocumentAttachment = selectDocumentAttachment;
7877
+ exports2.selectDocumentAttachmentById = selectDocumentAttachmentById;
7878
7878
  exports2.selectDocumentAttachmentMapping = selectDocumentAttachmentMapping;
7879
7879
  exports2.selectDocumentById = selectDocumentById;
7880
7880
  exports2.selectDocuments = selectDocuments;
@@ -7965,7 +7965,7 @@ var __publicField = (obj, key, value) => {
7965
7965
  exports2.selectProjectAccessMapping = selectProjectAccessMapping;
7966
7966
  exports2.selectProjectAccessUserMapping = selectProjectAccessUserMapping;
7967
7967
  exports2.selectProjectAccesses = selectProjectAccesses;
7968
- exports2.selectProjectAttachment = selectProjectAttachment;
7968
+ exports2.selectProjectAttachmentById = selectProjectAttachmentById;
7969
7969
  exports2.selectProjectAttachmentMapping = selectProjectAttachmentMapping;
7970
7970
  exports2.selectProjectById = selectProjectById;
7971
7971
  exports2.selectProjectFileById = selectProjectFileById;