Skip to content

Commit 42528fd

Browse files
authored
fix(sdks/bun-worker): export AbsurdClient instead (#15)
* test: unset env var explicitly * fix: export AbsurdClient type instead
1 parent e2ec270 commit 42528fd

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

sdks/bun-worker/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import { Absurd } from "absurd-sdk";
22
import { Database } from "bun:sqlite";
3+
import type { AbsurdClient } from "@absurd-sqlite/sdk";
34

45
import { BunSqliteConnection } from "./sqlite";
56

7+
export type { AbsurdClient } from "@absurd-sqlite/sdk";
8+
69
/**
710
* Register tasks and perform any one-time setup before the worker starts.
811
*/
9-
export type SetupFunction = (absurd: Absurd) => void | Promise<void>;
12+
export type SetupFunction = (absurd: AbsurdClient) => void | Promise<void>;
1013

1114
/**
1215
* Boots a worker using Bun's SQLite driver and Absurd's task engine.
@@ -15,9 +18,7 @@ export type SetupFunction = (absurd: Absurd) => void | Promise<void>;
1518
* - ABSURD_DATABASE_PATH: SQLite database file path.
1619
* - ABSURD_DATABASE_EXTENSION_PATH: Absurd-SQLite extension path (libabsurd.*).
1720
*/
18-
export default async function run(
19-
setupFunction: SetupFunction
20-
): Promise<void> {
21+
export default async function run(setupFunction: SetupFunction): Promise<void> {
2122
const dbPath = process.env.ABSURD_DATABASE_PATH;
2223
const extensionPath = process.env.ABSURD_DATABASE_EXTENSION_PATH;
2324

sdks/bun-worker/test/run.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ afterEach(() => {
5757

5858
describe("run", () => {
5959
it("requires ABSURD_DATABASE_PATH", async () => {
60+
process.env.ABSURD_DATABASE_PATH = "";
6061
process.env.ABSURD_DATABASE_EXTENSION_PATH = extensionPath;
6162
const { default: run } = await import("../src/index");
6263

63-
await expect(run(() => {})).rejects.toThrow("ABSURD_DATABASE_PATH is required");
64+
await expect(run(() => {})).rejects.toThrow(
65+
"ABSURD_DATABASE_PATH is required"
66+
);
6467
});
6568

6669
it("requires ABSURD_DATABASE_EXTENSION_PATH", async () => {

0 commit comments

Comments
 (0)