@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,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The parts the API suites run in against e3 in Chromium
|
|
7
|
+
* (`e3-api.ts`): together they run every suite e3-api-tests has, each once,
|
|
8
|
+
* so a suite added there runs here too, or this fails naming it; each part
|
|
9
|
+
* has its spec file; and a spec file runs the part its name names.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, it } from 'node:test';
|
|
12
|
+
import assert from 'node:assert/strict';
|
|
13
|
+
import { readdirSync } from 'node:fs';
|
|
14
|
+
import { dirname } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
import { apiTestSuites } from '@elaraai/e3-api-tests';
|
|
17
|
+
import { API_SUITE_PARTS, apiSuitePartOf } from './e3-api.js';
|
|
18
|
+
describe('the parts the API suites run in against e3 in Chromium', () => {
|
|
19
|
+
it('run every API suite e3-api-tests has, each in one part', () => {
|
|
20
|
+
const named = API_SUITE_PARTS.flat();
|
|
21
|
+
const twice = named.filter((suite, at) => named.indexOf(suite) !== at);
|
|
22
|
+
assert.deepEqual(twice, [], 'no suite runs in two parts');
|
|
23
|
+
const suites = Object.keys(apiTestSuites);
|
|
24
|
+
assert.deepEqual(suites.filter((suite) => !named.includes(suite)), [], 'every suite runs in a part');
|
|
25
|
+
assert.deepEqual(named.filter((suite) => !suites.includes(suite)), [], 'every suite a part names is one e3-api-tests has');
|
|
26
|
+
});
|
|
27
|
+
it('has a spec file for each part, e3-api-<n>.spec.ts, and none for a part it has not', () => {
|
|
28
|
+
const files = readdirSync(dirname(fileURLToPath(import.meta.url)))
|
|
29
|
+
.map((file) => /^e3-api-(\d+)\.spec\.js$/.exec(file))
|
|
30
|
+
.filter((match) => match !== null)
|
|
31
|
+
.map((match) => Number(match[1]))
|
|
32
|
+
.sort((a, b) => a - b);
|
|
33
|
+
assert.deepEqual(files, API_SUITE_PARTS.map((_, at) => at + 1));
|
|
34
|
+
});
|
|
35
|
+
it('runs in each spec file the part its name names, and refuses a file whose name names none', () => {
|
|
36
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
37
|
+
for (const [at] of API_SUITE_PARTS.entries()) {
|
|
38
|
+
assert.equal(apiSuitePartOf(new URL(`file://${here}/e3-api-${at + 1}.spec.js`).href), at, `e3-api-${at + 1}.spec runs part ${at + 1}`);
|
|
39
|
+
}
|
|
40
|
+
for (const file of [`${here}/e3-api-0.spec.js`, `${here}/e3-api-${API_SUITE_PARTS.length + 1}.spec.js`, `${here}/e3-api.js`, `${here}/e3-api-parts.spec.js`]) {
|
|
41
|
+
assert.throws(() => apiSuitePartOf(file), /names no part of the API suites/, file);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=e3-api-parts.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-api-parts.spec.js","sourceRoot":"","sources":["../../../src/browser/e3-api-parts.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,QAAQ,CAAC,wDAAwD,EAAE,GAAG,EAAE;IACtE,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACvE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,4BAA4B,CAAC,CAAC;QA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,CAAC,CAAC,CAAC;QACrD,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,UAAU,IAAI,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QACzI,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,mBAAmB,EAAE,GAAG,IAAI,WAAW,eAAe,CAAC,MAAM,GAAG,CAAC,UAAU,EAAE,GAAG,IAAI,YAAY,EAAE,GAAG,IAAI,uBAAuB,CAAC,EAAE,CAAC;YAC7J,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,iCAAiC,EAAE,IAAI,CAAC,CAAC;QACrF,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The parts the suites run in, each by the names of the suites it runs
|
|
7
|
+
* (`apiTestSuites`): every suite in one part, as `e3-api-parts.spec.ts`
|
|
8
|
+
* checks.
|
|
9
|
+
*/
|
|
10
|
+
export declare const API_SUITE_PARTS: ReadonlyArray<readonly string[]>;
|
|
11
|
+
/**
|
|
12
|
+
* The part of the API suites a spec file runs, by its name: `e3-api-<n>.spec`
|
|
13
|
+
* runs part `n`, the index `n - 1` of {@link API_SUITE_PARTS}.
|
|
14
|
+
*
|
|
15
|
+
* @param file - The spec file's URL or path
|
|
16
|
+
* @returns The part's index
|
|
17
|
+
* @throws {Error} When the file's name names no part the suites have
|
|
18
|
+
*/
|
|
19
|
+
export declare function apiSuitePartOf(file: string): number;
|
|
20
|
+
/**
|
|
21
|
+
* Registers the part of the API suites a spec file runs, against e3 in a
|
|
22
|
+
* Chromium page of its own.
|
|
23
|
+
*
|
|
24
|
+
* @param file - The spec file's URL (`import.meta.url`), whose name names the
|
|
25
|
+
* part ({@link apiSuitePartOf})
|
|
26
|
+
*/
|
|
27
|
+
export declare function apiSuitesInChromium(file: string): void;
|
|
28
|
+
//# sourceMappingURL=e3-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-api.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,CAI5D,CAAC;AASF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA8EtD"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The shared API suites against e3 in Chromium, run in parts: each part a
|
|
7
|
+
* spec file of its own (`e3-api-<n>.spec.ts`), with its own browser and page,
|
|
8
|
+
* so each file's time stays well inside the time a test file is given, and
|
|
9
|
+
* the parts run side by side.
|
|
10
|
+
*
|
|
11
|
+
* The suites run in Node, and each request they make is forwarded into a page
|
|
12
|
+
* running e3 — its e3 worker over IndexedDB, OPFS and Web Locks, its units on
|
|
13
|
+
* Web Workers — whose `e3.fetch` answers it. They run as an admin, and their
|
|
14
|
+
* reader cases as a reader: the page's e3 knows each by its token, and grants
|
|
15
|
+
* the admin's one-shots `any` and the reader's `platform_free`. A browser
|
|
16
|
+
* runs no commands. The global `fetch` refuses every request for the run, so
|
|
17
|
+
* a request that is not forwarded fails, and is named when the part ends.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import { after, before, describe, it } from 'node:test';
|
|
22
|
+
import assert from 'node:assert/strict';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { apiTestSuites, createTestContext } from '@elaraai/e3-api-tests';
|
|
25
|
+
import { WEB_E3_ORIGIN } from '../bridge/protocol.js';
|
|
26
|
+
import { ADMIN_TOKEN, READER_TOKEN } from '../testing/callers.js';
|
|
27
|
+
import { forwardInto } from './e3-forward.js';
|
|
28
|
+
import { Harness } from './harness.js';
|
|
29
|
+
/**
|
|
30
|
+
* The parts the suites run in, each by the names of the suites it runs
|
|
31
|
+
* (`apiTestSuites`): every suite in one part, as `e3-api-parts.spec.ts`
|
|
32
|
+
* checks.
|
|
33
|
+
*/
|
|
34
|
+
export const API_SUITE_PARTS = [
|
|
35
|
+
['repository', 'packages', 'workspaces', 'datasets', 'datasetPages', 'datasetTransfer', 'packageTransfer', 'platform'],
|
|
36
|
+
['dataflow'],
|
|
37
|
+
['functions', 'records', 'keyedRecords', 'recordDeploy'],
|
|
38
|
+
];
|
|
39
|
+
/** The pages and workers a part's harness serves. */
|
|
40
|
+
const entries = {
|
|
41
|
+
e3: fileURLToPath(new URL('./e3.page.js', import.meta.url)),
|
|
42
|
+
'e3-worker': fileURLToPath(new URL('./e3.worker.js', import.meta.url)),
|
|
43
|
+
'e3-unit-worker': fileURLToPath(new URL('./e3-unit.worker.js', import.meta.url)),
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The part of the API suites a spec file runs, by its name: `e3-api-<n>.spec`
|
|
47
|
+
* runs part `n`, the index `n - 1` of {@link API_SUITE_PARTS}.
|
|
48
|
+
*
|
|
49
|
+
* @param file - The spec file's URL or path
|
|
50
|
+
* @returns The part's index
|
|
51
|
+
* @throws {Error} When the file's name names no part the suites have
|
|
52
|
+
*/
|
|
53
|
+
export function apiSuitePartOf(file) {
|
|
54
|
+
const named = /(?:^|[/\\])e3-api-(\d+)\.spec\.[jt]s$/.exec(file);
|
|
55
|
+
const part = named === null ? -1 : Number(named[1]) - 1;
|
|
56
|
+
if (API_SUITE_PARTS[part] === undefined) {
|
|
57
|
+
throw new Error(`${file} names no part of the API suites: a part's spec file is e3-api-<n>.spec.ts, n from 1 to ${API_SUITE_PARTS.length}`);
|
|
58
|
+
}
|
|
59
|
+
return part;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Registers the part of the API suites a spec file runs, against e3 in a
|
|
63
|
+
* Chromium page of its own.
|
|
64
|
+
*
|
|
65
|
+
* @param file - The spec file's URL (`import.meta.url`), whose name names the
|
|
66
|
+
* part ({@link apiSuitePartOf})
|
|
67
|
+
*/
|
|
68
|
+
export function apiSuitesInChromium(file) {
|
|
69
|
+
const part = apiSuitePartOf(file);
|
|
70
|
+
const names = API_SUITE_PARTS[part];
|
|
71
|
+
describe(`the API suites against e3 in Chromium, part ${part + 1} of ${API_SUITE_PARTS.length} (${names.join(', ')})`, () => {
|
|
72
|
+
let harness;
|
|
73
|
+
/** The page running e3 */
|
|
74
|
+
let page;
|
|
75
|
+
/** The page's storage, removed once the part has run */
|
|
76
|
+
const name = `e3-web-api-${crypto.randomUUID()}`;
|
|
77
|
+
/** The fetch every request goes through: forwarded into the page */
|
|
78
|
+
let forwarded;
|
|
79
|
+
/** The global fetch, put back once the part has run */
|
|
80
|
+
const networkFetch = globalThis.fetch;
|
|
81
|
+
/** The requests that reached the global fetch */
|
|
82
|
+
const escaped = [];
|
|
83
|
+
let answered = 0;
|
|
84
|
+
before(async () => {
|
|
85
|
+
harness = await Harness.open({ entries });
|
|
86
|
+
page = await harness.newPage('e3');
|
|
87
|
+
const options = { name, hold: false, pieceBytes: null };
|
|
88
|
+
const started = await page.call('start', options);
|
|
89
|
+
assert.equal(started.apiUrl, WEB_E3_ORIGIN);
|
|
90
|
+
forwarded = forwardInto(page);
|
|
91
|
+
globalThis.fetch = ((input) => {
|
|
92
|
+
const url = input instanceof Request ? input.url : String(input);
|
|
93
|
+
escaped.push(url);
|
|
94
|
+
return Promise.reject(new TypeError(`a request went to the global fetch rather than into the page: ${url}`));
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
after(async () => {
|
|
98
|
+
globalThis.fetch = networkFetch;
|
|
99
|
+
try {
|
|
100
|
+
if (page !== undefined) {
|
|
101
|
+
await page.call('close');
|
|
102
|
+
await page.call('clear', name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
await harness?.close();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const setup = async (t) => {
|
|
110
|
+
const fetch = forwarded;
|
|
111
|
+
if (fetch === undefined)
|
|
112
|
+
throw new Error('the page running e3 did not start');
|
|
113
|
+
const ctx = await createTestContext({
|
|
114
|
+
baseUrl: WEB_E3_ORIGIN,
|
|
115
|
+
getToken: async () => ADMIN_TOKEN,
|
|
116
|
+
// The reader may read every repository of the page's e3, so needs no grant
|
|
117
|
+
getReaderToken: async () => READER_TOKEN,
|
|
118
|
+
cleanup: true,
|
|
119
|
+
fetch: (input, init) => {
|
|
120
|
+
answered++;
|
|
121
|
+
return fetch(input, init);
|
|
122
|
+
},
|
|
123
|
+
commands: false,
|
|
124
|
+
});
|
|
125
|
+
t.after(() => ctx.cleanup());
|
|
126
|
+
return ctx;
|
|
127
|
+
};
|
|
128
|
+
for (const suite of names) {
|
|
129
|
+
const register = apiTestSuites[suite];
|
|
130
|
+
if (register === undefined)
|
|
131
|
+
throw new Error(`e3-api-tests has no API suite '${suite}'`);
|
|
132
|
+
register(setup);
|
|
133
|
+
}
|
|
134
|
+
// Last, once every test before it has cleaned up: a request whose refusal
|
|
135
|
+
// what made it swallowed — a cleanup's — is named here, and so is every
|
|
136
|
+
// error the page raised, whether or not a call reported it.
|
|
137
|
+
it('sent every request into the page, which raised nothing', () => {
|
|
138
|
+
assert.deepEqual(escaped, [], 'every request goes into the page');
|
|
139
|
+
assert.ok(answered > 0, 'the suites\' requests went into the page');
|
|
140
|
+
assert.deepEqual(page?.raisedErrors.map((error) => error.message), [], 'the page raised nothing');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=e3-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-api.js","sourceRoot":"","sources":["../../../src/browser/e3-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAoC,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAoB,MAAM,cAAc,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqC;IAC/D,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,CAAC;IACtH,CAAC,UAAU,CAAC;IACZ,CAAC,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;CACzD,CAAC;AAEF,qDAAqD;AACrD,MAAM,OAAO,GAAG;IACd,EAAE,EAAE,aAAa,CAAC,IAAI,G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AAC,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE,kCAAkC,CAAC,CAAC;YAClE,MAAM,CAAC,EAAE,CAAC,QAAQ,GAAG,CAAC,EAAE,0CAA0C,CAAC,CAAC;YACpE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAC;QACpG,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-client.worker.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-client.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A page's stand-in, in a worker of its own, which the specs' e3 page can
|
|
7
|
+
* stop as a tab closes: it connects to an e3 served over the port it is sent
|
|
8
|
+
* (`createWebE3`), holding the lifeline the e3 waits on, says so, and holds
|
|
9
|
+
* the connection until it is terminated.
|
|
10
|
+
*
|
|
11
|
+
* The harness bundles it for Chromium; `e3.page.ts` starts it.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import { createWebE3 } from '../bridge/page.js';
|
|
16
|
+
self.onmessage = (event) => {
|
|
17
|
+
void createWebE3(event.data, { requestPersistence: false }).then(() => self.postMessage('connected'), (err) => self.postMessage(`refused: ${err instanceof Error ? err.message : String(err)}`));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=e3-client.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-client.worker.js","sourceRoot":"","sources":["../../../src/browser/e3-client.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,IAAI,CAAC,SAAS,GAAG,CAAC,KAAgC,EAAE,EAAE;IACpD,KAAK,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAC9D,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EACnC,CAAC,GAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CACnG,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { HarnessPage } from './harness.js';
|
|
6
|
+
/** What a forwarding fetch asks of a page: a call it reads the answer of, and
|
|
7
|
+
* one it does not. */
|
|
8
|
+
export type ForwardedPage = Pick<HarnessPage, 'call' | 'tell'>;
|
|
9
|
+
/**
|
|
10
|
+
* A `fetch` that forwards each request into a page running e3.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Each request is sent whole — its method, URL, headers and body — and
|
|
14
|
+
* answered with the response the page's `e3.fetch` gave, whole. A request
|
|
15
|
+
* whose signal aborts — before it is sent, while its body is read, or while
|
|
16
|
+
* the page answers it — rejects with the signal's reason, as `fetch` rejects,
|
|
17
|
+
* and one the page has been sent is given up there too, by a call whose
|
|
18
|
+
* answer nothing reads, so what the page raised is not lost with it. A
|
|
19
|
+
* request whose call into the page fails — the page threw, or did not answer
|
|
20
|
+
* within the call's deadline — rejects with what failed, and is given up in
|
|
21
|
+
* the page.
|
|
22
|
+
*
|
|
23
|
+
* @param page - A page running `e3.page.ts`, whose e3 has started
|
|
24
|
+
* @returns The fetch
|
|
25
|
+
*/
|
|
26
|
+
export declare function forwardInto(page: ForwardedPage): typeof globalThis.fetch;
|
|
27
|
+
//# sourceMappingURL=e3-forward.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-forward.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-forward.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD;uBACuB;AACvB,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,UAAU,CAAC,KAAK,CA0CxE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A `fetch`, in Node, that forwards each request into a test page running e3
|
|
7
|
+
* (`e3.page.ts`), whose `e3.fetch` answers it: what the shared API suites and
|
|
8
|
+
* the specs' own requests go through, so e3 in Chromium answers them.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import { fromBase64, toBase64 } from './e3-wire.js';
|
|
13
|
+
/** The statuses whose responses have no body. */
|
|
14
|
+
const NULL_BODY_STATUSES = new Set([101, 103, 204, 205, 304]);
|
|
15
|
+
/**
|
|
16
|
+
* A `fetch` that forwards each request into a page running e3.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Each request is sent whole — its method, URL, headers and body — and
|
|
20
|
+
* answered with the response the page's `e3.fetch` gave, whole. A request
|
|
21
|
+
* whose signal aborts — before it is sent, while its body is read, or while
|
|
22
|
+
* the page answers it — rejects with the signal's reason, as `fetch` rejects,
|
|
23
|
+
* and one the page has been sent is given up there too, by a call whose
|
|
24
|
+
* answer nothing reads, so what the page raised is not lost with it. A
|
|
25
|
+
* request whose call into the page fails — the page threw, or did not answer
|
|
26
|
+
* within the call's deadline — rejects with what failed, and is given up in
|
|
27
|
+
* the page.
|
|
28
|
+
*
|
|
29
|
+
* @param page - A page running `e3.page.ts`, whose e3 has started
|
|
30
|
+
* @returns The fetch
|
|
31
|
+
*/
|
|
32
|
+
export function forwardInto(page) {
|
|
33
|
+
let nextId = 0;
|
|
34
|
+
return async (input, init) => {
|
|
35
|
+
const request = new Request(input, init);
|
|
36
|
+
const { signal } = request;
|
|
37
|
+
const id = nextId++;
|
|
38
|
+
// Heard from the start: an abort while the body is read ends the request
|
|
39
|
+
// there, and one after it is sent gives it up in the page.
|
|
40
|
+
let sent = false;
|
|
41
|
+
let onAbort;
|
|
42
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
43
|
+
onAbort = () => {
|
|
44
|
+
if (sent)
|
|
45
|
+
page.tell('abort', id);
|
|
46
|
+
reject(signal.reason);
|
|
47
|
+
};
|
|
48
|
+
if (signal.aborted)
|
|
49
|
+
onAbort();
|
|
50
|
+
else
|
|
51
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
52
|
+
});
|
|
53
|
+
// Nothing may await it but the races below.
|
|
54
|
+
aborted.catch(() => undefined);
|
|
55
|
+
try {
|
|
56
|
+
const body = request.body === null ? null : toBase64(new Uint8Array(await Promise.race([request.arrayBuffer(), aborted])));
|
|
57
|
+
// Aborted as the body was read, though the race went to the body.
|
|
58
|
+
if (signal.aborted)
|
|
59
|
+
throw signal.reason;
|
|
60
|
+
const wire = { method: request.method, url: request.url, headers: [...request.headers], body };
|
|
61
|
+
sent = true;
|
|
62
|
+
const answering = page.call('fetch', id, wire).catch((err) => {
|
|
63
|
+
// The page threw, or ran past the call's deadline: what it was doing
|
|
64
|
+
// for the request is given up.
|
|
65
|
+
page.tell('abort', id);
|
|
66
|
+
throw err;
|
|
67
|
+
});
|
|
68
|
+
const answer = await Promise.race([answering, aborted]);
|
|
69
|
+
return new Response(NULL_BODY_STATUSES.has(answer.status) ? null : fromBase64(answer.body), {
|
|
70
|
+
status: answer.status,
|
|
71
|
+
statusText: answer.statusText,
|
|
72
|
+
headers: answer.headers.map(([name, value]) => [name, value]),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
if (onAbort !== undefined)
|
|
77
|
+
signal.removeEventListener('abort', onAbort);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=e3-forward.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-forward.js","sourceRoot":"","sources":["../../../src/browser/e3-forward.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAuC,MAAM,cAAc,CAAC;AAGzF,iDAAiD;AACjD,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAM9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,IAAmB;IAC7C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QACpB,yEAAyE;QACzE,2DAA2D;QAC3D,IAAI,IAAI,GAAG,K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;gBACrE,+BAA+B;gBAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACvB,MAAM,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YACxD,OAAO,IAAI,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBAC1F,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAoB,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aAChF,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,OAAO,KAAK,SAAS;gBAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-forward.spec.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-forward.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The forwarding fetch's edges, in Node, over a stand-in for a page: a
|
|
7
|
+
* request answered; one aborted while its body is read, which the page is
|
|
8
|
+
* never sent; one aborted while the page answers it; and one whose call into
|
|
9
|
+
* the page fails — past the call's deadline, say — each of the last two given
|
|
10
|
+
* up in the page by a call whose answer nothing reads. Every request the API
|
|
11
|
+
* suites make is forwarded so into Chromium (`e3-api.ts`).
|
|
12
|
+
*/
|
|
13
|
+
import { describe, it } from 'node:test';
|
|
14
|
+
import assert from 'node:assert/strict';
|
|
15
|
+
import { toBase64 } from './e3-wire.js';
|
|
16
|
+
import { forwardInto } from './e3-forward.js';
|
|
17
|
+
/** A stand-in for a page running e3: it answers each call as a test says,
|
|
18
|
+
* and records what it is called with and told. */
|
|
19
|
+
class StandInPage {
|
|
20
|
+
answer;
|
|
21
|
+
called = [];
|
|
22
|
+
told = [];
|
|
23
|
+
constructor(answer) {
|
|
24
|
+
this.answer = answer;
|
|
25
|
+
}
|
|
26
|
+
call(name, ...args) {
|
|
27
|
+
this.called.push({ name, args });
|
|
28
|
+
return this.answer(name);
|
|
29
|
+
}
|
|
30
|
+
tell(name, ...args) {
|
|
31
|
+
this.told.push({ name, args });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** A promise that never settles: a page that does not answer. */
|
|
35
|
+
function never() {
|
|
36
|
+
return new Promise(() => undefined);
|
|
37
|
+
}
|
|
38
|
+
describe('the forwarding fetch', () => {
|
|
39
|
+
it('answers a request with the response the page gave', async () => {
|
|
40
|
+
const answer = { status: 201, statusText: 'Created', headers: [['x-answer', 'yes']], body: toBase64(new Uint8Array([1, 2, 3])) };
|
|
41
|
+
const page = new StandInPage(() => Promise.resolve(answer));
|
|
42
|
+
const response = await forwardInto(page)('https://e3-web.invalid/api/repos/default', { method: 'PUT', body: new Uint8Array([9]) });
|
|
43
|
+
assert.equal(response.status, 201);
|
|
44
|
+
assert.equal(response.headers.get('x-answer'), 'yes');
|
|
45
|
+
assert.deepEqual(new Uint8Array(await response.arrayBuffer()), new Uint8Array([1, 2, 3]));
|
|
46
|
+
assert.deepEqual(page.called.map(({ name }) => name), ['fetch']);
|
|
47
|
+
assert.deepEqual(page.told, []);
|
|
48
|
+
});
|
|
49
|
+
it('gives up a request aborted while its body is read: it rejects with the abort\'s reason, and the page is sent nothing', async () => {
|
|
50
|
+
const page = new StandInPage(() => never());
|
|
51
|
+
const controller = new AbortController();
|
|
52
|
+
// A body that never ends: reading it waits until the abort.
|
|
53
|
+
const body = new ReadableStream({
|
|
54
|
+
start(stream) {
|
|
55
|
+
stream.enqueue(new Uint8Array([1]));
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const pending = forwardInto(page)('https://e3-web.invalid/api/uploads/an-upload', {
|
|
59
|
+
method: 'PUT', body, duplex: 'half', signal: controller.signal,
|
|
60
|
+
});
|
|
61
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
62
|
+
controller.abort();
|
|
63
|
+
await assert.rejects(pending, { name: 'AbortError' });
|
|
64
|
+
assert.deepEqual(page.called, [], 'the page was sent nothing');
|
|
65
|
+
assert.deepEqual(page.told, [], 'and told nothing');
|
|
66
|
+
});
|
|
67
|
+
it('gives up in the page a request aborted while the page answers it, by a call whose answer nothing reads', async () => {
|
|
68
|
+
const page = new StandInPage(() => never());
|
|
69
|
+
const controller = new AbortController();
|
|
70
|
+
const pending = forwardInto(page)('https://e3-web.invalid/api/repos', { signal: controller.signal });
|
|
71
|
+
while (page.called.length === 0)
|
|
72
|
+
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
73
|
+
controller.abort();
|
|
74
|
+
await assert.rejects(pending, { name: 'AbortError' });
|
|
75
|
+
assert.deepEqual(page.called.map(({ name }) => name), ['fetch'], 'the abort is no call whose answer is read');
|
|
76
|
+
assert.deepEqual(page.told, [{ name: 'abort', args: [0] }], 'the page is told to give the request up');
|
|
77
|
+
});
|
|
78
|
+
it('gives up in the page a request whose call into it failed — past the call\'s deadline, say — rejecting with what failed', async () => {
|
|
79
|
+
const page = new StandInPage(() => Promise.reject(new Error('the page did not answer fetch in 120 s')));
|
|
80
|
+
await assert.rejects(forwardInto(page)('https://e3-web.invalid/api/repos'), /^Error: the page did not answer fetch in 120 s$/);
|
|
81
|
+
assert.deepEqual(page.told, [{ name: 'abort', args: [0] }], 'what the page was doing for it is given up');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=e3-forward.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-forward.spec.js","sourceRoot":"","sources":["../../../src/browser/e3-forward.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAqB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AAQlE;mDACmD;AACnD,MAAM,WAAW;IAIc;IAHpB,MAAM,GAAW,EAAE,CAAC;IACpB,IAAI,GAAW,EAAE,CAAC;IAE3B,YAA6B,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;IAAG,CAAC;IAE3E,IAAI,CAAc,IAAY,EAAE,GAAG,IAAe;QAChD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAe,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,GAAG,IAAe;QACnC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;CACF;AAED,iEAAiE;AACjE,SAAS,KAAK;IACZ,OAAO,IAAI,OAAO,CAAQ,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,MAAM,GAAiB,EAAE,MAAM,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 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* An e3 worker the specs' e3 page starts to serve e3 over a `MessagePort`:
|
|
7
|
+
* `serveE3(options, port)`, over persisted repositories of the name its page
|
|
8
|
+
* sends with the port, its unit workers running `e3-unit.worker.ts`. A
|
|
9
|
+
* browser's port says nothing as it closes, so the e3 learns its page has
|
|
10
|
+
* gone from the page's `close`, or from the lifeline the page holds.
|
|
11
|
+
*
|
|
12
|
+
* The harness bundles it for Chromium; `e3.page.ts` starts it.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { serveE3 } from '../worker.js';
|
|
17
|
+
self.onmessage = (event) => {
|
|
18
|
+
const { port, name } = event.data;
|
|
19
|
+
serveE3({ units: () => new Worker('/e3-unit-worker.js?hold=0', { type: 'module' }), name }, port);
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=e3-port.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-port.worker.js","sourceRoot":"","sources":["../../../src/browser/e3-port.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQvC,IAAI,CAAC,SAAS,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC/C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AACpG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-unit.worker.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-unit.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The unit worker the specs' e3 worker starts: it serves units as an app's
|
|
7
|
+
* unit worker does — `serveUnits()`, with east-node-std's platform functions
|
|
8
|
+
* and e3's own — and the hold beside them, holding when its URL says.
|
|
9
|
+
*
|
|
10
|
+
* The harness bundles it for Chromium; `e3.worker.ts` starts it.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { HOLD_PLATFORM, holdPlatform } from '../testing/hold-platform.js';
|
|
15
|
+
import { serveUnits } from '../units.js';
|
|
16
|
+
const held = new URL(self.location.href).searchParams.get('hold') === '1';
|
|
17
|
+
serveUnits({ platforms: { [HOLD_PLATFORM]: holdPlatform(held) } });
|
|
18
|
+
//# sourceMappingURL=e3-unit.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-unit.worker.js","sourceRoot":"","sources":["../../../src/browser/e3-unit.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC;AAC1E,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A request, and its response, as they cross between Node and a test page
|
|
7
|
+
* running e3: what Node's forwarding fetch (`e3-forward.ts`) sends the page
|
|
8
|
+
* (`e3.page.ts`), which answers it with its `e3.fetch`. A call to a page takes
|
|
9
|
+
* and answers only what serializes, so a body crosses as base64 text.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
/** A request, as it crosses to the page. */
|
|
14
|
+
export interface WireRequest {
|
|
15
|
+
readonly method: string;
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly headers: ReadonlyArray<readonly [string, string]>;
|
|
18
|
+
/** Its body, as base64, or `null` for none */
|
|
19
|
+
readonly body: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A response, as it crosses back. */
|
|
22
|
+
export interface WireResponse {
|
|
23
|
+
readonly status: number;
|
|
24
|
+
readonly statusText: string;
|
|
25
|
+
readonly headers: ReadonlyArray<readonly [string, string]>;
|
|
26
|
+
/** Its body, as base64: empty for none */
|
|
27
|
+
readonly body: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bytes as base64 text.
|
|
31
|
+
*
|
|
32
|
+
* @param bytes - The bytes
|
|
33
|
+
* @returns Their base64
|
|
34
|
+
*/
|
|
35
|
+
export declare function toBase64(bytes: Uint8Array): string;
|
|
36
|
+
/**
|
|
37
|
+
* Base64 text as bytes.
|
|
38
|
+
*
|
|
39
|
+
* @param text - The base64
|
|
40
|
+
* @returns The bytes
|
|
41
|
+
*/
|
|
42
|
+
export declare function fromBase64(text: string): Uint8Array<ArrayBuffer>;
|
|
43
|
+
//# sourceMappingURL=e3-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e3-wire.d.ts","sourceRoot":"","sources":["../../../src/browser/e3-wire.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAKD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAKhE"}
|