@nocobase/plugin-workflow-custom-action-trigger 2.1.0-alpha.46 → 2.1.0-alpha.47
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,22 +10,22 @@
|
|
|
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
|
-
"@nocobase/plugin-workflow": "2.1.0-alpha.
|
|
15
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/client": "2.1.0-alpha.47",
|
|
14
|
+
"@nocobase/plugin-workflow": "2.1.0-alpha.47",
|
|
15
|
+
"@nocobase/flow-engine": "2.1.0-alpha.47",
|
|
16
16
|
"@emotion/css": "11.13.0",
|
|
17
17
|
"react-router-dom": "6.30.1",
|
|
18
18
|
"antd": "5.24.2",
|
|
19
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
19
|
+
"@nocobase/utils": "2.1.0-alpha.47",
|
|
20
20
|
"react-i18next": "11.18.6",
|
|
21
21
|
"@formily/antd-v5": "1.2.3",
|
|
22
|
-
"@nocobase/client-v2": "2.1.0-alpha.
|
|
23
|
-
"@nocobase/plugin-error-handler": "2.1.0-alpha.
|
|
24
|
-
"@nocobase/data-source-manager": "2.1.0-alpha.
|
|
25
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
22
|
+
"@nocobase/client-v2": "2.1.0-alpha.47",
|
|
23
|
+
"@nocobase/plugin-error-handler": "2.1.0-alpha.47",
|
|
24
|
+
"@nocobase/data-source-manager": "2.1.0-alpha.47",
|
|
25
|
+
"@nocobase/server": "2.1.0-alpha.47",
|
|
26
26
|
"lodash": "4.18.1",
|
|
27
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
28
|
-
"@nocobase/resourcer": "2.1.0-alpha.
|
|
29
|
-
"@nocobase/plugin-workflow-test": "2.1.0-alpha.
|
|
30
|
-
"@nocobase/test": "2.1.0-alpha.
|
|
27
|
+
"@nocobase/actions": "2.1.0-alpha.47",
|
|
28
|
+
"@nocobase/resourcer": "2.1.0-alpha.47",
|
|
29
|
+
"@nocobase/plugin-workflow-test": "2.1.0-alpha.47",
|
|
30
|
+
"@nocobase/test": "2.1.0-alpha.47"
|
|
31
31
|
};
|
|
@@ -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-06-
|
|
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-06-08T04:02:56.320Z"}
|
|
@@ -26,6 +26,7 @@ export default class CustomActionTrigger extends Trigger {
|
|
|
26
26
|
triggerAction: (context: ResourcerContext, next: Next) => Promise<any>;
|
|
27
27
|
constructor(workflow: WorkflowPluginServer);
|
|
28
28
|
private processEvents;
|
|
29
|
+
private scheduleAsyncWorkflowTriggers;
|
|
29
30
|
validateContext(values: any, workflow: WorkflowModel): {
|
|
30
31
|
data: string;
|
|
31
32
|
filterByTk?: undefined;
|
|
@@ -45,6 +45,7 @@ var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
|
45
45
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
46
46
|
var import_lodash = require("lodash");
|
|
47
47
|
var import_constants = require("../common/constants");
|
|
48
|
+
const ASYNC_WORKFLOW_TRIGGER_DELAY_MS = 200;
|
|
48
49
|
class CustomActionInterceptionError extends Error {
|
|
49
50
|
status = 400;
|
|
50
51
|
messages = [];
|
|
@@ -308,9 +309,34 @@ class CustomActionTrigger extends import_plugin_workflow.Trigger {
|
|
|
308
309
|
return context.throw(500, "Workflow on your action hangs, please contact the administrator");
|
|
309
310
|
}
|
|
310
311
|
await next();
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
this.scheduleAsyncWorkflowTriggers(context, asyncGroup);
|
|
313
|
+
}
|
|
314
|
+
scheduleAsyncWorkflowTriggers(context, events) {
|
|
315
|
+
if (!events.length) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const triggerAsyncWorkflows = () => {
|
|
319
|
+
const triggerAsyncWorkflow = async (workflow, values) => {
|
|
320
|
+
await this.workflow.trigger(workflow, values);
|
|
321
|
+
};
|
|
322
|
+
setTimeout(() => {
|
|
323
|
+
for (const [workflow, values] of events) {
|
|
324
|
+
triggerAsyncWorkflow(workflow, values).catch((error) => {
|
|
325
|
+
context.logger.error("[Workflow custom-action]: async workflow trigger failed", {
|
|
326
|
+
error,
|
|
327
|
+
workflowId: workflow.id,
|
|
328
|
+
workflowKey: workflow.key,
|
|
329
|
+
workflowTitle: workflow.title
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}, ASYNC_WORKFLOW_TRIGGER_DELAY_MS);
|
|
334
|
+
};
|
|
335
|
+
if (context.res.writableEnded) {
|
|
336
|
+
triggerAsyncWorkflows();
|
|
337
|
+
return;
|
|
313
338
|
}
|
|
339
|
+
context.res.once("finish", triggerAsyncWorkflows);
|
|
314
340
|
}
|
|
315
341
|
validateContext(values, workflow) {
|
|
316
342
|
var _a;
|
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.
|
|
3
|
+
"version": "2.1.0-alpha.47",
|
|
4
4
|
"displayName": "Workflow: Custom action event",
|
|
5
5
|
"displayName.zh-CN": "工作流:自定义操作事件",
|
|
6
6
|
"description": "Triggers after click a custom action button.",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
],
|
|
32
32
|
"editionLevel": 0
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "66196b57f9043ea0ac6ebdafbc732bfb98af1396",
|
|
35
35
|
"license": "Apache-2.0"
|
|
36
36
|
}
|