@elaraai/e3-web 0.0.0-stage → 1.0.86
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,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type DatasetRefStore, type ExecutionStateStore, type LockService, type LogStore, type ObjectStore, type RefStore, type RepoStore, type RepositoryUpgrade, type StorageBackend } from '@elaraai/e3-core/portable';
|
|
6
|
+
import type { BlobKey, BlobsAdapter, FilesAdapter, LocksAdapter, RecordKey, RecordsAdapter } from './adapters.js';
|
|
7
|
+
import { recordKeys } from './record-keys.js';
|
|
8
|
+
export { recordKeys };
|
|
9
|
+
/** The kinds of record a transfer backend over a `WebStorage` keeps. */
|
|
10
|
+
export type TransferKind = 'upload' | 'download' | 'import' | 'export' | 'deploy' | 'gc' | 'split';
|
|
11
|
+
/**
|
|
12
|
+
* The key of each record a transfer backend over a `WebStorage` keeps, in its
|
|
13
|
+
* records adapter: `['transfer', <kind>, <id>]`.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* A job is found by its id alone, as a route asks for it, and its record names
|
|
17
|
+
* the repository that started it, which the route checks. gc's sweep reads
|
|
18
|
+
* which transfers have a record ({@link WebRepoStore.gcSweepBackend}).
|
|
19
|
+
*/
|
|
20
|
+
export declare const transferKeys: {
|
|
21
|
+
/** Every transfer's record */
|
|
22
|
+
all: () => RecordKey;
|
|
23
|
+
/** Every record of a kind */
|
|
24
|
+
kind: (kind: TransferKind) => RecordKey;
|
|
25
|
+
/** A record of a kind */
|
|
26
|
+
of: (kind: TransferKind, id: string) => RecordKey;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The key of each blob a transfer stages, in the blobs adapter: under its
|
|
30
|
+
* repository, which takes them with it when it is removed.
|
|
31
|
+
*/
|
|
32
|
+
export declare const stagedKeys: {
|
|
33
|
+
/** Everything every transfer of a repository staged */
|
|
34
|
+
all: (repo: string) => BlobKey;
|
|
35
|
+
/** Everything a transfer staged */
|
|
36
|
+
of: (repo: string, id: string) => BlobKey;
|
|
37
|
+
/** A part of a dataset upload, from 1 */
|
|
38
|
+
part: (repo: string, id: string, part: number) => BlobKey;
|
|
39
|
+
/** A package import's zip */
|
|
40
|
+
zip: (repo: string, id: string) => BlobKey;
|
|
41
|
+
/** A round of an export's zip, from 0: the bytes one round wrote */
|
|
42
|
+
exported: (repo: string, id: string, round: number) => BlobKey;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* How long what a transfer staged is kept, however its record stands: a day,
|
|
46
|
+
* the longest a transfer backend keeps a record nothing finished or fetched.
|
|
47
|
+
* gc sweeps what is older, as it sweeps what no record names.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TRANSFER_RETENTION_MS: number;
|
|
50
|
+
/**
|
|
51
|
+
* Objects as blobs, named by their catalogue's entries.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* A write of bytes the store does not hold records its write in flight, writes
|
|
55
|
+
* a new blob, and then names it in the catalogue, in two transactions around
|
|
56
|
+
* the blob's write; one of bytes it holds re-references them instead. Every
|
|
57
|
+
* write and {@link touch} clears the object's unreachable note in the
|
|
58
|
+
* transaction that finds it.
|
|
59
|
+
*
|
|
60
|
+
* East's SHA-256 names bytes whole, so a streamed write, and a file adopted,
|
|
61
|
+
* are held whole to be named.
|
|
62
|
+
*/
|
|
63
|
+
export declare class WebObjectStore implements ObjectStore {
|
|
64
|
+
private readonly records;
|
|
65
|
+
private readonly blobs;
|
|
66
|
+
private readonly files;
|
|
67
|
+
/** Objects are blobs apart from any file: placing one copies its bytes. */
|
|
68
|
+
readonly placement = "download";
|
|
69
|
+
constructor(records: RecordsAdapter, blobs: BlobsAdapter, files: FilesAdapter);
|
|
70
|
+
write(repo: string, data: Uint8Array): Promise<string>;
|
|
71
|
+
writeStream(repo: string, stream: AsyncIterable<Uint8Array>): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Stores bytes the caller has hashed, under that hash, without hashing them
|
|
74
|
+
* again: what a transfer's commit stores once it has checked the bytes it
|
|
75
|
+
* staged against the hash its upload declared.
|
|
76
|
+
*
|
|
77
|
+
* @param repo - Repository identifier
|
|
78
|
+
* @param hash - The bytes' SHA-256, as the caller computed it
|
|
79
|
+
* @param data - The bytes
|
|
80
|
+
* @returns The hash
|
|
81
|
+
* @throws {Error} When a sweep took the write in flight for abandoned:
|
|
82
|
+
* nothing is stored
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
writeHashed(repo: string, hash: string, data: Uint8Array): Promise<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Stores bytes under their hash, or re-references the object when the store
|
|
88
|
+
* holds it.
|
|
89
|
+
*
|
|
90
|
+
* @throws {Error} When a sweep took the write in flight for abandoned, as
|
|
91
|
+
* one with no age gate beside running work may: nothing is stored
|
|
92
|
+
*/
|
|
93
|
+
private store;
|
|
94
|
+
touch(repo: string, hashes: readonly string[]): Promise<boolean[]>;
|
|
95
|
+
/** An object's entry, or `ObjectNotFoundError`; `InvalidNameError` for a
|
|
96
|
+
* hash that is not of its form. */
|
|
97
|
+
private entry;
|
|
98
|
+
read(repo: string, hash: string): Promise<Uint8Array>;
|
|
99
|
+
readRange(repo: string, hash: string, offset: number, length: number): Promise<Uint8Array>;
|
|
100
|
+
adoptFile(repo: string, file: string, hash?: string): Promise<{
|
|
101
|
+
hash: string;
|
|
102
|
+
size: number;
|
|
103
|
+
}>;
|
|
104
|
+
materialize(repo: string, hash: string, destPath: string): Promise<void>;
|
|
105
|
+
exists(repo: string, hash: string): Promise<boolean>;
|
|
106
|
+
stat(repo: string, hash: string): Promise<{
|
|
107
|
+
size: number;
|
|
108
|
+
}>;
|
|
109
|
+
list(repo: string): Promise<string[]>;
|
|
110
|
+
count(repo: string): Promise<number>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The upgrades of e3-web's own layout — its records' keys and its blobs — in
|
|
114
|
+
* the order they apply: none yet. A release that changes the layout appends
|
|
115
|
+
* its step here, and never edits, reorders or removes one a release shipped.
|
|
116
|
+
*/
|
|
117
|
+
export declare const WEB_REPOSITORY_UPGRADES: RepositoryUpgrade[];
|
|
118
|
+
/**
|
|
119
|
+
* The adapters a {@link WebStorage} keeps its repositories over.
|
|
120
|
+
*/
|
|
121
|
+
export interface WebAdapters {
|
|
122
|
+
/** The records: refs, dataset refs, executions, lock states, the catalogue */
|
|
123
|
+
readonly records: RecordsAdapter;
|
|
124
|
+
/** The objects' blobs */
|
|
125
|
+
readonly blobs: BlobsAdapter;
|
|
126
|
+
/** The locks, taken by this tab's session */
|
|
127
|
+
readonly locks: LocksAdapter;
|
|
128
|
+
/** The files `adoptFile` and `materialize` name */
|
|
129
|
+
readonly files: FilesAdapter;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* e3's storage backend over the four adapters: a browser's IndexedDB, OPFS
|
|
133
|
+
* and Web Locks, or memory.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* A repository is named, as the in-memory backend's is: every store takes its
|
|
137
|
+
* name. Two tabs over one origin's adapters share its repositories as two
|
|
138
|
+
* processes share a directory of local ones: records change in transactions,
|
|
139
|
+
* locks exclude across tabs, and a closed tab's locks are free.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const storage = await openWebStorage();
|
|
144
|
+
* await storage.repos.create('default');
|
|
145
|
+
* const hash = await storage.objects.write('default', bytes);
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare class WebStorage implements StorageBackend {
|
|
149
|
+
readonly adapters: WebAdapters;
|
|
150
|
+
readonly upgrades: readonly RepositoryUpgrade[];
|
|
151
|
+
readonly objects: WebObjectStore;
|
|
152
|
+
readonly refs: RefStore;
|
|
153
|
+
readonly locks: LockService;
|
|
154
|
+
readonly logs: LogStore;
|
|
155
|
+
readonly repos: RepoStore;
|
|
156
|
+
readonly datasets: DatasetRefStore;
|
|
157
|
+
/** Every repository's runs' states, in the same records */
|
|
158
|
+
private readonly states;
|
|
159
|
+
/**
|
|
160
|
+
* @param adapters - The adapters the repositories are kept over
|
|
161
|
+
*/
|
|
162
|
+
constructor(adapters: WebAdapters);
|
|
163
|
+
/**
|
|
164
|
+
* The store of a repository's dataflow runs' states: a {@link WebStateStore}
|
|
165
|
+
* over the backend's own records, which keeps each repository's runs under
|
|
166
|
+
* its records, where a workspace's removal and the repository's take them.
|
|
167
|
+
*
|
|
168
|
+
* @param _repo - Repository identifier
|
|
169
|
+
* @returns The run state store
|
|
170
|
+
*/
|
|
171
|
+
runStates(_repo: string): ExecutionStateStore;
|
|
172
|
+
validateRepository(repo: string): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Closes the backend: its records' connection, and its session's locks.
|
|
175
|
+
* What it keeps stays for the next backend over the same adapters.
|
|
176
|
+
*/
|
|
177
|
+
close(): Promise<void>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* How {@link openWebStorage} keeps its repositories.
|
|
181
|
+
*/
|
|
182
|
+
export interface WebStorageOptions {
|
|
183
|
+
/**
|
|
184
|
+
* Whether repositories outlive the page: in IndexedDB, OPFS and Web Locks
|
|
185
|
+
* (`true`, unless given), or in memory, starting fresh on every load
|
|
186
|
+
* (`false`).
|
|
187
|
+
*/
|
|
188
|
+
readonly persist?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* What the IndexedDB database, the OPFS directory and the Web Locks are
|
|
191
|
+
* named after: `e3` unless given. Two storages of one name, in one tab or
|
|
192
|
+
* two, share their repositories; two of different names share nothing.
|
|
193
|
+
*/
|
|
194
|
+
readonly name?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Opens e3's storage in a browser.
|
|
198
|
+
*
|
|
199
|
+
* @remarks
|
|
200
|
+
* Persisted, the records are the IndexedDB database of its name, the objects
|
|
201
|
+
* are OPFS files under `/<name>/blobs`, the files `adoptFile` and
|
|
202
|
+
* `materialize` name are OPFS files under `/<name>/files`, and the locks are
|
|
203
|
+
* Web Locks whose names begin with `<name>:`. Before it opens any of them it
|
|
204
|
+
* checks the page has every API it keeps repositories with — IndexedDB, OPFS
|
|
205
|
+
* whose file handles have `createWritable` and `move`, and Web Locks — so a
|
|
206
|
+
* browser that lacks one is refused at once, rather than at the first write
|
|
207
|
+
* that needs it. Not persisted, each is in memory, and the page starts with
|
|
208
|
+
* none on every load.
|
|
209
|
+
*
|
|
210
|
+
* @param options - Whether it persists, and its name
|
|
211
|
+
* @returns The storage, over IndexedDB, OPFS and Web Locks, or over memory
|
|
212
|
+
* @throws {Error} When it persists and the page lacks one of the APIs it keeps
|
|
213
|
+
* repositories with — in order, `IndexedDB`,
|
|
214
|
+
* `navigator.storage.getDirectory`, `FileSystemFileHandle.createWritable`,
|
|
215
|
+
* `FileSystemFileHandle.move` and `navigator.locks` — naming the first
|
|
216
|
+
* missing, having opened nothing
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const storage = await openWebStorage();
|
|
221
|
+
* if (!(await storage.repos.exists('default'))) await storage.repos.create('default');
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
export declare function openWebStorage(options?: WebStorageOptions): Promise<WebStorage>;
|
|
225
|
+
//# sourceMappingURL=WebStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebStorage.d.ts","sourceRoot":"","sources":["../../../src/storage/WebStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuDH,OAAO,EAoBL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAQxB,KAAK,WAAW,EAGhB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EAGb,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAmC,MAAM,eAAe,CAAC;AAInJ,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,OAAO,EAAE,UAAU,EAAE,CAAC;AAWtB,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,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