@mldong/jeeflow 1.8.46 → 1.8.48
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 +4 -0
- package/dist/facade.js +65 -4
- package/package.json +1 -1
package/dist/facade.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OrgUserProvider, ProcessExtRepository, ProcessRepository } from './spi.js';
|
|
2
2
|
import type { EngineImpl } from './engine.js';
|
|
3
3
|
export type UserSearch = (query: Record<string, any>) => Promise<[Record<string, any>[], number]> | [Record<string, any>[], number];
|
|
4
|
+
export type UserSearchById = (userId: string) => Promise<Record<string, any> | null> | Record<string, any> | null;
|
|
4
5
|
/** 内部异常对外只说这一句(八栈逐字同串,措辞不许改——owner 2026-10-02 第 3 问拍 A) */
|
|
5
6
|
export declare const INTERNAL_FAILURE_MSG = "\u6D41\u7A0B\u5904\u7406\u5931\u8D25";
|
|
6
7
|
/**
|
|
@@ -37,6 +38,7 @@ export declare class JeeflowFacade {
|
|
|
37
38
|
private readonly repo;
|
|
38
39
|
private readonly extRepo?;
|
|
39
40
|
private userSearch?;
|
|
41
|
+
private userSearchById?;
|
|
40
42
|
private orgProv?;
|
|
41
43
|
private metaReader?;
|
|
42
44
|
constructor(engine: EngineImpl, repo: ProcessRepository, extRepo?: ProcessExtRepository | undefined);
|
|
@@ -45,6 +47,7 @@ export declare class JeeflowFacade {
|
|
|
45
47
|
readByProcessInstance(tableName: string, processInstanceId: unknown): unknown;
|
|
46
48
|
}): this;
|
|
47
49
|
setUserSearch(fn: UserSearch): this;
|
|
50
|
+
setUserSearchById(fn: UserSearchById): this;
|
|
48
51
|
setOrgProvider(orgProv: OrgUserProvider): this;
|
|
49
52
|
flow(action: string, args?: Record<string, any>): Promise<Record<string, any>>;
|
|
50
53
|
/** 事务包裹(audit8 145-2):engine 缺省(纯统计门面用法)时裸跑=显式降级。 */
|
|
@@ -110,6 +113,7 @@ export declare class JeeflowFacade {
|
|
|
110
113
|
private taskDetail;
|
|
111
114
|
private jumpAbleTaskNameList;
|
|
112
115
|
private candidatePage;
|
|
116
|
+
private candidateRow;
|
|
113
117
|
private nextTaskCandidates;
|
|
114
118
|
private taskAddActor;
|
|
115
119
|
/**
|
package/dist/facade.js
CHANGED
|
@@ -198,6 +198,7 @@ export class JeeflowFacade {
|
|
|
198
198
|
repo;
|
|
199
199
|
extRepo;
|
|
200
200
|
userSearch;
|
|
201
|
+
userSearchById;
|
|
201
202
|
orgProv;
|
|
202
203
|
metaReader;
|
|
203
204
|
constructor(engine, repo, extRepo) {
|
|
@@ -221,6 +222,11 @@ export class JeeflowFacade {
|
|
|
221
222
|
this.userSearch = fn;
|
|
222
223
|
return this;
|
|
223
224
|
}
|
|
225
|
+
// 注入候选映射第一级钩子(issues/178 R12;可选,未注入回落 getUserProvider)
|
|
226
|
+
setUserSearchById(fn) {
|
|
227
|
+
this.userSearchById = fn;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
224
230
|
// 注入组织用户提供者(candidatePage candidateGroups 角色取人,v1.6.0)
|
|
225
231
|
setOrgProvider(orgProv) {
|
|
226
232
|
this.orgProv = orgProv;
|
|
@@ -1215,8 +1221,34 @@ export class JeeflowFacade {
|
|
|
1215
1221
|
catch { /* ignore */ }
|
|
1216
1222
|
}
|
|
1217
1223
|
if (candidates.length > 0) {
|
|
1218
|
-
// issues/
|
|
1219
|
-
|
|
1224
|
+
// issues/178 R12(spec 06:728 优先级链,形状照 java JeeflowFacade.java:945-1012):
|
|
1225
|
+
// 第一级 userSearchById(findById)→ 第二级 engine.getUserProvider().getUser → 兜底;
|
|
1226
|
+
// 修前恒兜底 {c,c,c}(provider 真名被丢,C99 ⑩ 派 3)。
|
|
1227
|
+
const up = this.engine ? this.engine.getUserProvider() : undefined;
|
|
1228
|
+
const rows = [];
|
|
1229
|
+
for (const c of candidates) {
|
|
1230
|
+
let src = null;
|
|
1231
|
+
if (this.userSearchById) {
|
|
1232
|
+
try {
|
|
1233
|
+
src = await this.userSearchById(c);
|
|
1234
|
+
}
|
|
1235
|
+
catch {
|
|
1236
|
+
src = null;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (!src && up) {
|
|
1240
|
+
try {
|
|
1241
|
+
const u = await up.getUser(c);
|
|
1242
|
+
if (u) {
|
|
1243
|
+
src = { userId: u.userId, realName: u.realName };
|
|
1244
|
+
if (u.deptName)
|
|
1245
|
+
src.deptName = u.deptName;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
catch { /* 单用户失败回落兜底 */ }
|
|
1249
|
+
}
|
|
1250
|
+
rows.push(this.candidateRow(c, src));
|
|
1251
|
+
}
|
|
1220
1252
|
return pageData(pageNum, pageSize, rows.length, rows);
|
|
1221
1253
|
}
|
|
1222
1254
|
// 无模型候选 → 用户分页搜索(依赖 userSearch 钩子)
|
|
@@ -1225,11 +1257,40 @@ export class JeeflowFacade {
|
|
|
1225
1257
|
const [rows, total] = await this.userSearch(args);
|
|
1226
1258
|
return pageData(pageNum, pageSize, total, rows);
|
|
1227
1259
|
}
|
|
1260
|
+
// candidatePage 候选行键归一(issues/178 R12;形状照 java :992-1012):
|
|
1261
|
+
// id=src.id→src.userId→actorId(一律字符串化);realName=src.realName→id;
|
|
1262
|
+
// userId/userName/deptName 仅在 src 给出时透传。src 为空=两级都未命中 ⇒ 兜底 {actor, actor}。
|
|
1263
|
+
candidateRow(actorId, srcIn) {
|
|
1264
|
+
const src = srcIn ?? { userId: actorId, realName: actorId };
|
|
1265
|
+
let id = actorId;
|
|
1266
|
+
if (src.id !== undefined && src.id !== null)
|
|
1267
|
+
id = String(src.id);
|
|
1268
|
+
else if (src.userId !== undefined && src.userId !== null)
|
|
1269
|
+
id = String(src.userId);
|
|
1270
|
+
const row = { id };
|
|
1271
|
+
row.realName = src.realName !== undefined && src.realName !== null ? src.realName : id;
|
|
1272
|
+
if (src.userId !== undefined && src.userId !== null)
|
|
1273
|
+
row.userId = src.userId;
|
|
1274
|
+
if (src.userName !== undefined && src.userName !== null)
|
|
1275
|
+
row.userName = src.userName;
|
|
1276
|
+
if (src.deptName !== undefined && src.deptName !== null)
|
|
1277
|
+
row.deptName = src.deptName;
|
|
1278
|
+
return row;
|
|
1279
|
+
}
|
|
1228
1280
|
async nextTaskCandidates(flow, taskName) {
|
|
1229
1281
|
const result = [];
|
|
1230
1282
|
const visited = new Set();
|
|
1231
1283
|
const collect = async (node) => {
|
|
1232
|
-
|
|
1284
|
+
// issues/177 R11:顶层优先、`field` 子对象兜底(形状对齐 163 会签条件腿)
|
|
1285
|
+
const props = node.properties ?? {};
|
|
1286
|
+
const fld = props.field ?? {};
|
|
1287
|
+
const propStr = (key) => {
|
|
1288
|
+
const top = props[key];
|
|
1289
|
+
if (top)
|
|
1290
|
+
return top;
|
|
1291
|
+
return fld[key];
|
|
1292
|
+
};
|
|
1293
|
+
const v = propStr('candidateUsers');
|
|
1233
1294
|
if (v) {
|
|
1234
1295
|
for (const s of String(v).split(',')) {
|
|
1235
1296
|
const t = s.trim();
|
|
@@ -1238,7 +1299,7 @@ export class JeeflowFacade {
|
|
|
1238
1299
|
}
|
|
1239
1300
|
}
|
|
1240
1301
|
// candidateGroups:按角色取人(v1.6.0,对齐 boot4 GlobalCandidateHandler)
|
|
1241
|
-
const g =
|
|
1302
|
+
const g = propStr('candidateGroups');
|
|
1242
1303
|
if (g && this.orgProv) {
|
|
1243
1304
|
for (const rc of String(g).split(',')) {
|
|
1244
1305
|
const role = rc.trim();
|