@workglow/storage 0.2.28 → 0.2.30
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 +13 -41
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @workglow/storage
|
|
2
2
|
|
|
3
|
-
Modular storage solutions for Workglow.AI platform with multiple backend implementations. Provides consistent interfaces for key-value
|
|
3
|
+
Modular storage solutions for Workglow.AI platform with multiple backend implementations. Provides consistent interfaces for key-value, tabular, and vector data storage. Job queue persistence lives in `@workglow/job-queue` and the vendor `./job-queue` packages.
|
|
4
4
|
|
|
5
5
|
- [Quick Start](#quick-start)
|
|
6
6
|
- [Installation](#installation)
|
|
@@ -20,9 +20,6 @@ Modular storage solutions for Workglow.AI platform with multiple backend impleme
|
|
|
20
20
|
- [Bulk Operations](#bulk-operations-1)
|
|
21
21
|
- [Searching and Filtering](#searching-and-filtering)
|
|
22
22
|
- [Environment-Specific Tabular Storage](#environment-specific-tabular-storage)
|
|
23
|
-
- [Queue Storage](#queue-storage)
|
|
24
|
-
- [Basic Job Queue Operations](#basic-job-queue-operations)
|
|
25
|
-
- [Job Management](#job-management)
|
|
26
23
|
- [Environment-Specific Usage](#environment-specific-usage)
|
|
27
24
|
- [Browser Environment](#browser-environment)
|
|
28
25
|
- [Node.js Environment](#nodejs-environment)
|
|
@@ -35,7 +32,6 @@ Modular storage solutions for Workglow.AI platform with multiple backend impleme
|
|
|
35
32
|
- [API Reference](#api-reference)
|
|
36
33
|
- [IKvStorage\<Key, Value\>](#ikvrepositorykey-value)
|
|
37
34
|
- [ITabularStorage\<Schema, PrimaryKeyNames\>](#itabularrepositoryschema-primarykeynames)
|
|
38
|
-
- [IQueueStorage\<Input, Output\>](#iqueuestorageinput-output)
|
|
39
35
|
- [Examples](#examples)
|
|
40
36
|
- [User Management System](#user-management-system)
|
|
41
37
|
- [Configuration Management](#configuration-management)
|
|
@@ -455,14 +451,16 @@ const fileUsers = new FsFolderTabularStorage<typeof UserSchema, ["id"]>(
|
|
|
455
451
|
|
|
456
452
|
### Queue Storage
|
|
457
453
|
|
|
458
|
-
Persistent job queue storage for background processing and task management
|
|
459
|
-
|
|
460
|
-
|
|
454
|
+
Persistent job queue storage for background processing and task management lives in
|
|
455
|
+
`@workglow/job-queue`. In-memory queue storage is exported from `@workglow/job-queue`;
|
|
456
|
+
backend-specific queue storage is exported from vendor packages such as
|
|
457
|
+
`@workglow/sqlite/job-queue`, `@workglow/postgres/job-queue`, `@workglow/indexeddb/job-queue`,
|
|
458
|
+
and `@workglow/supabase/job-queue`.
|
|
461
459
|
|
|
462
460
|
#### Basic Job Queue Operations
|
|
463
461
|
|
|
464
462
|
```typescript
|
|
465
|
-
import { InMemoryQueueStorage, JobStatus } from "@workglow/
|
|
463
|
+
import { InMemoryQueueStorage, JobStatus } from "@workglow/job-queue";
|
|
466
464
|
|
|
467
465
|
// Define job input/output types
|
|
468
466
|
type ProcessingInput = { text: string; options: any };
|
|
@@ -520,11 +518,11 @@ await jobQueue.deleteJobsByStatusAndAge(JobStatus.COMPLETED, 24 * 60 * 60 * 1000
|
|
|
520
518
|
import {
|
|
521
519
|
IndexedDbKvRepository,
|
|
522
520
|
IndexedDbTabularStorage,
|
|
523
|
-
IndexedDbQueueStorage,
|
|
524
521
|
SupabaseKvRepository,
|
|
525
522
|
SupabaseTabularStorage,
|
|
526
|
-
SupabaseQueueStorage,
|
|
527
523
|
} from "@workglow/storage";
|
|
524
|
+
import { IndexedDbQueueStorage } from "@workglow/indexeddb/job-queue";
|
|
525
|
+
import { SupabaseQueueStorage } from "@workglow/supabase/job-queue";
|
|
528
526
|
import { createClient } from "@supabase/supabase-js";
|
|
529
527
|
|
|
530
528
|
// Local browser storage with IndexedDB
|
|
@@ -560,10 +558,10 @@ const users = new PostgresTabularStorage(pool, "users", UserSchema, ["id"]);
|
|
|
560
558
|
import {
|
|
561
559
|
SqliteTabularStorage,
|
|
562
560
|
FsFolderJsonKvRepository,
|
|
563
|
-
PostgresQueueStorage,
|
|
564
561
|
SupabaseTabularStorage,
|
|
565
562
|
} from "@workglow/storage";
|
|
566
|
-
import {
|
|
563
|
+
import { PostgresQueueStorage } from "@workglow/postgres/job-queue";
|
|
564
|
+
import { Sqlite } from "@workglow/sqlite/storage";
|
|
567
565
|
import { createClient } from "@supabase/supabase-js";
|
|
568
566
|
|
|
569
567
|
await Sqlite.init();
|
|
@@ -648,7 +646,6 @@ const tabularSchema = TypeTabularStorage({
|
|
|
648
646
|
title: "Data Source",
|
|
649
647
|
description: "Tabular data repository",
|
|
650
648
|
});
|
|
651
|
-
|
|
652
649
|
```
|
|
653
650
|
|
|
654
651
|
### Event-Driven Architecture
|
|
@@ -807,28 +804,6 @@ await repo.deleteSearch({
|
|
|
807
804
|
});
|
|
808
805
|
```
|
|
809
806
|
|
|
810
|
-
### IQueueStorage<Input, Output>
|
|
811
|
-
|
|
812
|
-
Core interface for job queue storage:
|
|
813
|
-
|
|
814
|
-
```typescript
|
|
815
|
-
interface IQueueStorage<Input, Output> {
|
|
816
|
-
add(job: JobStorageFormat<Input, Output>): Promise<unknown>;
|
|
817
|
-
get(id: unknown): Promise<JobStorageFormat<Input, Output> | undefined>;
|
|
818
|
-
next(): Promise<JobStorageFormat<Input, Output> | undefined>;
|
|
819
|
-
complete(job: JobStorageFormat<Input, Output>): Promise<void>;
|
|
820
|
-
peek(status?: JobStatus, num?: number): Promise<JobStorageFormat<Input, Output>[]>;
|
|
821
|
-
size(status?: JobStatus): Promise<number>;
|
|
822
|
-
abort(id: unknown): Promise<void>;
|
|
823
|
-
saveProgress(id: unknown, progress: number, message: string, details: any): Promise<void>;
|
|
824
|
-
deleteAll(): Promise<void>;
|
|
825
|
-
getByRunId(runId: string): Promise<Array<JobStorageFormat<Input, Output>>>;
|
|
826
|
-
outputForInput(input: Input): Promise<Output | null>;
|
|
827
|
-
delete(id: unknown): Promise<void>;
|
|
828
|
-
deleteJobsByStatusAndAge(status: JobStatus, olderThanMs: number): Promise<void>;
|
|
829
|
-
}
|
|
830
|
-
```
|
|
831
|
-
|
|
832
807
|
## Examples
|
|
833
808
|
|
|
834
809
|
### User Management System
|
|
@@ -970,11 +945,8 @@ class ConfigManager {
|
|
|
970
945
|
```typescript
|
|
971
946
|
import { createClient } from "@supabase/supabase-js";
|
|
972
947
|
import { JsonSchema } from "@workglow/util";
|
|
973
|
-
import {
|
|
974
|
-
|
|
975
|
-
SupabaseKvRepository,
|
|
976
|
-
SupabaseQueueStorage,
|
|
977
|
-
} from "@workglow/storage";
|
|
948
|
+
import { SupabaseTabularStorage, SupabaseKvRepository } from "@workglow/storage";
|
|
949
|
+
import { SupabaseQueueStorage } from "@workglow/supabase/job-queue";
|
|
978
950
|
|
|
979
951
|
// Initialize Supabase client
|
|
980
952
|
const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.30",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/workglow-dev/workglow.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "bun test"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@workglow/util": "0.2.
|
|
29
|
+
"@workglow/util": "0.2.30"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
32
32
|
"@workglow/util": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@workglow/util": "0.2.
|
|
37
|
+
"@workglow/util": "0.2.30"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|