@devfellowship/dmn
v0.1.0
Published
S-FEEL DMN decision-table evaluator of the DFL flows engine, plus the decision tables marked public
Maintainers
Readme
@devfellowship/dmn
The S-FEEL DMN decision-table evaluator of the DFL flows engine, and the decision tables that DFL marks public. Pure TypeScript, zero dependencies, no I/O: it runs in Node, Deno, edge functions and browsers.
npm install @devfellowship/dmnEvaluate a table
import { evaluateDefinition, evaluateTable, DmnError } from "@devfellowship/dmn";
const result = evaluateDefinition(definition, "pr_auto_merge", { ci_green: true });
result.output; // UNIQUE / FIRST: { action: "merge" }; COLLECT: an array
result.matched_rules; // [{ rule_id, outputs }]Supported: hit policies UNIQUE, FIRST, COLLECT; entries -, > < >= <=,
ranges [a..b] with open ends ( ) ] [, not(...), comma lists, quoted
strings, true / false / null, numbers; dotted-path inputs; optional
inputs (a missing variable resolves to null). Errors are DmnError with a
kind (DecisionNotFound, UniqueViolation, InputCountMismatch,
OutputCountMismatch, InputResolutionFailed, UnsupportedExpression).
Public tables
import { listTables, getTable, evaluatePublicTable, tablesSource } from "@devfellowship/dmn/tables";
listTables(); // [{ key: "ci_rerun_policy", name, decision_id }]
evaluatePublicTable("ci_rerun_policy", input); // same result shape as above
tablesSource.commit; // dfl-flows-definitions commit of this releaseOnly manifest entries of devfellowship/dfl-flows-definitions with
"public": true enter the package (plan ADR-24). Every other table is
remote-only: evaluate it with the flows engine (check_decision).
Release
.github/workflows/dmn-package.yml publishes to npmjs when a merge to main
carries a version that npm does not have yet. To release: bump version in
packages/dmn/package.json in a PR. The release syncs the public tables from
dfl-flows-definitions main (scripts/sync-public-tables.mjs); the committed
src/tables.data.ts stays empty.
Develop
cd packages/dmn
npm ci
npm test # builds dist, then runs node:test against dist