@nocobase/plugin-workflow-action-trigger 2.1.0-beta.11 → 2.1.0-beta.12
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.
- package/dist/externalVersion.js +11 -11
- package/dist/server/ActionTrigger.js +41 -3
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"@formily/react": "2.3.7",
|
|
12
|
-
"@nocobase/client": "2.1.0-beta.
|
|
13
|
-
"@nocobase/plugin-workflow": "2.1.0-beta.
|
|
12
|
+
"@nocobase/client": "2.1.0-beta.12",
|
|
13
|
+
"@nocobase/plugin-workflow": "2.1.0-beta.12",
|
|
14
14
|
"react": "18.2.0",
|
|
15
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
15
|
+
"@nocobase/flow-engine": "2.1.0-beta.12",
|
|
16
16
|
"react-i18next": "11.18.6",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"sequelize": "6.35.2",
|
|
19
|
-
"@nocobase/database": "2.1.0-beta.
|
|
20
|
-
"@nocobase/server": "2.1.0-beta.
|
|
21
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
22
|
-
"@nocobase/plugin-error-handler": "2.1.0-beta.
|
|
23
|
-
"@nocobase/data-source-manager": "2.1.0-beta.
|
|
24
|
-
"@nocobase/plugin-workflow-test": "2.1.0-beta.
|
|
25
|
-
"@nocobase/test": "2.1.0-beta.
|
|
26
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
19
|
+
"@nocobase/database": "2.1.0-beta.12",
|
|
20
|
+
"@nocobase/server": "2.1.0-beta.12",
|
|
21
|
+
"@nocobase/actions": "2.1.0-beta.12",
|
|
22
|
+
"@nocobase/plugin-error-handler": "2.1.0-beta.12",
|
|
23
|
+
"@nocobase/data-source-manager": "2.1.0-beta.12",
|
|
24
|
+
"@nocobase/plugin-workflow-test": "2.1.0-beta.12",
|
|
25
|
+
"@nocobase/test": "2.1.0-beta.12",
|
|
26
|
+
"@nocobase/utils": "2.1.0-beta.12"
|
|
27
27
|
};
|
|
@@ -203,28 +203,66 @@ class ActionTrigger_default extends import_plugin_workflow.Trigger {
|
|
|
203
203
|
(workflow.sync ? syncGroup : asyncGroup).push([workflow, { data, ...userInfo }]);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
for (const event of syncGroup) {
|
|
207
|
-
const
|
|
206
|
+
for (const [index, event] of syncGroup.entries()) {
|
|
207
|
+
const workflow = event[0];
|
|
208
|
+
const remainingSyncWorkflows = syncGroup.length - index - 1;
|
|
209
|
+
const syncLogMeta = {
|
|
210
|
+
workflowId: workflow.id,
|
|
211
|
+
workflowKey: workflow.key,
|
|
212
|
+
workflowTitle: workflow.title,
|
|
213
|
+
resourceName,
|
|
214
|
+
actionName,
|
|
215
|
+
currentSyncOrder: index + 1,
|
|
216
|
+
totalSyncWorkflows: syncGroup.length,
|
|
217
|
+
remainingSyncWorkflows,
|
|
218
|
+
pendingAsyncWorkflows: asyncGroup.length
|
|
219
|
+
};
|
|
220
|
+
context.logger.debug("[Workflow post-action]: executing sync workflow", syncLogMeta);
|
|
221
|
+
const processor = await this.workflow.trigger(workflow, event[1], { httpContext: context });
|
|
208
222
|
if (!processor) {
|
|
209
|
-
|
|
223
|
+
context.logger.error(
|
|
224
|
+
"[Workflow post-action]: sync workflow trigger failed before execution created",
|
|
225
|
+
syncLogMeta
|
|
226
|
+
);
|
|
227
|
+
return context.throw(500, "Workflow on your action failed, please contact the administrator");
|
|
210
228
|
}
|
|
211
229
|
const { lastSavedJob, nodesMap } = processor;
|
|
212
230
|
const lastNode = nodesMap.get(lastSavedJob == null ? void 0 : lastSavedJob.nodeId);
|
|
213
231
|
if (processor.execution.status === import_plugin_workflow.EXECUTION_STATUS.RESOLVED) {
|
|
214
232
|
if ((lastNode == null ? void 0 : lastNode.type) === "end") {
|
|
233
|
+
context.logger.debug("[Workflow post-action]: sync workflow ended request chain on end node", {
|
|
234
|
+
...syncLogMeta,
|
|
235
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
236
|
+
});
|
|
215
237
|
return;
|
|
216
238
|
}
|
|
239
|
+
context.logger.debug("[Workflow post-action]: sync workflow finished successfully", {
|
|
240
|
+
...syncLogMeta,
|
|
241
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
242
|
+
});
|
|
217
243
|
continue;
|
|
218
244
|
}
|
|
219
245
|
if (processor.execution.status < import_plugin_workflow.EXECUTION_STATUS.STARTED) {
|
|
220
246
|
if ((lastNode == null ? void 0 : lastNode.type) !== "end") {
|
|
247
|
+
context.logger.error("[Workflow post-action]: sync workflow failed", {
|
|
248
|
+
...syncLogMeta,
|
|
249
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
250
|
+
});
|
|
221
251
|
return context.throw(500, "Workflow on your action failed, please contact the administrator");
|
|
222
252
|
}
|
|
253
|
+
context.logger.warn("[Workflow post-action]: sync workflow intercepted request on end node", {
|
|
254
|
+
...syncLogMeta,
|
|
255
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
256
|
+
});
|
|
223
257
|
const err = new RequestOnActionTriggerError("Request failed");
|
|
224
258
|
err.status = 400;
|
|
225
259
|
err.messages = context.state.messages;
|
|
226
260
|
return context.throw(err.status, err);
|
|
227
261
|
}
|
|
262
|
+
context.logger.error("[Workflow post-action]: sync workflow is still pending after trigger", {
|
|
263
|
+
...syncLogMeta,
|
|
264
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
265
|
+
});
|
|
228
266
|
return context.throw(500, "Workflow on your action hangs, please contact the administrator");
|
|
229
267
|
}
|
|
230
268
|
for (const event of asyncGroup) {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, deleting data, or \"submit to workflow\". Suitable for data processing, sending notifications, etc., after actions are completed.",
|
|
7
7
|
"description.ru-RU": "Срабатывает после завершения запроса, инициированного кнопкой действия или API, например после добавления, обновления, удаления данных или «отправки в рабочий процесс». Подходит для обработки данных, отправки уведомлений и т.д. после выполнения действий.",
|
|
8
8
|
"description.zh-CN": "通过操作按钮或 API 发起请求并在执行完成后触发,比如新增、更新、删除数据或者“提交至工作流”之后。适用于在操作完成后进行数据处理、发送通知等。",
|
|
9
|
-
"version": "2.1.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.12",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@nocobase/server": "2.x",
|
|
25
25
|
"@nocobase/test": "2.x"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "25cee9643f42f850afc4adc33c55a56850ac730d",
|
|
28
28
|
"keywords": [
|
|
29
29
|
"Workflow"
|
|
30
30
|
]
|