@mldong/jeeflow 1.8.5 → 1.8.6

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
@@ -46,6 +46,10 @@ export declare class JeeflowFacade {
46
46
  private surrogateSave;
47
47
  private getLastByName;
48
48
  private highLight;
49
+ /** 节点成员进度(issue 41,对齐 boot3 highLight):按任务状态 + 会签变量组装
50
+ * nodeProgress——会签节点带 type(PARALLEL/SEQUENTIAL),成员 done/active 标记;
51
+ * 动态参与人节点(无静态 actorIds)不返回;name 缺省(引擎不持有宿主用户体系,前端降级显示 id) */
52
+ private buildNodeProgress;
49
53
  private collectPath;
50
54
  /** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量) */
51
55
  private evalDecisionExpr;
package/dist/facade.js CHANGED
@@ -603,14 +603,60 @@ export class JeeflowFacade {
603
603
  history.push(t.taskName);
604
604
  // 路径补全:start 沿边递归(遇活跃节点停止);决策分支按表达式求值过滤(issues/06)
605
605
  const def = await this.repo.findDefineById(inst.defineId);
606
+ let nodeProgress = {};
606
607
  if (def) {
607
608
  try {
608
609
  const flow = JSON.parse(toStr(def.content));
610
+ nodeProgress = this.buildNodeProgress(flow, his);
609
611
  await this.collectPath(flow, 'start', '', active, history, edges, new Set(), inst.variables ?? {}, his);
610
612
  }
611
613
  catch { /* ignore */ }
612
614
  }
613
- return { activeNodeNames: active, historyNodeNames: history, historyEdgeNames: edges };
615
+ return { activeNodeNames: active, historyNodeNames: history, historyEdgeNames: edges, nodeProgress };
616
+ }
617
+ /** 节点成员进度(issue 41,对齐 boot3 highLight):按任务状态 + 会签变量组装
618
+ * nodeProgress——会签节点带 type(PARALLEL/SEQUENTIAL),成员 done/active 标记;
619
+ * 动态参与人节点(无静态 actorIds)不返回;name 缺省(引擎不持有宿主用户体系,前端降级显示 id) */
620
+ buildNodeProgress(flow, his) {
621
+ const progress = {};
622
+ const names = [...new Set(his.map(t => t.taskName))];
623
+ for (const name of names) {
624
+ const tasks = his.filter(t => t.taskName === name);
625
+ const vars = tasks[0]?.variables ?? {};
626
+ // 完整办理人列表:会签变量 operatorList_{node} 优先(顺序会签全量),否则任务 actorIds 并集
627
+ let members = Array.isArray(vars[`operatorList_${name}`]) ? vars[`operatorList_${name}`] : null;
628
+ if (!members || members.length === 0) {
629
+ members = [...new Set(tasks.flatMap(t => t.actorIds ?? []))];
630
+ }
631
+ if (!members || members.length === 0)
632
+ continue; // 动态参与人:无静态成员,不返回
633
+ const doneSet = new Set();
634
+ for (const t of tasks) {
635
+ if (t.taskState === TaskState.Done)
636
+ for (const a of t.actorIds ?? [])
637
+ doneSet.add(a);
638
+ }
639
+ const activeActor = tasks.find(t => t.taskState === TaskState.Doing)?.actorIds?.[0];
640
+ const node = (flow.nodes ?? []).find((n) => n.id === name);
641
+ // 会签判定:定义节点属性(引擎创建任务时 performType 未落任务表,取模型为准)
642
+ const nodeProps = node?.properties ?? {};
643
+ const isCountersign = nodeProps.performType === 1 || nodeProps.countersignType != null;
644
+ const item = {
645
+ members: members.map((id) => {
646
+ const m = { id, name: '' };
647
+ if (doneSet.has(id))
648
+ m.done = true;
649
+ else if (id === activeActor)
650
+ m.active = true;
651
+ return m;
652
+ }),
653
+ };
654
+ if (isCountersign && nodeProps.countersignType) {
655
+ item.type = nodeProps.countersignType;
656
+ }
657
+ progress[name] = item;
658
+ }
659
+ return progress;
614
660
  }
615
661
  async collectPath(flow, nodeId, edgeName, active, history, edges, visited, vars, historyTasks) {
616
662
  if (visited.has(nodeId))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",