Skip to main content

Function: withSystemTransaction()

withSystemTransaction<DB, R>(db, purpose, work): Promise<R>

Defined in: packages/persistence/src/system.ts:69

Opens a transaction with no scope, for one of the reviewed SystemPurposes. It exists because two audit paths have no scope to offer: the relay drains rows of every tenant, and a refusal is recorded before an actor is trusted. It is @oktoid/persistence/system so that the import is visible in a review.

Type Parameters​

DB​

DB

R​

R

Parameters​

db​

Database<DB>

The module's pool, opened as that module's own role.

purpose​

SystemPurpose

Why. Anything outside SystemPurpose is refused.

work​

(tx) => Promise<R>

Runs in the transaction; a throw rolls it back.

Returns​

Promise<R>

What work returned, after commit.

Throws​

invalid_input for a purpose that is not listed.