@nocobase/plugin-workflow 2.2.0-beta.16 → 2.2.0-beta.17

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.
@@ -76,8 +76,8 @@ var jobs_default = {
76
76
  name: "result"
77
77
  },
78
78
  {
79
- type: "json",
80
- name: "meta"
79
+ type: "datetime",
80
+ name: "startedAt"
81
81
  },
82
82
  /**
83
83
  * @experimental
@@ -11,33 +11,33 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.7",
13
13
  "@formily/react": "2.3.7",
14
- "@nocobase/client": "2.2.0-beta.16",
15
- "@nocobase/utils": "2.2.0-beta.16",
14
+ "@nocobase/client": "2.2.0-beta.17",
15
+ "@nocobase/utils": "2.2.0-beta.17",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
- "@nocobase/flow-engine": "2.2.0-beta.16",
18
+ "@nocobase/flow-engine": "2.2.0-beta.17",
19
19
  "ahooks": "3.7.8",
20
20
  "react-router-dom": "6.30.1",
21
21
  "react-i18next": "11.18.6",
22
22
  "lodash": "4.18.1",
23
23
  "@dnd-kit/core": "6.1.0",
24
24
  "@formily/shared": "2.3.7",
25
- "@nocobase/plugin-mobile": "2.2.0-beta.16",
26
- "@nocobase/client-v2": "2.2.0-beta.16",
25
+ "@nocobase/plugin-mobile": "2.2.0-beta.17",
26
+ "@nocobase/client-v2": "2.2.0-beta.17",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/server": "2.2.0-beta.16",
29
- "@nocobase/database": "2.2.0-beta.16",
30
- "@nocobase/data-source-manager": "2.2.0-beta.16",
31
- "@nocobase/logger": "2.2.0-beta.16",
32
- "@nocobase/evaluators": "2.2.0-beta.16",
28
+ "@nocobase/server": "2.2.0-beta.17",
29
+ "@nocobase/database": "2.2.0-beta.17",
30
+ "@nocobase/data-source-manager": "2.2.0-beta.17",
31
+ "@nocobase/logger": "2.2.0-beta.17",
32
+ "@nocobase/evaluators": "2.2.0-beta.17",
33
33
  "@formily/antd-v5": "1.2.3",
34
34
  "@formily/reactive": "2.3.7",
35
35
  "@emotion/css": "11.13.0",
36
36
  "@formily/json-schema": "2.3.7",
37
37
  "antd-style": "3.7.1",
38
38
  "dayjs": "1.11.13",
39
- "@nocobase/actions": "2.2.0-beta.16",
40
- "@nocobase/plugin-workflow-test": "2.2.0-beta.16",
41
- "@nocobase/test": "2.2.0-beta.16",
39
+ "@nocobase/actions": "2.2.0-beta.17",
40
+ "@nocobase/plugin-workflow-test": "2.2.0-beta.17",
41
+ "@nocobase/test": "2.2.0-beta.17",
42
42
  "@dnd-kit/sortable": "7.0.2"
43
43
  };
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-07-31T07:46:19.221Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-08-10T16:51:19.677Z"}
@@ -1 +1 @@
1
- {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-07-31T07:46:18.919Z"}
1
+ {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-08-10T16:51:19.396Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-07-31T07:46:18.094Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-08-10T16:51:18.632Z"}
@@ -1 +1 @@
1
- {"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2026-07-31T07:46:17.920Z"}
1
+ {"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2026-08-10T16:51:18.462Z"}
@@ -70,7 +70,7 @@ export default class PluginWorkflowServer extends Plugin {
70
70
  abortExecutionIfExpired(execution: ExecutionModel, options?: {
71
71
  transaction?: Transaction;
72
72
  }): Promise<boolean>;
73
- registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): void;
73
+ registerRunningExecution(executionId: number | string, abort: (reason?: string) => void): () => void;
74
74
  unregisterRunningExecution(executionId: number | string): void;
75
75
  abortRunningExecution(executionId: number | string, reason?: string): boolean;
76
76
  /**
@@ -225,7 +225,7 @@ class PluginWorkflowServer extends import_server.Plugin {
225
225
  return this.timeoutManager.abortExecutionIfExpired(execution, options);
226
226
  }
227
227
  registerRunningExecution(executionId, abort) {
228
- this.runningExecutionRegistry.register(executionId, { abort });
228
+ return this.runningExecutionRegistry.register(executionId, { abort });
229
229
  }
230
230
  unregisterRunningExecution(executionId) {
231
231
  this.runningExecutionRegistry.unregister(executionId);
@@ -73,6 +73,7 @@ export default class Processor {
73
73
  abortController: AbortController;
74
74
  timeoutGuard: NodeJS.Timeout | null;
75
75
  private runningRegistered;
76
+ private unregisterRunningExecution?;
76
77
  private abortReason;
77
78
  private aborted;
78
79
  constructor(execution: ExecutionModel, options: ProcessorOptions);
@@ -90,6 +90,7 @@ class Processor {
90
90
  abortController = new AbortController();
91
91
  timeoutGuard = null;
92
92
  runningRegistered = false;
93
+ unregisterRunningExecution;
93
94
  abortReason = null;
94
95
  aborted = false;
95
96
  get abortSignal() {
@@ -461,34 +462,40 @@ class Processor {
461
462
  }
462
463
  if (this.jobsToSave.size) {
463
464
  const newJobs = [];
465
+ const JobCollection = this.options.plugin.db.getCollection("jobs");
466
+ const JobsModel = this.options.plugin.db.getModel("jobs");
464
467
  for (const job of this.jobsToSave.values()) {
465
468
  if (job.isNewRecord) {
466
469
  newJobs.push(job);
467
470
  } else {
468
- const JobCollection = this.options.plugin.db.getCollection("jobs");
469
471
  const changes = [];
470
472
  if (job.changed("status")) {
471
- changes.push([`status`, job.status]);
472
- job.changed("status", false);
473
+ changes.push(["status", job.status]);
473
474
  }
474
475
  if (job.changed("meta")) {
475
- changes.push([`meta`, JSON.stringify(job.meta ?? null)]);
476
- job.changed("meta", false);
476
+ changes.push(["meta", JSON.stringify(job.meta ?? null)]);
477
477
  }
478
478
  if (job.changed("result")) {
479
- changes.push([`result`, JSON.stringify(job.result ?? null)]);
480
- job.changed("result", false);
479
+ changes.push(["result", JSON.stringify(job.result ?? null)]);
480
+ }
481
+ if (job.changed("startedAt")) {
482
+ changes.push(["startedAt", job.startedAt]);
481
483
  }
482
484
  if (changes.length) {
485
+ const idColumn = JobsModel.rawAttributes.id.field || "id";
483
486
  await this.options.plugin.db.sequelize.query(
484
- `UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(([key]) => `${key} = ?`)} WHERE id='${job.id}'`,
487
+ `UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(
488
+ ([field]) => `${this.options.plugin.db.quoteIdentifier(JobsModel.rawAttributes[field].field || field)} = ?`
489
+ )} WHERE ${this.options.plugin.db.quoteIdentifier(idColumn)}='${job.id}'`,
485
490
  { replacements: changes.map(([, value]) => value) }
486
491
  );
492
+ for (const [field] of changes) {
493
+ job.changed(field, false);
494
+ }
487
495
  }
488
496
  }
489
497
  }
490
498
  if (newJobs.length) {
491
- const JobsModel = this.options.plugin.db.getModel("jobs");
492
499
  for (let offset = 0; offset < newJobs.length; offset += JOB_SAVE_BATCH_SIZE) {
493
500
  const batch = newJobs.slice(offset, offset + JOB_SAVE_BATCH_SIZE);
494
501
  await JobsModel.bulkCreate(
@@ -644,6 +651,7 @@ class Processor {
644
651
  const { database } = this.execution.constructor;
645
652
  const model = database.getModel("jobs");
646
653
  let job;
654
+ const startedAt = Object.prototype.hasOwnProperty.call(payload, "startedAt") ? payload.startedAt : /* @__PURE__ */ new Date();
647
655
  if (payload instanceof model) {
648
656
  job = payload;
649
657
  job.set("updatedAt", /* @__PURE__ */ new Date());
@@ -653,6 +661,7 @@ class Processor {
653
661
  status: payload.status,
654
662
  result: Object.prototype.hasOwnProperty.call(payload, "result") ? payload.result : null,
655
663
  meta: Object.prototype.hasOwnProperty.call(payload, "meta") ? payload.meta : null,
664
+ startedAt,
656
665
  updatedAt: /* @__PURE__ */ new Date()
657
666
  });
