@nocobase/plugin-workflow-custom-action-trigger 2.1.0-beta.11 → 2.1.0-beta.13
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
CHANGED
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"@formily/react": "2.3.7",
|
|
13
|
-
"@nocobase/client": "2.1.0-beta.
|
|
14
|
-
"@nocobase/plugin-workflow": "2.1.0-beta.
|
|
15
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
13
|
+
"@nocobase/client": "2.1.0-beta.13",
|
|
14
|
+
"@nocobase/plugin-workflow": "2.1.0-beta.13",
|
|
15
|
+
"@nocobase/flow-engine": "2.1.0-beta.13",
|
|
16
16
|
"@emotion/css": "11.13.0",
|
|
17
17
|
"antd": "5.24.2",
|
|
18
18
|
"react-router-dom": "6.30.1",
|
|
19
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
19
|
+
"@nocobase/utils": "2.1.0-beta.13",
|
|
20
20
|
"react-i18next": "11.18.6",
|
|
21
21
|
"@formily/antd-v5": "1.2.3",
|
|
22
|
-
"@nocobase/plugin-error-handler": "2.1.0-beta.
|
|
23
|
-
"@nocobase/data-source-manager": "2.1.0-beta.
|
|
24
|
-
"@nocobase/server": "2.1.0-beta.
|
|
22
|
+
"@nocobase/plugin-error-handler": "2.1.0-beta.13",
|
|
23
|
+
"@nocobase/data-source-manager": "2.1.0-beta.13",
|
|
24
|
+
"@nocobase/server": "2.1.0-beta.13",
|
|
25
25
|
"lodash": "4.17.21",
|
|
26
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
27
|
-
"@nocobase/plugin-workflow-test": "2.1.0-beta.
|
|
28
|
-
"@nocobase/test": "2.1.0-beta.
|
|
26
|
+
"@nocobase/actions": "2.1.0-beta.13",
|
|
27
|
+
"@nocobase/plugin-workflow-test": "2.1.0-beta.13",
|
|
28
|
+
"@nocobase/test": "2.1.0-beta.13"
|
|
29
29
|
};
|
|
@@ -195,28 +195,66 @@ class CustomActionTrigger extends import_plugin_workflow.Trigger {
|
|
|
195
195
|
context.logger.warn("No workflow triggered");
|
|
196
196
|
return context.throw(500, "No action done, please contact the administrator");
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
const { resourceName, actionName } = context.action;
|
|
199
|
+
for (const [index, event] of syncGroup.entries()) {
|
|
200
|
+
const workflow = event[0];
|
|
201
|
+
const syncLogMeta = {
|
|
202
|
+
workflowId: workflow.id,
|
|
203
|
+
workflowKey: workflow.key,
|
|
204
|
+
workflowTitle: workflow.title,
|
|
205
|
+
resourceName,
|
|
206
|
+
actionName,
|
|
207
|
+
currentSyncOrder: index + 1,
|
|
208
|
+
totalSyncWorkflows: syncGroup.length,
|
|
209
|
+
remainingSyncWorkflows: syncGroup.length - index - 1,
|
|
210
|
+
pendingAsyncWorkflows: asyncGroup.length
|
|
211
|
+
};
|
|
212
|
+
context.logger.debug("[Workflow custom-action]: executing sync workflow", syncLogMeta);
|
|
213
|
+
const processor = await this.workflow.trigger(workflow, event[1], { httpContext: context });
|
|
200
214
|
if (!processor) {
|
|
215
|
+
context.logger.error(
|
|
216
|
+
"[Workflow custom-action]: sync workflow trigger failed before execution created",
|
|
217
|
+
syncLogMeta
|
|
218
|
+
);
|
|
201
219
|
return context.throw(500);
|
|
202
220
|
}
|
|
203
221
|
const { lastSavedJob, nodesMap } = processor;
|
|
204
222
|
const lastNode = nodesMap.get(lastSavedJob == null ? void 0 : lastSavedJob.nodeId);
|
|
205
223
|
if (processor.execution.status === import_plugin_workflow.EXECUTION_STATUS.RESOLVED) {
|
|
206
224
|
if ((lastNode == null ? void 0 : lastNode.type) === "end") {
|
|
225
|
+
context.logger.debug("[Workflow custom-action]: sync workflow ended request chain on end node", {
|
|
226
|
+
...syncLogMeta,
|
|
227
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
228
|
+
});
|
|
207
229
|
return;
|
|
208
230
|
}
|
|
231
|
+
context.logger.debug("[Workflow custom-action]: sync workflow finished successfully", {
|
|
232
|
+
...syncLogMeta,
|
|
233
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
234
|
+
});
|
|
209
235
|
continue;
|
|
210
236
|
}
|
|
211
237
|
if (processor.execution.status < import_plugin_workflow.EXECUTION_STATUS.STARTED) {
|
|
212
238
|
if ((lastNode == null ? void 0 : lastNode.type) !== "end") {
|
|
239
|
+
context.logger.error("[Workflow custom-action]: sync workflow failed", {
|
|
240
|
+
...syncLogMeta,
|
|
241
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
242
|
+
});
|
|
213
243
|
return context.throw(500, "Workflow on your action failed, please contact the administrator");
|
|
214
244
|
}
|
|
245
|
+
context.logger.warn("[Workflow custom-action]: sync workflow intercepted request on end node", {
|
|
246
|
+
...syncLogMeta,
|
|
247
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
248
|
+
});
|
|
215
249
|
const err = new CustomActionInterceptionError("Request is intercepted by workflow");
|
|
216
250
|
err.status = 400;
|
|
217
251
|
err.messages = context.state.messages;
|
|
218
252
|
return context.throw(err.status, err);
|
|
219
253
|
}
|
|
254
|
+
context.logger.error("[Workflow custom-action]: sync workflow is still pending after trigger", {
|
|
255
|
+
...syncLogMeta,
|
|
256
|
+
...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
|
|
257
|
+
});
|
|
220
258
|
return context.throw(500, "Workflow on your action hangs, please contact the administrator");
|
|
221
259
|
}
|
|
222
260
|
await next();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-workflow-custom-action-trigger",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.13",
|
|
4
4
|
"displayName": "Workflow: Custom action event",
|
|
5
5
|
"displayName.zh-CN": "工作流:自定义操作事件",
|
|
6
6
|
"description": "Triggers after click a custom action button.",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
],
|
|
28
28
|
"editionLevel": 0
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "691716e5f4e5f8bd3859d65bc8a29b4e3c32209b",
|
|
31
31
|
"license": "Apache-2.0"
|
|
32
32
|
}
|