Kaizen
Browse modulesLifecyclelifecycle/serverInterfaces

Interface: EntityStatePort

Defined in: shared/lifecycle/types/port.ts:53

Port over a consumer entity's lifecycle state.

Implementations run under the engine's ambient transaction — do NOT open your own transaction or accept a tx argument.

Properties

capabilities?

readonly optional capabilities?: EntityStatePortCapabilities;

Defined in: shared/lifecycle/types/port.ts:55

Optional capability flags (see EntityStatePortCapabilities).

Methods

compareAndSetState()

compareAndSetState(input: CompareAndSetStateInput): Promise<boolean>;

Defined in: shared/lifecycle/types/port.ts:70

Atomically move the entity from expectedFrom to to (compare-and-set). Returns true iff exactly one row was updated; false means the CAS lost (the engine maps that to TransitionConflictError). Throwing maps to LifecycleAdapterError.

Parameters

ParameterType
inputCompareAndSetStateInput

Returns

Promise<boolean>


getCurrentState()

getCurrentState(entityId: string): Promise<EntityStateSnapshot | null>;

Defined in: shared/lifecycle/types/port.ts:62

Read the entity's current state (and optional version). Returns null if the entity does not exist — the engine maps that to EntityNotFoundError. Throwing maps to LifecycleAdapterError.

Parameters

ParameterType
entityIdstring

Returns

Promise<EntityStateSnapshot | null>

On this page