@nocobase/plugin-workflow 2.1.0-alpha.1 → 2.1.0-alpha.10

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 (74) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/dist/client/0e7da88f89e15485.js +10 -0
  4. package/dist/client/37560b46d530bcf9.js +10 -0
  5. package/dist/client/4464fed3a8411375.js +10 -0
  6. package/dist/client/973723cf75f1e4e9.js +10 -0
  7. package/dist/client/AddNodeContext.d.ts +1 -0
  8. package/dist/client/NodeClipboardContext.d.ts +11 -0
  9. package/dist/client/NodeDragContext.d.ts +11 -0
  10. package/dist/client/hooks/{useWorkflowFilterActionProps.d.ts → useResourceFilterActionProps.d.ts} +1 -1
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.js +1 -1
  13. package/dist/client/models/NodeDetailsGridModel.d.ts +13 -0
  14. package/dist/client/models/NodeDetailsModel.d.ts +34 -0
  15. package/dist/client/models/NodeValueModel.d.ts +15 -0
  16. package/dist/client/models/TaskCardCommonItemModel.d.ts +14 -0
  17. package/dist/client/models/index.d.ts +11 -0
  18. package/dist/client/nodeVariableUtils.d.ts +14 -0
  19. package/dist/client/nodes/calculation.d.ts +7 -0
  20. package/dist/client/nodes/create.d.ts +13 -0
  21. package/dist/client/nodes/index.d.ts +24 -0
  22. package/dist/client/nodes/output.d.ts +53 -0
  23. package/dist/client/nodes/query.d.ts +13 -0
  24. package/dist/client/nodes/update.d.ts +1 -0
  25. package/dist/client/schemas/executions.d.ts +41 -22
  26. package/dist/client/style.d.ts +4 -0
  27. package/dist/client/triggers/collection.d.ts +13 -0
  28. package/dist/client/triggers/index.d.ts +10 -0
  29. package/dist/client/triggers/schedule/index.d.ts +13 -0
  30. package/dist/common/collections/executions.d.ts +22 -22
  31. package/dist/common/collections/executions.js +12 -0
  32. package/dist/common/collections/jobs.js +4 -0
  33. package/dist/common/collections/workflows.d.ts +22 -9
  34. package/dist/common/collections/workflows.js +9 -1
  35. package/dist/externalVersion.js +12 -12
  36. package/dist/locale/de-DE.json +10 -3
  37. package/dist/locale/en-US.json +22 -3
  38. package/dist/locale/es-ES.json +10 -3
  39. package/dist/locale/fr-FR.json +10 -3
  40. package/dist/locale/hu-HU.json +10 -2
  41. package/dist/locale/id-ID.json +10 -2
  42. package/dist/locale/it-IT.json +10 -3
  43. package/dist/locale/ja-JP.json +10 -5
  44. package/dist/locale/ko-KR.json +10 -3
  45. package/dist/locale/nl-NL.json +10 -3
  46. package/dist/locale/pt-BR.json +10 -3
  47. package/dist/locale/ru-RU.json +10 -3
  48. package/dist/locale/tr-TR.json +10 -3
  49. package/dist/locale/uk-UA.json +10 -3
  50. package/dist/locale/vi-VN.json +10 -2
  51. package/dist/locale/zh-CN.json +27 -5
  52. package/dist/locale/zh-TW.json +10 -3
  53. package/dist/node_modules/cron-parser/package.json +1 -1
  54. package/dist/node_modules/lru-cache/package.json +1 -1
  55. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  56. package/dist/server/Dispatcher.d.ts +3 -2
  57. package/dist/server/Dispatcher.js +76 -62
  58. package/dist/server/Plugin.js +6 -1
  59. package/dist/server/Processor.d.ts +9 -0
  60. package/dist/server/Processor.js +6 -1
  61. package/dist/server/actions/index.js +2 -0
  62. package/dist/server/actions/nodes.d.ts +2 -0
  63. package/dist/server/actions/nodes.js +281 -2
  64. package/dist/server/instructions/ConditionInstruction.js +4 -1
  65. package/dist/server/instructions/OutputInstruction.d.ts +21 -0
  66. package/dist/server/instructions/OutputInstruction.js +54 -0
  67. package/dist/server/repositories/WorkflowRepository.js +2 -1
  68. package/dist/swagger/index.d.ts +814 -62
  69. package/dist/swagger/index.js +975 -205
  70. package/package.json +3 -3
  71. package/dist/client/27bd65abee87cafa.js +0 -10
  72. package/dist/client/80d4cd8911e03c27.js +0 -10
  73. package/dist/client/bfc2a351589613e1.js +0 -10
  74. package/dist/client/e078314a62391f36.js +0 -10
