@mldong/jeeflow 1.8.37 → 1.8.39

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
@@ -81,8 +81,12 @@ export declare class JeeflowFacade {
81
81
  private surrogateDetail;
82
82
  /** 删除委托(issues/95:前端「我的委托」行内/批量删除统一发 {ids},与 define/design remove 同惯例) */
83
83
  private surrogateRemove;
84
- /** 委托写入公共字段。授权人(operator)仅在显式传入时覆盖,避免 update
85
- * 时清空原授权人(前端编辑表单不带 operator;集成层注入时 operator=授权人,覆盖无害) */
84
+ /** 委托写入公共字段。授权人(operator)仅在**显式且非空白**时覆盖:
85
+ * - update 缺省(不带键 / 空串 / 全空白)⇒ 保留原授权人,不得清空(spec 06 §update)
86
+ * - save 缺省档 ⇒ 保留调用点已归一的 operator(`operatorArg`,缺省 user1)
87
+ * issues/152 ③:空串/全空白**绝不落进** operator——那种行是「死行」,getSurrogate 的
88
+ * `WHERE operator = ?` 永不命中,台账看得见、待办永远不并人(比报错更难查)。
89
+ * 三档入参一律走 §2.5 归一,与 java `applySurrogateFields` 同形。 */
86
90
  private applySurrogateFields;
87
91
  private getLastByName;
88
92
  private highLight;
package/dist/facade.js CHANGED
@@ -807,12 +807,15 @@ export class JeeflowFacade {
807
807
  }
808
808
  // ── 委托代理(需扩展仓储) ───────────────────────────────────────────────
809
809
  async surrogatePage(args) {
810
- // issues/129 案 A 第一层(同档原则):空串/全空白 operator ≡ 缺键 ⇒ **不带**归属过滤。
811
- // 旧写法 `args.operator != null` 让 "" 变成"带了一个空值过滤",两仓给两种答案
812
- // (JDBC 侧 `t.operator = ''` 出 0 行、内存侧把条件整条丢掉出全库)。本 action 在 java
813
- // 门面里不下发归属条件,故回落点不是 user1 而是"与缺键一样不过滤"——只把两档并成一档。
814
- const opArg = toStr(args.operator).trim();
815
- const filters = opArg !== '' ? { operator: toStr(args.operator) } : undefined;
810
+ // issues/152 ②(案 A · 引擎侧立法,spec 06 §2.5 口径表 + §4.5「归属不变式」):
811
+ // t.operator 是归属列,与 instancePage(`pageInstances(pageNum, pageSize, operatorArg(args))`) 同形注入
812
+ // —— 引擎自己保证「我的委托」只看自己授出的行。旧写法(issues/129 案 A 那一版)是
813
+ // "空串/缺键 ⇒ **不带**归属过滤",理由是"本 action 在 java 门面里不下发归属条件",
814
+ // 那句话随 issues/152 选 A 一起作废:当时"我的委托只看自己"全靠集成壳注入 operator
815
+ // (mldong-boot2-jeeflow WfFlowController),换宿主/直调门面就退化成全库台账
816
+ // (vben5 前端本来就不传 operator)。归属列一律走 §2.5 归一:缺键/空串/全空白 ⇒ user1。
817
+ // 仓储那一层的第二道兜底(空归属值 ⇒ 空页)保持不动,见 memory-ext.ts / jdbc/ext.ts。
818
+ const filters = { operator: operatorArg(args) };
816
819
  const pageNum = toInt(args.pageNum ?? 1);
817
820
  const pageSize = toInt(args.pageSize ?? 10);
818
821
  const [rows, total] = await this.ext().pageSurrogates(pageNum, pageSize, filters, parseMQuery(args));
@@ -871,12 +874,19 @@ export class JeeflowFacade {
871
874
  await ext.removeSurrogate(id);
872
875
  return {};
873
876
  }
874
- /** 委托写入公共字段。授权人(operator)仅在显式传入时覆盖,避免 update
875
- * 时清空原授权人(前端编辑表单不带 operator;集成层注入时 operator=授权人,覆盖无害) */
877
+ /** 委托写入公共字段。授权人(operator)仅在**显式且非空白**时覆盖:
878
+ * - update 缺省(不带键 / 空串 / 全空白)⇒ 保留原授权人,不得清空(spec 06 §update)
879
+ * - save 缺省档 ⇒ 保留调用点已归一的 operator(`operatorArg`,缺省 user1)
880
+ * issues/152 ③:空串/全空白**绝不落进** operator——那种行是「死行」,getSurrogate 的
881
+ * `WHERE operator = ?` 永不命中,台账看得见、待办永远不并人(比报错更难查)。
882
+ * 三档入参一律走 §2.5 归一,与 java `applySurrogateFields` 同形。 */
876
883
  applySurrogateFields(s, args, operator) {
877
884
  s.processName = String(args.processName ?? '');
878
- if ('operator' in args)
879
- s.operator = String(args.operator);
885
+ if ('operator' in args) {
886
+ const explicit = toStr(args.operator);
887
+ if (explicit.trim() !== '')
888
+ s.operator = explicit;
889
+ }
880
890
  s.surrogate = String(args.surrogate ?? '');
881
891
  s.startTime = parseSurrogateTime(args.startTime);
882
892
  s.endTime = parseSurrogateTime(args.endTime);
@@ -1034,6 +1044,10 @@ export class JeeflowFacade {
1034
1044
  const instanceId = toId(args.id);
1035
1045
  const his = await this.repo.findHistoryTasks(instanceId);
1036
1046
  return his.map(t => ({
1047
+ // issues/154④:审批记录九键之首=任务行主键。本栈 id 全程 string(仓储 rowId 出口),
1048
+ // 仍显式 String() 一挡——"必须是字符串"这条契约不许押在仓储姿势上:19 位雪花 id
1049
+ // 出 number 会被 JS 截精度(同 issues/75/92 那族坑),对齐 java String.valueOf(...)。
1050
+ id: String(t.id ?? ''),
1037
1051
  taskName: t.taskName, displayName: t.displayName, taskType: t.taskType ?? null,
1038
1052
  performType: t.performType ?? null, taskState: t.taskState, operator: t.actorId ?? '',
1039
1053
  // issues/122:可空时间列空值出 '' 不出 null——mldong-nestjs 全局 SmartNullStripping
package/dist/jdbc/ext.js CHANGED
@@ -248,8 +248,16 @@ export class JdbcProcessExtRepository {
248
248
  let countSql = 'SELECT COUNT(*) FROM wf_process_surrogate t WHERE 1=1';
249
249
  // issues/129 案 A 第二层:filters.operator 是归属谓词("这条委托属于谁"),空值 ⇒ **空页**。
250
250
  // 与内存仓 memory-ext.ts pageSurrogates 同判据(否则同一个空 operator 两仓一个出 0 行、
251
- // 一个把条件丢掉出全库);门面已把空串归一化成缺键(surrogatePage),这一道防直连仓储的调用方。
252
- if ('operator' in (filters ?? {}) && isBlankValue(filters.operator))
251
+ // 一个把条件丢掉出全库)。issues/152 ② 起门面恒定下发归一后的归属值(surrogatePage 走
252
+ // operatorArg,缺键/空串/全空白 ⇒ user1),这一道专防绕过门面直连仓储的调用方。
253
+ // issues/152 ②:归属列**缺失档与空值档同判**(spec 06 §2.5),与 memory-ext.ts 逐字同尺子。
254
+ const ownCond = (conditions ?? []).find(c => c.column === 't.operator'
255
+ && (c.operator == null || String(c.operator).toUpperCase() === 'EQ'));
256
+ if ('operator' in (filters ?? {})) {
257
+ if (isBlankValue(filters.operator))
258
+ return [[], 0];
259
+ }
260
+ else if (!ownCond || isBlankValue(ownCond.value))
253
261
  return [[], 0];
254
262
  const args = [];
255
263
  const args2 = [];
@@ -97,9 +97,15 @@ export class MemoryExtRepository {
97
97
  // 原来靠下面那句 `val === '' continue` 把这条条件整条丢掉 ⇒ 空 operator 读出全库委托;
98
98
  // 只收归属列——surrogate / process_name / enabled 三个可选过滤仍走"空值当作没填"。
99
99
  // conditions 那一路(m_ 条件)由 matchConditions 的归属兜底覆盖(SURROGATE_FIELDS 带 t.operator)。
100
- const blankOwnershipFilter = Object.entries(filters ?? {})
101
- .some(([col, val]) => col === 'operator' && (val == null || String(val).trim() === ''));
102
- if (blankOwnershipFilter)
100
+ // issues/152 ②:归属列**缺失档与空值档同判**(spec 06 §2.5),与 jdbc/ext.ts 逐字同尺子。
101
+ const blankOwn = (v) => v == null || String(v).trim() === '';
102
+ const ownCond = (conditions ?? []).find(c => c.column === 't.operator'
103
+ && (c.operator == null || String(c.operator).toUpperCase() === 'EQ'));
104
+ if ('operator' in (filters ?? {})) {
105
+ if (blankOwn(filters.operator))
106
+ return [[], 0];
107
+ }
108
+ else if (!ownCond || blankOwn(ownCond.value))
103
109
  return [[], 0];
104
110
  const rows = [...this.surrogates.values()].filter(s => {
105
111
  for (const [col, val] of Object.entries(filters ?? {})) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.8.37",
3
+ "version": "1.8.39",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",