Spaces:
Paused
Paused
Download src/audit.ts from delqhi/sin-github-issues: direct link, hf CLI and curl.
- Browser
- Download file 691 Bytes
-
https://huggingface.co/spaces/delqhi/sin-github-issues/resolve/main/src/audit.ts
- Command line
-
hf download hf://spaces/delqhi/sin-github-issues/src/audit.ts
-
curl -L -o audit.ts https://huggingface.co/spaces/delqhi/sin-github-issues/resolve/main/src/audit.ts
691 Bytes
| 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 }; | |
| } | |
| } | |