import { db } from "$lib/server/db"; import { syncSession } from "$lib/server/db/schema"; import * as v from "valibot" import { command, query } from "$app/server"; import sb1 from "$lib/server/sb1"; const init_auth_session = command(async () => { return await sb1.auth.init_auth_session() }) const get_accounts = query(() => { return sb1.data.get_accounts() }) const get_transactions = query(v.string(), (accountKey: string) => { return sb1.data.get_transactions(accountKey) }) const clear_auth_session = query(async () => { await db.delete(syncSession) }) const get_auth_info = query(() => { return sb1.auth.get_auth_info() }) const refresh_tokem = command(async () => { await sb1.auth.refresh_token() }) export { refresh_tokem, init_auth_session, get_accounts, get_transactions, clear_auth_session, get_auth_info, }