@nocobase/plugin-workflow 1.9.30 → 1.9.32

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,7 +11,7 @@ import { CollectionManager } from '@nocobase/client';
11
11
  export type VariableOption = {
12
12
  key?: string;
13
13
  value?: string;
14
- label?: string;
14
+ label?: string | React.ReactNode;
15
15
  children?: VariableOption[] | null;
16
16
  [key: string]: any;
17
17
  };
@@ -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.9.30",
15
- "@nocobase/utils": "1.9.30",
14
+ "@nocobase/client": "1.9.32",
15
+ "@nocobase/utils": "1.9.32",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "react-router-dom": "6.28.1",
@@ -20,17 +20,17 @@ module.exports = {
20
20
  "lodash": "4.17.21",
21
21
  "@dnd-kit/core": "6.1.0",
22
22
  "@formily/shared": "2.3.2",
23
- "@nocobase/plugin-mobile": "1.9.30",
23
+ "@nocobase/plugin-mobile": "1.9.32",
24
24
  "sequelize": "6.35.2",
25
- "@nocobase/server": "1.9.30",
26
- "@nocobase/database": "1.9.30",
27
- "@nocobase/data-source-manager": "1.9.30",
28
- "@nocobase/logger": "1.9.30",
29
- "@nocobase/evaluators": "1.9.30",
25
+ "@nocobase/server": "1.9.32",
26
+ "@nocobase/database": "1.9.32",
27
+ "@nocobase/data-source-manager": "1.9.32",
28
+ "@nocobase/logger": "1.9.32",
29
+ "@nocobase/evaluators": "1.9.32",
30
30
  "@formily/antd-v5": "1.2.3",
31
31
  "@formily/reactive": "2.3.0",
32
- "@nocobase/actions": "1.9.30",
32
+ "@nocobase/actions": "1.9.32",
33
33
  "dayjs": "1.11.13",
34
- "@nocobase/plugin-workflow-test": "1.9.30",
35
- "@nocobase/test": "1.9.30"
34
+ "@nocobase/plugin-workflow-test": "1.9.32",
35
+ "@nocobase/test": "1.9.32"
36
36
  };