@@ -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}}”分支内",
@@ -152,6 +154,7 @@
152
154
  "Node type": "节点类型",
153
155
  "Node with unknown type will cause error. Please delete it or check plugin which provide this type.": "未知类型的节点会导致错误,请删除或检查提供该类型的插件。",
154
156
  "Null": "Null",
157
+ "Not found": "未找到",
155
158
  "Off": "停用",
156
159
  "On": "启用",
157
160
  "On going": "进行中",
@@ -160,6 +163,8 @@
160
163
  "Operations": "操作",
161
164
  "Operator": "运算符",
162
165
  "Otherwise": "否则",
166
+ "Output": "流程输出",
167
+ "Output value": "结果值",
163
168
  "Pending": "待处理",
164
169
  "Please add at least one condition": "请添加至少一个条件",
165
170
  "Please select collection first": "请先选择数据表",
@@ -185,6 +190,7 @@
185
190
  "Select context": "选择上下文",
186
191
  "Select users": "选择用户",
187
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 员工工作流中使用此节点,来定义输出内容。如果多次添加此节点,则以最后一个被执行的节点的值为准。",
188
194
  "Single record": "单条数据",
189
195
  "Some node meets error.": "某个节点出错。",
190
196
  "Started and executing, maybe waiting for an async callback (manual, delay etc.).": "已开始执行,可能在等待异步回调(人工、延时等)。",
@@ -217,12 +223,13 @@
217
223
  "The workflow tasks page has already been created.": "工作流待办页面已创建。",
218
224
  "This is a main version, delete it will cause the whole workflow to be deleted (including all other revisions).": "当前是主版本,删除将导致整个流程被删除(包括所有其他版本)。",
219
225
  "This node contains branches, deleting will also be preformed to them, are you sure?": "节点包含分支,将同时删除其所有分支下的子节点,确定继续?",
226
+ "This type of node can not be used in current type of workflow or execute mode.": "该类型的节点在当前类型的工作流或执行模式中不可用。",
220
227
  "This type of trigger has not been supported to be executed manually.": "该类型的触发器暂未支持手动执行。",
221
228
  "This will perform all the actions configured in the workflow. Are you sure you want to continue?": "将按照工作流中配置的所有操作执行,确定继续吗?",
222
229
  "Trigger": "触发器",
223
230
  "Trigger data": "触发数据",
224
231
  "Trigger data context": "触发数据上下文",
225
- "Trigger in executed workflow cannot be modified": "Trigger in executed workflow cannot be modified",
232
+ "Trigger in executed workflow cannot be modified": "已执行的工作流中的触发器无法修改",
226
233
  "Trigger mode": "触发模式",
227
234
  "Trigger on": "触发时机",
228
235
  "Trigger time": "触发时间",
@@ -253,12 +260,27 @@
253
260
  "Will be executed in the background as a queued task.": "将作为队列任务在后台执行。",
254
261
  "Workflow": "工作流",
255
262
  "Workflow executed, the result status is <1>{{statusText}}</1><2>View the execution</2>": "工作流已执行,结果状态为 <1>{{statusText}}</1><2>查看执行详情</2>",
