@oliphaunt/wasix-ts 0.1.0 → 0.2.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 +55 -32
- package/CHANGELOG.md +31 -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
package/ARCHITECTURE.md
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
# WASIX TypeScript binding architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This describes the development checkout. New resource and tools carrier identities
|
|
4
|
+
are not assumed to be available in a completed public release.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Source navigation
|
|
7
|
+
|
|
8
|
+
The files at `src/` are public package entrypoints. Implementation lives under:
|
|
9
|
+
|
|
10
|
+
| Directory | Responsibility |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `core/` | Shared database state machine, public types, errors and open configuration |
|
|
13
|
+
| `hosts/browser/` | Browser lifecycle, direct guest driver and browser-owned workers |
|
|
14
|
+
| `hosts/node-api/` | WASIX addon loading, Rust actor/direct/server sessions and Node-compatible workers |
|
|
15
|
+
| `workers/` | RPC, dispatch and byte transfer shared by both hosts |
|
|
16
|
+
| `protocol/` | Query package adapters and PostgreSQL wire connections |
|
|
17
|
+
| `resources/` | Runtime, extension, seed and ICU descriptors, archives and tools |
|
|
18
|
+
| `storage/` | Storage types, physical archives, providers and persistence adapters |
|
|
19
|
+
| `host/` | Declaration for the separately built, package-owned Wasmer browser host |
|
|
20
|
+
| `__tests__/` | Behavioral tests spanning those boundaries |
|
|
21
|
+
|
|
22
|
+
Package exports and storage entrypoints keep their published names. A worker
|
|
23
|
+
that owns a browser or Node-API session stays with that host; only the common
|
|
24
|
+
transport belongs in `workers/`.
|
|
25
|
+
|
|
26
|
+
## Runtime boundary
|
|
27
|
+
|
|
28
|
+
`src/wasix/sdks/ts` is one public TypeScript API over two host adapters.
|
|
6
29
|
The package export conditions, not a runtime option, select the adapter:
|
|
7
30
|
|
|
8
31
|
```text
|
|
@@ -20,22 +43,22 @@ portable liboliphaunt-wasix Rust actor, direct, Worker, server
|
|
|
20
43
|
The browser adapter owns the portable runtime/seed descriptors and dynamic
|
|
21
44
|
extension carrier installation. The server adapter owns no Wasmer JavaScript
|
|
22
45
|
fallback: it loads one exact, prebuilt platform carrier whose Rust dependency
|
|
23
|
-
embeds the runtime, AOT objects,
|
|
24
|
-
|
|
46
|
+
embeds the runtime, AOT objects, and supported extension catalog. Seeds, ICU
|
|
47
|
+
data, and frontend tools are separate explicit inputs. Both execute the canonical WASIX guest and preserve its physical
|
|
25
48
|
database and backup formats.
|
|
26
49
|
|
|
27
|
-
This boundary deliberately does not depend on `src/sdks/
|
|
50
|
+
This boundary deliberately does not depend on `src/native/sdks/ts`,
|
|
28
51
|
`liboliphaunt-native`, `node-direct`, or the broker. The N-API product wraps the
|
|
29
52
|
WASIX Rust binding; it is not a route into the native PostgreSQL SDK.
|
|
30
53
|
|
|
31
|
-
Protocol and typed-query helpers
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
Protocol and typed-query helpers come from the independently versioned
|
|
55
|
+
`@oliphaunt/ts-query` package in `src/query/ts`. The native and React Native
|
|
56
|
+
SDKs depend on the same package.
|
|
34
57
|
|
|
35
|
-
The patched Wasmer host under `host
|
|
36
|
-
dependency
|
|
37
|
-
|
|
38
|
-
`
|
|
58
|
+
The patched Wasmer host under `src/wasix/browser-host` is the browser host
|
|
59
|
+
implementation dependency. PostgreSQL binaries and the canonical runtime manifest
|
|
60
|
+
are owned by `liboliphaunt-wasix`; seed archives and ICU data are owned by
|
|
61
|
+
`database-resources`, and mutable PGDATA belongs to the application storage provider; each extension product owns its separately versioned
|
|
39
62
|
portable carrier envelope. The N-API release embeds the corresponding frozen
|
|
40
63
|
artifacts instead of resolving those bytes during application startup.
|
|
41
64
|
|
|
@@ -78,12 +101,12 @@ smaller qualified side modules remain supported in a direct Window.
|
|
|
78
101
|
realm and creates no Worker. `/worker` creates one module Web Worker per open
|
|
79
102
|
and a temporary Worker for restore.
|
|
80
103
|
2. The binding resolves the default `@oliphaunt/liboliphaunt-wasix` descriptor
|
|
81
|
-
internally
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
closure.
|
|
104
|
+
internally and verifies its manifest and runtime bytes. New browser storage
|
|
105
|
+
requires an explicit seed archive and manifest from `database-resources`;
|
|
106
|
+
existing storage can reopen without a seed. ICU selection supplies the raw
|
|
107
|
+
data file and its manifest. Each input retains its own integrity and runtime
|
|
108
|
+
compatibility checks rather than sharing one product version. Imported
|
|
109
|
+
extension descriptors add their exact carrier closure.
|
|
87
110
|
3. The selected realm safely expands the core artifacts and overlays only each
|
|
88
111
|
extension carrier's install-contract files into separate `/bin`, `/lib`, `/share`,
|
|
89
112
|
writable `/base`, `/home`, and `/tmp` Wasmer memory mounts. Before `/base` is
|
|
@@ -225,17 +248,16 @@ uses a separate persistent browser tool worker because COPY input is genuinely
|
|
|
225
248
|
full duplex. Its private pgwire connection has fixed, bounded shared-memory
|
|
226
249
|
rings.
|
|
227
250
|
|
|
228
|
-
Native
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
larger platform packages and a coordinated carrier release for fewer startup
|
|
233
|
-
reads, decompressions, compilation steps, and runtime compatibility edges.
|
|
251
|
+
Native hosts route `pg_dump` and `psql` through the existing Rust database owner
|
|
252
|
+
on root, `/direct`, or `/worker`. The independently versioned tools product
|
|
253
|
+
supplies portable or target-specific AOT inputs explicitly. Building or installing
|
|
254
|
+
the core runtime does not compile or bundle those optional frontends.
|
|
234
255
|
|
|
235
256
|
The package export `@oliphaunt/wasix-ts/internal/tools` exists only so the
|
|
236
|
-
|
|
257
|
+
`@oliphaunt/wasix-tools` package can reach this bridge. It is not
|
|
237
258
|
an application API or part of the stable SDK surface, is undocumented for app
|
|
238
|
-
consumers, and
|
|
259
|
+
consumers, and is governed by the companion package's declared SDK dependency. Independent
|
|
260
|
+
product versions need not be numerically equal. Package
|
|
239
261
|
checks reject any other low-level query or protocol subpath exports.
|
|
240
262
|
|
|
241
263
|
The database session is exclusively serialized. It resets PostgreSQL with
|
|
@@ -422,7 +444,7 @@ with that feature.
|
|
|
422
444
|
## Host compatibility
|
|
423
445
|
|
|
424
446
|
The host is rebuilt from source rather than maintained as hand-edited generated
|
|
425
|
-
JavaScript/WASM. `host/source.toml` pins the Wasmer JS Git source and Cargo
|
|
447
|
+
JavaScript/WASM. `src/wasix/browser-host/source.toml` pins the Wasmer JS Git source and Cargo
|
|
426
448
|
crates; the adjacent patches are the reviewable compatibility delta. The build
|
|
427
449
|
lands first in `target/oliphaunt-wasix-ts/host`. Public package staging copies
|
|
428
450
|
the exact JS module, worker module, WebAssembly module, license, and provenance
|
|
@@ -431,7 +453,7 @@ the browser `/worker` imports it in its package Worker. Node.js, Bun, Deno, and
|
|
|
431
453
|
conditions do not import this module.
|
|
432
454
|
|
|
433
455
|
This is not a general backport of WASIX 0.702 to Wasmer 0.601. The authoritative
|
|
434
|
-
patch order is the `series` in `host/source.toml`; this document records the
|
|
456
|
+
patch order is the `series` in `src/wasix/browser-host/source.toml`; this document records the
|
|
435
457
|
resulting invariants instead of duplicating that filename inventory. Together,
|
|
436
458
|
the patches:
|
|
437
459
|
|
|
@@ -498,7 +520,7 @@ and types contracts. A coordinated compile probe exposed incompatible
|
|
|
498
520
|
module hashing, and binary-package construction before the Oliphaunt runner and
|
|
499
521
|
recovery changes could be reapplied. Consequently 0.702.1 adoption is a full
|
|
500
522
|
source-host port plus browser qualification, not an isolated crate bump.
|
|
501
|
-
`host/source.toml` records the intentionally coherent 0.601 source family until
|
|
523
|
+
`src/wasix/browser-host/source.toml` records the intentionally coherent 0.601 source family until
|
|
502
524
|
that port exists.
|
|
503
525
|
|
|
504
526
|
## PGlite reference, not product inheritance
|
|
@@ -579,8 +601,9 @@ Linux carriers are GNU/glibc-only. The adapter identifies libc from the
|
|
|
579
601
|
runtime diagnostic report before resolving package-adjacent, optional, or
|
|
580
602
|
explicit addon paths; known musl and unknown libc identities fail closed.
|
|
581
603
|
|
|
582
|
-
Native release builds embed the runtime,
|
|
583
|
-
|
|
604
|
+
Native release builds embed the runtime, AOT objects, and complete currently
|
|
605
|
+
supported extension feature set. Seeds, ICU data, and frontend tools remain
|
|
606
|
+
separate selected resources. Optional extensions remain
|
|
584
607
|
exact, separately imported `-wasix` packages at the public TypeScript boundary,
|
|
585
608
|
but native hosts use their descriptor identity to select compiled-in artifacts
|
|
586
609
|
instead of copying the carrier bytes. Their availability is consequently a
|
|
@@ -607,7 +630,7 @@ extensions.
|
|
|
607
630
|
|
|
608
631
|
The first browser smoke selects the SQL-only `pgtap` carrier and explicitly runs
|
|
609
632
|
`CREATE EXTENSION`. That isolates manifest verification, dependency ordering, archive overlay, and lifecycle SQL
|
|
610
|
-
from dynamic linking. The separate `smoke-browser.
|
|
633
|
+
from dynamic linking. The separate `smoke-browser.sh --pg-uuidv7` profile selects the
|
|
611
634
|
native carrier, calls `uuid_generate_v7()` before and after the two error
|
|
612
635
|
recovery cases, verifies both results are UUIDv7 values, and checks clean
|
|
613
636
|
process exit. That proves one exact `.so` against the pinned package-owned host; it
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.0]() (2026-09-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **mobile:** native runtime ABI advances to 12 for streaming archive APIs; rebuild native clients and workers with matching artifacts.
|
|
9
|
+
* **sdk:** Native extension lists use typed selections, and native TypeScript restore accepts a directory storage descriptor instead of a path.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **mobile:** add unified iOS and Android broker modes ([#219](https://github.com/f0rr0/oliphaunt/issues/219)) ([6f205e9](https://github.com/f0rr0/oliphaunt/commit/6f205e966c6ce404f252ddcc5c5c1b0b8da47e31))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **ci:** unify Bun test entrypoints and import Swift signing keys ([#214](https://github.com/f0rr0/oliphaunt/issues/214)) ([a7724ef](https://github.com/f0rr0/oliphaunt/commit/a7724efe3ebda8c7f2e1af64d66b64fed645e3bf))
|
|
19
|
+
* **sdk:** align resource loading and extension selection ([#216](https://github.com/f0rr0/oliphaunt/issues/216)) ([b25d496](https://github.com/f0rr0/oliphaunt/commit/b25d49655de694525544c5553e77bdd83b2e1632))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Code Refactoring
|
|
23
|
+
|
|
24
|
+
* model product dependencies and simplify qualification ([#209](https://github.com/f0rr0/oliphaunt/issues/209)) ([e058785](https://github.com/f0rr0/oliphaunt/commit/e0587850e153fb8f8866711aa73717ca37bdb657))
|
|
25
|
+
* organize sources by native and WASIX runtime families ([#215](https://github.com/f0rr0/oliphaunt/issues/215)) ([a8f9bfe](https://github.com/f0rr0/oliphaunt/commit/a8f9bfe75f4cff0426f0089eb248783efacbde2e))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* The following workspace dependencies were updated
|
|
31
|
+
* dependencies
|
|
32
|
+
* @oliphaunt/ts-query bumped from 0.1.0 to 0.1.1
|
|
33
|
+
|
|
3
34
|
## 0.1.0 (2026-09-05)
|
|
4
35
|
|
|
5
36
|
|
package/README.md
CHANGED
|
@@ -1,404 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Oliphaunt WASIX TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`liboliphaunt-wasix` guest through the patched Wasmer JavaScript host. Node.js,
|
|
5
|
-
Bun, Deno, and Electron conditions run the same WASIX runtime through a Rust
|
|
6
|
-
Oliphaunt Node-API addon. The public TypeScript API is shared by both hosts.
|
|
7
|
-
|
|
8
|
-
In browsers the root owns PostgreSQL in the importing JavaScript realm. On
|
|
9
|
-
native hosts the root uses a dedicated Rust owner thread. The explicit
|
|
10
|
-
`/direct` import runs synchronously in the importing realm, while `/worker`
|
|
11
|
-
uses a separate JavaScript Worker on every runtime.
|
|
3
|
+
Run PostgreSQL as WebAssembly in browsers, Node.js, Bun, Deno, or Electron. Use the Worker entrypoint in a browser to keep database execution off the UI thread.
|
|
12
4
|
|
|
13
5
|
## Install
|
|
14
6
|
|
|
15
7
|
```sh
|
|
16
|
-
|
|
8
|
+
npm install @oliphaunt/wasix-ts
|
|
17
9
|
```
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
files and exact `@oliphaunt/liboliphaunt-wasix` dependency are therefore
|
|
21
|
-
installed on Node.js, Bun, Deno, and Electron too, although native export
|
|
22
|
-
conditions never load them. The matching target-filtered optional platform
|
|
23
|
-
package embeds the runtime, both cluster profiles, tools, and qualified
|
|
24
|
-
extension catalog used on those hosts. Carrier packages have no install scripts
|
|
25
|
-
and do not download a binary at install or first use. Applications do not
|
|
26
|
-
configure raw runtime assets.
|
|
27
|
-
|
|
28
|
-
Published Node-API 8 carriers currently cover:
|
|
29
|
-
|
|
30
|
-
- macOS arm64;
|
|
31
|
-
- Linux arm64 and x64 with glibc; and
|
|
32
|
-
- Windows x64 with MSVC.
|
|
33
|
-
|
|
34
|
-
There is no published carrier yet for macOS x64, Linux musl, or Windows arm64.
|
|
35
|
-
The native loader detects Linux libc before resolving a carrier and explicitly
|
|
36
|
-
rejects musl or an unidentifiable libc; it cannot load a `-gnu` carrier through
|
|
37
|
-
an override on an unsupported host. Opening a database on another server target
|
|
38
|
-
fails with an explicit unsupported-platform error rather than falling back to
|
|
39
|
-
the browser Wasmer host.
|
|
11
|
+
Browser Workers require cross-origin isolation. Follow the [quickstart](https://oliphaunt.dev/docs/sdk/wasix-typescript) to configure the required response headers and bundler.
|
|
40
12
|
|
|
41
|
-
|
|
42
|
-
must be granted `--allow-ffi`, `--allow-read`, and `--allow-env` in addition to any filesystem
|
|
43
|
-
permissions the application needs. The `/worker` entrypoint uses Deno's
|
|
44
|
-
Node-compatible Worker implementation and does not spawn a process. The package
|
|
45
|
-
smoke uses explicit host permissions. The qualified Deno surface is
|
|
46
|
-
the Deno CLI version declared by this package; managed Deno Deploy is not
|
|
47
|
-
currently a qualified distribution target.
|
|
13
|
+
The [quickstart](https://oliphaunt.dev/docs/sdk/wasix-typescript) covers prerequisites and the versions documented by the current site. Pin dependencies in your application manifest or lockfile.
|
|
48
14
|
|
|
49
|
-
|
|
50
|
-
ship the generated `app.asar.unpacked` directory beside `app.asar`. This keeps
|
|
51
|
-
the addon and any platform loader companions, including the Windows app-local
|
|
52
|
-
VC runtime, in one loadable directory. Electron can temporarily extract a
|
|
53
|
-
packed native module, but the unpacked layout avoids that startup overhead and
|
|
54
|
-
antivirus interaction. Carrier qualification loads the addon from this
|
|
55
|
-
packaged layout and proves that a missing unpacked companion fails explicitly.
|
|
56
|
-
|
|
57
|
-
Optional ICU data and its matching `icu` seed are selected explicitly:
|
|
15
|
+
## First query
|
|
58
16
|
|
|
59
17
|
```ts
|
|
60
18
|
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
61
|
-
import icu from '@oliphaunt/wasix-icu';
|
|
62
19
|
|
|
63
|
-
|
|
20
|
+
const db = await Oliphaunt.open();
|
|
21
|
+
try {
|
|
22
|
+
const result = await db.query('SELECT $1::int4 AS answer', [42]);
|
|
23
|
+
console.log(result.rows[0]?.answer); // 42
|
|
24
|
+
} finally {
|
|
25
|
+
await db.close();
|
|
26
|
+
}
|
|
64
27
|
```
|
|
65
28
|
|
|
66
|
-
|
|
67
|
-
native platform carrier contains one addon with both `standard` and `icu`
|
|
68
|
-
profiles, and the existing `icu` option selects the database profile. The loader checks
|
|
69
|
-
the exact SDK/carrier version, WASIX runtime version, addon ABI, Node-API level,
|
|
70
|
-
target, and ICU profile before running native code.
|
|
71
|
-
|
|
72
|
-
## Query PostgreSQL
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
76
|
-
|
|
77
|
-
await using database = await Oliphaunt.open();
|
|
78
|
-
|
|
79
|
-
await database.execute('create table todo (title text not null)');
|
|
80
|
-
await database.execute('insert into todo values ($1)', ['ship it']);
|
|
81
|
-
|
|
82
|
-
const result = await database.query(
|
|
83
|
-
'select title from todo where title = $1',
|
|
84
|
-
['ship it'],
|
|
85
|
-
);
|
|
86
|
-
console.log(result.rows[0]?.title);
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
`execute` asserts one command with no rows. `query` accepts command-only or
|
|
90
|
-
row-producing SQL and defaults to decoded object rows; array rows, text value
|
|
91
|
-
mode, and immutable per-query OID codecs are available. Object mode rejects
|
|
92
|
-
duplicate field names; use `rowMode: 'array'` to preserve them positionally.
|
|
93
|
-
`queryRaw` retains ordered nullable bytes and complete field metadata. `exec` returns ordered
|
|
94
|
-
simple-query results, while `describe` resolves parameter OIDs and optional
|
|
95
|
-
result fields without executing. Structured operations preserve command
|
|
96
|
-
metadata and ordered notices.
|
|
97
|
-
|
|
98
|
-
Safe scalar parameters are resolved and encoded inside one owned operation.
|
|
99
|
-
Use `text`, `binary`, `typedNull`, `json`, or `array` with `postgresOids` for a
|
|
100
|
-
deterministic type, or an immutable per-query encoder for an extension OID.
|
|
101
|
-
Unsupported and mismatched values fail rather than being guessed.
|
|
102
|
-
|
|
103
|
-
`execProtocolRaw` is the buffered PostgreSQL frontend-protocol escape hatch.
|
|
104
|
-
`execProtocolRawStream` delivers the same response through a synchronous
|
|
105
|
-
callback. Every surface invokes it serially with at most 64 KiB per chunk and
|
|
106
|
-
waits for it to return before producing the next chunk. Direct sessions invoke
|
|
107
|
-
the callback inline; the native actor and Worker paths use bounded
|
|
108
|
-
acknowledgements across their existing thread boundary. COPY-sized responses
|
|
109
|
-
therefore need not be retained as one JavaScript value. A thrown callback, including
|
|
110
|
-
the deterministic error for returning a Promise or thenable, is rethrown
|
|
111
|
-
unchanged only after the guest confirms recovery to `ReadyForQuery`; the
|
|
112
|
-
recovered database remains reusable. An asynchronous callback cannot provide
|
|
113
|
-
this backpressure contract.
|
|
114
|
-
The callback also cannot reenter the same database or transaction;
|
|
115
|
-
fire-and-forget calls are rejected instead of being queued behind the stream.
|
|
116
|
-
Neither method interprets responses for the caller. A buffered raw rejection,
|
|
117
|
-
or a streamed execution, transport, or recovery failure, poisons the handle and
|
|
118
|
-
takes precedence over a simultaneous callback error; close it and open a new
|
|
119
|
-
database instead of assuming the physical session recovered.
|
|
120
|
-
|
|
121
|
-
PostgreSQL `ErrorResponse` values reject with `PostgresError`, including the
|
|
122
|
-
SQLSTATE and structured diagnostic fields.
|
|
123
|
-
|
|
124
|
-
## Transactions
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
await database.transaction(async (transaction) => {
|
|
128
|
-
await transaction.execute('insert into todo values ($1)', ['inside transaction']);
|
|
129
|
-
return transaction.query('select count(*)::int4 as count from todo');
|
|
130
|
-
});
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
The callback exclusively owns the session from `BEGIN` through its final
|
|
134
|
-
boundary. It mirrors query/raw query, execute, exec, and describe; database-level
|
|
135
|
-
operations reject while it is active. One-shot `rollback()` closes the
|
|
136
|
-
transaction and lets the callback return without a later commit.
|
|
137
|
-
|
|
138
|
-
Raw protocol is database-only and deliberately absent from the callback handle.
|
|
139
|
-
Do not issue manual `BEGIN`, `START TRANSACTION`, `COMMIT`, `END`, `ABORT`,
|
|
140
|
-
`PREPARE TRANSACTION`, or `AND CHAIN` inside the callback; return/throw or call
|
|
141
|
-
`rollback()` instead. `SAVEPOINT` and `ROLLBACK TO` are supported. `ROLLBACK AND
|
|
142
|
-
CHAIN` is unsupported contract misuse and has the same PostgreSQL wire
|
|
143
|
-
tag/readiness state as `ROLLBACK TO`, so the SDK rejects `ROLLBACK`/`ABORT ...
|
|
144
|
-
AND CHAIN` before dispatch and still validates every actual protocol boundary.
|
|
145
|
-
A proven ownership escape makes the database close-only and never causes a
|
|
146
|
-
speculative SDK `COMMIT` or `ROLLBACK`.
|
|
147
|
-
|
|
148
|
-
Callback failures trigger a best-effort `ROLLBACK`. Once `COMMIT` has been
|
|
149
|
-
sent, the binding never sends a second rollback. PostgreSQL's clean `ROLLBACK`
|
|
150
|
-
response is a known aborted outcome; a transport failure or malformed response
|
|
151
|
-
after `COMMIT` makes the outcome unknown and poisons the handle until close.
|
|
152
|
-
Persistent publication completes before a successful transaction resolves.
|
|
153
|
-
After rollback and its required publication succeed, the original callback
|
|
154
|
-
failure is rethrown unchanged. If the callback and rollback both fail, an
|
|
155
|
-
`AggregateError` preserves the callback failure followed by the rollback
|
|
156
|
-
failure. If an earlier independent database or protocol failure has already
|
|
157
|
-
poisoned or expired transaction ownership and the callback then throws a
|
|
158
|
-
different value, an `AggregateError` preserves the callback failure followed by
|
|
159
|
-
that database failure; the database is close-only. Ordinary PostgreSQL statement
|
|
160
|
-
errors that remain safely rollbackable are not automatically aggregated.
|
|
161
|
-
|
|
162
|
-
## Storage
|
|
163
|
-
|
|
164
|
-
Omitting `storage` creates a fresh true-memory database. Persistent adapters
|
|
165
|
-
are explicit, host-specific imports:
|
|
166
|
-
|
|
167
|
-
```ts
|
|
168
|
-
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
169
|
-
import { directory } from '@oliphaunt/wasix-ts/storage/node';
|
|
170
|
-
|
|
171
|
-
const storage = directory('./data/todos');
|
|
172
|
-
let database = await Oliphaunt.open({ storage });
|
|
173
|
-
await database.execute('create table if not exists todo (title text not null)');
|
|
174
|
-
await database.close();
|
|
175
|
-
|
|
176
|
-
database = await Oliphaunt.open({ storage });
|
|
177
|
-
await database.close();
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Use `storage/bun` or `storage/deno` for those runtimes, and
|
|
181
|
-
`storage/indexed-db` or `storage/opfs` in browsers.
|
|
182
|
-
|
|
183
|
-
A Node, Bun, Deno, or Electron directory is a managed root with exactly:
|
|
184
|
-
|
|
185
|
-
```text
|
|
186
|
-
.oliphaunt.json
|
|
187
|
-
pgdata/
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
The descriptor records the shared database-root schema, PostgreSQL major, and
|
|
191
|
-
WASIX physical format. Runtime source fingerprints and package hashes validate
|
|
192
|
-
the asset graph; they are not physical-reopen identity. Native and WASIX roots
|
|
193
|
-
are not rejected merely because of the originating family.
|
|
194
|
-
|
|
195
|
-
Rust and WASIX TypeScript bindings use the same root and physical-archive
|
|
196
|
-
contracts. On Node.js, Bun, Deno, and Electron the Rust runtime holds the managed
|
|
197
|
-
root's OS advisory lock for the database lifetime. The same lock protects actor,
|
|
198
|
-
direct, Worker, and Rust owners. Always close the current owner before handing a
|
|
199
|
-
root to another process, Worker, or binding.
|
|
200
|
-
|
|
201
|
-
The Rust host owns directory durability for Node.js, Bun, Deno, and Electron. IndexedDB
|
|
202
|
-
publishes a delta in one transaction. OPFS uses synchronous backing files for
|
|
203
|
-
`/worker` and when the root entrypoint is imported inside an application-owned
|
|
204
|
-
Dedicated Worker.
|
|
205
|
-
The root entrypoint in a browser Window uses the same opaque format through a
|
|
206
|
-
copy-on-write portable path. Both OPFS paths flush or publish in
|
|
207
|
-
PostgreSQL-safe order. A
|
|
208
|
-
publication failure rejects with `WasixStorageError`; an uncertain state
|
|
209
|
-
poisons the live database handle.
|
|
210
|
-
|
|
211
|
-
All native-host entrypoints may be used inside an application-owned Worker,
|
|
212
|
-
including with directory storage. Close the database before terminating that
|
|
213
|
-
Worker. The lock is owned by the Rust runtime rather than a JavaScript marker
|
|
214
|
-
directory, and an orderly package Worker close waits for native quiescence,
|
|
215
|
-
posts its terminal reply, and then lets the Worker exit itself.
|
|
216
|
-
|
|
217
|
-
`close()` is one terminal, idempotent teardown attempt. It stops admitting new
|
|
218
|
-
work and lets work already accepted by the database FIFO finish. The root actor
|
|
219
|
-
and `/server` await their Rust owner teardown. `/direct` closes synchronously at
|
|
220
|
-
the native boundary. `/worker` closes its direct native session at quiescence,
|
|
221
|
-
replies, and self-exits; it is never force-terminated across an active Node-API
|
|
222
|
-
frame. Concurrent and later calls return the same promise. Provider, host, and
|
|
223
|
-
Worker transport failures are preserved.
|
|
224
|
-
If teardown rejects, `closed` still becomes `true`: cleanup was attempted and
|
|
225
|
-
a destroyed isolated owner or guest is never treated as a retryable live session.
|
|
226
|
-
An unexpected `/worker` crash also makes `closed` true as soon as the transport
|
|
227
|
-
observes ownership loss. Later operations fail without posting more work;
|
|
228
|
-
`close()` remains idempotent and reports that terminal transport failure while
|
|
229
|
-
finishing any remaining package-owned cleanup.
|
|
230
|
-
|
|
231
|
-
Forgetting a database handle schedules generation-guarded best-effort cleanup
|
|
232
|
-
of only that handle's actor, direct session, or Worker generation. A stale
|
|
233
|
-
finalizer cannot affect a later open. Finalizers are not prompt or observable,
|
|
234
|
-
so applications must still use `close()` or `await using` when ownership release
|
|
235
|
-
matters.
|
|
236
|
-
|
|
237
|
-
## Backup and restore
|
|
238
|
-
|
|
239
|
-
```ts
|
|
240
|
-
const backup = await database.backup();
|
|
241
|
-
await database.close();
|
|
242
|
-
|
|
243
|
-
await Oliphaunt.restore(directory('./data/restored'), backup);
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
`backup()` performs PostgreSQL online physical backup without replacing the
|
|
247
|
-
session. The archive is the shared strict ustar format containing
|
|
248
|
-
`pgdata/**` and `.oliphaunt/backup-manifest.properties`. `restore` accepts only
|
|
249
|
-
an absent or empty persistent destination, validates the complete archive
|
|
250
|
-
before publication, and creates the receiving storage provider's outer
|
|
251
|
-
identity. Browser root restores in its importing realm. On native hosts the
|
|
252
|
-
root uses the Rust owner actor, `/direct` restores on the importing JavaScript
|
|
253
|
-
thread, and `/worker` uses a temporary package-owned Worker.
|
|
254
|
-
|
|
255
|
-
## Extensions
|
|
29
|
+
Default storage is a memory filesystem and is discarded on close. Use the quickstart's persistent-storage example for application data; run it as an alternative to this disposable example. Always close database handles explicitly.
|
|
256
30
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
```ts
|
|
260
|
-
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
261
|
-
import pgtap from '@oliphaunt/extension-pgtap-wasix';
|
|
262
|
-
|
|
263
|
-
await using database = await Oliphaunt.open({ extensions: [pgtap] });
|
|
264
|
-
await database.execute('CREATE EXTENSION pgtap');
|
|
265
|
-
const version = await database.query('select pgtap_version()');
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
The call shape and lifecycle ownership are host-independent. A browser verifies
|
|
269
|
-
the selected carrier and its dependency closure, installs its artifacts before
|
|
270
|
-
startup, and applies required startup/preload settings. Node.js, Bun, Deno, and Electron
|
|
271
|
-
validate the same descriptor but resolve its SQL name against the extension
|
|
272
|
-
catalog compiled into the platform addon. Release addons contain the complete
|
|
273
|
-
currently supported extension catalog; they do not load arbitrary side-module
|
|
274
|
-
bytes from npm at runtime. Adding or upgrading a server extension therefore
|
|
275
|
-
requires a matching N-API carrier release. This increases the carrier size in
|
|
276
|
-
exchange for eliminating runtime archive expansion and dynamic linking on the
|
|
277
|
-
native path.
|
|
278
|
-
|
|
279
|
-
Neither host runs database-local `CREATE EXTENSION`, `LOAD`, schema,
|
|
280
|
-
post-create, upgrade, or migration SQL. Applications and ORM migrations own
|
|
281
|
-
those ordinary PostgreSQL statements explicitly; selecting a descriptor makes
|
|
282
|
-
its code available but leaves the extension uninstalled in the database.
|
|
283
|
-
|
|
284
|
-
## Calling shape and execution placement
|
|
285
|
-
|
|
286
|
-
The normal import keeps the public API consistent while selecting the safest
|
|
287
|
-
default placement for the host:
|
|
288
|
-
|
|
289
|
-
```ts
|
|
290
|
-
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
291
|
-
|
|
292
|
-
await using database = await Oliphaunt.open();
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
On Node.js, Bun, Deno, and Electron, use `/direct` only when the lowest-hop path
|
|
296
|
-
is more important than keeping the importing event loop responsive:
|
|
297
|
-
|
|
298
|
-
```ts
|
|
299
|
-
import DirectOliphaunt from '@oliphaunt/wasix-ts/direct';
|
|
300
|
-
|
|
301
|
-
await using database = await DirectOliphaunt.open();
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Use the explicit Worker import when a separate JavaScript realm is part of the
|
|
305
|
-
application's isolation or placement model:
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
import WorkerOliphaunt from '@oliphaunt/wasix-ts/worker';
|
|
309
|
-
|
|
310
|
-
await using database = await WorkerOliphaunt.open();
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
All imports expose the same PostgreSQL interface and retain the promise-shaped
|
|
314
|
-
public API. A Promise does not itself imply off-thread execution. In a browser,
|
|
315
|
-
the root steps the Wasmer guest in the importing realm. On native hosts, the
|
|
316
|
-
root uses one Rust owner actor so PostgreSQL does not block the importing event
|
|
317
|
-
loop. `/direct` calls the synchronous Rust database on the importing thread and
|
|
318
|
-
removes that actor hop. `/worker` uses a real package-owned JavaScript Worker on
|
|
319
|
-
every runtime and loads the direct implementation inside it.
|
|
320
|
-
|
|
321
|
-
Importing the browser root or `/direct` from an application Worker blocks only
|
|
322
|
-
that Worker; importing the browser root in a Window can block the page. Browser
|
|
323
|
-
Worker use requires cross-origin isolation. Chromium Window compilation
|
|
324
|
-
of native side modules larger than 8 MiB requires `/worker`.
|
|
325
|
-
|
|
326
|
-
## Optional PostgreSQL tools
|
|
327
|
-
|
|
328
|
-
Install `@oliphaunt/wasix-tools` when the application needs standard plain
|
|
329
|
-
`pg_dump` or non-interactive `psql`:
|
|
330
|
-
|
|
331
|
-
```ts
|
|
332
|
-
import Oliphaunt from '@oliphaunt/wasix-ts';
|
|
333
|
-
import WorkerOliphaunt from '@oliphaunt/wasix-ts/worker';
|
|
334
|
-
import { pgDump, psql } from '@oliphaunt/wasix-tools';
|
|
335
|
-
|
|
336
|
-
await using source = await Oliphaunt.open();
|
|
337
|
-
const sql = await pgDump(source, { args: ['--schema-only'] });
|
|
338
|
-
await using target = await WorkerOliphaunt.open();
|
|
339
|
-
await psql(target, { script: sql });
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
`pgDump()` runs with the database's existing owner, so it supports root,
|
|
343
|
-
`/direct`, and `/worker` entrypoints where available. In browsers, `psql()` requires `/worker`
|
|
344
|
-
because restoring COPY input is full duplex. Node.js, Bun, Deno, and Electron route both
|
|
345
|
-
tools through the frontend binaries compiled into the native carrier, so
|
|
346
|
-
`psql()` works with root, `/direct`, and `/worker` on those hosts. The optional
|
|
347
|
-
`@oliphaunt/wasix-tools` package remains the public opt-in API even though the
|
|
348
|
-
native carrier includes the tool code at build time. Adding or changing a tool
|
|
349
|
-
requires a matching N-API carrier release.
|
|
350
|
-
|
|
351
|
-
The package preserves PostgreSQL's normal plain SQL and COPY output. It does
|
|
352
|
-
not support interactive psql, custom dump archives, parallel jobs, or
|
|
353
|
-
pg_restore.
|
|
354
|
-
|
|
355
|
-
## Optional local server
|
|
356
|
-
|
|
357
|
-
Node, Bun, Deno, and Electron may import `openServer` from the shared host-only server
|
|
358
|
-
subpath. Package export conditions select the runtime; browsers cannot resolve
|
|
359
|
-
this entrypoint:
|
|
360
|
-
|
|
361
|
-
```ts
|
|
362
|
-
import { openServer } from '@oliphaunt/wasix-ts/server';
|
|
363
|
-
|
|
364
|
-
await using server = await openServer({
|
|
365
|
-
listen: { transport: 'tcp' },
|
|
366
|
-
});
|
|
367
|
-
console.log(server.connectionString);
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
The lightweight compatibility endpoint binds IPv4 loopback with an automatic
|
|
371
|
-
port when `port` is omitted. Unix hosts may instead pass
|
|
372
|
-
`{ transport: 'unix', directory, port? }`; the socket follows PostgreSQL's
|
|
373
|
-
`.s.PGSQL.<port>` convention. One complete client connection owns the single
|
|
374
|
-
embedded backend at a time; another connection may wait in the operating-system
|
|
375
|
-
backlog, so configure client pools with a maximum size of one. The server
|
|
376
|
-
entrypoint wraps the Rust `OliphauntServer` directly; it does not create a
|
|
377
|
-
JavaScript socket relay or managed Worker. The listener and storage lease
|
|
378
|
-
persist, while each admitted client receives a fresh backend.
|
|
379
|
-
Use the separate WASIX postmaster product for concurrent PostgreSQL sessions.
|
|
380
|
-
The server's read-only `closed` property remains `false` while terminal teardown
|
|
381
|
-
is running and becomes `true` when that memoized attempt settles, including when
|
|
382
|
-
cleanup rejects.
|
|
383
|
-
|
|
384
|
-
## Scope
|
|
385
|
-
|
|
386
|
-
The core database surface remains limited to open, execute/query/queryRaw,
|
|
387
|
-
exec/describe, buffered and callback-streamed raw protocol, callback
|
|
388
|
-
transaction, physical backup/restore, read-only `closed`, and close.
|
|
389
|
-
Tools and local sockets stay in optional packages or host-only subpaths.
|
|
390
|
-
Cancellation and a dedicated typed COPY reader/writer are not exposed today.
|
|
391
|
-
|
|
392
|
-
## Qualification
|
|
393
|
-
|
|
394
|
-
```sh
|
|
395
|
-
pnpm --dir src/bindings/wasix-ts typecheck
|
|
396
|
-
pnpm --dir src/bindings/wasix-ts test
|
|
397
|
-
moon run oliphaunt-wasix-ts:package
|
|
398
|
-
pnpm --dir src/runtimes/wasix-napi check
|
|
399
|
-
```
|
|
31
|
+
## Build your integration
|
|
400
32
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
33
|
+
- [Guide](https://oliphaunt.dev/docs/sdk/wasix-typescript/guide): parameters, transactions, extensions, backups, and shutdown.
|
|
34
|
+
- [API reference](https://oliphaunt.dev/docs/sdk/wasix-typescript/api-reference): methods, configuration, results, and errors.
|
|
35
|
+
- [Runtime support](https://oliphaunt.dev/docs/reference/capabilities): platforms, storage, and concurrency.
|
|
36
|
+
- [Releases and upgrades](https://oliphaunt.dev/docs/reference/releases): dependency and database upgrades.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -6,15 +6,15 @@ Oliphaunt source code in this repository is licensed under the MIT license in
|
|
|
6
6
|
This file is the repository-level notice index. Product-specific runtime and
|
|
7
7
|
packaging notices live next to the product that ships the relevant artifacts:
|
|
8
8
|
|
|
9
|
-
- `src/
|
|
10
|
-
- `src/
|
|
9
|
+
- `src/native/runtime/THIRD_PARTY_NOTICES.md`
|
|
10
|
+
- `src/wasix/sdks/rust/THIRD_PARTY_NOTICES.md`
|
|
11
11
|
|
|
12
12
|
Shared PostgreSQL source pins, third-party source pins, and extension metadata
|
|
13
|
-
are maintained in `src/postgres
|
|
13
|
+
are maintained in `src/third-party/postgres/`, `src/third-party/`, and
|
|
14
14
|
`src/extensions/`. Generated release artifacts must include the notices and
|
|
15
15
|
exact pinned license bytes for every product and third-party component they
|
|
16
16
|
ship.
|
|
17
17
|
|
|
18
18
|
Canonical runtime license snapshots live in
|
|
19
|
-
`src/
|
|
20
|
-
enforced by `tools/
|
|
19
|
+
`src/third-party/`; their source pins and digests are
|
|
20
|
+
enforced by `tools/packaging/release-notices.mts`.
|
package/lib/browser.d.ts
ADDED
package/lib/browser.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const host = globalThis;
|
|
2
|
+
if (host.process?.versions?.node || host.Bun !== undefined || host.Deno !== undefined) {
|
|
3
|
+
throw new Error('@oliphaunt/wasix-ts/browser requires a browser or browser worker; use @oliphaunt/wasix-ts on Node.js, Bun, or Deno');
|
|
4
|
+
}
|
|
5
|
+
export { Oliphaunt, Oliphaunt as default } from './hosts/browser/client.js';
|
|
6
|
+
export * from './hosts/browser/browser-public.js';
|