@nocobase/plugin-workflow 1.7.0-alpha.14 → 1.7.0-alpha.15

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.
@@ -11,24 +11,24 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.0",
13
13
  "@formily/react": "2.3.0",
14
- "@nocobase/client": "1.7.0-alpha.14",
15
- "@nocobase/utils": "1.7.0-alpha.14",
14
+ "@nocobase/client": "1.7.0-alpha.15",
15
+ "@nocobase/utils": "1.7.0-alpha.15",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "react-router-dom": "6.28.1",
19
19
  "react-i18next": "11.18.6",
20
20
  "lodash": "4.17.21",
21
21
  "sequelize": "6.35.2",
22
- "@nocobase/database": "1.7.0-alpha.14",
23
- "@nocobase/server": "1.7.0-alpha.14",
24
- "@nocobase/data-source-manager": "1.7.0-alpha.14",
25
- "@nocobase/logger": "1.7.0-alpha.14",
26
- "@nocobase/evaluators": "1.7.0-alpha.14",
22
+ "@nocobase/database": "1.7.0-alpha.15",
23
+ "@nocobase/server": "1.7.0-alpha.15",
24
+ "@nocobase/data-source-manager": "1.7.0-alpha.15",
25
+ "@nocobase/logger": "1.7.0-alpha.15",
26
+ "@nocobase/evaluators": "1.7.0-alpha.15",
27
27
  "@formily/antd-v5": "1.2.3",
28
28
  "@formily/reactive": "2.3.0",
29
29
  "@formily/shared": "2.3.2",
30
- "@nocobase/actions": "1.7.0-alpha.14",
30
+ "@nocobase/actions": "1.7.0-alpha.15",
31
31
  "dayjs": "1.11.13",
32
- "@nocobase/plugin-workflow-test": "1.7.0-alpha.14",
33
- "@nocobase/test": "1.7.0-alpha.14"
32
+ "@nocobase/plugin-workflow-test": "1.7.0-alpha.15",
33
+ "@nocobase/test": "1.7.0-alpha.15"
34
34
  };
@@ -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":"2025-05-20T16:11:23.611Z"}
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":"2025-05-28T07:15:44.675Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-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"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-05-20T16:11:23.270Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-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"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-05-28T07:15:44.315Z"}
@@ -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":"2025-05-20T16:11:23.074Z"}
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":"2025-05-28T07:15:44.140Z"}
@@ -41,6 +41,7 @@ export default class PluginWorkflowServer extends Plugin {
41
41
  private loggerCache;
42
42
  private meter;
43
43
  private checker;
44
+ private onQueueExecution;
44
45
  private onBeforeSave;
45
46
  private onAfterCreate;
46
47
  private onAfterUpdate;
@@ -75,6 +75,20 @@ class PluginWorkflowServer extends import_server.Plugin {
75
75
  loggerCache;
76
76
  meter = null;
77
77
  checker = null;
78
+ onQueueExecution = async (event) => {
79
+ const ExecutionRepo = this.db.getRepository("executions");
80
+ const execution = await ExecutionRepo.findOne({
81
+ filterByTk: event.executionId
82
+ });
83
+ if (!execution || execution.status !== import_constants.EXECUTION_STATUS.QUEUEING) {
84
+ return;
85
+ }
86
+ this.getLogger(execution.workflowId).info(
87
+ `execution (${execution.id}) received from queue, adding to pending list`
88
+ );
89
+ this.pending.push([execution]);
90
+ this.dispatch();
91
+ };
78
92
  onBeforeSave = async (instance, { transaction, cycling }) => {
79
93
  if (cycling) {
80
94
  return;
@@ -172,6 +186,7 @@ class PluginWorkflowServer extends import_server.Plugin {
172
186
  this.ready = true;
173
187
  };
174
188
  onBeforeStop = async () => {
189
+ this.app.logger.info(`stopping workflow plugin before app (${this.app.name}) shutdown...`);
175
190
  for (const workflow of this.enabledCache.values()) {
176
191
  this.toggle(workflow, false, { silent: true });
177
192
  }
@@ -285,6 +300,10 @@ class PluginWorkflowServer extends import_server.Plugin {
285
300
  this.snowflake = new import_nodejs_snowflake.Snowflake({
286
301
  custom_epoch: pluginRecord == null ? void 0 : pluginRecord.createdAt.getTime()
287
302
  });
303
+ this.app.eventQueue.subscribe(`${this.name}.pendingExecution`, {
304
+ idle: () => !this.executing && !this.pending.length && !this.events.length,
305
+ process: this.onQueueExecution
306
+ });
288
307
  }
289
308
  /**
290
309
  * @internal
@@ -540,8 +559,14 @@ class PluginWorkflowServer extends import_server.Plugin {
540
559
  logger.info(`preparing execution for event`);
541
560
  try {
542
561
  const execution = await this.createExecution(...event);
543
- if ((execution == null ? void 0 : execution.status) === import_constants.EXECUTION_STATUS.QUEUEING && !this.executing && !this.pending.length) {
544
- this.pending.push([execution]);
562
+ if ((execution == null ? void 0 : execution.status) === import_constants.EXECUTION_STATUS.QUEUEING) {
563
+ if (!this.executing && !this.pending.length) {
564
+ logger.info(`local pending list is empty, adding execution (${execution.id}) to pending list`);
565
+ this.pending.push([execution]);
566
+ } else {
567
+ logger.info(`local pending list is not empty, sending execution (${execution.id}) to queue`);
568
+ this.app.eventQueue.publish(`${this.name}.pendingExecution`, { executionId: execution.id });
569
+ }
545
570
  }
546
571
  } catch (error) {
547
572
  logger.error(`failed to create execution:`, { error });
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
6
6
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
7
- "version": "1.7.0-alpha.14",
7
+ "version": "1.7.0-alpha.15",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
12
12
  "dependencies": {
13
- "@nocobase/plugin-workflow-test": "1.7.0-alpha.14"
13
+ "@nocobase/plugin-workflow-test": "1.7.0-alpha.15"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@ant-design/icons": "5.x",
@@ -46,7 +46,7 @@
46
46
  "@nocobase/test": "1.x",
47
47
  "@nocobase/utils": "1.x"
48
48
  },
49
- "gitHead": "726870b3afcd0ae02a353730a1dffe7da9be6f1c",
49
+ "gitHead": "abedb555b92d597b96d55663a9f8109e7ab85fa9",
50
50
  "keywords": [
51
51
  "Workflow"
52
52
  ]