@overmap-ai/core 1.0.63-selector-standardization.3 → 1.0.63-selector-standardization.4
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.
- package/dist/overmap-core.js +107 -107
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +107 -107
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/slices/assetTypeSlice.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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$
|
|
896
|
+
const initialState$z = assetTypeAdapter.getInitialState({});
|
|
986
897
|
const assetTypeSlice = toolkit.createSlice({
|
|
987
898
|
name: "assetTypes",
|
|
988
|
-
initialState: initialState$
|
|
989
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
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
|
-
[
|
|
918
|
+
[selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
|
|
1008
919
|
(assetTypeMapping, assetTypeIds) => {
|
|
1009
920
|
const assetTypes = [];
|
|
1010
|
-
for (const
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
assetTypes.push(
|
|
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
|
|
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$
|
|
935
|
+
const initialState$y = assetAdapter.getInitialState({});
|
|
1025
936
|
const assetSlice = toolkit.createSlice({
|
|
1026
937
|
name: "assets",
|
|
1027
|
-
initialState: initialState$
|
|
1028
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
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$
|
|
1041
|
+
const initialState$x = assetAttachmentAdapter.getInitialState({});
|
|
1131
1042
|
const assetAttachmentSlice = toolkit.createSlice({
|
|
1132
1043
|
name: "assetAttachments",
|
|
1133
|
-
initialState: initialState$
|
|
1134
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
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,
|
|
@@ -1189,13 +1100,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1189
1100
|
)
|
|
1190
1101
|
);
|
|
1191
1102
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1192
|
-
const initialState$
|
|
1103
|
+
const initialState$w = {
|
|
1193
1104
|
completionsByAssetId: {}
|
|
1194
1105
|
};
|
|
1195
1106
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1196
1107
|
name: "assetStageCompletions",
|
|
1197
|
-
initialState: initialState$
|
|
1198
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
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
|
);
|