feat: add src/report.mjs

This commit is contained in:
2026-09-25 11:57:06 +08:00
parent 21eb6b320c
commit 74e10f772a

8
src/report.mjs Normal file
View File

@@ -0,0 +1,8 @@
export function summarize(result) {
const outstanding = [], anomalies = [];
for (const [key, state] of result.groups) {
if (state.open) outstanding.push({ key, since: state.firstAlarm, acknowledged: state.acknowledged });
for (const reason of state.anomalies) anomalies.push({ key, reason });
}
return { outstanding, anomalies, rejected: result.rejected };
}