@nocobase/plugin-workflow-custom-action-trigger 2.1.0-alpha.14 → 2.1.0-alpha.15

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.1.0-alpha.14",
14
- "@nocobase/plugin-workflow": "2.1.0-alpha.14",
15
- "@nocobase/flow-engine": "2.1.0-alpha.14",
13
+ "@nocobase/client": "2.1.0-alpha.15",
14
+ "@nocobase/plugin-workflow": "2.1.0-alpha.15",
15
+ "@nocobase/flow-engine": "2.1.0-alpha.15",
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-alpha.14",
19
+ "@nocobase/utils": "2.1.0-alpha.15",
20
20
  "react-i18next": "11.18.6",
21
21
  "@formily/antd-v5": "1.2.3",
22
- "@nocobase/plugin-error-handler": "2.1.0-alpha.14",
23
- "@nocobase/data-source-manager": "2.1.0-alpha.14",
24
- "@nocobase/server": "2.1.0-alpha.14",
22
+ "@nocobase/plugin-error-handler": "2.1.0-alpha.15",
23
+ "@nocobase/data-source-manager": "2.1.0-alpha.15",
24
+ "@nocobase/server": "2.1.0-alpha.15",
25
25
  "lodash": "4.17.21",
26
- "@nocobase/actions": "2.1.0-alpha.14",
27
- "@nocobase/plugin-workflow-test": "2.1.0-alpha.14",
28
- "@nocobase/test": "2.1.0-alpha.14"
26
+ "@nocobase/actions": "2.1.0-alpha.15",
27
+ "@nocobase/plugin-workflow-test": "2.1.0-alpha.15",
28
+ "@nocobase/test": "2.1.0-alpha.15"
29
29
  };
@@ -1 +1 @@
1
- {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-04-07T15:55:30.204Z"}
1
+ {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-04-10T12:41:02.177Z"}
@@ -215,28 +215,66 @@ class CustomActionTrigger extends import_plugin_workflow.Trigger {
215
215
  context.logger.warn("No workflow triggered");
216
216
  return context.throw(500, "No action done, please contact the administrator");
217
217
  }
218
- for (const event of syncGroup) {
219
- const processor = await this.workflow.trigger(event[0], event[1], { httpContext: context });
218
+ const { resourceName, actionName } = context.action;
219
+ for (const [index, event] of syncGroup.entries()) {
220
+ const workflow = event[0];
221
+ const syncLogMeta = {
222
+ workflowId: workflow.id,
223
+ workflowKey: workflow.key,
224
+ workflowTitle: workflow.title,
225
+ resourceName,
226
+ actionName,
227
+ currentSyncOrder: index + 1,
228
+ totalSyncWorkflows: syncGroup.length,
229
+ remainingSyncWorkflows: syncGroup.length - index - 1,
230
+ pendingAsyncWorkflows: asyncGroup.length
231
+ };
232
+ context.logger.debug("[Workflow custom-action]: executing sync workflow", syncLogMeta);
233
+ const processor = await this.workflow.trigger(workflow, event[1], { httpContext: context });
220
234
  if (!processor) {
235
+ context.logger.error(
236
+ "[Workflow custom-action]: sync workflow trigger failed before execution created",
237
+ syncLogMeta
238
+ );
221
239
  return context.throw(500);
222
240
  }
223
241
  const { lastSavedJob, nodesMap } = processor;
224
242
  const lastNode = nodesMap.get(lastSavedJob == null ? void 0 : lastSavedJob.nodeId);
225
243
  if (processor.execution.status === import_plugin_workflow.EXECUTION_STATUS.RESOLVED) {
226
244
  if ((lastNode == null ? void 0 : lastNode.type) === "end") {
245
+ context.logger.debug("[Workflow custom-action]: sync workflow ended request chain on end node", {
246
+ ...syncLogMeta,
247
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
248
+ });
227
249
  return;
228
250
  }
251
+ context.logger.debug("[Workflow custom-action]: sync workflow finished successfully", {
252
+ ...syncLogMeta,
253
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
254
+ });
229
255
  continue;
230
256
  }
231
257
  if (processor.execution.status < import_plugin_workflow.EXECUTION_STATUS.STARTED) {
232
258
  if ((lastNode == null ? void 0 : lastNode.type) !== "end") {
259
+ context.logger.error("[Workflow custom-action]: sync workflow failed", {
260
+ ...syncLogMeta,
261
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
262
+ });
233
263
  return context.throw(500, "Workflow on your action failed, please contact the administrator");
234
264
  }
265
+ context.logger.warn("[Workflow custom-action]: sync workflow intercepted request on end node", {
266
+ ...syncLogMeta,
267
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
268
+ });
235
269
  const err = new CustomActionInterceptionError("Request is intercepted by workflow");
236
270
  err.status = 400;
237
271
  err.messages = context.state.messages;
238
272
  return context.throw(err.status, err);
239
273
  }
274
+ context.logger.error("[Workflow custom-action]: sync workflow is still pending after trigger", {
275
+ ...syncLogMeta,
276
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
277
+ });
240
278
  return context.throw(500, "Workflow on your action hangs, please contact the administrator");
241
279
  }
242
280
  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-alpha.14",
3
+ "version": "2.1.0-alpha.15",
4
4
  "displayName": "Workflow: Custom action event",
5
5
  "displayName.zh-CN": "工作流:自定义操作事件",
6
6
  "description": "Triggers after click a custom action button.",
@@ -30,6 +30,6 @@
30
30
  ],
31
31
  "editionLevel": 0
32
32
  },
33
- "gitHead": "d8735b541de0ff9557bba704de49c799b4962672",
33
+ "gitHead": "7c86e75b0af4b9f532c8ebf5ef96a7423b0ab60e",
34
34
  "license": "Apache-2.0"
35
35
  }