blob: c3967c1ee97f9561e85108338860763c4dc39f4a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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 is_ready = query(() => {
return sb1.auth.is_ready()
})
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_tokem()
})
export {
refresh_tokem,
init_auth_session,
is_ready,
get_accounts,
get_transactions,
clear_auth_session,
get_auth_info,
}
|