@@ -1,4 +1,6 @@
1
1
  {
2
+ "53 bit (JavaScript safe) unique ID generated by Snowflake algorithm. Will always generate new one each time use this variable.": "53 bit (JavaScript safe) unique ID generated by Snowflake algorithm. Will always generate new one each time use this variable.",
3
+ "53-bit Snowflake ID doc link": "https://v2.docs.nocobase.com/data-sources/data-modeling/collection-fields/advanced/snowflake-id",
2
4
  "\"Submit to workflow\" to \"Post-action event\" is deprecated, please use \"Custom action event\" instead.": "\"Submit to workflow\" to \"Post-action event\" is deprecated, please use \"Custom action event\" instead.",
3
5
  "\"{{branchName}}\" branch": "\"{{branchName}}\" branch",
4
6
  "A new version will be created automatically after execution if current version is not executed.": "A new version will be created automatically after execution if current version is not executed.",
@@ -107,6 +109,7 @@
107
109
  "Inside of \"{{branchName}}\" branch": "Inside of \"{{branchName}}\" branch",
108
110
  "Inside of branch": "Inside of branch",
109
111
  "Keep": "Keep",
112
+ "Learn more": "Learn more",
110
113
  "Load failed": "Load failed",
111
114
  "Loading": "Loading",
112
115
  "Log": "Log",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "53 bit (JavaScript safe) unique ID generated by Snowflake algorithm. Will always generate new one each time use this variable.": "53 位长度(JavaScript 安全)雪花算法唯一 ID,每次使用该变量都会生成一个新的 ID。",
3
+ "53-bit Snowflake ID doc link": "https://v2.docs.nocobase.com/cn/data-sources/data-modeling/collection-fields/advanced/snowflake-id",
2
4
  "\"Submit to workflow\" to \"Post-action event\" is deprecated, please use \"Custom action event\" instead.": "“提交至工作流”到“操作后事件”的方式已被弃用,请使用“自定义操作事件”代替。",
3
5
  "\"{{branchName}}\" branch": "“{{branchName}}”分支",
4
6
  "A new version will be created automatically after execution if current version is not executed.": "如果当前版本还未执行过,将在执行后自动创建一个新版本。",
@@ -107,6 +109,7 @@
107
109
  "Inside of \"{{branchName}}\" branch": "“{{branchName}}”分支内",
108
110
  "Inside of branch": "分支内",
109
111
  "Keep": "保留",
112
+ "Learn more": "了解更多",
110
113
  "Load failed": "加载失败",
111
114
  "Loading": "加载中",
112
115
  "Log": "日志",
@@ -176,6 +179,9 @@
176
179
  "Syntax references: ": "语法参考:",
177
180
  "System time": "系统时间",
178
181
  "System variables": "系统变量",
182
+ "Generate snowflake ID": "生成雪花 ID",
183
+ "Instance ID": "应用实例 ID",
184
+ "The ID of current server instance": "当前服务器实例的 ID",
179
185
  "Task type {{type}} is invalid": "待办类型 {{type}} 无效",
180
186
  "Test run": "测试执行",
181
187
  "Test run will do the actual data manipulating or API calling, please use with caution.": "测试执行会进行实际的数据操作或 API 调用,请谨慎使用。",
@@ -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-12-19T10:42:53.763Z"}
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-12-24T08:40:44.329Z"}
@@ -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-12-19T10:42:53.415Z"}
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-12-24T08:40:43.987Z"}
@@ -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-12-19T10:42:53.218Z"}
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-12-24T08:40:43.797Z"}
@@ -297,6 +297,9 @@ class PluginWorkflowServer extends import_server.Plugin {
297
297
  this.initTriggers(options.triggers);
298
298
  this.initInstructions(options.instructions);
299
299
  (0, import_functions.default)(this, options.functions);
300
+ this.functions.register("instanceId", () => this.app.instanceId);
301
+ this.functions.register("epoch", () => 1605024e3);
302
+ this.functions.register("genSnowflakeId", () => this.app.snowflakeIdGenerator.generate());
300
303
  this.loggerCache = new import_lru_cache.default({
301
304
  max: 20,
302
305
  updateAgeOnGet: true,
@@ -21,7 +21,9 @@ export type InstructionInterface = {
21
21
  run: Runner;
22
22
  resume?: Runner;
23
23
  getScope?: (node: FlowNodeModel, data: any, processor: Processor) => any;
24
- duplicateConfig?: (node: FlowNodeModel, options: Transactionable) => object | Promise<object>;
24
+ duplicateConfig?: (node: FlowNodeModel, options: Transactionable & {
25
+ origin?: FlowNodeModel;
26
+ }) => object | Promise<object>;
25
27
  test?: (config: Record<string, any>) => IJob | Promise<IJob>;
26
28
  };
27
29
  export declare abstract class Instruction implements InstructionInterface {
@@ -75,7 +75,7 @@ class WorkflowRepository extends import_database.Repository {
75
75
  transaction
76
76
  });
77
77
  if (trigger && typeof trigger.duplicateConfig === "function") {
78
- const newConfig = await trigger.duplicateConfig(instance, { transaction });
78
+ const newConfig = await trigger.duplicateConfig(instance, { origin, transaction });
79
79
  await instance.update({ config: newConfig }, { transaction });
80
80
  }
81
81
  const originalNodesMap = /* @__PURE__ */ new Map();
@@ -90,12 +90,15 @@ class WorkflowRepository extends import_database.Repository {
90
90
  {
91
91
  type: node.type,
92
92
  key: node.key,
93
- config: typeof instruction.duplicateConfig === "function" ? await instruction.duplicateConfig(node, { transaction }) : node.config,
93
+ config: node.config,
94
94
  title: node.title,
95
95
  branchIndex: node.branchIndex
96
96
  },
97
97
  { transaction }
98
98
  );
99
+ if (typeof instruction.duplicateConfig === "function") {
100
+ await instruction.duplicateConfig(newNode, { origin: node, transaction });
101
+ }
99
102
  oldToNew.set(node.id, newNode);
100
103
  newToOld.set(newNode.id, node);
101
104
  }
@@ -16,7 +16,9 @@ export declare abstract class Trigger {
16
16
  on(workflow: WorkflowModel): void;
17
17
  off(workflow: WorkflowModel): void;
18
18
  validateEvent(workflow: WorkflowModel, context: any, options: Transactionable): boolean | Promise<boolean>;
19
- duplicateConfig?(workflow: WorkflowModel, options: Transactionable): object | Promise<object>;
19
+ duplicateConfig?(workflow: WorkflowModel, options: Transactionable & {
20
+ origin?: WorkflowModel;
21
+ }): object | Promise<object>;
20
22
  validateContext?(values: any, workflow: WorkflowModel): null | void | {
21
23
  [key: string]: string;
22
24
  };
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": "1.9.30",
9
+ "version": "1.9.32",
10
10
  "license": "AGPL-3.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow",
@@ -48,7 +48,7 @@
48
48
  "@nocobase/test": "1.x",
49
49
  "@nocobase/utils": "1.x"
50
50
  },
51
- "gitHead": "1396429d1957cb719fbb7960dc8cc76e80a7b049",
51
+ "gitHead": "40b6cf8117d8ae2435fead40d26d12647706f852",
52
52
  "keywords": [
53
53
  "Workflow"
54
54
  ]