1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { InStatement } from "https://esm.town/v/std/sqlite";
import type { ResultSet } from "npm:@libsql/client";
async function execute(statement: InStatement): Promise<ResultSet> {
const resp = await fetch("https://sqlite-execute.web.val.run", {
method: "POST",
body: JSON.stringify({
args: [statement],
}),
});
if (!resp.ok) {
throw new Error(await resp.text());
}
return resp.json();
}
export const db = {
execute,
};