Kaizen
Browse modulesFormsforms/serverFunctions

Function: evaluateConditionLogic()

function evaluateConditionLogic<TContext extends FormEvalContext>(
   node: ConditionLogicNode, 
   ctx: TContext, 
   conditionsTable: ConditionsTable, 
   customConditions?: Map<string, CustomConditionDef<unknown, TContext>>
): boolean;

Defined in: shared/forms/condition-evaluator.ts:62

Evaluate a ConditionLogicNode against an evaluation context.

Mirrors the AND/OR/NOT/leaf walker that lives privately inside @the-kaizen-labs/taproot/rules/shared (evaluateLogicNode). We reimplement it here rather than reach into a private export so that forms remains a leaf consumer of the rules-engine public surface.

Leaves are dispatched through the rules engine's evaluateCondition, which handles both built-in condition_types (FIELD_COMPARISON, AGE_CHECK, etc.) and consumer-registered custom conditions.

The empty-object case ({}) is treated as "always true" — matches the rules-engine convention.

Lives in the shared lane (no Prisma / Node-only deps) so client code — e.g. a multi-step wizard's progress projection — can evaluate the same condition trees the server walks on advanceStep, against a ConditionsTable it received from the server. The Prisma-row helpers needed to build the table stay in forms/server.

Type Parameters

Type Parameter
TContext extends FormEvalContext

Parameters

ParameterType
nodeConditionLogicNode
ctxTContext
conditionsTableConditionsTable
customConditionsMap<string, CustomConditionDef<unknown, TContext>>

Returns

boolean

On this page