@nocobase/plugin-workflow 2.0.0-beta.8 → 2.0.0

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.
Files changed (52) hide show
  1. package/dist/client/478692c1637f2742.js +10 -0
  2. package/dist/client/AddNodeContext.d.ts +1 -0
  3. package/dist/client/NodeClipboardContext.d.ts +11 -0
  4. package/dist/client/NodeDragContext.d.ts +11 -0
  5. package/dist/client/{c050b1c93ef4392f.js → c1347b9d21f864d9.js} +1 -1
  6. package/dist/client/f39e94207f92e352.js +10 -0
  7. package/dist/client/index.js +1 -1
  8. package/dist/client/models/NodeDetailsGridModel.d.ts +13 -0
  9. package/dist/client/models/TaskCardCommonItemModel.d.ts +14 -0
  10. package/dist/client/models/index.d.ts +1 -0
  11. package/dist/client/nodeVariableUtils.d.ts +14 -0
  12. package/dist/client/nodes/create.d.ts +6 -0
  13. package/dist/client/nodes/index.d.ts +10 -0
  14. package/dist/client/nodes/output.d.ts +53 -0
  15. package/dist/client/nodes/query.d.ts +6 -0
  16. package/dist/client/nodes/update.d.ts +1 -0
  17. package/dist/client/style.d.ts +4 -0
  18. package/dist/client/triggers/collection.d.ts +13 -0
  19. package/dist/client/triggers/index.d.ts +10 -0
  20. package/dist/client/triggers/schedule/index.d.ts +13 -0
  21. package/dist/common/collections/jobs.js +4 -0
  22. package/dist/externalVersion.js +12 -12
  23. package/dist/locale/de-DE.json +9 -2
  24. package/dist/locale/en-US.json +20 -2
  25. package/dist/locale/es-ES.json +9 -2
  26. package/dist/locale/fr-FR.json +9 -2
  27. package/dist/locale/hu-HU.json +10 -2
  28. package/dist/locale/id-ID.json +10 -2
  29. package/dist/locale/it-IT.json +9 -2
  30. package/dist/locale/ja-JP.json +9 -4
  31. package/dist/locale/ko-KR.json +9 -2
  32. package/dist/locale/nl-NL.json +9 -2
  33. package/dist/locale/pt-BR.json +9 -2
  34. package/dist/locale/ru-RU.json +9 -2
  35. package/dist/locale/tr-TR.json +9 -2
  36. package/dist/locale/uk-UA.json +9 -2
  37. package/dist/locale/vi-VN.json +10 -2
  38. package/dist/locale/zh-CN.json +23 -3
  39. package/dist/locale/zh-TW.json +9 -2
  40. package/dist/node_modules/cron-parser/package.json +1 -1
  41. package/dist/node_modules/lru-cache/package.json +1 -1
  42. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  43. package/dist/server/Dispatcher.js +2 -1
  44. package/dist/server/Plugin.js +4 -0
  45. package/dist/server/actions/index.js +2 -0
  46. package/dist/server/actions/nodes.d.ts +2 -0
  47. package/dist/server/actions/nodes.js +281 -2
  48. package/dist/server/instructions/OutputInstruction.d.ts +21 -0
  49. package/dist/server/instructions/OutputInstruction.js +54 -0
  50. package/package.json +2 -2
  51. package/dist/client/40b94f9ce949dab9.js +0 -10
  52. package/dist/client/e078314a62391f36.js +0 -10
@@ -54,7 +54,7 @@
54
54
  "Collection event": "Collection event",
55
55
  "Collection operations": "Collection operations",
56
56
  "Completed": "Completed",
57
- "Concat": "Concat",
57
+ "Concatenate": "Concatenate",
58
58
  "Condition": "Condition",
59
59
  "Condition expression": "Condition expression",
60
60
  "Condition label": "Condition label",
@@ -254,5 +254,12 @@
254
254
  "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
255
255
  "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.",
256
256
  "Yes": "Yes",
257
- "concat": "concat"
257
+ "Failed to move node": "Не вдалося перемістити вузол",
258
+ "Confirm move": "Підтвердити переміщення",
259
+ "Moving this node may remove variable references.": "Переміщення цього вузла може видалити посилання на змінні.",
260
+ "Impacted current node variables": "Змінні, на які посилається поточний вузол",
261
+ "Impacted dependent node variables": "Вузли, які посилаються на змінні поточного вузла",
262
+ "Keep variable references": "Зберегти посилання на змінні",
263
+ "Keeping variable references requires manual adjustment, otherwise workflow may fail.": "Збереження посилань на змінні потребує ручного налаштування, інакше робочий процес може завершитися помилкою.",
264
+ "Failed to update node variables": "Не вдалося оновити змінні вузла"
258
265
  }
