Spaces:
Sleeping
Sleeping
| import { getSupabaseClient } from './supabase.js'; | |
| const DEFAULT_TABLE = process.env.SIN_GITHUB_ISSUES_AUDIT_TABLE?.trim() || 'sin_github_issues_events'; | |
| export async function recordAuditEvent(event: Record<string, unknown>) { | |
| try { | |
| const client = getSupabaseClient(); | |
| const { error } = await client.from(DEFAULT_TABLE).insert({ | |
| kind: String(event.kind || 'unknown'), | |
| payload: event, | |
| created_at: new Date().toISOString(), | |
| }); | |
| return { persisted: !error, error: error?.message || null, table: DEFAULT_TABLE }; | |
| } catch (error) { | |
| return { persisted: false, error: error instanceof Error ? error.message : String(error), table: DEFAULT_TABLE }; | |
| } | |
| } | |