Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
txnBegintxnCommittxnAbort
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKTransactionstxnAbort

txnAbort

Discard a transaction's writes without waiting for its timeout.

PURPOSE

Discard the transaction and everything in it. Call it from a finally so a thrown error does not leave the transaction open until its timeout elapses.

Handshake credentialstable
txnAbort(request: TxnAbortRequest): Promise<TxnAbortResponse>

Parameters

ParameterTypeRequired
txnIdUUID bytesrequired

The transaction to discard.

Returns

FieldTypePresence
txnIdUUID bytesalways

Echoed back.

operationsDiscardedintegeralways

How many operations were thrown away.

Example

const txnId = newId();
await client.txnBegin({ txnId, timeoutSeconds: 30 });
try {
  await writeEverything(txnId);
  const res = await client.txnCommit({ txnId });
  console.log(`applied ${res.operationsApplied}`);
} catch (e) {
  await client.txnAbort({ txnId });
  throw e;
}

HTTP has no transactions

The HTTP edge exposes no transaction routes. Each HTTP verb is its own unit. If several writes must land together, you need the wire client — see Wire client.

See also
txnBegintxnCommit

Was this page helpful?

txnCommit

Apply a transaction's writes atomically, and check that every write actually joined it.

putLlmCredential

Register or replace the namespace's provider key — verified with the provider before it is stored.

On this page

ParametersReturnsExample
Suggest an editOpen in Playground