@elaraai/e3-core 0.0.2-beta.9 → 1.0.1

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 (285) hide show
  1. package/LICENSE.md +4 -0
  2. package/README.md +74 -35
  3. package/dist/src/dataflow/api-compat.d.ts +90 -0
  4. package/dist/src/dataflow/api-compat.d.ts.map +1 -0
  5. package/dist/src/dataflow/api-compat.js +139 -0
  6. package/dist/src/dataflow/api-compat.js.map +1 -0
  7. package/dist/src/dataflow/api-compat.spec.d.ts +6 -0
  8. package/dist/src/dataflow/api-compat.spec.d.ts.map +1 -0
  9. package/dist/src/dataflow/api-compat.spec.js +182 -0
  10. package/dist/src/dataflow/api-compat.spec.js.map +1 -0
  11. package/dist/src/dataflow/index.d.ts +18 -0
  12. package/dist/src/dataflow/index.d.ts.map +1 -0
  13. package/dist/src/dataflow/index.js +23 -0
  14. package/dist/src/dataflow/index.js.map +1 -0
  15. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +76 -0
  16. package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
  17. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +729 -0
  18. package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
  19. package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
  20. package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
  21. package/dist/src/dataflow/orchestrator/index.js +12 -0
  22. package/dist/src/dataflow/orchestrator/index.js.map +1 -0
  23. package/dist/src/dataflow/orchestrator/interfaces.d.ts +163 -0
  24. package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
  25. package/dist/src/dataflow/orchestrator/interfaces.js +52 -0
  26. package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
  27. package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
  28. package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
  29. package/dist/src/dataflow/state-store/FileStateStore.js +300 -0
  30. package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
  31. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
  32. package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
  33. package/dist/src/dataflow/state-store/InMemoryStateStore.js +229 -0
  34. package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
  35. package/dist/src/dataflow/state-store/InMemoryStateStore.spec.d.ts +6 -0
  36. package/dist/src/dataflow/state-store/InMemoryStateStore.spec.d.ts.map +1 -0
  37. package/dist/src/dataflow/state-store/InMemoryStateStore.spec.js +114 -0
  38. package/dist/src/dataflow/state-store/InMemoryStateStore.spec.js.map +1 -0
  39. package/dist/src/dataflow/state-store/index.d.ts +13 -0
  40. package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
  41. package/dist/src/dataflow/state-store/index.js +13 -0
  42. package/dist/src/dataflow/state-store/index.js.map +1 -0
  43. package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
  44. package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
  45. package/dist/src/dataflow/state-store/interfaces.js +6 -0
  46. package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
  47. package/dist/src/dataflow/steps.d.ts +222 -0
  48. package/dist/src/dataflow/steps.d.ts.map +1 -0
  49. package/dist/src/dataflow/steps.js +707 -0
  50. package/dist/src/dataflow/steps.js.map +1 -0
  51. package/dist/src/dataflow/steps.spec.d.ts +6 -0
  52. package/dist/src/dataflow/steps.spec.d.ts.map +1 -0
  53. package/dist/src/dataflow/steps.spec.js +343 -0
  54. package/dist/src/dataflow/steps.spec.js.map +1 -0
  55. package/dist/src/dataflow/types.d.ts +127 -0
  56. package/dist/src/dataflow/types.d.ts.map +1 -0
  57. package/dist/src/dataflow/types.js +7 -0
  58. package/dist/src/dataflow/types.js.map +1 -0
  59. package/dist/src/dataflow-orchestration.spec.d.ts +6 -0
  60. package/dist/src/dataflow-orchestration.spec.d.ts.map +1 -0
  61. package/dist/src/dataflow-orchestration.spec.js +1025 -0
  62. package/dist/src/dataflow-orchestration.spec.js.map +1 -0
  63. package/dist/src/dataflow.d.ts +113 -38
  64. package/dist/src/dataflow.d.ts.map +1 -1
  65. package/dist/src/dataflow.js +269 -416
  66. package/dist/src/dataflow.js.map +1 -1
  67. package/dist/src/dataflow.spec.d.ts +6 -0
  68. package/dist/src/dataflow.spec.d.ts.map +1 -0
  69. package/dist/src/dataflow.spec.js +663 -0
  70. package/dist/src/dataflow.spec.js.map +1 -0
  71. package/dist/src/dataset-refs.d.ts +124 -0
  72. package/dist/src/dataset-refs.d.ts.map +1 -0
  73. package/dist/src/dataset-refs.js +319 -0
  74. package/dist/src/dataset-refs.js.map +1 -0
  75. package/dist/src/errors.d.ts +39 -9
  76. package/dist/src/errors.d.ts.map +1 -1
  77. package/dist/src/errors.js +51 -8
  78. package/dist/src/errors.js.map +1 -1
  79. package/dist/src/errors.spec.d.ts +6 -0
  80. package/dist/src/errors.spec.d.ts.map +1 -0
  81. package/dist/src/errors.spec.js +276 -0
  82. package/dist/src/errors.spec.js.map +1 -0
  83. package/dist/src/execution/LocalTaskRunner.d.ts +73 -0
  84. package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
  85. package/dist/src/execution/LocalTaskRunner.js +399 -0
  86. package/dist/src/execution/LocalTaskRunner.js.map +1 -0
  87. package/dist/src/execution/MockTaskRunner.d.ts +49 -0
  88. package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
  89. package/dist/src/execution/MockTaskRunner.js +54 -0
  90. package/dist/src/execution/MockTaskRunner.js.map +1 -0
  91. package/dist/src/execution/index.d.ts +16 -0
  92. package/dist/src/execution/index.d.ts.map +1 -0
  93. package/dist/src/execution/index.js +8 -0
  94. package/dist/src/execution/index.js.map +1 -0
  95. package/dist/src/execution/interfaces.d.ts +246 -0
  96. package/dist/src/execution/interfaces.d.ts.map +1 -0
  97. package/dist/src/execution/interfaces.js +6 -0
  98. package/dist/src/execution/interfaces.js.map +1 -0
  99. package/dist/src/execution/processHelpers.d.ts +20 -0
  100. package/dist/src/execution/processHelpers.d.ts.map +1 -0
  101. package/dist/src/execution/processHelpers.js +62 -0
  102. package/dist/src/execution/processHelpers.js.map +1 -0
  103. package/dist/src/executions.d.ts +71 -104
  104. package/dist/src/executions.d.ts.map +1 -1
  105. package/dist/src/executions.js +113 -481
  106. package/dist/src/executions.js.map +1 -1
  107. package/dist/src/executions.spec.d.ts +6 -0
  108. package/dist/src/executions.spec.d.ts.map +1 -0
  109. package/dist/src/executions.spec.js +387 -0
  110. package/dist/src/executions.spec.js.map +1 -0
  111. package/dist/src/formats.d.ts +18 -2
  112. package/dist/src/formats.d.ts.map +1 -1
  113. package/dist/src/formats.js +34 -2
  114. package/dist/src/formats.js.map +1 -1
  115. package/dist/src/gc.spec.d.ts +6 -0
  116. package/dist/src/gc.spec.d.ts.map +1 -0
  117. package/dist/src/gc.spec.js +512 -0
  118. package/dist/src/gc.spec.js.map +1 -0
  119. package/dist/src/index.d.ts +20 -10
  120. package/dist/src/index.d.ts.map +1 -1
  121. package/dist/src/index.js +48 -18
  122. package/dist/src/index.js.map +1 -1
  123. package/dist/src/objects.d.ts +7 -53
  124. package/dist/src/objects.d.ts.map +1 -1
  125. package/dist/src/objects.js +13 -232
  126. package/dist/src/objects.js.map +1 -1
  127. package/dist/src/objects.spec.d.ts +6 -0
  128. package/dist/src/objects.spec.d.ts.map +1 -0
  129. package/dist/src/objects.spec.js +247 -0
  130. package/dist/src/objects.spec.js.map +1 -0
  131. package/dist/src/packages.d.ts +41 -14
  132. package/dist/src/packages.d.ts.map +1 -1
  133. package/dist/src/packages.js +151 -89
  134. package/dist/src/packages.js.map +1 -1
  135. package/dist/src/packages.spec.d.ts +6 -0
  136. package/dist/src/packages.spec.d.ts.map +1 -0
  137. package/dist/src/packages.spec.js +324 -0
  138. package/dist/src/packages.spec.js.map +1 -0
  139. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts +35 -0
  140. package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts.map +1 -0
  141. package/dist/src/storage/in-memory/InMemoryRepoStore.js +107 -0
  142. package/dist/src/storage/in-memory/InMemoryRepoStore.js.map +1 -0
  143. package/dist/src/storage/in-memory/InMemoryRepoStore.spec.d.ts +6 -0
  144. package/dist/src/storage/in-memory/InMemoryRepoStore.spec.d.ts.map +1 -0
  145. package/dist/src/storage/in-memory/InMemoryRepoStore.spec.js +187 -0
  146. package/dist/src/storage/in-memory/InMemoryRepoStore.spec.js.map +1 -0
  147. package/dist/src/storage/in-memory/InMemoryStorage.d.ts +139 -0
  148. package/dist/src/storage/in-memory/InMemoryStorage.d.ts.map +1 -0
  149. package/dist/src/storage/in-memory/InMemoryStorage.js +439 -0
  150. package/dist/src/storage/in-memory/InMemoryStorage.js.map +1 -0
  151. package/dist/src/storage/in-memory/index.d.ts +12 -0
  152. package/dist/src/storage/in-memory/index.d.ts.map +1 -0
  153. package/dist/src/storage/in-memory/index.js +12 -0
  154. package/dist/src/storage/in-memory/index.js.map +1 -0
  155. package/dist/src/storage/index.d.ts +18 -0
  156. package/dist/src/storage/index.d.ts.map +1 -0
  157. package/dist/src/storage/index.js +10 -0
  158. package/dist/src/storage/index.js.map +1 -0
  159. package/dist/src/storage/interfaces.d.ts +581 -0
  160. package/dist/src/storage/interfaces.d.ts.map +1 -0
  161. package/dist/src/storage/interfaces.js +6 -0
  162. package/dist/src/storage/interfaces.js.map +1 -0
  163. package/dist/src/storage/local/LocalBackend.d.ts +56 -0
  164. package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
  165. package/dist/src/storage/local/LocalBackend.js +145 -0
  166. package/dist/src/storage/local/LocalBackend.js.map +1 -0
  167. package/dist/src/storage/local/LocalDatasetRefStore.d.ts +22 -0
  168. package/dist/src/storage/local/LocalDatasetRefStore.d.ts.map +1 -0
  169. package/dist/src/storage/local/LocalDatasetRefStore.js +118 -0
  170. package/dist/src/storage/local/LocalDatasetRefStore.js.map +1 -0
  171. package/dist/src/storage/local/LocalLockService.d.ts +111 -0
  172. package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
  173. package/dist/src/storage/local/LocalLockService.js +364 -0
  174. package/dist/src/storage/local/LocalLockService.js.map +1 -0
  175. package/dist/src/storage/local/LocalLockService.spec.d.ts +6 -0
  176. package/dist/src/storage/local/LocalLockService.spec.d.ts.map +1 -0
  177. package/dist/src/storage/local/LocalLockService.spec.js +148 -0
  178. package/dist/src/storage/local/LocalLockService.spec.js.map +1 -0
  179. package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
  180. package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
  181. package/dist/src/storage/local/LocalLogStore.js +66 -0
  182. package/dist/src/storage/local/LocalLogStore.js.map +1 -0
  183. package/dist/src/storage/local/LocalObjectStore.d.ts +55 -0
  184. package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
  185. package/dist/src/storage/local/LocalObjectStore.js +300 -0
  186. package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
  187. package/dist/src/storage/local/LocalRefStore.d.ts +50 -0
  188. package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
  189. package/dist/src/storage/local/LocalRefStore.js +337 -0
  190. package/dist/src/storage/local/LocalRefStore.js.map +1 -0
  191. package/dist/src/storage/local/LocalRepoStore.d.ts +55 -0
  192. package/dist/src/storage/local/LocalRepoStore.d.ts.map +1 -0
  193. package/dist/src/storage/local/LocalRepoStore.js +365 -0
  194. package/dist/src/storage/local/LocalRepoStore.js.map +1 -0
  195. package/dist/src/storage/local/LocalRepoStore.spec.d.ts +6 -0
  196. package/dist/src/storage/local/LocalRepoStore.spec.d.ts.map +1 -0
  197. package/dist/src/storage/local/LocalRepoStore.spec.js +255 -0
  198. package/dist/src/storage/local/LocalRepoStore.spec.js.map +1 -0
  199. package/dist/src/storage/local/gc.d.ts +92 -0
  200. package/dist/src/storage/local/gc.d.ts.map +1 -0
  201. package/dist/src/storage/local/gc.js +377 -0
  202. package/dist/src/storage/local/gc.js.map +1 -0
  203. package/dist/src/storage/local/index.d.ts +18 -0
  204. package/dist/src/storage/local/index.d.ts.map +1 -0
  205. package/dist/src/storage/local/index.js +18 -0
  206. package/dist/src/storage/local/index.js.map +1 -0
  207. package/dist/src/storage/local/localHelpers.d.ts +25 -0
  208. package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
  209. package/dist/src/storage/local/localHelpers.js +69 -0
  210. package/dist/src/storage/local/localHelpers.js.map +1 -0
  211. package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +8 -4
  212. package/dist/src/storage/local/repository.d.ts.map +1 -0
  213. package/dist/src/{repository.js → storage/local/repository.js} +31 -29
  214. package/dist/src/storage/local/repository.js.map +1 -0
  215. package/dist/src/storage/local/repository.spec.d.ts +6 -0
  216. package/dist/src/storage/local/repository.spec.d.ts.map +1 -0
  217. package/dist/src/storage/local/repository.spec.js +186 -0
  218. package/dist/src/storage/local/repository.spec.js.map +1 -0
  219. package/dist/src/tasks.d.ts +16 -10
  220. package/dist/src/tasks.d.ts.map +1 -1
  221. package/dist/src/tasks.js +35 -41
  222. package/dist/src/tasks.js.map +1 -1
  223. package/dist/src/tasks.spec.d.ts +6 -0
  224. package/dist/src/tasks.spec.d.ts.map +1 -0
  225. package/dist/src/tasks.spec.js +105 -0
  226. package/dist/src/tasks.spec.js.map +1 -0
  227. package/dist/src/test-helpers.d.ts +5 -4
  228. package/dist/src/test-helpers.d.ts.map +1 -1
  229. package/dist/src/test-helpers.js +9 -21
  230. package/dist/src/test-helpers.js.map +1 -1
  231. package/dist/src/transfer/InMemoryTransferBackend.d.ts +75 -0
  232. package/dist/src/transfer/InMemoryTransferBackend.d.ts.map +1 -0
  233. package/dist/src/transfer/InMemoryTransferBackend.js +211 -0
  234. package/dist/src/transfer/InMemoryTransferBackend.js.map +1 -0
  235. package/dist/src/transfer/index.d.ts +9 -0
  236. package/dist/src/transfer/index.d.ts.map +1 -0
  237. package/dist/src/transfer/index.js +11 -0
  238. package/dist/src/transfer/index.js.map +1 -0
  239. package/dist/src/transfer/interfaces.d.ts +103 -0
  240. package/dist/src/transfer/interfaces.d.ts.map +1 -0
  241. package/dist/src/transfer/interfaces.js +6 -0
  242. package/dist/src/transfer/interfaces.js.map +1 -0
  243. package/dist/src/transfer/process.d.ts +55 -0
  244. package/dist/src/transfer/process.d.ts.map +1 -0
  245. package/dist/src/transfer/process.js +144 -0
  246. package/dist/src/transfer/process.js.map +1 -0
  247. package/dist/src/transfer/types.d.ts +106 -0
  248. package/dist/src/transfer/types.d.ts.map +1 -0
  249. package/dist/src/transfer/types.js +61 -0
  250. package/dist/src/transfer/types.js.map +1 -0
  251. package/dist/src/trees.d.ts +102 -63
  252. package/dist/src/trees.d.ts.map +1 -1
  253. package/dist/src/trees.js +319 -479
  254. package/dist/src/trees.js.map +1 -1
  255. package/dist/src/trees.spec.d.ts +6 -0
  256. package/dist/src/trees.spec.d.ts.map +1 -0
  257. package/dist/src/trees.spec.js +635 -0
  258. package/dist/src/trees.spec.js.map +1 -0
  259. package/dist/src/uuid.d.ts +26 -0
  260. package/dist/src/uuid.d.ts.map +1 -0
  261. package/dist/src/uuid.js +80 -0
  262. package/dist/src/uuid.js.map +1 -0
  263. package/dist/src/workspaceStatus.d.ts +6 -4
  264. package/dist/src/workspaceStatus.d.ts.map +1 -1
  265. package/dist/src/workspaceStatus.js +46 -60
  266. package/dist/src/workspaceStatus.js.map +1 -1
  267. package/dist/src/workspaces.d.ts +46 -47
  268. package/dist/src/workspaces.d.ts.map +1 -1
  269. package/dist/src/workspaces.js +281 -221
  270. package/dist/src/workspaces.js.map +1 -1
  271. package/dist/src/workspaces.spec.d.ts +6 -0
  272. package/dist/src/workspaces.spec.d.ts.map +1 -0
  273. package/dist/src/workspaces.spec.js +273 -0
  274. package/dist/src/workspaces.spec.js.map +1 -0
  275. package/package.json +15 -15
  276. package/dist/src/gc.d.ts +0 -54
  277. package/dist/src/gc.d.ts.map +0 -1
  278. package/dist/src/gc.js +0 -233
  279. package/dist/src/gc.js.map +0 -1
  280. package/dist/src/repository.d.ts.map +0 -1
  281. package/dist/src/repository.js.map +0 -1
  282. package/dist/src/workspaceLock.d.ts +0 -67
  283. package/dist/src/workspaceLock.d.ts.map +0 -1
  284. package/dist/src/workspaceLock.js +0 -217
  285. package/dist/src/workspaceLock.js.map +0 -1
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Tests for InMemoryRepoStore.
7
+ */
8
+ import { describe, it, beforeEach } from 'node:test';
9
+ import assert from 'node:assert';
10
+ import { InMemoryRepoStore } from './InMemoryRepoStore.js';
11
+ import { RepoNotFoundError, RepoAlreadyExistsError, RepoStatusConflictError, } from '../../errors.js';
12
+ describe('InMemoryRepoStore', () => {
13
+ let store;
14
+ beforeEach(() => {
15
+ store = new InMemoryRepoStore();
16
+ });
17
+ describe('list', () => {
18
+ it('returns empty array initially', async () => {
19
+ const repos = await store.list();
20
+ assert.deepStrictEqual(repos, []);
21
+ });
22
+ it('returns all created repos', async () => {
23
+ await store.create('repo1');
24
+ await store.create('repo2');
25
+ await store.create('repo3');
26
+ const repos = await store.list();
27
+ assert.deepStrictEqual(repos.sort(), ['repo1', 'repo2', 'repo3']);
28
+ });
29
+ });
30
+ describe('exists', () => {
31
+ it('returns false for non-existent repo', async () => {
32
+ const exists = await store.exists('nonexistent');
33
+ assert.strictEqual(exists, false);
34
+ });
35
+ it('returns true for existing repo', async () => {
36
+ await store.create('my-repo');
37
+ const exists = await store.exists('my-repo');
38
+ assert.strictEqual(exists, true);
39
+ });
40
+ });
41
+ describe('getMetadata', () => {
42
+ it('returns null for non-existent repo', async () => {
43
+ const metadata = await store.getMetadata('nonexistent');
44
+ assert.strictEqual(metadata, null);
45
+ });
46
+ it('returns metadata for existing repo', async () => {
47
+ await store.create('my-repo');
48
+ const metadata = await store.getMetadata('my-repo');
49
+ assert.ok(metadata);
50
+ assert.strictEqual(metadata.name, 'my-repo');
51
+ assert.strictEqual(metadata.status, 'active');
52
+ assert.ok(metadata.createdAt);
53
+ assert.ok(metadata.statusChangedAt);
54
+ });
55
+ });
56
+ describe('create', () => {
57
+ it('creates a new repo with active status', async () => {
58
+ await store.create('my-repo');
59
+ const metadata = await store.getMetadata('my-repo');
60
+ assert.ok(metadata);
61
+ assert.strictEqual(metadata.status, 'active');
62
+ });
63
+ it('throws RepoAlreadyExistsError if repo exists', async () => {
64
+ await store.create('my-repo');
65
+ await assert.rejects(() => store.create('my-repo'), RepoAlreadyExistsError);
66
+ });
67
+ });
68
+ describe('setStatus', () => {
69
+ it('updates status', async () => {
70
+ await store.create('my-repo');
71
+ await store.setStatus('my-repo', 'gc');
72
+ const metadata = await store.getMetadata('my-repo');
73
+ assert.ok(metadata);
74
+ assert.strictEqual(metadata.status, 'gc');
75
+ });
76
+ it('updates statusChangedAt', async () => {
77
+ await store.create('my-repo');
78
+ const before = await store.getMetadata('my-repo');
79
+ // Wait a tiny bit to ensure timestamps differ
80
+ await new Promise(resolve => setTimeout(resolve, 10));
81
+ await store.setStatus('my-repo', 'gc');
82
+ const after = await store.getMetadata('my-repo');
83
+ assert.ok(before && after);
84
+ assert.notStrictEqual(before.statusChangedAt, after.statusChangedAt);
85
+ });
86
+ it('throws RepoNotFoundError for non-existent repo', async () => {
87
+ await assert.rejects(() => store.setStatus('nonexistent', 'gc'), RepoNotFoundError);
88
+ });
89
+ it('succeeds with correct expected status', async () => {
90
+ await store.create('my-repo');
91
+ await store.setStatus('my-repo', 'gc', 'active');
92
+ const metadata = await store.getMetadata('my-repo');
93
+ assert.ok(metadata);
94
+ assert.strictEqual(metadata.status, 'gc');
95
+ });
96
+ it('throws RepoStatusConflictError with wrong expected status', async () => {
97
+ await store.create('my-repo');
98
+ await assert.rejects(() => store.setStatus('my-repo', 'gc', 'deleting'), RepoStatusConflictError);
99
+ });
100
+ it('succeeds with expected status array', async () => {
101
+ await store.create('my-repo');
102
+ await store.setStatus('my-repo', 'gc', ['active', 'creating']);
103
+ const metadata = await store.getMetadata('my-repo');
104
+ assert.ok(metadata);
105
+ assert.strictEqual(metadata.status, 'gc');
106
+ });
107
+ it('throws RepoStatusConflictError with expected status array not matching', async () => {
108
+ await store.create('my-repo');
109
+ await assert.rejects(() => store.setStatus('my-repo', 'gc', ['creating', 'deleting']), RepoStatusConflictError);
110
+ });
111
+ });
112
+ describe('remove', () => {
113
+ it('removes a repo', async () => {
114
+ await store.create('my-repo');
115
+ await store.remove('my-repo');
116
+ const exists = await store.exists('my-repo');
117
+ assert.strictEqual(exists, false);
118
+ });
119
+ it('does not throw for non-existent repo', async () => {
120
+ await store.remove('nonexistent');
121
+ // Should not throw
122
+ });
123
+ });
124
+ describe('deleteRefsBatch', () => {
125
+ it('returns done immediately (no-op for in-memory)', async () => {
126
+ await store.create('my-repo');
127
+ const result = await store.deleteRefsBatch('my-repo');
128
+ assert.strictEqual(result.status, 'done');
129
+ assert.strictEqual(result.deleted, 0);
130
+ });
131
+ });
132
+ describe('deleteObjectsBatch', () => {
133
+ it('returns done immediately (no-op for in-memory)', async () => {
134
+ await store.create('my-repo');
135
+ const result = await store.deleteObjectsBatch('my-repo');
136
+ assert.strictEqual(result.status, 'done');
137
+ assert.strictEqual(result.deleted, 0);
138
+ });
139
+ });
140
+ describe('gcScanPackageRoots', () => {
141
+ it('returns empty for in-memory store', async () => {
142
+ await store.create('my-repo');
143
+ const result = await store.gcScanPackageRoots('my-repo');
144
+ assert.deepStrictEqual(result.roots, []);
145
+ assert.strictEqual(result.cursor, undefined);
146
+ });
147
+ });
148
+ describe('gcScanWorkspaceRoots', () => {
149
+ it('returns empty for in-memory store', async () => {
150
+ await store.create('my-repo');
151
+ const result = await store.gcScanWorkspaceRoots('my-repo');
152
+ assert.deepStrictEqual(result.roots, []);
153
+ });
154
+ });
155
+ describe('gcScanExecutionRoots', () => {
156
+ it('returns empty for in-memory store', async () => {
157
+ await store.create('my-repo');
158
+ const result = await store.gcScanExecutionRoots('my-repo');
159
+ assert.deepStrictEqual(result.roots, []);
160
+ });
161
+ });
162
+ describe('gcScanObjects', () => {
163
+ it('returns empty for in-memory store', async () => {
164
+ await store.create('my-repo');
165
+ const result = await store.gcScanObjects('my-repo');
166
+ assert.deepStrictEqual(result.objects, []);
167
+ assert.strictEqual(result.cursor, undefined);
168
+ });
169
+ });
170
+ describe('gcDeleteObjects', () => {
171
+ it('succeeds (no-op for in-memory)', async () => {
172
+ await store.create('my-repo');
173
+ await store.gcDeleteObjects('my-repo', ['a'.repeat(64)]);
174
+ // Should not throw
175
+ });
176
+ });
177
+ describe('clear', () => {
178
+ it('removes all repos', async () => {
179
+ await store.create('repo1');
180
+ await store.create('repo2');
181
+ store.clear();
182
+ const repos = await store.list();
183
+ assert.deepStrictEqual(repos, []);
184
+ });
185
+ });
186
+ });
187
+ //# sourceMappingURL=InMemoryRepoStore.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InMemoryRepoStore.spec.js","sourceRoot":"","sources":["../../../../src/storage/in-memory/InMemoryRepoStore.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,KAAwB,CAAC;IAE7B,UAAU,CAAC,GAAG,EAAE;QACd,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;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YAC5B,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAE5B,KAAK,CAAC,KAAK,EAAE,CAAC;YAEd,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import type { ExecutionStatus, DataflowRun, DatasetRef } from '@elaraai/e3-types';
6
+ import type { StorageBackend, ObjectStore, RefStore, DatasetRefStore, LockService, LockHandle, LockOperation, LockState, LogStore, LogChunk } from '../interfaces.js';
7
+ import { InMemoryRepoStore } from './InMemoryRepoStore.js';
8
+ /**
9
+ * In-memory implementation of ObjectStore for testing.
10
+ */
11
+ declare class InMemoryObjectStore implements ObjectStore {
12
+ private objects;
13
+ private getRepoObjects;
14
+ write(repo: string, data: Uint8Array): Promise<string>;
15
+ writeStream(repo: string, stream: AsyncIterable<Uint8Array>): Promise<string>;
16
+ read(repo: string, hash: string): Promise<Uint8Array>;
17
+ exists(repo: string, hash: string): Promise<boolean>;
18
+ stat(repo: string, hash: string): Promise<{
19
+ size: number;
20
+ }>;
21
+ list(repo: string): Promise<string[]>;
22
+ count(repo: string): Promise<number>;
23
+ clear(): void;
24
+ }
25
+ /**
26
+ * In-memory implementation of RefStore for testing.
27
+ */
28
+ declare class InMemoryRefStore implements RefStore {
29
+ private packages;
30
+ private workspaces;
31
+ private executions;
32
+ private dataflowRuns;
33
+ private getPackages;
34
+ private getWorkspaces;
35
+ private getExecutions;
36
+ private getDataflowRuns;
37
+ private makePackageKey;
38
+ private makeExecutionKey;
39
+ private makeInputsKey;
40
+ private makeDataflowRunKey;
41
+ packageList(repo: string): Promise<{
42
+ name: string;
43
+ version: string;
44
+ }[]>;
45
+ packageResolve(repo: string, name: string, version: string): Promise<string | null>;
46
+ packageWrite(repo: string, name: string, version: string, hash: string): Promise<void>;
47
+ packageRemove(repo: string, name: string, version: string): Promise<void>;
48
+ workspaceList(repo: string): Promise<string[]>;
49
+ workspaceRead(repo: string, name: string): Promise<Uint8Array | null>;
50
+ workspaceWrite(repo: string, name: string, state: Uint8Array): Promise<void>;
51
+ workspaceRemove(repo: string, name: string): Promise<void>;
52
+ executionGet(repo: string, taskHash: string, inputsHash: string, executionId: string): Promise<ExecutionStatus | null>;
53
+ executionWrite(repo: string, taskHash: string, inputsHash: string, executionId: string, status: ExecutionStatus): Promise<void>;
54
+ executionListIds(repo: string, taskHash: string, inputsHash: string): Promise<string[]>;
55
+ executionGetLatest(repo: string, taskHash: string, inputsHash: string): Promise<ExecutionStatus | null>;
56
+ executionGetLatestOutput(repo: string, taskHash: string, inputsHash: string): Promise<string | null>;
57
+ executionList(repo: string): Promise<{
58
+ taskHash: string;
59
+ inputsHash: string;
60
+ }[]>;
61
+ executionListForTask(repo: string, taskHash: string): Promise<string[]>;
62
+ dataflowRunGet(repo: string, workspace: string, runId: string): Promise<DataflowRun | null>;
63
+ dataflowRunWrite(repo: string, workspace: string, run: DataflowRun): Promise<void>;
64
+ dataflowRunList(repo: string, workspace: string): Promise<string[]>;
65
+ dataflowRunGetLatest(repo: string, workspace: string): Promise<DataflowRun | null>;
66
+ dataflowRunDelete(repo: string, workspace: string, runId: string): Promise<void>;
67
+ clear(): void;
68
+ }
69
+ /**
70
+ * In-memory implementation of LockService for testing.
71
+ *
72
+ * Supports shared/exclusive lock modes:
73
+ * - Multiple shared holders can coexist on the same resource
74
+ * - Exclusive locks require zero holders
75
+ * - Shared locks fail if an exclusive holder exists
76
+ */
77
+ declare class InMemoryLockService implements LockService {
78
+ private exclusiveLocks;
79
+ private sharedLockCounts;
80
+ private makeLockKey;
81
+ acquire(repo: string, resource: string, operation: LockOperation, options?: {
82
+ wait?: boolean;
83
+ timeout?: number;
84
+ mode?: 'shared' | 'exclusive';
85
+ }): Promise<LockHandle | null>;
86
+ getState(repo: string, resource: string): Promise<LockState | null>;
87
+ isHolderAlive(_holder: string): Promise<boolean>;
88
+ clear(): void;
89
+ }
90
+ /**
91
+ * In-memory implementation of LogStore for testing.
92
+ */
93
+ declare class InMemoryLogStore implements LogStore {
94
+ private logs;
95
+ private makeLogKey;
96
+ append(repo: string, taskHash: string, inputsHash: string, executionId: string, stream: 'stdout' | 'stderr', data: string): Promise<void>;
97
+ read(repo: string, taskHash: string, inputsHash: string, executionId: string, stream: 'stdout' | 'stderr', options?: {
98
+ offset?: number;
99
+ limit?: number;
100
+ }): Promise<LogChunk>;
101
+ clear(): void;
102
+ }
103
+ /**
104
+ * In-memory implementation of DatasetRefStore for testing.
105
+ */
106
+ declare class InMemoryDatasetRefStore implements DatasetRefStore {
107
+ private refs;
108
+ private makeKey;
109
+ private makePrefix;
110
+ read(repo: string, ws: string, path: string): Promise<DatasetRef | null>;
111
+ write(repo: string, ws: string, path: string, ref: DatasetRef): Promise<void>;
112
+ list(repo: string, ws: string): Promise<string[]>;
113
+ remove(repo: string, ws: string, path: string): Promise<void>;
114
+ removeAll(repo: string, ws: string): Promise<void>;
115
+ clear(): void;
116
+ }
117
+ /**
118
+ * In-memory implementation of StorageBackend for testing.
119
+ *
120
+ * All data is stored in memory maps. Useful for unit tests
121
+ * where filesystem access is not needed.
122
+ */
123
+ export declare class InMemoryStorage implements StorageBackend {
124
+ readonly objects: InMemoryObjectStore;
125
+ readonly refs: InMemoryRefStore;
126
+ readonly locks: InMemoryLockService;
127
+ readonly logs: InMemoryLogStore;
128
+ readonly repos: InMemoryRepoStore;
129
+ readonly datasets: InMemoryDatasetRefStore;
130
+ constructor();
131
+ validateRepository(repo: string): Promise<void>;
132
+ /**
133
+ * Clear all stored data.
134
+ * Useful for test cleanup.
135
+ */
136
+ clear(): void;
137
+ }
138
+ export {};
139
+ //# sourceMappingURL=InMemory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