@elaraai/e3-core 0.0.2-beta.12 → 0.0.2-beta.13
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/src/dataflow.d.ts +118 -9
- package/dist/src/dataflow.d.ts.map +1 -1
- package/dist/src/dataflow.js +283 -54
- package/dist/src/dataflow.js.map +1 -1
- package/dist/src/errors.d.ts +11 -6
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +10 -3
- package/dist/src/errors.js.map +1 -1
- package/dist/src/execution/index.d.ts +14 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +6 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/interfaces.d.ts +244 -0
- package/dist/src/execution/interfaces.d.ts.map +1 -0
- package/dist/src/execution/interfaces.js +6 -0
- package/dist/src/execution/interfaces.js.map +1 -0
- package/dist/src/executions.d.ts +48 -38
- package/dist/src/executions.d.ts.map +1 -1
- package/dist/src/executions.js +117 -162
- package/dist/src/executions.js.map +1 -1
- package/dist/src/gc.d.ts +9 -2
- package/dist/src/gc.d.ts.map +1 -1
- package/dist/src/gc.js +19 -9
- package/dist/src/gc.js.map +1 -1
- package/dist/src/index.d.ts +8 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +22 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/objects.d.ts +6 -6
- package/dist/src/objects.js +6 -6
- package/dist/src/packages.d.ts +22 -14
- package/dist/src/packages.d.ts.map +1 -1
- package/dist/src/packages.js +45 -79
- package/dist/src/packages.js.map +1 -1
- package/dist/src/repository.d.ts +8 -4
- package/dist/src/repository.d.ts.map +1 -1
- package/dist/src/repository.js +25 -29
- package/dist/src/repository.js.map +1 -1
- package/dist/src/storage/index.d.ts +17 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/storage/index.js +8 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/interfaces.d.ts +299 -0
- package/dist/src/storage/interfaces.d.ts.map +1 -0
- package/dist/src/storage/interfaces.js +6 -0
- package/dist/src/storage/interfaces.js.map +1 -0
- package/dist/src/storage/local/LocalBackend.d.ts +51 -0
- package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
- package/dist/src/storage/local/LocalBackend.js +73 -0
- package/dist/src/storage/local/LocalBackend.js.map +1 -0
- package/dist/src/storage/local/LocalLockService.d.ts +22 -0
- package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLockService.js +38 -0
- package/dist/src/storage/local/LocalLockService.js.map +1 -0
- package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
- package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLogStore.js +66 -0
- package/dist/src/storage/local/LocalLogStore.js.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts +19 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.js +68 -0
- package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
- package/dist/src/storage/local/LocalRefStore.d.ts +35 -0
- package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalRefStore.js +233 -0
- package/dist/src/storage/local/LocalRefStore.js.map +1 -0
- package/dist/src/storage/local/index.d.ts +16 -0
- package/dist/src/storage/local/index.d.ts.map +1 -0
- package/dist/src/storage/local/index.js +16 -0
- package/dist/src/storage/local/index.js.map +1 -0
- package/dist/src/tasks.d.ts +16 -10
- package/dist/src/tasks.d.ts.map +1 -1
- package/dist/src/tasks.js +35 -41
- package/dist/src/tasks.js.map +1 -1
- package/dist/src/test-helpers.d.ts +4 -4
- package/dist/src/test-helpers.d.ts.map +1 -1
- package/dist/src/test-helpers.js +6 -20
- package/dist/src/test-helpers.js.map +1 -1
- package/dist/src/trees.d.ts +41 -29
- package/dist/src/trees.d.ts.map +1 -1
- package/dist/src/trees.js +112 -109
- package/dist/src/trees.js.map +1 -1
- package/dist/src/workspaceLock.d.ts +29 -7
- package/dist/src/workspaceLock.d.ts.map +1 -1
- package/dist/src/workspaceLock.js +130 -40
- package/dist/src/workspaceLock.js.map +1 -1
- package/dist/src/workspaceStatus.d.ts +6 -4
- package/dist/src/workspaceStatus.d.ts.map +1 -1
- package/dist/src/workspaceStatus.js +42 -58
- package/dist/src/workspaceStatus.js.map +1 -1
- package/dist/src/workspaces.d.ts +35 -26
- package/dist/src/workspaces.d.ts.map +1 -1
- package/dist/src/workspaces.js +93 -116
- package/dist/src/workspaces.js.map +1 -1
- package/package.json +3 -3
package/dist/src/dataflow.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { StorageBackend, LockHandle } from './storage/interfaces.js';
|
|
6
6
|
/**
|
|
7
7
|
* Result of executing a single task in the dataflow.
|
|
8
8
|
*/
|
|
@@ -57,7 +57,7 @@ export interface DataflowOptions {
|
|
|
57
57
|
* Use an external lock when you need to hold the lock across multiple
|
|
58
58
|
* operations (e.g., API server that cancels and restarts dataflow on writes).
|
|
59
59
|
*/
|
|
60
|
-
lock?:
|
|
60
|
+
lock?: LockHandle;
|
|
61
61
|
/**
|
|
62
62
|
* AbortSignal for cancellation. When aborted:
|
|
63
63
|
* - No new tasks will be started
|
|
@@ -85,7 +85,8 @@ export interface DataflowOptions {
|
|
|
85
85
|
* to prevent concurrent modifications. If options.lock is provided, uses that
|
|
86
86
|
* lock instead (caller is responsible for releasing it).
|
|
87
87
|
*
|
|
88
|
-
* @param
|
|
88
|
+
* @param storage - Storage backend
|
|
89
|
+
* @param repo - Repository identifier (for local storage, the path to e3 repository directory)
|
|
89
90
|
* @param ws - Workspace name
|
|
90
91
|
* @param options - Execution options
|
|
91
92
|
* @returns Result of the dataflow execution
|
|
@@ -95,14 +96,15 @@ export interface DataflowOptions {
|
|
|
95
96
|
* @throws {TaskNotFoundError} If filter specifies a task that doesn't exist
|
|
96
97
|
* @throws {DataflowError} If execution fails for other reasons
|
|
97
98
|
*/
|
|
98
|
-
export declare function dataflowExecute(
|
|
99
|
+
export declare function dataflowExecute(storage: StorageBackend, repo: string, ws: string, options?: DataflowOptions): Promise<DataflowResult>;
|
|
99
100
|
/**
|
|
100
101
|
* Start dataflow execution in the background (non-blocking).
|
|
101
102
|
*
|
|
102
103
|
* Returns a promise immediately without awaiting execution. The lock is
|
|
103
104
|
* released automatically when execution completes.
|
|
104
105
|
*
|
|
105
|
-
* @param
|
|
106
|
+
* @param storage - Storage backend
|
|
107
|
+
* @param repo - Repository identifier (for local storage, the path to e3 repository directory)
|
|
106
108
|
* @param ws - Workspace name
|
|
107
109
|
* @param options - Execution options (lock must be provided)
|
|
108
110
|
* @returns Promise that resolves when execution completes
|
|
@@ -111,20 +113,21 @@ export declare function dataflowExecute(repoPath: string, ws: string, options?:
|
|
|
111
113
|
* @throws {TaskNotFoundError} If filter specifies a task that doesn't exist
|
|
112
114
|
* @throws {DataflowError} If execution fails for other reasons
|
|
113
115
|
*/
|
|
114
|
-
export declare function dataflowStart(
|
|
115
|
-
lock:
|
|
116
|
+
export declare function dataflowStart(storage: StorageBackend, repo: string, ws: string, options: DataflowOptions & {
|
|
117
|
+
lock: LockHandle;
|
|
116
118
|
}): Promise<DataflowResult>;
|
|
117
119
|
/**
|
|
118
120
|
* Get the dependency graph for a workspace (for visualization/debugging).
|
|
119
121
|
*
|
|
120
|
-
* @param
|
|
122
|
+
* @param storage - Storage backend
|
|
123
|
+
* @param repo - Repository identifier (for local storage, the path to e3 repository directory)
|
|
121
124
|
* @param ws - Workspace name
|
|
122
125
|
* @returns Graph information
|
|
123
126
|
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
124
127
|
* @throws {WorkspaceNotDeployedError} If workspace has no package deployed
|
|
125
128
|
* @throws {DataflowError} If graph building fails for other reasons
|
|
126
129
|
*/
|
|
127
|
-
export declare function dataflowGetGraph(
|
|
130
|
+
export declare function dataflowGetGraph(storage: StorageBackend, repo: string, ws: string): Promise<{
|
|
128
131
|
tasks: Array<{
|
|
129
132
|
name: string;
|
|
130
133
|
hash: string;
|
|
@@ -133,4 +136,110 @@ export declare function dataflowGetGraph(repoPath: string, ws: string): Promise<
|
|
|
133
136
|
dependsOn: string[];
|
|
134
137
|
}>;
|
|
135
138
|
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Graph structure returned by dataflowGetGraph.
|
|
141
|
+
*/
|
|
142
|
+
export interface DataflowGraph {
|
|
143
|
+
tasks: Array<{
|
|
144
|
+
name: string;
|
|
145
|
+
hash: string;
|
|
146
|
+
inputs: string[];
|
|
147
|
+
output: string;
|
|
148
|
+
dependsOn: string[];
|
|
149
|
+
}>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get tasks that are ready to execute given the set of completed tasks.
|
|
153
|
+
*
|
|
154
|
+
* A task is ready when all tasks it depends on have completed.
|
|
155
|
+
* This is useful for distributed execution (e.g., AWS Step Functions)
|
|
156
|
+
* where a coordinator needs to determine which tasks can run next.
|
|
157
|
+
*
|
|
158
|
+
* @param graph - The dependency graph from dataflowGetGraph
|
|
159
|
+
* @param completedTasks - Set of task names that have completed
|
|
160
|
+
* @returns Array of task names that are ready to execute
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const graph = await dataflowGetGraph(storage, repo, 'production');
|
|
165
|
+
* const ready = dataflowGetReadyTasks(graph, new Set()); // Initial ready tasks
|
|
166
|
+
* // Execute ready[0]...
|
|
167
|
+
* const nextReady = dataflowGetReadyTasks(graph, new Set([ready[0]]));
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare function dataflowGetReadyTasks(graph: DataflowGraph, completedTasks: Set<string>): string[];
|
|
171
|
+
/**
|
|
172
|
+
* Check if a task execution is cached for the given inputs.
|
|
173
|
+
*
|
|
174
|
+
* This is useful for distributed execution where a Lambda handler needs
|
|
175
|
+
* to check if a task can be skipped before spawning execution.
|
|
176
|
+
*
|
|
177
|
+
* @param storage - Storage backend
|
|
178
|
+
* @param repo - Repository path
|
|
179
|
+
* @param taskHash - Hash of the TaskObject
|
|
180
|
+
* @param inputHashes - Array of input dataset hashes (in order)
|
|
181
|
+
* @returns Output hash if cached, null if execution needed
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const outputHash = await dataflowCheckCache(storage, repo, taskHash, inputHashes);
|
|
186
|
+
* if (outputHash) {
|
|
187
|
+
* // Task is cached, use outputHash directly
|
|
188
|
+
* } else {
|
|
189
|
+
* // Need to execute task
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
export declare function dataflowCheckCache(storage: StorageBackend, repo: string, taskHash: string, inputHashes: string[]): Promise<string | null>;
|
|
194
|
+
/**
|
|
195
|
+
* Find tasks that should be skipped when a task fails.
|
|
196
|
+
*
|
|
197
|
+
* Returns all tasks that transitively depend on the failed task
|
|
198
|
+
* (directly or through other tasks), excluding already completed
|
|
199
|
+
* or already skipped tasks.
|
|
200
|
+
*
|
|
201
|
+
* This is useful for distributed execution where the coordinator
|
|
202
|
+
* needs to mark downstream tasks as skipped after a failure.
|
|
203
|
+
*
|
|
204
|
+
* @param graph - The dependency graph from dataflowGetGraph
|
|
205
|
+
* @param failedTask - Name of the task that failed
|
|
206
|
+
* @param completedTasks - Set of task names already completed (won't be skipped)
|
|
207
|
+
* @param skippedTasks - Set of task names already skipped (won't be returned again)
|
|
208
|
+
* @returns Array of task names that should be skipped
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const graph = await dataflowGetGraph(storage, repo, 'production');
|
|
213
|
+
* // Task 'etl' failed...
|
|
214
|
+
* const toSkip = dataflowGetDependentsToSkip(graph, 'etl', completed, skipped);
|
|
215
|
+
* // toSkip might be ['transform', 'aggregate', 'report'] - all downstream tasks
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare function dataflowGetDependentsToSkip(graph: DataflowGraph, failedTask: string, completedTasks: Set<string>, skippedTasks: Set<string>): string[];
|
|
219
|
+
/**
|
|
220
|
+
* Resolve input hashes for a task from current workspace state.
|
|
221
|
+
*
|
|
222
|
+
* Returns an array of hashes in the same order as the task's inputs.
|
|
223
|
+
* If any input is unassigned, returns null for that position.
|
|
224
|
+
*
|
|
225
|
+
* This is useful for distributed execution where the input hashes
|
|
226
|
+
* need to be resolved before checking cache or executing.
|
|
227
|
+
*
|
|
228
|
+
* @param storage - Storage backend
|
|
229
|
+
* @param repo - Repository path
|
|
230
|
+
* @param ws - Workspace name
|
|
231
|
+
* @param task - Task info from the graph (needs inputs array)
|
|
232
|
+
* @returns Array of hashes (null if input is unassigned)
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const graph = await dataflowGetGraph(storage, repo, 'production');
|
|
237
|
+
* const task = graph.tasks.find(t => t.name === 'etl')!;
|
|
238
|
+
* const inputHashes = await dataflowResolveInputHashes(storage, repo, 'production', task);
|
|
239
|
+
* if (!inputHashes.includes(null)) {
|
|
240
|
+
* const cached = await dataflowCheckCache(storage, repo, task.hash, inputHashes);
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export declare function dataflowResolveInputHashes(storage: StorageBackend, repo: string, ws: string, task: DataflowGraph['tasks'][0]): Promise<Array<string | null>>;
|
|
136
245
|
//# sourceMappingURL=dataflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../src/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../src/dataflow.ts"],"names":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