@elaraai/e3-core 0.0.2-beta.4 → 0.0.2-beta.40

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.
Files changed (208) hide show
  1. package/README.md +25 -22
  2. package/dist/src/dataflow/api-compat.d.ts +90 -0
  3. package/dist/src/dataflow/api-compat.d.ts.map +1 -0
  4. package/dist/src/dataflow/api-compat.js +139 -0
  5. package/dist/src/dataflow/api-compat.js.map +1 -0
  6. package/dist/src/dataflow/index.d.ts +18 -0
  7. package/dist/src/dataflow/index.d.ts.map +1 -0
  8. package/dist/src/dataflow/index.js +23 -0
  9. package/dist/src/dataflow/index.js.map +1 -0
  10. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +76 -0
  11. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
  12. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +695 -0
  13. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
  14. package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
  15. package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
  16. package/dist/src/dataflow/orchestrator/index.js +12 -0
  17. package/dist/src/dataflow/orchestrator/index.js.map +1 -0
  18. package/dist/src/dataflow/orchestrator/interfaces.d.ts +163 -0
  19. package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
  20. package/dist/src/dataflow/orchestrator/interfaces.js +52 -0
  21. package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
  22. package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
  23. package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
  24. package/dist/src/dataflow/state-store/FileStateStore.js +300 -0
  25. package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
  26. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
  27. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
  28. package/dist/src/dataflow/state-store/InMemoryStateStore.js +229 -0
  29. package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
  30. package/dist/src/dataflow/state-store/index.d.ts +13 -0
  31. package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
  32. package/dist/src/dataflow/state-store/index.js +13 -0
  33. package/dist/src/dataflow/state-store/index.js.map +1 -0
  34. package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
  35. package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
  36. package/dist/src/dataflow/state-store/interfaces.js +6 -0
  37. package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
  38. package/dist/src/dataflow/steps.d.ts +222 -0
  39. package/dist/src/dataflow/steps.d.ts.map +1 -0
  40. package/dist/src/dataflow/steps.js +707 -0
  41. package/dist/src/dataflow/steps.js.map +1 -0
  42. package/dist/src/dataflow/types.d.ts +127 -0
  43. package/dist/src/dataflow/types.d.ts.map +1 -0
  44. package/dist/src/dataflow/types.js +7 -0
  45. package/dist/src/dataflow/types.js.map +1 -0
  46. package/dist/src/dataflow.d.ts +113 -38
  47. package/dist/src/dataflow.d.ts.map +1 -1
  48. package/dist/src/dataflow.js +269 -416
  49. package/dist/src/dataflow.js.map +1 -1
  50. package/dist/src/dataset-refs.d.ts +124 -0
  51. package/dist/src/dataset-refs.d.ts.map +1 -0
  52. package/dist/src/dataset-refs.js +319 -0
  53. package/dist/src/dataset-refs.js.map +1 -0
  54. package/dist/src/errors.d.ts +39 -9
  55. package/dist/src/errors.d.ts.map +1 -1
  56. package/dist/src/errors.js +51 -8
  57. package/dist/src/errors.js.map +1 -1
  58. package/dist/src/execution/LocalTaskRunner.d.ts +73 -0
  59. package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
  60. package/dist/src/execution/LocalTaskRunner.js +399 -0
  61. package/dist/src/execution/LocalTaskRunner.js.map +1 -0
  62. package/dist/src/execution/MockTaskRunner.d.ts +49 -0
  63. package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
  64. package/dist/src/execution/MockTaskRunner.js +54 -0
  65. package/dist/src/execution/MockTaskRunner.js.map +1 -0
  66. package/dist/src/execution/index.d.ts +16 -0
  67. package/dist/src/execution/index.d.ts.map +1 -0
  68. package/dist/src/execution/index.js +8 -0
  69. package/dist/src/execution/index.js.map +1 -0
  70. package/dist/src/execution/interfaces.d.ts +246 -0
  71. package/dist/src/execution/interfaces.d.ts.map +1 -0
  72. package/dist/src/execution/interfaces.js +6 -0
  73. package/dist/src/execution/interfaces.js.map +1 -0
  74. package/dist/src/execution/processHelpers.d.ts +20 -0
  75. package/dist/src/execution/processHelpers.d.ts.map +1 -0
  76. package/dist/src/execution/processHelpers.js +62 -0
  77. package/dist/src/execution/processHelpers.js.map +1 -0
  78. package/dist/src/executions.d.ts +71 -104
  79. package/dist/src/executions.d.ts.map +1 -1
  80. package/dist/src/executions.js +110 -476
  81. package/dist/src/executions.js.map +1 -1
  82. package/dist/src/index.d.ts +19 -9
  83. package/dist/src/index.d.ts.map +1 -1
  84. package/dist/src/index.js +48 -18
  85. package/dist/src/index.js.map +1 -1
  86. package/dist/src/objects.d.ts +8 -51
  87. package/dist/src/objects.d.ts.map +1 -1
  88. package/dist/src/objects.js +13 -230
  89. package/dist/src/objects.js.map +1 -1
  90. package/dist/src/packages.d.ts +22 -14
  91. package/dist/src/packages.d.ts.map +1 -1
  92. package/dist/src/packages.js +134 -88
  93. package/dist/src/packages.js.map +1 -1
  94. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts +35 -0
  95. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts.map +1 -0
  96. package/dist/src/storage/in-memory/InMemoryRepoStore.js +107 -0
  97. package/dist/src/storage/in-memory/InMemoryRepoStore.js.map +1 -0
  98. package/dist/src/storage/in-memory/InMemoryStorage.d.ts +139 -0
  99. package/dist/src/storage/in-memory/InMemoryStorage.d.ts.map +1 -0
  100. package/dist/src/storage/in-memory/InMemoryStorage.js +439 -0
  101. package/dist/src/storage/in-memory/InMemoryStorage.js.map +1 -0
  102. package/dist/src/storage/in-memory/index.d.ts +12 -0
  103. package/dist/src/storage/in-memory/index.d.ts.map +1 -0
  104. package/dist/src/storage/in-memory/index.js +12 -0
  105. package/dist/src/storage/in-memory/index.js.map +1 -0
  106. package/dist/src/storage/index.d.ts +18 -0
  107. package/dist/src/storage/index.d.ts.map +1 -0
  108. package/dist/src/storage/index.js +10 -0
  109. package/dist/src/storage/index.js.map +1 -0
  110. package/dist/src/storage/interfaces.d.ts +581 -0
  111. package/dist/src/storage/interfaces.d.ts.map +1 -0
  112. package/dist/src/storage/interfaces.js +6 -0
  113. package/dist/src/storage/interfaces.js.map +1 -0
  114. package/dist/src/storage/local/LocalBackend.d.ts +56 -0
  115. package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
  116. package/dist/src/storage/local/LocalBackend.js +145 -0
  117. package/dist/src/storage/local/LocalBackend.js.map +1 -0
  118. package/dist/src/storage/local/LocalDatasetRefStore.d.ts +22 -0
  119. package/dist/src/storage/local/LocalDatasetRefStore.d.ts.map +1 -0
  120. package/dist/src/storage/local/LocalDatasetRefStore.js +118 -0
  121. package/dist/src/storage/local/LocalDatasetRefStore.js.map +1 -0
  122. package/dist/src/storage/local/LocalLockService.d.ts +111 -0
  123. package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
  124. package/dist/src/storage/local/LocalLockService.js +355 -0
  125. package/dist/src/storage/local/LocalLockService.js.map +1 -0
  126. package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
  127. package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
  128. package/dist/src/storage/local/LocalLogStore.js +66 -0
  129. package/dist/src/storage/local/LocalLogStore.js.map +1 -0
  130. package/dist/src/storage/local/LocalObjectStore.d.ts +55 -0
  131. package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
  132. package/dist/src/storage/local/LocalObjectStore.js +300 -0
  133. package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
  134. package/dist/src/storage/local/LocalRefStore.d.ts +50 -0
  135. package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
  136. package/dist/src/storage/local/LocalRefStore.js +337 -0
  137. package/dist/src/storage/local/LocalRefStore.js.map +1 -0
  138. package/dist/src/storage/local/LocalRepoStore.d.ts +55 -0
  139. package/dist/src/storage/local/LocalRepoStore.d.ts.map +1 -0
  140. package/dist/src/storage/local/LocalRepoStore.js +365 -0
  141. package/dist/src/storage/local/LocalRepoStore.js.map +1 -0
  142. package/dist/src/storage/local/gc.d.ts +92 -0
  143. package/dist/src/storage/local/gc.d.ts.map +1 -0
  144. package/dist/src/storage/local/gc.js +377 -0
  145. package/dist/src/storage/local/gc.js.map +1 -0
  146. package/dist/src/storage/local/index.d.ts +18 -0
  147. package/dist/src/storage/local/index.d.ts.map +1 -0
  148. package/dist/src/storage/local/index.js +18 -0
  149. package/dist/src/storage/local/index.js.map +1 -0
  150. package/dist/src/storage/local/localHelpers.d.ts +25 -0
  151. package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
  152. package/dist/src/storage/local/localHelpers.js +69 -0
  153. package/dist/src/storage/local/localHelpers.js.map +1 -0
  154. package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +8 -4
  155. package/dist/src/storage/local/repository.d.ts.map +1 -0
  156. package/dist/src/{repository.js → storage/local/repository.js} +31 -29
  157. package/dist/src/storage/local/repository.js.map +1 -0
  158. package/dist/src/tasks.d.ts +16 -10
  159. package/dist/src/tasks.d.ts.map +1 -1
  160. package/dist/src/tasks.js +35 -41
  161. package/dist/src/tasks.js.map +1 -1
  162. package/dist/src/test-helpers.d.ts +5 -4
  163. package/dist/src/test-helpers.d.ts.map +1 -1
  164. package/dist/src/test-helpers.js +9 -21
  165. package/dist/src/test-helpers.js.map +1 -1
  166. package/dist/src/transfer/InMemoryTransferBackend.d.ts +66 -0
  167. package/dist/src/transfer/InMemoryTransferBackend.d.ts.map +1 -0
  168. package/dist/src/transfer/InMemoryTransferBackend.js +166 -0
  169. package/dist/src/transfer/InMemoryTransferBackend.js.map +1 -0
  170. package/dist/src/transfer/index.d.ts +8 -0
  171. package/dist/src/transfer/index.d.ts.map +1 -0
  172. package/dist/src/transfer/index.js +9 -0
  173. package/dist/src/transfer/index.js.map +1 -0
  174. package/dist/src/transfer/interfaces.d.ts +103 -0
  175. package/dist/src/transfer/interfaces.d.ts.map +1 -0
  176. package/dist/src/transfer/interfaces.js +6 -0
  177. package/dist/src/transfer/interfaces.js.map +1 -0
  178. package/dist/src/transfer/types.d.ts +79 -0
  179. package/dist/src/transfer/types.d.ts.map +1 -0
  180. package/dist/src/transfer/types.js +58 -0
  181. package/dist/src/transfer/types.js.map +1 -0
  182. package/dist/src/trees.d.ts +147 -59
  183. package/dist/src/trees.d.ts.map +1 -1
  184. package/dist/src/trees.js +372 -419
  185. package/dist/src/trees.js.map +1 -1
  186. package/dist/src/uuid.d.ts +26 -0
  187. package/dist/src/uuid.d.ts.map +1 -0
  188. package/dist/src/uuid.js +80 -0
  189. package/dist/src/uuid.js.map +1 -0
  190. package/dist/src/workspaceStatus.d.ts +6 -4
  191. package/dist/src/workspaceStatus.d.ts.map +1 -1
  192. package/dist/src/workspaceStatus.js +43 -49
  193. package/dist/src/workspaceStatus.js.map +1 -1
  194. package/dist/src/workspaces.d.ts +35 -47
  195. package/dist/src/workspaces.d.ts.map +1 -1
  196. package/dist/src/workspaces.js +194 -156
  197. package/dist/src/workspaces.js.map +1 -1
  198. package/package.json +4 -4
  199. package/dist/src/gc.d.ts +0 -54
  200. package/dist/src/gc.d.ts.map +0 -1
  201. package/dist/src/gc.js +0 -233
  202. package/dist/src/gc.js.map +0 -1
  203. package/dist/src/repository.d.ts.map +0 -1
  204. package/dist/src/repository.js.map +0 -1
  205. package/dist/src/workspaceLock.d.ts +0 -67
  206. package/dist/src/workspaceLock.d.ts.map +0 -1
  207. package/dist/src/workspaceLock.js +0 -217
  208. package/dist/src/workspaceLock.js.map +0 -1
