@workglow/storage 0.0.125 → 0.1.0
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/browser.js +58 -23
- package/dist/browser.js.map +13 -13
- package/dist/{types.d.ts → bun.d.ts} +1 -1
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +106 -45
- package/dist/bun.js.map +22 -22
- package/dist/node.d.ts +7 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +106 -45
- package/dist/node.js.map +22 -22
- 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/InMemoryQueueStorage.d.ts.map +1 -1
- package/dist/queue/IndexedDbQueueStorage.d.ts.map +1 -1
- 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/SupabaseQueueStorage.d.ts +11 -0
- package/dist/queue/SupabaseQueueStorage.d.ts.map +1 -1
- package/dist/queue-limiter/IndexedDbRateLimiterStorage.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/CachedTabularStorage.d.ts +1 -0
- package/dist/tabular/CachedTabularStorage.d.ts.map +1 -1
- package/dist/tabular/FsFolderTabularStorage.d.ts.map +1 -1
- package/dist/tabular/InMemoryTabularStorage.d.ts +2 -0
- package/dist/tabular/InMemoryTabularStorage.d.ts.map +1 -1
- package/dist/tabular/PostgresTabularStorage.d.ts +1 -1
- package/dist/tabular/PostgresTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SharedInMemoryTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts.map +1 -1
- package/dist/tabular/TelemetryTabularStorage.d.ts.map +1 -1
- package/dist/util/HybridSubscriptionManager.d.ts.map +1 -1
- package/dist/util/PollingSubscriptionManager.d.ts +2 -0
- package/dist/util/PollingSubscriptionManager.d.ts.map +1 -1
- package/dist/vector/PostgresVectorStorage.d.ts +1 -13
- 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 +85 -21
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PollingSubscriptionManager.d.ts","sourceRoot":"","sources":["../../src/util/PollingSubscriptionManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,IAAI,EAAE,aAAa;IACvD,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,aAAa,CAAC;IAC/C,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,KAAK,aAAa,CAAC;IACjE,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,aAAa,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAUD;;;;;;;;;;;GAWG;AACH,qBAAa,0BAA0B,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa;IAC9D,8DAA8D;IAC9D,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,OAAO,CAAC,EAAE,qBAAqB,EAMhC;IAED;;;;;;OAMG;IACH,SAAS,CACP,QAAQ,EAAE,cAAc,CAAC,aAAa,CAAC,EACvC,OAAO,CAAC,EAAE,0BAA0B,GACnC,MAAM,IAAI,CA4CZ;YAKa,WAAW;IAmBzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;YAed,IAAI;IA4ClB;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAM9B;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED;;OAEG;IACH,OAAO,IAAI,IAAI,CAQd;CACF"}
|
|
@@ -4,21 +4,9 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* PostgreSQL vector repository implementation using pgvector extension.
|
|
12
|
-
* Extends PostgresTabularStorage for storage.
|
|
13
|
-
* Provides efficient vector similarity search with native database support.
|
|
14
|
-
*
|
|
15
|
-
* Requirements:
|
|
16
|
-
* - PostgreSQL database with pgvector extension installed
|
|
17
|
-
* - CREATE EXTENSION vector;
|
|
18
|
-
*
|
|
19
|
-
* @template Metadata - The metadata type
|
|
20
|
-
* @template Vector - The vector type
|
|
21
|
-
*/
|
|
22
10
|
export declare class PostgresVectorStorage<Schema extends DataPortSchemaObject, PrimaryKeyNames extends ReadonlyArray<keyof Schema["properties"]>, Metadata extends Record<string, unknown> = Record<string, unknown>, Vector extends TypedArray = Float32Array, Entity = FromSchema<Schema, TypedArraySchemaOptions>> extends PostgresTabularStorage<Schema, PrimaryKeyNames, Entity> implements IVectorStorage<Metadata, Schema, Entity, PrimaryKeyNames> {
|
|
23
11
|
private vectorDimensions;
|
|
24
12
|
private VectorType;
|
|
@@ -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,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PostgresVectorStorage.d.ts","sourceRoot":"","sources":["../../src/vector/PostgresVectorStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAoB1B,qBAAa,qBAAqB,CAChC,MAAM,SAAS,oBAAoB,EACnC,eAAe,SAAS,aAAa,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EACjE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,MAAM,SAAS,UAAU,GAAG,YAAY,EACxC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAEpD,SAAQ,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAC9D,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;;;;;;;;;OASG;IACH,YACE,EAAE,EAAE,IAAI,EACR,KAAK,EAAE,MAAM,EACb,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;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,CAwE5C;IAEK,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC;;UAoF3E;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;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAuD1B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAqB,CAChC,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;IACvD,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,eAAe,CAAkB;IAEzC;;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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.1.0",
|
|
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
|
-
"
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
34
|
+
"@electric-sql/pglite": "^0.4.2",
|
|
35
|
+
"@sqlite.org/sqlite-wasm": "^3.51.2-build8",
|
|
36
|
+
"@supabase/supabase-js": "^2.101.1",
|
|
37
|
+
"@sqliteai/sqlite-vector": "^0.9.90",
|
|
38
|
+
"@workglow/util": "0.1.0",
|
|
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
|
-
"
|
|
66
|
+
"@electric-sql/pglite": "^0.4.2",
|
|
67
|
+
"@sqlite.org/sqlite-wasm": "^3.51.2-build8",
|
|
68
|
+
"@supabase/supabase-js": "^2.101.1",
|
|
69
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
45
70
|
"@types/pg": "^8.18.0",
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
71
|
+
"@workglow/util": "0.1.0",
|
|
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 */
|
package/src/vector/README.md
CHANGED
|
@@ -150,7 +150,7 @@ await repo.putMany([
|
|
|
150
150
|
### PostgreSQL with pgvector
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
|
-
import { Pool } from "
|
|
153
|
+
import type { Pool } from "@workglow/storage/postgres";
|
|
154
154
|
import { PostgresVectorStorage } from "@workglow/storage";
|
|
155
155
|
import { TypedArraySchema } from "@workglow/util";
|
|
156
156
|
|
|
@@ -293,7 +293,10 @@ Register and retrieve chunk vector repositories globally:
|
|
|
293
293
|
|
|
294
294
|
```typescript
|
|
295
295
|
import { getChunkVectorRepository, getGlobalChunkVectorRepositories } from "@workglow/storage";
|
|
296
|
-
import {
|
|
296
|
+
import {
|
|
297
|
+
registerChunkVectorRepository,
|
|
298
|
+
getGlobalChunkVectorRepositories,
|
|
299
|
+
} from "@workglow/knowledge-base";
|
|
297
300
|
|
|
298
301
|
// Register a repository
|
|
299
302
|
registerChunkVectorRepository("my-chunks", repo);
|
|
@@ -350,10 +353,7 @@ The chunk vector repository works alongside `KnowledgeBase` for hierarchical doc
|
|
|
350
353
|
|
|
351
354
|
```typescript
|
|
352
355
|
import { KnowledgeBase, DocumentStorageSchema } from "@workglow/knowledge-base";
|
|
353
|
-
import {
|
|
354
|
-
InMemoryChunkVectorStorage,
|
|
355
|
-
InMemoryTabularStorage,
|
|
356
|
-
} from "@workglow/storage";
|
|
356
|
+
import { InMemoryChunkVectorStorage, InMemoryTabularStorage } from "@workglow/storage";
|
|
357
357
|
|
|
358
358
|
// Initialize storage backends
|
|
359
359
|
const tabularStorage = new InMemoryTabularStorage(DocumentStorageSchema, ["doc_id"]);
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC"}
|