@@ -254,5 +254,13 @@
254
254
  "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
255
255
  "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.",
256
256
  "Yes": "Yes",
257
- "concat": "concat"
258
- }
257
+ "concat": "concat",
258
+ "Failed to move node": "Không thể di chuyển nút",
259
+ "Confirm move": "Xác nhận di chuyển",
260
+ "Moving this node may remove variable references.": "Di chuyển nút này có thể loại bỏ các tham chiếu biến.",
261
+ "Impacted current node variables": "Các biến mà nút hiện tại tham chiếu",
262
+ "Impacted dependent node variables": "Các nút tham chiếu đến biến của nút hiện tại",
263
+ "Keep variable references": "Giữ tham chiếu biến",
264
+ "Keeping variable references requires manual adjustment, otherwise workflow may fail.": "Giữ tham chiếu biến cần điều chỉnh thủ công, nếu không quy trình có thể lỗi.",
265
+ "Failed to update node variables": "Không thể cập nhật biến của nút"
266
+ }
@@ -53,10 +53,11 @@
53
53
  "Choose a record or primary key of a record in the collection to trigger.": "选择数据表中的一行记录或者记录的主键来触发。",
54
54
  "Clear all executions": "清除所有执行记录",
55
55
  "Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?": "清空执行记录不会重置执行次数,且执行中的也不会被删除,确定要删除所有执行记录吗?",
56
+ "Collection \"{{collectionName}}\" not found.": "数据表“{{collectionName}}”未找到。",
56
57
  "Collection event": "数据表事件",
57
58
  "Collection operations": "数据表操作",
58
59
  "Completed": "已完成",
59
- "Concat": "连接",
60
+ "Concatenate": "连接",
60
61
  "Condition": "条件判断",
61
62
  "Condition expression": "条件表达式",
62
63
  "Condition label": "条件名称",
@@ -75,6 +76,7 @@
75
76
  "Current version will be deleted (without affecting other versions).": "当前版本将被删除(不影响其他版本)。",
76
77
  "Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.": "工作流中的节点将在同一个事务中运行。任何失败都会导致数据回滚,同时也会回滚相应的执行历史。",
77
78
  "Date range": "日期范围",
79
+ "Data source \"{{dataSourceName}}\" not found.": "数据源“{{dataSourceName}}”未找到。",
78
80
  "Date variables": "日期变量",
79
81
  "Days": "天",
80
82
  "Delete a main version will cause all other revisions to be deleted too.": "删除主版本将导致其他版本一并被删除。",
@@ -120,7 +122,7 @@
120
122
  "Hours": "小时",
121
123
  "If checked, all nodes in-progress could continue to be processed in execution of disabled workflow. Otherwise, all nodes in-progress will be aborted automatically.": "如果选中,在途的节点在禁用或升级到新版本的工作流中将继续处理。否则将自动取消执行。",
122
124
  "If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.": "选中后,当查询结果有多条记录时,会返回数组作为结果,可以使用循环节点对它逐条操作;否则,仅返回一条数据。",
123
- "If the number of loop calls is too large, there will be performance issues.": "If the number of loop calls is too large, there will be performance issues.",
125
+ "Input workflow result": "请输入工作流执行结果",
124
126
  "Inside of \"No\" branch": "“否”分支内",
125
127
  "Inside of \"Yes\" branch": "“是”分支内",
126
128
  "Inside of \"{{branchName}}\" branch": "“{{branchName}}”分支内",
@@ -161,6 +163,8 @@
161
163
  "Operations": "操作",
162
164
  "Operator": "运算符",
163
165
  "Otherwise": "否则",
166
+ "Output": "流程输出",
167
+ "Output value": "结果值",
164
168
  "Pending": "待处理",
165
169
  "Please add at least one condition": "请添加至少一个条件",
166
170
  "Please select collection first": "请先选择数据表",
@@ -186,6 +190,7 @@
186
190
  "Select context": "选择上下文",
187
191
  "Select users": "选择用户",
