Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/security / / composeGuardrails

Function: composeGuardrails()

ts
function composeGuardrails<TValue>(
   guardrails, 
   value, 
ctx): Promise<ComposedGuardrailResult<TValue>>;

Defined in: packages/security/src/guardrails/builders.ts:58

Compose a sequence of guardrails into a single check that runs them in order. The first 'block' short-circuits; 'warn' is accumulated; 'rewrite' mutates the in-flight value and continues forward.

The composer never throws: every error path returns ComposedGuardrailResult so the caller can surface structured results without exception handling.

Type Parameters

Type ParameterDefault type
TValueunknown

Parameters

ParameterType
guardrailsreadonly GuardrailDefinition&lt;TValue&gt;[]
valueTValue
ctxGuardrailContext

Returns

Promise<ComposedGuardrailResult&lt;TValue&gt;>

Stable