File size: 621 Bytes
c6b6c96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// In-memory store for live Torque events fired this session.
// Module-level singleton — persists across API route calls in the same Node.js process.

export interface LiveEvent {
  ingestionId: string
  wallet: string
  eventName: string
  risk?: string
  score?: number
  firedAt: string
  source: 'scan' | 'manual' | 'agent'
}

const store: LiveEvent[] = []

export function pushEvent(e: LiveEvent) {
  store.unshift(e)
  if (store.length > 100) store.splice(100)
}

export function getEvents(limit = 20): LiveEvent[] {
  return store.slice(0, limit)
}

export function getCount(): number {
  return store.length
}