@mldong/jeeflow 1.8.39 → 1.8.41
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/engine.js +42 -4
- package/dist/facade.js +9 -6
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -383,7 +383,17 @@ export class EngineImpl {
|
|
|
383
383
|
// createTask 不再触发(引擎语义修正),此处为完成任务节点的唯一触发点
|
|
384
384
|
await this.firePost(curNode, inst);
|
|
385
385
|
const ct = curNode.properties?.countersignType;
|
|
386
|
-
|
|
386
|
+
let csCond = String(curNode.properties?.countersignCompletionCondition ?? '').trim();
|
|
387
|
+
// issues/163 附带读形对齐:设计器把条件写进 `properties.field` 子对象(共享夹具 07 就是
|
|
388
|
+
// 这个形状),java/php/csharp/rust/moon 五栈都读了嵌套形、只有本栈(及 python/go)只读
|
|
389
|
+
// 顶层 ⇒ 同一份 07 定义在 java 测试里 2/4 放行、本栈 4/4 才放行。顶层优先、嵌套兜底
|
|
390
|
+
// (rust/moon 同序;两处都写且打架属退化形状,不承诺与 java 的 "ext 优先" 同分叉)。
|
|
391
|
+
if (!csCond) {
|
|
392
|
+
const fld = curNode.properties?.field;
|
|
393
|
+
if (fld && typeof fld === 'object') {
|
|
394
|
+
csCond = String(fld.countersignCompletionCondition ?? '').trim();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
387
397
|
// issues/91:会签一票否决仅当节点配置 ONE_VOTE_VETO(忽略大小写)时生效,
|
|
388
398
|
// submitType=20 才跳过会签"未完成即停留"门控提前流转;否则为软拒绝——
|
|
389
399
|
// 否决者任务正常完成、countersignDisagreeFlag=1 已记录为变量(供下游参考),
|
|
@@ -424,9 +434,37 @@ export class EngineImpl {
|
|
|
424
434
|
}
|
|
425
435
|
}
|
|
426
436
|
if ((ct === 'PARALLEL' || ct?.startsWith('RATIO')) && !csVeto) {
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
|
|
437
|
+
const csExpr = csCond !== '' && csCond.toUpperCase() !== 'ONE_VOTE_VETO';
|
|
438
|
+
if (csExpr && this.exprEval) {
|
|
439
|
+
// issues/163:并行/比例会签的放行表达式**真求值**——基准=java CountersignHandler
|
|
440
|
+
// 并行分支(:86-106:cond 非空交求值器,catch ⇒ false)+ rust gate_vars
|
|
441
|
+
// (engine.rs:1122-1124:门控计数以**裸名**并进原料)。计数口径对齐 java
|
|
442
|
+
// buildCountersignVars:total=该节点全部成员行、activate=DOING、completed=已完成
|
|
443
|
+
// (读 inst.tasks:prepareExecuteTask 里 completeTask+syncTaskToAggregate 已把
|
|
444
|
+
// 本单同步进聚合,计数是新鲜的)。
|
|
445
|
+
const members = inst.tasks.filter(t => t.taskName === curNode.id);
|
|
446
|
+
const evalVars = {
|
|
447
|
+
...vars,
|
|
448
|
+
nrOfInstances: members.length,
|
|
449
|
+
nrOfActivateInstances: members.filter(t => t.isDoing()).length,
|
|
450
|
+
nrOfCompletedInstances: members.filter(t => t.isFinished()).length,
|
|
451
|
+
};
|
|
452
|
+
let merged = false;
|
|
453
|
+
try {
|
|
454
|
+
merged = isTruthy(await this.exprEval.eval(csCond, evalVars));
|
|
455
|
+
}
|
|
456
|
+
catch {
|
|
457
|
+
merged = false; // 对齐 java `catch (Exception ignored) { merged = false; }`
|
|
458
|
+
}
|
|
459
|
+
if (!merged)
|
|
460
|
+
return finishExecute();
|
|
461
|
+
// merged ⇒ 落穿到下面的 abandon+跟进边(与"全部完成"走同一出口)
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
const doing = await this.repo.findDoingTasks(inst.id);
|
|
465
|
+
if (doing.length > 0)
|
|
466
|
+
return finishExecute();
|
|
467
|
+
}
|
|
430
468
|
}
|
|
431
469
|
// issues/91:会签节点 merged 后(ONE_VOTE_VETO 否决 / 全部完成任一路径),
|
|
432
470
|
// 废弃该节点剩余 DOING 任务(对齐内置引擎 abandonProcessTask):
|
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',
|
|
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
|
-
|
|
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,
|
|
1024
|
+
continue; // 遇活跃节点停止深入(边名已在上面收录)
|
|
1025
|
+
await this.collectPath(flow, tid, active, history, edges, visited, vars, historyTasks);
|
|
1023
1026
|
}
|
|
1024
1027
|
}
|
|
1025
1028
|
/** 决策输出边表达式求值(args = 实例变量 + 决策节点前置任务变量) */
|