@mldong/jeeflow 1.8.3 → 1.8.5
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/README.md +23 -1
- package/dist/engine.d.ts +15 -10
- package/dist/engine.js +44 -6
- package/dist/extensions.d.ts +4 -2
- package/dist/facade.d.ts +15 -0
- package/dist/facade.js +127 -16
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/jdbc/ext.d.ts +5 -5
- package/dist/jdbc/ext.js +9 -9
- package/dist/jdbc/shared.d.ts +19 -15
- package/dist/jdbc/shared.js +38 -30
- package/dist/memory-ext.d.ts +5 -5
- package/dist/memory-ext.js +3 -3
- package/dist/memory.d.ts +13 -13
- package/dist/memory.js +6 -5
- package/dist/model.d.ts +23 -23
- package/dist/persist.d.ts +1 -1
- package/dist/spi.d.ts +19 -19
- package/package.json +48 -47
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ const repo = new MemoryRepository()
|
|
|
18
18
|
const engine = new EngineImpl(repo)
|
|
19
19
|
|
|
20
20
|
const def = {
|
|
21
|
-
id: 1, name: 'leave', displayName: '请假审批',
|
|
21
|
+
id: '1', name: 'leave', displayName: '请假审批',
|
|
22
22
|
content: JSON.stringify({ nodes: [...], edges: [...] })
|
|
23
23
|
}
|
|
24
24
|
repo.addDefine(def)
|
|
@@ -28,6 +28,28 @@ const tasks = await repo.findDoingTasks(inst.id)
|
|
|
28
28
|
await engine.executeProcessTask(tasks[0].id, 'leader')
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
> ⚠️ **id 全程 string(issue 38 E9)**:引擎内部与 API 契约的 id(流程定义/实例/任务/设计)一律为**字符串**。
|
|
32
|
+
> Java 雪花 id(>2^53)超出 JS 安全整数,`Number()` 转换必丢精度;字符串可无损承载,保证四语言同库共享流程。
|
|
33
|
+
|
|
34
|
+
## JDBC(MySQL/PostgreSQL)
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import mysql from 'mysql2/promise'
|
|
38
|
+
import { JdbcRepository, TsIDGenerator, MysqlAdapter } from '@mldong/jeeflow/jdbc'
|
|
39
|
+
|
|
40
|
+
// ⚠️ 必须配置 bigNumberStrings(issue 38 E9):BIGINT 列以 string 返回,
|
|
41
|
+
// 否则 mysql2 默认转 number,Java 雪花 id(>2^53)在驱动层就已丢精度
|
|
42
|
+
const pool = mysql.createPool({
|
|
43
|
+
host: 'localhost', user: 'root', password: '***', database: 'wf',
|
|
44
|
+
supportBigNumbers: true,
|
|
45
|
+
bigNumberStrings: true,
|
|
46
|
+
})
|
|
47
|
+
const repo = new JdbcRepository(new MysqlAdapter(pool), new TsIDGenerator())
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- MySQL 连接池必须带 `supportBigNumbers: true, bigNumberStrings: true`;PostgreSQL 的 int8 默认即字符串,无此要求
|
|
51
|
+
- 引擎侧已做驱动兜底:`rowId()` 把驱动返回的 number/string 统一归一化为 string,未开 `bigNumberStrings` 时小 id(Node 自建)仍可用
|
|
52
|
+
|
|
31
53
|
## 运行演示
|
|
32
54
|
|
|
33
55
|
```bash
|
package/dist/engine.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export declare const KeyProcessStartNextNodeOperator = "f_nextNodeOperator";
|
|
|
15
15
|
export declare const KeyAutoExecute = "flow.auto";
|
|
16
16
|
export declare const KeyAdminID = "flow.admin";
|
|
17
17
|
export interface Engine {
|
|
18
|
-
startProcessInstanceById(defineId:
|
|
19
|
-
executeProcessTask(taskId:
|
|
20
|
-
executeAndJumpToEnd(taskId:
|
|
21
|
-
executeAndJumpTask(taskId:
|
|
22
|
-
executeAndJumpToFirstTaskNode(taskId:
|
|
18
|
+
startProcessInstanceById(defineId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
19
|
+
executeProcessTask(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
20
|
+
executeAndJumpToEnd(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
21
|
+
executeAndJumpTask(taskId: string, operator: string, args: Record<string, any>, targetTaskName?: string): Promise<ProcessInstance>;
|
|
22
|
+
executeAndJumpToFirstTaskNode(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
23
23
|
}
|
|
24
24
|
export declare class EngineImpl implements Engine {
|
|
25
25
|
private repo;
|
|
@@ -31,16 +31,21 @@ export declare class EngineImpl implements Engine {
|
|
|
31
31
|
constructor(repo: ProcessRepository, userProv?: UserProvider | undefined, idGen?: IDGenerator | undefined, exprEval?: ExpressionEvaluator | undefined);
|
|
32
32
|
setExtensions(ext: EngineExtensions): void;
|
|
33
33
|
setRegistry(reg: HandlerRegistry): void;
|
|
34
|
+
private interceptorCache;
|
|
35
|
+
/** 定义级拦截器解析(issue 34,对齐 Java 模型级 postInterceptors):
|
|
36
|
+
* 流程定义顶层 postInterceptors 声明 → 按名从 interceptorRegistry 取(未声明该流程不触发);
|
|
37
|
+
* 未声明 → 回落引擎级列表(向后兼容)。结果按 defineId 缓存。 */
|
|
38
|
+
private resolveInterceptors;
|
|
34
39
|
private firePre;
|
|
35
40
|
/** 表达式求值(v1.5.0,门面 highLight 决策分支过滤用) */
|
|
36
41
|
evalExpr(expr: string, vars: Record<string, any>): Promise<any>;
|
|
37
42
|
private firePost;
|
|
38
43
|
private fireEvent;
|
|
39
|
-
startProcessInstanceById(defineId:
|
|
40
|
-
executeProcessTask(taskId:
|
|
41
|
-
executeAndJumpToEnd(taskId:
|
|
42
|
-
executeAndJumpTask(taskId:
|
|
43
|
-
executeAndJumpToFirstTaskNode(taskId:
|
|
44
|
+
startProcessInstanceById(defineId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
45
|
+
executeProcessTask(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
46
|
+
executeAndJumpToEnd(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
47
|
+
executeAndJumpTask(taskId: string, operator: string, args?: Record<string, any>, targetTaskName?: string): Promise<ProcessInstance>;
|
|
48
|
+
executeAndJumpToFirstTaskNode(taskId: string, operator: string, args?: Record<string, any>): Promise<ProcessInstance>;
|
|
44
49
|
private loadAndCheck;
|
|
45
50
|
private executeNode;
|
|
46
51
|
private evaluateDecision;
|
package/dist/engine.js
CHANGED
|
@@ -28,12 +28,50 @@ export class EngineImpl {
|
|
|
28
28
|
this.idGen = idGen;
|
|
29
29
|
this.exprEval = exprEval;
|
|
30
30
|
}
|
|
31
|
-
setExtensions(ext) {
|
|
31
|
+
setExtensions(ext) {
|
|
32
|
+
this.ext = ext;
|
|
33
|
+
this.interceptorCache = new Map();
|
|
34
|
+
}
|
|
32
35
|
setRegistry(reg) { this.registry = reg; }
|
|
36
|
+
interceptorCache = new Map();
|
|
37
|
+
/** 定义级拦截器解析(issue 34,对齐 Java 模型级 postInterceptors):
|
|
38
|
+
* 流程定义顶层 postInterceptors 声明 → 按名从 interceptorRegistry 取(未声明该流程不触发);
|
|
39
|
+
* 未声明 → 回落引擎级列表(向后兼容)。结果按 defineId 缓存。 */
|
|
40
|
+
async resolveInterceptors(inst) {
|
|
41
|
+
if (!this.ext)
|
|
42
|
+
return [];
|
|
43
|
+
const defineId = inst.defineId;
|
|
44
|
+
if (defineId == null)
|
|
45
|
+
return this.ext.interceptors ?? [];
|
|
46
|
+
const cached = this.interceptorCache.get(defineId);
|
|
47
|
+
if (cached)
|
|
48
|
+
return cached;
|
|
49
|
+
let list = this.ext.interceptors ?? [];
|
|
50
|
+
try {
|
|
51
|
+
const def = await this.repo.findDefineById(defineId);
|
|
52
|
+
if (def) {
|
|
53
|
+
const content = typeof def.content === 'string' ? def.content : new TextDecoder().decode(def.content);
|
|
54
|
+
const meta = JSON.parse(content);
|
|
55
|
+
const declared = String(meta.postInterceptors ?? '').trim();
|
|
56
|
+
if (declared) {
|
|
57
|
+
list = [];
|
|
58
|
+
for (const name of declared.split(',').map(n => n.trim())) {
|
|
59
|
+
const ic = this.ext.interceptorRegistry?.[name];
|
|
60
|
+
if (name && ic)
|
|
61
|
+
list.push(ic);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { /* 解析失败回落引擎级 */ }
|
|
67
|
+
this.interceptorCache.set(defineId, list);
|
|
68
|
+
return list;
|
|
69
|
+
}
|
|
33
70
|
async firePre(node, inst) {
|
|
34
|
-
if (!this.ext?.interceptors)
|
|
71
|
+
if (!this.ext?.interceptors && !this.ext?.interceptorRegistry)
|
|
35
72
|
return true;
|
|
36
|
-
|
|
73
|
+
const list = await this.resolveInterceptors(inst);
|
|
74
|
+
for (const ic of [...list].sort((a, b) => a.order - b.order))
|
|
37
75
|
if (!(await ic.preHandle(node, inst)))
|
|
38
76
|
return false;
|
|
39
77
|
return true;
|
|
@@ -45,9 +83,9 @@ export class EngineImpl {
|
|
|
45
83
|
return this.exprEval.eval(expr, vars);
|
|
46
84
|
}
|
|
47
85
|
async firePost(node, inst) {
|
|
48
|
-
if (!this.ext?.interceptors)
|
|
86
|
+
if (!this.ext?.interceptors && !this.ext?.interceptorRegistry)
|
|
49
87
|
return;
|
|
50
|
-
for (const ic of this.
|
|
88
|
+
for (const ic of await this.resolveInterceptors(inst))
|
|
51
89
|
await ic.postHandle(node, inst);
|
|
52
90
|
}
|
|
53
91
|
async fireEvent(evt) {
|
|
@@ -435,7 +473,7 @@ export class EngineImpl {
|
|
|
435
473
|
nextId() {
|
|
436
474
|
if (this.idGen)
|
|
437
475
|
return this.idGen.nextId();
|
|
438
|
-
return Date.now() * 1000 + Math.floor(Math.random() * 1000);
|
|
476
|
+
return String(Date.now() * 1000 + Math.floor(Math.random() * 1000));
|
|
439
477
|
}
|
|
440
478
|
}
|
|
441
479
|
// ─── Pure Functions ──────────────────────────────────────────────────────────
|
package/dist/extensions.d.ts
CHANGED
|
@@ -26,14 +26,16 @@ export declare enum EventType {
|
|
|
26
26
|
}
|
|
27
27
|
export interface ProcessEvent {
|
|
28
28
|
type: EventType;
|
|
29
|
-
instanceId:
|
|
30
|
-
taskId?:
|
|
29
|
+
instanceId: string;
|
|
30
|
+
taskId?: string;
|
|
31
31
|
nodeId?: string;
|
|
32
32
|
operator: string;
|
|
33
33
|
}
|
|
34
34
|
export type ProcessEventListener = (event: ProcessEvent) => void | Promise<void>;
|
|
35
35
|
export interface EngineExtensions {
|
|
36
36
|
interceptors?: FlowInterceptor[];
|
|
37
|
+
/** 定义级拦截器注册表(issue 34):名字 → 实例;流程定义顶层 postInterceptors 按名解析 */
|
|
38
|
+
interceptorRegistry?: Record<string, FlowInterceptor>;
|
|
37
39
|
assignmentHandler?: AssignmentHandler;
|
|
38
40
|
decisionHandler?: DecisionHandler;
|
|
39
41
|
listeners?: ProcessEventListener[];
|
package/dist/facade.d.ts
CHANGED
|
@@ -7,7 +7,12 @@ export declare class JeeflowFacade {
|
|
|
7
7
|
private readonly extRepo?;
|
|
8
8
|
private userSearch?;
|
|
9
9
|
private orgProv?;
|
|
10
|
+
private metaReader?;
|
|
10
11
|
constructor(engine: EngineImpl, repo: ProcessRepository, extRepo?: ProcessExtRepository | undefined);
|
|
12
|
+
/** 注入业务数据读取器(issue 30):需有 readByProcessInstance(tableName, processInstanceId) */
|
|
13
|
+
setMetaReader(reader: {
|
|
14
|
+
readByProcessInstance(tableName: string, processInstanceId: unknown): unknown;
|
|
15
|
+
}): this;
|
|
11
16
|
setUserSearch(fn: UserSearch): this;
|
|
12
17
|
setOrgProvider(orgProv: OrgUserProvider): this;
|
|
13
18
|
flow(action: string, args?: Record<string, any>): Promise<Record<string, any>>;
|
|
@@ -23,6 +28,16 @@ export declare class JeeflowFacade {
|
|
|
23
28
|
private designUpdate;
|
|
24
29
|
/** 更新流程设计定义(设计稿保存,issues/08):content 快照入库 + 同步基本信息 + 置未部署 */
|
|
25
30
|
private designUpdateDefine;
|
|
31
|
+
/** 删除设计稿(issues/28:兼容 {ids} 批量与单 {id}) */
|
|
32
|
+
private designRemove;
|
|
33
|
+
/** 删除定义(issues/28:兼容 {ids} 批量与单 {id}) */
|
|
34
|
+
private defineRemove;
|
|
35
|
+
/** 启用/停用(issues/28:兼容 {ids, opType} 批量;opType/state 二选一) */
|
|
36
|
+
private defineUpAndDown;
|
|
37
|
+
/** 按类型分组列出流程设计(issue 30,对齐 Java issues/28):不依赖框架字典 */
|
|
38
|
+
private designListByType;
|
|
39
|
+
/** 按流程实例回显业务数据(issue 30,对齐 Java issues/28):metaReader 注入式,未注入清晰报错 */
|
|
40
|
+
private bizData;
|
|
26
41
|
/** 重新部署流程定义(issues/08):替换最新定义内容 + 置已部署(对齐 boot3 redeploy) */
|
|
27
42
|
private designRedeploy;
|
|
28
43
|
private designDetail;
|
package/dist/facade.js
CHANGED
|
@@ -19,11 +19,17 @@ export class JeeflowFacade {
|
|
|
19
19
|
extRepo;
|
|
20
20
|
userSearch;
|
|
21
21
|
orgProv;
|
|
22
|
+
metaReader;
|
|
22
23
|
constructor(engine, repo, extRepo) {
|
|
23
24
|
this.engine = engine;
|
|
24
25
|
this.repo = repo;
|
|
25
26
|
this.extRepo = extRepo;
|
|
26
27
|
}
|
|
28
|
+
/** 注入业务数据读取器(issue 30):需有 readByProcessInstance(tableName, processInstanceId) */
|
|
29
|
+
setMetaReader(reader) {
|
|
30
|
+
this.metaReader = reader;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
27
33
|
// 注入用户搜索钩子(candidatePage 无模型候选时的用户分页搜索)
|
|
28
34
|
setUserSearch(fn) {
|
|
29
35
|
this.userSearch = fn;
|
|
@@ -60,9 +66,9 @@ export class JeeflowFacade {
|
|
|
60
66
|
case 'processDefine/redeploy':
|
|
61
67
|
return this.redeploy(args);
|
|
62
68
|
case 'processDefine/remove':
|
|
63
|
-
return this.
|
|
69
|
+
return this.defineRemove(args);
|
|
64
70
|
case 'processDefine/upAndDown':
|
|
65
|
-
return this.
|
|
71
|
+
return this.defineUpAndDown(args);
|
|
66
72
|
case 'processInstance/page':
|
|
67
73
|
return this.instancePage(args);
|
|
68
74
|
case 'processInstance/detail':
|
|
@@ -86,7 +92,11 @@ export class JeeflowFacade {
|
|
|
86
92
|
case 'processDesign/updateDefine':
|
|
87
93
|
return this.designUpdateDefine(args);
|
|
88
94
|
case 'processDesign/remove':
|
|
89
|
-
return this.
|
|
95
|
+
return this.designRemove(args);
|
|
96
|
+
case 'processDesign/listByType':
|
|
97
|
+
return this.designListByType(args);
|
|
98
|
+
case 'processInstance/bizData':
|
|
99
|
+
return this.bizData(args);
|
|
90
100
|
case 'processSurrogate/page':
|
|
91
101
|
return this.surrogatePage(args);
|
|
92
102
|
case 'processSurrogate/save':
|
|
@@ -187,7 +197,7 @@ export class JeeflowFacade {
|
|
|
187
197
|
version = (latest.version ?? 0) + 1;
|
|
188
198
|
const operator = String(args.operator ?? 'system');
|
|
189
199
|
const def = {
|
|
190
|
-
id:
|
|
200
|
+
id: '', name, displayName: flow.displayName ?? '', type: flow.type ?? 'approval',
|
|
191
201
|
state: 1, content, version, createTime: new Date(), createUser: operator,
|
|
192
202
|
updateTime: new Date(), updateUser: operator,
|
|
193
203
|
};
|
|
@@ -292,14 +302,24 @@ export class JeeflowFacade {
|
|
|
292
302
|
const design = await ext.findDesignById(designId);
|
|
293
303
|
if (!design)
|
|
294
304
|
throw new Error('流程设计不存在');
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
305
|
+
// issues/31:兼容 boot3 顶层 JSON(无 content 字段)——非保留字段序列化为内容快照
|
|
306
|
+
let content = args.content;
|
|
307
|
+
if (content == null) {
|
|
308
|
+
const copy = {};
|
|
309
|
+
for (const [k, v] of Object.entries(args)) {
|
|
310
|
+
if (k !== 'processDesignId' && k !== 'operator')
|
|
311
|
+
copy[k] = v;
|
|
312
|
+
}
|
|
313
|
+
if (Object.keys(copy).length === 0)
|
|
314
|
+
throw new Error('content 缺失');
|
|
315
|
+
content = JSON.stringify(copy);
|
|
316
|
+
}
|
|
317
|
+
content = toStr(content);
|
|
298
318
|
// 与最新一条相同则不重复入库(对齐 boot3 updateDefine)
|
|
299
319
|
const hisList = await ext.listDesignHis(designId);
|
|
300
320
|
if (hisList.length === 0 || toStr(hisList[0].content) !== content) {
|
|
301
321
|
await ext.saveDesignHis({
|
|
302
|
-
id:
|
|
322
|
+
id: '', processDesignId: designId, content,
|
|
303
323
|
createTime: new Date(), createUser: String(args.operator ?? 'system'),
|
|
304
324
|
});
|
|
305
325
|
}
|
|
@@ -319,6 +339,93 @@ export class JeeflowFacade {
|
|
|
319
339
|
await ext.updateDesign(design);
|
|
320
340
|
return {};
|
|
321
341
|
}
|
|
342
|
+
/** 删除设计稿(issues/28:兼容 {ids} 批量与单 {id}) */
|
|
343
|
+
async designRemove(args) {
|
|
344
|
+
const ext = this.ext();
|
|
345
|
+
if (Array.isArray(args.ids)) {
|
|
346
|
+
for (const id of args.ids)
|
|
347
|
+
await ext.removeDesign(toId(id));
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
await ext.removeDesign(toId(args.id));
|
|
351
|
+
}
|
|
352
|
+
return {};
|
|
353
|
+
}
|
|
354
|
+
/** 删除定义(issues/28:兼容 {ids} 批量与单 {id}) */
|
|
355
|
+
async defineRemove(args) {
|
|
356
|
+
if (Array.isArray(args.ids)) {
|
|
357
|
+
for (const id of args.ids)
|
|
358
|
+
await this.repo.removeDefine(toId(id));
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
await this.repo.removeDefine(toId(args.id));
|
|
362
|
+
}
|
|
363
|
+
return {};
|
|
364
|
+
}
|
|
365
|
+
/** 启用/停用(issues/28:兼容 {ids, opType} 批量;opType/state 二选一) */
|
|
366
|
+
async defineUpAndDown(args) {
|
|
367
|
+
const state = toInt(args.opType ?? args.state);
|
|
368
|
+
if (Array.isArray(args.ids)) {
|
|
369
|
+
for (const id of args.ids)
|
|
370
|
+
await this.repo.updateDefineState(toId(id), state);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
await this.repo.updateDefineState(toId(args.id), state);
|
|
374
|
+
}
|
|
375
|
+
return {};
|
|
376
|
+
}
|
|
377
|
+
/** 按类型分组列出流程设计(issue 30,对齐 Java issues/28):不依赖框架字典 */
|
|
378
|
+
async designListByType(args) {
|
|
379
|
+
const ext = this.ext();
|
|
380
|
+
const pageNum = args.pageNum != null ? toInt(args.pageNum) : 1;
|
|
381
|
+
const pageSize = args.pageSize != null ? toInt(args.pageSize) : 10000;
|
|
382
|
+
const [rows] = await ext.pageDesigns(pageNum, pageSize, []);
|
|
383
|
+
// 每 name 最新 define(version 最大)
|
|
384
|
+
const { rows: defRows } = await this.repo.pageDefines(1, 10000, []);
|
|
385
|
+
const latestByName = new Map();
|
|
386
|
+
for (const r of defRows) {
|
|
387
|
+
const prev = latestByName.get(r.name);
|
|
388
|
+
if (!prev || r.version > prev.version)
|
|
389
|
+
latestByName.set(r.name, r);
|
|
390
|
+
}
|
|
391
|
+
const groups = {};
|
|
392
|
+
for (const d of rows) {
|
|
393
|
+
const key = d.type || '';
|
|
394
|
+
(groups[key] ??= []).push({
|
|
395
|
+
processDesignId: d.id,
|
|
396
|
+
name: d.name,
|
|
397
|
+
displayName: d.displayName,
|
|
398
|
+
icon: d.icon,
|
|
399
|
+
remark: d.remark,
|
|
400
|
+
processDefineId: latestByName.get(d.name)?.id ?? null,
|
|
401
|
+
processDefineState: latestByName.get(d.name)?.state ?? null,
|
|
402
|
+
jsonObject: this.parseGraph((await ext.listDesignHis(d.id))[0]?.content ?? ''),
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
return groups;
|
|
406
|
+
}
|
|
407
|
+
/** 按流程实例回显业务数据(issue 30,对齐 Java issues/28):metaReader 注入式,未注入清晰报错 */
|
|
408
|
+
async bizData(args) {
|
|
409
|
+
const instanceId = toId(args.processInstanceId ?? args.id);
|
|
410
|
+
const inst = await this.repo.findInstanceById(instanceId);
|
|
411
|
+
if (!inst)
|
|
412
|
+
throw new Error('流程实例不存在');
|
|
413
|
+
const def = await this.repo.findDefineById(inst.defineId);
|
|
414
|
+
if (!def)
|
|
415
|
+
throw new Error('流程定义不存在');
|
|
416
|
+
const content = typeof def.content === 'string' ? def.content : new TextDecoder().decode(def.content);
|
|
417
|
+
let tableName = null;
|
|
418
|
+
try {
|
|
419
|
+
const meta = JSON.parse(content);
|
|
420
|
+
tableName = String(meta.relTableName ?? '').trim() || String(meta.name ?? '').trim() || null;
|
|
421
|
+
}
|
|
422
|
+
catch { /* ignore */ }
|
|
423
|
+
if (!tableName)
|
|
424
|
+
throw new Error('流程定义未配置 relTableName');
|
|
425
|
+
if (!this.metaReader)
|
|
426
|
+
throw new Error('业务数据读取器未注册(facade.setMetaReader(MetaTableReader(...)),需引入 jeeflow.meta)');
|
|
427
|
+
return this.metaReader.readByProcessInstance(tableName, instanceId);
|
|
428
|
+
}
|
|
322
429
|
/** 重新部署流程定义(issues/08):替换最新定义内容 + 置已部署(对齐 boot3 redeploy) */
|
|
323
430
|
async designRedeploy(args) {
|
|
324
431
|
const ext = this.ext();
|
|
@@ -394,11 +501,11 @@ export class JeeflowFacade {
|
|
|
394
501
|
async designSave(args) {
|
|
395
502
|
const ext = this.ext();
|
|
396
503
|
const operator = String(args.operator ?? 'user1');
|
|
397
|
-
const designId = args.id != null ? toId(args.id) :
|
|
504
|
+
const designId = args.id != null ? toId(args.id) : '';
|
|
398
505
|
let design;
|
|
399
506
|
if (!designId) {
|
|
400
507
|
design = {
|
|
401
|
-
id:
|
|
508
|
+
id: '', name: String(args.name ?? ''), displayName: String(args.displayName ?? ''),
|
|
402
509
|
type: String(args.type ?? 'approval'), icon: String(args.icon ?? ''),
|
|
403
510
|
isDeployed: 0, remark: String(args.remark ?? ''),
|
|
404
511
|
createTime: new Date(), createUser: operator,
|
|
@@ -428,7 +535,7 @@ export class JeeflowFacade {
|
|
|
428
535
|
// 内容快照(设计稿内容存历史表)
|
|
429
536
|
if (args.content != null) {
|
|
430
537
|
await ext.saveDesignHis({
|
|
431
|
-
id:
|
|
538
|
+
id: '', processDesignId: design.id, content: String(args.content),
|
|
432
539
|
createTime: new Date(), createUser: operator,
|
|
433
540
|
});
|
|
434
541
|
}
|
|
@@ -443,11 +550,11 @@ export class JeeflowFacade {
|
|
|
443
550
|
async surrogateSave(args) {
|
|
444
551
|
const ext = this.ext();
|
|
445
552
|
const operator = String(args.operator ?? 'user1');
|
|
446
|
-
const surrogateId = args.id != null ? toId(args.id) :
|
|
553
|
+
const surrogateId = args.id != null ? toId(args.id) : '';
|
|
447
554
|
let surrogate;
|
|
448
555
|
if (!surrogateId) {
|
|
449
556
|
surrogate = {
|
|
450
|
-
id:
|
|
557
|
+
id: '', operator, // 授权人 = 操作人
|
|
451
558
|
surrogate: String(args.surrogate ?? ''), processName: String(args.processName ?? ''),
|
|
452
559
|
enabled: toInt(args.enabled ?? 1),
|
|
453
560
|
createTime: new Date(), createUser: operator,
|
|
@@ -972,10 +1079,14 @@ function toStr(v) {
|
|
|
972
1079
|
return String(v);
|
|
973
1080
|
}
|
|
974
1081
|
function toId(v) {
|
|
975
|
-
|
|
976
|
-
|
|
1082
|
+
// issue 38 E9:id 全程 string 承载——Java 雪花 id(>2^53)经 Number() 必丢精度。
|
|
1083
|
+
// 数字输入(JS 安全整数内)转字符串;字符串输入原样保留(含超长雪花 id)。
|
|
1084
|
+
if (v == null)
|
|
977
1085
|
throw new Error('id 缺失或非法');
|
|
978
|
-
|
|
1086
|
+
const s = String(v).trim();
|
|
1087
|
+
if (!/^\d+$/.test(s) || s === '0')
|
|
1088
|
+
throw new Error('id 缺失或非法');
|
|
1089
|
+
return s;
|
|
979
1090
|
}
|
|
980
1091
|
function toStringList2(v) {
|
|
981
1092
|
if (Array.isArray(v))
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,6 @@ export * from './model.js';
|
|
|
6
6
|
export type { ProcessRepository, UserProvider, OrgUserProvider, IDGenerator, ExpressionEvaluator } from './spi.js';
|
|
7
7
|
export { SqliteDynamicTableWriter, PersistPostInterceptor, type DynamicTableWriter, type DefineLoader, } from './persist.js';
|
|
8
8
|
export { registerBuiltinAssignments, OperatorAssignmentHandler, FormFieldAssigneeHandler, DeptLeaderAssignmentHandler, DeptMainLeaderAssignmentHandler, ApplicantDeptLeaderAssignmentHandler, ApplicantDeptMainLeaderAssignmentHandler, TaskRoleAssigneeHandler, HANDLER_OPERATOR_ASSIGNMENT, HANDLER_FORM_FIELD_ASSIGNEE, HANDLER_DEPT_LEADER, HANDLER_DEPT_MAIN_LEADER, HANDLER_APPLICANT_DEPT_LEADER, HANDLER_APPLICANT_DEPT_MAIN_LEADER, HANDLER_TASK_ROLE_ASSIGNEE, } from './builtin.js';
|
|
9
|
+
export { JeeflowFacade } from './facade.js';
|
|
10
|
+
export type { EngineExtensions, FlowInterceptor, ProcessEventListener, ProcessEvent, AssignmentHandler, DecisionHandler } from './extensions.js';
|
|
11
|
+
export { JdbcProcessExtRepository } from './jdbc/ext.js';
|
package/dist/index.js
CHANGED
|
@@ -5,3 +5,6 @@ export { enumDict, enumDictKeys } from './metadata.js';
|
|
|
5
5
|
export * from './model.js';
|
|
6
6
|
export { SqliteDynamicTableWriter, PersistPostInterceptor, } from './persist.js';
|
|
7
7
|
export { registerBuiltinAssignments, OperatorAssignmentHandler, FormFieldAssigneeHandler, DeptLeaderAssignmentHandler, DeptMainLeaderAssignmentHandler, ApplicantDeptLeaderAssignmentHandler, ApplicantDeptMainLeaderAssignmentHandler, TaskRoleAssigneeHandler, HANDLER_OPERATOR_ASSIGNMENT, HANDLER_FORM_FIELD_ASSIGNEE, HANDLER_DEPT_LEADER, HANDLER_DEPT_MAIN_LEADER, HANDLER_APPLICANT_DEPT_LEADER, HANDLER_APPLICANT_DEPT_MAIN_LEADER, HANDLER_TASK_ROLE_ASSIGNEE, } from './builtin.js';
|
|
8
|
+
// issues/35:包导出面补齐——门面/扩展类型/扩展仓储(集成方组装完整引擎链)
|
|
9
|
+
export { JeeflowFacade } from './facade.js';
|
|
10
|
+
export { JdbcProcessExtRepository } from './jdbc/ext.js';
|
package/dist/jdbc/ext.d.ts
CHANGED
|
@@ -9,21 +9,21 @@ export declare class JdbcProcessExtRepository implements ProcessExtRepository {
|
|
|
9
9
|
private c;
|
|
10
10
|
private done;
|
|
11
11
|
private static DESIGN_COLS;
|
|
12
|
-
findDesignById(id:
|
|
12
|
+
findDesignById(id: string): Promise<ProcessDesign | null>;
|
|
13
13
|
saveDesign(d: ProcessDesign): Promise<void>;
|
|
14
14
|
updateDesign(d: ProcessDesign): Promise<void>;
|
|
15
|
-
removeDesign(id:
|
|
15
|
+
removeDesign(id: string): Promise<void>;
|
|
16
16
|
pageDesigns(pageNum?: number, pageSize?: number, filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessDesign[], number]>;
|
|
17
17
|
private buildExtWhere;
|
|
18
18
|
private static readonly DESIGN_WHITELIST;
|
|
19
19
|
private static readonly SURROGATE_WHITELIST;
|
|
20
20
|
saveDesignHis(his: ProcessDesignHis): Promise<void>;
|
|
21
|
-
listDesignHis(designId:
|
|
21
|
+
listDesignHis(designId: string): Promise<ProcessDesignHis[]>;
|
|
22
22
|
private static SURROGATE_COLS;
|
|
23
|
-
findSurrogateById(id:
|
|
23
|
+
findSurrogateById(id: string): Promise<ProcessSurrogate | null>;
|
|
24
24
|
saveSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
25
25
|
updateSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
26
|
-
removeSurrogate(id:
|
|
26
|
+
removeSurrogate(id: string): Promise<void>;
|
|
27
27
|
pageSurrogates(pageNum?: number, pageSize?: number, filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessSurrogate[], number]>;
|
|
28
28
|
getSurrogate(operator: string, processName: string, at?: Date): Promise<ProcessSurrogate | null>;
|
|
29
29
|
private querySurrogate;
|
package/dist/jdbc/ext.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// 与 shared.ts 同一套 SqlAdapter / 占位符约定;分页为单表简单过滤(filters 字段名 EQ)。
|
|
4
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
5
|
-
import { TsIDGenerator } from './shared.js';
|
|
5
|
+
import { TsIDGenerator, rowId } from './shared.js';
|
|
6
6
|
const txStore = new AsyncLocalStorage();
|
|
7
7
|
export class JdbcProcessExtRepository {
|
|
8
8
|
adapter;
|
|
@@ -174,9 +174,9 @@ export class JdbcProcessExtRepository {
|
|
|
174
174
|
try {
|
|
175
175
|
const rows = await conn.fetchAll(this.sql('SELECT id, process_design_id, content, create_time, create_user FROM wf_process_design_his WHERE process_design_id = ? ORDER BY id DESC'), [designId]);
|
|
176
176
|
return rows.map(r => ({
|
|
177
|
-
id: r.id, processDesignId: r.process_design_id,
|
|
177
|
+
id: rowId(r.id), processDesignId: rowId(r.process_design_id),
|
|
178
178
|
content: r.content ? Buffer.from(r.content).toString('utf8') : '',
|
|
179
|
-
createTime: r.create_time, createUser: r.create_user,
|
|
179
|
+
createTime: r.create_time, createUser: rowId(r.create_user),
|
|
180
180
|
}));
|
|
181
181
|
}
|
|
182
182
|
finally {
|
|
@@ -300,18 +300,18 @@ export class JdbcProcessExtRepository {
|
|
|
300
300
|
// ── 行映射 ───────────────────────────────────────────────────────────────
|
|
301
301
|
mapDesign(row) {
|
|
302
302
|
return {
|
|
303
|
-
id: row.id, name: row.name, displayName: row.display_name, type: row.type,
|
|
303
|
+
id: rowId(row.id), name: row.name, displayName: row.display_name, type: row.type,
|
|
304
304
|
icon: row.icon, isDeployed: row.is_deployed, remark: row.remark,
|
|
305
|
-
createTime: row.create_time, createUser: row.create_user,
|
|
306
|
-
updateTime: row.update_time, updateUser: row.update_user,
|
|
305
|
+
createTime: row.create_time, createUser: rowId(row.create_user),
|
|
306
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
mapSurrogate(row) {
|
|
310
310
|
return {
|
|
311
|
-
id: row.id, processName: row.process_name, operator: row.operator, surrogate: row.surrogate,
|
|
311
|
+
id: rowId(row.id), processName: row.process_name, operator: row.operator, surrogate: row.surrogate,
|
|
312
312
|
startTime: row.start_time, endTime: row.end_time, enabled: row.enabled,
|
|
313
|
-
createTime: row.create_time, createUser: row.create_user,
|
|
314
|
-
updateTime: row.update_time, updateUser: row.update_user,
|
|
313
|
+
createTime: row.create_time, createUser: rowId(row.create_user),
|
|
314
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
}
|
package/dist/jdbc/shared.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ProcessInstance, ProcessTask, type ProcessDefine, type CcInstanceRow, type DefineRow, type InstanceRow, type TaskRow } from '../model.js';
|
|
2
2
|
import type { IDGenerator, ProcessRepository, QueryCondition } from '../spi.js';
|
|
3
|
-
/** 默认 ID 生成器:时间戳毫秒 + 同毫秒递增序号(对齐 Java nextId
|
|
3
|
+
/** 默认 ID 生成器:时间戳毫秒 + 同毫秒递增序号(对齐 Java nextId 默认实现)——
|
|
4
|
+
* issue 38 E9:返回 string(数字值在 2^53 内精确,转字符串统一承载) */
|
|
4
5
|
export declare class TsIDGenerator implements IDGenerator {
|
|
5
6
|
private last;
|
|
6
7
|
private seq;
|
|
7
|
-
nextId():
|
|
8
|
+
nextId(): string;
|
|
8
9
|
}
|
|
10
|
+
/** 行 id 归一化(issue 38 E9):mysql2 可能返回 number(默认)或 string(bigNumberStrings),
|
|
11
|
+
* 统一转 string,保证引擎内部 id 全字符串、跨驱动一致 */
|
|
12
|
+
export declare function rowId(v: any): string;
|
|
9
13
|
/** 适配器返回的连接包装——最小接口 */
|
|
10
14
|
export interface SqlConnection {
|
|
11
15
|
execute(sql: string, args: any[]): Promise<void>;
|
|
@@ -35,34 +39,34 @@ export declare class JdbcRepository implements ProcessRepository {
|
|
|
35
39
|
private c;
|
|
36
40
|
/** 归还非事务连接(事务连接由 withTx 统一释放) */
|
|
37
41
|
private done;
|
|
38
|
-
findDefineById(id:
|
|
42
|
+
findDefineById(id: string): Promise<ProcessDefine | null>;
|
|
39
43
|
saveDefine(define: ProcessDefine): Promise<void>;
|
|
40
44
|
updateDefine(define: ProcessDefine): Promise<void>;
|
|
41
|
-
updateDefineState(defineId:
|
|
42
|
-
removeDefine(defineId:
|
|
45
|
+
updateDefineState(defineId: string, state: number): Promise<void>;
|
|
46
|
+
removeDefine(defineId: string): Promise<void>;
|
|
43
47
|
findDefineByName(name: string): Promise<ProcessDefine | null>;
|
|
44
48
|
private static INSTANCE_COLS;
|
|
45
|
-
findInstanceById(id:
|
|
49
|
+
findInstanceById(id: string): Promise<ProcessInstance | null>;
|
|
46
50
|
saveInstance(inst: ProcessInstance): Promise<void>;
|
|
47
51
|
updateInstance(inst: ProcessInstance): Promise<void>;
|
|
48
52
|
private static TASK_COLS;
|
|
49
|
-
findTaskById(taskId:
|
|
53
|
+
findTaskById(taskId: string): Promise<ProcessTask | null>;
|
|
50
54
|
saveTask(task: ProcessTask): Promise<void>;
|
|
51
55
|
updateTask(task: ProcessTask): Promise<void>;
|
|
52
56
|
/** 用指定连接更新任务(实例级联时与实例更新同连接) */
|
|
53
57
|
private updateTaskWithConn;
|
|
54
58
|
private findTasksByState;
|
|
55
|
-
findDoingTasks(instanceId:
|
|
56
|
-
findDoneTasks(instanceId:
|
|
57
|
-
findHistoryTasks(instanceId:
|
|
59
|
+
findDoingTasks(instanceId: string, taskNames?: string[]): Promise<ProcessTask[]>;
|
|
60
|
+
findDoneTasks(instanceId: string, taskNames?: string[]): Promise<ProcessTask[]>;
|
|
61
|
+
findHistoryTasks(instanceId: string): Promise<ProcessTask[]>;
|
|
58
62
|
private mapTask;
|
|
59
63
|
private replaceTaskActors;
|
|
60
64
|
private insertTaskActors;
|
|
61
|
-
findTaskActors(taskId:
|
|
62
|
-
addTaskActor(taskId:
|
|
63
|
-
removeTaskActor(taskId:
|
|
64
|
-
createCcInstance(instanceId:
|
|
65
|
-
updateCcStatus(instanceId:
|
|
65
|
+
findTaskActors(taskId: string): Promise<string[]>;
|
|
66
|
+
addTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
67
|
+
removeTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
68
|
+
createCcInstance(instanceId: string, creator: string, ...actorIds: string[]): Promise<void>;
|
|
69
|
+
updateCcStatus(instanceId: string, actorId: string): Promise<void>;
|
|
66
70
|
pageDefines(pageNum: number, pageSize: number, conditions?: QueryCondition[]): Promise<{
|
|
67
71
|
rows: DefineRow[];
|
|
68
72
|
total: number;
|
package/dist/jdbc/shared.js
CHANGED
|
@@ -37,7 +37,8 @@ const DEFINE_WHITELIST = new Set([
|
|
|
37
37
|
]);
|
|
38
38
|
// 当前异步上下文绑定的事务连接
|
|
39
39
|
const txStore = new AsyncLocalStorage();
|
|
40
|
-
/** 默认 ID 生成器:时间戳毫秒 + 同毫秒递增序号(对齐 Java nextId
|
|
40
|
+
/** 默认 ID 生成器:时间戳毫秒 + 同毫秒递增序号(对齐 Java nextId 默认实现)——
|
|
41
|
+
* issue 38 E9:返回 string(数字值在 2^53 内精确,转字符串统一承载) */
|
|
41
42
|
export class TsIDGenerator {
|
|
42
43
|
last = 0;
|
|
43
44
|
seq = 0;
|
|
@@ -50,9 +51,14 @@ export class TsIDGenerator {
|
|
|
50
51
|
this.last = now;
|
|
51
52
|
this.seq = 0;
|
|
52
53
|
}
|
|
53
|
-
return now * 1000 + this.seq;
|
|
54
|
+
return String(now * 1000 + this.seq);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
57
|
+
/** 行 id 归一化(issue 38 E9):mysql2 可能返回 number(默认)或 string(bigNumberStrings),
|
|
58
|
+
* 统一转 string,保证引擎内部 id 全字符串、跨驱动一致 */
|
|
59
|
+
export function rowId(v) {
|
|
60
|
+
return v == null ? '' : String(v);
|
|
61
|
+
}
|
|
56
62
|
/** 把核心 SQL 的统一 `?` 占位符转换为适配器风格 */
|
|
57
63
|
export function convertPlaceholder(sql, style) {
|
|
58
64
|
if (style === '$n') {
|
|
@@ -115,8 +121,8 @@ export class JdbcRepository {
|
|
|
115
121
|
id: row.id, name: row.name, displayName: row.display_name, type: row.type,
|
|
116
122
|
state: row.state,
|
|
117
123
|
content: row.content ? Buffer.from(row.content).toString('utf8') : '',
|
|
118
|
-
version: row.version, createTime: row.create_time, createUser: row.create_user,
|
|
119
|
-
updateTime: row.update_time, updateUser: row.update_user,
|
|
124
|
+
version: row.version, createTime: row.create_time, createUser: rowId(row.create_user),
|
|
125
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
120
126
|
};
|
|
121
127
|
}
|
|
122
128
|
finally {
|
|
@@ -180,11 +186,11 @@ export class JdbcRepository {
|
|
|
180
186
|
if (!row)
|
|
181
187
|
return null;
|
|
182
188
|
return {
|
|
183
|
-
id: row.id, name: row.name, displayName: row.display_name, type: row.type,
|
|
189
|
+
id: rowId(row.id), name: row.name, displayName: row.display_name, type: row.type,
|
|
184
190
|
state: row.state,
|
|
185
191
|
content: row.content ? Buffer.from(row.content).toString('utf8') : '',
|
|
186
|
-
version: row.version, createTime: row.create_time, createUser: row.create_user,
|
|
187
|
-
updateTime: row.update_time, updateUser: row.update_user,
|
|
192
|
+
version: row.version, createTime: row.create_time, createUser: rowId(row.create_user),
|
|
193
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
188
194
|
};
|
|
189
195
|
}
|
|
190
196
|
finally {
|
|
@@ -201,11 +207,12 @@ export class JdbcRepository {
|
|
|
201
207
|
if (!row)
|
|
202
208
|
return null;
|
|
203
209
|
const inst = new ProcessInstance({
|
|
204
|
-
id: row.id, parentId: row.parent_id
|
|
210
|
+
id: rowId(row.id), parentId: row.parent_id != null ? rowId(row.parent_id) : undefined,
|
|
211
|
+
defineId: rowId(row.process_define_id),
|
|
205
212
|
state: row.state, parentNodeName: row.parent_node_name, businessNo: row.business_no,
|
|
206
213
|
operator: row.operator, expireTime: row.expire_time,
|
|
207
|
-
createTime: row.create_time, createUser: row.create_user,
|
|
208
|
-
updateTime: row.update_time, updateUser: row.update_user,
|
|
214
|
+
createTime: row.create_time, createUser: rowId(row.create_user),
|
|
215
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
209
216
|
tasks: [],
|
|
210
217
|
});
|
|
211
218
|
inst.variables = row.variable ? JSON.parse(row.variable) : {};
|
|
@@ -318,7 +325,7 @@ export class JdbcRepository {
|
|
|
318
325
|
for (const t of tasks)
|
|
319
326
|
t.actorIds = [];
|
|
320
327
|
for (const r of actorRows) {
|
|
321
|
-
const t = tasks.find(x => x.id === r.process_task_id);
|
|
328
|
+
const t = tasks.find(x => x.id === rowId(r.process_task_id));
|
|
322
329
|
if (t)
|
|
323
330
|
t.actorIds.push(r.actor_id);
|
|
324
331
|
}
|
|
@@ -340,12 +347,13 @@ export class JdbcRepository {
|
|
|
340
347
|
}
|
|
341
348
|
mapTask(row) {
|
|
342
349
|
const task = new ProcessTask({
|
|
343
|
-
id: row.id, processInstanceId: row.process_instance_id, taskName: row.task_name,
|
|
350
|
+
id: rowId(row.id), processInstanceId: rowId(row.process_instance_id), taskName: row.task_name,
|
|
344
351
|
displayName: row.display_name, taskType: row.task_type, performType: row.perform_type,
|
|
345
352
|
taskState: row.task_state, actorId: row.operator, finishTime: row.finish_time,
|
|
346
|
-
expireTime: row.expire_time, formKey: row.form_key,
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
expireTime: row.expire_time, formKey: row.form_key,
|
|
354
|
+
parentTaskId: row.task_parent_id != null ? rowId(row.task_parent_id) : undefined,
|
|
355
|
+
createTime: row.create_time, createUser: rowId(row.create_user),
|
|
356
|
+
updateTime: row.update_time, updateUser: rowId(row.update_user),
|
|
349
357
|
});
|
|
350
358
|
task.variables = row.variable ? JSON.parse(row.variable) : {};
|
|
351
359
|
task.actorIds = [];
|
|
@@ -435,10 +443,10 @@ export class JdbcRepository {
|
|
|
435
443
|
where + ' ORDER BY t.id DESC LIMIT ? OFFSET ?'), [...cond.params, pageSize, (pageNum - 1) * pageSize]);
|
|
436
444
|
return {
|
|
437
445
|
rows: rows.map(r => ({
|
|
438
|
-
id:
|
|
446
|
+
id: rowId(r.id), name: r.name, displayName: r.display_name, type: r.type,
|
|
439
447
|
state: Number(r.state), version: Number(r.version),
|
|
440
|
-
createTime: r.create_time, createUser: r.create_user
|
|
441
|
-
updateTime: r.update_time, updateUser: r.update_user
|
|
448
|
+
createTime: r.create_time, createUser: rowId(r.create_user),
|
|
449
|
+
updateTime: r.update_time, updateUser: rowId(r.update_user),
|
|
442
450
|
})),
|
|
443
451
|
total,
|
|
444
452
|
};
|
|
@@ -504,12 +512,12 @@ export class JdbcRepository {
|
|
|
504
512
|
catch { /* 忽略坏 JSON */ }
|
|
505
513
|
}
|
|
506
514
|
return {
|
|
507
|
-
id:
|
|
508
|
-
defineId:
|
|
515
|
+
id: rowId(r.id), parentId: r.parent_id != null ? rowId(r.parent_id) : undefined,
|
|
516
|
+
defineId: rowId(r.process_define_id), state: r.state,
|
|
509
517
|
parentNodeName: r.parent_node_name ?? '', businessNo: r.business_no ?? '', operator: r.operator ?? '',
|
|
510
518
|
expireTime: r.expire_time ?? undefined, variables,
|
|
511
|
-
createTime: r.create_time, createUser: r.create_user
|
|
512
|
-
updateTime: r.update_time, updateUser: r.update_user
|
|
519
|
+
createTime: r.create_time, createUser: rowId(r.create_user),
|
|
520
|
+
updateTime: r.update_time, updateUser: rowId(r.update_user),
|
|
513
521
|
defineName: r.name ?? '', defineDisplayName: r.display_name ?? '',
|
|
514
522
|
defineVersion: Number(r.version ?? 0),
|
|
515
523
|
};
|
|
@@ -583,13 +591,13 @@ export class JdbcRepository {
|
|
|
583
591
|
catch { /* 忽略坏 JSON */ }
|
|
584
592
|
}
|
|
585
593
|
return {
|
|
586
|
-
id:
|
|
594
|
+
id: rowId(r.id), processInstanceId: rowId(r.process_instance_id), taskName: r.task_name,
|
|
587
595
|
displayName: r.display_name, taskType: Number(r.task_type), performType: Number(r.perform_type),
|
|
588
596
|
taskState: r.task_state, operator: r.operator ?? '', finishTime: r.finish_time ?? undefined,
|
|
589
597
|
expireTime: r.expire_time ?? undefined, formKey: r.form_key ?? '',
|
|
590
|
-
taskParentId: r.task_parent_id != null ?
|
|
591
|
-
variables, createTime: r.create_time, createUser: r.create_user
|
|
592
|
-
updateTime: r.update_time, updateUser: r.update_user
|
|
598
|
+
taskParentId: r.task_parent_id != null ? rowId(r.task_parent_id) : undefined,
|
|
599
|
+
variables, createTime: r.create_time, createUser: rowId(r.create_user),
|
|
600
|
+
updateTime: r.update_time, updateUser: rowId(r.update_user),
|
|
593
601
|
processDefineName: r.name ?? '', processDefineDisplayName: r.display_name ?? '',
|
|
594
602
|
defineVersion: Number(r.process_define_version ?? 0),
|
|
595
603
|
instanceVariable: r.instance_variable ?? '', instanceCreateTime: r.instance_create_time,
|
|
@@ -628,12 +636,12 @@ export class JdbcRepository {
|
|
|
628
636
|
catch { /* 忽略坏 JSON */ }
|
|
629
637
|
}
|
|
630
638
|
return {
|
|
631
|
-
id:
|
|
632
|
-
defineId:
|
|
639
|
+
id: rowId(r.id), parentId: r.parent_id != null ? rowId(r.parent_id) : undefined,
|
|
640
|
+
defineId: rowId(r.process_define_id), state: r.state,
|
|
633
641
|
parentNodeName: r.parent_node_name ?? '', businessNo: r.business_no ?? '', operator: r.operator ?? '',
|
|
634
642
|
expireTime: r.expire_time ?? undefined, variables,
|
|
635
|
-
createTime: r.create_time, createUser: r.create_user
|
|
636
|
-
updateTime: r.update_time, updateUser: r.update_user
|
|
643
|
+
createTime: r.create_time, createUser: rowId(r.create_user),
|
|
644
|
+
updateTime: r.update_time, updateUser: rowId(r.update_user),
|
|
637
645
|
defineName: r.name ?? '', defineDisplayName: r.display_name ?? '',
|
|
638
646
|
defineVersion: Number(r.version ?? 0),
|
|
639
647
|
};
|
package/dist/memory-ext.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ export declare class MemoryExtRepository implements ProcessExtRepository {
|
|
|
5
5
|
private designHis;
|
|
6
6
|
private surrogates;
|
|
7
7
|
private seq;
|
|
8
|
-
findDesignById(id:
|
|
8
|
+
findDesignById(id: string): Promise<ProcessDesign | null>;
|
|
9
9
|
saveDesign(d: ProcessDesign): Promise<void>;
|
|
10
10
|
updateDesign(d: ProcessDesign): Promise<void>;
|
|
11
|
-
removeDesign(id:
|
|
11
|
+
removeDesign(id: string): Promise<void>;
|
|
12
12
|
pageDesigns(_pageNum?: number, _pageSize?: number, _filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessDesign[], number]>;
|
|
13
13
|
saveDesignHis(his: ProcessDesignHis): Promise<void>;
|
|
14
|
-
listDesignHis(designId:
|
|
15
|
-
findSurrogateById(id:
|
|
14
|
+
listDesignHis(designId: string): Promise<ProcessDesignHis[]>;
|
|
15
|
+
findSurrogateById(id: string): Promise<ProcessSurrogate | null>;
|
|
16
16
|
saveSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
17
17
|
updateSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
18
|
-
removeSurrogate(id:
|
|
18
|
+
removeSurrogate(id: string): Promise<void>;
|
|
19
19
|
pageSurrogates(_pageNum?: number, _pageSize?: number, filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessSurrogate[], number]>;
|
|
20
20
|
getSurrogate(operator: string, processName: string, at?: Date): Promise<ProcessSurrogate | null>;
|
|
21
21
|
}
|
package/dist/memory-ext.js
CHANGED
|
@@ -28,7 +28,7 @@ export class MemoryExtRepository {
|
|
|
28
28
|
async findDesignById(id) { return this.designs.get(id) ?? null; }
|
|
29
29
|
async saveDesign(d) {
|
|
30
30
|
if (!d.id)
|
|
31
|
-
d.id = this.seq
|
|
31
|
+
d.id = String(this.seq++);
|
|
32
32
|
const now = new Date();
|
|
33
33
|
if (!d.createTime)
|
|
34
34
|
d.createTime = now;
|
|
@@ -51,7 +51,7 @@ export class MemoryExtRepository {
|
|
|
51
51
|
// ── 设计历史 ──
|
|
52
52
|
async saveDesignHis(his) {
|
|
53
53
|
if (!his.id)
|
|
54
|
-
his.id = this.seq
|
|
54
|
+
his.id = String(this.seq++);
|
|
55
55
|
if (!his.createTime)
|
|
56
56
|
his.createTime = new Date();
|
|
57
57
|
const list = this.designHis.get(his.processDesignId) ?? [];
|
|
@@ -65,7 +65,7 @@ export class MemoryExtRepository {
|
|
|
65
65
|
async findSurrogateById(id) { return this.surrogates.get(id) ?? null; }
|
|
66
66
|
async saveSurrogate(s) {
|
|
67
67
|
if (!s.id)
|
|
68
|
-
s.id = this.seq
|
|
68
|
+
s.id = String(this.seq++);
|
|
69
69
|
const now = new Date();
|
|
70
70
|
if (!s.createTime)
|
|
71
71
|
s.createTime = now;
|
package/dist/memory.d.ts
CHANGED
|
@@ -13,26 +13,26 @@ export declare class MemoryRepository implements ProcessRepository {
|
|
|
13
13
|
private ccInstances;
|
|
14
14
|
private seq;
|
|
15
15
|
addDefine(def: ProcessDefine): void;
|
|
16
|
-
findDefineById(id:
|
|
16
|
+
findDefineById(id: string): Promise<ProcessDefine | null>;
|
|
17
17
|
findDefineByName(name: string): Promise<ProcessDefine | null>;
|
|
18
18
|
saveDefine(def: ProcessDefine): Promise<void>;
|
|
19
19
|
updateDefine(def: ProcessDefine): Promise<void>;
|
|
20
|
-
updateDefineState(defineId:
|
|
21
|
-
removeDefine(defineId:
|
|
20
|
+
updateDefineState(defineId: string, state: number): Promise<void>;
|
|
21
|
+
removeDefine(defineId: string): Promise<void>;
|
|
22
22
|
saveInstance(inst: ProcessInstance): Promise<void>;
|
|
23
23
|
updateInstance(inst: ProcessInstance): Promise<void>;
|
|
24
|
-
findInstanceById(id:
|
|
25
|
-
findTaskById(id:
|
|
24
|
+
findInstanceById(id: string): Promise<ProcessInstance | null>;
|
|
25
|
+
findTaskById(id: string): Promise<ProcessTask | null>;
|
|
26
26
|
saveTask(task: ProcessTask): Promise<void>;
|
|
27
27
|
updateTask(task: ProcessTask): Promise<void>;
|
|
28
|
-
findDoingTasks(instanceId:
|
|
29
|
-
findDoneTasks(instanceId:
|
|
30
|
-
findHistoryTasks(instanceId:
|
|
31
|
-
findTaskActors(taskId:
|
|
32
|
-
addTaskActor(taskId:
|
|
33
|
-
removeTaskActor(taskId:
|
|
34
|
-
createCcInstance(instanceId:
|
|
35
|
-
updateCcStatus(_instanceId:
|
|
28
|
+
findDoingTasks(instanceId: string, taskNames?: string[]): Promise<ProcessTask[]>;
|
|
29
|
+
findDoneTasks(instanceId: string, _taskNames?: string[]): Promise<ProcessTask[]>;
|
|
30
|
+
findHistoryTasks(instanceId: string): Promise<ProcessTask[]>;
|
|
31
|
+
findTaskActors(taskId: string): Promise<string[]>;
|
|
32
|
+
addTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
33
|
+
removeTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
34
|
+
createCcInstance(instanceId: string, _creator: string, ...actorIds: string[]): Promise<void>;
|
|
35
|
+
updateCcStatus(_instanceId: string, _actorId: string): Promise<void>;
|
|
36
36
|
pageDefines(pageNum?: number, pageSize?: number, conditions?: QueryCondition[]): Promise<{
|
|
37
37
|
rows: DefineRow[];
|
|
38
38
|
total: number;
|
package/dist/memory.js
CHANGED
|
@@ -101,7 +101,7 @@ export class MemoryRepository {
|
|
|
101
101
|
seq = 1;
|
|
102
102
|
addDefine(def) {
|
|
103
103
|
if (!def.id)
|
|
104
|
-
def.id = this.seq
|
|
104
|
+
def.id = String(this.seq++);
|
|
105
105
|
this.defines.set(def.id, def);
|
|
106
106
|
}
|
|
107
107
|
async findDefineById(id) { return this.defines.get(id) ?? null; }
|
|
@@ -109,7 +109,8 @@ export class MemoryRepository {
|
|
|
109
109
|
async findDefineByName(name) {
|
|
110
110
|
let latest = null;
|
|
111
111
|
for (const d of this.defines.values()) {
|
|
112
|
-
|
|
112
|
+
// BigInt 比较:id 为 string(issue 38 E9),大整数数字比较不可靠
|
|
113
|
+
if (d.name === name && (!latest || BigInt(d.id) > BigInt(latest.id)))
|
|
113
114
|
latest = d;
|
|
114
115
|
}
|
|
115
116
|
return latest;
|
|
@@ -117,7 +118,7 @@ export class MemoryRepository {
|
|
|
117
118
|
// ── 定义写操作(v1.0.1,对齐 SPI)──
|
|
118
119
|
async saveDefine(def) {
|
|
119
120
|
if (!def.id)
|
|
120
|
-
def.id = this.seq
|
|
121
|
+
def.id = String(this.seq++);
|
|
121
122
|
this.defines.set(def.id, def);
|
|
122
123
|
}
|
|
123
124
|
async updateDefine(def) {
|
|
@@ -133,7 +134,7 @@ export class MemoryRepository {
|
|
|
133
134
|
}
|
|
134
135
|
async saveInstance(inst) {
|
|
135
136
|
if (!inst.id)
|
|
136
|
-
inst.id = this.seq
|
|
137
|
+
inst.id = String(this.seq++);
|
|
137
138
|
const cp = cloneInstance(inst);
|
|
138
139
|
cp.tasks = [];
|
|
139
140
|
this.instances.set(inst.id, cp);
|
|
@@ -178,7 +179,7 @@ export class MemoryRepository {
|
|
|
178
179
|
}
|
|
179
180
|
async saveTask(task) {
|
|
180
181
|
if (!task.id)
|
|
181
|
-
task.id = this.seq
|
|
182
|
+
task.id = String(this.seq++);
|
|
182
183
|
const cp = cloneTask(task);
|
|
183
184
|
cp.actorIds = [];
|
|
184
185
|
this.tasks.set(task.id, cp);
|
package/dist/model.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const TypeFork = "snaker:fork";
|
|
|
32
32
|
export declare const TypeJoin = "snaker:join";
|
|
33
33
|
export declare const TypeCustom = "snaker:custom";
|
|
34
34
|
export interface ProcessDefine {
|
|
35
|
-
id:
|
|
35
|
+
id: string;
|
|
36
36
|
name: string;
|
|
37
37
|
displayName: string;
|
|
38
38
|
type: string;
|
|
@@ -45,7 +45,7 @@ export interface ProcessDefine {
|
|
|
45
45
|
updateUser: string;
|
|
46
46
|
}
|
|
47
47
|
export interface ProcessDesign {
|
|
48
|
-
id:
|
|
48
|
+
id: string;
|
|
49
49
|
name: string;
|
|
50
50
|
displayName: string;
|
|
51
51
|
type: string;
|
|
@@ -58,14 +58,14 @@ export interface ProcessDesign {
|
|
|
58
58
|
updateUser: string;
|
|
59
59
|
}
|
|
60
60
|
export interface ProcessDesignHis {
|
|
61
|
-
id:
|
|
62
|
-
processDesignId:
|
|
61
|
+
id: string;
|
|
62
|
+
processDesignId: string;
|
|
63
63
|
content: Uint8Array | string;
|
|
64
64
|
createTime: Date;
|
|
65
65
|
createUser: string;
|
|
66
66
|
}
|
|
67
67
|
export interface ProcessSurrogate {
|
|
68
|
-
id:
|
|
68
|
+
id: string;
|
|
69
69
|
processName?: string;
|
|
70
70
|
operator: string;
|
|
71
71
|
surrogate: string;
|
|
@@ -128,9 +128,9 @@ export declare enum CountersignType {
|
|
|
128
128
|
}
|
|
129
129
|
export declare const BusinessNoKey = "BUSINESS_NO";
|
|
130
130
|
export declare class ProcessInstance {
|
|
131
|
-
id:
|
|
132
|
-
parentId?:
|
|
133
|
-
defineId:
|
|
131
|
+
id: string;
|
|
132
|
+
parentId?: string;
|
|
133
|
+
defineId: string;
|
|
134
134
|
state: InstanceState;
|
|
135
135
|
parentNodeName: string;
|
|
136
136
|
businessNo: string;
|
|
@@ -144,7 +144,7 @@ export declare class ProcessInstance {
|
|
|
144
144
|
updateUser: string;
|
|
145
145
|
constructor(data: any);
|
|
146
146
|
/** 工厂——创建流程实例 */
|
|
147
|
-
static create(id:
|
|
147
|
+
static create(id: string, defineId: string, operator: string, vars: Record<string, any>, now: Date): ProcessInstance;
|
|
148
148
|
/** 完成任务(子实体状态转换 + 实例变量合并) */
|
|
149
149
|
completeTask(task: ProcessTask, operator: string, vars: Record<string, any>, now: Date): void;
|
|
150
150
|
/** 废弃单个任务 */
|
|
@@ -164,11 +164,11 @@ export declare class ProcessInstance {
|
|
|
164
164
|
/** 所有任务是否都已完成(join 合并判断) */
|
|
165
165
|
isAllTasksFinished(): boolean;
|
|
166
166
|
/** 创建任务(子实体工厂) */
|
|
167
|
-
createTask(id:
|
|
167
|
+
createTask(id: string, taskName: string, displayName: string, actor: string, operator: string, formKey: string, now: Date): ProcessTask;
|
|
168
168
|
}
|
|
169
169
|
export declare class ProcessTask {
|
|
170
|
-
id:
|
|
171
|
-
processInstanceId:
|
|
170
|
+
id: string;
|
|
171
|
+
processInstanceId: string;
|
|
172
172
|
taskName: string;
|
|
173
173
|
displayName: string;
|
|
174
174
|
taskType: number;
|
|
@@ -179,7 +179,7 @@ export declare class ProcessTask {
|
|
|
179
179
|
finishTime?: Date;
|
|
180
180
|
expireTime?: Date;
|
|
181
181
|
formKey: string;
|
|
182
|
-
parentTaskId?:
|
|
182
|
+
parentTaskId?: string;
|
|
183
183
|
variables: Record<string, any>;
|
|
184
184
|
createTime: Date;
|
|
185
185
|
createUser: string;
|
|
@@ -208,9 +208,9 @@ export interface UserInfo {
|
|
|
208
208
|
postName?: string;
|
|
209
209
|
}
|
|
210
210
|
export interface CcInstanceRow {
|
|
211
|
-
id:
|
|
212
|
-
parentId?:
|
|
213
|
-
defineId:
|
|
211
|
+
id: string;
|
|
212
|
+
parentId?: string;
|
|
213
|
+
defineId: string;
|
|
214
214
|
state: InstanceState;
|
|
215
215
|
parentNodeName: string;
|
|
216
216
|
businessNo: string;
|
|
@@ -226,7 +226,7 @@ export interface CcInstanceRow {
|
|
|
226
226
|
defineVersion: number;
|
|
227
227
|
}
|
|
228
228
|
export interface DefineRow {
|
|
229
|
-
id:
|
|
229
|
+
id: string;
|
|
230
230
|
name: string;
|
|
231
231
|
displayName: string;
|
|
232
232
|
type: string;
|
|
@@ -238,9 +238,9 @@ export interface DefineRow {
|
|
|
238
238
|
updateUser: string;
|
|
239
239
|
}
|
|
240
240
|
export interface InstanceRow {
|
|
241
|
-
id:
|
|
242
|
-
parentId?:
|
|
243
|
-
defineId:
|
|
241
|
+
id: string;
|
|
242
|
+
parentId?: string;
|
|
243
|
+
defineId: string;
|
|
244
244
|
state: InstanceState;
|
|
245
245
|
parentNodeName: string;
|
|
246
246
|
businessNo: string;
|
|
@@ -256,8 +256,8 @@ export interface InstanceRow {
|
|
|
256
256
|
defineVersion: number;
|
|
257
257
|
}
|
|
258
258
|
export interface TaskRow {
|
|
259
|
-
id:
|
|
260
|
-
processInstanceId:
|
|
259
|
+
id: string;
|
|
260
|
+
processInstanceId: string;
|
|
261
261
|
taskName: string;
|
|
262
262
|
displayName: string;
|
|
263
263
|
taskType: number;
|
|
@@ -267,7 +267,7 @@ export interface TaskRow {
|
|
|
267
267
|
finishTime?: Date;
|
|
268
268
|
expireTime?: Date;
|
|
269
269
|
formKey: string;
|
|
270
|
-
taskParentId?:
|
|
270
|
+
taskParentId?: string;
|
|
271
271
|
variables: Record<string, any>;
|
|
272
272
|
createTime: Date;
|
|
273
273
|
createUser: string;
|
package/dist/persist.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare class SqliteDynamicTableWriter implements DynamicTableWriter {
|
|
|
61
61
|
private resolveDefaultUser;
|
|
62
62
|
}
|
|
63
63
|
/** 流程定义加载器(用于解析 relTableName / persistMode / 流程 name),通常透传仓库 findDefineById */
|
|
64
|
-
export type DefineLoader = (defineId:
|
|
64
|
+
export type DefineLoader = (defineId: string) => Promise<ProcessDefine | null>;
|
|
65
65
|
/** 持久化模式(流程定义顶层 persistMode,缺省 ARCHIVE) */
|
|
66
66
|
export declare const PersistModeArchive = "ARCHIVE";
|
|
67
67
|
export declare const PersistModeSync = "SYNC";
|
package/dist/spi.d.ts
CHANGED
|
@@ -5,26 +5,26 @@ export interface QueryCondition {
|
|
|
5
5
|
value: any;
|
|
6
6
|
}
|
|
7
7
|
export interface ProcessRepository {
|
|
8
|
-
findDefineById(id:
|
|
8
|
+
findDefineById(id: string): Promise<ProcessDefine | null>;
|
|
9
9
|
findDefineByName(name: string): Promise<ProcessDefine | null>;
|
|
10
10
|
saveDefine(define: ProcessDefine): Promise<void>;
|
|
11
11
|
updateDefine(define: ProcessDefine): Promise<void>;
|
|
12
|
-
updateDefineState(defineId:
|
|
13
|
-
removeDefine(defineId:
|
|
14
|
-
findInstanceById(id:
|
|
12
|
+
updateDefineState(defineId: string, state: number): Promise<void>;
|
|
13
|
+
removeDefine(defineId: string): Promise<void>;
|
|
14
|
+
findInstanceById(id: string): Promise<ProcessInstance | null>;
|
|
15
15
|
saveInstance(inst: ProcessInstance): Promise<void>;
|
|
16
16
|
updateInstance(inst: ProcessInstance): Promise<void>;
|
|
17
|
-
findTaskById(taskId:
|
|
17
|
+
findTaskById(taskId: string): Promise<ProcessTask | null>;
|
|
18
18
|
saveTask(task: ProcessTask): Promise<void>;
|
|
19
19
|
updateTask(task: ProcessTask): Promise<void>;
|
|
20
|
-
findDoingTasks(instanceId:
|
|
21
|
-
findDoneTasks(instanceId:
|
|
22
|
-
findHistoryTasks(instanceId:
|
|
23
|
-
findTaskActors(taskId:
|
|
24
|
-
addTaskActor(taskId:
|
|
25
|
-
removeTaskActor(taskId:
|
|
26
|
-
createCcInstance(instanceId:
|
|
27
|
-
updateCcStatus(instanceId:
|
|
20
|
+
findDoingTasks(instanceId: string, taskNames?: string[]): Promise<ProcessTask[]>;
|
|
21
|
+
findDoneTasks(instanceId: string, taskNames?: string[]): Promise<ProcessTask[]>;
|
|
22
|
+
findHistoryTasks(instanceId: string): Promise<ProcessTask[]>;
|
|
23
|
+
findTaskActors(taskId: string): Promise<string[]>;
|
|
24
|
+
addTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
25
|
+
removeTaskActor(taskId: string, actors: string[]): Promise<void>;
|
|
26
|
+
createCcInstance(instanceId: string, creator: string, ...actorIds: string[]): Promise<void>;
|
|
27
|
+
updateCcStatus(instanceId: string, actorId: string): Promise<void>;
|
|
28
28
|
pageCcInstances(pageNum: number, pageSize: number, actorId: string, conditions?: QueryCondition[]): Promise<{
|
|
29
29
|
rows: CcInstanceRow[];
|
|
30
30
|
total: number;
|
|
@@ -58,23 +58,23 @@ export interface OrgUserProvider {
|
|
|
58
58
|
findByRole(roleCode: string): Promise<string[]>;
|
|
59
59
|
}
|
|
60
60
|
export interface IDGenerator {
|
|
61
|
-
nextId():
|
|
61
|
+
nextId(): string;
|
|
62
62
|
}
|
|
63
63
|
export interface ExpressionEvaluator {
|
|
64
64
|
eval(expr: string, vars: Record<string, any>): Promise<any>;
|
|
65
65
|
}
|
|
66
66
|
export interface ProcessExtRepository {
|
|
67
|
-
findDesignById(id:
|
|
67
|
+
findDesignById(id: string): Promise<ProcessDesign | null>;
|
|
68
68
|
saveDesign(d: ProcessDesign): Promise<void>;
|
|
69
69
|
updateDesign(d: ProcessDesign): Promise<void>;
|
|
70
|
-
removeDesign(id:
|
|
70
|
+
removeDesign(id: string): Promise<void>;
|
|
71
71
|
pageDesigns(pageNum?: number, pageSize?: number, filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessDesign[], number]>;
|
|
72
72
|
saveDesignHis(his: ProcessDesignHis): Promise<void>;
|
|
73
|
-
listDesignHis(designId:
|
|
74
|
-
findSurrogateById(id:
|
|
73
|
+
listDesignHis(designId: string): Promise<ProcessDesignHis[]>;
|
|
74
|
+
findSurrogateById(id: string): Promise<ProcessSurrogate | null>;
|
|
75
75
|
saveSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
76
76
|
updateSurrogate(s: ProcessSurrogate): Promise<void>;
|
|
77
|
-
removeSurrogate(id:
|
|
77
|
+
removeSurrogate(id: string): Promise<void>;
|
|
78
78
|
pageSurrogates(pageNum?: number, pageSize?: number, filters?: Record<string, any>, conditions?: QueryCondition[]): Promise<[ProcessSurrogate[], number]>;
|
|
79
79
|
getSurrogate(operator: string, processName: string, at?: Date): Promise<ProcessSurrogate | null>;
|
|
80
80
|
}
|
package/package.json
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mldong/jeeflow",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"description": "jeeflow workflow engine — Node.js / TypeScript implementation",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./dist/index.js",
|
|
10
|
-
"./engine": "./dist/engine.js",
|
|
11
|
-
"./model": "./dist/model.js",
|
|
12
|
-
"./spi": "./dist/spi.js",
|
|
13
|
-
"./memory": "./dist/memory.js",
|
|
14
|
-
"./jdbc": "./dist/jdbc/index.js",
|
|
15
|
-
"./mysql": "./dist/jdbc/mysql.js",
|
|
16
|
-
"./postgres": "./dist/jdbc/postgres.js"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"@types/
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@mldong/jeeflow",
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"description": "jeeflow workflow engine — Node.js / TypeScript implementation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./engine": "./dist/engine.js",
|
|
11
|
+
"./model": "./dist/model.js",
|
|
12
|
+
"./spi": "./dist/spi.js",
|
|
13
|
+
"./memory": "./dist/memory.js",
|
|
14
|
+
"./jdbc": "./dist/jdbc/index.js",
|
|
15
|
+
"./mysql": "./dist/jdbc/mysql.js",
|
|
16
|
+
"./postgres": "./dist/jdbc/postgres.js",
|
|
17
|
+
"./jdbc/ext": "./dist/jdbc/ext.js"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "node --import tsx __tests__/spec.test.ts",
|
|
22
|
+
"demo": "node --import tsx demo/main.ts",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"workflow",
|
|
27
|
+
"engine",
|
|
28
|
+
"jeeflow",
|
|
29
|
+
"typescript"
|
|
30
|
+
],
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/express": "^4.17.25",
|
|
34
|
+
"@types/pg": "^8.20.3",
|
|
35
|
+
"express": "^4.22.2",
|
|
36
|
+
"tsx": "^4.19.0",
|
|
37
|
+
"typescript": "^5.5.0"
|
|
38
|
+
},
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"mysql2": "^3.11.0",
|
|
41
|
+
"pg": "^8.13.0"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"README.md"
|
|
47
|
+
]
|
|
48
|
+
}
|