@elaraai/e3-web 0.0.0-stage → 1.0.85
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/LICENSE.md +54 -0
- package/README.md +395 -2
- package/dist/src/app.d.ts +91 -0
- package/dist/src/app.d.ts.map +1 -0
- package/dist/src/app.js +112 -0
- package/dist/src/app.js.map +1 -0
- package/dist/src/bridge/bridge.spec.d.ts +6 -0
- package/dist/src/bridge/bridge.spec.d.ts.map +1 -0
- package/dist/src/bridge/bridge.spec.js +56 -0
- package/dist/src/bridge/bridge.spec.js.map +1 -0
- package/dist/src/bridge/page.d.ts +149 -0
- package/dist/src/bridge/page.d.ts.map +1 -0
- package/dist/src/bridge/page.js +328 -0
- package/dist/src/bridge/page.js.map +1 -0
- package/dist/src/bridge/protocol.d.ts +181 -0
- package/dist/src/bridge/protocol.d.ts.map +1 -0
- package/dist/src/bridge/protocol.js +113 -0
- package/dist/src/bridge/protocol.js.map +1 -0
- package/dist/src/bridge/worker.d.ts +124 -0
- package/dist/src/bridge/worker.d.ts.map +1 -0
- package/dist/src/bridge/worker.js +185 -0
- package/dist/src/bridge/worker.js.map +1 -0
- package/dist/src/browser/bridge.page.d.ts +12 -0
- package/dist/src/browser/bridge.page.d.ts.map +1 -0
- package/dist/src/browser/bridge.page.js +79 -0
- package/dist/src/browser/bridge.page.js.map +1 -0
- package/dist/src/browser/bridge.spec.d.ts +6 -0
- package/dist/src/browser/bridge.spec.d.ts.map +1 -0
- package/dist/src/browser/bridge.spec.js +105 -0
- package/dist/src/browser/bridge.spec.js.map +1 -0
- package/dist/src/browser/bridge.worker.d.ts +6 -0
- package/dist/src/browser/bridge.worker.d.ts.map +1 -0
- package/dist/src/browser/bridge.worker.js +35 -0
- package/dist/src/browser/bridge.worker.js.map +1 -0
- package/dist/src/browser/compliance.d.ts +68 -0
- package/dist/src/browser/compliance.d.ts.map +1 -0
- package/dist/src/browser/compliance.js +30 -0
- package/dist/src/browser/compliance.js.map +1 -0
- package/dist/src/browser/compliance.page.d.ts +6 -0
- package/dist/src/browser/compliance.page.d.ts.map +1 -0
- package/dist/src/browser/compliance.page.js +204 -0
- package/dist/src/browser/compliance.page.js.map +1 -0
- package/dist/src/browser/compliance.spec.d.ts +6 -0
- package/dist/src/browser/compliance.spec.d.ts.map +1 -0
- package/dist/src/browser/compliance.spec.js +147 -0
- package/dist/src/browser/compliance.spec.js.map +1 -0
- package/dist/src/browser/e3-api-1.spec.d.ts +6 -0
- package/dist/src/browser/e3-api-1.spec.d.ts.map +1 -0
- package/dist/src/browser/e3-api-1.spec.js +12 -0
- package/dist/src/browser/e3-api-1.spec.js.map +1 -0
- package/dist/src/browser/e3-api-2.spec.d.ts +6 -0
- package/dist/src/browser/e3-api-2.spec.d.ts.map +1 -0
- package/dist/src/browser/e3-api-2.spec.js +12 -0
- package/dist/src/browser/e3-api-2.spec.js.map +1 -0
- package/dist/src/browser/e3-api-3.spec.d.ts +6 -0
- package/dist/src/browser/e3-api-3.spec.d.ts.map +1 -0
- package/dist/src/browser/e3-api-3.spec.js +12 -0
- package/dist/src/browser/e3-api-3.spec.js.map +1 -0
- package/dist/src/browser/e3-api-parts.spec.d.ts +6 -0
- package/dist/src/browser/e3-api-parts.spec.d.ts.map +1 -0
- package/dist/src/browser/e3-api-parts.spec.js +45 -0
- package/dist/src/browser/e3-api-parts.spec.js.map +1 -0
- package/dist/src/browser/e3-api.d.ts +28 -0
- package/dist/src/browser/e3-api.d.ts.map +1 -0
- package/dist/src/browser/e3-api.js +144 -0
- package/dist/src/browser/e3-api.js.map +1 -0
- package/dist/src/browser/e3-client.worker.d.ts +6 -0
- package/dist/src/browser/e3-client.worker.d.ts.map +1 -0
- package/dist/src/browser/e3-client.worker.js +19 -0
- package/dist/src/browser/e3-client.worker.js.map +1 -0
- package/dist/src/browser/e3-forward.d.ts +27 -0
- package/dist/src/browser/e3-forward.d.ts.map +1 -0
- package/dist/src/browser/e3-forward.js +81 -0
- package/dist/src/browser/e3-forward.js.map +1 -0
- package/dist/src/browser/e3-forward.spec.d.ts +6 -0
- package/dist/src/browser/e3-forward.spec.d.ts.map +1 -0
- package/dist/src/browser/e3-forward.spec.js +84 -0
- package/dist/src/browser/e3-forward.spec.js.map +1 -0
- package/dist/src/browser/e3-port.worker.d.ts +6 -0
- package/dist/src/browser/e3-port.worker.d.ts.map +1 -0
- package/dist/src/browser/e3-port.worker.js +21 -0
- package/dist/src/browser/e3-port.worker.js.map +1 -0
- package/dist/src/browser/e3-unit.worker.d.ts +6 -0
- package/dist/src/browser/e3-unit.worker.d.ts.map +1 -0
- package/dist/src/browser/e3-unit.worker.js +18 -0
- package/dist/src/browser/e3-unit.worker.js.map +1 -0
- package/dist/src/browser/e3-wire.d.ts +43 -0
- package/dist/src/browser/e3-wire.d.ts.map +1 -0
- package/dist/src/browser/e3-wire.js +32 -0
- package/dist/src/browser/e3-wire.js.map +1 -0
- package/dist/src/browser/e3.page.d.ts +21 -0
- package/dist/src/browser/e3.page.d.ts.map +1 -0
- package/dist/src/browser/e3.page.js +119 -0
- package/dist/src/browser/e3.page.js.map +1 -0
- package/dist/src/browser/e3.spec.d.ts +6 -0
- package/dist/src/browser/e3.spec.d.ts.map +1 -0
- package/dist/src/browser/e3.spec.js +358 -0
- package/dist/src/browser/e3.spec.js.map +1 -0
- package/dist/src/browser/e3.worker.d.ts +6 -0
- package/dist/src/browser/e3.worker.d.ts.map +1 -0
- package/dist/src/browser/e3.worker.js +38 -0
- package/dist/src/browser/e3.worker.js.map +1 -0
- package/dist/src/browser/harness.d.ts +175 -0
- package/dist/src/browser/harness.d.ts.map +1 -0
- package/dist/src/browser/harness.js +375 -0
- package/dist/src/browser/harness.js.map +1 -0
- package/dist/src/browser/page.d.ts +47 -0
- package/dist/src/browser/page.d.ts.map +1 -0
- package/dist/src/browser/page.js +47 -0
- package/dist/src/browser/page.js.map +1 -0
- package/dist/src/browser/repository.page.d.ts +85 -0
- package/dist/src/browser/repository.page.d.ts.map +1 -0
- package/dist/src/browser/repository.page.js +271 -0
- package/dist/src/browser/repository.page.js.map +1 -0
- package/dist/src/browser/runner.page.d.ts +6 -0
- package/dist/src/browser/runner.page.d.ts.map +1 -0
- package/dist/src/browser/runner.page.js +62 -0
- package/dist/src/browser/runner.page.js.map +1 -0
- package/dist/src/browser/runner.spec.d.ts +6 -0
- package/dist/src/browser/runner.spec.d.ts.map +1 -0
- package/dist/src/browser/runner.spec.js +46 -0
- package/dist/src/browser/runner.spec.js.map +1 -0
- package/dist/src/browser/storage.page.d.ts +6 -0
- package/dist/src/browser/storage.page.d.ts.map +1 -0
- package/dist/src/browser/storage.page.js +289 -0
- package/dist/src/browser/storage.page.js.map +1 -0
- package/dist/src/browser/storage.spec.d.ts +6 -0
- package/dist/src/browser/storage.spec.d.ts.map +1 -0
- package/dist/src/browser/storage.spec.js +211 -0
- package/dist/src/browser/storage.spec.js.map +1 -0
- package/dist/src/browser/unit.worker.d.ts +6 -0
- package/dist/src/browser/unit.worker.d.ts.map +1 -0
- package/dist/src/browser/unit.worker.js +17 -0
- package/dist/src/browser/unit.worker.js.map +1 -0
- package/dist/src/execution/WebTaskRunner.d.ts +159 -0
- package/dist/src/execution/WebTaskRunner.d.ts.map +1 -0
- package/dist/src/execution/WebTaskRunner.js +581 -0
- package/dist/src/execution/WebTaskRunner.js.map +1 -0
- package/dist/src/execution/WebTaskRunner.spec.d.ts +6 -0
- package/dist/src/execution/WebTaskRunner.spec.d.ts.map +1 -0
- package/dist/src/execution/WebTaskRunner.spec.js +91 -0
- package/dist/src/execution/WebTaskRunner.spec.js.map +1 -0
- package/dist/src/execution/e3-platform.d.ts +41 -0
- package/dist/src/execution/e3-platform.d.ts.map +1 -0
- package/dist/src/execution/e3-platform.js +52 -0
- package/dist/src/execution/e3-platform.js.map +1 -0
- package/dist/src/execution/in-process.d.ts +32 -0
- package/dist/src/execution/in-process.d.ts.map +1 -0
- package/dist/src/execution/in-process.js +89 -0
- package/dist/src/execution/in-process.js.map +1 -0
- package/dist/src/execution/pool.d.ts +172 -0
- package/dist/src/execution/pool.d.ts.map +1 -0
- package/dist/src/execution/pool.js +352 -0
- package/dist/src/execution/pool.js.map +1 -0
- package/dist/src/execution/pool.spec.d.ts +6 -0
- package/dist/src/execution/pool.spec.d.ts.map +1 -0
- package/dist/src/execution/pool.spec.js +252 -0
- package/dist/src/execution/pool.spec.js.map +1 -0
- package/dist/src/execution/protocol.d.ts +108 -0
- package/dist/src/execution/protocol.d.ts.map +1 -0
- package/dist/src/execution/protocol.js +27 -0
- package/dist/src/execution/protocol.js.map +1 -0
- package/dist/src/execution/unit-server.d.ts +131 -0
- package/dist/src/execution/unit-server.d.ts.map +1 -0
- package/dist/src/execution/unit-server.js +142 -0
- package/dist/src/execution/unit-server.js.map +1 -0
- package/dist/src/index.d.ts +39 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.spec.d.ts +6 -0
- package/dist/src/index.spec.d.ts.map +1 -0
- package/dist/src/index.spec.js +212 -0
- package/dist/src/index.spec.js.map +1 -0
- package/dist/src/node.d.ts +12 -0
- package/dist/src/node.d.ts.map +1 -0
- package/dist/src/node.js +12 -0
- package/dist/src/node.js.map +1 -0
- package/dist/src/storage/WebStateStore.d.ts +64 -0
- package/dist/src/storage/WebStateStore.d.ts.map +1 -0
- package/dist/src/storage/WebStateStore.js +237 -0
- package/dist/src/storage/WebStateStore.js.map +1 -0
- package/dist/src/storage/WebStorage.d.ts +225 -0
- package/dist/src/storage/WebStorage.d.ts.map +1 -0
- package/dist/src/storage/WebStorage.js +1462 -0
- package/dist/src/storage/WebStorage.js.map +1 -0
- package/dist/src/storage/adapters.d.ts +610 -0
- package/dist/src/storage/adapters.d.ts.map +1 -0
- package/dist/src/storage/adapters.js +246 -0
- package/dist/src/storage/adapters.js.map +1 -0
- package/dist/src/storage/indexeddb.d.ts +93 -0
- package/dist/src/storage/indexeddb.d.ts.map +1 -0
- package/dist/src/storage/indexeddb.js +384 -0
- package/dist/src/storage/indexeddb.js.map +1 -0
- package/dist/src/storage/indexeddb.spec.d.ts +6 -0
- package/dist/src/storage/indexeddb.spec.d.ts.map +1 -0
- package/dist/src/storage/indexeddb.spec.js +77 -0
- package/dist/src/storage/indexeddb.spec.js.map +1 -0
- package/dist/src/storage/memory.d.ts +275 -0
- package/dist/src/storage/memory.d.ts.map +1 -0
- package/dist/src/storage/memory.js +724 -0
- package/dist/src/storage/memory.js.map +1 -0
- package/dist/src/storage/memory.spec.d.ts +6 -0
- package/dist/src/storage/memory.spec.d.ts.map +1 -0
- package/dist/src/storage/memory.spec.js +71 -0
- package/dist/src/storage/memory.spec.js.map +1 -0
- package/dist/src/storage/node-files.d.ts +38 -0
- package/dist/src/storage/node-files.d.ts.map +1 -0
- package/dist/src/storage/node-files.js +148 -0
- package/dist/src/storage/node-files.js.map +1 -0
- package/dist/src/storage/node-files.spec.d.ts +6 -0
- package/dist/src/storage/node-files.spec.d.ts.map +1 -0
- package/dist/src/storage/node-files.spec.js +40 -0
- package/dist/src/storage/node-files.spec.js.map +1 -0
- package/dist/src/storage/opfs.d.ts +145 -0
- package/dist/src/storage/opfs.d.ts.map +1 -0
- package/dist/src/storage/opfs.js +514 -0
- package/dist/src/storage/opfs.js.map +1 -0
- package/dist/src/storage/opfs.spec.d.ts +6 -0
- package/dist/src/storage/opfs.spec.d.ts.map +1 -0
- package/dist/src/storage/opfs.spec.js +51 -0
- package/dist/src/storage/opfs.spec.js.map +1 -0
- package/dist/src/storage/record-keys.d.ts +78 -0
- package/dist/src/storage/record-keys.d.ts.map +1 -0
- package/dist/src/storage/record-keys.js +71 -0
- package/dist/src/storage/record-keys.js.map +1 -0
- package/dist/src/storage/stores.spec.d.ts +6 -0
- package/dist/src/storage/stores.spec.d.ts.map +1 -0
- package/dist/src/storage/stores.spec.js +326 -0
- package/dist/src/storage/stores.spec.js.map +1 -0
- package/dist/src/storage/web-locks.d.ts +103 -0
- package/dist/src/storage/web-locks.d.ts.map +1 -0
- package/dist/src/storage/web-locks.js +228 -0
- package/dist/src/storage/web-locks.js.map +1 -0
- package/dist/src/testing/adapter-contract.d.ts +116 -0
- package/dist/src/testing/adapter-contract.d.ts.map +1 -0
- package/dist/src/testing/adapter-contract.js +769 -0
- package/dist/src/testing/adapter-contract.js.map +1 -0
- package/dist/src/testing/assert.d.ts +75 -0
- package/dist/src/testing/assert.d.ts.map +1 -0
- package/dist/src/testing/assert.js +146 -0
- package/dist/src/testing/assert.js.map +1 -0
- package/dist/src/testing/assert.spec.d.ts +6 -0
- package/dist/src/testing/assert.spec.d.ts.map +1 -0
- package/dist/src/testing/assert.spec.js +62 -0
- package/dist/src/testing/assert.spec.js.map +1 -0
- package/dist/src/testing/bridge-contract.d.ts +55 -0
- package/dist/src/testing/bridge-contract.d.ts.map +1 -0
- package/dist/src/testing/bridge-contract.js +376 -0
- package/dist/src/testing/bridge-contract.js.map +1 -0
- package/dist/src/testing/bridge-handler.d.ts +35 -0
- package/dist/src/testing/bridge-handler.d.ts.map +1 -0
- package/dist/src/testing/bridge-handler.js +108 -0
- package/dist/src/testing/bridge-handler.js.map +1 -0
- package/dist/src/testing/callers.d.ts +29 -0
- package/dist/src/testing/callers.d.ts.map +1 -0
- package/dist/src/testing/callers.js +24 -0
- package/dist/src/testing/callers.js.map +1 -0
- package/dist/src/testing/e3-fixtures.d.ts +38 -0
- package/dist/src/testing/e3-fixtures.d.ts.map +1 -0
- package/dist/src/testing/e3-fixtures.js +126 -0
- package/dist/src/testing/e3-fixtures.js.map +1 -0
- package/dist/src/testing/hold-platform.d.ts +33 -0
- package/dist/src/testing/hold-platform.d.ts.map +1 -0
- package/dist/src/testing/hold-platform.js +41 -0
- package/dist/src/testing/hold-platform.js.map +1 -0
- package/dist/src/testing/runner-cases.d.ts +112 -0
- package/dist/src/testing/runner-cases.d.ts.map +1 -0
- package/dist/src/testing/runner-cases.js +959 -0
- package/dist/src/testing/runner-cases.js.map +1 -0
- package/dist/src/testing/runner-fixtures.d.ts +13 -0
- package/dist/src/testing/runner-fixtures.d.ts.map +1 -0
- package/dist/src/testing/runner-fixtures.js +173 -0
- package/dist/src/testing/runner-fixtures.js.map +1 -0
- package/dist/src/testing/test-platform.d.ts +73 -0
- package/dist/src/testing/test-platform.d.ts.map +1 -0
- package/dist/src/testing/test-platform.js +143 -0
- package/dist/src/testing/test-platform.js.map +1 -0
- package/dist/src/transfer/WebTransferBackend.d.ts +780 -0
- package/dist/src/transfer/WebTransferBackend.d.ts.map +1 -0
- package/dist/src/transfer/WebTransferBackend.js +1140 -0
- package/dist/src/transfer/WebTransferBackend.js.map +1 -0
- package/dist/src/transfer/WebTransferBackend.spec.d.ts +6 -0
- package/dist/src/transfer/WebTransferBackend.spec.d.ts.map +1 -0
- package/dist/src/transfer/WebTransferBackend.spec.js +582 -0
- package/dist/src/transfer/WebTransferBackend.spec.js.map +1 -0
- package/dist/src/transfer/endpoints.d.ts +46 -0
- package/dist/src/transfer/endpoints.d.ts.map +1 -0
- package/dist/src/transfer/endpoints.js +157 -0
- package/dist/src/transfer/endpoints.js.map +1 -0
- package/dist/src/units.d.ts +51 -0
- package/dist/src/units.d.ts.map +1 -0
- package/dist/src/units.js +74 -0
- package/dist/src/units.js.map +1 -0
- package/dist/src/worker.d.ts +126 -0
- package/dist/src/worker.d.ts.map +1 -0
- package/dist/src/worker.js +186 -0
- package/dist/src/worker.js.map +1 -0
- package/dist/src/worker.spec.d.ts +6 -0
- package/dist/src/worker.spec.d.ts.map +1 -0
- package/dist/src/worker.spec.js +195 -0
- package/dist/src/worker.spec.js.map +1 -0
- package/package.json +76 -3
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The e3 worker: where e3 itself runs in a browser — its storage, its
|
|
7
|
+
* orchestrator, its runner and its API. An app's e3 worker script calls
|
|
8
|
+
* {@link serveE3}, and its page connects with `createWebE3` from
|
|
9
|
+
* `@elaraai/e3-web`.
|
|
10
|
+
*
|
|
11
|
+
* This entry (`@elaraai/e3-web/worker`) reaches nothing of Node: its routes
|
|
12
|
+
* are e3-api-server's portable entry, and its logic e3-core's.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // e3.worker.ts
|
|
17
|
+
* import { serveE3 } from '@elaraai/e3-web/worker';
|
|
18
|
+
* serveE3({
|
|
19
|
+
* units: () => new Worker(new URL('./unit.worker.ts', import.meta.url), { type: 'module' }),
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
import { LocalOrchestrator } from '@elaraai/e3-core/portable';
|
|
26
|
+
import { oneShotAccessByRoles } from '@elaraai/e3-api-server/portable';
|
|
27
|
+
import { createWebApp } from './app.js';
|
|
28
|
+
import { serveBridge } from './bridge/worker.js';
|
|
29
|
+
import { UnitPool } from './execution/pool.js';
|
|
30
|
+
import { WebTaskRunner, wholeIntakeLimitOf } from './execution/WebTaskRunner.js';
|
|
31
|
+
import { WebStateStore } from './storage/WebStateStore.js';
|
|
32
|
+
import { openWebStorage } from './storage/WebStorage.js';
|
|
33
|
+
import { WebTransferBackend } from './transfer/WebTransferBackend.js';
|
|
34
|
+
export { oneShotAccessByRoles } from '@elaraai/e3-api-server/portable';
|
|
35
|
+
/**
|
|
36
|
+
* Runs e3 in this e3 worker, and serves it to the page: what an app's e3
|
|
37
|
+
* worker script calls, once.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* It boots, in order:
|
|
41
|
+
* - the storage (`openWebStorage`), which a browser that lacks IndexedDB,
|
|
42
|
+
* OPFS or Web Locks refuses, naming the API: the page's `createWebE3`
|
|
43
|
+
* rejects with that refusal. Not persisted, it needs none of them;
|
|
44
|
+
* - the state store every dataflow run keeps its state in (`WebStateStore`);
|
|
45
|
+
* - the unit pool, which starts unit workers from {@link ServeE3Options.units}
|
|
46
|
+
* and hands each a port to this e3, and each repository's runner over it
|
|
47
|
+
* (`WebTaskRunner`);
|
|
48
|
+
* - the orchestrator (`LocalOrchestrator`), which records a split task's own
|
|
49
|
+
* execution under the tab's session, as the runner records every other;
|
|
50
|
+
* - the transfer backend (`WebTransferBackend`), which records what a closed
|
|
51
|
+
* tab left — a job, or an upload's commit — failed, naming why, and never
|
|
52
|
+
* runs it again, and forgets what is past its retention while the tab
|
|
53
|
+
* lives;
|
|
54
|
+
* - the app: e3-api-server's routes over all of it (`createWebApp`).
|
|
55
|
+
*
|
|
56
|
+
* Every request the page's `e3.fetch` posts is then answered by the app, and
|
|
57
|
+
* so is every request a unit's e3 platform functions make, over its worker's
|
|
58
|
+
* port; once the pool lets a unit worker go, what the e3 was answering for it
|
|
59
|
+
* is given up. The page is told whether the repositories outlive it.
|
|
60
|
+
*
|
|
61
|
+
* Over a `MessagePort`, the e3 closes once its page has gone: the page's
|
|
62
|
+
* `e3.close()` tells it, the Web Lock the page holds while it is connected is
|
|
63
|
+
* freed — its tab closed — or the port closes, where the platform says so (a
|
|
64
|
+
* browser's port does not). Its unit workers are terminated, and its storage
|
|
65
|
+
* closed, which frees the tab's session for the next.
|
|
66
|
+
*
|
|
67
|
+
* @param options - The unit workers, who may run what, and how the
|
|
68
|
+
* repositories are kept
|
|
69
|
+
* @param endpoint - What the page's messages come over: this worker's global
|
|
70
|
+
* scope unless given, or a `MessagePort`
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // e3.worker.ts — repositories in memory, gone with the page
|
|
75
|
+
* import { serveE3 } from '@elaraai/e3-web/worker';
|
|
76
|
+
* serveE3({
|
|
77
|
+
* units: () => new Worker(new URL('./unit.worker.ts', import.meta.url), { type: 'module' }),
|
|
78
|
+
* persist: false,
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function serveE3(options, endpoint) {
|
|
83
|
+
const running = start(options);
|
|
84
|
+
// A boot that failed is the page's to hear: the bridge tells it.
|
|
85
|
+
running.catch(() => undefined);
|
|
86
|
+
serveBridge(async () => (await running).boot, endpoint, {
|
|
87
|
+
// The page has gone: the e3 it was served goes with it. A boot that
|
|
88
|
+
// failed has nothing to close, and a close that fails has no one to tell.
|
|
89
|
+
onEnd: () => {
|
|
90
|
+
running.then((e3) => e3.close()).catch(() => undefined);
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Boots the e3 the worker runs.
|
|
96
|
+
*
|
|
97
|
+
* @throws {Error} When the storage cannot be opened — a browser API it keeps
|
|
98
|
+
* repositories with is missing, named — or a seam refuses its options: a
|
|
99
|
+
* whole-intake limit that is not a whole number of bytes, say.
|
|
100
|
+
*/
|
|
101
|
+
async function start(options) {
|
|
102
|
+
// The runners are made as repositories need them: what they would refuse is
|
|
103
|
+
// refused here, before anything opens.
|
|
104
|
+
const wholeIntakeLimit = wholeIntakeLimitOf(options.wholeIntakeLimit);
|
|
105
|
+
const persist = options.persist ?? true;
|
|
106
|
+
const storage = await openWebStorage({ persist, ...(options.name !== undefined && { name: options.name }) });
|
|
107
|
+
try {
|
|
108
|
+
const locks = storage.adapters.locks;
|
|
109
|
+
const stateStore = new WebStateStore(storage.adapters.records);
|
|
110
|
+
// Each unit worker's port to this e3, which its e3 platform functions
|
|
111
|
+
// reach the app through: served by the bridge, as the page is, but with no
|
|
112
|
+
// lifelines — the pool ends it as it lets the worker go, which gives up
|
|
113
|
+
// what the e3 was answering for it.
|
|
114
|
+
const connections = new Set();
|
|
115
|
+
const pool = new UnitPool({
|
|
116
|
+
units: options.units,
|
|
117
|
+
connect: () => {
|
|
118
|
+
const { port1, port2 } = new MessageChannel();
|
|
119
|
+
const bridge = serveBridge(() => Promise.resolve({ fetch: (request) => app.fetch(request), persist }), port1, { lifelines: false });
|
|
120
|
+
const connection = {
|
|
121
|
+
port: port2,
|
|
122
|
+
close: () => {
|
|
123
|
+
if (!connections.delete(connection))
|
|
124
|
+
return;
|
|
125
|
+
bridge.end();
|
|
126
|
+
port1.close();
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
connections.add(connection);
|
|
130
|
+
return connection;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
const runners = new Map();
|
|
134
|
+
const getRunner = (repo) => {
|
|
135
|
+
let runner = runners.get(repo);
|
|
136
|
+
if (runner === undefined) {
|
|
137
|
+
runner = new WebTaskRunner({ repo, pool, locks, wholeIntakeLimit });
|
|
138
|
+
runners.set(repo, runner);
|
|
139
|
+
}
|
|
140
|
+
return runner;
|
|
141
|
+
};
|
|
142
|
+
// A split task's own execution is recorded under the tab's session, as
|
|
143
|
+
// the runner records every unit's, so the next tab judges it by whether
|
|
144
|
+
// this one lives.
|
|
145
|
+
const owner = { pid: 0n, pidStartTime: 0n, bootId: locks.session };
|
|
146
|
+
const orchestrator = new LocalOrchestrator(stateStore, { owner: () => Promise.resolve(owner) });
|
|
147
|
+
const transfer = new WebTransferBackend({
|
|
148
|
+
storage,
|
|
149
|
+
getRunner,
|
|
150
|
+
...(options.transferPartBytes !== undefined && { partBytes: options.transferPartBytes }),
|
|
151
|
+
...(options.transferExportRoundBytes !== undefined && { exportRoundBytes: options.transferExportRoundBytes }),
|
|
152
|
+
});
|
|
153
|
+
const app = createWebApp({
|
|
154
|
+
storage,
|
|
155
|
+
transfer,
|
|
156
|
+
getRunner,
|
|
157
|
+
orchestrator,
|
|
158
|
+
stateStore,
|
|
159
|
+
width: pool.width,
|
|
160
|
+
// Who may run what a caller supplies, as the local server grants it:
|
|
161
|
+
// by roles where callers are known, and to the one caller otherwise.
|
|
162
|
+
access: options.access ?? (options.identify !== undefined ? oneShotAccessByRoles() : () => 'any'),
|
|
163
|
+
...(options.identify !== undefined && { identify: options.identify }),
|
|
164
|
+
...(options.transferCommitWaitMs !== undefined && { commitWaitMs: options.transferCommitWaitMs }),
|
|
165
|
+
});
|
|
166
|
+
// What a closed tab left — its jobs and its commits — is recorded failed,
|
|
167
|
+
// and what is past its retention forgotten, from here on.
|
|
168
|
+
await transfer.start();
|
|
169
|
+
return {
|
|
170
|
+
boot: { fetch: (request) => app.fetch(request), persist },
|
|
171
|
+
close: async () => {
|
|
172
|
+
await transfer.close();
|
|
173
|
+
// Every worker let go, and the services each was handed ended.
|
|
174
|
+
pool.close();
|
|
175
|
+
for (const connection of [...connections])
|
|
176
|
+
connection.close();
|
|
177
|
+
await storage.close();
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
await storage.close();
|
|
183
|
+
throw err;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,iBAAiB,EAAmB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAsB,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAwC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAuB,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAmB,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,oBAAoB,EAAqC,MAAM,iCAAiC,CAAC;AA0E1G;;;;;;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AE,CAAC;QAEvB,OAAO;YACL,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE;YAClE,KAAK,EAAE,KAAK,IAAI,EAAE;gBAChB,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACvB,+DAA+D;gBAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,KAAK,MAAM,UAAU,IAAI,CAAC,GAAG,WAAW,CAAC;oBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;gBAC9D,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.spec.d.ts","sourceRoot":"","sources":["../../src/worker.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `serveE3` in Node: the e3 worker's side at one end of a `MessageChannel`,
|
|
7
|
+
* and the page's `createWebE3` at the other, over in-memory repositories and
|
|
8
|
+
* units in this thread — how it boots, refuses to, closes with its page,
|
|
9
|
+
* answers a caller it does not know with what a server's auth answers, and
|
|
10
|
+
* serves e3's own platform functions to a unit, bound to itself. The shared
|
|
11
|
+
* API suites run against it in `libs/e3/test/integration`'s
|
|
12
|
+
* `web-compliance.spec.ts`, and in Chromium in `browser/e3-api.ts`'s parts.
|
|
13
|
+
*/
|
|
14
|
+
import { after, afterEach, before, describe, it } from 'node:test';
|
|
15
|
+
import assert from 'node:assert/strict';
|
|
16
|
+
import { ArrayType, East, IntegerType, StringType, decodeBeast2For, encodeBeast2For, encodeEastIR, none, variant } from '@elaraai/east';
|
|
17
|
+
import { ApiError, dataflowExecute, datasetGet, datasetSet, oneShotExecute, packageImport, repoCreate, repoList, workspaceCreate, workspaceDeploy, workspaceList, } from '@elaraai/e3-api-client';
|
|
18
|
+
import { assertDataflowSucceeded } from '@elaraai/e3-api-tests';
|
|
19
|
+
import { createWebE3, inProcessUnits } from './index.js';
|
|
20
|
+
import { serveE3 } from './worker.js';
|
|
21
|
+
import { ADMIN_TOKEN, READER_TOKEN, identifyCaller } from './testing/callers.js';
|
|
22
|
+
import { FIXTURE_VERSION, PLATFORM_PACKAGE, buildE3Fixtures } from './testing/e3-fixtures.js';
|
|
23
|
+
/** The e3s a test started, closed once it has run. */
|
|
24
|
+
const started = [];
|
|
25
|
+
/**
|
|
26
|
+
* Serves e3 over a `MessageChannel`, and connects to it.
|
|
27
|
+
*
|
|
28
|
+
* @param options - How the e3 is served: its repositories in memory unless
|
|
29
|
+
* the test says
|
|
30
|
+
* @returns The page's e3
|
|
31
|
+
*/
|
|
32
|
+
async function connect(options = {}) {
|
|
33
|
+
const { port1, port2 } = new MessageChannel();
|
|
34
|
+
serveE3({ units: inProcessUnits(), persist: false, ...options }, port1);
|
|
35
|
+
const e3 = await createWebE3(port2);
|
|
36
|
+
started.push(e3);
|
|
37
|
+
return e3;
|
|
38
|
+
}
|
|
39
|
+
/** Unit workers in this thread, each counted as it starts and as it ends. */
|
|
40
|
+
function countedUnits() {
|
|
41
|
+
const inProcess = inProcessUnits();
|
|
42
|
+
let live = 0;
|
|
43
|
+
let count = 0;
|
|
44
|
+
return {
|
|
45
|
+
units: () => {
|
|
46
|
+
const worker = inProcess();
|
|
47
|
+
const terminate = worker.terminate.bind(worker);
|
|
48
|
+
live++;
|
|
49
|
+
count++;
|
|
50
|
+
let ended = false;
|
|
51
|
+
worker.terminate = () => {
|
|
52
|
+
if (!ended) {
|
|
53
|
+
ended = true;
|
|
54
|
+
live--;
|
|
55
|
+
}
|
|
56
|
+
terminate();
|
|
57
|
+
};
|
|
58
|
+
return worker;
|
|
59
|
+
},
|
|
60
|
+
live: () => live,
|
|
61
|
+
startedCount: () => count,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Waits for a condition, failing with what it waits for after five seconds. */
|
|
65
|
+
async function until(condition, what) {
|
|
66
|
+
const deadline = Date.now() + 5_000;
|
|
67
|
+
while (!condition()) {
|
|
68
|
+
if (Date.now() > deadline)
|
|
69
|
+
assert.fail(`waited five seconds for ${what}`);
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
describe('serveE3, over a MessageChannel', () => {
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
for (const e3 of started.splice(0))
|
|
76
|
+
e3.close();
|
|
77
|
+
});
|
|
78
|
+
it('serves e3\'s API to the page, at the URL only e3.fetch answers, keeping nothing past the page', async () => {
|
|
79
|
+
const e3 = await connect();
|
|
80
|
+
assert.equal(e3.apiUrl, 'https://e3-web.invalid');
|
|
81
|
+
assert.equal(e3.persisted, false, 'repositories in memory are not kept past the page');
|
|
82
|
+
const opts = { token: null, fetch: e3.fetch };
|
|
83
|
+
assert.deepEqual(await repoList(e3.apiUrl, opts), []);
|
|
84
|
+
await repoCreate(e3.apiUrl, 'default', opts);
|
|
85
|
+
assert.deepEqual(await repoList(e3.apiUrl, opts), ['default']);
|
|
86
|
+
});
|
|
87
|
+
it('refuses to boot, naming the API, where the page cannot keep repositories, and createWebE3 rejects with it', async () => {
|
|
88
|
+
const { port1, port2 } = new MessageChannel();
|
|
89
|
+
serveE3({ units: inProcessUnits() }, port1);
|
|
90
|
+
await assert.rejects(createWebE3(port2), (err) => {
|
|
91
|
+
assert.match(err.message, /^createWebE3: the e3 worker did not start: e3-web cannot keep repositories in this page: it has no IndexedDB/);
|
|
92
|
+
assert.match(err.message, /persist: false/, 'naming the way to keep them in memory');
|
|
93
|
+
return true;
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
it('refuses to boot with a whole-intake limit that is not a whole number of bytes, naming it, and createWebE3 rejects with it', async () => {
|
|
97
|
+
for (const wholeIntakeLimit of [-1, 1.5]) {
|
|
98
|
+
const { port1, port2 } = new MessageChannel();
|
|
99
|
+
serveE3({ units: inProcessUnits(), persist: false, wholeIntakeLimit }, port1);
|
|
100
|
+
await assert.rejects(createWebE3(port2), {
|
|
101
|
+
message: new RegExp(`^createWebE3: the e3 worker did not start: RangeError: a runner's whole-intake limit is a whole number of bytes, zero or more, not ${wholeIntakeLimit}$`),
|
|
102
|
+
}, `a limit of ${wholeIntakeLimit}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
it('closes with its page: its unit workers end with the port', async () => {
|
|
106
|
+
const counted = countedUnits();
|
|
107
|
+
const e3 = await connect({ units: counted.units });
|
|
108
|
+
const opts = { token: null, fetch: e3.fetch };
|
|
109
|
+
const zip = (await buildE3Fixtures()).platform;
|
|
110
|
+
await repoCreate(e3.apiUrl, 'default', opts);
|
|
111
|
+
await packageImport(e3.apiUrl, 'default', zip, opts);
|
|
112
|
+
await workspaceCreate(e3.apiUrl, 'default', 'main', opts);
|
|
113
|
+
await workspaceDeploy(e3.apiUrl, 'default', 'main', `${PLATFORM_PACKAGE}@${FIXTURE_VERSION}`, opts);
|
|
114
|
+
await datasetSet(e3.apiUrl, 'default', 'main', [variant('field', 'inputs'), variant('field', 'repo')], encodeBeast2For(StringType)('default'), opts);
|
|
115
|
+
assertDataflowSucceeded(await dataflowExecute(e3.apiUrl, 'default', 'main', {}, opts));
|
|
116
|
+
assert.ok(counted.startedCount() > 0, 'units ran on workers of the pool');
|
|
117
|
+
assert.ok(counted.live() > 0, 'the pool keeps its idle workers');
|
|
118
|
+
e3.close();
|
|
119
|
+
await until(() => counted.live() === 0, 'every unit worker to end once the page\'s port closed');
|
|
120
|
+
await assert.rejects(repoList(e3.apiUrl, opts), /e3\.close\(\) has closed the e3 worker/);
|
|
121
|
+
});
|
|
122
|
+
describe('who calls, when the host says', () => {
|
|
123
|
+
/** Who calls, by the specs' tokens; a verifier that throws for one. */
|
|
124
|
+
const identify = (request) => {
|
|
125
|
+
if (request.headers.get('authorization') === 'Bearer breaks-the-verifier')
|
|
126
|
+
throw new Error('the verifier broke');
|
|
127
|
+
return identifyCaller(request);
|
|
128
|
+
};
|
|
129
|
+
it('answers a request to a repository from a caller it does not know 401, as a server\'s auth does, and a reader as one it knows', async () => {
|
|
130
|
+
const e3 = await connect({ identify });
|
|
131
|
+
await repoCreate(e3.apiUrl, 'default', { token: ADMIN_TOKEN, fetch: e3.fetch });
|
|
132
|
+
const url = `${e3.apiUrl}/api/repos/default/workspaces`;
|
|
133
|
+
const anonymous = await e3.fetch(url);
|
|
134
|
+
assert.equal(anonymous.status, 401, 'a request with no token');
|
|
135
|
+
assert.equal(await anonymous.text(), 'Unauthorized: Missing Bearer token');
|
|
136
|
+
const stranger = await e3.fetch(url, { headers: { authorization: 'Bearer a-token-no-one-has' } });
|
|
137
|
+
assert.equal(stranger.status, 401, 'a token it does not know');
|
|
138
|
+
assert.equal(await stranger.text(), 'Unauthorized: Invalid token');
|
|
139
|
+
const broken = await e3.fetch(url, { headers: { authorization: 'Bearer breaks-the-verifier' } });
|
|
140
|
+
assert.equal(broken.status, 401, 'a verifier that throws');
|
|
141
|
+
assert.equal(await broken.text(), 'Unauthorized: the verifier broke');
|
|
142
|
+
assert.deepEqual(await workspaceList(e3.apiUrl, 'default', { token: READER_TOKEN, fetch: e3.fetch }), [], 'a reader is answered');
|
|
143
|
+
});
|
|
144
|
+
it('grants by the caller\'s roles unless given access: an admin\'s one-shot with a platform runs, and a reader\'s is refused', async () => {
|
|
145
|
+
const e3 = await connect({ identify });
|
|
146
|
+
const admin = { token: ADMIN_TOKEN, fetch: e3.fetch };
|
|
147
|
+
await repoCreate(e3.apiUrl, 'default', admin);
|
|
148
|
+
await packageImport(e3.apiUrl, 'default', (await buildE3Fixtures()).platform, admin);
|
|
149
|
+
await workspaceCreate(e3.apiUrl, 'default', 'main', admin);
|
|
150
|
+
await workspaceDeploy(e3.apiUrl, 'default', 'main', `${PLATFORM_PACKAGE}@${FIXTURE_VERSION}`, admin);
|
|
151
|
+
const request = {
|
|
152
|
+
bodyIr: encodeEastIR(East.function([], IntegerType, () => 42n).toIR()),
|
|
153
|
+
args: [],
|
|
154
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
155
|
+
limits: none,
|
|
156
|
+
};
|
|
157
|
+
const ran = await oneShotExecute(e3.apiUrl, 'default', 'main', request, admin);
|
|
158
|
+
assert.equal(ran.outcome.type, 'success', 'the admin\'s runs');
|
|
159
|
+
await assert.rejects(oneShotExecute(e3.apiUrl, 'default', 'main', request, { token: READER_TOKEN, fetch: e3.fetch }), (err) => err instanceof ApiError && err.code === 'permission_denied', 'the reader\'s is refused');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('e3\'s own platform functions, in a unit', () => {
|
|
163
|
+
/** The global fetch, put back once the cases have run. */
|
|
164
|
+
const networkFetch = globalThis.fetch;
|
|
165
|
+
/** The requests that reached the global fetch. */
|
|
166
|
+
const escaped = [];
|
|
167
|
+
let zip;
|
|
168
|
+
before(async () => {
|
|
169
|
+
zip = (await buildE3Fixtures()).platform;
|
|
170
|
+
globalThis.fetch = ((input) => {
|
|
171
|
+
const url = input instanceof Request ? input.url : String(input);
|
|
172
|
+
escaped.push(url);
|
|
173
|
+
return Promise.reject(new TypeError(`a request went to the global fetch rather than e3.fetch: ${url}`));
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
after(() => {
|
|
177
|
+
globalThis.fetch = networkFetch;
|
|
178
|
+
});
|
|
179
|
+
it('lists this e3\'s workspaces: Platform.workspaceList, called from a unit, is answered by the e3 that started its worker', async () => {
|
|
180
|
+
const e3 = await connect();
|
|
181
|
+
const opts = { token: ADMIN_TOKEN, fetch: e3.fetch };
|
|
182
|
+
await repoCreate(e3.apiUrl, 'default', opts);
|
|
183
|
+
await packageImport(e3.apiUrl, 'default', zip, opts);
|
|
184
|
+
for (const name of ['main', 'other'])
|
|
185
|
+
await workspaceCreate(e3.apiUrl, 'default', name, opts);
|
|
186
|
+
await workspaceDeploy(e3.apiUrl, 'default', 'main', `${PLATFORM_PACKAGE}@${FIXTURE_VERSION}`, opts);
|
|
187
|
+
await datasetSet(e3.apiUrl, 'default', 'main', [variant('field', 'inputs'), variant('field', 'repo')], encodeBeast2For(StringType)('default'), opts);
|
|
188
|
+
assertDataflowSucceeded(await dataflowExecute(e3.apiUrl, 'default', 'main', {}, opts));
|
|
189
|
+
const { data } = await datasetGet(e3.apiUrl, 'default', 'main', [variant('field', 'tasks'), variant('field', 'workspaces'), variant('field', 'output')], opts);
|
|
190
|
+
assert.deepEqual(decodeBeast2For(ArrayType(StringType))(data), ['main', 'other'], 'the workspaces of the e3 the unit runs in');
|
|
191
|
+
assert.deepEqual(escaped, [], 'no request reached the network');
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
//# sourceMappingURL=worker.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.spec.js","sourceRoot":"","sources":["../../src/worker.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxI,OAAO,EACL,QAAQ,EACR,eAAe,EACf,UAAU,EACV,UAAU,EAC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gCAAgC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elaraai/e3-web",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "1.0.85",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "East Execution Engine in the browser - e3 in a page: its storage over IndexedDB, OPFS and Web Locks, its units on Web Workers, and its API answered in the page",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/src/index.d.ts",
|
|
11
|
+
"default": "./dist/src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./worker": {
|
|
14
|
+
"types": "./dist/src/worker.d.ts",
|
|
15
|
+
"default": "./dist/src/worker.js"
|
|
16
|
+
},
|
|
17
|
+
"./units": {
|
|
18
|
+
"types": "./dist/src/units.d.ts",
|
|
19
|
+
"default": "./dist/src/units.js"
|
|
20
|
+
},
|
|
21
|
+
"./node": {
|
|
22
|
+
"types": "./dist/src/node.d.ts",
|
|
23
|
+
"default": "./dist/src/node.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/src",
|
|
28
|
+
"!dist/src/**/*.spec.*",
|
|
29
|
+
"!dist/src/browser/**",
|
|
30
|
+
"!dist/src/testing/**",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"keywords": [
|
|
35
|
+
"east",
|
|
36
|
+
"e3",
|
|
37
|
+
"browser",
|
|
38
|
+
"indexeddb",
|
|
39
|
+
"opfs"
|
|
40
|
+
],
|
|
41
|
+
"license": "BUSL-1.1",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/elaraai/east-workspace.git",
|
|
45
|
+
"directory": "libs/e3/packages/e3-web"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22.2.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"hono": "^4.6.0",
|
|
52
|
+
"@elaraai/e3-api-client": "1.0.85",
|
|
53
|
+
"@elaraai/e3-types": "1.0.85",
|
|
54
|
+
"@elaraai/east-web-std": "1.0.85",
|
|
55
|
+
"@elaraai/e3-api-server": "1.0.85",
|
|
56
|
+
"@elaraai/e3-core": "1.0.85"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@elaraai/east": "1.0.85"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^22.0.0",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
64
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
65
|
+
"esbuild": "^0.27.2",
|
|
66
|
+
"eslint": "^9.0.0",
|
|
67
|
+
"eslint-plugin-headers": "^1.3.3",
|
|
68
|
+
"playwright-core": "~1.59.0",
|
|
69
|
+
"typescript": "^5.6.0",
|
|
70
|
+
"@elaraai/e3": "1.0.85",
|
|
71
|
+
"@elaraai/e3-api-tests": "1.0.85"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsc",
|
|
75
|
+
"test": "npm run build && node --enable-source-maps --test-reporter=spec --test-timeout=480000 --test 'dist/src/**/*.spec.js'",
|
|
76
|
+
"lint": "eslint .",
|
|
77
|
+
"lint:fix": "eslint . --fix"
|
|
78
|
+
}
|
|
6
79
|
}
|