@nocobase/plugin-workflow 0.21.0-alpha.13 → 0.21.0-alpha.14

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.
@@ -2,23 +2,23 @@ module.exports = {
2
2
  "react": "18.2.0",
3
3
  "antd": "5.12.8",
4
4
  "@ant-design/icons": "5.2.6",
5
- "@nocobase/client": "0.21.0-alpha.13",
5
+ "@nocobase/client": "0.21.0-alpha.14",
6
6
  "react-router-dom": "6.21.0",
7
- "@nocobase/utils": "0.21.0-alpha.13",
7
+ "@nocobase/utils": "0.21.0-alpha.14",
8
8
  "react-i18next": "11.18.6",
9
9
  "@formily/core": "2.3.0",
10
10
  "@formily/react": "2.3.0",
11
- "@nocobase/database": "0.21.0-alpha.13",
12
- "@nocobase/server": "0.21.0-alpha.13",
13
- "@nocobase/logger": "0.21.0-alpha.13",
14
- "@nocobase/evaluators": "0.21.0-alpha.13",
11
+ "@nocobase/database": "0.21.0-alpha.14",
12
+ "@nocobase/server": "0.21.0-alpha.14",
13
+ "@nocobase/logger": "0.21.0-alpha.14",
14
+ "@nocobase/evaluators": "0.21.0-alpha.14",
15
15
  "@formily/shared": "2.3.0",
16
16
  "lodash": "4.17.21",
17
17
  "@formily/antd-v5": "1.1.9",
18
- "@nocobase/actions": "0.21.0-alpha.13",
19
- "@nocobase/data-source-manager": "0.21.0-alpha.13",
18
+ "@nocobase/actions": "0.21.0-alpha.14",
19
+ "@nocobase/data-source-manager": "0.21.0-alpha.14",
20
20
  "sequelize": "6.35.2",
21
- "@nocobase/plugin-workflow-test": "0.21.0-alpha.13",
22
- "@nocobase/test": "0.21.0-alpha.13",
21
+ "@nocobase/plugin-workflow-test": "0.21.0-alpha.14",
22
+ "@nocobase/test": "0.21.0-alpha.14",
23
23
  "dayjs": "1.11.10"
24
24
  };
@@ -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":"2024-04-21T04:16:52.998Z"}
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":"2024-04-22T03:37:22.064Z"}
@@ -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":"2024-04-21T04:16:52.677Z"}
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":"2024-04-22T03:37:21.726Z"}
@@ -20,6 +20,7 @@ export default class PluginWorkflowServer extends Plugin {
20
20
  private eventsCount;
21
21
  private loggerCache;
22
22
  private meter;
23
+ private checker;
23
24
  private onBeforeSave;
24
25
  /**
25
26
  * @experimental
@@ -60,6 +60,7 @@ class PluginWorkflowServer extends import_server.Plugin {
60
60
  eventsCount = 0;
61
61
  loggerCache;
62
62
  meter = null;
63
+ checker = null;
63
64
  onBeforeSave = async (instance, options) => {
64
65
  const Model = instance.constructor;
65
66
  if (instance.enabled) {
@@ -223,6 +224,9 @@ class PluginWorkflowServer extends import_server.Plugin {
223
224
  workflows.forEach((workflow) => {
224
225
  this.toggle(workflow);
225
226
  });
227
+ this.checker = setInterval(() => {
228
+ this.dispatch();
229
+ }, 3e5);
226
230
  });
227
231
  this.app.on("afterStart", () => {
228
232
  this.app.setMaintainingMessage("check for not started executions");
@@ -244,6 +248,9 @@ class PluginWorkflowServer extends import_server.Plugin {
244
248
  if (this.executing) {
245
249
  await this.executing;
246
250
  }
251
+ if (this.checker) {
252
+ clearInterval(this.checker);
253
+ }
247
254
  });
248
255
  }
249
256
  toggle(workflow, enable) {
@@ -397,32 +404,35 @@ class PluginWorkflowServer extends import_server.Plugin {
397
404
  }
398
405
  this.executing = (async () => {
399
406
  let next = null;
400
- if (this.pending.length) {
401
- next = this.pending.shift();
402
- this.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
403
- } else {
404
- const execution = await this.db.getRepository("executions").findOne({
405
- filter: {
406
- status: import_constants.EXECUTION_STATUS.QUEUEING,
407
- "workflow.enabled": true,
408
- "workflow.id": {
409
- [import_database.Op.not]: null
410
- }
411
- },
412
- appends: ["workflow"],
413
- sort: "createdAt"
414
- });
415
- if (execution) {
416
- this.getLogger(execution.workflowId).info(`execution (${execution.id}) fetched from db`);
417
- next = [execution];
407
+ try {
408
+ if (this.pending.length) {
409
+ next = this.pending.shift();
410
+ this.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
411
+ } else {
412
+ const execution = await this.db.getRepository("executions").findOne({
413
+ filter: {
414
+ status: import_constants.EXECUTION_STATUS.QUEUEING,
415
+ "workflow.enabled": true,
416
+ "workflow.id": {
417
+ [import_database.Op.not]: null
418
+ }
419
+ },
420
+ appends: ["workflow"],
421
+ sort: "id"
422
+ });
423
+ if (execution) {
424
+ this.getLogger(execution.workflowId).info(`execution (${execution.id}) fetched from db`);
425
+ next = [execution];
426
+ }
427
+ }
428
+ if (next) {
429
+ await this.process(...next);
430
+ }
431
+ } finally {
432
+ this.executing = null;
433
+ if (next) {
434
+ this.dispatch();
418
435
  }
419
- }
420
- if (next) {
421
- await this.process(...next);
422
- }
423
- this.executing = null;
424
- if (next) {
425
- this.dispatch();
426
436
  }
427
437
  })();
428
438
  }
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": "0.21.0-alpha.13",
7
+ "version": "0.21.0-alpha.14",
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": "0.21.0-alpha.13"
13
+ "@nocobase/plugin-workflow-test": "0.21.0-alpha.14"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@ant-design/icons": "5.x",
@@ -44,7 +44,7 @@
44
44
  "@nocobase/test": "0.x",
45
45
  "@nocobase/utils": "0.x"
46
46
  },
47
- "gitHead": "27fced984ff80c7673ad49b6a7365578ca309fe7",
47
+ "gitHead": "dbcca03c0535e14f0b09fd13306731b4438829c4",
48
48
  "keywords": [
49
49
  "Workflow"
50
50
  ]