@nocobase/plugin-workflow-loop 2.0.0-alpha.3 → 2.0.0-alpha.5
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/.env.example +3 -0
- package/dist/externalVersion.js +4 -4
- package/dist/server/LoopInstruction.js +13 -2
- package/package.json +2 -2
package/.env.example
ADDED
package/dist/externalVersion.js
CHANGED
|
@@ -13,9 +13,9 @@ module.exports = {
|
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@formily/antd-v5": "1.2.3",
|
|
15
15
|
"@formily/react": "2.3.7",
|
|
16
|
-
"@nocobase/client": "2.0.0-alpha.
|
|
17
|
-
"@nocobase/plugin-workflow": "2.0.0-alpha.
|
|
16
|
+
"@nocobase/client": "2.0.0-alpha.5",
|
|
17
|
+
"@nocobase/plugin-workflow": "2.0.0-alpha.5",
|
|
18
18
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/evaluators": "2.0.0-alpha.
|
|
20
|
-
"@nocobase/server": "2.0.0-alpha.
|
|
19
|
+
"@nocobase/evaluators": "2.0.0-alpha.5",
|
|
20
|
+
"@nocobase/server": "2.0.0-alpha.5"
|
|
21
21
|
};
|
|
@@ -42,6 +42,10 @@ module.exports = __toCommonJS(LoopInstruction_exports);
|
|
|
42
42
|
var import_evaluators = __toESM(require("@nocobase/evaluators"));
|
|
43
43
|
var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
44
44
|
var import_constants = require("../constants");
|
|
45
|
+
function getLoopLimit() {
|
|
46
|
+
const limit = process.env.WORKFLOW_LOOP_LIMIT;
|
|
47
|
+
return limit ? parseInt(limit, 10) : null;
|
|
48
|
+
}
|
|
45
49
|
function getTargetLength(target) {
|
|
46
50
|
let length = 0;
|
|
47
51
|
if (typeof target === "number") {
|
|
@@ -153,8 +157,15 @@ class LoopInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
153
157
|
job.changed("result", true);
|
|
154
158
|
processor.saveJob(job);
|
|
155
159
|
if (result.looped < length) {
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
const loopLimit = getLoopLimit();
|
|
161
|
+
if (!loopLimit || result.done < loopLimit) {
|
|
162
|
+
await processor.run(branch, job);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
job.set({
|
|
166
|
+
status: import_plugin_workflow.JOB_STATUS.ERROR,
|
|
167
|
+
result: { ...result, exceeded: true }
|
|
168
|
+
});
|
|
158
169
|
} else {
|
|
159
170
|
job.set({
|
|
160
171
|
status: import_plugin_workflow.JOB_STATUS.RESOLVED
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:循环节点",
|
|
5
5
|
"description": "Used to repeat the sub-process processing of each value in an array, and can also be used for fixed times of sub-process processing.",
|
|
6
6
|
"description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。",
|
|
7
|
-
"version": "2.0.0-alpha.
|
|
7
|
+
"version": "2.0.0-alpha.5",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow-loop",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@nocobase/server": "2.x",
|
|
23
23
|
"@nocobase/test": "2.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "943e035bbec27f9ecfe8ce8857955945f20976f3",
|
|
26
26
|
"keywords": [
|
|
27
27
|
"Workflow"
|
|
28
28
|
]
|