@mldong/jeeflow 1.8.39 → 1.8.40

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.
Files changed (2) hide show
  1. package/dist/facade.js +9 -6
  2. package/package.json +1 -1
package/dist/facade.js CHANGED
@@ -925,7 +925,7 @@ export class JeeflowFacade {
925
925
  try {
926
926
  const flow = JSON.parse(toStr(def.content));
927
927
  nodeProgress = await this.buildNodeProgress(flow, his);
928
- await this.collectPath(flow, 'start', '', active, history, edges, new Set(), inst.variables ?? {}, his);
928
+ await this.collectPath(flow, 'start', active, history, edges, new Set(), inst.variables ?? {}, his);
929
929
  }
930
930
  catch { /* ignore */ }
931
931
  }
@@ -995,12 +995,13 @@ export class JeeflowFacade {
995
995
  }
996
996
  return ids.map(id => ({ id, name: nameMap[id] ?? '' }));
997
997
  }
998
- async collectPath(flow, nodeId, edgeName, active, history, edges, visited, vars, historyTasks) {
998
+ // issues/157:边名收录在**源节点循环内**、活跃判断之前(逐字同位于 java
999
+ // `JeeflowFacade.collectPath`)。此前是把边名当递归实参传的,
1000
+ // ⇒ 目标节点当前活跃的那条边既不下钻也不收录,"进当前待办的那一跳"永远是灰的。
1001
+ async collectPath(flow, nodeId, active, history, edges, visited, vars, historyTasks) {
999
1002
  if (visited.has(nodeId))
1000
1003
  return;
1001
1004
  visited.add(nodeId);
1002
- if (edgeName && !edges.includes(edgeName))
1003
- edges.push(edgeName);
1004
1005
  const src = (flow.nodes ?? []).find((n) => n.id === nodeId);
1005
1006
  for (const e of flow.edges ?? []) {
1006
1007
  if (e.sourceNodeId !== nodeId)
@@ -1011,6 +1012,8 @@ export class JeeflowFacade {
1011
1012
  if (expr && !await this.evalDecisionExpr(flow, src, expr, vars, historyTasks))
1012
1013
  continue;
1013
1014
  }
1015
+ if (e.id && !edges.includes(e.id))
1016
+ edges.push(e.id);
1014
1017
  const target = (flow.nodes ?? []).find((n) => n.id === e.targetNodeId);
1015
1018
  if (!target)
1016
1019
  continue;
@@ -1018,8 +1021,8 @@ export class JeeflowFacade {
1018
1021
  if (!active.includes(tid) && !history.includes(tid))
1019
1022
  history.push(tid);
1020
1023
  if (active.includes(tid))
1021
- continue;
1022
- await this.collectPath(flow, tid, e.id, active, history, edges, visited, vars, historyTasks);
1024
+ continue; // 遇活跃节点停止深入(边名已在上面收录)
1025
+ await this.collectPath(flow, tid, active, history, edges, visited, vars, historyTasks);
1023
1026
  }
1024
1027
  }
1025
1028
  /** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.8.39",
3
+ "version": "1.8.40",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",