@mldong/jeeflow 1.8.31 → 1.8.33
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.d.ts +15 -0
- package/dist/engine.js +125 -1
- package/dist/facade.js +36 -13
- package/dist/jdbc/ext.js +13 -0
- package/dist/jdbc/shared.js +23 -0
- package/dist/memory-ext.js +8 -0
- package/dist/memory.js +33 -4
- package/dist/spi.d.ts +18 -0
- package/dist/spi.js +25 -1
- package/package.json +1 -1
package/dist/engine.d.ts
CHANGED
|
@@ -125,3 +125,18 @@ export declare function mergeAgents(actors: string[], agents: Map<string, string
|
|
|
125
125
|
* '1' / 'ALL' / 'COUNTERSIGN'(大小写不敏感)→ 会签。
|
|
126
126
|
* 设计器属性面板保存 'ALL' 字符串符合 Java 契约,引擎必须兼容 */
|
|
127
127
|
export declare function isCountersign(v: any): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* 解析期待完成时间(逐字移植 Java `FlowUtil.processTime` / C# `FlowUtil.ProcessTime`,本栈原先没有)。
|
|
130
|
+
*
|
|
131
|
+
* 三档语义,**顺序不能变**:
|
|
132
|
+
* 1. `args` 里存在键名等于 expr 原串的项 ⇒ 取该项的值:Date / 毫秒时间戳 / `"yyyy-MM-dd HH:mm:ss"`
|
|
133
|
+
* → 该时刻;字符串解析失败 → **null**(不是 now);其它类型(布尔/数组/对象/小数)→ **落穿**到下面两档
|
|
134
|
+
* (Java/C# 都是落穿,不许当"解析失败"提前 return null)。
|
|
135
|
+
* 2. 否则 expr 以 `s`/`m`/`h`/`d` 结尾且前缀是整数 ⇒ now + N 秒/分/时/天(`d` 走**日历加天**,不乘 86400 秒)。
|
|
136
|
+
* 3. 否则把 expr 本身按 `"yyyy-MM-dd HH:mm:ss"` 解析 → 时刻;失败 → null。
|
|
137
|
+
*
|
|
138
|
+
* ⚠️ 任何一档都不得退回 now()——"算不出来就写当前时间"正是 issues/126 的病灶(建单即逾期,逾期统计恒失真)。
|
|
139
|
+
*
|
|
140
|
+
* @param now 取时基准=**本栈写 createTime 用的同一个 Date**(本栈无时钟槽,与 Java 直接用系统钟同档)
|
|
141
|
+
*/
|
|
142
|
+
export declare function processTime(expr: string, args: Record<string, any> | undefined, now: Date): Date | null;
|
package/dist/engine.js
CHANGED
|
@@ -272,6 +272,12 @@ export class EngineImpl {
|
|
|
272
272
|
const eff = mergeAgents([actors[lc + 1]], await this.surrogateAgents([actors[lc + 1]], pn));
|
|
273
273
|
if (eff.length > 1)
|
|
274
274
|
nt.actorIds = eff;
|
|
275
|
+
// issues/126 案 A · **第五处写点**:这一支绕过 createTask helper 直建任务行,所以必须显式补一次
|
|
276
|
+
// ——基准侧 boot2 的串行推进是回调 createCountersignTask(ProcessTaskServiceImpl:485,
|
|
277
|
+
// 内含 :524 那处到期写)⇒ 基准形状里"推进出的第二/第三位成员"同样带到期时间;
|
|
278
|
+
// 不补就是"首成员有到期、后续没有"(对齐 Java CountersignHandler.applyNodeExpireTime @ cb541d4)。
|
|
279
|
+
// 变量源=实例变量(与建单同档),取时基准=本行 createTime 用的同一个 now。
|
|
280
|
+
applyNodeExpireTime(nt, curNode.properties?.expireTime, inst.variables, now);
|
|
275
281
|
await this.repo.saveTask(nt);
|
|
276
282
|
// TASK_CREATE:顺序会签推进新任务落库后 fire(对齐 Java CreateTaskHandler / Rust)
|
|
277
283
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: curNode.id, operator });
|
|
@@ -415,9 +421,15 @@ export class EngineImpl {
|
|
|
415
421
|
let actor = isFirst ? String(his.variables?.u_userId ?? '') || inst.operator : his.actorId;
|
|
416
422
|
if (!actor)
|
|
417
423
|
throw new Error(NO_LINEAGE);
|
|
418
|
-
|
|
424
|
+
// 取时基准只取一次:本行 createTime 与 expire_time 共用同一个 Date(写点内不另起时钟)
|
|
425
|
+
const now = new Date();
|
|
426
|
+
const nt = inst.createTask(this.nextId(), prev.id, prev.text.value, actor, his.createUser ?? '', prev.properties?.form ?? '', now, his.parentTaskId ?? '0', isFirst, his.performType);
|
|
419
427
|
// 复活行只带数据类键:tf_*(上次表单提交)与 csv_*/会签簿记都是"上次提交"的残留
|
|
420
428
|
nt.variables = { ...lineageVars(his.variables), isFirstTaskNode: isFirst };
|
|
429
|
+
// issues/126 案 A · 回退新建写点:表达式取**被回退掉的那个节点**(=当前节点)的 expireTime,
|
|
430
|
+
// 变量源用随行拷贝那份(boot2 的 hisVariable)——两点都与 Java rejectTask 逐字一致。
|
|
431
|
+
// 取时基准 now 同时是本行 createTime 的值,勿另起时钟(否则同行 create→expire 差值带偏差)。
|
|
432
|
+
applyNodeExpireTime(nt, findNode(flow, task.taskName)?.properties?.expireTime, nt.variables, now);
|
|
421
433
|
const agents = await this.surrogateAgents([actor], await this.surrogateProcessName(flow, inst));
|
|
422
434
|
const eff = mergeAgents([actor], agents);
|
|
423
435
|
if (eff.length > 1)
|
|
@@ -460,6 +472,10 @@ export class EngineImpl {
|
|
|
460
472
|
const ct = node.properties?.countersignType;
|
|
461
473
|
const now = new Date();
|
|
462
474
|
const form = node.properties?.form ?? '';
|
|
475
|
+
// issues/126 案 A:与 createTask 同一把尺子。本函数当前**零调用者**(issues/121 P2 把回退改成血缘版后
|
|
476
|
+
// 就没人调它了),按 §1.9 第 1 条口径"接线但不为它造测试"——接线是为了将来复活时不再漏。
|
|
477
|
+
const expireExpr = node.properties?.expireTime;
|
|
478
|
+
const expireArgs = inst.variables;
|
|
463
479
|
if (isCountersign(node.properties?.performType) && ct) {
|
|
464
480
|
switch (ct) {
|
|
465
481
|
case 'PARALLEL':
|
|
@@ -469,6 +485,7 @@ export class EngineImpl {
|
|
|
469
485
|
const eff = mergeAgents([actor], agents);
|
|
470
486
|
if (eff.length > 1)
|
|
471
487
|
nt.actorIds = eff;
|
|
488
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now);
|
|
472
489
|
await this.repo.saveTask(nt);
|
|
473
490
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
474
491
|
}
|
|
@@ -483,6 +500,7 @@ export class EngineImpl {
|
|
|
483
500
|
const eff = mergeAgents([actors[0]], agents);
|
|
484
501
|
if (eff.length > 1)
|
|
485
502
|
nt.actorIds = eff;
|
|
503
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now);
|
|
486
504
|
await this.repo.saveTask(nt);
|
|
487
505
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
488
506
|
return;
|
|
@@ -493,6 +511,7 @@ export class EngineImpl {
|
|
|
493
511
|
const eff = mergeAgents([actor], agents);
|
|
494
512
|
if (eff.length > 1)
|
|
495
513
|
nt.actorIds = eff;
|
|
514
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now);
|
|
496
515
|
await this.repo.saveTask(nt);
|
|
497
516
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
498
517
|
}
|
|
@@ -503,6 +522,7 @@ export class EngineImpl {
|
|
|
503
522
|
const nt = inst.createTask(this.nextId(), node.id, node.text.value, effActors[0], operator, form, now, parentId, isFirst);
|
|
504
523
|
if (effActors.length > 1)
|
|
505
524
|
nt.actorIds = effActors;
|
|
525
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now);
|
|
506
526
|
await this.repo.saveTask(nt);
|
|
507
527
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
508
528
|
}
|
|
@@ -631,6 +651,10 @@ export class EngineImpl {
|
|
|
631
651
|
const ct = node.properties?.countersignType;
|
|
632
652
|
const now = new Date();
|
|
633
653
|
const form = node.properties?.form ?? '';
|
|
654
|
+
// issues/126 案 A:节点到期表达式(properties.expireTime)+ 实例变量 + 本函数取时基准 now
|
|
655
|
+
// —— 三处写点(串行首位 / 并行全员 / 普通建单)共用 applyNodeExpireTime 这一把尺子
|
|
656
|
+
const expireExpr = node.properties?.expireTime;
|
|
657
|
+
const expireArgs = inst.variables;
|
|
634
658
|
if (isCountersign(node.properties?.performType) && ct) {
|
|
635
659
|
switch (ct) {
|
|
636
660
|
case 'PARALLEL':
|
|
@@ -639,6 +663,7 @@ export class EngineImpl {
|
|
|
639
663
|
const eff = mergeAgents([actor], agents);
|
|
640
664
|
if (eff.length > 1)
|
|
641
665
|
nt.actorIds = eff;
|
|
666
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now); // 并行会签全员
|
|
642
667
|
await this.repo.saveTask(nt);
|
|
643
668
|
// TASK_CREATE:任务落库后逐个 fire(会签多任务逐个,对齐 Java CreateTaskHandler)
|
|
644
669
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
@@ -656,6 +681,7 @@ export class EngineImpl {
|
|
|
656
681
|
const eff = mergeAgents([actors[0]], agents);
|
|
657
682
|
if (eff.length > 1)
|
|
658
683
|
nt.actorIds = eff;
|
|
684
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now); // 串行会签首位成员
|
|
659
685
|
await this.repo.saveTask(nt);
|
|
660
686
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
661
687
|
return;
|
|
@@ -666,6 +692,7 @@ export class EngineImpl {
|
|
|
666
692
|
const eff = mergeAgents([actor], agents);
|
|
667
693
|
if (eff.length > 1)
|
|
668
694
|
nt.actorIds = eff;
|
|
695
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now); // 未配会签类型=全员预创建,与并行同档
|
|
669
696
|
await this.repo.saveTask(nt);
|
|
670
697
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
671
698
|
}
|
|
@@ -677,6 +704,7 @@ export class EngineImpl {
|
|
|
677
704
|
const nt = inst.createTask(this.nextId(), node.id, node.text.value, effActors[0], operator, form, now, parentId, isFirst);
|
|
678
705
|
if (effActors.length > 1)
|
|
679
706
|
nt.actorIds = effActors;
|
|
707
|
+
applyNodeExpireTime(nt, expireExpr, expireArgs, now); // 普通建单
|
|
680
708
|
await this.repo.saveTask(nt);
|
|
681
709
|
await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
|
|
682
710
|
}
|
|
@@ -875,3 +903,99 @@ function filterFieldByPerm(args, node) {
|
|
|
875
903
|
}
|
|
876
904
|
return out;
|
|
877
905
|
}
|
|
906
|
+
// ─── issues/126 案 A · 任务行到期时间(expire_time)求值与写入 ────────────────────
|
|
907
|
+
/** 绝对时刻格式 "yyyy-MM-dd HH:mm:ss"(Java SimpleDateFormat / C# TimeFormat 同串) */
|
|
908
|
+
const ABS_TIME_RE = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;
|
|
909
|
+
/** 按 "yyyy-MM-dd HH:mm:ss" 严格解析(本地时区);不合规/越界一律 null。
|
|
910
|
+
* 越界判据取 C# 的 TryParseExact(拒 13 月 / 25 时),不取 Java 的 SimpleDateFormat 宽松进位——
|
|
911
|
+
* 本案的硬要求是"解析不出 ⇒ 这一列留空",宽松进位会把误配的值算成一个真时刻。 */
|
|
912
|
+
function parseAbsTime(s) {
|
|
913
|
+
const m = ABS_TIME_RE.exec(s);
|
|
914
|
+
if (!m)
|
|
915
|
+
return null;
|
|
916
|
+
const [, ys, mos, ds, hs, mis, ss] = m;
|
|
917
|
+
const mo = Number(mos), d = Number(ds), h = Number(hs), mi = Number(mis), sec = Number(ss);
|
|
918
|
+
if (mo < 1 || mo > 12 || d < 1 || d > 31 || h > 23 || mi > 59 || sec > 59)
|
|
919
|
+
return null;
|
|
920
|
+
const dt = new Date(Number(ys), mo - 1, d, h, mi, sec, 0);
|
|
921
|
+
// 2 月 30 日这类"字段合法但日历上不存在"的值会被 JS 进位,回读校验挡掉
|
|
922
|
+
if (dt.getMonth() !== mo - 1 || dt.getDate() !== d)
|
|
923
|
+
return null;
|
|
924
|
+
return dt;
|
|
925
|
+
}
|
|
926
|
+
/** 相对档前缀取整:必须是**纯整数**且落在 int32 内(C# int.TryParse 同判据),否则返回 null ⇒ 落穿。
|
|
927
|
+
* 与 Java 的差异是故意的:Java 的 Integer.parseInt 遇 "xh" 会抛异常**打断建单**,
|
|
928
|
+
* owner 2026-09-28 定的口径是按 C# 落穿→NULL(配置写错不该让流程卡死);要改回"跟 Java 一样抛"必须八栈同批改。 */
|
|
929
|
+
function intPrefix(s) {
|
|
930
|
+
if (!/^[-+]?\d+$/.test(s))
|
|
931
|
+
return null;
|
|
932
|
+
const n = Number(s);
|
|
933
|
+
return Number.isSafeInteger(n) && Math.abs(n) <= 2147483647 ? n : null;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* 解析期待完成时间(逐字移植 Java `FlowUtil.processTime` / C# `FlowUtil.ProcessTime`,本栈原先没有)。
|
|
937
|
+
*
|
|
938
|
+
* 三档语义,**顺序不能变**:
|
|
939
|
+
* 1. `args` 里存在键名等于 expr 原串的项 ⇒ 取该项的值:Date / 毫秒时间戳 / `"yyyy-MM-dd HH:mm:ss"`
|
|
940
|
+
* → 该时刻;字符串解析失败 → **null**(不是 now);其它类型(布尔/数组/对象/小数)→ **落穿**到下面两档
|
|
941
|
+
* (Java/C# 都是落穿,不许当"解析失败"提前 return null)。
|
|
942
|
+
* 2. 否则 expr 以 `s`/`m`/`h`/`d` 结尾且前缀是整数 ⇒ now + N 秒/分/时/天(`d` 走**日历加天**,不乘 86400 秒)。
|
|
943
|
+
* 3. 否则把 expr 本身按 `"yyyy-MM-dd HH:mm:ss"` 解析 → 时刻;失败 → null。
|
|
944
|
+
*
|
|
945
|
+
* ⚠️ 任何一档都不得退回 now()——"算不出来就写当前时间"正是 issues/126 的病灶(建单即逾期,逾期统计恒失真)。
|
|
946
|
+
*
|
|
947
|
+
* @param now 取时基准=**本栈写 createTime 用的同一个 Date**(本栈无时钟槽,与 Java 直接用系统钟同档)
|
|
948
|
+
*/
|
|
949
|
+
export function processTime(expr, args, now) {
|
|
950
|
+
const a = args ?? {};
|
|
951
|
+
// ① 变量档:优先于相对档(args 里真有个键叫 "2h" 时取变量值)
|
|
952
|
+
if (Object.prototype.hasOwnProperty.call(a, expr)) {
|
|
953
|
+
const v = a[expr];
|
|
954
|
+
if (v instanceof Date)
|
|
955
|
+
return new Date(v.getTime());
|
|
956
|
+
if (typeof v === 'number' && Number.isSafeInteger(v))
|
|
957
|
+
return new Date(v);
|
|
958
|
+
if (typeof v === 'string')
|
|
959
|
+
return parseAbsTime(v);
|
|
960
|
+
// 其它类型 ⇒ 落穿
|
|
961
|
+
}
|
|
962
|
+
if (expr.trim() === '')
|
|
963
|
+
return null;
|
|
964
|
+
// ② 相对档
|
|
965
|
+
const n = intPrefix(expr.slice(0, -1));
|
|
966
|
+
if (n !== null) {
|
|
967
|
+
switch (expr.charAt(expr.length - 1)) {
|
|
968
|
+
case 's': return new Date(now.getTime() + n * 1000);
|
|
969
|
+
case 'm': return new Date(now.getTime() + n * 60000);
|
|
970
|
+
case 'h': return new Date(now.getTime() + n * 3600000);
|
|
971
|
+
case 'd': {
|
|
972
|
+
const d = new Date(now.getTime());
|
|
973
|
+
d.setDate(d.getDate() + n); // 日历加天(跨夏令时/月末按天进位,对齐 Java Calendar.add)
|
|
974
|
+
return d;
|
|
975
|
+
}
|
|
976
|
+
default: break;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
// ③ 绝对档
|
|
980
|
+
return parseAbsTime(expr);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* issues/126 案 A · 任务行 expire_time 的**唯一**写入口(五处写点共用同一把尺子):
|
|
984
|
+
* 普通建单 / 串行会签首位成员 / 并行会签全员 / 回退新建 / 串行会签推进出的下一位成员。
|
|
985
|
+
*
|
|
986
|
+
* 节点没配(undefined / null / 空串 / 纯空白)⇒ **该列保持空**:不写 now()、不写 ''、不写 0
|
|
987
|
+
* (owner 2026-09-28 口径,对齐 boot2 `if(StrUtil.isNotEmpty(expireTime))` 的先判再写)。
|
|
988
|
+
*
|
|
989
|
+
* 变量源两档:建单路径=**实例变量**(boot2 的 `execution.getArgs()`),
|
|
990
|
+
* 回退新建=**随行拷贝那份变量**(boot2 的 `hisVariable`)。搞混会让"表达式是个变量名"这一档跨栈得到不同答案。
|
|
991
|
+
*/
|
|
992
|
+
function applyNodeExpireTime(task, expr, args, now) {
|
|
993
|
+
if (!task)
|
|
994
|
+
return;
|
|
995
|
+
const s = expr == null ? '' : String(expr);
|
|
996
|
+
if (s.trim() === '')
|
|
997
|
+
return;
|
|
998
|
+
const at = processTime(s, args, now);
|
|
999
|
+
if (at)
|
|
1000
|
+
task.expireTime = at;
|
|
1001
|
+
}
|
package/dist/facade.js
CHANGED
|
@@ -155,7 +155,7 @@ export class JeeflowFacade {
|
|
|
155
155
|
// ── 流程定义 / 实例 ──────────────────────────────────────────────────────
|
|
156
156
|
async startAndExecute(args) {
|
|
157
157
|
const defineId = toId(args.processDefineId);
|
|
158
|
-
const operator =
|
|
158
|
+
const operator = operatorArg(args);
|
|
159
159
|
const flowArgs = {};
|
|
160
160
|
for (const [k, v] of Object.entries(args)) {
|
|
161
161
|
if (k === 'processDefineId' || k === 'operator')
|
|
@@ -302,7 +302,7 @@ export class JeeflowFacade {
|
|
|
302
302
|
// ── 流程任务 ─────────────────────────────────────────────────────────────
|
|
303
303
|
async execute(args) {
|
|
304
304
|
const taskId = toId(args.processTaskId);
|
|
305
|
-
const operator =
|
|
305
|
+
const operator = operatorArg(args);
|
|
306
306
|
const submitType = toInt(args.submitType ?? SUBMIT_AGREE);
|
|
307
307
|
const flowArgs = {};
|
|
308
308
|
for (const [k, v] of Object.entries(args)) {
|
|
@@ -550,7 +550,7 @@ export class JeeflowFacade {
|
|
|
550
550
|
}
|
|
551
551
|
async designSave(args) {
|
|
552
552
|
const ext = this.ext();
|
|
553
|
-
const operator =
|
|
553
|
+
const operator = operatorArg(args);
|
|
554
554
|
const designId = args.id != null ? toId(args.id) : '';
|
|
555
555
|
let design;
|
|
556
556
|
if (!designId) {
|
|
@@ -604,7 +604,12 @@ export class JeeflowFacade {
|
|
|
604
604
|
}
|
|
605
605
|
// ── 委托代理(需扩展仓储) ───────────────────────────────────────────────
|
|
606
606
|
async surrogatePage(args) {
|
|
607
|
-
|
|
607
|
+
// issues/129 案 A 第一层(同档原则):空串/全空白 operator ≡ 缺键 ⇒ **不带**归属过滤。
|
|
608
|
+
// 旧写法 `args.operator != null` 让 "" 变成"带了一个空值过滤",两仓给两种答案
|
|
609
|
+
// (JDBC 侧 `t.operator = ''` 出 0 行、内存侧把条件整条丢掉出全库)。本 action 在 java
|
|
610
|
+
// 门面里不下发归属条件,故回落点不是 user1 而是"与缺键一样不过滤"——只把两档并成一档。
|
|
611
|
+
const opArg = toStr(args.operator).trim();
|
|
612
|
+
const filters = opArg !== '' ? { operator: toStr(args.operator) } : undefined;
|
|
608
613
|
const pageNum = toInt(args.pageNum ?? 1);
|
|
609
614
|
const pageSize = toInt(args.pageSize ?? 10);
|
|
610
615
|
const [rows, total] = await this.ext().pageSurrogates(pageNum, pageSize, filters, parseMQuery(args));
|
|
@@ -613,7 +618,7 @@ export class JeeflowFacade {
|
|
|
613
618
|
}
|
|
614
619
|
async surrogateSave(args) {
|
|
615
620
|
const ext = this.ext();
|
|
616
|
-
const operator =
|
|
621
|
+
const operator = operatorArg(args);
|
|
617
622
|
const surrogateId = args.id != null ? toId(args.id) : '';
|
|
618
623
|
let surrogate;
|
|
619
624
|
if (!surrogateId) {
|
|
@@ -643,7 +648,7 @@ export class JeeflowFacade {
|
|
|
643
648
|
const surrogate = await ext.findSurrogateById(surrogateId);
|
|
644
649
|
if (!surrogate)
|
|
645
650
|
throw new Error('委托记录不存在');
|
|
646
|
-
const operator =
|
|
651
|
+
const operator = operatorArg(args);
|
|
647
652
|
this.applySurrogateFields(surrogate, args, operator);
|
|
648
653
|
await ext.updateSurrogate(surrogate);
|
|
649
654
|
return { id: surrogate.id };
|
|
@@ -850,7 +855,7 @@ export class JeeflowFacade {
|
|
|
850
855
|
}
|
|
851
856
|
async createCCInstance(args) {
|
|
852
857
|
const instanceId = toId(args.processInstanceId);
|
|
853
|
-
const operator =
|
|
858
|
+
const operator = operatorArg(args);
|
|
854
859
|
const actors = toStringList2(args.actorIds);
|
|
855
860
|
if (actors.length === 0)
|
|
856
861
|
throw new Error('actorIds 缺失');
|
|
@@ -862,20 +867,20 @@ export class JeeflowFacade {
|
|
|
862
867
|
}
|
|
863
868
|
async updateCCStatus(args) {
|
|
864
869
|
const instanceId = toId(args.processInstanceId);
|
|
865
|
-
const operator =
|
|
870
|
+
const operator = operatorArg(args);
|
|
866
871
|
await this.repo.updateCcStatus(instanceId, operator);
|
|
867
872
|
}
|
|
868
873
|
// ccList 我的抄送分页(v1.3.0):operator 作为抄送人过滤
|
|
869
874
|
async ccList(args) {
|
|
870
875
|
const pageNum = toInt(args.pageNum ?? 1);
|
|
871
876
|
const pageSize = toInt(args.pageSize ?? 10);
|
|
872
|
-
const actorId =
|
|
877
|
+
const actorId = operatorArg(args);
|
|
873
878
|
const { rows, total } = await this.repo.pageCcInstances(pageNum, pageSize, actorId, parseMQuery(args));
|
|
874
879
|
return pageData(pageNum, pageSize, total, rows.map(r => ccRowToMap(r)));
|
|
875
880
|
}
|
|
876
881
|
async taskDetail(args) {
|
|
877
882
|
const taskId = toId(args.id);
|
|
878
|
-
const operator =
|
|
883
|
+
const operator = operatorArg(args);
|
|
879
884
|
const task = await this.repo.findTaskById(taskId);
|
|
880
885
|
if (!task)
|
|
881
886
|
throw new Error('任务不存在');
|
|
@@ -1125,7 +1130,7 @@ export class JeeflowFacade {
|
|
|
1125
1130
|
async instancePage(args) {
|
|
1126
1131
|
const pageNum = toInt(args.pageNum ?? 1);
|
|
1127
1132
|
const pageSize = toInt(args.pageSize ?? 10);
|
|
1128
|
-
const operator =
|
|
1133
|
+
const operator = operatorArg(args);
|
|
1129
1134
|
const { rows, total } = await this.repo.pageInstances(pageNum, pageSize, operator, parseMQuery(args));
|
|
1130
1135
|
return pageData(pageNum, pageSize, total, rows.map(r => instanceRowToMap(r)));
|
|
1131
1136
|
}
|
|
@@ -1192,14 +1197,14 @@ export class JeeflowFacade {
|
|
|
1192
1197
|
async todoList(args) {
|
|
1193
1198
|
const pageNum = toInt(args.pageNum ?? 1);
|
|
1194
1199
|
const pageSize = toInt(args.pageSize ?? 10);
|
|
1195
|
-
const actorId =
|
|
1200
|
+
const actorId = operatorArg(args);
|
|
1196
1201
|
const { rows, total } = await this.repo.pageTodoTasks(pageNum, pageSize, actorId, parseMQuery(args));
|
|
1197
1202
|
return pageData(pageNum, pageSize, total, rows.map(r => taskRowToMap(r)));
|
|
1198
1203
|
}
|
|
1199
1204
|
async doneList(args) {
|
|
1200
1205
|
const pageNum = toInt(args.pageNum ?? 1);
|
|
1201
1206
|
const pageSize = toInt(args.pageSize ?? 10);
|
|
1202
|
-
const operator =
|
|
1207
|
+
const operator = operatorArg(args);
|
|
1203
1208
|
const { rows, total } = await this.repo.pageDoneTasks(pageNum, pageSize, operator, parseMQuery(args));
|
|
1204
1209
|
return pageData(pageNum, pageSize, total, rows.map(r => taskRowToMap(r)));
|
|
1205
1210
|
}
|
|
@@ -1606,6 +1611,24 @@ function toStr(v) {
|
|
|
1606
1611
|
return JSON.stringify(v);
|
|
1607
1612
|
return String(v);
|
|
1608
1613
|
}
|
|
1614
|
+
/**
|
|
1615
|
+
* issues/129 案 A 第一层(门面归一化):operator 取值,**空串与缺键同档**。
|
|
1616
|
+
*
|
|
1617
|
+
* 逐字对齐 java `JeeflowFacade.operatorArg`(`s != null && !s.trim().isEmpty() ? s : "user1"`)。
|
|
1618
|
+
* 旧写法 `String(args.operator ?? 'user1')` 的 `??` 只在 null/undefined 兜缺省 ⇒ 显式传
|
|
1619
|
+
* `{"operator":""}` 会原样穿过门面落到仓储,再被仓储「空值不加条件」的通用放行**整条丢掉**
|
|
1620
|
+
* ⇒「我的实例/待办/已办/抄送」读出全库(2026-09-28 实测 node 栈 25 行 vs user1 的 4 行,
|
|
1621
|
+
* 返回行带着 userA/userB/manager/director 等**别人的** operator)。
|
|
1622
|
+
* 归一化放门面是第一层,仓储的归属兜底是第二层(`spi.ts` OWNERSHIP_COLUMNS → memory.ts /
|
|
1623
|
+
* jdbc/shared.ts buildWhere / jdbc/ext.ts buildExtWhere),两层都要在;只留门面那半不算修完。
|
|
1624
|
+
*
|
|
1625
|
+
* ⚠️ 本 helper 不适用撤回(withdraw)/转办(transfer)族——那两处是 issues/114 的
|
|
1626
|
+
* 「operator 硬必填、严禁回落 user1」,保持原样。
|
|
1627
|
+
*/
|
|
1628
|
+
function operatorArg(args) {
|
|
1629
|
+
const s = toStr(args.operator);
|
|
1630
|
+
return s.trim() !== '' ? s : 'user1';
|
|
1631
|
+
}
|
|
1609
1632
|
function toId(v) {
|
|
1610
1633
|
// issue 38 E9:id 全程 string 承载——Java 雪花 id(>2^53)经 Number() 必丢精度。
|
|
1611
1634
|
// 数字输入(JS 安全整数内)转字符串;字符串输入原样保留(含超长雪花 id)。
|
package/dist/jdbc/ext.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// 与 shared.ts 同一套 SqlAdapter / 占位符约定;分页为单表简单过滤(filters 字段名 EQ)。
|
|
4
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
5
|
+
import { isBlankOwnership, isBlankValue } from '../spi.js';
|
|
5
6
|
import { TsIDGenerator, rowId } from './shared.js';
|
|
6
7
|
import { surrogateIsEffective, surrogateTimeMs } from '../surrogate-rule.js';
|
|
7
8
|
const txStore = new AsyncLocalStorage();
|
|
@@ -117,6 +118,13 @@ export class JdbcProcessExtRepository {
|
|
|
117
118
|
if (!whitelist.has(c.column))
|
|
118
119
|
continue;
|
|
119
120
|
const val = c.value;
|
|
121
|
+
// issues/129 案 A 第二层(与 shared.ts buildWhere 同形,在原有那句通用放行之前):
|
|
122
|
+
// 归属谓词列(委托分页的 t.operator)+ 空值 ⇒ **空页**,不是"这条条件不加"。
|
|
123
|
+
// ⚠️ 只收归属列,下面那句"空值当作没填"是设计名/流程名等**可选过滤**的通用放行,不动。
|
|
124
|
+
if (isBlankOwnership(c.column, c.operator, val)) {
|
|
125
|
+
sql += ' AND 1=0';
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
120
128
|
if (val == null || val === '')
|
|
121
129
|
continue;
|
|
122
130
|
switch (c.operator.toUpperCase()) {
|
|
@@ -238,6 +246,11 @@ export class JdbcProcessExtRepository {
|
|
|
238
246
|
async pageSurrogates(pageNum = 1, pageSize = 10, filters, conditions) {
|
|
239
247
|
let sql = `SELECT ${JdbcProcessExtRepository.SURROGATE_COLS} FROM wf_process_surrogate t WHERE 1=1`;
|
|
240
248
|
let countSql = 'SELECT COUNT(*) FROM wf_process_surrogate t WHERE 1=1';
|
|
249
|
+
// issues/129 案 A 第二层:filters.operator 是归属谓词("这条委托属于谁"),空值 ⇒ **空页**。
|
|
250
|
+
// 与内存仓 memory-ext.ts pageSurrogates 同判据(否则同一个空 operator 两仓一个出 0 行、
|
|
251
|
+
// 一个把条件丢掉出全库);门面已把空串归一化成缺键(surrogatePage),这一道防直连仓储的调用方。
|
|
252
|
+
if ('operator' in (filters ?? {}) && isBlankValue(filters.operator))
|
|
253
|
+
return [[], 0];
|
|
241
254
|
const args = [];
|
|
242
255
|
const args2 = [];
|
|
243
256
|
for (const [col, val] of Object.entries(filters ?? {})) {
|
package/dist/jdbc/shared.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
12
12
|
import { ProcessInstance, ProcessTask } from '../model.js';
|
|
13
13
|
import { TaskState } from '../model.js';
|
|
14
|
+
import { isBlankOwnership, isBlankValue } from '../spi.js';
|
|
14
15
|
// ═══ 列白名单(issues/05-5,与 mldong-boot2 别名一致) ═══
|
|
15
16
|
const TASK_WHITELIST = new Set([
|
|
16
17
|
't.id', 't.task_name', 't.display_name', 't.task_type', 't.perform_type', 't.task_state',
|
|
@@ -460,6 +461,11 @@ export class JdbcRepository {
|
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
463
|
async pageInstances(pageNum, pageSize, operator, conditions) {
|
|
464
|
+
// issues/129 案 A 第二层:位置参归属过滤(t.operator)为空 ⇒ 空页。
|
|
465
|
+
// 不短路的话 `WHERE t.operator = ''` 会去匹配 operator 列恰为空串的行,与内存仓(空 ⇒ 空页)、
|
|
466
|
+
// 与 java(归属列空值 ⇒ `AND 1=0`)都不同答案;两仓同一份数据必须给同一个结论。
|
|
467
|
+
if (isBlankValue(operator))
|
|
468
|
+
return { rows: [], total: 0 };
|
|
463
469
|
const cond = this.buildWhere(conditions ?? [], INSTANCE_WHITELIST);
|
|
464
470
|
const where = ' FROM wf_process_instance t' +
|
|
465
471
|
' LEFT JOIN wf_process_define pd ON t.process_define_id = pd.id' +
|
|
@@ -485,6 +491,10 @@ export class JdbcRepository {
|
|
|
485
491
|
return this.pageTasks(pageNum, pageSize, true, operator, conditions);
|
|
486
492
|
}
|
|
487
493
|
async pageTasks(pageNum, pageSize, done, filter, conditions) {
|
|
494
|
+
// issues/129 案 A 第二层:位置参归属过滤(done=t.operator / todo=pta.actor_id)为空 ⇒ 空页,
|
|
495
|
+
// 与内存仓同判据(两仓同一份数据一个答案),也让 `= ''` 不去匹配归属列恰为空串的行。
|
|
496
|
+
if (isBlankValue(filter))
|
|
497
|
+
return { rows: [], total: 0 };
|
|
488
498
|
const cond = this.buildWhere(conditions ?? [], TASK_WHITELIST);
|
|
489
499
|
const where = ' FROM wf_process_task t' +
|
|
490
500
|
' LEFT JOIN wf_process_instance pi ON t.process_instance_id = pi.id' +
|
|
@@ -536,6 +546,16 @@ export class JdbcRepository {
|
|
|
536
546
|
if (!whitelist.has(c.column))
|
|
537
547
|
continue; // 不在白名单,丢弃
|
|
538
548
|
const val = c.value;
|
|
549
|
+
// issues/129 案 A 第二层(在**原有那句通用放行之前**,逐字对照 java JdbcProcessRepository.buildWhere):
|
|
550
|
+
// 归属谓词列 + 空值 ⇒ **空页**(`AND 1=0`),绝不能变成"这条条件不加"。
|
|
551
|
+
// 门面已把空串归一化成缺省(facade `operatorArg`),这一道防的是绕过门面直接调仓储的调用方
|
|
552
|
+
// 与将来的门面改动——只留门面那半不算修完(rust 1.0.17 同为两层)。
|
|
553
|
+
// ⚠️ 只收归属列:下面那句"空值当作没填"是 QueryCondition 对 m_LIKE_* 等**可选过滤**的通用放行,
|
|
554
|
+
// 照字面改成"空值即空页"会把可选过滤一起改坏。
|
|
555
|
+
if (isBlankOwnership(c.column, c.operator, val)) {
|
|
556
|
+
sql += ' AND 1=0';
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
539
559
|
if (val == null || val === '')
|
|
540
560
|
continue;
|
|
541
561
|
switch (c.operator.toUpperCase()) {
|
|
@@ -611,6 +631,9 @@ export class JdbcRepository {
|
|
|
611
631
|
}
|
|
612
632
|
// pageCcInstances 我的抄送分页(v1.3.0):cc 表 join 实例 + 定义,按抄送人过滤(对齐 Java pageCcInstances)
|
|
613
633
|
async pageCcInstances(pageNum, pageSize, actorId, conditions) {
|
|
634
|
+
// issues/129 案 A 第二层:位置参归属过滤(cc.actor_id)为空 ⇒ 空页(与内存仓/java 同判据)
|
|
635
|
+
if (isBlankValue(actorId))
|
|
636
|
+
return { rows: [], total: 0 };
|
|
614
637
|
const cond = this.buildWhere(conditions ?? [], CC_WHITELIST);
|
|
615
638
|
const where = ' FROM wf_process_instance t' +
|
|
616
639
|
' LEFT JOIN wf_process_define pd ON t.process_define_id = pd.id' +
|
package/dist/memory-ext.js
CHANGED
|
@@ -84,6 +84,14 @@ export class MemoryExtRepository {
|
|
|
84
84
|
this.surrogates.delete(id);
|
|
85
85
|
}
|
|
86
86
|
async pageSurrogates(_pageNum = 1, _pageSize = 10, filters, conditions) {
|
|
87
|
+
// issues/129 案 A 第二层:filters 的 operator 键 = 归属谓词列(t.operator),空值 ⇒ **空页**。
|
|
88
|
+
// 原来靠下面那句 `val === '' continue` 把这条条件整条丢掉 ⇒ 空 operator 读出全库委托;
|
|
89
|
+
// 只收归属列——surrogate / process_name / enabled 三个可选过滤仍走"空值当作没填"。
|
|
90
|
+
// conditions 那一路(m_ 条件)由 matchConditions 的归属兜底覆盖(SURROGATE_FIELDS 带 t.operator)。
|
|
91
|
+
const blankOwnershipFilter = Object.entries(filters ?? {})
|
|
92
|
+
.some(([col, val]) => col === 'operator' && (val == null || String(val).trim() === ''));
|
|
93
|
+
if (blankOwnershipFilter)
|
|
94
|
+
return [[], 0];
|
|
87
95
|
const rows = [...this.surrogates.values()].filter(s => {
|
|
88
96
|
for (const [col, val] of Object.entries(filters ?? {})) {
|
|
89
97
|
if (val == null || val === '')
|
package/dist/memory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaskState } from './model.js';
|
|
2
2
|
import { cloneInstance, cloneTask } from './model.js';
|
|
3
|
+
import { isBlankOwnership } from './spi.js';
|
|
3
4
|
// ═══ 条件匹配基建(issues/05-5,对齐 JDBC 白名单语义) ═══
|
|
4
5
|
// 行字段映射(列名 → 行属性,白名单列均可匹配)
|
|
5
6
|
const TASK_FIELDS = {
|
|
@@ -35,6 +36,13 @@ export function matchConditions(conditions, fields) {
|
|
|
35
36
|
for (const c of conditions ?? []) {
|
|
36
37
|
const v = fields[c.column];
|
|
37
38
|
const expect = c.value;
|
|
39
|
+
// issues/129 案 A 第二层(在**原有那句通用放行之前**,与 java JdbcProcessRepository.buildWhere 同位置):
|
|
40
|
+
// 归属谓词列 + 空值 ⇒ 空页,绝不折叠成"这条条件不加"。门面已把空串归一化成缺省(facade operatorArg),
|
|
41
|
+
// 这一道防的是绕过门面直连仓储的调用方与下一版门面改动。
|
|
42
|
+
// ⚠️ 只收 OWNERSHIP_COLUMNS 那四列:下面那句 expect == null 放行 + 空串按"没填"处理是
|
|
43
|
+
// m_LIKE_* 等**可选过滤**的通用行为,整体改成"空值即空页"会把可选过滤一起改坏。
|
|
44
|
+
if (isBlankOwnership(c.column, c.operator, expect))
|
|
45
|
+
return false;
|
|
38
46
|
if (v == null || expect == null)
|
|
39
47
|
continue;
|
|
40
48
|
switch (c.operator.toUpperCase()) {
|
|
@@ -92,6 +100,22 @@ export function eqValue(v, expect) {
|
|
|
92
100
|
return v.includes(expect);
|
|
93
101
|
return String(v) === String(expect);
|
|
94
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* issues/129 案 A 第二层 · 位置参归属过滤(内存仓)。
|
|
105
|
+
*
|
|
106
|
+
* 本栈门面把"我是谁"作为**位置参**下发给 pageInstances/pageTodoTasks/pageDoneTasks/pageCcInstances
|
|
107
|
+
* (java 下发的是 `t.operator EQ` 条件,形状不同、义务相同:归属值为空 ⇒ 空页)。
|
|
108
|
+
* 旧写法 `if (operator && …) continue` 把空串折叠成"这条条件不加" ⇒ 绕过门面的调用方一读就是**全库**
|
|
109
|
+
* (issues/129 §2 点名的 node 落点 `src/memory.ts:273` 就是 doneList 那一句)。
|
|
110
|
+
* 现按拍板一律「空(null/undefined/全空白)⇒ 空页」,与 rust 1.0.17 内存仓
|
|
111
|
+
* (`!op.is_empty()` 判据)同形;非空值**原样比较、不 trim**,与 java `t.operator = ?`
|
|
112
|
+
* 及本栈 SQL 侧 `= ?` 的取值口径一致(不借机放宽成模糊匹配)。
|
|
113
|
+
* 返回 null 表示"归属值为空",调用方据此让每一行都不匹配。
|
|
114
|
+
*/
|
|
115
|
+
function ownershipKey(wanted) {
|
|
116
|
+
const op = wanted ?? '';
|
|
117
|
+
return op.trim() === '' ? null : op;
|
|
118
|
+
}
|
|
95
119
|
export class MemoryRepository {
|
|
96
120
|
defines = new Map();
|
|
97
121
|
instances = new Map();
|
|
@@ -270,8 +294,10 @@ export class MemoryRepository {
|
|
|
270
294
|
}
|
|
271
295
|
async pageInstances(pageNum = 1, pageSize = 10, operator, conditions) {
|
|
272
296
|
const rows = [];
|
|
297
|
+
// issues/129 案 A 第二层:归属值为空 ⇒ 空页(原来 `if (operator && …)` 是"空即不过滤",读出全库)
|
|
298
|
+
const op = ownershipKey(operator);
|
|
273
299
|
for (const inst of this.instances.values()) {
|
|
274
|
-
if (
|
|
300
|
+
if (op == null || inst.operator !== op)
|
|
275
301
|
continue;
|
|
276
302
|
const def = this.defines.get(inst.defineId);
|
|
277
303
|
const r = {
|
|
@@ -292,10 +318,11 @@ export class MemoryRepository {
|
|
|
292
318
|
}
|
|
293
319
|
async pageTodoTasks(pageNum = 1, pageSize = 10, actorId, conditions) {
|
|
294
320
|
const rows = [];
|
|
321
|
+
const op = ownershipKey(actorId); // issues/129 案 A 第二层:空 ⇒ 空页,不再"空即不过滤"
|
|
295
322
|
for (const t of this.tasks.values()) {
|
|
296
323
|
if (t.taskState !== TaskState.Doing)
|
|
297
324
|
continue;
|
|
298
|
-
if (
|
|
325
|
+
if (op == null || !(this.actors.get(t.id) ?? []).includes(op))
|
|
299
326
|
continue;
|
|
300
327
|
const r = this.taskRow(t);
|
|
301
328
|
const fields = pickFields(r, TASK_FIELDS);
|
|
@@ -309,10 +336,11 @@ export class MemoryRepository {
|
|
|
309
336
|
}
|
|
310
337
|
async pageDoneTasks(pageNum = 1, pageSize = 10, operator, conditions) {
|
|
311
338
|
const rows = [];
|
|
339
|
+
const op = ownershipKey(operator); // issues/129 案 A 第二层:空 ⇒ 空页(本 issue §2 点名的内存仓落点)
|
|
312
340
|
for (const t of this.tasks.values()) {
|
|
313
341
|
if (t.taskState === TaskState.Doing)
|
|
314
342
|
continue;
|
|
315
|
-
if (
|
|
343
|
+
if (op == null || t.actorId !== op)
|
|
316
344
|
continue;
|
|
317
345
|
const r = this.taskRow(t);
|
|
318
346
|
if (matchConditions(conditions, pickFields(r, TASK_FIELDS)))
|
|
@@ -341,8 +369,9 @@ export class MemoryRepository {
|
|
|
341
369
|
// pageCcInstances 我的抄送分页(v1.3.0):按抄送人 actorId 过滤,join 实例 + 定义
|
|
342
370
|
async pageCcInstances(pageNum = 1, pageSize = 10, actorId, conditions) {
|
|
343
371
|
const rows = [];
|
|
372
|
+
const op = ownershipKey(actorId); // issues/129 案 A 第二层:空 ⇒ 空页(cc.actor_id 为归属列)
|
|
344
373
|
for (const [instId, actors] of this.ccInstances) {
|
|
345
|
-
if (
|
|
374
|
+
if (op == null || !actors.includes(op))
|
|
346
375
|
continue;
|
|
347
376
|
const inst = this.instances.get(instId);
|
|
348
377
|
if (!inst)
|
package/dist/spi.d.ts
CHANGED
|
@@ -4,6 +4,24 @@ export interface QueryCondition {
|
|
|
4
4
|
operator: string;
|
|
5
5
|
value: any;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* 归属谓词列:这几列定义「这条记录属于谁」,空值**绝不能**等于「不过滤」。
|
|
9
|
+
* 取自门面实际下发的那四条(逐字对齐 java `JdbcProcessRepository.OWNERSHIP_COLUMNS`,
|
|
10
|
+
* 本栈列名写法与 java 相同——`wf_process_task.operator` / 实例 join 出的 `pi.operator` /
|
|
11
|
+
* 任务参与者表 `wf_process_task_actor.actor_id` / 抄送表 `wf_process_cc.actor_id`):
|
|
12
|
+
* processInstance/page → t.operator、processTask/todoList → pta.actor_id、
|
|
13
|
+
* processTask/doneList → t.operator(+ pi.operator 带出的实例发起人)、processInstance/ccList → cc.actor_id
|
|
14
|
+
* 口径见 jeeflow-doc `spec/06-facade.md` §2.5。
|
|
15
|
+
*/
|
|
16
|
+
export declare const OWNERSHIP_COLUMNS: ReadonlySet<string>;
|
|
17
|
+
/** 空值判定(对齐 java `val == null || ((String) val).trim().isEmpty()`):null/undefined/全空白串 */
|
|
18
|
+
export declare function isBlankValue(val: unknown): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 归属谓词 + 空值 ⇒ **空页**(issues/129 案 A 第二层)。
|
|
21
|
+
* 只收 `OWNERSHIP_COLUMNS` 上的 EQ 条件:动态 where 里「空值当作没填」那句是 PageQuery 对
|
|
22
|
+
* `m_LIKE_*` 等**可选过滤**的通用放行,整体改掉会把可选过滤一起改坏(spec 06-facade.md §2.5 ⚠️)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function isBlankOwnership(column: string, operator: string, val: unknown): boolean;
|
|
7
25
|
export interface InstanceStatsRow {
|
|
8
26
|
defineId: string;
|
|
9
27
|
state: number;
|
package/dist/spi.js
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
// ═══ 归属谓词基建(issues/129 案 A · 第二层「仓储兜底」)═══
|
|
2
|
+
/**
|
|
3
|
+
* 归属谓词列:这几列定义「这条记录属于谁」,空值**绝不能**等于「不过滤」。
|
|
4
|
+
* 取自门面实际下发的那四条(逐字对齐 java `JdbcProcessRepository.OWNERSHIP_COLUMNS`,
|
|
5
|
+
* 本栈列名写法与 java 相同——`wf_process_task.operator` / 实例 join 出的 `pi.operator` /
|
|
6
|
+
* 任务参与者表 `wf_process_task_actor.actor_id` / 抄送表 `wf_process_cc.actor_id`):
|
|
7
|
+
* processInstance/page → t.operator、processTask/todoList → pta.actor_id、
|
|
8
|
+
* processTask/doneList → t.operator(+ pi.operator 带出的实例发起人)、processInstance/ccList → cc.actor_id
|
|
9
|
+
* 口径见 jeeflow-doc `spec/06-facade.md` §2.5。
|
|
10
|
+
*/
|
|
11
|
+
export const OWNERSHIP_COLUMNS = new Set([
|
|
12
|
+
't.operator', 'pi.operator', 'pta.actor_id', 'cc.actor_id',
|
|
13
|
+
]);
|
|
14
|
+
/** 空值判定(对齐 java `val == null || ((String) val).trim().isEmpty()`):null/undefined/全空白串 */
|
|
15
|
+
export function isBlankValue(val) {
|
|
16
|
+
return val == null || (typeof val === 'string' && val.trim() === '');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 归属谓词 + 空值 ⇒ **空页**(issues/129 案 A 第二层)。
|
|
20
|
+
* 只收 `OWNERSHIP_COLUMNS` 上的 EQ 条件:动态 where 里「空值当作没填」那句是 PageQuery 对
|
|
21
|
+
* `m_LIKE_*` 等**可选过滤**的通用放行,整体改掉会把可选过滤一起改坏(spec 06-facade.md §2.5 ⚠️)。
|
|
22
|
+
*/
|
|
23
|
+
export function isBlankOwnership(column, operator, val) {
|
|
24
|
+
return OWNERSHIP_COLUMNS.has(column) && operator.toUpperCase() === 'EQ' && isBlankValue(val);
|
|
25
|
+
}
|