Kaizen
Browse modulesLifecyclelifecycle/serverFunctions

Function: bindingPort()

function bindingPort(config: BindingPortConfig): EntityStatePort;

Defined in: server/lifecycle/binding-port.ts:76

The default EntityStatePort over a registered Prisma model — the common "single id column + status column" case. Reads and compare-and-sets through the ambient transaction (no explicit tx argument), so it composes with the engine's send transaction.

This adapter does not add tenant predicates. A tenant-enabled engine requires the entity table to enforce tenant ownership, typically through RLS under the same role, GUC, and transaction, or a custom port that performs authorization.

Concurrency:

  • WITHOUT versionColumn: CAS is updateMany({ where: { id, state: expectedFrom }, data: { state: to } }), succeeding iff exactly one row changed. This can't distinguish a self-transition from a no-op, so the engine refuses allowSelf edges against a version-less port.
  • WITH versionColumn: CAS additionally matches the observed counter and bumps it (data: { state: to, version: expectedVersion + 1 }), serializing concurrent writers — including self-transitions.

Parameters

ParameterType
configBindingPortConfig

Returns

EntityStatePort

On this page