@workglow/storage 0.0.125 → 0.0.126
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/README.md +15 -6
- package/dist/browser.d.ts +18 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/{types.d.ts → bun.d.ts} +1 -1
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +3 -4
- package/dist/bun.js.map +11 -11
- package/dist/node.d.ts +7 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +3 -4
- package/dist/node.js.map +11 -11
- package/dist/postgres/browser.d.ts +32 -0
- package/dist/postgres/browser.d.ts.map +1 -0
- package/dist/postgres/browser.js +150 -0
- package/dist/postgres/browser.js.map +11 -0
- package/dist/postgres/node-bun.d.ts +26 -0
- package/dist/postgres/node-bun.d.ts.map +1 -0
- package/dist/postgres/node-bun.js +41 -0
- package/dist/postgres/node-bun.js.map +10 -0
- package/dist/postgres/pglite-pool.d.ts +21 -0
- package/dist/postgres/pglite-pool.d.ts.map +1 -0
- package/dist/queue/PostgresQueueStorage.d.ts +1 -1
- package/dist/queue/PostgresQueueStorage.d.ts.map +1 -1
- package/dist/queue/SqliteQueueStorage.d.ts +1 -1
- package/dist/queue/SqliteQueueStorage.d.ts.map +1 -1
- package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts +1 -1
- package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts.map +1 -1
- package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts +1 -1
- package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts.map +1 -1
- package/dist/sqlite/browser.d.ts +37 -0
- package/dist/sqlite/browser.d.ts.map +1 -0
- package/dist/sqlite/browser.js +125 -0
- package/dist/sqlite/browser.js.map +10 -0
- package/dist/sqlite/bun.d.ts +32 -0
- package/dist/sqlite/bun.d.ts.map +1 -0
- package/dist/sqlite/bun.js +84 -0
- package/dist/sqlite/bun.js.map +10 -0
- package/dist/sqlite/canonical-api.d.ts +34 -0
- package/dist/sqlite/canonical-api.d.ts.map +1 -0
- package/dist/sqlite/node.d.ts +34 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +65 -0
- package/dist/sqlite/node.js.map +10 -0
- package/dist/tabular/PostgresTabularStorage.d.ts +1 -1
- package/dist/tabular/PostgresTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts.map +1 -1
- package/dist/vector/PostgresVectorStorage.d.ts +1 -1
- package/dist/vector/PostgresVectorStorage.d.ts.map +1 -1
- package/dist/vector/SqliteAiVectorStorage.d.ts +1 -1
- package/dist/vector/SqliteAiVectorStorage.d.ts.map +1 -1
- package/dist/vector/SqliteVectorStorage.d.ts +1 -1
- package/dist/vector/SqliteVectorStorage.d.ts.map +1 -1
- package/package.json +84 -20
- package/src/kv/README.md +4 -3
- package/src/queue/README.md +1 -1
- package/src/tabular/README.md +8 -1
- package/src/vector/README.md +6 -6
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { SqliteApi } from "./canonical-api";
|
|
7
|
+
export type { SqliteApi };
|
|
8
|
+
/**
|
|
9
|
+
* Resolves `bun:sqlite` via dynamic import. Idempotent; concurrent callers share one load.
|
|
10
|
+
*/
|
|
11
|
+
declare function initSqlite(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Bun `bun:sqlite` database wrapped to match {@link SqliteApi.Database}:
|
|
14
|
+
* `prepare<Bind, Result>` uses bindings-first generics; `get()` maps `null` → `undefined`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BunSqliteDatabase implements SqliteApi.Database {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(filename?: string, options?: number | import("bun:sqlite").DatabaseOptions);
|
|
19
|
+
exec(sql: string): void;
|
|
20
|
+
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): SqliteApi.Statement<BindParameters, Result>;
|
|
21
|
+
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
22
|
+
close(): void;
|
|
23
|
+
loadExtension(path: string, entryPoint?: string): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const Sqlite: {
|
|
26
|
+
readonly init: typeof initSqlite;
|
|
27
|
+
readonly Database: typeof BunSqliteDatabase;
|
|
28
|
+
};
|
|
29
|
+
export declare namespace Sqlite {
|
|
30
|
+
type Database = BunSqliteDatabase;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=bun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/sqlite/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EAAE,SAAS,EAAE,CAAC;AAgB1B;;GAEG;AACH,iBAAS,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAOnC;AAuCD;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,SAAS,CAAC,QAAQ;;IAG1D,YAAY,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,YAAY,EAAE,eAAe,EAGrF;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtB;IAED,OAAO,CAAC,cAAc,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,GAAG,OAAO,EAC9F,GAAG,EAAE,MAAM,GACV,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAG7C;IAED,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAK/E;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAErD;CACF;AAED,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX,yBAAiB,MAAM,CAAC,CAAC;IACvB,KAAY,QAAQ,GAAG,iBAAiB,CAAC;CAC1C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __require = import.meta.require;
|
|
3
|
+
|
|
4
|
+
// src/sqlite/bun.ts
|
|
5
|
+
var _bunSqlite;
|
|
6
|
+
var initPromise;
|
|
7
|
+
function assertBunLoaded() {
|
|
8
|
+
if (!_bunSqlite) {
|
|
9
|
+
throw new Error("SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().");
|
|
10
|
+
}
|
|
11
|
+
return _bunSqlite;
|
|
12
|
+
}
|
|
13
|
+
function initSqlite() {
|
|
14
|
+
return initPromise ??= (async () => {
|
|
15
|
+
if (_bunSqlite) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
_bunSqlite = await import("bun:sqlite");
|
|
19
|
+
})();
|
|
20
|
+
}
|
|
21
|
+
function getBunSqlite() {
|
|
22
|
+
return assertBunLoaded();
|
|
23
|
+
}
|
|
24
|
+
function toRunResult(changes, lastInsertRowid) {
|
|
25
|
+
return { changes, lastInsertRowid };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class BunStatementAdapter {
|
|
29
|
+
#stmt;
|
|
30
|
+
constructor(stmt) {
|
|
31
|
+
this.#stmt = stmt;
|
|
32
|
+
}
|
|
33
|
+
run(...params) {
|
|
34
|
+
const meta = this.#stmt.run(...params);
|
|
35
|
+
return toRunResult(meta.changes, meta.lastInsertRowid);
|
|
36
|
+
}
|
|
37
|
+
get(...params) {
|
|
38
|
+
const row = this.#stmt.get(...params);
|
|
39
|
+
return row === null ? undefined : row;
|
|
40
|
+
}
|
|
41
|
+
all(...params) {
|
|
42
|
+
return this.#stmt.all(...params);
|
|
43
|
+
}
|
|
44
|
+
finalize() {
|
|
45
|
+
this.#stmt.finalize();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class BunSqliteDatabase {
|
|
50
|
+
#db;
|
|
51
|
+
constructor(filename, options) {
|
|
52
|
+
const { Database } = getBunSqlite();
|
|
53
|
+
this.#db = new Database(filename, options);
|
|
54
|
+
}
|
|
55
|
+
exec(sql) {
|
|
56
|
+
this.#db.run(sql);
|
|
57
|
+
}
|
|
58
|
+
prepare(sql) {
|
|
59
|
+
const stmt = this.#db.prepare(sql);
|
|
60
|
+
return new BunStatementAdapter(stmt);
|
|
61
|
+
}
|
|
62
|
+
transaction(fn) {
|
|
63
|
+
const tx = this.#db.transaction(fn);
|
|
64
|
+
return (...args) => {
|
|
65
|
+
tx(...args);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
close() {
|
|
69
|
+
this.#db.close();
|
|
70
|
+
}
|
|
71
|
+
loadExtension(path, entryPoint) {
|
|
72
|
+
this.#db.loadExtension(path, entryPoint);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
var Sqlite = {
|
|
76
|
+
init: initSqlite,
|
|
77
|
+
Database: BunSqliteDatabase
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
Sqlite,
|
|
81
|
+
BunSqliteDatabase
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//# debugId=A1427F3CD043959764756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sqlite/bun.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Database as BunDatabaseCtor, Statement as BunStatementType } from \"bun:sqlite\";\n\nimport type { SqliteApi } from \"./canonical-api\";\n\nexport type { SqliteApi };\n\ntype BunSqliteModule = typeof import(\"bun:sqlite\");\n\nlet _bunSqlite: BunSqliteModule | undefined;\nlet initPromise: Promise<void> | undefined;\n\nfunction assertBunLoaded(): BunSqliteModule {\n if (!_bunSqlite) {\n throw new Error(\n \"SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().\"\n );\n }\n return _bunSqlite;\n}\n\n/**\n * Resolves `bun:sqlite` via dynamic import. Idempotent; concurrent callers share one load.\n */\nfunction initSqlite(): Promise<void> {\n return (initPromise ??= (async () => {\n if (_bunSqlite) {\n return;\n }\n _bunSqlite = await import(\"bun:sqlite\");\n })());\n}\n\nfunction getBunSqlite(): BunSqliteModule {\n return assertBunLoaded();\n}\n\nfunction toRunResult(changes: number, lastInsertRowid: number | bigint): SqliteApi.RunResult {\n return { changes, lastInsertRowid };\n}\n\nclass BunStatementAdapter<\n BindParameters extends unknown[] | Record<string, unknown> = unknown[],\n Result = unknown,\n> implements SqliteApi.Statement<BindParameters, Result> {\n readonly #stmt: BunStatementType<Result, any>;\n\n constructor(stmt: BunStatementType<Result, any>) {\n this.#stmt = stmt;\n }\n\n run(...params: unknown[]): SqliteApi.RunResult {\n const meta = this.#stmt.run(...(params as never[]));\n return toRunResult(meta.changes, meta.lastInsertRowid);\n }\n\n get(...params: unknown[]): Result | undefined {\n const row = this.#stmt.get(...(params as never[]));\n return row === null ? undefined : row;\n }\n\n all(...params: unknown[]): Result[] {\n return this.#stmt.all(...(params as never[]));\n }\n\n finalize(): void {\n this.#stmt.finalize();\n }\n}\n\n/**\n * Bun `bun:sqlite` database wrapped to match {@link SqliteApi.Database}:\n * `prepare<Bind, Result>` uses bindings-first generics; `get()` maps `null` → `undefined`.\n */\nexport class BunSqliteDatabase implements SqliteApi.Database {\n readonly #db: InstanceType<typeof BunDatabaseCtor>;\n\n constructor(filename?: string, options?: number | import(\"bun:sqlite\").DatabaseOptions) {\n const { Database } = getBunSqlite();\n this.#db = new Database(filename, options);\n }\n\n exec(sql: string): void {\n this.#db.run(sql);\n }\n\n prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(\n sql: string\n ): SqliteApi.Statement<BindParameters, Result> {\n const stmt = this.#db.prepare<Result, any>(sql);\n return new BunStatementAdapter<BindParameters, Result>(stmt);\n }\n\n transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void {\n const tx = this.#db.transaction(fn);\n return (...args: T) => {\n tx(...args);\n };\n }\n\n close(): void {\n this.#db.close();\n }\n\n loadExtension(path: string, entryPoint?: string): void {\n this.#db.loadExtension(path, entryPoint);\n }\n}\n\nexport const Sqlite = {\n init: initSqlite,\n Database: BunSqliteDatabase,\n} as const;\n\nexport namespace Sqlite {\n export type Database = BunSqliteDatabase;\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;AAcA,IAAI;AACJ,IAAI;AAEJ,SAAS,eAAe,GAAoB;AAAA,EAC1C,IAAI,CAAC,YAAY;AAAA,IACf,MAAM,IAAI,MACR,8EACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAMT,SAAS,UAAU,GAAkB;AAAA,EACnC,OAAQ,iBAAiB,YAAY;AAAA,IACnC,IAAI,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,aAAa,MAAa;AAAA,KACzB;AAAA;AAGL,SAAS,YAAY,GAAoB;AAAA,EACvC,OAAO,gBAAgB;AAAA;AAGzB,SAAS,WAAW,CAAC,SAAiB,iBAAuD;AAAA,EAC3F,OAAO,EAAE,SAAS,gBAAgB;AAAA;AAAA;AAGpC,MAAM,oBAGmD;AAAA,EAC9C;AAAA,EAET,WAAW,CAAC,MAAqC;AAAA,IAC/C,KAAK,QAAQ;AAAA;AAAA,EAGf,GAAG,IAAI,QAAwC;AAAA,IAC7C,MAA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**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Canonical SQLite surface for `@workglow/storage/sqlite` across Node (better-sqlite3),
|
|
8
|
+
* Bun (native, via adapter), and browser (WASM).
|
|
9
|
+
*
|
|
10
|
+
* On every platform, call `await Sqlite.init()` once before `new Sqlite.Database(...)`.
|
|
11
|
+
*
|
|
12
|
+
* **Generic order:** `prepare<BindParameters, Result>(sql)` — bindings first,
|
|
13
|
+
* row/result second (better-sqlite3 order), not `bun:sqlite`’s reversed order.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace SqliteApi {
|
|
16
|
+
interface RunResult {
|
|
17
|
+
readonly changes: number;
|
|
18
|
+
readonly lastInsertRowid: number | bigint;
|
|
19
|
+
}
|
|
20
|
+
interface Statement<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown> {
|
|
21
|
+
run(...params: unknown[]): RunResult;
|
|
22
|
+
get(...params: unknown[]): Result | undefined;
|
|
23
|
+
all(...params: unknown[]): Result[];
|
|
24
|
+
finalize(): void;
|
|
25
|
+
}
|
|
26
|
+
interface Database {
|
|
27
|
+
exec(sql: string): void;
|
|
28
|
+
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): Statement<BindParameters, Result>;
|
|
29
|
+
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
30
|
+
close(): void;
|
|
31
|
+
loadExtension(path: string, entryPoint?: string): void;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=canonical-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-api.d.ts","sourceRoot":"","sources":["../../src/sqlite/canonical-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,yBAAiB,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|
5
|
+
*/
|
|
6
|
+
import type BetterSqlite3 from "better-sqlite3";
|
|
7
|
+
import type { SqliteApi } from "./canonical-api";
|
|
8
|
+
export type { SqliteApi };
|
|
9
|
+
/**
|
|
10
|
+
* Loads better-sqlite3 via dynamic import. Idempotent; concurrent callers share one load.
|
|
11
|
+
*/
|
|
12
|
+
declare function initSqlite(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* better-sqlite3 database wrapped as {@link SqliteApi.Database} (bindings-first `prepare`
|
|
15
|
+
* generics). Construct only after {@link Sqlite.init}.
|
|
16
|
+
*/
|
|
17
|
+
export declare class NodeSqliteDatabase implements SqliteApi.Database {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(filename?: string, options?: BetterSqlite3.Options);
|
|
20
|
+
exec(sql: string): void;
|
|
21
|
+
prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(sql: string): SqliteApi.Statement<BindParameters, Result>;
|
|
22
|
+
transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void;
|
|
23
|
+
close(): void;
|
|
24
|
+
loadExtension(path: string, entryPoint?: string): void;
|
|
25
|
+
}
|
|
26
|
+
export declare const Sqlite: {
|
|
27
|
+
readonly init: typeof initSqlite;
|
|
28
|
+
readonly Database: typeof NodeSqliteDatabase;
|
|
29
|
+
};
|
|
30
|
+
/** Merged with {@link Sqlite} so `Sqlite.Database` works in type positions (not only as a value). */
|
|
31
|
+
export declare namespace Sqlite {
|
|
32
|
+
type Database = NodeSqliteDatabase;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/sqlite/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EAAE,SAAS,EAAE,CAAC;AAc1B;;GAEG;AACH,iBAAS,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBnC;AAED;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,SAAS,CAAC,QAAQ;;IAG3D,YAAY,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,EAG7D;IAED,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtB;IAED,OAAO,CAAC,cAAc,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,GAAG,OAAO,EAC9F,GAAG,EAAE,MAAM,GACV,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAE7C;IAED,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAK/E;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CASrD;CACF;AAED,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX,qGAAqG;AACrG,yBAAiB,MAAM,CAAC,CAAC;IACvB,KAAY,QAAQ,GAAG,kBAAkB,CAAC;CAC3C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/sqlite/node.ts
|
|
5
|
+
var BetterCtor;
|
|
6
|
+
var initPromise;
|
|
7
|
+
function assertLoaded() {
|
|
8
|
+
if (!BetterCtor) {
|
|
9
|
+
throw new Error("SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().");
|
|
10
|
+
}
|
|
11
|
+
return BetterCtor;
|
|
12
|
+
}
|
|
13
|
+
function initSqlite() {
|
|
14
|
+
return initPromise ??= (async () => {
|
|
15
|
+
if (BetterCtor) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const mod = await import("better-sqlite3");
|
|
20
|
+
BetterCtor = mod.default ?? mod;
|
|
21
|
+
} catch {
|
|
22
|
+
throw new Error("better-sqlite3 is required for @workglow/storage/sqlite on Node.js. Install it with: bun add better-sqlite3");
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class NodeSqliteDatabase {
|
|
28
|
+
#inner;
|
|
29
|
+
constructor(filename, options) {
|
|
30
|
+
const Ctor = assertLoaded();
|
|
31
|
+
this.#inner = new Ctor(filename ?? ":memory:", options);
|
|
32
|
+
}
|
|
33
|
+
exec(sql) {
|
|
34
|
+
this.#inner.exec(sql);
|
|
35
|
+
}
|
|
36
|
+
prepare(sql) {
|
|
37
|
+
return this.#inner.prepare(sql);
|
|
38
|
+
}
|
|
39
|
+
transaction(fn) {
|
|
40
|
+
const tx = this.#inner.transaction(fn);
|
|
41
|
+
return (...args) => {
|
|
42
|
+
tx(...args);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
close() {
|
|
46
|
+
this.#inner.close();
|
|
47
|
+
}
|
|
48
|
+
loadExtension(path, entryPoint) {
|
|
49
|
+
if (entryPoint === undefined) {
|
|
50
|
+
this.#inner.loadExtension(path);
|
|
51
|
+
} else {
|
|
52
|
+
this.#inner.loadExtension(path, entryPoint);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
var Sqlite = {
|
|
57
|
+
init: initSqlite,
|
|
58
|
+
Database: NodeSqliteDatabase
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
Sqlite,
|
|
62
|
+
NodeSqliteDatabase
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//# debugId=0C6C96D699E34FE664756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sqlite/node.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type BetterSqlite3 from \"better-sqlite3\";\n\nimport type { SqliteApi } from \"./canonical-api\";\n\nexport type { SqliteApi };\n\ntype BetterDatabase = InstanceType<typeof BetterSqlite3>;\n\nlet BetterCtor: typeof BetterSqlite3 | undefined;\nlet initPromise: Promise<void> | undefined;\n\nfunction assertLoaded(): typeof BetterSqlite3 {\n if (!BetterCtor) {\n throw new Error(\"SQLite is not ready. Await Sqlite.init() before using new Sqlite.Database().\");\n }\n return BetterCtor;\n}\n\n/**\n * Loads better-sqlite3 via dynamic import. Idempotent; concurrent callers share one load.\n */\nfunction initSqlite(): Promise<void> {\n return (initPromise ??= (async () => {\n if (BetterCtor) {\n return;\n }\n try {\n const mod = await import(\"better-sqlite3\");\n BetterCtor =\n (mod as { default?: typeof BetterSqlite3 }).default ??\n (mod as unknown as typeof BetterSqlite3);\n } catch {\n throw new Error(\n \"better-sqlite3 is required for @workglow/storage/sqlite on Node.js. Install it with: bun add better-sqlite3\"\n );\n }\n })());\n}\n\n/**\n * better-sqlite3 database wrapped as {@link SqliteApi.Database} (bindings-first `prepare`\n * generics). Construct only after {@link Sqlite.init}.\n */\nexport class NodeSqliteDatabase implements SqliteApi.Database {\n readonly #inner: BetterDatabase;\n\n constructor(filename?: string, options?: BetterSqlite3.Options) {\n const Ctor = assertLoaded();\n this.#inner = new Ctor(filename ?? \":memory:\", options);\n }\n\n exec(sql: string): void {\n this.#inner.exec(sql);\n }\n\n prepare<BindParameters extends unknown[] | Record<string, unknown> = unknown[], Result = unknown>(\n sql: string\n ): SqliteApi.Statement<BindParameters, Result> {\n return this.#inner.prepare(sql) as unknown as SqliteApi.Statement<BindParameters, Result>;\n }\n\n transaction<T extends unknown[]>(fn: (...args: T) => void): (...args: T) => void {\n const tx = this.#inner.transaction(fn);\n return (...args: T) => {\n tx(...args);\n };\n }\n\n close(): void {\n this.#inner.close();\n }\n\n loadExtension(path: string, entryPoint?: string): void {\n if (entryPoint === undefined) {\n this.#inner.loadExtension(path);\n } else {\n (this.#inner as unknown as { loadExtension(p: string, e?: string): void }).loadExtension(\n path,\n entryPoint\n );\n }\n }\n}\n\nexport const Sqlite = {\n init: initSqlite,\n Database: NodeSqliteDatabase,\n} as const;\n\n/** Merged with {@link Sqlite} so `Sqlite.Database` works in type positions (not only as a value). */\nexport namespace Sqlite {\n export type Database = NodeSqliteDatabase;\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;AAcA,IAAI;AACJ,IAAI;AAEJ,SAAS,YAAY,GAAyB;AAAA,EAC5C,IAAI,CAAC,YAAY;AAAA,IACf,MAAM,IAAI,MAAM,8EAA8E;AAAA,EAChG;AAAA,EACA,OAAO;AAAA;AAMT,SAAS,UAAU,GAAkB;AAAA,EACnC,OAAQ,iBAAiB,YAAY;AAAA,IACnC,IAAI,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,IAAI;AAAA,MACF,MAAM,MAAM,MAAa;AAAA,MACzB,aACG,IAA2C,WAC3C;AAAA,MACH,MAAM;AAAA,MACN,MAAM,IAAI,MACR,6GACF;AAAA;AAAA,KAED;AAAA;AAAA;AAOE,MAAM,mBAAiD;AAAA,EACnD;AAAA,EAET,WAAW,CAAC,UAAmB,SAAiC;AAAA,IAC9D,MAAM,OAAO,aAAa;AAAA,IAC1B,KAAK,SAAS,IAAI,KAAK,YAAY,YAAY,OAAO;AAAA;AAAA,EAGxD,IAAI,CAAC,KAAmB;AAAA,IACtB,KAAK,OAAO,KAAK,GAAG;AAAA;AAAA,EAGtB,OAAiG,CAC/F,KAC6C;AAAA,IAC7C,OAAO,KAAK,OAAO,QAAQ,GAAG;AAAA;AAAA,EAGhC,WAAgC,CAAC,IAAgD;AAAA,IAC/E,MAAM,KAAK,KAAK,OAAO,YAAY,EAAE;AAAA,IACrC,OAAO,IAAI,SAAY;AAAA,MACrB,GAAG,GAAG,IAAI;AAAA;AAAA;AAAA,EAId,KAAK,GAAS;AAAA,IACZ,KAAK,OAAO,MAAM;AAAA;AAAA,EAGpB,aAAa,CAAC,MAAc,YAA2B;AAAA,IACrD,IAAI,eAAe,WAAW;AAAA,MAC5B,KAAK,OAAO,cAAc,IAAI;AAAA,IAChC,EAAO;AAAA,MACJ,KAAK,OAAqE,cACzE,MACA,UACF;AAAA;AAAA;AAGN;AAEO,IAAM,SAAS;AAAA,EACpB,MAAM;AAAA,EACN,UAAU;AACZ;",
|
|
8
|
+
"debugId": "0C6C96D699E34FE664756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
7
|
-
import type { Pool } from "
|
|
7
|
+
import type { Pool } from "@workglow/storage/postgres";
|
|
8
8
|
import { BaseSqlTabularStorage } from "./BaseSqlTabularStorage";
|
|
9
9
|
import { ClientProvidedKeysOption } from "./BaseTabularStorage";
|
|
10
10
|
import { AnyTabularStorage, AutoGeneratedKeys, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/PostgresTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,UAAU,EAEV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,K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M,EAAE,GAAG,SAAS,CAAC,CAqC/B;IAED;;;;;OAKG;IACH,kBAAkB,CAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,IAAI,EACxD,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,IAAI,CAEZ;IAED;;OAEG;IACH,OAAO,IAAI,IAAI,CAEd;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Sqlite } from "@workglow/sqlite";
|
|
6
|
+
import { Sqlite } from "@workglow/storage/sqlite";
|
|
7
7
|
import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
8
8
|
import { BaseSqlTabularStorage } from "./BaseSqlTabularStorage";
|
|
9
9
|
import { ClientProvidedKeysOption, KeyGenerationStrategy } from "./BaseTabularStorage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/SqliteTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SqliteTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/SqliteTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,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AAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAuB1E;IAED;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG;QACxE,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,eAAe,EAAE,CAAC;KAC3B,CA4BA;IAED;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAYxE;IAED;;;;;;OAMG;IACG,KAAK,CACT,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAChC,OAAO,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA0C/B;IAED;;;;;OAKG;IACH,kBAAkB,CAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,IAAI,EACxD,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,IAAI,CAEZ;IAED;;OAEG;IACH,OAAO,IAAI,IAAI,CAEd;CACF"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { DataPortSchemaObject, FromSchema, TypedArray, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
7
|
-
import type { Pool } from "
|
|
7
|
+
import type { Pool } from "@workglow/storage/postgres";
|
|
8
8
|
import { PostgresTabularStorage } from "../tabular/PostgresTabularStorage";
|
|
9
9
|
import { type HybridSearchOptions, type IVectorStorage, type VectorSearchOptions } from "./IVectorStorage";
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/PostgresVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB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AChC,OAAO,mEAA4D,EACnE,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,KAAK,KAAK,EAAE,MAAM,EAAE,KAAK,UAAyB,EAc/D;IAED,mBAAmB,IAAI,MAAM,CAE5B;IAEK,gBAAgB,CACpB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,mBAAmB,CAAC,QAAQ,CAAM,GAC1C,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAgE5C;IAEK,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC;;UA2E3E;YAKa,cAAc;YA+Bd,oBAAoB;IA4ClC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,aAAa;CAQtB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Sqlite } from "@workglow/sqlite";
|
|
6
|
+
import { Sqlite } from "@workglow/storage/sqlite";
|
|
7
7
|
import type { DataPortSchemaObject, FromSchema, TypedArray, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
8
8
|
import { SqliteTabularStorage } from "../tabular/SqliteTabularStorage";
|
|
9
9
|
import { type HybridSearchOptions, type IVectorStorage, type VectorSearchOptions } from "./IVectorStorage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteAiVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/SqliteAiVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SqliteAiVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/SqliteAiVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG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IAED,mBAAmB,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAsCnC;IAED;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IA8BpB;;OAEG;IACH,SAAS,CAAC,YAAY,CACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,MAAM,CAAC,GAC1B,UAAU,CAAC,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,CAOnF;IAED;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,MAAM,CAAC,CAKvE;IAED;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAQ3C;IAED;;;;;OAKG;IACG,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAwGtC;IAED;;;;OAIG;IACG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,mBAAmB,CAAC,QAAQ,CAAM;;UAoGpF;IAED;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC;;UAmF3E;YAKa,cAAc;YA6Bd,oBAAoB;CAyCnC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Sqlite } from "@workglow/sqlite";
|
|
6
|
+
import { Sqlite } from "@workglow/storage/sqlite";
|
|
7
7
|
import type { DataPortSchemaObject, FromSchema, TypedArray, TypedArraySchemaOptions } from "@workglow/util/schema";
|
|
8
8
|
import { SqliteTabularStorage } from "../tabular/SqliteTabularStorage";
|
|
9
9
|
import { type HybridSearchOptions, type IVectorStorage, type VectorSearchOptions } from "./IVectorStorage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/SqliteVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SqliteVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/SqliteVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAc1B;;;;;;;;GAQG;AACH,qBAAa,mBAAmB,CAC9B,MAAM,SAAS,oBAAoB,EACnC,eAAe,SAAS,aAAa,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EACjE,MAAM,SAAS,UAAU,GAAG,YAAY,EACxC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9E,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAEpD,SAAQ,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAC5D,YAAW,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC;IAEpE,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,kBAAkB,CAAe;IACzC,OAAO,CAAC,oBAAoB,CAA2B;IAEvD;;;;;;OAMG;IACH,YACE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,QAAQ,EAClC,KAAK,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,OAAO,mEAA4D,EACnE,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,KAAK,KAAK,EAAE,MAAM,EAAE,KAAK,UAAyB,EAc/D;IAED,mBAAmB,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAMnB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,mBAAmB,CAAC,QAAQ,CAAM;;UAsCpF;IAEK,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC;;UA6D3E;CACF"}
|
package/package.json
CHANGED
|
@@ -1,58 +1,122 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.126",
|
|
5
5
|
"description": "Storage abstraction layer for Workglow, supporting IndexedDB, PostgreSQL, and Supabase with unified interfaces.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
8
|
-
"watch-js": "concurrently -c 'auto' -n 'browser,node,bun' 'bun run watch-browser' 'bun run watch-node' 'bun run watch-bun'",
|
|
8
|
+
"watch-js": "concurrently -c 'auto' -n 'browser,node,bun,sqlite-br,sqlite-n,sqlite-bu,pg-br,pg-nb' 'bun run watch-browser' 'bun run watch-node' 'bun run watch-bun' 'bun run watch-sqlite-browser' 'bun run watch-sqlite-node' 'bun run watch-sqlite-bun' 'bun run watch-postgres-browser' 'bun run watch-postgres-node-bun'",
|
|
9
9
|
"watch-browser": "bun build --watch --no-clear-screen --target=browser --sourcemap=external --packages=external --outdir ./dist ./src/browser.ts",
|
|
10
10
|
"watch-node": "bun build --watch --no-clear-screen --target=node --sourcemap=external --packages=external --outdir ./dist ./src/node.ts",
|
|
11
11
|
"watch-bun": "bun build --watch --no-clear-screen --target=bun --sourcemap=external --packages=external --outdir ./dist ./src/bun.ts",
|
|
12
|
+
"watch-sqlite-browser": "bun build --watch --no-clear-screen --target=browser --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/browser.ts",
|
|
13
|
+
"watch-sqlite-node": "bun build --watch --no-clear-screen --target=node --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/node.ts",
|
|
14
|
+
"watch-sqlite-bun": "bun build --watch --no-clear-screen --target=bun --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/bun.ts",
|
|
15
|
+
"watch-postgres-browser": "bun build --watch --no-clear-screen --target=browser --sourcemap=external --packages=external --outdir ./dist/postgres ./src/postgres/browser.ts",
|
|
16
|
+
"watch-postgres-node-bun": "bun build --watch --no-clear-screen --target=node --sourcemap=external --packages=external --outdir ./dist/postgres ./src/postgres/node-bun.ts",
|
|
12
17
|
"watch-types": "tsc --watch --preserveWatchOutput",
|
|
13
|
-
"build-package": "
|
|
14
|
-
"build-js": "concurrently -c 'auto' -n 'browser,node,bun' 'bun run build-browser' 'bun run build-node' 'bun run build-bun'",
|
|
18
|
+
"build-package": "bun run build-js && bun run build-types",
|
|
19
|
+
"build-js": "concurrently -c 'auto' -n 'browser,node,bun,sqlite-br,sqlite-n,sqlite-bu,pg-br,pg-nb' 'bun run build-browser' 'bun run build-node' 'bun run build-bun' 'bun run build-sqlite-browser' 'bun run build-sqlite-node' 'bun run build-sqlite-bun' 'bun run build-postgres-browser' 'bun run build-postgres-node-bun'",
|
|
15
20
|
"build-clean": "rm -fr dist/* tsconfig.tsbuildinfo",
|
|
16
21
|
"build-browser": "bun build --target=browser --sourcemap=external --packages=external --outdir ./dist ./src/browser.ts",
|
|
17
22
|
"build-node": "bun build --target=node --sourcemap=external --packages=external --outdir ./dist ./src/node.ts",
|
|
18
23
|
"build-bun": "bun build --target=bun --sourcemap=external --packages=external --outdir ./dist ./src/bun.ts",
|
|
24
|
+
"build-sqlite-browser": "bun build --target=browser --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/browser.ts",
|
|
25
|
+
"build-sqlite-node": "bun build --target=node --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/node.ts",
|
|
26
|
+
"build-sqlite-bun": "bun build --target=bun --sourcemap=external --packages=external --outdir ./dist/sqlite ./src/sqlite/bun.ts",
|
|
27
|
+
"build-postgres-browser": "bun build --target=browser --sourcemap=external --packages=external --outdir ./dist/postgres ./src/postgres/browser.ts",
|
|
28
|
+
"build-postgres-node-bun": "bun build --target=node --sourcemap=external --packages=external --outdir ./dist/postgres ./src/postgres/node-bun.ts",
|
|
19
29
|
"build-types": "rm -f tsconfig.tsbuildinfo && tsgo",
|
|
20
30
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
21
31
|
"test": "bun test"
|
|
22
32
|
},
|
|
23
33
|
"peerDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"pg": "^8.20.0",
|
|
34
|
+
"@electric-sql/pglite": "^0.4.1",
|
|
35
|
+
"@sqlite.org/sqlite-wasm": "^3.51.2-build8",
|
|
27
36
|
"@supabase/supabase-js": "^2.100.0",
|
|
28
|
-
"@sqliteai/sqlite-vector": "^0.9.90"
|
|
37
|
+
"@sqliteai/sqlite-vector": "^0.9.90",
|
|
38
|
+
"@workglow/util": "0.0.126",
|
|
39
|
+
"better-sqlite3": "^12.8.0",
|
|
40
|
+
"pg": "^8.20.0"
|
|
29
41
|
},
|
|
30
42
|
"peerDependenciesMeta": {
|
|
31
|
-
"@
|
|
32
|
-
"optional":
|
|
43
|
+
"@electric-sql/pglite": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"@sqlite.org/sqlite-wasm": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@sqliteai/sqlite-vector": {
|
|
50
|
+
"optional": true
|
|
33
51
|
},
|
|
34
52
|
"@workglow/util": {
|
|
35
53
|
"optional": false
|
|
36
54
|
},
|
|
37
|
-
"
|
|
55
|
+
"better-sqlite3": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"pg": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@supabase/supabase-js": {
|
|
38
62
|
"optional": true
|
|
39
63
|
}
|
|
40
64
|
},
|
|
41
65
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"pg": "^8.20.0",
|
|
45
|
-
"@types/pg": "^8.18.0",
|
|
66
|
+
"@electric-sql/pglite": "^0.4.1",
|
|
67
|
+
"@sqlite.org/sqlite-wasm": "^3.51.2-build8",
|
|
46
68
|
"@supabase/supabase-js": "^2.100.0",
|
|
47
|
-
"
|
|
69
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
70
|
+
"@types/pg": "^8.18.0",
|
|
71
|
+
"@workglow/util": "0.0.126",
|
|
72
|
+
"better-sqlite3": "^12.8.0",
|
|
73
|
+
"fake-indexeddb": "^6.2.4",
|
|
74
|
+
"pg": "^8.20.0"
|
|
48
75
|
},
|
|
49
76
|
"exports": {
|
|
50
77
|
".": {
|
|
51
|
-
"react-native":
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
78
|
+
"react-native": {
|
|
79
|
+
"types": "./dist/browser.d.ts",
|
|
80
|
+
"import": "./dist/browser.js"
|
|
81
|
+
},
|
|
82
|
+
"browser": {
|
|
83
|
+
"types": "./dist/browser.d.ts",
|
|
84
|
+
"import": "./dist/browser.js"
|
|
85
|
+
},
|
|
86
|
+
"bun": {
|
|
87
|
+
"types": "./dist/bun.d.ts",
|
|
88
|
+
"import": "./dist/bun.js"
|
|
89
|
+
},
|
|
90
|
+
"types": "./dist/node.d.ts",
|
|
55
91
|
"import": "./dist/node.js"
|
|
92
|
+
},
|
|
93
|
+
"./sqlite": {
|
|
94
|
+
"react-native": {
|
|
95
|
+
"types": "./dist/sqlite/node.d.ts",
|
|
96
|
+
"import": "./dist/sqlite/browser.js"
|
|
97
|
+
},
|
|
98
|
+
"browser": {
|
|
99
|
+
"types": "./dist/sqlite/node.d.ts",
|
|
100
|
+
"import": "./dist/sqlite/browser.js"
|
|
101
|
+
},
|
|
102
|
+
"bun": {
|
|
103
|
+
"types": "./dist/sqlite/node.d.ts",
|
|
104
|
+
"import": "./dist/sqlite/bun.js"
|
|
105
|
+
},
|
|
106
|
+
"types": "./dist/sqlite/node.d.ts",
|
|
107
|
+
"import": "./dist/sqlite/node.js"
|
|
108
|
+
},
|
|
109
|
+
"./postgres": {
|
|
110
|
+
"browser": {
|
|
111
|
+
"types": "./dist/postgres/browser.d.ts",
|
|
112
|
+
"import": "./dist/postgres/browser.js"
|
|
113
|
+
},
|
|
114
|
+
"bun": {
|
|
115
|
+
"types": "./dist/postgres/node-bun.d.ts",
|
|
116
|
+
"import": "./dist/postgres/node-bun.js"
|
|
117
|
+
},
|
|
118
|
+
"types": "./dist/postgres/node-bun.d.ts",
|
|
119
|
+
"import": "./dist/postgres/node-bun.js"
|
|
56
120
|
}
|
|
57
121
|
},
|
|
58
122
|
"files": [
|
package/src/kv/README.md
CHANGED
|
@@ -88,11 +88,12 @@ await pgRepo.put("preferences:456", { lang: "en", fontSize: 16 });
|
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
90
|
import { SqliteKvRepository } from "@workglow/storage/kv";
|
|
91
|
-
import { Sqlite } from "@workglow/sqlite";
|
|
91
|
+
import { Sqlite } from "@workglow/storage/sqlite";
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
await Sqlite.init();
|
|
94
|
+
const db = new Sqlite.Database(":memory:");
|
|
94
95
|
const sqliteRepo = new SqliteKvRepository(
|
|
95
|
-
db, //
|
|
96
|
+
db, // Sqlite.Database instance or pass a file path string after Sqlite.init()
|
|
96
97
|
"cache_data", // Table name
|
|
97
98
|
"string", // Key type
|
|
98
99
|
"string" // Value type (raw strings)
|
package/src/queue/README.md
CHANGED
|
@@ -11,7 +11,7 @@ This is not a job queue implementation. It is a storage implementation for job q
|
|
|
11
11
|
- Multiple storage implementations:
|
|
12
12
|
- `InMemoryQueueStorage` - Volatile memory (dev/testing)
|
|
13
13
|
- `IndexedDbQueueStorage` - Browser-based storage
|
|
14
|
-
- `SqliteQueueStorage` - Embedded SQLite
|
|
14
|
+
- `SqliteQueueStorage` - Embedded SQLite (pass a `Sqlite.Database` from `@workglow/storage/sqlite`; call `await Sqlite.init()` before opening the DB)
|
|
15
15
|
- `PostgresQueueStorage` - Production-grade PostgreSQL
|
|
16
16
|
- Job lifecycle management:
|
|
17
17
|
- PENDING → PROCESSING → COMPLETED/FAILED/ABORTED
|
package/src/tabular/README.md
CHANGED
|
@@ -350,7 +350,14 @@ const repo = new InMemoryTabularStorage<
|
|
|
350
350
|
- Embedded SQLite database
|
|
351
351
|
- File-based or in-memory
|
|
352
352
|
|
|
353
|
+
Call **`await Sqlite.init()`** once (from `@workglow/storage/sqlite` or `workglow`) before opening a database by **path** or constructing **`new Sqlite.Database(...)`**.
|
|
354
|
+
|
|
353
355
|
```typescript
|
|
356
|
+
import { SqliteTabularStorage } from "@workglow/storage";
|
|
357
|
+
import { Sqlite } from "@workglow/storage/sqlite";
|
|
358
|
+
|
|
359
|
+
await Sqlite.init();
|
|
360
|
+
|
|
354
361
|
const repo = new SqliteTabularStorage<
|
|
355
362
|
typeof schema,
|
|
356
363
|
typeof primaryKeys,
|
|
@@ -372,7 +379,7 @@ const repo = new SqliteTabularStorage<
|
|
|
372
379
|
- Connection pooling support
|
|
373
380
|
|
|
374
381
|
```typescript
|
|
375
|
-
import { Pool } from "
|
|
382
|
+
import type { Pool } from "@workglow/storage/postgres";
|
|
376
383
|
|
|
377
384
|
const pool = new Pool({
|
|
378
385
|
/* config */
|