npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@floken-io/dmn

v0.0.3

Published

DMN 1.5 decision engine (DRG + decision tables) for floken

Readme

@floken-io/dmn

npm license

DMN 1.5 决策引擎:让「规则」独立于流程图存在。

表达式求值委托 @floken-io/feel,不自研求值器。

安装

npm i @floken-io/dmn

快速开始

import { decide, decideOnly } from '@floken-io/dmn';

// 指定决策入口
const r = decide(xml, 'decision_001', { applicantAge: 18, risk: 'LOW' });
r.value;         // 决策结果
r.trace;         // 决策轨迹:[{ type: 'Decision', id, name, result }]
r.diagnostics;   // 诊断(换输入有救的那类问题;其余抛错)

// 模型里只有一个决策时
const r2 = decideOnly(xml, { applicantAge: 18 });

低层 API:readDmn / writeDmn(XML ↔ 模型)、indexModel / evaluateDecision / evaluateAll(DRG 编排)、evaluateExpression(单表达式)。

接入流程引擎(businessRuleTask)

createDecisionHandler() 把一份 .dmn 包装成 @floken-io/engine 的 decisionHandler SPI:

import { createEngine } from '@floken-io/engine';
import { createDecisionHandler } from '@floken-io/dmn';

createEngine({
  decisionHandler: createDecisionHandler(xml, { decision: '住宿标准表' }),
});

决策结果会并入流程变量,可以直接驱动网关分支:

| as | 落点 | 适用 | |---|---|---| | 'merge'(默认) | 结果是对象 → 逐键并入;是标量 → 挂到决策变量名下 | 决策表多列输出 | | 'node' | { [节点 id]: 结果 } | 与引擎 scriptTask 的落点对齐 | | 自定义函数 | 宿主完全接管 | 只要其中一列之类 |

不 import @floken-io/engine:本包只做形状兼容,不引入对引擎的类型依赖 —— 装不装 dmn,引擎都一样完整(依赖方向是单向旁挂)。

诊断:DMN 的 diagnostics 在引擎侧没有出口(decisionHandler 只返回变量补丁), 故提供 onDiagnostics 回调;不传则诊断不落地。DMN 里「null 传播」是正常结果, 不是一个错误,所以默认不告警。

版本口径

  • 元模型权威版本 = DMN 1.5(命名空间 https://www.omg.org/spec/DMN/20230324/MODEL/)
  • 导入兼容 1.3 / 1.4 / 1.5 / 1.6,按文件声明的命名空间识别
  • 导出恒写 1.5
  • FEEL 表达式语言 URI = https://www.omg.org/spec/DMN/20230324/FEEL/

遇到 1.6 专有特性(importType="ONNX"、B-FEEL 命名空间)会明确报错,不静默降级。

标准符合性

用官方 DMN TCK 全量(含 DRG 遍历 / 决策表 / 命中策略)自证:

| 项 | 数 | |---|---| | 断言总数(生效) | 3467 | | IGNORED(0076 组,需真实 Java 类) | 18 | | 计分基数 | 3449 | | 通过 | 3449(100%) | | label 满分 | 53 / 53 |

分母可复算:语料全量 3569 = 生效 3467 + 官方注释禁用 102。数字比较按官方 runner 口径(绝对差 < 1e-8)。

IGNORED 清单与判定规则见 known-gaps.md。TCK 语料不随包分发(CC BY-SA 有传染性)。

相关包

| 包 | 用途 | |---|---| | @floken-io/feel | FEEL 表达式语言 | | @floken-io/moddle | BPMN 2.0 模型与 XML 转换 | | @floken-io/dmn | DMN 1.5 决策引擎(本包) | | @floken-io/engine | 流程内核与审批动作 | | @floken-io/designer | 流程画布与审批配置面板(开发中) |

开发

npm install
npm run build
npm run verify   # 发布门禁(含 TCK;语料缺失则跳过该项)
npm run tck      # 单独跑 TCK

许可证

Apache-2.0