188
192
  "Select workflow": "选择工作流",
193
+ "Set output data of this workflow. When this one is executed as a subflow, the output could be used as variables in downstream nodes of super workflow. You can also use this node in an AI employee workflow, to define what to output. If this node is added multiple times, the value of the last executed node prevails.": "设置工作流的输出数据。在作为子流程执行后可以被上级流程后续节点使用。你也可以在 AI 员工工作流中使用此节点,来定义输出内容。如果多次添加此节点,则以最后一个被执行的节点的值为准。",
189
194
  "Single record": "单条数据",
190
195
  "Some node meets error.": "某个节点出错。",
191
196
  "Started and executing, maybe waiting for an async callback (manual, delay etc.).": "已开始执行,可能在等待异步回调(人工、延时等)。",
@@ -261,5 +266,20 @@
261
266
  "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "按钮点击后直接触发工作流,但不会保存数据。仅支持绑定“自定义操作事件”。",
262
267
  "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "未知类型的工作流会导致错误,请删除或检查提供该类型的插件。",
263
268
  "Yes": "是",
264
- "concat": "连接"
269
+ "Failed to move node": "节点移动失败",
270
+ "Confirm move": "确认移动",
271
+ "Moving this node may remove variable references.": "移动该节点可能会移除变量引用。",
272
+ "Impacted current node variables": "当前节点引用的变量",
273
+ "Impacted dependent node variables": "引用当前节点变量的节点",
274
+ "Keep variable references": "保留变量引用,我将手动修复",
275
+ "Keeping variable references requires manual adjustment, otherwise workflow may fail.": "已保留变量引用,请手动调整,否则工作流执行可能出错。",
276
+ "Failed to update node variables": "更新节点变量失败",
277
+ "Copy": "复制",
278
+ "Cancel copy": "取消复制",
279
+ "Paste": "粘贴",
280
+ "Copied node": "已复制节点",
281
+ "Click a paste button to place": "点击粘贴按钮放置",
282
+ "Confirm paste": "确认粘贴",
283
+ "This action will remove invalid variable references, otherwise the workflow cannot run correctly.": "该操作将移除无效的变量引用,否则工作流将无法正确执行。",
284
+ "Failed to paste node": "粘贴节点失败"
265
285
  }
@@ -54,7 +54,7 @@
54
54
  "Collection event": "Collection event",
55
55
  "Collection operations": "Collection operations",
56
56
  "Completed": "Completed",
57
- "Concat": "Concat",
57
+ "Concatenate": "連接",
58
58
  "Condition": "Condition",
59
59
  "Condition expression": "Condition expression",
60
60
  "Condition label": "Condition label",
@@ -254,5 +254,12 @@
254
254
  "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
255
255
  "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.",
256
256
  "Yes": "Yes",
257
- "concat": "concat"
257
+ "Failed to move node": "節點移動失敗",
258
+ "Confirm move": "確認移動",
259
+ "Moving this node may remove variable references.": "移動此節點可能會移除變數引用。",
260
+ "Impacted current node variables": "目前節點引用的變數",
261
+ "Impacted dependent node variables": "引用目前節點變數的節點",
262
+ "Keep variable references": "保留變數引用",
263
+ "Keeping variable references requires manual adjustment, otherwise workflow may fail.": "已保留變數引用,請手動調整,否則工作流執行可能出錯。",
264
+ "Failed to update node variables": "更新節點變數失敗"
258
265
  }
