انتقل إلى المحتوى الرئيسي

Class: TenantTransaction<DB>

Defined in: packages/persistence/src/scoped.ts:36

A transaction opened for one tenant Scope, with oktoid.scope_path set for its life. Holding one proves a scope was checked and the setting made: it is only registered by withScope, and a repository refuses any other instance. A platform transaction is a different class, so a tenant repository handed one does not compile.

Type Parameters​

DB​

DB

Properties​

scope​

readonly scope: Scope

Defined in: packages/persistence/src/scoped.ts:39

The scope the transaction was opened for.


trx​

readonly trx: Transaction<DB>

Defined in: packages/persistence/src/scoped.ts:41

The Kysely transaction. Every statement on it runs under scope.

Accessors​

kind​

Get Signature​

get kind(): "tenant"

Defined in: packages/persistence/src/scoped.ts:53

Returns​

"tenant"

'tenant'; present so the private field is read and the type stays nominal.

Methods​

afterCommit()​

afterCommit(effect): void

Defined in: packages/persistence/src/scoped.ts:66

Runs effect once this transaction has COMMITTED, and never when it rolls back. For in-memory consequences of a write (evicting a cached key) that must not happen for a write that did not take. Synchronous and in-memory only: a port call does not belong here. A throw is swallowed, so one effect cannot stop the next or turn a committed transaction into an error.

Parameters​

effect​

() => void

What to do after commit.

Returns​

void