@nocobase/plugin-workflow-parallel 0.17.0-alpha.7 → 0.18.0-alpha.8
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/client/index.js +4 -4
- package/dist/externalVersion.js +5 -5
- package/dist/server/ParallelInstruction.js +1 -1
- package/dist/server/Plugin.d.ts +0 -2
- package/dist/server/Plugin.js +3 -4
- package/package.json +2 -3
- package/src/client/index.ts +1 -2
- package/src/server/ParallelInstruction.ts +1 -1
- package/src/server/Plugin.ts +2 -5
- package/src/server/__tests__/instruction.test.ts +3 -3
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","react/jsx-runtime","react","antd","@ant-design/icons","react-i18next"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-workflow-parallel"]={},e["@nocobase/client"],e["@nocobase/plugin-workflow"],e.jsxRuntime,e.react,e.antd,e["@ant-design/icons"],e["react-i18next"]))})(this,function(e,t,n,
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","react/jsx-runtime","react","antd","@ant-design/icons","react-i18next"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-workflow-parallel"]={},e["@nocobase/client"],e["@nocobase/plugin-workflow"],e.jsxRuntime,e.react,e.antd,e["@ant-design/icons"],e["react-i18next"]))})(this,function(e,t,n,r,f,d,b,u){"use strict";var M=Object.defineProperty;var S=(e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l=(e,t,n)=>(S(e,typeof t!="symbol"?t+"":t,n),n);var x=(e,t,n)=>new Promise((r,f)=>{var d=a=>{try{u(n.next(a))}catch(p){f(p)}},b=a=>{try{u(n.throw(a))}catch(p){f(p)}},u=a=>a.done?r(a.value):Promise.resolve(a.value).then(d,b);u((n=n.apply(e,t)).next())});const a="workflow-parallel";function p(h,m={}){const{t:c}=v(m);return c(h)}function v(h){return u.useTranslation(a,h)}class $ extends n.Instruction{constructor(){super(...arguments);l(this,"title",`{{t("Parallel branch", { ns: "${a}" })}}`);l(this,"type","parallel");l(this,"group","control");l(this,"description",`{{t("Run multiple branch processes in parallel.", { ns: "${a}" })}}`);l(this,"fieldset",{mode:{type:"string",title:`{{t("Mode", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{value:"all",label:`{{t('All succeeded', { ns: "${a}" })}}`,tooltip:`{{t('Continue after all branches succeeded', { ns: "${a}" })}}`},{value:"any",label:`{{t('Any succeeded', { ns: "${a}" })}}`,tooltip:`{{t('Continue after any branch succeeded', { ns: "${a}" })}}`},{value:"race",label:`{{t('Any succeeded or failed', { ns: "${a}" })}}`,tooltip:`{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: "${a}" })}}`}]},default:"all"}});l(this,"components",{RadioWithTooltip:n.RadioWithTooltip})}Component({data:c}){const{styles:A}=n.useStyles(),{id:B,config:{mode:L}}=c,{workflow:y,nodes:T}=n.useFlowContext(),i=T.reduce((s,o)=>o.upstreamId===B&&o.branchIndex!=null?s.concat(o):s,[]).sort((s,o)=>s.branchIndex-o.branchIndex),[g,C]=f.useState(Math.max(2,i.length)),{getAriaLabel:q}=n.useGetAriaLabelOfAddButton(c),N=p("Add branch"),j=Array(Math.max(0,g-i.length)).fill(null),I=i[i.length-1];return r.jsx(n.NodeDefaultView,{data:c,children:r.jsxs("div",{className:A.nodeSubtreeClass,children:[r.jsxs("div",{className:A.branchBlockClass,children:[i.map(s=>r.jsx(n.Branch,{from:c,entry:s,branchIndex:s.branchIndex},s.id)),j.map((s,o)=>r.jsx(n.Branch,{from:c,branchIndex:(I?I.branchIndex:0)+o+1,controller:i.length+o>1?r.jsx("div",{className:t.css`
|
|
2
2
|
padding-top: 2em;
|
|
3
3
|
|
|
4
4
|
> button {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
transform: rotate(45deg);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,children:
|
|
9
|
+
`,children:r.jsx(d.Button,{shape:"circle",icon:r.jsx(b.PlusOutlined,{}),onClick:()=>C(g-1),disabled:y.executed})}):null},`temp_${i.length+o}`))]}),r.jsx(d.Tooltip,{title:N,className:t.css`
|
|
10
10
|
visibility: ${y.executed?"hidden":"visible"};
|
|
11
|
-
`,children:
|
|
11
|
+
`,children:r.jsx(d.Button,{"aria-label":q("add-branch"),icon:r.jsx(b.PlusOutlined,{}),className:t.css`
|
|
12
12
|
position: relative;
|
|
13
13
|
top: 1em;
|
|
14
14
|
transform-origin: center;
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
transform-origin: center;
|
|
19
19
|
transform: rotate(-45deg);
|
|
20
20
|
}
|
|
21
|
-
`,onClick:()=>C(g+1),disabled:y.executed})})]})})}}class
|
|
21
|
+
`,onClick:()=>C(g+1),disabled:y.executed})})]})})}}class w extends t.Plugin{afterAdd(){return x(this,null,function*(){})}beforeLoad(){return x(this,null,function*(){})}load(){return x(this,null,function*(){this.app.pm.get(n).registerInstruction("parallel",$)})}}e.default=w,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.2.0",
|
|
3
|
-
"antd": "5.
|
|
4
|
-
"@ant-design/icons": "5.
|
|
5
|
-
"@nocobase/client": "0.
|
|
6
|
-
"@nocobase/plugin-workflow": "0.
|
|
3
|
+
"antd": "5.12.2",
|
|
4
|
+
"@ant-design/icons": "5.2.6",
|
|
5
|
+
"@nocobase/client": "0.18.0-alpha.8",
|
|
6
|
+
"@nocobase/plugin-workflow": "0.18.0-alpha.8",
|
|
7
7
|
"react-i18next": "11.18.6",
|
|
8
|
-
"@nocobase/server": "0.
|
|
8
|
+
"@nocobase/server": "0.18.0-alpha.8"
|
|
9
9
|
};
|
|
@@ -112,7 +112,7 @@ class ParallelInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
112
112
|
status: Modes[mode].getStatus(newResult)
|
|
113
113
|
});
|
|
114
114
|
if (job.status === import_plugin_workflow.JOB_STATUS.PENDING) {
|
|
115
|
-
await job.save(
|
|
115
|
+
await job.save();
|
|
116
116
|
return processor.exit();
|
|
117
117
|
}
|
|
118
118
|
return job;
|
package/dist/server/Plugin.d.ts
CHANGED
package/dist/server/Plugin.js
CHANGED
|
@@ -31,12 +31,11 @@ __export(Plugin_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Plugin_exports);
|
|
33
33
|
var import_server = require("@nocobase/server");
|
|
34
|
+
var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
|
|
34
35
|
var import_ParallelInstruction = __toESM(require("./ParallelInstruction"));
|
|
35
36
|
class Plugin_default extends import_server.Plugin {
|
|
36
|
-
workflow;
|
|
37
37
|
async load() {
|
|
38
|
-
const workflowPlugin = this.app.getPlugin(
|
|
39
|
-
|
|
40
|
-
workflowPlugin.instructions.register("parallel", new import_ParallelInstruction.default(workflowPlugin));
|
|
38
|
+
const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
|
|
39
|
+
workflowPlugin.registerInstruction("parallel", import_ParallelInstruction.default);
|
|
41
40
|
}
|
|
42
41
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:并行分支节点",
|
|
5
5
|
"description": "Could be used for parallel execution of branch processes in the workflow.",
|
|
6
6
|
"description.zh-CN": "用于在工作流中需要并行执行的分支流程。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.18.0-alpha.8",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
"@nocobase/client": "0.x",
|
|
18
18
|
"@nocobase/database": "0.x",
|
|
19
19
|
"@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
|
|
20
|
-
"@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
|
|
21
20
|
"@nocobase/server": "0.x",
|
|
22
21
|
"@nocobase/test": "0.x"
|
|
23
22
|
},
|
|
24
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "727d42f6f14e5f863831da3dbf3255ba1165b567"
|
|
25
24
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ export default class extends Plugin {
|
|
|
13
13
|
// You can get and modify the app instance here
|
|
14
14
|
async load() {
|
|
15
15
|
const workflow = this.app.pm.get(WorkflowPlugin);
|
|
16
|
-
|
|
17
|
-
workflow.instructions.register(parallelInstruction.type, parallelInstruction);
|
|
16
|
+
workflow.registerInstruction('parallel', ParallelInstruction);
|
|
18
17
|
}
|
|
19
18
|
}
|
package/src/server/Plugin.ts
CHANGED
|
@@ -4,11 +4,8 @@ import WorkflowPlugin from '@nocobase/plugin-workflow';
|
|
|
4
4
|
import ParallelInstruction from './ParallelInstruction';
|
|
5
5
|
|
|
6
6
|
export default class extends Plugin {
|
|
7
|
-
workflow: WorkflowPlugin;
|
|
8
|
-
|
|
9
7
|
async load() {
|
|
10
|
-
const workflowPlugin = this.app.getPlugin(
|
|
11
|
-
|
|
12
|
-
workflowPlugin.instructions.register('parallel', new ParallelInstruction(workflowPlugin));
|
|
8
|
+
const workflowPlugin = this.app.getPlugin<WorkflowPlugin>(WorkflowPlugin);
|
|
9
|
+
workflowPlugin.registerInstruction('parallel', ParallelInstruction);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Database from '@nocobase/database';
|
|
2
2
|
import { Application } from '@nocobase/server';
|
|
3
|
-
import {
|
|
3
|
+
import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
|
|
4
4
|
import { getApp, sleep } from '@nocobase/plugin-workflow-test';
|
|
5
5
|
|
|
6
6
|
import Plugin from '..';
|
|
@@ -453,7 +453,7 @@ describe('workflow > instructions > parallel', () => {
|
|
|
453
453
|
|
|
454
454
|
const n2 = await workflow.createNode({
|
|
455
455
|
type: 'parallel',
|
|
456
|
-
branchIndex:
|
|
456
|
+
branchIndex: 1,
|
|
457
457
|
upstreamId: n1.id,
|
|
458
458
|
});
|
|
459
459
|
|
|
@@ -521,7 +521,7 @@ describe('workflow > instructions > parallel', () => {
|
|
|
521
521
|
const n4 = await workflow.createNode({
|
|
522
522
|
type: 'echo',
|
|
523
523
|
upstreamId: n3.id,
|
|
524
|
-
branchIndex:
|
|
524
|
+
branchIndex: 1,
|
|
525
525
|
});
|
|
526
526
|
|
|
527
527
|
const n5 = await workflow.createNode({
|