658
667
  } else {
@@ -660,6 +669,7 @@ class Processor {
660
669
  {
661
670
  ...payload,
662
671
  id: this.options.plugin.snowflake.getUniqueID().toString(),
672
+ startedAt,
663
673
  createdAt: /* @__PURE__ */ new Date(),
664
674
  updatedAt: /* @__PURE__ */ new Date(),
665
675
  executionId: this.execution.id
@@ -688,7 +698,10 @@ class Processor {
688
698
  this.options.plugin.timeoutManager.clear(this.execution.id);
689
699
  this.abortReason = null;
690
700
  this.aborted = false;
691
- this.options.plugin.registerRunningExecution(this.execution.id, (reason) => this.abortExecution(reason));
701
+ this.unregisterRunningExecution = this.options.plugin.registerRunningExecution(
702
+ this.execution.id,
703
+ (reason) => this.abortExecution(reason)
704
+ );
692
705
  this.runningRegistered = true;
693
706
  const remaining = this.execution.expiresAt ? this.execution.expiresAt.getTime() - Date.now() : null;
694
707
  if (remaining == null) {
@@ -704,6 +717,7 @@ class Processor {
704
717
  return this.options.plugin.timeoutManager.shouldContinue(this.execution);
705
718
  }
706
719
  leaveRunningState() {
720
+ var _a;
707
721
  if (this.timeoutGuard) {
708
722
  clearTimeout(this.timeoutGuard);
709
723
  this.timeoutGuard = null;
@@ -711,7 +725,8 @@ class Processor {
711
725
  if (!this.runningRegistered) {
712
726
  return;
713
727
  }
714
- this.options.plugin.unregisterRunningExecution(this.execution.id);
728
+ (_a = this.unregisterRunningExecution) == null ? void 0 : _a.call(this);
729
+ this.unregisterRunningExecution = void 0;
715
730
  this.runningRegistered = false;
716
731
  }
717
732
  /**
@@ -11,8 +11,8 @@ type AbortHandler = {
11
11
  };
12
12
  export default class RunningExecutionRegistry {
13
13
  private readonly executions;
14
- register(executionId: number | string, handler: AbortHandler): void;
15
- unregister(executionId: number | string): void;
14
+ register(executionId: number | string, handler: AbortHandler): () => void;
15
+ unregister(executionId: number | string, handler?: AbortHandler): void;
16
16
  abort(executionId: number | string, reason?: string): boolean;
17
17
  }
18
18
  export {};
@@ -32,17 +32,32 @@ module.exports = __toCommonJS(RunningExecutionRegistry_exports);
32
32
  class RunningExecutionRegistry {
33
33
  executions = /* @__PURE__ */ new Map();
34
34
  register(executionId, handler) {
35
- this.executions.set(String(executionId), handler);
35
+ const key = String(executionId);
36
+ const handlers = this.executions.get(key) ?? /* @__PURE__ */ new Set();
37
+ handlers.add(handler);
38
+ this.executions.set(key, handlers);
39
+ return () => this.unregister(executionId, handler);
36
40
  }
37
- unregister(executionId) {
38
- this.executions.delete(String(executionId));
41
+ unregister(executionId, handler) {
42
+ const key = String(executionId);
43
+ if (!handler) {
44
+ this.executions.delete(key);
45
+ return;
46
+ }
47
+ const handlers = this.executions.get(key);
48
+ handlers == null ? void 0 : handlers.delete(handler);
49
+ if (!(handlers == null ? void 0 : handlers.size)) {
50
+ this.executions.delete(key);
51
+ }
39
52
  }
40
53
  abort(executionId, reason) {
41
- const handler = this.executions.get(String(executionId));
42
- if (!handler) {
54
+ const handlers = this.executions.get(String(executionId));
55
+ if (!(handlers == null ? void 0 : handlers.size)) {
43
56
  return false;
44
57
  }
45
- handler.abort(reason);
58
+ for (const handler of handlers) {
59
+ handler.abort(reason);
60
+ }
46
61
  return true;
47
62
  }
48
63
  }
@@ -225,7 +225,7 @@ async function execute(context, next) {
225
225
  filter: { key: workflow.key }
226
226
  });
227
227
  let newVersion;
228
- if (executed == 0 && autoRevision) {
228
+ if (executed === 0 && Number(autoRevision) === 1) {
229
229
  newVersion = await repository.revision({
230
230
  filterByTk: workflow.id,
231
231
  filter: { key: workflow.key },
@@ -16,6 +16,7 @@ export default class JobModel extends Model {
16
16
  status: number;
17
17
  result?: any;
18
18
  meta?: any;
19
+ startedAt?: Date | null;
19
20
  createdAt: Date;
20
21
  updatedAt: Date;
21
22
  upstreamId: number;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
7
7
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
8
8
  "description.ru-RU": "Мощный инструмент BPM, обеспечивающий базовую поддержку автоматизации бизнес-процессов с возможностью неограниченного расширения триггеров и узлов.",
9
- "version": "2.2.0-beta.16",
9
+ "version": "2.2.0-beta.17",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow",
@@ -51,7 +51,7 @@
51
51
  "@nocobase/test": "2.x",
52
52
  "@nocobase/utils": "2.x"
53
53
  },
54
- "gitHead": "49d9bd2e21122eab9435f128375828b8c5bb4c07",
54
+ "gitHead": "d7a69c4f47fe38b17a2ce1408258902cf64f6c83",
55
55
  "keywords": [
56
56
  "Workflow"
57
57
  ]