Skip to content

Commit ffb1cda

Browse files
authored
refactor: move typescript impl to this repo (#28)
* refactor: pull absurd implementation to local * feat: update sample * sdks/typescript: 0.3.0-alpha.0 * chore: minor adjust
1 parent 2a74b12 commit ffb1cda

14 files changed

Lines changed: 1446 additions & 466 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ target/
55
*.dll
66
.DS_Store
77

8-
*.db
8+
*.db
9+
*.db-shm
10+
*.db-wal

samples/typescript-client/package-lock.json

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/typescript-client/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Absurd, SQLiteDatabase } from "@absurd-sqlite/sdk";
1+
import { Absurd, SQLiteConnection, SQLiteDatabase } from "@absurd-sqlite/sdk";
22
import sqlite from "better-sqlite3";
33

44
async function main() {
@@ -9,9 +9,12 @@ async function main() {
99
"ABSURD_DATABASE_EXTENSION_PATH and ABSURD_DATABASE_PATH must be set",
1010
);
1111
}
12-
const db = sqlite(dbPath) as unknown as SQLiteDatabase;
12+
const db = sqlite(dbPath) as SQLiteDatabase;
13+
db.loadExtension(extensionPath);
14+
db.prepare("select absurd_apply_migrations()").run();
15+
const conn = new SQLiteConnection(db, { verbose: console.log });
1316

14-
const absurd = new Absurd(db, extensionPath);
17+
const absurd = new Absurd(conn);
1518

1619
absurd.registerTask(
1720
{
@@ -21,13 +24,15 @@ async function main() {
2124
await ctx.step("init", async () => {
2225
console.log("init step");
2326
ctx.emitEvent("progress", { message: "Initialization complete" });
27+
return {};
2428
});
2529

2630
await ctx.sleepFor("back off 15s", 15);
2731

2832
await ctx.step("process", async () => {
2933
console.log("process step");
3034
ctx.emitEvent("progress", { message: "Processing complete" });
35+
return {};
3136
});
3237

3338
const name = params.name || "world";

0 commit comments

Comments
 (0)