Refactor: Update Supabase client

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 12:05:04 +00:00
parent d886343398
commit 0c0d79754b
6 changed files with 849 additions and 0 deletions

View File

@@ -6,11 +6,33 @@
type LogLevel = 'info' | 'warn' | 'error' | 'debug';
interface LogContext {
requestId?: string; // Correlation ID for tracing
userId?: string;
action?: string;
duration?: number; // Request duration in ms
traceId?: string; // Distributed tracing ID
[key: string]: unknown;
}
// Request tracking utilities
export interface RequestTracking {
requestId: string;
start: number;
traceId?: string;
}
export function startRequest(traceId?: string): RequestTracking {
return {
requestId: crypto.randomUUID(),
start: Date.now(),
traceId: traceId || crypto.randomUUID(),
};
}
export function endRequest(tracking: RequestTracking): number {
return Date.now() - tracking.start;
}
// Fields that should never be logged
const SENSITIVE_FIELDS = [
'password',