@mldong/jeeflow 1.5.0 → 1.5.1

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
@@ -17,6 +17,12 @@ export declare class JeeflowFacade {
17
17
  private withdraw;
18
18
  private execute;
19
19
  private designPage;
20
+ /** 修改流程设计基本信息(对齐 boot3 ProcessDesignController.update,不写设计稿快照) */
21
+ private designUpdate;
22
+ /** 更新流程设计定义(设计稿保存,issues/08):content 快照入库 + 同步基本信息 + 置未部署 */
23
+ private designUpdateDefine;
24
+ /** 重新部署流程定义(issues/08):替换最新定义内容 + 置已部署(对齐 boot3 redeploy) */
25
+ private designRedeploy;
20
26
  private designDetail;
21
27
  private designSave;
22
28
  private surrogatePage;
package/dist/facade.js CHANGED
@@ -48,6 +48,8 @@ export class JeeflowFacade {
48
48
  case 'processDefine/deploy':
49
49
  case 'processDesign/deploy':
50
50
  return this.deploy(args, action === 'processDesign/deploy');
51
+ case 'processDesign/redeploy':
52
+ return this.designRedeploy(args);
51
53
  case 'processDefine/redeploy':
52
54
  return this.redeploy(args);
53
55
  case 'processDefine/remove':
@@ -72,6 +74,10 @@ export class JeeflowFacade {
72
74
  return this.designDetail(args);
73
75
  case 'processDesign/save':
74
76
  return this.designSave(args);
77
+ case 'processDesign/update':
78
+ return this.designUpdate(args);
79
+ case 'processDesign/updateDefine':
80
+ return this.designUpdateDefine(args);
75
81
  case 'processDesign/remove':
76
82
  return this.ext().removeDesign(toId(args.id));
77
83
  case 'processSurrogate/page':
@@ -247,6 +253,100 @@ export class JeeflowFacade {
247
253
  const [rows, total] = await this.ext().pageDesigns(toInt(args.pageNum ?? 1), toInt(args.pageSize ?? 10), undefined, parseMQuery(args));
248
254
  return { rows, recordCount: total };
249
255
  }
256
+ /** 修改流程设计基本信息(对齐 boot3 ProcessDesignController.update,不写设计稿快照) */
257
+ async designUpdate(args) {
258
+ const ext = this.ext();
259
+ const design = await ext.findDesignById(toId(args.id));
260
+ if (!design)
261
+ throw new Error('流程设计不存在');
262
+ if (args.name != null)
263
+ design.name = String(args.name);
264
+ if (args.displayName != null)
265
+ design.displayName = String(args.displayName);
266
+ if (args.type != null)
267
+ design.type = String(args.type);
268
+ if (args.icon != null)
269
+ design.icon = String(args.icon);
270
+ if (args.remark != null)
271
+ design.remark = String(args.remark);
272
+ design.updateUser = String(args.operator ?? 'system');
273
+ await ext.updateDesign(design);
274
+ return {};
275
+ }
276
+ /** 更新流程设计定义(设计稿保存,issues/08):content 快照入库 + 同步基本信息 + 置未部署 */
277
+ async designUpdateDefine(args) {
278
+ const ext = this.ext();
279
+ const designId = toId(args.processDesignId);
280
+ const design = await ext.findDesignById(designId);
281
+ if (!design)
282
+ throw new Error('流程设计不存在');
283
+ if (args.content == null)
284
+ throw new Error('content 缺失');
285
+ const content = toStr(args.content);
286
+ // 与最新一条相同则不重复入库(对齐 boot3 updateDefine)
287
+ const hisList = await ext.listDesignHis(designId);
288
+ if (hisList.length === 0 || toStr(hisList[0].content) !== content) {
289
+ await ext.saveDesignHis({
290
+ id: 0, processDesignId: designId, content,
291
+ createTime: new Date(), createUser: String(args.operator ?? 'system'),
292
+ });
293
+ }
294
+ // 同步设计基本信息(jsonObject 里的 name/displayName/type)+ 内容变更 → 未部署
295
+ try {
296
+ const flow = JSON.parse(content);
297
+ if (flow?.name)
298
+ design.name = flow.name;
299
+ if (flow?.displayName)
300
+ design.displayName = flow.displayName;
301
+ if (flow?.type)
302
+ design.type = flow.type;
303
+ }
304
+ catch { /* ignore */ }
305
+ design.isDeployed = 0;
306
+ design.updateUser = String(args.operator ?? 'system');
307
+ await ext.updateDesign(design);
308
+ return {};
309
+ }
310
+ /** 重新部署流程定义(issues/08):替换最新定义内容 + 置已部署(对齐 boot3 redeploy) */
311
+ async designRedeploy(args) {
312
+ const ext = this.ext();
313
+ const designId = toId(args.id);
314
+ const design = await ext.findDesignById(designId);
315
+ if (!design)
316
+ throw new Error('流程设计不存在');
317
+ const hisList = await ext.listDesignHis(designId);
318
+ if (hisList.length === 0)
319
+ throw new Error('流程设计没有内容,无法发布');
320
+ const content = toStr(hisList[0].content);
321
+ let flow;
322
+ try {
323
+ flow = JSON.parse(content);
324
+ }
325
+ catch (e) {
326
+ throw new Error('流程定义 JSON 解析失败: ' + String(e));
327
+ }
328
+ if (!flow?.name)
329
+ throw new Error('流程定义缺少 name');
330
+ // 按 name 取最新定义:有则替换内容(version 不变),无则新建(对齐 boot3 redeploy)
331
+ const last = await this.repo.findDefineByName(flow.name);
332
+ let defineId;
333
+ if (!last) {
334
+ defineId = await this.saveDeployedDefine(content, args);
335
+ }
336
+ else {
337
+ last.name = flow.name;
338
+ last.displayName = flow.displayName ?? '';
339
+ last.type = flow.type ?? '';
340
+ last.content = content;
341
+ last.updateUser = String(args.operator ?? 'system');
342
+ await this.repo.updateDefine(last);
343
+ defineId = last.id;
344
+ }
345
+ design.isDeployed = 1;
346
+ design.updateUser = String(args.operator ?? 'system');
347
+ await ext.updateDesign(design);
348
+ return { processDefineId: defineId };
349
+ }
250
350
  async designDetail(args) {
251
351
  const ext = this.ext();
252
352
  const design = await ext.findDesignById(toId(args.id));
@@ -307,6 +407,9 @@ export class JeeflowFacade {
307
407
  if (args.remark != null)
308
408
  found.remark = String(args.remark);
309
409
  found.updateUser = operator;
410
+ // 内容快照变更 → 置为未部署(对齐 boot3 updateDefine 语义,issues/08)
411
+ if (args.content != null)
412
+ found.isDeployed = 0;
310
413
  await ext.updateDesign(found);
311
414
  design = found;
312
415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",