@nocobase/plugin-workflow 1.7.14 → 1.7.16

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.
@@ -223,6 +223,20 @@ declare const _default: {
223
223
  constraints?: undefined;
224
224
  through?: undefined;
225
225
  otherKey?: undefined;
226
+ } | {
227
+ type: string;
228
+ name: string;
229
+ target: string;
230
+ foreignKey: string;
231
+ sourceKey: string;
232
+ constraints: boolean;
233
+ interface?: undefined;
234
+ uiSchema?: undefined;
235
+ defaultValue?: undefined;
236
+ required?: undefined;
237
+ onDelete?: undefined;
238
+ through?: undefined;
239
+ otherKey?: undefined;
226
240
  } | {
227
241
  type: string;
228
242
  name: string;
@@ -170,8 +170,7 @@ var workflows_default = {
170
170
  target: "workflowStats",
171
171
  foreignKey: "key",
172
172
  sourceKey: "key",
173
- constraints: false,
174
- onDelete: "CASCADE"
173
+ constraints: false
175
174
  // interface: 'oho',
176
175
  // uiSchema: {
177
176
  // type: 'object',
@@ -11,8 +11,8 @@ 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.14",
15
- "@nocobase/utils": "1.7.14",
14
+ "@nocobase/client": "1.7.16",
15
+ "@nocobase/utils": "1.7.16",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "react-router-dom": "6.28.1",
@@ -21,15 +21,15 @@ module.exports = {
21
21
  "@dnd-kit/core": "6.1.0",
22
22
  "@formily/shared": "2.3.2",
23
23
  "sequelize": "6.35.2",
24
- "@nocobase/database": "1.7.14",
25
- "@nocobase/server": "1.7.14",
26
- "@nocobase/data-source-manager": "1.7.14",
27
- "@nocobase/logger": "1.7.14",
28
- "@nocobase/evaluators": "1.7.14",
24
+ "@nocobase/database": "1.7.16",
25
+ "@nocobase/server": "1.7.16",
26
+ "@nocobase/data-source-manager": "1.7.16",
27
+ "@nocobase/logger": "1.7.16",
28
+ "@nocobase/evaluators": "1.7.16",
29
29
  "@formily/antd-v5": "1.2.3",
30
30
  "@formily/reactive": "2.3.0",
31
- "@nocobase/actions": "1.7.14",
31
+ "@nocobase/actions": "1.7.16",
32
32
  "dayjs": "1.11.13",
33
- "@nocobase/plugin-workflow-test": "1.7.14",
34
- "@nocobase/test": "1.7.14"
33
+ "@nocobase/plugin-workflow-test": "1.7.16",
34
+ "@nocobase/test": "1.7.16"
35
35
  };
@@ -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-06-17T16:41:01.240Z"}
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-06-19T16:45:21.890Z"}
@@ -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-06-17T16:41:00.932Z"}
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-06-19T16:45:21.566Z"}
@@ -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-06-17T16:41:00.773Z"}
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-06-19T16:45:21.394Z"}
@@ -52,8 +52,7 @@ async function create(context, next) {
52
52
  context.body = await db.sequelize.transaction(async (transaction) => {
53
53
  const workflow = await repository.getSourceModel(transaction);
54
54
  workflow.versionStats = await workflow.getVersionStats({ transaction });
55
- const { executed } = workflow.versionStats;
56
- if (executed) {
55
+ if (workflow.versionStats.executed > 0) {
57
56
  context.throw(400, "Node could not be created in executed workflow");
58
57
  }
59
58
  const instance = await repository.create({
@@ -147,7 +146,7 @@ async function destroy(context, next) {
147
146
  fields: [...fields, "workflowId"],
148
147
  appends: ["upstream", "downstream", "workflow.versionStats.executed"]
149
148
  });
150
- if (instance.workflow.versionStats.executed) {
149
+ if (instance.workflow.versionStats.executed > 0) {
151
150
  context.throw(400, "Nodes in executed workflow could not be deleted");
152
151
  }
153
152
  await db.sequelize.transaction(async (transaction) => {
@@ -207,7 +206,7 @@ async function update(context, next) {
207
206
  appends: ["workflow.versionStats.executed"],
208
207
  transaction
209
208
  });
210
- if (workflow.versionStats.executed) {
209
+ if (workflow.versionStats.executed > 0) {
211
210
  context.throw(400, "Nodes in executed workflow could not be reconfigured");
212
211
  }
213
212
  return repository.update({
@@ -57,7 +57,7 @@ async function update(context, next) {
57
57
  filterByTk,
58
58
  appends: ["versionStats"]
59
59
  });
60
- if (workflow.versionStats.executed) {
60
+ if (workflow.versionStats.executed > 0) {
61
61
  return context.throw(400, "config of executed workflow can not be updated");
62
62
  }
63
63
  }
@@ -84,11 +84,19 @@ async function destroy(context, next) {
84
84
  transaction
85
85
  });
86
86
  revisions.forEach((item) => ids.add(item.id));
87
- context.body = await repository.destroy({
87
+ const deleted = await repository.destroy({
88
88
  filterByTk: Array.from(ids),
89
89
  individualHooks: true,
90
90
  transaction
91
91
  });
92
+ const StatsRepo = context.db.getRepository("workflowStats");
93
+ await StatsRepo.destroy({
94
+ filter: {
95
+ key: Array.from(keysSet)
96
+ },
97
+ transaction
98
+ });
99
+ context.body = deleted;
92
100
  });
93
101
  next();
94
102
  }
@@ -150,7 +158,7 @@ async function execute(context, next) {
150
158
  filter: { key: workflow.key }
151
159
  });
152
160
  let newVersion;
153
- if (!executed && autoRevision) {
161
+ if (executed == 0 && autoRevision) {
154
162
  newVersion = await repository.revision({
155
163
  filterByTk: workflow.id,
156
164
  filter: { key: workflow.key },
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ appVersion: string;
12
+ on: string;
13
+ up(): Promise<void>;
14
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var add_missed_stats_exports = {};
28
+ __export(add_missed_stats_exports, {
29
+ default: () => add_missed_stats_default
30
+ });
31
+ module.exports = __toCommonJS(add_missed_stats_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class add_missed_stats_default extends import_server.Migration {
34
+ appVersion = "<1.8.0";
35
+ on = "afterLoad";
36
+ async up() {
37
+ const { db } = this.context;
38
+ const WorkflowRepo = db.getRepository("workflows");
39
+ const ExecutionRepo = db.getRepository("executions");
40
+ await db.sequelize.transaction(async (transaction) => {
41
+ const workflows = await WorkflowRepo.find({
42
+ filter: {
43
+ current: true
44
+ },
45
+ appends: ["stats"],
46
+ transaction
47
+ });
48
+ for (const workflow of workflows) {
49
+ if (!workflow.stats) {
50
+ const executed = await ExecutionRepo.count({
51
+ filter: {
52
+ key: workflow.key
53
+ },
54
+ transaction
55
+ }) || workflow.allExecuted || 0;
56
+ await workflow.createStats({ executed }, { transaction });
57
+ }
58
+ }
59
+ });
60
+ }
61
+ }
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.14",
7
+ "version": "1.7.16",
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.14"
13
+ "@nocobase/plugin-workflow-test": "1.7.16"
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": "58bbe59c0c3dca4c8db54ac3d3796de1d1fbd19b",
49
+ "gitHead": "5801f904778c4dee6d602e1f4728cc4fa95967a9",
50
50
  "keywords": [
51
51
  "Workflow"
52
52
  ]