@nocobase/plugin-workflow-custom-action-trigger 2.0.32 → 2.0.34

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.
@@ -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.0.32",
14
- "@nocobase/plugin-workflow": "2.0.32",
15
- "@nocobase/flow-engine": "2.0.32",
13
+ "@nocobase/client": "2.0.34",
14
+ "@nocobase/plugin-workflow": "2.0.34",
15
+ "@nocobase/flow-engine": "2.0.34",
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.0.32",
19
+ "@nocobase/utils": "2.0.34",
20
20
  "react-i18next": "11.18.6",
21
21
  "@formily/antd-v5": "1.2.3",
22
- "@nocobase/plugin-error-handler": "2.0.32",
23
- "@nocobase/data-source-manager": "2.0.32",
24
- "@nocobase/server": "2.0.32",
22
+ "@nocobase/plugin-error-handler": "2.0.34",
23
+ "@nocobase/data-source-manager": "2.0.34",
24
+ "@nocobase/server": "2.0.34",
25
25
  "lodash": "4.17.21",
26
- "@nocobase/actions": "2.0.32",
27
- "@nocobase/plugin-workflow-test": "2.0.32",
28
- "@nocobase/test": "2.0.32"
26
+ "@nocobase/actions": "2.0.34",
27
+ "@nocobase/plugin-workflow-test": "2.0.34",
28
+ "@nocobase/test": "2.0.34"
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
- for (const event of syncGroup) {
199
- const processor = await this.workflow.trigger(event[0], event[1], { httpContext: context });
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.0.32",
3
+ "version": "2.0.34",
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": "ad454bc0bc27dee7e931644200317d034c816e3e",
30
+ "gitHead": "c1ab70fd5ea49ec889c93838b78e633fe78b97dd",
31
31
  "license": "Apache-2.0"
32
32
  }