Combinators

Compose policy conditions with any_of (OR), all_of (AND), and not (NEGATE) combinators.

Compose policy conditions using boolean logic. Combinators are condition object shapes (not imported functions) that you use directly in policy rule conditions. any_of, all_of, and not let you build arbitrarily complex rules from simple building blocks.

Condition Shapes

ShapeSignatureDescription
any_of{ type: "any_of", conditions: PolicyCondition[] }OR combinator. Matches if at least one condition is true. Short-circuits on first match.
all_of{ type: "all_of", conditions: PolicyCondition[] }AND combinator. Matches only if every condition is true. Short-circuits on first failure.
not{ type: "not", condition: PolicyCondition }NEGATE combinator. Inverts the result of a single condition.

Basic Usage

ts

Nested Composition

Combinators nest freely. Build complex access control logic by composing simple conditions into trees.

ts

Note: Evaluation short-circuits: any_of stops at the first true condition, all_of stops at the first false. This keeps enforcement fast even with deep nesting.

Full Example

ts