Sessions 5-7a: 955 tests, deployment ready

This commit is contained in:
Kev
2026-06-08 18:35:13 -04:00
parent 06b82624a2
commit 1fa04dc776
371 changed files with 49366 additions and 955 deletions
+36
View File
@@ -0,0 +1,36 @@
import { createClient, type SupabaseClient } from '@supabase/supabase-js';
const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
const anonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
let browserClient: SupabaseClient | null = null;
export function getBrowserSupabase(): SupabaseClient | null {
if (typeof window === 'undefined') return null;
if (!url || !anonKey) return null;
if (browserClient) return browserClient;
browserClient = createClient(url, anonKey, {
auth: {
persistSession: true,
autoRefreshToken: true,
detectSessionInUrl: true,
},
});
return browserClient;
}
export function getServerSupabase(authHeader?: string | null): SupabaseClient | null {
if (!url || !anonKey) return null;
return createClient(url, anonKey, {
auth: { persistSession: false, autoRefreshToken: false },
global: authHeader ? { headers: { Authorization: authHeader } } : undefined,
});
}
export function getServiceRoleSupabase(): SupabaseClient | null {
const serviceKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!url || !serviceKey) return null;
return createClient(url, serviceKey, {
auth: { persistSession: false, autoRefreshToken: false },
});
}