@kengela/adapter-expr-cel
v0.1.5
Published
Kengela ExpressionEnginePort adapter based on CEL (@marcbachmann/cel-js).
Maintainers
Readme
@kengela/adapter-expr-cel
An
ExpressionEnginePortadapter that evaluates authorization conditions with CEL (Common Expression Language).
This package implements the ExpressionEnginePort contract using CEL, so declarative policy conditions (for example resource.attributes.agencyId == principal.agencyId) are evaluated safely against the expression context. It is the adapter ring, and also ships date helpers usable from CEL expressions.
Part of Kengela, a Zero Trust identity and access foundation for multi-tenant TypeScript apps (authentication + authorization + identity federation + compliance).
Install
npm install @kengela/adapter-expr-celUsage
import { CelExpressionEngine } from '@kengela/adapter-expr-cel';
import type { ExpressionContext } from '@kengela/contracts';
const engine = new CelExpressionEngine();
const allowed = engine.evaluateBoolean(
'resource.attributes.agencyId == principal.agencyId',
ctx satisfies ExpressionContext,
);Key exports
CelExpressionEngine- theExpressionEnginePortimplementation backed by CEL.CelEvaluationError- thrown on invalid or failing expression evaluation.toEpochMs,daysBetween,businessDaysBetween- date helpers for CEL conditions.
Documentation
Guides and recipes: https://github.com/yannds/kengela/wiki
License
Apache-2.0
