// /components/supadb/aksupainstance.uts import AkSupa from './aksupa.uts' import { SUPA_URL, SUPA_KEY } from '@/ak/config.uts' const supa = new AkSupa(SUPA_URL, SUPA_KEY) // Do not perform hard-coded auto sign-in during page preload (development mode may preload pages). // Instead, mark supa as ready if an existing session is present; otherwise defer sign-in to explicit user action. const supaReady: Promise = (async () => { try { const sess = supa.getSession() if (sess != null && sess.session != null) { return true } return true } catch (err) { console.error('Supabase instance init failed', err) return false } })() // 兼容具名导出(部分代码使用 import { supabase, ensureSupabaseReady }) export const supabase = supa export async function ensureSupabaseReady(): Promise { return await supaReady } export { supaReady } export default supa