@absurd-sqlite/bun-worker 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -4
- package/test/run.test.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AbsurdClient } from "@absurd-sqlite/sdk";
|
|
2
|
+
export type { AbsurdClient } from "@absurd-sqlite/sdk";
|
|
2
3
|
/**
|
|
3
4
|
* Register tasks and perform any one-time setup before the worker starts.
|
|
4
5
|
*/
|
|
5
|
-
export type SetupFunction = (absurd:
|
|
6
|
+
export type SetupFunction = (absurd: AbsurdClient) => void | Promise<void>;
|
|
6
7
|
/**
|
|
7
8
|
* Boots a worker using Bun's SQLite driver and Absurd's task engine.
|
|
8
9
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3E;;;;;;GAMG;AACH,wBAA8B,GAAG,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C7E"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Absurd } from "absurd-sdk";
|
|
2
2
|
import { Database } from "bun:sqlite";
|
|
3
|
+
import type { AbsurdClient } from "@absurd-sqlite/sdk";
|
|
3
4
|
|
|
4
5
|
import { BunSqliteConnection } from "./sqlite";
|
|
5
6
|
|
|
7
|
+
export type { AbsurdClient } from "@absurd-sqlite/sdk";
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Register tasks and perform any one-time setup before the worker starts.
|
|
8
11
|
*/
|
|
9
|
-
export type SetupFunction = (absurd:
|
|
12
|
+
export type SetupFunction = (absurd: AbsurdClient) => void | Promise<void>;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* 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>;
|
|
|
15
18
|
* - ABSURD_DATABASE_PATH: SQLite database file path.
|
|
16
19
|
* - ABSURD_DATABASE_EXTENSION_PATH: Absurd-SQLite extension path (libabsurd.*).
|
|
17
20
|
*/
|
|
18
|
-
export default async function run(
|
|
19
|
-
setupFunction: SetupFunction
|
|
20
|
-
): Promise<void> {
|
|
21
|
+
export default async function run(setupFunction: SetupFunction): Promise<void> {
|
|
21
22
|
const dbPath = process.env.ABSURD_DATABASE_PATH;
|
|
22
23
|
const extensionPath = process.env.ABSURD_DATABASE_EXTENSION_PATH;
|
|
23
24
|
|
package/test/run.test.ts
CHANGED
|
@@ -57,10 +57,13 @@ afterEach(() => {
|
|
|
57
57
|
|
|
58
58
|
describe("run", () => {
|
|
59
59
|
it("requires ABSURD_DATABASE_PATH", async () => {
|
|
60
|
+
process.env.ABSURD_DATABASE_PATH = "";
|
|
60
61
|
process.env.ABSURD_DATABASE_EXTENSION_PATH = extensionPath;
|
|
61
62
|
const { default: run } = await import("../src/index");
|
|
62
63
|
|
|
63
|
-
await expect(run(() => {})).rejects.toThrow(
|
|
64
|
+
await expect(run(() => {})).rejects.toThrow(
|
|
65
|
+
"ABSURD_DATABASE_PATH is required"
|
|
66
|
+
);
|
|
64
67
|
});
|
|
65
68
|
|
|
66
69
|
it("requires ABSURD_DATABASE_EXTENSION_PATH", async () => {
|