delqhi/sin-github-issues
0
1import { getSupabaseClient } from './supabase.js';2 3const DEFAULT_TABLE = process.env.SIN_GITHUB_ISSUES_AUDIT_TABLE?.trim() || 'sin_github_issues_events';4 5export async function recordAuditEvent(event: Record<string, unknown>) {6 try {7 const client = getSupabaseClient();8 const { error } = await client.from(DEFAULT_TABLE).insert({9 kind: String(event.kind || 'unknown'),10 payload: event,11 created_at: new Date().toISOString(),12 });13 return { persisted: !error, error: error?.message || null, table: DEFAULT_TABLE };14 } catch (error) {15 return { persisted: false, error: error instanceof Error ? error.message : String(error), table: DEFAULT_TABLE };16 }17}18 