@gravito/flux 3.0.1 → 3.0.2
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 +298 -0
- package/bin/flux.js +25 -1
- package/dev/viewer/app.js +4 -4
- package/dist/bun.cjs +2 -2
- package/dist/bun.cjs.map +1 -1
- package/dist/bun.d.cts +65 -26
- package/dist/bun.d.ts +65 -26
- package/dist/bun.js +1 -1
- package/dist/chunk-4DXCQ6CL.js +3486 -0
- package/dist/chunk-4DXCQ6CL.js.map +1 -0
- package/dist/chunk-6AZNHVEO.cjs +316 -0
- package/dist/chunk-6AZNHVEO.cjs.map +1 -0
- package/dist/{chunk-ZAMVC732.js → chunk-NAIVO7RR.js} +64 -15
- package/dist/chunk-NAIVO7RR.js.map +1 -0
- package/dist/chunk-WAPZDXSX.cjs +3486 -0
- package/dist/chunk-WAPZDXSX.cjs.map +1 -0
- package/dist/chunk-WGDTB6OC.js +316 -0
- package/dist/chunk-WGDTB6OC.js.map +1 -0
- package/dist/{chunk-SJSPR4ZU.cjs → chunk-YXBEYVGY.cjs} +66 -17
- package/dist/chunk-YXBEYVGY.cjs.map +1 -0
- package/dist/cli/flux-visualize.cjs +108 -0
- package/dist/cli/flux-visualize.cjs.map +1 -0
- package/dist/cli/flux-visualize.d.cts +1 -0
- package/dist/cli/flux-visualize.d.ts +1 -0
- package/dist/cli/flux-visualize.js +108 -0
- package/dist/cli/flux-visualize.js.map +1 -0
- package/dist/index.cjs +97 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +369 -13
- package/dist/index.d.ts +369 -13
- package/dist/index.js +96 -8
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +11 -3
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +1110 -247
- package/dist/index.node.d.ts +1110 -247
- package/dist/index.node.js +10 -2
- package/dist/types-CRz5XdLd.d.cts +433 -0
- package/dist/types-CRz5XdLd.d.ts +433 -0
- package/package.json +17 -6
- package/dist/chunk-3JGQYHUN.js +0 -1006
- package/dist/chunk-3JGQYHUN.js.map +0 -1
- package/dist/chunk-5OXXH442.cjs +0 -1006
- package/dist/chunk-5OXXH442.cjs.map +0 -1
- package/dist/chunk-SJSPR4ZU.cjs.map +0 -1
- package/dist/chunk-ZAMVC732.js.map +0 -1
- package/dist/types-CZwYGpou.d.cts +0 -353
- package/dist/types-CZwYGpou.d.ts +0 -353
package/dist/bun.d.ts
CHANGED
|
@@ -1,74 +1,113 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite';
|
|
2
|
-
import {
|
|
2
|
+
import { p as WorkflowStorage, a as WorkflowState, n as WorkflowFilter } from './types-CRz5XdLd.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* High-performance storage using Bun's built-in SQLite.
|
|
8
|
-
*
|
|
9
|
-
* @module @gravito/flux/storage
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* SQLite Storage Options
|
|
5
|
+
* Configuration options for the Bun SQLite storage adapter.
|
|
14
6
|
*/
|
|
15
7
|
interface BunSQLiteStorageOptions {
|
|
16
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Path to the SQLite database file.
|
|
10
|
+
* Use ':memory:' for an ephemeral in-memory database.
|
|
11
|
+
*/
|
|
17
12
|
path?: string;
|
|
18
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Name of the table used to store workflow states.
|
|
15
|
+
*/
|
|
19
16
|
tableName?: string;
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
|
-
* Bun SQLite
|
|
19
|
+
* BunSQLiteStorage provides a persistent storage backend for Flux workflows using Bun's native SQLite module.
|
|
23
20
|
*
|
|
24
|
-
*
|
|
21
|
+
* It handles automatic table creation, indexing for performance, and serialization of workflow state
|
|
22
|
+
* into a relational format.
|
|
25
23
|
*
|
|
26
24
|
* @example
|
|
27
25
|
* ```typescript
|
|
28
|
-
* const
|
|
29
|
-
*
|
|
30
|
-
*
|
|
26
|
+
* const storage = new BunSQLiteStorage({
|
|
27
|
+
* path: './workflows.db',
|
|
28
|
+
* tableName: 'my_workflows'
|
|
29
|
+
* });
|
|
30
|
+
* await storage.init();
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
declare class BunSQLiteStorage implements WorkflowStorage {
|
|
34
34
|
private db;
|
|
35
35
|
private tableName;
|
|
36
36
|
private initialized;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new instance of BunSQLiteStorage.
|
|
39
|
+
*
|
|
40
|
+
* @param options - Configuration for the database connection and table naming.
|
|
41
|
+
*/
|
|
37
42
|
constructor(options?: BunSQLiteStorageOptions);
|
|
38
43
|
/**
|
|
39
|
-
*
|
|
44
|
+
* Initializes the database schema and required indexes.
|
|
45
|
+
*
|
|
46
|
+
* This method is idempotent and will be called automatically by other operations if not invoked manually.
|
|
47
|
+
*
|
|
48
|
+
* @throws {Error} If the database schema cannot be created or indexes fail to initialize.
|
|
40
49
|
*/
|
|
41
50
|
init(): Promise<void>;
|
|
42
51
|
/**
|
|
43
|
-
*
|
|
52
|
+
* Persists or updates a workflow state in the database.
|
|
53
|
+
*
|
|
54
|
+
* Uses an "INSERT OR REPLACE" strategy to ensure the latest state is always stored for a given ID.
|
|
55
|
+
*
|
|
56
|
+
* @param state - The current state of the workflow to be saved.
|
|
57
|
+
* @throws {Error} If the database write operation fails or serialization errors occur.
|
|
44
58
|
*/
|
|
45
59
|
save(state: WorkflowState): Promise<void>;
|
|
46
60
|
/**
|
|
47
|
-
*
|
|
61
|
+
* Retrieves a workflow state by its unique identifier.
|
|
62
|
+
*
|
|
63
|
+
* @param id - The unique ID of the workflow to load.
|
|
64
|
+
* @returns The reconstructed workflow state, or null if no record is found.
|
|
65
|
+
* @throws {Error} If the database query fails or deserialization of stored JSON fails.
|
|
48
66
|
*/
|
|
49
67
|
load(id: string): Promise<WorkflowState | null>;
|
|
50
68
|
/**
|
|
51
|
-
*
|
|
69
|
+
* Lists workflow states based on the provided filtering criteria.
|
|
70
|
+
*
|
|
71
|
+
* Results are returned in descending order of creation time.
|
|
72
|
+
*
|
|
73
|
+
* @param filter - Criteria for filtering and paginating the results.
|
|
74
|
+
* @returns An array of workflow states matching the filter.
|
|
75
|
+
* @throws {Error} If the database query fails.
|
|
52
76
|
*/
|
|
53
77
|
list(filter?: WorkflowFilter): Promise<WorkflowState[]>;
|
|
54
78
|
/**
|
|
55
|
-
*
|
|
79
|
+
* Deletes a workflow state from the database.
|
|
80
|
+
*
|
|
81
|
+
* @param id - The unique ID of the workflow to delete.
|
|
82
|
+
* @throws {Error} If the database deletion fails.
|
|
56
83
|
*/
|
|
57
84
|
delete(id: string): Promise<void>;
|
|
58
85
|
/**
|
|
59
|
-
*
|
|
86
|
+
* Closes the database connection and resets the initialization state.
|
|
87
|
+
*
|
|
88
|
+
* @throws {Error} If the database connection cannot be closed cleanly.
|
|
60
89
|
*/
|
|
61
90
|
close(): Promise<void>;
|
|
62
91
|
/**
|
|
63
|
-
*
|
|
92
|
+
* Converts a raw database row into a structured WorkflowState object.
|
|
93
|
+
*
|
|
94
|
+
* @param row - The raw SQLite row data.
|
|
95
|
+
* @returns The parsed workflow state.
|
|
96
|
+
* @private
|
|
64
97
|
*/
|
|
65
98
|
private rowToState;
|
|
66
99
|
/**
|
|
67
|
-
*
|
|
100
|
+
* Provides direct access to the underlying Bun SQLite Database instance.
|
|
101
|
+
*
|
|
102
|
+
* Useful for performing custom queries or maintenance tasks.
|
|
103
|
+
*
|
|
104
|
+
* @returns The raw Database instance.
|
|
68
105
|
*/
|
|
69
106
|
getDatabase(): Database;
|
|
70
107
|
/**
|
|
71
|
-
*
|
|
108
|
+
* Performs a VACUUM operation to reclaim unused space and defragment the database.
|
|
109
|
+
*
|
|
110
|
+
* @throws {Error} If the VACUUM operation fails.
|
|
72
111
|
*/
|
|
73
112
|
vacuum(): void;
|
|
74
113
|
}
|