@mldong/jeeflow 1.8.56 → 1.8.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/facade.d.ts CHANGED
@@ -103,6 +103,11 @@ export declare class JeeflowFacade {
103
103
  /** 成员姓名解析(issue 43/E15):UserProvider SPI 并行批量解析 realName,查不到缺省空串 */
104
104
  private resolveMemberNames;
105
105
  private collectPath;
106
+ /** issues/241:决策节点选边——先按表达式求值(issues/06/153 旧口径),
107
+ * **当表达式给出的非空结果与任务行佐证相矛盾时,以任务行为准**;求值失败/零命中时保持
108
+ * 既有降级面(issues/164/201 的口径不被本规则改写)。
109
+ * 直返单重提后实例变量已改,按当前值重放会选出没走过的分支;走过的分支在任务表里有行。 */
110
+ private selectDecisionEdges;
106
111
  /** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量)
107
112
  *
108
113
  * instanceId/defineId 只作日志归因用(issues/201)——求值失败那条腿不许再一声不吭。 */
package/dist/facade.js CHANGED
@@ -1037,15 +1037,13 @@ export class JeeflowFacade {
1037
1037
  return;
1038
1038
  visited.add(nodeId);
1039
1039
  const src = (flow.nodes ?? []).find((n) => n.id === nodeId);
1040
- for (const e of flow.edges ?? []) {
1041
- if (e.sourceNodeId !== nodeId)
1042
- continue;
1043
- // 决策节点:输出边表达式求值过滤(对齐 boot3 recursionModel,issues/06)
1044
- if (src?.type === 'snaker:decision') {
1045
- const expr = e.properties?.expr;
1046
- if (expr && !await this.evalDecisionExpr(flow, src, expr, vars, historyTasks, instanceId, defineId))
1047
- continue;
1048
- }
1040
+ let outs = (flow.edges ?? []).filter((e) => e.sourceNodeId === nodeId);
1041
+ // issues/241:决策节点选边以任务行佐证为准(活跃目标 → 有任务行的目标),
1042
+ // 一条佐证都没有才回落到按当前实例变量求值
1043
+ if (src?.type === 'snaker:decision') {
1044
+ outs = await this.selectDecisionEdges(flow, src, outs, active, vars, historyTasks, instanceId, defineId);
1045
+ }
1046
+ for (const e of outs) {
1049
1047
  if (e.id && !edges.includes(e.id))
1050
1048
  edges.push(e.id);
1051
1049
  const target = (flow.nodes ?? []).find((n) => n.id === e.targetNodeId);
@@ -1059,6 +1057,34 @@ export class JeeflowFacade {
1059
1057
  await this.collectPath(flow, tid, active, history, edges, visited, vars, historyTasks, instanceId, defineId);
1060
1058
  }
1061
1059
  }
1060
+ /** issues/241:决策节点选边——先按表达式求值(issues/06/153 旧口径),
1061
+ * **当表达式给出的非空结果与任务行佐证相矛盾时,以任务行为准**;求值失败/零命中时保持
1062
+ * 既有降级面(issues/164/201 的口径不被本规则改写)。
1063
+ * 直返单重提后实例变量已改,按当前值重放会选出没走过的分支;走过的分支在任务表里有行。 */
1064
+ async selectDecisionEdges(flow, decision, outs, active, vars, historyTasks, instanceId, defineId) {
1065
+ const selected = [];
1066
+ for (const e of outs) {
1067
+ const expr = e.properties?.expr;
1068
+ if (!expr || await this.evalDecisionExpr(flow, decision, expr, vars, historyTasks, instanceId, defineId)) {
1069
+ selected.push(e);
1070
+ }
1071
+ }
1072
+ if (selected.length === 0)
1073
+ return selected;
1074
+ const taskNames = new Set((historyTasks ?? []).map((t) => t.taskName));
1075
+ for (const e of selected) {
1076
+ if (active.includes(e.targetNodeId) || taskNames.has(e.targetNodeId)) {
1077
+ return selected; // 表达式与执行事实一致,维持原口径
1078
+ }
1079
+ }
1080
+ const activeHits = outs.filter(e => active.includes(e.targetNodeId));
1081
+ if (activeHits.length > 0)
1082
+ return activeHits;
1083
+ const evidenced = outs.filter(e => taskNames.has(e.targetNodeId));
1084
+ if (evidenced.length > 0)
1085
+ return evidenced;
1086
+ return selected;
1087
+ }
1062
1088
  /** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量)
1063
1089
  *
1064
1090
  * instanceId/defineId 只作日志归因用(issues/201)——求值失败那条腿不许再一声不吭。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.8.56",
3
+ "version": "1.8.58",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,5 +46,9 @@
46
46
  "dist",
47
47
  "LICENSE",
48
48
  "README.md"
49
- ]
50
- }
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/mldong/jeeflow-node.git"
53
+ }
54
+ }