feat: add main.mjs

This commit is contained in:
2026-09-25 11:57:04 +08:00
parent cb30bbebf4
commit 6cc323dc15

10
main.mjs Normal file
View File

@@ -0,0 +1,10 @@
import { correlate } from './src/correlate.mjs';
import { summarize } from './src/report.mjs';
const events = [
{ device: 'RIG-1', alarmId: 'TEMP', type: 'ACK', time: 20 },
{ device: 'RIG-1', alarmId: 'TEMP', type: 'ALARM', time: 10 },
{ device: 'RIG-1', alarmId: 'TEMP', type: 'CLEAR', time: 30 },
{ device: 'RIG-2', alarmId: 'VOLT', type: 'ALARM', time: 40 },
];
console.log(JSON.stringify(summarize(correlate(events)), null, 2));