createPgwasmClient
createPgwasmClient(
store,options?):Promise<PgwasmWithLive>
Defined in: packages/client/src/index.ts:620
Create the raw local pgwasm store the sync client runs on — the SAME pgwasm.create call
createSyncClient makes internally (the live extension, pre-warmed boot-asset
consumption, and the boot pgwasm.create rail stamp), extracted so exactly one implementation exists
and a host can create the store EAGERLY on an earlier screen. Hand the returned (still-pending)
instance to CreateSyncClientOptions.precreatedPgwasm: the client then owns schema exec, prepare
hooks, journal recovery, and registry reconciliation, exactly as its own storePath path does.
Takes a plain store path (ADR-0036), never a storage URL — the backend is DERIVED from the engine home
(capability-selected opfs-repacked with IndexedDB fallback in a browser, or the filesystem on Bun/Node);
a scheme-bearing path throws InvalidStorePathError.
Also accepts the testing helper’s output (createPgwasmClient(memoryStoreForTests("x"))) so a test can
mint a memory store without naming a backend.
The instance is deliberately schemaless — the registry-derived local schema is role/registry
dependent, so it is applied post-create by createSyncClient. The eager create buys only the expensive
initdb (+ persistent-store open), which is the dominant cold-boot cost once the WASM is pre-warmed.
build is the Postgres build (see CreateSyncClientOptions.build); a createCBuild({ assets }) whose
warm rejects loads its own assets — never a failure.
Parameters
Section titled “Parameters”StorePathInput
options?
Section titled “options?”Returns
Section titled “Returns”Promise<PgwasmWithLive>