@@ -0,0 +1,581 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Storage abstraction interfaces for e3 repositories.
7
+ *
8
+ * These interfaces enable e3-core logic to work against different backends:
9
+ * - LocalBackend: Filesystem (default, for CLI and local dev)
10
+ * - EfsBackend: AWS EFS (for Lambda/Fargate cloud deployment)
11
+ * - S3DynamoBackend: S3 + DynamoDB (future optimization)
12
+ *
13
+ * The core insight: e3-core business logic is storage-agnostic. By injecting
14
+ * a StorageBackend, the same code can run locally or in the cloud.
15
+ */
16
+ import type { ExecutionStatus, LockState, LockOperation, DataflowRun, DatasetRef } from '@elaraai/e3-types';
17
+ import type { LockHolderInfo } from '../errors.js';
18
+ export type { LockState, LockOperation, LockHolderInfo };
19
+ /**
20
+ * Repository status for lifecycle tracking.
21
+ *
22
+ * - 'creating': Repository is being initialized
23
+ * - 'active': Repository is ready for use
24
+ * - 'gc': Garbage collection is in progress
25
+ * - 'deleting': Repository is being deleted
26
+ */
27
+ export type RepoStatus = 'creating' | 'active' | 'gc' | 'deleting';
28
+ /**
29
+ * Repository metadata.
30
+ */
31
+ export interface RepoMetadata {
32
+ /** Repository name */
33
+ name: string;
34
+ /** Current status */
35
+ status: RepoStatus;
36
+ /** When the repository was created (ISO 8601) */
37
+ createdAt: string;
38
+ /** When the status last changed (ISO 8601) */
39
+ statusChangedAt: string;
40
+ }
41
+ /**
42
+ * Result from batch operations (resumable pattern).
43
+ *
44
+ * Operations return { status: 'continue', cursor } if more work remains,
45
+ * or { status: 'done' } when complete. This enables Step Functions orchestration.
46
+ */
47
+ export interface BatchResult {
48
+ /** 'continue' if more batches remain, 'done' if complete */
49
+ status: 'continue' | 'done';
50
+ /** Opaque cursor for next batch (only present if status='continue') */
51
+ cursor?: string;
52
+ /** Number of items deleted in this batch */
53
+ deleted: number;
54
+ }
55
+ /**
56
+ * A single object entry returned by gcScanObjects.
57
+ */
58
+ export interface GcObjectEntry {
59
+ /** SHA256 hash of the object */
60
+ hash: string;
61
+ /** Last modification time (epoch ms) */
62
+ lastModified: number;
63
+ /** Size of the object in bytes */
64
+ size: number;
65
+ }
66
+ /**
67
+ * Result from scanning root hashes for GC (paginated).
68
+ */
69
+ export interface GcRootScanResult {
70
+ /** Root object hashes in this batch */
71
+ roots: string[];
72
+ /** Opaque cursor for next batch; undefined means scan is complete */
73
+ cursor?: unknown;
74
+ }
75
+ /**
76
+ * Result from scanning objects for GC.
77
+ */
78
+ export interface GcObjectScanResult {
79
+ /** Object entries in this batch */
80
+ objects: GcObjectEntry[];
81
+ /** Opaque cursor for next batch; undefined means scan is complete */
82
+ cursor?: unknown;
83
+ }
84
+ /**
85
+ * Content-addressed object storage.
86
+ *
87
+ * Objects are immutable and identified by their SHA256 hash.
88
+ * The store handles deduplication automatically.
89
+ *
90
+ * All methods take `repo` as first parameter to identify the repository.
91
+ * For local storage, `repo` is the path to the e3 repository directory.
92
+ * For cloud storage, `repo` is a repository identifier used as a key prefix.
93
+ */
94
+ export interface ObjectStore {
95
+ /**
96
+ * Write data to the object store.
97
+ * @param repo - Repository identifier
98
+ * @param data - Raw bytes to store
99
+ * @returns SHA256 hash of the data
100
+ */
101
+ write(repo: string, data: Uint8Array): Promise<string>;
102
+ /**
103
+ * Write data from a stream to the object store.
104
+ * @param repo - Repository identifier
105
+ * @param stream - Async iterable of chunks
106
+ * @returns SHA256 hash of the data
107
+ */
108
+ writeStream(repo: string, stream: AsyncIterable<Uint8Array>): Promise<string>;
109
+ /**
110
+ * Read an object by hash.
111
+ * @param repo - Repository identifier
112
+ * @param hash - SHA256 hash of the object
113
+ * @returns Raw bytes
114
+ * @throws {ObjectNotFoundError} If object doesn't exist
115
+ */
116
+ read(repo: string, hash: string): Promise<Uint8Array>;
117
+ /**
118
+ * Check if an object exists.
119
+ * @param repo - Repository identifier
120
+ * @param hash - SHA256 hash of the object
121
+ * @returns true if object exists
122
+ */
123
+ exists(repo: string, hash: string): Promise<boolean>;
124
+ /**
125
+ * Get the size of an object without reading its contents.
126
+ * @param repo - Repository identifier
127
+ * @param hash - SHA256 hash of the object
128
+ * @returns Object metadata including size in bytes
129
+ * @throws {ObjectNotFoundError} If object doesn't exist
130
+ */
131
+ stat(repo: string, hash: string): Promise<{
132
+ size: number;
133
+ }>;
134
+ /**
135
+ * List all object hashes in the store.
136
+ * Used for garbage collection.
137
+ * @param repo - Repository identifier
138
+ * @returns Array of hashes
139
+ */
140
+ list(repo: string): Promise<string[]>;
141
+ /**
142
+ * Count objects in the store.
143
+ * More efficient than list() when only the count is needed.
144
+ * @param repo - Repository identifier
145
+ * @returns Number of objects
146
+ */
147
+ count(repo: string): Promise<number>;
148
+ }
149
+ /**
150
+ * Mutable reference storage for packages, workspaces, and executions.
151
+ *
152
+ * Unlike objects, references can be updated and deleted.
153
+ * All methods take `repo` as first parameter to identify the repository.
154
+ */
155
+ export interface RefStore {
156
+ /**
157
+ * List all packages with their versions.
158
+ * @param repo - Repository identifier
159
+ * @returns Array of {name, version} pairs
160
+ */
161
+ packageList(repo: string): Promise<{
162
+ name: string;
163
+ version: string;
164
+ }[]>;
165
+ /**
166
+ * Resolve a package reference to its hash.
167
+ * @param repo - Repository identifier
168
+ * @param name - Package name
169
+ * @param version - Package version
170
+ * @returns Package object hash, or null if not found
171
+ */
172
+ packageResolve(repo: string, name: string, version: string): Promise<string | null>;
173
+ /**
174
+ * Write a package reference.
175
+ * @param repo - Repository identifier
176
+ * @param name - Package name
177
+ * @param version - Package version
178
+ * @param hash - Package object hash
179
+ */
180
+ packageWrite(repo: string, name: string, version: string, hash: string): Promise<void>;
181
+ /**
182
+ * Remove a package reference.
183
+ * @param repo - Repository identifier
184
+ * @param name - Package name
185
+ * @param version - Package version
186
+ */
187
+ packageRemove(repo: string, name: string, version: string): Promise<void>;
188
+ /**
189
+ * List all workspace names.
190
+ * @param repo - Repository identifier
191
+ * @returns Array of workspace names
192
+ */
193
+ workspaceList(repo: string): Promise<string[]>;
194
+ /**
195
+ * Read workspace state.
196
+ * @param repo - Repository identifier
197
+ * @param name - Workspace name
198
+ * @returns Encoded workspace state, or null if not found
199
+ */
200
+ workspaceRead(repo: string, name: string): Promise<Uint8Array | null>;
201
+ /**
202
+ * Write workspace state.
203
+ * @param repo - Repository identifier
204
+ * @param name - Workspace name
205
+ * @param state - Encoded workspace state (empty = undeployed)
206
+ */
207
+ workspaceWrite(repo: string, name: string, state: Uint8Array): Promise<void>;
208
+ /**
209
+ * Remove a workspace.
210
+ * @param repo - Repository identifier
211
+ * @param name - Workspace name
212
+ */
213
+ workspaceRemove(repo: string, name: string): Promise<void>;
214
+ /**
215
+ * Get execution status for a specific execution.
216
+ * @param repo - Repository identifier
217
+ * @param taskHash - Task object hash
218
+ * @param inputsHash - Combined input hashes
219
+ * @param executionId - Execution ID (UUIDv7)
220
+ * @returns ExecutionStatus or null if not found
221
+ */
222
+ executionGet(repo: string, taskHash: string, inputsHash: string, executionId: string): Promise<ExecutionStatus | null>;
223
+ /**
224
+ * Write execution status.
225
+ * @param repo - Repository identifier
226
+ * @param taskHash - Task object hash
227
+ * @param inputsHash - Combined input hashes
228
+ * @param executionId - Execution ID (UUIDv7)
229
+ * @param status - Execution status
230
+ */
231
+ executionWrite(repo: string, taskHash: string, inputsHash: string, executionId: string, status: ExecutionStatus): Promise<void>;
232
+ /**
233
+ * List all execution IDs for a (taskHash, inputsHash) pair.
234
+ * @param repo - Repository identifier
235
+ * @param taskHash - Task object hash
236
+ * @param inputsHash - Combined input hashes
237
+ * @returns Array of executionId values (sorted lexicographically ascending)
238
+ */
239
+ executionListIds(repo: string, taskHash: string, inputsHash: string): Promise<string[]>;
240
+ /**
241
+ * Get the latest execution status (lexicographically greatest executionId).
242
+ * @param repo - Repository identifier
243
+ * @param taskHash - Task object hash
244
+ * @param inputsHash - Combined input hashes
245
+ * @returns ExecutionStatus or null if no executions exist
246
+ */
247
+ executionGetLatest(repo: string, taskHash: string, inputsHash: string): Promise<ExecutionStatus | null>;
248
+ /**
249
+ * Get the latest successful output hash (for cache lookup).
250
+ * Iterates from latest executionId backwards, returns first success.outputHash found.
251
+ * @param repo - Repository identifier
252
+ * @param taskHash - Task object hash
253
+ * @param inputsHash - Combined input hashes
254
+ * @returns Output hash or null if no successful execution exists
255
+ */
256
+ executionGetLatestOutput(repo: string, taskHash: string, inputsHash: string): Promise<string | null>;
257
+ /**
258
+ * List all executions in the repository.
259
+ * @param repo - Repository identifier
260
+ * @returns Array of {taskHash, inputsHash} pairs
261
+ */
262
+ executionList(repo: string): Promise<{
263
+ taskHash: string;
264
+ inputsHash: string;
265
+ }[]>;
266
+ /**
267
+ * List executions for a specific task.
268
+ * @param repo - Repository identifier
269
+ * @param taskHash - Task object hash
270
+ * @returns Array of inputsHash values
271
+ */
272
+ executionListForTask(repo: string, taskHash: string): Promise<string[]>;
273
+ /**
274
+ * Get a specific dataflow run.
275
+ * @param repo - Repository identifier
276
+ * @param workspace - Workspace name
277
+ * @param runId - Run ID (UUIDv7)
278
+ * @returns DataflowRun or null if not found
279
+ */
280
+ dataflowRunGet(repo: string, workspace: string, runId: string): Promise<DataflowRun | null>;
281
+ /**
282
+ * Write a dataflow run.
283
+ * @param repo - Repository identifier
284
+ * @param workspace - Workspace name
285
+ * @param run - The dataflow run record
286
+ */
287
+ dataflowRunWrite(repo: string, workspace: string, run: DataflowRun): Promise<void>;
288
+ /**
289
+ * List all run IDs for a workspace (sorted lexicographically ascending).
290
+ * @param repo - Repository identifier
291
+ * @param workspace - Workspace name
292
+ * @returns Array of runId values
293
+ */
294
+ dataflowRunList(repo: string, workspace: string): Promise<string[]>;
295
+ /**
296
+ * Get the latest dataflow run for a workspace.
297
+ * @param repo - Repository identifier
298
+ * @param workspace - Workspace name
299
+ * @returns DataflowRun or null if no runs exist
300
+ */
301
+ dataflowRunGetLatest(repo: string, workspace: string): Promise<DataflowRun | null>;
302
+ /**
303
+ * Delete a specific dataflow run.
304
+ * @param repo - Repository identifier
305
+ * @param workspace - Workspace name
306
+ * @param runId - Run ID (UUIDv7)
307
+ */
308
+ dataflowRunDelete(repo: string, workspace: string, runId: string): Promise<void>;
309
+ }
310
+ /**
311
+ * Handle to a held lock.
312
+ */
313
+ export interface LockHandle {
314
+ /** The resource this lock is for */
315
+ readonly resource: string;
316
+ /** Release the lock. Safe to call multiple times. */
317
+ release(): Promise<void>;
318
+ }
319
+ /**
320
+ * Distributed locking service for exclusive access.
321
+ *
322
+ * Used to prevent concurrent modifications to workspaces.
323
+ * The lock state is stored using the LockState type from e3-types,
324
+ * enabling cloud implementations to extend the holder variants.
325
+ * All methods (except isHolderAlive) take `repo` as first parameter.
326
+ */
327
+ export interface LockService {
328
+ /**
329
+ * Acquire an exclusive lock on a resource.
330
+ *
331
+ * The implementation gathers holder information (process ID for local,
332
+ * request ID for Lambda, etc.) and writes the lock state.
333
+ *
334
+ * @param repo - Repository identifier
335
+ * @param resource - Resource identifier (e.g., "workspaces/production")
336
+ * @param operation - What operation is acquiring the lock
337
+ * @param options - Lock options
338
+ * @returns Lock handle, or null if lock couldn't be acquired
339
+ */
340
+ acquire(repo: string, resource: string, operation: LockOperation, options?: {
341
+ wait?: boolean;
342
+ timeout?: number;
343
+ mode?: 'shared' | 'exclusive';
344
+ }): Promise<LockHandle | null>;
345
+ /**
346
+ * Get the current lock state.
347
+ * @param repo - Repository identifier
348
+ * @param resource - Resource identifier
349
+ * @returns Lock state, or null if not locked
350
+ */
351
+ getState(repo: string, resource: string): Promise<LockState | null>;
352
+ /**
353
+ * Check if a lock holder is still alive.
354
+ *
355
+ * For local process locks, checks if the PID is still running.
356
+ * For cloud locks, checks expiry or queries the cloud service.
357
+ *
358
+ * @param holder - East text-encoded holder string from LockState
359
+ * @returns true if the holder is still active
360
+ */
361
+ isHolderAlive(holder: string): Promise<boolean>;
362
+ }
363
+ /**
364
+ * A chunk of log output.
365
+ */
366
+ export interface LogChunk {
367
+ /** Log content (UTF-8) */
368
+ data: string;
369
+ /** Byte offset of this chunk */
370
+ offset: number;
371
+ /** Bytes in this chunk */
372
+ size: number;
373
+ /** Total log file size (for pagination) */
374
+ totalSize: number;
375
+ /** True if this is the end of the file */
376
+ complete: boolean;
377
+ }
378
+ /**
379
+ * Log storage for execution stdout/stderr.
380
+ * All methods take `repo` as first parameter to identify the repository.
381
+ */
382
+ export interface LogStore {
383
+ /**
384
+ * Append data to a log stream.
385
+ * @param repo - Repository identifier
386
+ * @param taskHash - Task object hash
387
+ * @param inputsHash - Combined input hashes
388
+ * @param executionId - Execution ID (UUIDv7)
389
+ * @param stream - 'stdout' or 'stderr'
390
+ * @param data - Data to append
391
+ */
392
+ append(repo: string, taskHash: string, inputsHash: string, executionId: string, stream: 'stdout' | 'stderr', data: string): Promise<void>;
393
+ /**
394
+ * Read from a log stream.
395
+ * @param repo - Repository identifier
396
+ * @param taskHash - Task object hash
397
+ * @param inputsHash - Combined input hashes
398
+ * @param executionId - Execution ID (UUIDv7)
399
+ * @param stream - 'stdout' or 'stderr'
400
+ * @param options - Read options
401
+ * @returns Log chunk
402
+ */
403
+ read(repo: string, taskHash: string, inputsHash: string, executionId: string, stream: 'stdout' | 'stderr', options?: {
404
+ offset?: number;
405
+ limit?: number;
406
+ }): Promise<LogChunk>;
407
+ }
408
+ /**
409
+ * Repository lifecycle management.
410
+ *
411
+ * Handles repo creation, deletion, status tracking, and GC.
412
+ * Follows the sub-interface pattern (storage.repos.*) like other stores.
413
+ */
414
+ export interface RepoStore {
415
+ /**
416
+ * List all repository names.
417
+ * @returns Array of repository names
418
+ */
419
+ list(): Promise<string[]>;
420
+ /**
421
+ * Check if a repository exists.
422
+ * @param repo - Repository name
423
+ * @returns true if repository exists
424
+ */
425
+ exists(repo: string): Promise<boolean>;
426
+ /**
427
+ * Get repository metadata.
428
+ * @param repo - Repository name
429
+ * @returns Metadata or null if not found
430
+ */
431
+ getMetadata(repo: string): Promise<RepoMetadata | null>;
432
+ /**
433
+ * Create a new repository.
434
+ * Sets status to 'active' after initialization.
435
+ * @param repo - Repository name
436
+ * @throws {RepoAlreadyExistsError} If repository already exists
437
+ */
438
+ create(repo: string): Promise<void>;
439
+ /**
440
+ * Atomically set repository status.
441
+ * Used for CAS (compare-and-swap) operations.
442
+ * @param repo - Repository name
443
+ * @param status - New status
444
+ * @param expected - Optional expected current status (single or array) for CAS
445
+ * @throws {RepoNotFoundError} If repository doesn't exist
446
+ * @throws {RepoStatusConflictError} If expected status doesn't match
447
+ */
448
+ setStatus(repo: string, status: RepoStatus, expected?: RepoStatus | RepoStatus[]): Promise<void>;
449
+ /**
450
+ * Remove repository metadata/tombstone.
451
+ * Called after GC completes for 'deleting' repos.
452
+ * @param repo - Repository name
453
+ */
454
+ remove(repo: string): Promise<void>;
455
+ /**
456
+ * Delete all refs for a repo in batches.
457
+ * Loop until status='done'.
458
+ * @param repo - Repository name
459
+ * @param cursor - Cursor from previous call (undefined for first call)
460
+ * @returns Batch result with status and optional cursor
461
+ */
462
+ deleteRefsBatch(repo: string, cursor?: string): Promise<BatchResult>;
463
+ /**
464
+ * Delete all objects for a repo in batches.
465
+ * Loop until status='done'.
466
+ * @param repo - Repository name
467
+ * @param cursor - Cursor from previous call (undefined for first call)
468
+ * @returns Batch result with status and optional cursor
469
+ */
470
+ deleteObjectsBatch(repo: string, cursor?: string): Promise<BatchResult>;
471
+ /**
472
+ * Scan package references for root hashes.
473
+ * @param repo - Repository name
474
+ * @param cursor - Opaque cursor from previous call (undefined for first call)
475
+ * @returns Root hashes and optional cursor for next batch
476
+ */
477
+ gcScanPackageRoots(repo: string, cursor?: unknown): Promise<GcRootScanResult>;
478
+ /**
479
+ * Scan workspace state for root hashes.
480
+ * @param repo - Repository name
481
+ * @param cursor - Opaque cursor from previous call (undefined for first call)
482
+ * @returns Root hashes and optional cursor for next batch
483
+ */
484
+ gcScanWorkspaceRoots(repo: string, cursor?: unknown): Promise<GcRootScanResult>;
485
+ /**
486
+ * Scan execution history for root hashes.
487
+ * @param repo - Repository name
488
+ * @param cursor - Opaque cursor from previous call (undefined for first call)
489
+ * @returns Root hashes and optional cursor for next batch
490
+ */
491
+ gcScanExecutionRoots(repo: string, cursor?: unknown): Promise<GcRootScanResult>;
492
+ /**
493
+ * Scan object catalogue entries for GC.
494
+ * @param repo - Repository name
495
+ * @param cursor - Opaque cursor from previous call (undefined for first call)
496
+ * @returns Object entries and optional cursor for next batch
497
+ */
498
+ gcScanObjects(repo: string, cursor?: unknown): Promise<GcObjectScanResult>;
499
+ /**
500
+ * Delete objects by hash. Idempotent — safe to retry on failure.
501
+ * @param repo - Repository name
502
+ * @param hashes - Object hashes to delete
503
+ */
504
+ gcDeleteObjects(repo: string, hashes: string[]): Promise<void>;
505
+ }
506
+ /**
507
+ * Per-dataset reference storage for reactive dataflow.
508
+ *
509
+ * Each dataset in a workspace has its own ref file tracking its current
510
+ * value and version vector. This replaces the single rootHash approach,
511
+ * enabling concurrent writes and reactive re-execution.
512
+ *
513
+ * Ref files are stored at: workspaces/<ws>/data/<path>.ref
514
+ * where <path> uses directory separators (e.g., inputs/sales.ref).
515
+ */
516
+ export interface DatasetRefStore {
517
+ /**
518
+ * Read a dataset ref.
519
+ * @param repo - Repository identifier
520
+ * @param ws - Workspace name
521
+ * @param path - Dataset path (e.g., "inputs/sales" for .inputs.sales)
522
+ * @returns DatasetRef or null if ref doesn't exist
523
+ */
524
+ read(repo: string, ws: string, path: string): Promise<DatasetRef | null>;
525
+ /**
526
+ * Write a dataset ref atomically.
527
+ * @param repo - Repository identifier
528
+ * @param ws - Workspace name
529
+ * @param path - Dataset path (e.g., "inputs/sales" for .inputs.sales)
530
+ * @param ref - The dataset ref to write
531
+ */
532
+ write(repo: string, ws: string, path: string, ref: DatasetRef): Promise<void>;
533
+ /**
534
+ * List all dataset ref paths in a workspace.
535
+ * @param repo - Repository identifier
536
+ * @param ws - Workspace name
537
+ * @returns Array of dataset paths (e.g., ["inputs/sales", "tasks/etl/output"])
538
+ */
539
+ list(repo: string, ws: string): Promise<string[]>;
540
+ /**
541
+ * Remove a single dataset ref.
542
+ * @param repo - Repository identifier
543
+ * @param ws - Workspace name
544
+ * @param path - Dataset path
545
+ */
546
+ remove(repo: string, ws: string, path: string): Promise<void>;
547
+ /**
548
+ * Remove all dataset refs for a workspace.
549
+ * @param repo - Repository identifier
550
+ * @param ws - Workspace name
551
+ */
552
+ removeAll(repo: string, ws: string): Promise<void>;
553
+ }
554
+ /**
555
+ * Complete storage backend combining all storage interfaces.
556
+ *
557
+ * This is the main abstraction point for e3-core. Functions receive a
558
+ * StorageBackend instead of a repoPath, allowing the same logic to work
559
+ * against different storage implementations.
560
+ */
561
+ export interface StorageBackend {
562
+ /** Content-addressed object storage */
563
+ readonly objects: ObjectStore;
564
+ /** Mutable reference storage */
565
+ readonly refs: RefStore;
566
+ /** Distributed locking service */
567
+ readonly locks: LockService;
568
+ /** Execution log storage */
569
+ readonly logs: LogStore;
570
+ /** Repository lifecycle management */
571
+ readonly repos: RepoStore;
572
+ /** Per-dataset reference storage (reactive dataflow) */
573
+ readonly datasets: DatasetRefStore;
574
+ /**
575
+ * Validate that a repository exists and is properly structured.
576
+ * @param repo - Repository identifier (path to e3 repository directory for local storage)
577
+ * @throws {RepoNotFoundError} If repository doesn't exist or is invalid
578
+ */
579
+ validateRepository(repo: string): Promise<void>;
580
+ }
581
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/storage/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAMzD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,IAAI,GAAG,UAAU,CAAC;AAEnE;;GAE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AC,KAAK,EAAE,WAAW,CAAC;IAE5B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAExB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAE1B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/storage/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import type { StorageBackend, ObjectStore, RefStore, LockService, LogStore, RepoStore, DatasetRefStore } from '../interfaces.js';
6
+ /**
7
+ * Local filesystem implementation of StorageBackend.
8
+ *
9
+ * This combines the local implementations of all storage interfaces,
10
+ * providing a complete backend for local e3 repositories.
11
+ *
12
+ * The `repo` parameter passed to each method is the path to the e3 repository directory.
13
+ * This allows a single LocalStorage instance to be used for multiple repositories.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { LocalStorage } from '@elaraai/e3-core';
18
+ *
19
+ * const storage = new LocalStorage();
20
+ * const repo = '/path/to/repo';
21
+ *
22
+ * // Use the backend with storage-agnostic functions
23
+ * const hash = await storage.objects.write(repo, data);
24
+ * const packages = await storage.refs.packageList(repo);
25
+ * ```
26
+ */
27
+ export declare class LocalStorage implements StorageBackend {
28
+ /** Content-addressed object storage */
29
+ readonly objects: ObjectStore;
30
+ /** Mutable reference storage */
31
+ readonly refs: RefStore;
32
+ /** Distributed locking service */
33
+ readonly locks: LockService;
34
+ /** Execution log storage */
35
+ readonly logs: LogStore;
36
+ /** Repository lifecycle management */
37
+ readonly repos: RepoStore;
38
+ /** Per-dataset reference storage (reactive dataflow) */
39
+ readonly datasets: DatasetRefStore;
40
+ /**
41
+ * Create a new LocalStorage instance.
42
+ *
43
+ * @param reposDir - Optional parent directory containing repositories.
44
+ * Required for repo lifecycle operations (repos.*).
45
+ * If not provided, repos.* methods will throw.
46
+ */
47
+ constructor(reposDir?: string);
48
+ /**
49
+ * Validate that a repository exists and is properly structured.
50
+ * @param repo - Path to the e3 repository directory
51
+ * @throws {RepoNotFoundError} If repository doesn't exist or is invalid
52
+ */
53
+ validateRepository(repo: string): Promise<void>;
54
+ }
55
+ export { LocalStorage as LocalBackend };
56
+ //# sourceMappingURL=LocalBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalBackend.d.ts","sourceRoot":"","sources":["../../../../src/storage/local/LocalBackend.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmBjI;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAa,YAAW,cAAc;IACjD,uCAAuC;IACvC,SAAgB,OAAO,EAAE,WAAW,CAAC;IAErC,gCAAgC;IAChC,SAAgB,IAAI,EAAE,QAAQ,CAAC;IAE/B,kCAAkC;IAClC,SAAgB,KAAK,EAAE,WAAW,CAAC;IAEnC,4BAA4B;IAC5B,SAAgB,IAAI,EAAE,QAAQ,CAAC;IAE/B,sCAAsC;IACtC,SAAgB,KAAK,EAAE,SAAS,CAAC;IAEjC,wDAAwD;IACxD,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAE1C;;;;;;OAMG;gBACS,QAAQ,CAAC,EAAE,MAAM;IAa7B;;;;OAIG;IACG,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAUtD;AAGD,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,CAAC"}