[AVAILABLE].
packages/policy, 61 tests. CLAIMS.md 2.2/2.3.Purpose
Evaluates aPolicySignals object against a Policy’s ordered rules and returns exactly
one Decision. See Policies and the decision for the
concept, this page is the export reference.
Install
Key exports
Engine, [AVAILABLE]
| Export | Signature |
|---|---|
PolicyEngine | .evaluate(policy: Policy, input: PolicyInput): PolicyDecision, first-match-wins over policy.rules, unmatched input rejects |
Routing and loading, [AVAILABLE]
| Export | Purpose |
|---|---|
PolicyRouter | Resolves a PolicyReference { name, version, schemaVersion } to a loaded Policy |
PolicyRegistry | In-memory policy lookup by name/version |
PolicyRepository (type) | The interface FilePolicyRepository and any custom repository implement |
FilePolicyRepository | new FilePolicyRepository(directory: string), resolves <directory>/<name>/<version>/policy.json |
Validation, [AVAILABLE]
| Export | Purpose |
|---|---|
PolicyValidator | Checks a loaded policy’s identity (policyId/policyVersion) matches what was requested before evaluation runs |
SignalValidator | Validates submitted signals against a policy’s signalsSchema |
Types
Policy, PolicyRule, PolicyCondition, PolicyRuleOutcome, PolicyInput,
PolicySignals, PolicyDecision, PolicyAction (enum: APPROVE, REJECT,
REQUIRE_OVERRIDE), PolicyOutcome (enum: APPROVE, REJECT, REQUIRE_OVERRIDE).
Minimal example
Next
Write your first policy
Write a policy and confirm both the approve and reject paths.
@parmana/runtime
Where
PolicyEngine is actually invoked as part of executing a transaction.