@oliphaunt/wasix-ts 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +55 -32
- package/CHANGELOG.md +38 -0
- package/README.md +19 -387
- package/THIRD_PARTY_NOTICES.md +5 -5
- package/lib/browser.d.ts +2 -0
- package/lib/browser.js +6 -0
- package/lib/{database.d.ts → core/database.d.ts} +4 -4
- package/lib/{database.js → core/database.js} +1 -1
- package/lib/core/open-config.d.ts +5 -0
- package/lib/core/open-config.js +28 -0
- package/lib/{public.d.ts → core/public.d.ts} +3 -3
- package/lib/{public.js → core/public.js} +2 -2
- package/lib/{types.d.ts → core/types.d.ts} +19 -43
- package/lib/direct.node.d.ts +2 -2
- package/lib/direct.node.js +2 -2
- package/lib/host/index.d.mts +1 -1
- package/lib/host/index.mjs +1 -1
- package/lib/host/provenance.json +1 -1
- package/lib/host/wasmer_js_bg.wasm +0 -0
- package/lib/hosts/browser/browser-public.d.ts +8 -0
- package/lib/hosts/browser/browser-public.js +1 -0
- package/lib/{client-common.d.ts → hosts/browser/client-common.d.ts} +3 -3
- package/lib/hosts/browser/client-common.js +17 -0
- package/lib/{client.d.ts → hosts/browser/client.d.ts} +1 -1
- package/lib/{client.js → hosts/browser/client.js} +5 -3
- package/lib/{direct-client-common.d.ts → hosts/browser/direct-client-common.d.ts} +9 -8
- package/lib/{direct-client-common.js → hosts/browser/direct-client-common.js} +17 -31
- package/lib/hosts/browser/initialize.d.ts +5 -0
- package/lib/hosts/browser/initialize.js +67 -0
- package/lib/{internal-common.d.ts → hosts/browser/internal-common.d.ts} +3 -3
- package/lib/{internal-common.js → hosts/browser/internal-common.js} +3 -3
- package/lib/{tool-worker-common.d.ts → hosts/browser/tool-worker-common.d.ts} +3 -3
- package/lib/{tool-worker-common.js → hosts/browser/tool-worker-common.js} +2 -2
- package/lib/{tool-worker.js → hosts/browser/tool-worker.js} +1 -1
- package/lib/{wasix-runtime.d.ts → hosts/browser/wasix-runtime.d.ts} +3 -3
- package/lib/{wasix-runtime.js → hosts/browser/wasix-runtime.js} +41 -25
- package/lib/{worker-client.d.ts → hosts/browser/worker-client.d.ts} +1 -1
- package/lib/{worker-client.js → hosts/browser/worker-client.js} +5 -4
- package/lib/{worker.js → hosts/browser/worker.js} +2 -2
- package/lib/{direct-client.d.ts → hosts/node-api/direct-client.d.ts} +1 -1
- package/lib/{direct-client.js → hosts/node-api/direct-client.js} +1 -1
- package/lib/{native-addon.d.ts → hosts/node-api/native-addon.d.ts} +28 -6
- package/lib/{native-addon.js → hosts/node-api/native-addon.js} +4 -5
- package/lib/hosts/node-api/native-public.d.ts +8 -0
- package/lib/hosts/node-api/native-public.js +1 -0
- package/lib/{native-server.d.ts → hosts/node-api/native-server.d.ts} +1 -1
- package/lib/{native-server.js → hosts/node-api/native-server.js} +3 -2
- package/lib/{native-session.d.ts → hosts/node-api/native-session.d.ts} +14 -4
- package/lib/{native-session.js → hosts/node-api/native-session.js} +93 -108
- package/lib/{node-actor.d.ts → hosts/node-api/node-actor.d.ts} +2 -2
- package/lib/{node-actor.js → hosts/node-api/node-actor.js} +1 -1
- package/lib/{node-client-common.d.ts → hosts/node-api/node-client-common.d.ts} +3 -3
- package/lib/{node-client-common.js → hosts/node-api/node-client-common.js} +4 -4
- package/lib/{node-client.d.ts → hosts/node-api/node-client.d.ts} +1 -1
- package/lib/{node-client.js → hosts/node-api/node-client.js} +1 -1
- package/lib/{node-direct.d.ts → hosts/node-api/node-direct.d.ts} +2 -2
- package/lib/{node-direct.js → hosts/node-api/node-direct.js} +1 -1
- package/lib/{node-worker-port.d.ts → hosts/node-api/node-worker-port.d.ts} +1 -1
- package/lib/{node-worker.js → hosts/node-api/node-worker.js} +1 -1
- package/lib/{worker-node-client.d.ts → hosts/node-api/worker-node-client.d.ts} +1 -1
- package/lib/{worker-node-client.js → hosts/node-api/worker-node-client.js} +5 -18
- package/lib/index.bun.d.ts +2 -2
- package/lib/index.bun.js +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.deno.d.ts +2 -2
- package/lib/index.deno.js +2 -2
- package/lib/index.js +2 -2
- package/lib/index.node.d.ts +2 -2
- package/lib/index.node.js +2 -2
- package/lib/internal.d.ts +4 -4
- package/lib/internal.js +24 -4
- package/lib/internal.node.d.ts +4 -4
- package/lib/internal.node.js +2 -2
- package/lib/native-only.d.ts +1 -0
- package/lib/native-only.js +2 -0
- package/lib/protocol/protocol.d.ts +1 -0
- package/lib/protocol/protocol.js +1 -0
- package/lib/protocol/query.d.ts +1 -0
- package/lib/protocol/query.js +1 -0
- package/lib/{archive.d.ts → resources/archive.d.ts} +1 -1
- package/lib/{descriptor-validation.d.ts → resources/descriptor-validation.d.ts} +2 -2
- package/lib/{descriptor-validation.js → resources/descriptor-validation.js} +1 -1
- package/lib/{extension-descriptor.d.ts → resources/extension-descriptor.d.ts} +2 -2
- package/lib/{extensions.d.ts → resources/extensions.d.ts} +13 -6
- package/lib/{extensions.js → resources/extensions.js} +80 -155
- package/lib/resources/icu-descriptor.d.ts +3 -0
- package/lib/resources/icu-descriptor.js +16 -0
- package/lib/{runtime-descriptor.d.ts → resources/runtime-descriptor.d.ts} +1 -1
- package/lib/{runtime-descriptor.js → resources/runtime-descriptor.js} +1 -24
- package/lib/{tool-runtime.d.ts → resources/tool-runtime.d.ts} +8 -2
- package/lib/server.node.d.ts +1 -1
- package/lib/server.node.js +1 -1
- package/lib/{database-root.d.ts → storage/database-root.d.ts} +8 -0
- package/lib/{database-root.js → storage/database-root.js} +6 -0
- package/lib/storage/incremental-storage.d.ts +3 -3
- package/lib/storage/incremental-storage.js +2 -2
- package/lib/storage/indexed-db-provider.d.ts +2 -2
- package/lib/storage/indexed-db-provider.js +3 -3
- package/lib/storage/indexed-db.d.ts +2 -2
- package/lib/storage/indexed-db.js +1 -1
- package/lib/storage/node.d.ts +2 -2
- package/lib/storage/node.js +1 -1
- package/lib/storage/opfs-pool.d.ts +2 -2
- package/lib/storage/opfs-pool.js +4 -4
- package/lib/storage/opfs-provider.d.ts +2 -2
- package/lib/storage/opfs-provider.js +1 -1
- package/lib/storage/opfs.d.ts +2 -2
- package/lib/storage/opfs.js +1 -1
- package/lib/{physical-archive.js → storage/physical-archive.js} +4 -4
- package/lib/storage/restore-cleanup.d.ts +1 -1
- package/lib/storage/restore-cleanup.js +1 -1
- package/lib/{storage-provider.d.ts → storage/storage-provider.d.ts} +5 -11
- package/lib/{storage-provider.js → storage/storage-provider.js} +8 -13
- package/lib/{storage-snapshot.d.ts → storage/storage-snapshot.d.ts} +2 -2
- package/lib/{storage.d.ts → storage/types.d.ts} +8 -7
- package/lib/storage/web-lock.js +1 -1
- package/lib/worker-entry.bun.d.ts +2 -2
- package/lib/worker-entry.bun.js +2 -2
- package/lib/worker-entry.d.ts +2 -2
- package/lib/worker-entry.deno.d.ts +2 -2
- package/lib/worker-entry.deno.js +2 -2
- package/lib/worker-entry.js +2 -2
- package/lib/worker-entry.node.d.ts +2 -2
- package/lib/worker-entry.node.js +2 -2
- package/lib/{rpc.d.ts → workers/rpc.d.ts} +14 -34
- package/lib/{rpc.js → workers/rpc.js} +4 -4
- package/lib/{worker-dispatch.d.ts → workers/worker-dispatch.d.ts} +1 -1
- package/lib/{worker-dispatch.js → workers/worker-dispatch.js} +2 -2
- package/lib/{worker-rpc.d.ts → workers/worker-rpc.d.ts} +3 -3
- package/lib/{worker-rpc.js → workers/worker-rpc.js} +8 -12
- package/package.json +66 -30
- package/lib/client-common.js +0 -36
- package/lib/icu-descriptor.d.ts +0 -3
- package/lib/icu-descriptor.js +0 -92
- package/lib/protocol.d.ts +0 -1
- package/lib/protocol.js +0 -1
- package/lib/query.d.ts +0 -1
- package/lib/query.js +0 -1
- package/node_modules/@oliphaunt/js-core/README.md +0 -7
- package/node_modules/@oliphaunt/js-core/dist/commonjs/protocol.d.ts +0 -1
- package/node_modules/@oliphaunt/js-core/dist/commonjs/protocol.js +0 -22
- package/node_modules/@oliphaunt/js-core/dist/commonjs/query.d.ts +0 -255
- package/node_modules/@oliphaunt/js-core/dist/commonjs/query.js +0 -2068
- package/node_modules/@oliphaunt/js-core/dist/module/package.json +0 -3
- package/node_modules/@oliphaunt/js-core/dist/module/protocol.d.ts +0 -1
- package/node_modules/@oliphaunt/js-core/dist/module/protocol.js +0 -19
- package/node_modules/@oliphaunt/js-core/dist/module/query.d.ts +0 -255
- package/node_modules/@oliphaunt/js-core/dist/module/query.js +0 -2039
- package/node_modules/@oliphaunt/js-core/package.json +0 -21
- /package/lib/{errors.d.ts → core/errors.d.ts} +0 -0
- /package/lib/{errors.js → core/errors.js} +0 -0
- /package/lib/{startup-config.d.ts → core/startup-config.d.ts} +0 -0
- /package/lib/{startup-config.js → core/startup-config.js} +0 -0
- /package/lib/{types.js → core/types.js} +0 -0
- /package/lib/{tool-worker.d.ts → hosts/browser/tool-worker.d.ts} +0 -0
- /package/lib/{worker.d.ts → hosts/browser/worker.d.ts} +0 -0
- /package/lib/{host-runtime.d.ts → hosts/node-api/host-runtime.d.ts} +0 -0
- /package/lib/{host-runtime.js → hosts/node-api/host-runtime.js} +0 -0
- /package/lib/{node-worker-options.d.ts → hosts/node-api/node-worker-options.d.ts} +0 -0
- /package/lib/{node-worker-options.js → hosts/node-api/node-worker-options.js} +0 -0
- /package/lib/{node-worker-port.js → hosts/node-api/node-worker-port.js} +0 -0
- /package/lib/{node-worker.d.ts → hosts/node-api/node-worker.d.ts} +0 -0
- /package/lib/{byte-channel.d.ts → protocol/byte-channel.d.ts} +0 -0
- /package/lib/{byte-channel.js → protocol/byte-channel.js} +0 -0
- /package/lib/{pgwire-connection.d.ts → protocol/pgwire-connection.d.ts} +0 -0
- /package/lib/{pgwire-connection.js → protocol/pgwire-connection.js} +0 -0
- /package/lib/{pgwire.d.ts → protocol/pgwire.d.ts} +0 -0
- /package/lib/{pgwire.js → protocol/pgwire.js} +0 -0
- /package/lib/{archive.js → resources/archive.js} +0 -0
- /package/lib/{asset-source.d.ts → resources/asset-source.d.ts} +0 -0
- /package/lib/{asset-source.js → resources/asset-source.js} +0 -0
- /package/lib/{extension-descriptor.js → resources/extension-descriptor.js} +0 -0
- /package/lib/{tool-runtime.js → resources/tool-runtime.js} +0 -0
- /package/lib/{zstd.d.ts → resources/zstd.d.ts} +0 -0
- /package/lib/{zstd.js → resources/zstd.js} +0 -0
- /package/lib/{physical-archive.d.ts → storage/physical-archive.d.ts} +0 -0
- /package/lib/{storage-snapshot.js → storage/storage-snapshot.js} +0 -0
- /package/lib/{storage.js → storage/types.js} +0 -0
- /package/lib/{worker-transfer.d.ts → workers/worker-transfer.d.ts} +0 -0
- /package/lib/{worker-transfer.js → workers/worker-transfer.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type WasixClusterSeedLoader, type WasixPhysicalIdentity, type WasixStorageSyncBoundary } from '
|
|
2
|
-
import { type StorageDelta, type StoredSnapshot } from '
|
|
1
|
+
import { type WasixClusterSeedLoader, type WasixPhysicalIdentity, type WasixStorageSyncBoundary } from './storage-provider.js';
|
|
2
|
+
import { type StorageDelta, type StoredSnapshot } from './storage-snapshot.js';
|
|
3
3
|
export declare const OPFS_POOL_ROOT = ".oliphaunt-wasix-pool-v1";
|
|
4
4
|
export type PooledOpfsDatabase = Readonly<{
|
|
5
5
|
snapshot: StoredSnapshot | undefined;
|
package/lib/storage/opfs-pool.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { parseJsonWithUniqueObjectKeys } from '
|
|
2
|
-
import { composeWasixStorageFailure, WasixStorageError } from '../errors.js';
|
|
3
|
-
import { assertWasixPhysicalIdentity, physicalIdentityMatches, } from '
|
|
4
|
-
import { splitStorageDeltaDeletes, VOLATILE_DATABASE_FILES, validateDirectoryEntryName, validateStoredSnapshot, } from '
|
|
1
|
+
import { parseJsonWithUniqueObjectKeys } from './database-root.js';
|
|
2
|
+
import { composeWasixStorageFailure, WasixStorageError } from '../core/errors.js';
|
|
3
|
+
import { assertWasixPhysicalIdentity, physicalIdentityMatches, } from './storage-provider.js';
|
|
4
|
+
import { splitStorageDeltaDeletes, VOLATILE_DATABASE_FILES, validateDirectoryEntryName, validateStoredSnapshot, } from './storage-snapshot.js';
|
|
5
5
|
export const OPFS_POOL_ROOT = '.oliphaunt-wasix-pool-v1';
|
|
6
6
|
const STATE_FILE = 'state.json';
|
|
7
7
|
const DATA_DIRECTORY = 'data';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WasixClusterSeedLoader, WasixPhysicalIdentity, WasixStorageLease } from '
|
|
2
|
-
import type { StoredSnapshot } from '
|
|
1
|
+
import type { WasixClusterSeedLoader, WasixPhysicalIdentity, WasixStorageLease } from './storage-provider.js';
|
|
2
|
+
import type { StoredSnapshot } from './storage-snapshot.js';
|
|
3
3
|
export declare function acquireOpfsStorage(name: string, loadClusterSeed: WasixClusterSeedLoader, physicalIdentity: WasixPhysicalIdentity): Promise<WasixStorageLease>;
|
|
4
4
|
export declare function restoreOpfsStorage(name: string, snapshot: StoredSnapshot, physicalIdentity: WasixPhysicalIdentity): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { composeWasixStorageFailure, WasixStorageError } from '../errors.js';
|
|
1
|
+
import { composeWasixStorageFailure, WasixStorageError } from '../core/errors.js';
|
|
2
2
|
import { acquireIncrementalStorage } from './incremental-storage.js';
|
|
3
3
|
import { applyPooledOpfsDelta, DirectOpfsPool, inspectPooledOpfsDatabase, openPooledDatabaseDirectory, openPooledOpfsRoot, preparePooledOpfsDatabase, } from './opfs-pool.js';
|
|
4
4
|
import { releaseRestoreLock } from './restore-cleanup.js';
|
package/lib/storage/opfs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type PersistentWasixStorage } from '
|
|
1
|
+
import { type PersistentWasixStorage } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Select an origin-private opaque database pool. Worker execution uses
|
|
4
4
|
* same-realm synchronous exact-range I/O; other placements publish to the
|
|
5
5
|
* same format through the portable journaled path.
|
|
6
6
|
*/
|
|
7
|
-
export declare function opfs(name: string): PersistentWasixStorage
|
|
7
|
+
export declare function opfs(name: string): PersistentWasixStorage<'opfs'>;
|
|
8
8
|
export default opfs;
|
package/lib/storage/opfs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PHYSICAL_FORMAT as WASIX_PHYSICAL_FORMAT, POSTGRES_MAJOR as WASIX_POSTGRES_MAJOR, } from '@oliphaunt/liboliphaunt-wasix';
|
|
2
|
-
import { extractTar } from '
|
|
3
|
-
import { WasixStorageError } from '
|
|
4
|
-
import { simpleQuery } from '
|
|
5
|
-
import { PostgresError, parseSimpleQueryRawResponse } from '
|
|
2
|
+
import { extractTar } from '../resources/archive.js';
|
|
3
|
+
import { WasixStorageError } from '../core/errors.js';
|
|
4
|
+
import { simpleQuery } from '../protocol/protocol.js';
|
|
5
|
+
import { PostgresError, parseSimpleQueryRawResponse, } from '../protocol/query.js';
|
|
6
6
|
import { snapshotStorageDirectory, validateStoredSnapshot, } from './storage-snapshot.js';
|
|
7
7
|
const TAR_BLOCK_BYTES = 512;
|
|
8
8
|
const ARCHIVE_MANIFEST_PATH = '.oliphaunt/backup-manifest.properties';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WasixStorageCommitState } from '../errors.js';
|
|
1
|
+
import { type WasixStorageCommitState } from '../core/errors.js';
|
|
2
2
|
import type { ExclusiveStorageLock } from './incremental-storage.js';
|
|
3
3
|
/** Preserve a restore failure while making ownership-release failure observable. */
|
|
4
4
|
export declare function releaseRestoreLock(lock: ExclusiveStorageLock, label: string, commitState: WasixStorageCommitState, primary: unknown): Promise<unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { composeWasixStorageFailure, WasixStorageError, } from '../errors.js';
|
|
1
|
+
import { composeWasixStorageFailure, WasixStorageError, } from '../core/errors.js';
|
|
2
2
|
/** Preserve a restore failure while making ownership-release failure observable. */
|
|
3
3
|
export async function releaseRestoreLock(lock, label, commitState, primary) {
|
|
4
4
|
try {
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { WasixDirectoryMount } from '
|
|
2
|
-
import type
|
|
3
|
-
|
|
1
|
+
import type { WasixDirectoryMount } from '../resources/archive.js';
|
|
2
|
+
import { type WasixPhysicalIdentity } from './database-root.js';
|
|
3
|
+
export { WASIX_PHYSICAL_IDENTITY, type WasixPhysicalIdentity } from './database-root.js';
|
|
4
|
+
import type { Directory } from '../host/index.mjs';
|
|
5
|
+
import type { SerializedWasixStorage } from './types.js';
|
|
4
6
|
import type { StoredSnapshot } from './storage-snapshot.js';
|
|
5
|
-
/** Stable fields that determine whether a WASIX runtime may open stored PGDATA. */
|
|
6
|
-
export type WasixPhysicalIdentity = Readonly<{
|
|
7
|
-
schema: 'oliphaunt-physical-format-v1';
|
|
8
|
-
engineFamily: 'wasix';
|
|
9
|
-
postgresMajor: number;
|
|
10
|
-
physicalFormat: string;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const WASIX_PHYSICAL_IDENTITY: WasixPhysicalIdentity;
|
|
13
7
|
export type StorageDirectoryEntry = Readonly<{
|
|
14
8
|
type: 'dir' | 'file' | 'unknown';
|
|
15
9
|
name: string;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
schema: 'oliphaunt-physical-format-v1',
|
|
6
|
-
engineFamily: 'wasix',
|
|
7
|
-
postgresMajor: DATABASE_ROOT_POSTGRES_MAJOR,
|
|
8
|
-
physicalFormat: WASIX_PHYSICAL_FORMAT,
|
|
9
|
-
});
|
|
1
|
+
import { WASIX_PHYSICAL_IDENTITY } from './database-root.js';
|
|
2
|
+
export { WASIX_PHYSICAL_IDENTITY } from './database-root.js';
|
|
3
|
+
import { WasixStorageError } from '../core/errors.js';
|
|
4
|
+
import { validateIndexedDbDatabaseName, validateOpfsDatabaseName } from './types.js';
|
|
10
5
|
/** Restore a validated snapshot into a closed, empty persistent destination. */
|
|
11
6
|
export async function restoreWasixStorage(storage, snapshot, identity) {
|
|
12
7
|
switch (storage.kind) {
|
|
@@ -17,12 +12,12 @@ export async function restoreWasixStorage(storage, snapshot, identity) {
|
|
|
17
12
|
});
|
|
18
13
|
case 'indexed-db': {
|
|
19
14
|
validateIndexedDbDatabaseName(storage.name);
|
|
20
|
-
const { restoreIndexedDbStorage } = await import('./
|
|
15
|
+
const { restoreIndexedDbStorage } = await import('./indexed-db-provider.js');
|
|
21
16
|
return restoreIndexedDbStorage(storage.name, snapshot, identity);
|
|
22
17
|
}
|
|
23
18
|
case 'opfs': {
|
|
24
19
|
validateOpfsDatabaseName(storage.name);
|
|
25
|
-
const { restoreOpfsStorage } = await import('./
|
|
20
|
+
const { restoreOpfsStorage } = await import('./opfs-provider.js');
|
|
26
21
|
return restoreOpfsStorage(storage.name, snapshot, identity);
|
|
27
22
|
}
|
|
28
23
|
case 'directory':
|
|
@@ -41,12 +36,12 @@ export async function acquireWasixStorage(storage, loadClusterSeed, identity) {
|
|
|
41
36
|
return memoryLease(await loadClusterSeed());
|
|
42
37
|
case 'indexed-db': {
|
|
43
38
|
validateIndexedDbDatabaseName(storage.name);
|
|
44
|
-
const { acquireIndexedDbStorage } = await import('./
|
|
39
|
+
const { acquireIndexedDbStorage } = await import('./indexed-db-provider.js');
|
|
45
40
|
return acquireIndexedDbStorage(storage.name, loadClusterSeed, identity);
|
|
46
41
|
}
|
|
47
42
|
case 'opfs': {
|
|
48
43
|
validateOpfsDatabaseName(storage.name);
|
|
49
|
-
const { acquireOpfsStorage } = await import('./
|
|
44
|
+
const { acquireOpfsStorage } = await import('./opfs-provider.js');
|
|
50
45
|
return acquireOpfsStorage(storage.name, loadClusterSeed, identity);
|
|
51
46
|
}
|
|
52
47
|
case 'directory':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WasixDirectoryMount } from '
|
|
2
|
-
import type { WasixStorageError } from '
|
|
1
|
+
import type { WasixDirectoryMount } from '../resources/archive.js';
|
|
2
|
+
import type { WasixStorageError } from '../core/errors.js';
|
|
3
3
|
import type { StorageDirectory } from './storage-provider.js';
|
|
4
4
|
export declare const VOLATILE_DATABASE_FILES: Set<string>;
|
|
5
5
|
export type StoredSnapshot = {
|
|
@@ -4,11 +4,12 @@ declare const persistentStorageDescriptorBrand: unique symbol;
|
|
|
4
4
|
* An opaque storage selection created by this package's storage factories.
|
|
5
5
|
* The descriptor is deliberately not a bag of user-authored paths or assets.
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
8
|
-
|
|
7
|
+
export type WasixStorageKind = 'memory' | 'directory' | 'indexed-db' | 'opfs';
|
|
8
|
+
export type WasixStorage<Kind extends WasixStorageKind = WasixStorageKind> = Readonly<{
|
|
9
|
+
[storageDescriptorBrand]: Kind;
|
|
9
10
|
}>;
|
|
10
11
|
/** Opaque persistent storage accepted by static physical restore. */
|
|
11
|
-
export type PersistentWasixStorage = WasixStorage & Readonly<{
|
|
12
|
+
export type PersistentWasixStorage<Kind extends Exclude<WasixStorageKind, 'memory'> = Exclude<WasixStorageKind, 'memory'>> = WasixStorage<Kind> & Readonly<{
|
|
12
13
|
[persistentStorageDescriptorBrand]: 'oliphaunt-wasix-persistent-storage';
|
|
13
14
|
}>;
|
|
14
15
|
export type SerializedWasixStorage = Readonly<{
|
|
@@ -31,13 +32,13 @@ export type SerializedWasixStorage = Readonly<{
|
|
|
31
32
|
* Select a fresh in-memory database. This is also the default when `storage`
|
|
32
33
|
* is omitted. Reusing the descriptor does not preserve data.
|
|
33
34
|
*/
|
|
34
|
-
export declare function memory(): WasixStorage
|
|
35
|
+
export declare function memory(): WasixStorage<'memory'>;
|
|
35
36
|
/** @internal Used by the selectively imported IndexedDB adapter. */
|
|
36
|
-
export declare function defineIndexedDbStorage(name: string): PersistentWasixStorage
|
|
37
|
+
export declare function defineIndexedDbStorage(name: string): PersistentWasixStorage<'indexed-db'>;
|
|
37
38
|
/** @internal Used by the selectively imported OPFS adapter. */
|
|
38
|
-
export declare function defineOpfsStorage(name: string): PersistentWasixStorage
|
|
39
|
+
export declare function defineOpfsStorage(name: string): PersistentWasixStorage<'opfs'>;
|
|
39
40
|
/** @internal Used by the selectively imported Node directory adapter. */
|
|
40
|
-
export declare function defineDirectoryStorage(path: string): PersistentWasixStorage
|
|
41
|
+
export declare function defineDirectoryStorage(path: string): PersistentWasixStorage<'directory'>;
|
|
41
42
|
/** @internal Validate and project the opaque main-thread value for the worker. */
|
|
42
43
|
export declare function serializeWasixStorage(storage: WasixStorage | undefined): SerializedWasixStorage;
|
|
43
44
|
export declare function validateIndexedDbDatabaseName(name: unknown): asserts name is string;
|
package/lib/storage/web-lock.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
package/lib/worker-entry.bun.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
package/lib/worker-entry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/browser/worker-client.js';
|
|
2
|
+
export * from './hosts/browser/browser-public.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
package/lib/worker-entry.deno.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
package/lib/worker-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/browser/worker-client.js';
|
|
2
|
+
export * from './hosts/browser/browser-public.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
package/lib/worker-entry.node.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Oliphaunt, Oliphaunt as default } from './worker-node-client.js';
|
|
2
|
-
export * from './public.js';
|
|
1
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/node-api/worker-node-client.js';
|
|
2
|
+
export * from './hosts/node-api/native-public.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { WasixPersistenceMode, WasixProtocolConnectionMode, WasixProtocolStreamOutcome } from '
|
|
2
|
-
import { WasixStorageError } from '
|
|
3
|
-
import { type PostgresErrorField } from '
|
|
4
|
-
import type { SerializedWasixStorage } from '
|
|
5
|
-
import type { WasixStorageSyncBoundary } from '
|
|
6
|
-
import type { WasixProtocolConnection } from '
|
|
7
|
-
import type { WasixToolDescriptor, WasixToolProcessOptions, WasixToolProcessResult } from '
|
|
1
|
+
import type { WasixPersistenceMode, WasixProtocolConnectionMode, WasixProtocolStreamOutcome } from '../core/database.js';
|
|
2
|
+
import { WasixStorageError } from '../core/errors.js';
|
|
3
|
+
import { type PostgresErrorField } from '../protocol/query.js';
|
|
4
|
+
import type { SerializedWasixStorage } from '../storage/types.js';
|
|
5
|
+
import type { WasixStorageSyncBoundary } from '../storage/storage-provider.js';
|
|
6
|
+
import type { WasixProtocolConnection } from '../protocol/pgwire-connection.js';
|
|
7
|
+
import type { WasixToolDescriptor, WasixToolProcessOptions, WasixToolProcessResult } from '../resources/tool-runtime.js';
|
|
8
8
|
export type SerializedAssetSource = string | Uint8Array;
|
|
9
9
|
export type SerializedExtensionCarrier = {
|
|
10
10
|
product: string;
|
|
@@ -64,12 +64,6 @@ export type SerializedRuntimeDescriptor = {
|
|
|
64
64
|
product: 'liboliphaunt-wasix';
|
|
65
65
|
version: string;
|
|
66
66
|
runtimeArchive: SerializedRuntimeArchive;
|
|
67
|
-
standardSeedArchive: SerializedRuntimeArchive;
|
|
68
|
-
standardSeedManifest: {
|
|
69
|
-
sha256: string;
|
|
70
|
-
size: number;
|
|
71
|
-
source: SerializedAssetSource;
|
|
72
|
-
};
|
|
73
67
|
manifest: {
|
|
74
68
|
sha256: string;
|
|
75
69
|
size: number;
|
|
@@ -79,32 +73,18 @@ export type SerializedRuntimeDescriptor = {
|
|
|
79
73
|
/** Runtime subset required by PostgreSQL frontend tools. */
|
|
80
74
|
export type SerializedToolRuntimeDescriptor = Pick<SerializedRuntimeDescriptor, 'product' | 'version' | 'runtimeArchive' | 'manifest'>;
|
|
81
75
|
export type SerializedIcuDescriptor = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
runtimeVersion: string;
|
|
89
|
-
postgresMajor: '18';
|
|
90
|
-
physicalFormat: 'wasix-pg18-v1';
|
|
91
|
-
compatibilityKey: 'wasix-pg18-datum32-v1';
|
|
92
|
-
dataVersion: '76.1';
|
|
93
|
-
dataForm: 'files-le';
|
|
94
|
-
dataTreeSha256: string;
|
|
95
|
-
};
|
|
96
|
-
dataArchive: SerializedRuntimeArchive;
|
|
97
|
-
clusterSeedArchive: SerializedRuntimeArchive;
|
|
98
|
-
clusterSeedManifest: {
|
|
99
|
-
sha256: string;
|
|
100
|
-
size: number;
|
|
101
|
-
source: SerializedAssetSource;
|
|
102
|
-
};
|
|
76
|
+
data: SerializedAssetSource;
|
|
77
|
+
manifest: SerializedAssetSource;
|
|
78
|
+
};
|
|
79
|
+
export type SerializedSeed = {
|
|
80
|
+
archive: SerializedAssetSource;
|
|
81
|
+
manifest: SerializedAssetSource;
|
|
103
82
|
};
|
|
104
83
|
/** Host-ready open options shared by both public execution surfaces. */
|
|
105
84
|
export type SerializedOpenOptions = {
|
|
106
85
|
runtime: SerializedRuntimeDescriptor;
|
|
107
86
|
icu?: SerializedIcuDescriptor;
|
|
87
|
+
seed?: SerializedSeed;
|
|
108
88
|
/** Exact imported carrier closure, keyed by PostgreSQL SQL name. */
|
|
109
89
|
extensionCarriers: Record<string, SerializedExtensionCarrier>;
|
|
110
90
|
extensions: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WasixStorageError } from '
|
|
2
|
-
import { PostgresError } from '
|
|
1
|
+
import { WasixStorageError } from '../core/errors.js';
|
|
2
|
+
import { PostgresError } from '../protocol/query.js';
|
|
3
3
|
export function serializeWorkerError(error) {
|
|
4
4
|
if (error instanceof WasixStorageError) {
|
|
5
5
|
return {
|
|
@@ -52,7 +52,7 @@ export function deserializeWorkerError(error) {
|
|
|
52
52
|
restored.name = error.name;
|
|
53
53
|
return Object.assign(restored, {
|
|
54
54
|
oliphauntWasixError: 'tool',
|
|
55
|
-
oliphauntWasixAddonAbi:
|
|
55
|
+
oliphauntWasixAddonAbi: 3,
|
|
56
56
|
code: error.code,
|
|
57
57
|
tool: error.tool,
|
|
58
58
|
exitCode: error.exitCode,
|
|
@@ -71,7 +71,7 @@ function nativeToolError(error) {
|
|
|
71
71
|
return undefined;
|
|
72
72
|
const candidate = error;
|
|
73
73
|
if (candidate.oliphauntWasixError !== 'tool' ||
|
|
74
|
-
candidate.oliphauntWasixAddonAbi !==
|
|
74
|
+
candidate.oliphauntWasixAddonAbi !== 3 ||
|
|
75
75
|
candidate.code !== 'tool-error' ||
|
|
76
76
|
typeof candidate.message !== 'string' ||
|
|
77
77
|
typeof candidate.tool !== 'string' ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WasixDatabaseSession } from '
|
|
1
|
+
import { type WasixDatabaseSession } from '../core/database.js';
|
|
2
2
|
import { type SerializedOpenOptions, type WorkerRequest, type WorkerResponse } from './rpc.js';
|
|
3
3
|
export type WorkerResponder = (response: WorkerResponse, transfer?: readonly ArrayBuffer[]) => void;
|
|
4
4
|
export type WorkerSessionOpener = (options: SerializedOpenOptions) => Promise<WasixDatabaseSession>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES, } from '
|
|
2
|
-
import { restoreWasixSerialized } from '
|
|
1
|
+
import { WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES, } from '../core/database.js';
|
|
2
|
+
import { restoreWasixSerialized } from '../hosts/browser/client-common.js';
|
|
3
3
|
import { serializeWorkerError, } from './rpc.js';
|
|
4
4
|
import { prepareTransferableBytes } from './worker-transfer.js';
|
|
5
5
|
class WorkerStreamCallbackAborted extends Error {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type WasixDatabaseSessionTerminalState, type WasixPersistenceMode, type WasixProtocolStreamOutcome } from '
|
|
1
|
+
import { type WasixDatabaseSessionTerminalState, type WasixPersistenceMode, type WasixProtocolStreamOutcome } from '../core/database.js';
|
|
2
2
|
import type { SerializedOpenOptions, WorkerRequest, WorkerResponse } from './rpc.js';
|
|
3
|
-
import type { BinaryInput, OliphauntDatabase, OpenConfig } from '
|
|
4
|
-
import type { WasixToolProcessResult } from '
|
|
3
|
+
import type { BinaryInput, OliphauntDatabase, OpenConfig } from '../core/types.js';
|
|
4
|
+
import type { WasixToolProcessResult } from '../resources/tool-runtime.js';
|
|
5
5
|
type WorkerResponseValue = Uint8Array | WasixToolProcessResult | WasixProtocolStreamOutcome | undefined;
|
|
6
6
|
type WorkerRequestWithoutId = WorkerRequest extends infer Request ? Request extends {
|
|
7
7
|
id: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES, WasixDatabaseImpl, createWasixDeferred, normalizeWasixDatabaseIdentity, } from '
|
|
2
|
-
import { serializeOpenConfig } from '
|
|
3
|
-
import { toUint8Array } from '
|
|
1
|
+
import { WASIX_PROTOCOL_CALLBACK_CHUNK_BYTES, WasixDatabaseImpl, createWasixDeferred, normalizeWasixDatabaseIdentity, } from '../core/database.js';
|
|
2
|
+
import { serializeOpenConfig } from '../core/open-config.js';
|
|
3
|
+
import { toUint8Array } from '../protocol/query.js';
|
|
4
4
|
import { deserializeWorkerError } from './rpc.js';
|
|
5
5
|
const STREAM_ACK = 0;
|
|
6
6
|
const STREAM_FAILED = 1;
|
|
@@ -215,13 +215,12 @@ function assetTransfers(options) {
|
|
|
215
215
|
appendAssetTransfer(options.runtime.runtimeArchive.source, transfer, seen);
|
|
216
216
|
appendAssetTransfer(options.runtime.manifest.source, transfer, seen);
|
|
217
217
|
if (options.icu !== undefined) {
|
|
218
|
-
appendAssetTransfer(options.icu.
|
|
219
|
-
appendAssetTransfer(options.icu.
|
|
220
|
-
appendAssetTransfer(options.icu.clusterSeedManifest.source, transfer, seen);
|
|
218
|
+
appendAssetTransfer(options.icu.data, transfer, seen);
|
|
219
|
+
appendAssetTransfer(options.icu.manifest, transfer, seen);
|
|
221
220
|
}
|
|
222
|
-
|
|
223
|
-
appendAssetTransfer(options.
|
|
224
|
-
appendAssetTransfer(options.
|
|
221
|
+
if (options.seed !== undefined) {
|
|
222
|
+
appendAssetTransfer(options.seed.archive, transfer, seen);
|
|
223
|
+
appendAssetTransfer(options.seed.manifest, transfer, seen);
|
|
225
224
|
}
|
|
226
225
|
for (const carrier of Object.values(options.extensionCarriers)) {
|
|
227
226
|
appendAssetTransfer(carrier.source, transfer, seen);
|
|
@@ -316,9 +315,6 @@ class WorkerDatabaseSession {
|
|
|
316
315
|
method: 'runTool',
|
|
317
316
|
options: {
|
|
318
317
|
...options,
|
|
319
|
-
// The release addon owns the verified tool payload. Preserve only
|
|
320
|
-
// the descriptor identity across the Worker boundary.
|
|
321
|
-
tool: { ...options.tool, source: 'oliphaunt:wasix-napi-embedded' },
|
|
322
318
|
args: [...options.args],
|
|
323
319
|
...(stdin === undefined ? {} : { stdin }),
|
|
324
320
|
},
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliphaunt/wasix-ts",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Portable Oliphaunt WASIX TypeScript SDK for browsers, Node.js, Bun, Deno, and Electron.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects":
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"./lib/browser.js",
|
|
9
|
+
"./lib/native-only.js"
|
|
10
|
+
],
|
|
8
11
|
"repository": {
|
|
9
12
|
"type": "git",
|
|
10
13
|
"url": "git+https://github.com/f0rr0/oliphaunt.git",
|
|
11
|
-
"directory": "src/
|
|
14
|
+
"directory": "src/wasix/sdks/ts"
|
|
12
15
|
},
|
|
13
16
|
"bugs": {
|
|
14
17
|
"url": "https://github.com/f0rr0/oliphaunt/issues"
|
|
@@ -16,10 +19,10 @@
|
|
|
16
19
|
"homepage": "https://oliphaunt.dev",
|
|
17
20
|
"oliphaunt": {
|
|
18
21
|
"runtimeProduct": "liboliphaunt-wasix",
|
|
19
|
-
"runtimeVersion": "0.
|
|
22
|
+
"runtimeVersion": "0.3.1",
|
|
20
23
|
"wasixNapiProduct": "oliphaunt-wasix-napi",
|
|
21
|
-
"wasixNapiVersion": "0.
|
|
22
|
-
"wasixAddonAbiVersion":
|
|
24
|
+
"wasixNapiVersion": "0.2.0",
|
|
25
|
+
"wasixAddonAbiVersion": 3,
|
|
23
26
|
"nodeApiVersion": 8,
|
|
24
27
|
"browserHost": "wasmer-js-patched",
|
|
25
28
|
"serverHost": "wasix-rust-napi"
|
|
@@ -30,26 +33,56 @@
|
|
|
30
33
|
},
|
|
31
34
|
"exports": {
|
|
32
35
|
".": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
36
|
+
"deno": {
|
|
37
|
+
"types": "./lib/index.deno.d.ts",
|
|
38
|
+
"default": "./lib/index.deno.js"
|
|
39
|
+
},
|
|
40
|
+
"bun": {
|
|
41
|
+
"types": "./lib/index.bun.d.ts",
|
|
42
|
+
"default": "./lib/index.bun.js"
|
|
43
|
+
},
|
|
44
|
+
"node": {
|
|
45
|
+
"types": "./lib/index.node.d.ts",
|
|
46
|
+
"default": "./lib/index.node.js"
|
|
47
|
+
},
|
|
48
|
+
"browser": {
|
|
49
|
+
"types": "./lib/index.d.ts",
|
|
50
|
+
"default": "./lib/index.js"
|
|
51
|
+
},
|
|
52
|
+
"default": {
|
|
53
|
+
"types": "./lib/index.d.ts",
|
|
54
|
+
"default": "./lib/index.js"
|
|
55
|
+
}
|
|
39
56
|
},
|
|
40
57
|
"./worker": {
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
58
|
+
"deno": {
|
|
59
|
+
"types": "./lib/worker-entry.deno.d.ts",
|
|
60
|
+
"default": "./lib/worker-entry.deno.js"
|
|
61
|
+
},
|
|
62
|
+
"bun": {
|
|
63
|
+
"types": "./lib/worker-entry.bun.d.ts",
|
|
64
|
+
"default": "./lib/worker-entry.bun.js"
|
|
65
|
+
},
|
|
66
|
+
"node": {
|
|
67
|
+
"types": "./lib/worker-entry.node.d.ts",
|
|
68
|
+
"default": "./lib/worker-entry.node.js"
|
|
69
|
+
},
|
|
70
|
+
"browser": {
|
|
71
|
+
"types": "./lib/worker-entry.d.ts",
|
|
72
|
+
"default": "./lib/worker-entry.js"
|
|
73
|
+
},
|
|
74
|
+
"default": {
|
|
75
|
+
"types": "./lib/worker-entry.d.ts",
|
|
76
|
+
"default": "./lib/worker-entry.js"
|
|
77
|
+
}
|
|
47
78
|
},
|
|
48
79
|
"./direct": {
|
|
49
80
|
"types": "./lib/direct.node.d.ts",
|
|
50
81
|
"deno": "./lib/direct.node.js",
|
|
51
82
|
"bun": "./lib/direct.node.js",
|
|
52
|
-
"node": "./lib/direct.node.js"
|
|
83
|
+
"node": "./lib/direct.node.js",
|
|
84
|
+
"browser": "./lib/native-only.js",
|
|
85
|
+
"default": "./lib/native-only.js"
|
|
53
86
|
},
|
|
54
87
|
"./internal/tools": {
|
|
55
88
|
"types": "./lib/internal.d.ts",
|
|
@@ -63,7 +96,9 @@
|
|
|
63
96
|
"types": "./lib/server.node.d.ts",
|
|
64
97
|
"deno": "./lib/server.node.js",
|
|
65
98
|
"bun": "./lib/server.node.js",
|
|
66
|
-
"node": "./lib/server.node.js"
|
|
99
|
+
"node": "./lib/server.node.js",
|
|
100
|
+
"browser": "./lib/native-only.js",
|
|
101
|
+
"default": "./lib/native-only.js"
|
|
67
102
|
},
|
|
68
103
|
"./storage/indexed-db": {
|
|
69
104
|
"types": "./lib/storage/indexed-db.d.ts",
|
|
@@ -87,6 +122,10 @@
|
|
|
87
122
|
},
|
|
88
123
|
"./package.json": {
|
|
89
124
|
"default": "./package.json"
|
|
125
|
+
},
|
|
126
|
+
"./browser": {
|
|
127
|
+
"types": "./lib/browser.d.ts",
|
|
128
|
+
"default": "./lib/browser.js"
|
|
90
129
|
}
|
|
91
130
|
},
|
|
92
131
|
"main": "lib/index.js",
|
|
@@ -101,22 +140,19 @@
|
|
|
101
140
|
"THIRD_PARTY_NOTICES.md"
|
|
102
141
|
],
|
|
103
142
|
"dependencies": {
|
|
104
|
-
"@oliphaunt/
|
|
105
|
-
"@oliphaunt/
|
|
143
|
+
"@oliphaunt/liboliphaunt-wasix": "0.3.1",
|
|
144
|
+
"@oliphaunt/ts-query": "0.1.1",
|
|
106
145
|
"fzstd": "0.1.1"
|
|
107
146
|
},
|
|
108
|
-
"bundledDependencies": [
|
|
109
|
-
"@oliphaunt/js-core"
|
|
110
|
-
],
|
|
111
147
|
"optionalDependencies": {
|
|
112
|
-
"@oliphaunt/wasix-napi-darwin-arm64": "0.
|
|
113
|
-
"@oliphaunt/wasix-napi-linux-arm64-gnu": "0.
|
|
114
|
-
"@oliphaunt/wasix-napi-linux-x64-gnu": "0.
|
|
115
|
-
"@oliphaunt/wasix-napi-win32-x64-msvc": "0.
|
|
148
|
+
"@oliphaunt/wasix-napi-darwin-arm64": "0.2.0",
|
|
149
|
+
"@oliphaunt/wasix-napi-linux-arm64-gnu": "0.2.0",
|
|
150
|
+
"@oliphaunt/wasix-napi-linux-x64-gnu": "0.2.0",
|
|
151
|
+
"@oliphaunt/wasix-napi-win32-x64-msvc": "0.2.0"
|
|
116
152
|
},
|
|
117
153
|
"engines": {
|
|
118
154
|
"node": ">=22.13 <25",
|
|
119
155
|
"bun": ">=1.3.14",
|
|
120
156
|
"deno": ">=2.8.1"
|
|
121
157
|
}
|
|
122
|
-
}
|
|
158
|
+
}
|
package/lib/client-common.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import defaultWasixRuntime from '@oliphaunt/liboliphaunt-wasix';
|
|
2
|
-
import { serializeWasixExtensionDescriptors } from './extension-descriptor.js';
|
|
3
|
-
import { serializeWasixIcuDescriptor } from './icu-descriptor.js';
|
|
4
|
-
import { decodePhysicalArchive } from './physical-archive.js';
|
|
5
|
-
import { toUint8Array } from './query.js';
|
|
6
|
-
import { serializeWasixRuntimeDescriptor } from './runtime-descriptor.js';
|
|
7
|
-
import { serializeWasixStorage } from './storage.js';
|
|
8
|
-
import { restoreWasixStorage, WASIX_PHYSICAL_IDENTITY } from './storage-provider.js';
|
|
9
|
-
import { normalizeWasixStartupGUCs } from './startup-config.js';
|
|
10
|
-
export function serializeOpenConfig(config = {}, runtimeDescriptor = defaultWasixRuntime) {
|
|
11
|
-
const extensions = serializeWasixExtensionDescriptors(config.extensions ?? []);
|
|
12
|
-
const runtime = serializeWasixRuntimeDescriptor(runtimeDescriptor);
|
|
13
|
-
const storage = serializeWasixStorage(config.storage);
|
|
14
|
-
return {
|
|
15
|
-
runtime,
|
|
16
|
-
...(config.icu === undefined ? {} : { icu: serializeWasixIcuDescriptor(config.icu) }),
|
|
17
|
-
extensionCarriers: extensions.carriers,
|
|
18
|
-
extensions: extensions.selectedSqlNames,
|
|
19
|
-
username: config.username ?? 'postgres',
|
|
20
|
-
database: config.database ?? 'postgres',
|
|
21
|
-
startupGUCs: normalizeWasixStartupGUCs(config.startupGUCs ?? {}),
|
|
22
|
-
storage,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export async function restoreWasix(storage, bytes, validate) {
|
|
26
|
-
if (storage === undefined)
|
|
27
|
-
throw new TypeError('WASIX restore requires persistent storage');
|
|
28
|
-
const openOptions = serializeOpenConfig({ storage });
|
|
29
|
-
validate?.(openOptions);
|
|
30
|
-
await restoreWasixSerialized(openOptions.storage, toUint8Array(bytes).slice());
|
|
31
|
-
}
|
|
32
|
-
/** @internal Restore already-owned archive bytes inside the selected realm. */
|
|
33
|
-
export async function restoreWasixSerialized(storage, bytes) {
|
|
34
|
-
const snapshot = decodePhysicalArchive(bytes);
|
|
35
|
-
await restoreWasixStorage(storage, snapshot, WASIX_PHYSICAL_IDENTITY);
|
|
36
|
-
}
|
package/lib/icu-descriptor.d.ts
DELETED