@mldong/jeeflow 1.8.22 → 1.8.23

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.
Files changed (2) hide show
  1. package/dist/engine.js +27 -8
  2. package/package.json +1 -1
package/dist/engine.js CHANGED
@@ -155,6 +155,8 @@ export class EngineImpl {
155
155
  [`operatorList_${curNode.id}`]: actors,
156
156
  };
157
157
  await this.repo.saveTask(nt);
158
+ // TASK_CREATE:顺序会签推进新任务落库后 fire(对齐 Java CreateTaskHandler / Rust)
159
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: curNode.id, operator });
158
160
  return (await this.repo.findInstanceById(inst.id));
159
161
  }
160
162
  }
@@ -340,8 +342,11 @@ export class EngineImpl {
340
342
  switch (ct) {
341
343
  case 'PARALLEL':
342
344
  case '':
343
- for (const actor of actors)
344
- await this.repo.saveTask(inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1));
345
+ for (const actor of actors) {
346
+ const nt = inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1);
347
+ await this.repo.saveTask(nt);
348
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
349
+ }
345
350
  return;
346
351
  case 'SEQUENTIAL': {
347
352
  const nt = inst.createTask(this.nextId(), node.id, node.text.value, actors[0], operator, form, now, 1);
@@ -351,11 +356,15 @@ export class EngineImpl {
351
356
  [`operatorList_${node.id}`]: actors,
352
357
  };
353
358
  await this.repo.saveTask(nt);
359
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
354
360
  return;
355
361
  }
356
362
  default:
357
- for (const actor of actors)
358
- await this.repo.saveTask(inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1));
363
+ for (const actor of actors) {
364
+ const nt = inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1);
365
+ await this.repo.saveTask(nt);
366
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
367
+ }
359
368
  return;
360
369
  }
361
370
  }
@@ -363,6 +372,7 @@ export class EngineImpl {
363
372
  if (actors.length > 1)
364
373
  nt.actorIds = actors;
365
374
  await this.repo.saveTask(nt);
375
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
366
376
  }
367
377
  // ─── Helpers ───────────────────────────────────────────────────────────────
368
378
  async loadAndCheck(taskId, operator) {
@@ -489,8 +499,12 @@ export class EngineImpl {
489
499
  if (isCountersign(node.properties?.performType) && ct) {
490
500
  switch (ct) {
491
501
  case 'PARALLEL':
492
- for (const actor of actors)
493
- await this.repo.saveTask(inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1));
502
+ for (const actor of actors) {
503
+ const nt = inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1);
504
+ await this.repo.saveTask(nt);
505
+ // TASK_CREATE:任务落库后逐个 fire(会签多任务逐个,对齐 Java CreateTaskHandler)
506
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
507
+ }
494
508
  return;
495
509
  case 'SEQUENTIAL': {
496
510
  // 顺序会签任务也是会签任务(issues/57 E29 修正:仅普通分支默认 0)
@@ -501,11 +515,15 @@ export class EngineImpl {
501
515
  [`operatorList_${node.id}`]: actors,
502
516
  };
503
517
  await this.repo.saveTask(nt);
518
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
504
519
  return;
505
520
  }
506
521
  default:
507
- for (const actor of actors)
508
- await this.repo.saveTask(inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1));
522
+ for (const actor of actors) {
523
+ const nt = inst.createTask(this.nextId(), node.id, node.text.value, actor, operator, form, now, 1);
524
+ await this.repo.saveTask(nt);
525
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
526
+ }
509
527
  return;
510
528
  }
511
529
  }
@@ -514,6 +532,7 @@ export class EngineImpl {
514
532
  if (actors.length > 1)
515
533
  nt.actorIds = actors;
516
534
  await this.repo.saveTask(nt);
535
+ await this.fireEvent({ type: EventType.TaskCreate, instanceId: inst.id, taskId: nt.id, nodeId: node.id, operator });
517
536
  }
518
537
  async resolveActors(node, inst, operator, vars) {
519
538
  // 1a. Registry 按名称解析(推荐)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mldong/jeeflow",
3
- "version": "1.8.22",
3
+ "version": "1.8.23",
4
4
  "description": "jeeflow workflow engine — Node.js / TypeScript implementation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",