256
- "Workflow is not exists": "工作流不存在",
263
+ "Workflow of execution is not existed": "执行计划对应的工作流不存在",
257
264
  "Workflow tasks": "流程待办",
258
265
  "Workflow todos": "流程待办",
259
266
  "Workflow will be triggered before deleting succeeded (only supports pre-action event in local mode).": "删除成功之前触发工作流(支持操作前事件)。",
260
267
  "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "按钮点击后直接触发工作流,但不会保存数据。仅支持绑定“自定义操作事件”。",
261
268
  "Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.": "未知类型的工作流会导致错误,请删除或检查提供该类型的插件。",
262
269
  "Yes": "是",
263
- "concat": "连接"
270
+ "Failed to move node": "节点移动失败",
271
+ "Confirm move": "确认移动",
272
+ "Moving this node may remove variable references.": "移动该节点可能会移除变量引用。",
273
+ "Impacted current node variables": "当前节点引用的变量",
274
+ "Impacted dependent node variables": "引用当前节点变量的节点",
275
+ "Keep variable references": "保留变量引用,我将手动修复",
276
+ "Keeping variable references requires manual adjustment, otherwise workflow may fail.": "已保留变量引用,请手动调整,否则工作流执行可能出错。",
277
+ "Failed to update node variables": "更新节点变量失败",
278
+ "Copy": "复制",
279
+ "Cancel copy": "取消复制",
280
+ "Paste": "粘贴",
281
+ "Copied node": "已复制节点",
282
+ "Click a paste button to place": "点击粘贴按钮放置",
283
+ "Confirm paste": "确认粘贴",
284
+ "This action will remove invalid variable references, otherwise the workflow cannot run correctly.": "该操作将移除无效的变量引用,否则工作流将无法正确执行。",
285
+ "Failed to paste node": "粘贴节点失败"
264
286
  }
@@ -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",
@@ -247,12 +247,19 @@
247
247
  "Will be executed in the background as a queued task.": "Will be executed in the background as a queued task.",
248
248
  "Workflow": "Workflow",
249
249
  "Workflow executed, the result status is <1>{{statusText}}</1><2>View the execution</2>": "Workflow executed, the result status is <1>{{statusText}}</1><2>View the execution</2>",
250
- "Workflow is not exists": "Workflow is not exists",
250
+ "Workflow of execution is not existed": "Workflow of execution is not existed",
251
251
  "Workflow tasks": "Workflow tasks",
252
252
  "Workflow todos": "Workflow todos",
