File size: 406 Bytes
dd480ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Audit Event Factory
 */
import type { AuditEvent } from '../types/workflow';

let counter = 0;

export function createAuditEvent(
  jobId: string,
  event: string,
  actor: AuditEvent['actor'],
  data?: Record<string, unknown>,
): AuditEvent {
  return {
    id: `audit-${jobId}-${++counter}-${Date.now()}`,
    jobId,
    event,
    actor,
    timestamp: new Date().toISOString(),
    data,
  };
}