@@ -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-01-09T15:50:16.199Z"}
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-02-14T15:51:45.517Z"}
@@ -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":"2026-01-09T15:50:15.824Z"}
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":"2026-02-14T15:51:45.169Z"}
@@ -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-01-09T15:50:15.618Z"}
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-02-14T15:51:44.982Z"}
@@ -390,7 +390,8 @@ class Dispatcher {
390
390
  logger.info(`execution (${execution.id}) ${job ? "resuming" : "starting"}...`);
391
391
  try {
392
392
  await (job ? processor.resume(job) : processor.start());
393
- logger.info(`execution (${execution.id}) finished with status: ${execution.status}`, { execution });
393
+ logger.info(`execution (${execution.id}) finished with status: ${execution.status}`);
394
+ logger.debug(`execution (${execution.id}) details:`, { execution });
394
395
  if (execution.status && ((_b = (_a = execution.workflow.options) == null ? void 0 : _a.deleteExecutionOnStatus) == null ? void 0 : _b.includes(execution.status))) {
395
396
  await execution.destroy({ transaction: processor.mainTransaction });
396
397
  }
@@ -55,6 +55,7 @@ var import_ScheduleTrigger = __toESM(require("./triggers/ScheduleTrigger"));
55
55
  var import_CalculationInstruction = __toESM(require("./instructions/CalculationInstruction"));
56
56
  var import_ConditionInstruction = __toESM(require("./instructions/ConditionInstruction"));
57
57
  var import_EndInstruction = __toESM(require("./instructions/EndInstruction"));
58
+ var import_OutputInstruction = __toESM(require("./instructions/OutputInstruction"));
58
59
  var import_CreateInstruction = __toESM(require("./instructions/CreateInstruction"));
59
60
  var import_DestroyInstruction = __toESM(require("./instructions/DestroyInstruction"));
60
61
  var import_QueryInstruction = __toESM(require("./instructions/QueryInstruction"));
@@ -270,6 +271,7 @@ class PluginWorkflowServer extends import_server.Plugin {
270
271
  this.registerInstruction("condition", import_ConditionInstruction.default);
271
272
  this.registerInstruction("multi-conditions", import_MultiConditionsInstruction.default);
272
273
  this.registerInstruction("end", import_EndInstruction.default);
274
+ this.registerInstruction("output", import_OutputInstruction.default);
273
275
  this.registerInstruction("create", import_CreateInstruction.default);
274
276
  this.registerInstruction("destroy", import_DestroyInstruction.default);
275
277
  this.registerInstruction("query", import_QueryInstruction.default);
@@ -336,6 +338,8 @@ class PluginWorkflowServer extends import_server.Plugin {
336
338
  "flow_nodes:update",
337
339
  "flow_nodes:destroy",
338
340
  "flow_nodes:destroyBranch",
341
+ "flow_nodes:duplicate",
342
+ "flow_nodes:move",
339
343
  "flow_nodes:test",
340
344
  "jobs:get",
341
345
  "workflowCategories:*"
@@ -63,6 +63,8 @@ function actions_default({ app }) {
63
63
  update: nodes.update,
64
64
  destroy: nodes.destroy,
65
65
  destroyBranch: nodes.destroyBranch,
66
+ duplicate: nodes.duplicate,
67
+ move: nodes.move,
66
68
  test: nodes.test
67
69
  }),
68
70
  ...make("jobs", jobs),
@@ -8,7 +8,9 @@
8
8
  */
9
9
  import { Context } from '@nocobase/actions';
10
10
  export declare function create(context: Context, next: any): Promise<void>;
11
+ export declare function duplicate(context: Context, next: any): Promise<void>;
11
12
  export declare function destroy(context: Context, next: any): Promise<void>;
12
13
  export declare function destroyBranch(context: Context, next: any): Promise<void>;
14
+ export declare function move(context: Context, next: any): Promise<void>;
13
15
  export declare function update(context: Context, next: any): Promise<void>;
14
16
  export declare function test(context: Context, next: any): Promise<void>;
@@ -39,6 +39,8 @@ __export(nodes_exports, {
39
39
  create: () => create,
40
40
  destroy: () => destroy,
41
41
  destroyBranch: () => destroyBranch,
42
+ duplicate: () => duplicate,
43
+ move: () => move,
42
44
  test: () => test,
43
45
  update: () => update
44
46
  });
@@ -49,10 +51,10 @@ var import__ = __toESM(require(".."));
49
51
  async function create(context, next) {
50
52
  const { db } = context;
51
53
  const repository = import_actions.utils.getRepositoryFromParams(context);
52
- const { whitelist, blacklist, updateAssociationValues, values, associatedIndex: workflowId } = context.action.params;
54
+ const { whitelist, blacklist, updateAssociationValues, values } = context.action.params;
53
55
  const workflowPlugin = context.app.pm.get(import__.default);
54
56
  context.body = await db.sequelize.transaction(async (transaction) => {
55
- const workflow = workflowPlugin.enabledCache.get(Number.parseInt(workflowId, 10)) || await repository.getSourceModel(transaction);
57
+ const workflow = workflowPlugin.enabledCache.get(Number.parseInt(context.action.sourceId, 10)) || await repository.getSourceModel(transaction);
56
58
  if (!workflow.versionStats) {
57
59
  workflow.versionStats = await workflow.getVersionStats({ transaction });
58
60
  }
@@ -133,6 +135,117 @@ async function create(context, next) {
133
135
  });
134
136
  await next();
135
137
  }
138
+ async function duplicate(context, next) {
139
+ const { db } = context;
140
+ const repository = import_actions.utils.getRepositoryFromParams(context);
141
+ const { whitelist, blacklist, filterByTk, values = {} } = context.action.params;
142
+ const workflowPlugin = context.app.pm.get(import__.default);
143
+ context.body = await db.sequelize.transaction(async (transaction) => {
144
+ const origin = filterByTk ? await repository.findOne({ filterByTk, transaction }) : null;
145
+ if (!origin) {
146
+ return context.throw(404, "Node not found");
147
+ }
148
+ const workflow = workflowPlugin.enabledCache.get(origin.workflowId) || await db.getRepository("workflows").findOne({
149
+ filterByTk: origin.workflowId,
150
+ transaction
151
+ });
152
+ if (!workflow) {
153
+ return context.throw(400, "Workflow not found");
154
+ }
155
+ if (!workflow.versionStats) {
156
+ workflow.versionStats = await workflow.getVersionStats({ transaction });
157
+ }
158
+ if (workflow.versionStats.executed > 0) {
159
+ context.throw(400, "Node could not be created in executed workflow");
160
+ }
161
+ const NODES_LIMIT = process.env.WORKFLOW_NODES_LIMIT ? parseInt(process.env.WORKFLOW_NODES_LIMIT, 10) : null;
162
+ if (NODES_LIMIT) {
163
+ const nodesCount = await workflow.countNodes({ transaction });
164
+ if (nodesCount >= NODES_LIMIT) {
165
+ context.throw(400, `The number of nodes in a workflow cannot exceed ${NODES_LIMIT}`);
166
+ }
167
+ }
168
+ let nextConfig = values.config;
169
+ if (!nextConfig) {
170
+ const instruction = workflowPlugin.instructions.get(origin.type);
171
+ if (instruction && typeof instruction.duplicateConfig === "function") {
172
+ nextConfig = await instruction.duplicateConfig(origin, { origin: origin ?? void 0, transaction });
173
+ }
174
+ }
175
+ const instance = await repository.create({
176
+ values: {
177
+ config: nextConfig ?? origin.config,
178
+ upstreamId: values.upstreamId,
179
+ branchIndex: values.branchIndex,
180
+ type: origin.type,
181
+ title: origin.title,
182
+ workflowId: origin.workflowId
183
+ },
184
+ whitelist,
185
+ blacklist,
186
+ context,
187
+ transaction
188
+ });
189
+ if (!instance.upstreamId) {
190
+ const previousHead = await repository.findOne({
191
+ filter: {
192
+ id: {
193
+ $ne: instance.id
194
+ },
195
+ workflowId: origin.workflowId,
196
+ upstreamId: null
197
+ },
198
+ transaction
199
+ });
200
+ if (previousHead) {
201
+ await previousHead.setUpstream(instance, { transaction });
202
+ await instance.setDownstream(previousHead, { transaction });
203
+ instance.set("downstream", previousHead);
204
+ }
205
+ return instance;
206
+ }
207
+ const upstream = await instance.getUpstream({ transaction });
208
+ if (instance.branchIndex == null) {
209
+ const downstream = await upstream.getDownstream({ transaction });
210
+ if (downstream) {
211
+ await downstream.setUpstream(instance, { transaction });
212
+ await instance.setDownstream(downstream, { transaction });
213
+ instance.set("downstream", downstream);
214
+ }
215
+ await upstream.update(
216
+ {
217
+ downstreamId: instance.id
218
+ },
219
+ { transaction }
220
+ );
221
+ upstream.set("downstream", instance);
222
+ } else {
223
+ const [downstream] = await upstream.getBranches({
224
+ where: {
225
+ id: {
226
+ [import_database.Op.ne]: instance.id
227
+ },
228
+ branchIndex: instance.branchIndex
229
+ },
230
+ transaction
231
+ });
232
+ if (downstream) {
233
+ await downstream.update(
234
+ {
235
+ upstreamId: instance.id,
236
+ branchIndex: null
237
+ },
238
+ { transaction }
239
+ );
240
+ await instance.setDownstream(downstream, { transaction });
241
+ instance.set("downstream", downstream);
242
+ }
243
+ }
244
+ instance.set("upstream", upstream);
245
+ return instance;
246
+ });
247
+ await next();
248
+ }
136
249
  function searchBranchNodes(nodes, from) {
137
250
  const branchHeads = nodes.filter((item) => item.upstreamId === from.id && item.branchIndex != null);
138
251
  return branchHeads.reduce(
@@ -336,6 +449,170 @@ async function destroyBranch(context, next) {
336
449
  context.body = deletedBranchHead;
337
450
  await next();
338
451
  }
452
+ async function move(context, next) {
453
+ const { db } = context;
454
+ const repository = import_actions.utils.getRepositoryFromParams(context);
455
+ const { filterByTk, values = {} } = context.action.params;
456
+ const rawUpstreamId = values.upstreamId;
457
+ const rawBranchIndex = values.branchIndex;
458
+ const upstreamId = rawUpstreamId == null || rawUpstreamId === "" ? null : rawUpstreamId;
459
+ let branchIndex = rawBranchIndex == null || rawBranchIndex === "" ? null : Number.parseInt(rawBranchIndex, 10);
460
+ if (rawBranchIndex != null && rawBranchIndex !== "" && Number.isNaN(branchIndex)) {
461
+ context.throw(400, "branchIndex must be a number");
462
+ }
463
+ if (upstreamId == null) {
464
+ branchIndex = null;
465
+ }
466
+ const fields = ["id", "key", "upstreamId", "downstreamId", "branchIndex", "workflowId"];
467
+ context.body = await db.sequelize.transaction(async (transaction) => {
468
+ const instance = await repository.findOne({
469
+ filterByTk,
470
+ fields,
471
+ appends: ["upstream", "downstream", "workflow.versionStats"],
472
+ transaction
473
+ });
474
+ if (!instance) {
475
+ context.throw(404, "Node not found");
476
+ }
477
+ if (instance.workflow.versionStats.executed > 0) {
478
+ context.throw(400, "Nodes in executed workflow could not be moved");
479
+ }
480
+ if (upstreamId != null && String(upstreamId) === String(instance.id)) {
481
+ context.throw(400, "Invalid upstream node");
482
+ }
483
+ const sameUpstream = (instance.upstreamId ?? null) == (upstreamId ?? null);
484
+ const sameBranchIndex = (instance.branchIndex ?? null) == (branchIndex ?? null);
485
+ if (sameUpstream && sameBranchIndex) {
486
+ context.throw(400, "Node does not need to be moved");
487
+ }
488
+ const { upstream: oldUpstream, downstream: oldDownstream } = instance.get();
489
+ if (oldUpstream && oldUpstream.downstreamId === instance.id) {
490
+ await oldUpstream.update(
491
+ {
492
+ downstreamId: oldDownstream ? oldDownstream.id : null
493
+ },
494
+ { transaction }
495
+ );
496
+ }
497
+ if (oldDownstream && oldDownstream.upstreamId === instance.id) {
498
+ await oldDownstream.update(
499
+ {
500
+ upstreamId: oldUpstream ? oldUpstream.id : null,
501
+ branchIndex: instance.branchIndex ?? null
502
+ },
503
+ { transaction }
504
+ );
505
+ }
506
+ let targetUpstream = null;
507
+ if (upstreamId != null) {
508
+ targetUpstream = await repository.findOne({
509
+ filterByTk: upstreamId,
510
+ fields,
511
+ transaction
512
+ });
513
+ if (!targetUpstream) {
514
+ context.throw(404, "Upstream node not found");
515
+ }
516
+ if (targetUpstream.workflowId !== instance.workflowId) {
517
+ context.throw(400, "Upstream node is not in the same workflow");
518
+ }
519
+ }
520
+ let newDownstream = null;
521
+ if (!targetUpstream) {
522
+ const previousHead = await repository.findOne({
523
+ filter: {
524
+ workflowId: instance.workflowId,
525
+ upstreamId: null,
526
+ id: {
527
+ [import_database.Op.ne]: instance.id
528
+ }
529
+ },
530
+ fields,
531
+ transaction
532
+ });
533
+ if (previousHead) {
534
+ await previousHead.update(
535
+ {
536
+ upstreamId: instance.id,
537
+ branchIndex: null
538
+ },
539
+ { transaction }
540
+ );
541
+ newDownstream = previousHead;
542
+ }
543
+ await instance.update(
544
+ {
545
+ upstreamId: null,
546
+ branchIndex: null,
547
+ downstreamId: newDownstream ? newDownstream.id : null
548
+ },
549
+ { transaction }
550
+ );
551
+ return instance;
552
+ }
553
+ if (branchIndex == null) {
554
+ if (targetUpstream.downstreamId) {
555
+ newDownstream = await repository.findOne({
556
+ filterByTk: targetUpstream.downstreamId,
557
+ fields,
558
+ transaction
559
+ });
560
+ }
561
+ if (newDownstream) {
562
+ await newDownstream.update(
563
+ {
564
+ upstreamId: instance.id,
565
+ branchIndex: null
566
+ },
567
+ { transaction }
568
+ );
569
+ }
570
+ await targetUpstream.update(
571
+ {
572
+ downstreamId: instance.id
573
+ },
574
+ { transaction }
575
+ );
576
+ await instance.update(
577
+ {
578
+ upstreamId: targetUpstream.id,
579
+ branchIndex: null,
580
+ downstreamId: newDownstream ? newDownstream.id : null
581
+ },
582
+ { transaction }
583
+ );
584
+ return instance;
585
+ }
586
+ const branchHead = await repository.findOne({
587
+ filter: {
588
+ upstreamId: targetUpstream.id,
589
+ branchIndex
590
+ },
591
+ fields,
592
+ transaction
593
+ });
594
+ if (branchHead) {
595
+ await branchHead.update(
596
+ {
597
+ upstreamId: instance.id,
598
+ branchIndex: null
599
+ },
600
+ { transaction }
601
+ );
602
+ newDownstream = branchHead;
603
+ }
604
+ await instance.update(
605
+ {
606
+ upstreamId: targetUpstream.id,
607
+ branchIndex,
608
+ downstreamId: newDownstream ? newDownstream.id : null
609
+ },
610
+ { transaction }
611
+ );
612
+ return instance;
613
+ });
614
+ await next();
615
+ }
339
616
  async function update(context, next) {
340
617
  const { db } = context;
341
618
  const repository = import_actions.utils.getRepositoryFromParams(context);
@@ -385,6 +662,8 @@ async function test(context, next) {
385
662
  create,
386
663
  destroy,
387
664
  destroyBranch,
665
+ duplicate,
666
+ move,
388
667
  test,
389
668
  update
390
669
  });
@@ -0,0 +1,21 @@
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 { Instruction } from '.';
10
+ import Processor from '../Processor';
11
+ import { FlowNodeModel } from '../types';
12
+ export default class ExecutionResultInstruction extends Instruction {
13
+ run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
14
+ result: any;
15
+ status: -1;
16
+ } | {
17
+ result: any;
18
+ status: 1;
19
+ }>;
20
+ resume(node: FlowNodeModel, job: any, processor: Processor): Promise<any>;
21
+ }
@@ -0,0 +1,54 @@
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 OutputInstruction_exports = {};
28
+ __export(OutputInstruction_exports, {
29
+ default: () => ExecutionResultInstruction
30
+ });
31
+ module.exports = __toCommonJS(OutputInstruction_exports);
32
+ var import__ = require(".");
33
+ var import_constants = require("../constants");
34
+ class ExecutionResultInstruction extends import__.Instruction {
35
+ async run(node, prevJob, processor) {
36
+ const { value } = node.config;
37
+ const output = processor.getParsedValue(value, node.id);
38
+ try {
39
+ await processor.execution.update({ output }, { hooks: false, transaction: processor.mainTransaction });
40
+ } catch (e) {
41
+ return {
42
+ result: e.message,
43
+ status: import_constants.JOB_STATUS.FAILED
44
+ };
45
+ }
46
+ return {
47
+ result: output,
48
+ status: import_constants.JOB_STATUS.RESOLVED
49
+ };
50
+ }
51
+ async resume(node, job, processor) {
52
+ return job;
53
+ }
54
+ }
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.0.0-beta.8",
9
+ "version": "2.0.0",
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": "2.x",
49
49
  "@nocobase/utils": "2.x"
50
50
  },
51
- "gitHead": "6bd912b1028eb8bc09a823d35e4d37b3000861b1",
51
+ "gitHead": "3590c0087a56f0f285a5357f43a80bdc62b11bec",
52
52
  "keywords": [
53
53
  "Workflow"
54
54
  ]