253
253
  "Workflow will be triggered before deleting succeeded (only supports pre-action event in local mode).": "Workflow will be triggered before deleting succeeded (only supports pre-action event in local mode).",
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":"2025-12-31T16:48:00.775Z"}
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-03-20T09:07:40.613Z"}
@@ -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-31T16:48:00.430Z"}
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-03-20T09:07:40.263Z"}
@@ -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-31T16:48:00.227Z"}
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-03-20T09:07:40.075Z"}
@@ -30,6 +30,7 @@ export default class Dispatcher {
30
30
  private readonly plugin;
31
31
  private ready;
32
32
  private executing;
33
+ private preparing;
33
34
  private pending;
34
35
  private events;
35
36
  private eventsCount;
@@ -39,15 +40,15 @@ export default class Dispatcher {
39
40
  setReady(ready: boolean): void;
40
41
  getEventsCount(): number;
41
42
  trigger(workflow: WorkflowModel, context: object, options?: EventOptions): void | Promise<Processor | null>;
43
+ private prepare;
42
44
  resume(job: any): Promise<void>;
43
45
  start(execution: ExecutionModel): Promise<void>;
44
46
  beforeStop(): Promise<void>;
45
- dispatch(): Promise<void>;
47
+ dispatch(): void;
46
48
  run(pending: Pending): Promise<void>;
47
49
  private triggerSync;
48
50
  private validateEvent;
49
51
  private createExecution;
50
- private prepare;
51
52
  private acquirePendingExecution;
52
53
  private acquireQueueingExecution;
53
54
  private process;
@@ -29,22 +29,22 @@ __export(Dispatcher_exports, {
29
29
  default: () => Dispatcher
30
30
  });
31
31
  module.exports = __toCommonJS(Dispatcher_exports);
32
- var import_crypto = require("crypto");
32
+ var import_node_crypto = require("node:crypto");
33
33
  var import_sequelize = require("sequelize");
34
34
  var import_constants = require("./constants");
35
35
  var import_Plugin = require("./Plugin");
36
36
  class Dispatcher {
37
37
  constructor(plugin) {
38
38
  this.plugin = plugin;
39
- this.prepare = this.prepare.bind(this);
40
39
  }
41
40
  ready = false;
42
41
  executing = null;
42
+ preparing = null;
43
43
  pending = [];
44
44
  events = [];
45
45
  eventsCount = 0;
46
46
  get idle() {
47
- return this.ready && !this.executing && !this.pending.length && !this.events.length;
47
+ return this.ready && !this.executing && !this.preparing && !this.pending.length && !this.events.length;
48
48
  }
49
49
  onQueueExecution = async (event) => {
50
50
  const ExecutionRepo = this.plugin.db.getRepository("executions");
@@ -96,11 +96,55 @@ class Dispatcher {
96
96
  this.eventsCount = this.events.length;
97
97
  logger.info(`new event triggered, now events: ${this.events.length}`);
98
98
  logger.debug(`event data:`, { context });
99
- if (this.events.length > 1) {
100
- logger.info(`new event is pending to be prepared after previous preparation is finished`);
99
+ this.prepare();
100
+ }
101
+ prepare() {
102
+ if (this.preparing) {
101
103
  return;
102
104
  }
103
- setImmediate(this.prepare);
105
+ this.preparing = (async () => {
106
+ try {
107
+ while (this.events.length) {
108
+ if (this.executing && this.plugin.db.options.dialect === "sqlite") {
109
+ await this.executing;
110
+ }
111
+ const event = this.events.shift();
112
+ this.eventsCount = this.events.length;
113
+ if (!event) continue;
114
+ const logger = this.plugin.getLogger(event[0].id);
115
+ logger.info(`preparing execution for event`);
116
+ try {
117
+ const execution = await this.createExecution(...event);
118
+ if (!(execution == null ? void 0 : execution.dispatched)) {
119
+ if (this.plugin.serving() && !this.executing && !this.pending.length) {
120
+ logger.info(`local pending list is empty, adding execution (${execution.id}) to pending list`);
121
+ this.pending.push({ execution });
122
+ } else {
123
+ logger.info(
124
+ `instance is not serving as worker or local pending list is not empty, sending execution (${execution.id}) to queue`
125
+ );
126
+ try {
127
+ await this.plugin.app.eventQueue.publish(this.plugin.channelPendingExecution, {
128
+ executionId: execution.id
129
+ });
130
+ } catch (qErr) {
131
+ logger.error(`publishing execution (${execution.id}) to queue failed:`, { error: qErr });
132
+ }
133
+ }
134
+ }
135
+ } catch (error) {
136
+ logger.error(`failed to create execution:`, { error });
137
+ }
138
+ }
139
+ } finally {
140
+ this.preparing = null;
141
+ if (this.events.length) {
142
+ this.prepare();
143
+ } else {
144
+ this.dispatch();
145
+ }
146
+ }
147
+ })();
104
148
  }
105
149
  async resume(job) {
106
150
  let { execution } = job;
@@ -119,16 +163,26 @@ class Dispatcher {
119
163
  }
120
164
  async beforeStop() {
121
165
  this.ready = false;
122
- if (this.events.length) {
123
- await this.prepare();
124
- }
125
- if (this.executing) {
126
- await this.executing;
166
+ this.plugin.getLogger("dispatcher").info("app is stopping, draining local queues...");
167
+ while (this.preparing || this.executing || this.events.length || this.pending.length) {
168
+ if (this.preparing) {
169
+ await this.preparing;
170
+ }
171
+ if (this.executing) {
172
+ await this.executing;
173
+ }
174
+ if (this.events.length && !this.preparing) {
175
+ this.prepare();
176
+ }
177
+ if (this.pending.length && !this.executing) {
178
+ this.dispatch();
179
+ }
180
+ await new Promise((resolve) => setImmediate(resolve));
127
181
  }
182
+ this.plugin.getLogger("dispatcher").info("local queues drained");
128
183
  }
129
184
  dispatch() {
130
- if (!this.ready) {
131
- this.plugin.getLogger("dispatcher").warn(`app is not ready, new dispatching will be ignored`);
185
+ if (!this.ready && !this.pending.length && !this.events.length) {
132
186
  return;
133
187
  }
134
188
  if (this.executing) {
@@ -136,7 +190,8 @@ class Dispatcher {
136
190
  return;
137
191
  }
138
192
  if (this.events.length) {
139
- return this.prepare();
193
+ this.prepare();
194
+ return;
140
195
  }
141
196
  this.executing = (async () => {
142
197
  let next = null;
@@ -149,13 +204,15 @@ class Dispatcher {
149
204
  this.plugin.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
150
205
  }
151
206
  } else {
152
- if (this.plugin.serving()) {
207
+ if (this.ready && this.plugin.serving()) {
153
208
  execution = await this.acquireQueueingExecution();
154
209
  if (execution) {
155
210
  next = [execution];
156
211
  }
157
212
  } else {
158
- this.plugin.getLogger("dispatcher").warn(`${import_Plugin.WORKER_JOB_WORKFLOW_PROCESS} is not serving on this instance, new dispatching will be ignored`);
213
+ this.plugin.getLogger("dispatcher").warn(
214
+ `${import_Plugin.WORKER_JOB_WORKFLOW_PROCESS} is not serving on this instance or app not ready, new dispatching will be ignored`
215
+ );
159
216
  }
160
217
  }
161
218
  if (next) {
@@ -233,7 +290,7 @@ class Dispatcher {
233
290
  {
234
291
  context,
235
292
  key: workflow.key,
236
- eventKey: options.eventKey ?? (0, import_crypto.randomUUID)(),
293
+ eventKey: options.eventKey ?? (0, import_node_crypto.randomUUID)(),
237
294
  stack: options.stack,
238
295
  dispatched: deferred ?? false,
239
296
  status: deferred ? import_constants.EXECUTION_STATUS.STARTED : import_constants.EXECUTION_STATUS.QUEUEING,
@@ -268,50 +325,6 @@ class Dispatcher {
268
325
  execution.workflow = workflow;
269
326
  return execution;
270
327
  }
271
- prepare = async () => {
272
- if (this.executing && this.plugin.db.options.dialect === "sqlite") {
273
- await this.executing;
274
- }
275
- const event = this.events.shift();
276
- this.eventsCount = this.events.length;
277
- if (!event) {
278
- this.plugin.getLogger("dispatcher").info(`events queue is empty, no need to prepare`);
279
- return;
280
- }
281
- const logger = this.plugin.getLogger(event[0].id);
282
- logger.info(`preparing execution for event`);
283
- try {
284
- const execution = await this.createExecution(...event);
285
- if (!(execution == null ? void 0 : execution.dispatched)) {
286
- if (this.plugin.serving() && !this.executing && !this.pending.length) {
287
- logger.info(`local pending list is empty, adding execution (${execution.id}) to pending list`);
288
- this.pending.push({ execution });
289
- } else {
290
- logger.info(
291
- `instance is not serving as worker or local pending list is not empty, sending execution (${execution.id}) to queue`
292
- );
293
- try {
294
- await this.plugin.app.eventQueue.publish(this.plugin.channelPendingExecution, {
295
- executionId: execution.id
296
- });
297
- } catch (qErr) {
298
- logger.error(`publishing execution (${execution.id}) to queue failed:`, { error: qErr });
299
- }
300
- }
301
- }
302
- } catch (error) {
303
- logger.error(`failed to create execution:`, { error });
304
- }
305
- if (this.events.length) {
306
- await this.prepare();
307
- } else {
308
- this.plugin.getLogger("dispatcher").info("no more events need to be prepared, dispatching...");
309
- if (this.executing) {
310
- await this.executing;
311
- }
312
- this.dispatch();
313
- }
314
- };
315
328
  async acquirePendingExecution(execution) {
316
329
  const logger = this.plugin.getLogger(execution.workflowId);
317
330
  const isolationLevel = this.plugin.db.options.dialect === "sqlite" ? [][0] : import_sequelize.Transaction.ISOLATION_LEVELS.REPEATABLE_READ;
@@ -390,7 +403,8 @@ class Dispatcher {
390
403
  logger.info(`execution (${execution.id}) ${job ? "resuming" : "starting"}...`);
391
404
  try {
392
405
  await (job ? processor.resume(job) : processor.start());
393
- logger.info(`execution (${execution.id}) finished with status: ${execution.status}`, { execution });
406
+ logger.info(`execution (${execution.id}) finished with status: ${execution.status}`);
407
+ logger.debug(`execution (${execution.id}) details:`, { execution });
394
408
  if (execution.status && ((_b = (_a = execution.workflow.options) == null ? void 0 : _a.deleteExecutionOnStatus) == null ? void 0 : _b.includes(execution.status))) {
395
409
  await execution.destroy({ transaction: processor.mainTransaction });
396
410
  }
@@ -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);
@@ -287,7 +289,8 @@ class PluginWorkflowServer extends import_server.Plugin {
287
289
  filter: { name: this.name }
288
290
  });
289
291
  this.snowflake = new import_nodejs_snowflake.Snowflake({
290
- custom_epoch: pluginRecord == null ? void 0 : pluginRecord.createdAt.getTime()
292
+ custom_epoch: pluginRecord == null ? void 0 : pluginRecord.createdAt.getTime(),
293
+ instance_id: this.app.instanceId
291
294
  });
292
295
  }
293
296
  /**
@@ -335,6 +338,8 @@ class PluginWorkflowServer extends import_server.Plugin {
335
338
  "flow_nodes:update",
336
339
  "flow_nodes:destroy",
337
340
  "flow_nodes:destroyBranch",
341
+ "flow_nodes:duplicate",
342
+ "flow_nodes:move",
338
343
  "flow_nodes:test",
339
344
  "jobs:get",
340
345
  "workflowCategories:*"
@@ -96,6 +96,15 @@ export default class Processor {
96
96
  * @experimental
97
97
  */
98
98
  getScope(sourceNodeId?: number | string, includeSelfScope?: boolean): {
99
+ ctx: {
100
+ $context: any;
101
+ $jobsMapByNodeKey: {
102
+ [key: string]: any;
103
+ };
104
+ $system: {};
105
+ $scopes: {};
106
+ $env: {};
107
+ };
99
108
  $context: any;
100
109
  $jobsMapByNodeKey: {
101
110
  [key: string]: any;
@@ -439,13 +439,18 @@ class Processor {
439
439
  $scopes[n.id] = $scopes[n.key] = instruction.getScope(n, this.jobResultsMapByNodeKey[n.key], this);
440
440
  }
441
441
  }
442
- return {
442
+ const scopes = {
443
443
  $context: this.execution.context,
444
444
  $jobsMapByNodeKey: this.jobResultsMapByNodeKey,
445
445
  $system: systemFns,
446
446
  $scopes,
447
447
  $env: this.options.plugin.app.environment.getVariables()
448
448
  };
449
+ return {
450
+ ...scopes,
451
+ ctx: scopes
452
+ // 2.0
453
+ };
449
454
  }
450
455
  /**
451
456
  * @experimental
@@ -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>;