PgwasmProtocol
Defined in: packages/pgwasm/src/core/internals.ts:31
What protocol(pg) returns.
Properties
Section titled “Properties”capabilities
Section titled “capabilities”
readonlycapabilities:BuildCapabilities
Defined in: packages/pgwasm/src/core/internals.ts:56
The build’s capabilities, e.g. to check synchronousExchange before relying on it.
Methods
Section titled “Methods”execProtocol()
Section titled “execProtocol()”execProtocol(
message,options?):Promise<ExecProtocolResult>
Defined in: packages/pgwasm/src/core/internals.ts:33
Run frontend message bytes; the parsed backend messages and the raw reply.
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
options?
Section titled “options?”Returns
Section titled “Returns”Promise<ExecProtocolResult>
execProtocolRaw()
Section titled “execProtocolRaw()”execProtocolRaw(
message,options?):Promise<Uint8Array<ArrayBufferLike>>
Defined in: packages/pgwasm/src/core/internals.ts:37
Run frontend message bytes; the raw reply. Notifications and errors are still dispatched.
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
options?
Section titled “options?”Pick<ExecProtocolOptions, "persist">
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
execProtocolRawStream()
Section titled “execProtocolRawStream()”execProtocolRawStream(
message,options):Promise<void>
Defined in: packages/pgwasm/src/core/internals.ts:43
Run frontend message bytes and stream the raw reply. When nothing is pending and the build has
synchronousExchange, the whole reply is delivered before this call returns its promise — what a
tool driving it from inside a blocking wasm callback (pg_dump) needs.
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
options
Section titled “options”Returns
Section titled “Returns”Promise<void>
execProtocolStream()
Section titled “execProtocolStream()”execProtocolStream(
message,options?):Promise<BackendMessage[]>
Defined in: packages/pgwasm/src/core/internals.ts:35
Run frontend message bytes; the parsed backend messages only.
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
options?
Section titled “options?”Returns
Section titled “Returns”Promise<BackendMessage[]>
runExclusiveSession()
Section titled “runExclusiveSession()”runExclusiveSession<
T>(fn):Promise<T>
Defined in: packages/pgwasm/src/core/internals.ts:54
Run fn with the database’s session to itself, for a tool whose exchanges must not interleave with
anything else (pg_dump). It waits for, then holds, the locks a transaction() holds, and the query
lock: no query, exec, transaction, listen, live-query refresh or Store backup of this database runs
until fn settles.
What fn sends with the execProtocol* methods is its own responsibility: no transaction is begun
or ended around it, and a message is persisted only as its options say. Inside fn, use only these
wire methods: the database’s query methods wait for the locks fn holds, so awaiting one deadlocks.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”() => Promise<T>
Returns
Section titled “Returns”Promise<T>