@oliphaunt/wasix-ts 0.1.0
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/ARCHITECTURE.md +655 -0
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +404 -0
- package/THIRD_PARTY_NOTICES.md +20 -0
- package/lib/archive.d.ts +21 -0
- package/lib/archive.js +336 -0
- package/lib/asset-source.d.ts +4 -0
- package/lib/asset-source.js +15 -0
- package/lib/byte-channel.d.ts +27 -0
- package/lib/byte-channel.js +170 -0
- package/lib/client-common.d.ts +6 -0
- package/lib/client-common.js +36 -0
- package/lib/client.d.ts +7 -0
- package/lib/client.js +24 -0
- package/lib/database-root.d.ts +19 -0
- package/lib/database-root.js +139 -0
- package/lib/database.d.ts +135 -0
- package/lib/database.js +1039 -0
- package/lib/descriptor-validation.d.ts +10 -0
- package/lib/descriptor-validation.js +75 -0
- package/lib/direct-client-common.d.ts +50 -0
- package/lib/direct-client-common.js +717 -0
- package/lib/direct-client.d.ts +4 -0
- package/lib/direct-client.js +13 -0
- package/lib/direct.node.d.ts +2 -0
- package/lib/direct.node.js +2 -0
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +34 -0
- package/lib/extension-descriptor.d.ts +14 -0
- package/lib/extension-descriptor.js +419 -0
- package/lib/extensions.d.ts +68 -0
- package/lib/extensions.js +769 -0
- package/lib/host/LICENSE +21 -0
- package/lib/host/index.d.mts +123 -0
- package/lib/host/index.mjs +11 -0
- package/lib/host/provenance.json +16 -0
- package/lib/host/wasmer_js_bg.wasm +0 -0
- package/lib/host/worker.mjs +11 -0
- package/lib/host-runtime.d.ts +5 -0
- package/lib/host-runtime.js +13 -0
- package/lib/icu-descriptor.d.ts +3 -0
- package/lib/icu-descriptor.js +92 -0
- package/lib/index.bun.d.ts +2 -0
- package/lib/index.bun.js +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.deno.d.ts +2 -0
- package/lib/index.deno.js +2 -0
- package/lib/index.js +2 -0
- package/lib/index.node.d.ts +2 -0
- package/lib/index.node.js +2 -0
- package/lib/internal-common.d.ts +12 -0
- package/lib/internal-common.js +274 -0
- package/lib/internal.d.ts +5 -0
- package/lib/internal.js +42 -0
- package/lib/internal.node.d.ts +5 -0
- package/lib/internal.node.js +8 -0
- package/lib/native-addon.d.ts +111 -0
- package/lib/native-addon.js +223 -0
- package/lib/native-server.d.ts +21 -0
- package/lib/native-server.js +109 -0
- package/lib/native-session.d.ts +60 -0
- package/lib/native-session.js +565 -0
- package/lib/node-actor.d.ts +7 -0
- package/lib/node-actor.js +10 -0
- package/lib/node-client-common.d.ts +9 -0
- package/lib/node-client-common.js +35 -0
- package/lib/node-client.d.ts +4 -0
- package/lib/node-client.js +13 -0
- package/lib/node-direct.d.ts +7 -0
- package/lib/node-direct.js +10 -0
- package/lib/node-worker-options.d.ts +5 -0
- package/lib/node-worker-options.js +65 -0
- package/lib/node-worker-port.d.ts +4 -0
- package/lib/node-worker-port.js +116 -0
- package/lib/node-worker.d.ts +1 -0
- package/lib/node-worker.js +38 -0
- package/lib/pgwire-connection.d.ts +60 -0
- package/lib/pgwire-connection.js +528 -0
- package/lib/pgwire.d.ts +3 -0
- package/lib/pgwire.js +105 -0
- package/lib/physical-archive.d.ts +29 -0
- package/lib/physical-archive.js +527 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/protocol.js +1 -0
- package/lib/public.d.ts +4 -0
- package/lib/public.js +3 -0
- package/lib/query.d.ts +1 -0
- package/lib/query.js +1 -0
- package/lib/rpc.d.ts +203 -0
- package/lib/rpc.js +84 -0
- package/lib/runtime-descriptor.d.ts +3 -0
- package/lib/runtime-descriptor.js +79 -0
- package/lib/server.node.d.ts +1 -0
- package/lib/server.node.js +1 -0
- package/lib/startup-config.d.ts +2 -0
- package/lib/startup-config.js +19 -0
- package/lib/storage/bun.d.ts +6 -0
- package/lib/storage/bun.js +6 -0
- package/lib/storage/deno.d.ts +7 -0
- package/lib/storage/deno.js +7 -0
- package/lib/storage/incremental-storage.d.ts +25 -0
- package/lib/storage/incremental-storage.js +154 -0
- package/lib/storage/indexed-db-provider.d.ts +40 -0
- package/lib/storage/indexed-db-provider.js +259 -0
- package/lib/storage/indexed-db.d.ts +9 -0
- package/lib/storage/indexed-db.js +11 -0
- package/lib/storage/node.d.ts +10 -0
- package/lib/storage/node.js +13 -0
- package/lib/storage/opfs-pool.d.ts +31 -0
- package/lib/storage/opfs-pool.js +1271 -0
- package/lib/storage/opfs-provider.d.ts +4 -0
- package/lib/storage/opfs-provider.js +257 -0
- package/lib/storage/opfs.d.ts +8 -0
- package/lib/storage/opfs.js +10 -0
- package/lib/storage/restore-cleanup.d.ts +4 -0
- package/lib/storage/restore-cleanup.js +22 -0
- package/lib/storage/web-lock.d.ts +2 -0
- package/lib/storage/web-lock.js +64 -0
- package/lib/storage-provider.d.ts +47 -0
- package/lib/storage-provider.js +141 -0
- package/lib/storage-snapshot.d.ts +44 -0
- package/lib/storage-snapshot.js +274 -0
- package/lib/storage.d.ts +46 -0
- package/lib/storage.js +83 -0
- package/lib/tool-runtime.d.ts +43 -0
- package/lib/tool-runtime.js +93 -0
- package/lib/tool-worker-common.d.ts +48 -0
- package/lib/tool-worker-common.js +97 -0
- package/lib/tool-worker.d.ts +1 -0
- package/lib/tool-worker.js +10 -0
- package/lib/types.d.ts +230 -0
- package/lib/types.js +1 -0
- package/lib/wasix-runtime.d.ts +24 -0
- package/lib/wasix-runtime.js +186 -0
- package/lib/worker-client.d.ts +4 -0
- package/lib/worker-client.js +45 -0
- package/lib/worker-dispatch.d.ts +11 -0
- package/lib/worker-dispatch.js +174 -0
- package/lib/worker-entry.bun.d.ts +2 -0
- package/lib/worker-entry.bun.js +2 -0
- package/lib/worker-entry.d.ts +2 -0
- package/lib/worker-entry.deno.d.ts +2 -0
- package/lib/worker-entry.deno.js +2 -0
- package/lib/worker-entry.js +2 -0
- package/lib/worker-entry.node.d.ts +2 -0
- package/lib/worker-entry.node.js +2 -0
- package/lib/worker-node-client.d.ts +4 -0
- package/lib/worker-node-client.js +55 -0
- package/lib/worker-rpc.d.ts +36 -0
- package/lib/worker-rpc.js +422 -0
- package/lib/worker-transfer.d.ts +6 -0
- package/lib/worker-transfer.js +11 -0
- package/lib/worker.d.ts +1 -0
- package/lib/worker.js +21 -0
- package/lib/zstd.d.ts +4 -0
- package/lib/zstd.js +12 -0
- package/node_modules/@oliphaunt/js-core/README.md +7 -0
- package/node_modules/@oliphaunt/js-core/dist/commonjs/protocol.d.ts +1 -0
- package/node_modules/@oliphaunt/js-core/dist/commonjs/protocol.js +22 -0
- package/node_modules/@oliphaunt/js-core/dist/commonjs/query.d.ts +255 -0
- package/node_modules/@oliphaunt/js-core/dist/commonjs/query.js +2068 -0
- package/node_modules/@oliphaunt/js-core/dist/module/package.json +3 -0
- package/node_modules/@oliphaunt/js-core/dist/module/protocol.d.ts +1 -0
- package/node_modules/@oliphaunt/js-core/dist/module/protocol.js +19 -0
- package/node_modules/@oliphaunt/js-core/dist/module/query.d.ts +255 -0
- package/node_modules/@oliphaunt/js-core/dist/module/query.js +2039 -0
- package/node_modules/@oliphaunt/js-core/package.json +21 -0
- package/package.json +122 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES, } from './database.js';
|
|
2
|
+
import { restoreWasixSerialized } from './client-common.js';
|
|
3
|
+
import { serializeWorkerError, } from './rpc.js';
|
|
4
|
+
import { prepareTransferableBytes } from './worker-transfer.js';
|
|
5
|
+
class WorkerStreamCallbackAborted extends Error {
|
|
6
|
+
}
|
|
7
|
+
/** @internal One request state machine shared by browser and server worker realms. */
|
|
8
|
+
export function createWorkerSessionDispatcher(openSession, respond, restore = restoreWasixSerialized, lifecycle = {}) {
|
|
9
|
+
let process;
|
|
10
|
+
let terminal = false;
|
|
11
|
+
return async (request) => {
|
|
12
|
+
let quiescentClose = false;
|
|
13
|
+
try {
|
|
14
|
+
if (terminal) {
|
|
15
|
+
throw new Error('Oliphaunt WASIX worker session is closed');
|
|
16
|
+
}
|
|
17
|
+
switch (request.method) {
|
|
18
|
+
case 'open':
|
|
19
|
+
if (process !== undefined) {
|
|
20
|
+
throw new Error('this worker already owns an Oliphaunt WASIX process');
|
|
21
|
+
}
|
|
22
|
+
process = await openSession(request.options);
|
|
23
|
+
respond({ id: request.id, ok: true });
|
|
24
|
+
return;
|
|
25
|
+
case 'restore':
|
|
26
|
+
if (process !== undefined) {
|
|
27
|
+
throw new Error('this worker already owns an Oliphaunt WASIX process');
|
|
28
|
+
}
|
|
29
|
+
await restore(request.storage, request.bytes);
|
|
30
|
+
respond({ id: request.id, ok: true });
|
|
31
|
+
return;
|
|
32
|
+
case 'exec': {
|
|
33
|
+
const response = prepareTransferableBytes(await requireProcess(process).exec(request.input, request.persistence));
|
|
34
|
+
respond({ id: request.id, ok: true, value: response.value }, response.transfer);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
case 'execStream': {
|
|
38
|
+
const session = requireProcess(process);
|
|
39
|
+
const control = new Int32Array(request.control);
|
|
40
|
+
let sequence = 0;
|
|
41
|
+
const onChunk = (chunk) => {
|
|
42
|
+
if (Atomics.load(control, 1) !== 0) {
|
|
43
|
+
throw new WorkerStreamCallbackAborted('protocol stream consumer failed');
|
|
44
|
+
}
|
|
45
|
+
sequence += 1;
|
|
46
|
+
const prepared = prepareTransferableBytes(chunk);
|
|
47
|
+
respond({
|
|
48
|
+
id: request.id,
|
|
49
|
+
kind: 'chunk',
|
|
50
|
+
sequence,
|
|
51
|
+
value: prepared.value,
|
|
52
|
+
}, prepared.transfer);
|
|
53
|
+
while (Atomics.load(control, 0) < sequence) {
|
|
54
|
+
Atomics.wait(control, 0, sequence - 1);
|
|
55
|
+
}
|
|
56
|
+
if (Atomics.load(control, 1) !== 0) {
|
|
57
|
+
throw new WorkerStreamCallbackAborted('protocol stream consumer failed');
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
};
|
|
61
|
+
let outcome;
|
|
62
|
+
if (session.execStream === undefined) {
|
|
63
|
+
const response = await session.exec(request.input, request.persistence);
|
|
64
|
+
outcome = 'complete';
|
|
65
|
+
try {
|
|
66
|
+
for (let offset = 0; offset < response.length; offset += WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES) {
|
|
67
|
+
onChunk(response.slice(offset, offset + WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (!(error instanceof WorkerStreamCallbackAborted))
|
|
72
|
+
throw error;
|
|
73
|
+
outcome = 'callbackAborted';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
outcome = await session.execStream(request.input, onChunk, request.persistence);
|
|
78
|
+
}
|
|
79
|
+
respond({ id: request.id, ok: true, streamOutcome: outcome });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
case 'sync':
|
|
83
|
+
await requireProcess(process).sync(request.boundary);
|
|
84
|
+
respond({ id: request.id, ok: true });
|
|
85
|
+
return;
|
|
86
|
+
case 'backup': {
|
|
87
|
+
const session = requireProcess(process);
|
|
88
|
+
if (session.backup === undefined) {
|
|
89
|
+
throw new Error('this WASIX worker session does not support physical backup');
|
|
90
|
+
}
|
|
91
|
+
const archive = prepareTransferableBytes(await session.backup());
|
|
92
|
+
respond({ id: request.id, ok: true, value: archive.value }, archive.transfer);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
case 'runPgDump': {
|
|
96
|
+
const session = requireProcess(process);
|
|
97
|
+
if (session.runPgDump === undefined) {
|
|
98
|
+
throw new Error('this WASIX worker session does not support pg_dump');
|
|
99
|
+
}
|
|
100
|
+
const result = await session.runPgDump({ tool: request.tool, args: request.args });
|
|
101
|
+
const stdout = prepareTransferableBytes(result.stdout);
|
|
102
|
+
const stderr = prepareTransferableBytes(result.stderr);
|
|
103
|
+
respond({
|
|
104
|
+
id: request.id,
|
|
105
|
+
ok: true,
|
|
106
|
+
value: {
|
|
107
|
+
exitCode: result.exitCode,
|
|
108
|
+
stdout: stdout.value,
|
|
109
|
+
stderr: stderr.value,
|
|
110
|
+
},
|
|
111
|
+
}, [...new Set([...stdout.transfer, ...stderr.transfer])]);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
case 'runTool': {
|
|
115
|
+
const session = requireProcess(process);
|
|
116
|
+
if (session.runTool === undefined) {
|
|
117
|
+
throw new Error('this WASIX worker session does not support native tools');
|
|
118
|
+
}
|
|
119
|
+
const result = await session.runTool(request.options);
|
|
120
|
+
const stdout = prepareTransferableBytes(result.stdout);
|
|
121
|
+
const stderr = prepareTransferableBytes(result.stderr);
|
|
122
|
+
respond({
|
|
123
|
+
id: request.id,
|
|
124
|
+
ok: true,
|
|
125
|
+
value: {
|
|
126
|
+
exitCode: result.exitCode,
|
|
127
|
+
stdout: stdout.value,
|
|
128
|
+
stderr: stderr.value,
|
|
129
|
+
},
|
|
130
|
+
}, [...new Set([...stdout.transfer, ...stderr.transfer])]);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
case 'serve': {
|
|
134
|
+
const session = requireProcess(process);
|
|
135
|
+
if (session.serve === undefined) {
|
|
136
|
+
throw new Error('this WASIX worker session does not support protocol connections');
|
|
137
|
+
}
|
|
138
|
+
await session.serve(request.connection, request.mode);
|
|
139
|
+
respond({ id: request.id, ok: true });
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
case 'close': {
|
|
143
|
+
const closing = requireProcess(process);
|
|
144
|
+
// Retire the dispatcher before awaiting guest/provider teardown. A
|
|
145
|
+
// rejected close cannot make a Worker whose transport will be
|
|
146
|
+
// destroyed by its owner safe to reopen or use again.
|
|
147
|
+
process = undefined;
|
|
148
|
+
terminal = true;
|
|
149
|
+
quiescentClose = true;
|
|
150
|
+
await closing.close();
|
|
151
|
+
respond({ id: request.id, ok: true });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
respond({
|
|
158
|
+
id: request.id,
|
|
159
|
+
ok: false,
|
|
160
|
+
error: serializeWorkerError(error),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
if (quiescentClose)
|
|
165
|
+
lifecycle.onQuiescentClose?.();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function requireProcess(process) {
|
|
170
|
+
if (process === undefined) {
|
|
171
|
+
throw new Error('Oliphaunt WASIX process is not open');
|
|
172
|
+
}
|
|
173
|
+
return process;
|
|
174
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OliphauntClient, OliphauntDatabase, OpenConfig } from './types.js';
|
|
2
|
+
/** Open PostgreSQL in a package-owned Node-compatible Worker realm. */
|
|
3
|
+
export declare function openWasix(config?: OpenConfig): Promise<OliphauntDatabase>;
|
|
4
|
+
export declare const Oliphaunt: OliphauntClient;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Worker } from 'node:worker_threads';
|
|
2
|
+
import { serializeOpenConfig } from './client-common.js';
|
|
3
|
+
import { hostRuntimeName } from './host-runtime.js';
|
|
4
|
+
import { requireNodeStorage } from './node-client-common.js';
|
|
5
|
+
import { nodeWorkerExecArgv } from './node-worker-options.js';
|
|
6
|
+
import { nodeWorkerPort } from './node-worker-port.js';
|
|
7
|
+
import { openWasixWithWorker, restoreWasixWithWorker } from './worker-rpc.js';
|
|
8
|
+
/** Open PostgreSQL in a package-owned Node-compatible Worker realm. */
|
|
9
|
+
export async function openWasix(config = {}) {
|
|
10
|
+
// The native Worker owns release-embedded runtime assets. Do not structured-
|
|
11
|
+
// clone caller-provided WebAssembly archives that the N-API path will never
|
|
12
|
+
// read; retain their exact identity metadata for compatibility validation.
|
|
13
|
+
const openOptions = withoutNativeAssetPayloads(serializeOpenConfig(config));
|
|
14
|
+
return openWasixWithWorker(createNodeWorker, openOptions, requireNodeStorage, false);
|
|
15
|
+
}
|
|
16
|
+
export const Oliphaunt = {
|
|
17
|
+
open: openWasix,
|
|
18
|
+
restore: restoreNodeWasixWithWorker,
|
|
19
|
+
};
|
|
20
|
+
async function restoreNodeWasixWithWorker(storage, bytes) {
|
|
21
|
+
return restoreWasixWithWorker(createNodeWorker, storage, bytes, requireNodeStorage);
|
|
22
|
+
}
|
|
23
|
+
function createNodeWorker(_options) {
|
|
24
|
+
return nodeWorkerPort(new Worker(new URL('./node-worker.js', import.meta.url), {
|
|
25
|
+
execArgv: nodeWorkerExecArgv(),
|
|
26
|
+
name: 'oliphaunt-wasix',
|
|
27
|
+
}), hostRuntimeName());
|
|
28
|
+
}
|
|
29
|
+
function withoutNativeAssetPayloads(options) {
|
|
30
|
+
const source = 'oliphaunt:wasix-napi-embedded';
|
|
31
|
+
return {
|
|
32
|
+
...options,
|
|
33
|
+
runtime: {
|
|
34
|
+
...options.runtime,
|
|
35
|
+
runtimeArchive: { ...options.runtime.runtimeArchive, source },
|
|
36
|
+
standardSeedArchive: { ...options.runtime.standardSeedArchive, source },
|
|
37
|
+
standardSeedManifest: { ...options.runtime.standardSeedManifest, source },
|
|
38
|
+
manifest: { ...options.runtime.manifest, source },
|
|
39
|
+
},
|
|
40
|
+
...(options.icu === undefined
|
|
41
|
+
? {}
|
|
42
|
+
: {
|
|
43
|
+
icu: {
|
|
44
|
+
...options.icu,
|
|
45
|
+
dataArchive: { ...options.icu.dataArchive, source },
|
|
46
|
+
clusterSeedArchive: { ...options.icu.clusterSeedArchive, source },
|
|
47
|
+
clusterSeedManifest: { ...options.icu.clusterSeedManifest, source },
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
extensionCarriers: Object.fromEntries(Object.entries(options.extensionCarriers).map(([sqlName, carrier]) => [
|
|
51
|
+
sqlName,
|
|
52
|
+
{ ...carrier, source },
|
|
53
|
+
])),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type WasixDatabaseSessionTerminalState, type WasixPersistenceMode, type WasixProtocolStreamOutcome } from './database.js';
|
|
2
|
+
import type { SerializedOpenOptions, WorkerRequest, WorkerResponse } from './rpc.js';
|
|
3
|
+
import type { BinaryInput, OliphauntDatabase, OpenConfig } from './types.js';
|
|
4
|
+
import type { WasixToolProcessResult } from './tool-runtime.js';
|
|
5
|
+
type WorkerResponseValue = Uint8Array | WasixToolProcessResult | WasixProtocolStreamOutcome | undefined;
|
|
6
|
+
type WorkerRequestWithoutId = WorkerRequest extends infer Request ? Request extends {
|
|
7
|
+
id: number;
|
|
8
|
+
} ? Omit<Request, 'id'> : never : never;
|
|
9
|
+
export type WasixWorkerPort = {
|
|
10
|
+
/** Shared memory is available only for a same-process Worker transport. */
|
|
11
|
+
readonly supportsSharedMemory?: boolean;
|
|
12
|
+
postMessage(message: WorkerRequest, transfer: readonly Transferable[]): void;
|
|
13
|
+
/** Mark and await a Worker-initiated exit after its quiescent close reply. */
|
|
14
|
+
expectSelfExit?(): Promise<void>;
|
|
15
|
+
terminate(): void | Promise<void>;
|
|
16
|
+
onMessage(listener: (message: WorkerResponse) => void): void;
|
|
17
|
+
onFatal(listener: (error: Error) => void): void;
|
|
18
|
+
};
|
|
19
|
+
/** @internal Open through a package-owned isolated host without burdening the direct graph. */
|
|
20
|
+
export declare function openWasixWithWorker(createWorker: (options: SerializedOpenOptions) => WasixWorkerPort, openOptions: SerializedOpenOptions, validate?: (options: SerializedOpenOptions) => void, transferAssets?: boolean): Promise<OliphauntDatabase>;
|
|
21
|
+
/** @internal Restore through a temporary package-owned isolated host. */
|
|
22
|
+
export declare function restoreWasixWithWorker(createWorker: (options: SerializedOpenOptions) => WasixWorkerPort, storage: OpenConfig['storage'], bytes: BinaryInput, validate?: (options: SerializedOpenOptions) => void): Promise<void>;
|
|
23
|
+
/** @internal Correlates worker requests and fails them as one unit if the worker exits. */
|
|
24
|
+
export declare class WorkerRpc {
|
|
25
|
+
#private;
|
|
26
|
+
readonly terminalState: WasixDatabaseSessionTerminalState;
|
|
27
|
+
constructor(worker: WasixWorkerPort);
|
|
28
|
+
get supportsSharedMemory(): boolean;
|
|
29
|
+
request(request: WorkerRequestWithoutId, transfer?: Transferable[]): Promise<WorkerResponseValue>;
|
|
30
|
+
stream(input: Uint8Array, persistence: WasixPersistenceMode, onChunk: (chunk: Uint8Array) => void): Promise<WasixProtocolStreamOutcome>;
|
|
31
|
+
terminate(): Promise<void>;
|
|
32
|
+
expectSelfExit(): Promise<void> | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** @internal Opens exactly one database and guarantees worker cleanup on failure. */
|
|
35
|
+
export declare function openWorkerDatabase(worker: WasixWorkerPort, options: SerializedOpenOptions, transfer?: Transferable[]): Promise<OliphauntDatabase>;
|
|
36
|
+
export {};
|