@nocobase/plugin-workflow-parallel 1.9.0-beta.4 → 1.9.0-beta.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.
@@ -24,6 +24,7 @@ export default class extends Instruction {
24
24
  'x-decorator': string;
25
25
  'x-component': string;
26
26
  'x-component-props': {
27
+ direction: string;
27
28
  options: {
28
29
  value: string;
29
30
  label: string;
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-parallel",["react","@nocobase/client","@ant-design/icons","@nocobase/plugin-workflow/client","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-parallel"]=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("antd"),require("react-i18next")):e["@nocobase/plugin-workflow-parallel"]=t(e.react,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var a={482:function(e){e.exports=n},772:function(e){e.exports=t},433:function(e){e.exports=r},721:function(e){e.exports=o},156:function(t){t.exports=e},238:function(e){e.exports=i}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return!function(){u.r(l),u.d(l,{default:function(){return I}});var e=u(772),t=u(433),n=u.n(t),r=u(156),o=u.n(r),i=u(721),a=u(482),c=u(238),f="workflow-parallel";function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function m(){var e=y(["\n padding-top: 2em;\n\n > button {\n line-height: 1;\n\n .anticon {\n transform: rotate(45deg);\n }\n }\n "]);return m=function(){return e},e}function v(){var e=y(["\n visibility: ",";\n "]);return v=function(){return e},e}function g(){var e=y(["\n position: relative;\n top: 1em;\n line-height: 1;\n transform-origin: center;\n transform: rotate(45deg);\n\n .anticon {\n transform-origin: center;\n transform: rotate(-45deg);\n }\n "]);return g=function(){return e},e}function w(n){var u,l=n.data,p=(0,t.useStyles)().styles,d=l.id;l.config.mode;var b=(0,t.useFlowContext)().nodes,y=(0,t.useWorkflowExecuted)(),h=b.reduce(function(e,t){return t.upstreamId===d&&null!=t.branchIndex?e.concat(t):e},[]).sort(function(e,t){return e.branchIndex-t.branchIndex}),w=(u=(0,r.useState)(Math.max(2,h.length)),function(e){if(Array.isArray(e))return e}(u)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(u,2)||function(e,t){if(e){if("string"==typeof e)return s(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(u,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x=w[0],O=w[1],j=(0,t.useGetAriaLabelOfAddButton)(l).getAriaLabel,S=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=n,(0,c.useTranslation)(f,t)).t)(e)}("Add branch"),k=Array(Math.max(0,x-h.length)).fill(null),E=h[h.length-1];return o().createElement(t.NodeDefaultView,{data:l},o().createElement("div",{className:p.nodeSubtreeClass},o().createElement("div",{className:p.branchBlockClass},h.map(function(e){return o().createElement(t.Branch,{key:e.id,from:l,entry:e,branchIndex:e.branchIndex})}),k.map(function(n,r){return o().createElement(t.Branch,{key:"temp_".concat(h.length+r),from:l,branchIndex:(E?E.branchIndex:0)+r+1,controller:h.length+r>1?o().createElement("div",{className:(0,e.css)(m())},o().createElement(i.Button,{shape:"circle",icon:o().createElement(a.PlusOutlined,null),onClick:function(){return O(x-1)},disabled:y>0,size:"small"})):null})})),o().createElement(i.Tooltip,{title:S,className:(0,e.css)(v(),y>0?"hidden":"visible")},o().createElement(i.Button,{"aria-label":j("add-branch"),icon:o().createElement(a.PlusOutlined,null),className:(0,e.css)(g()),size:"small",onClick:function(){return O(x+1)},disabled:y>0}))))}var x=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,i=arguments,r=d(r),p(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(r,i||[],d(this).constructor):r.apply(this,i)),"title",'{{t("Parallel branch", { ns: "'.concat(f,'" })}}')),p(e,"type","parallel"),p(e,"group","control"),p(e,"description",'{{t("Run multiple branch processes in parallel.", { ns: "'.concat(f,'" })}}')),p(e,"icon",o().createElement(a.ApartmentOutlined,{style:{}})),p(e,"fieldset",{mode:{type:"string",title:'{{t("Mode", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{value:"all",label:"{{t('All succeeded', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after all branches succeeded', { ns: \"".concat(f,'" })}}')},{value:"any",label:"{{t('Any succeeded', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after any branch succeeded', { ns: \"".concat(f,'" })}}')},{value:"race",label:"{{t('Any succeeded or failed', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: \"".concat(f,'" })}}')}]},default:"all"}}),p(e,"branching",!0),p(e,"components",{RadioWithTooltip:t.RadioWithTooltip}),p(e,"Component",w),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&b(n,e),n}(t.Instruction);function O(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){O(i,r,o,a,c,"next",e)}function c(e){O(i,r,o,a,c,"throw",e)}a(void 0)})}}function S(e,t,n){return(S=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&E(o,n.prototype),o}).apply(null,arguments)}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t="function"==typeof Map?new Map:void 0;return(P=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return S(e,arguments,k(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function A(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var I=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=k(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],k(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&E(r,e),t=[{key:"afterAdd",value:function(){return j(function(){return A(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return j(function(){return A(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return j(function(){return A(this,function(t){return e.app.pm.get(n()).registerInstruction("parallel",x),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(P(e.Plugin))}(),l}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-parallel",["react","@nocobase/client","@ant-design/icons","@nocobase/plugin-workflow/client","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-parallel"]=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("antd"),require("react-i18next")):e["@nocobase/plugin-workflow-parallel"]=t(e.react,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,a){return function(){"use strict";var c={482:function(e){e.exports=n},772:function(e){e.exports=t},433:function(e){e.exports=r},721:function(e){e.exports=o},156:function(t){t.exports=e},238:function(e){e.exports=a}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return c[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return!function(){u.r(l),u.d(l,{default:function(){return I}});var e=u(772),t=u(433),n=u.n(t),r=u(156),o=u.n(r),a=u(721),c=u(482),i=u(238),f="workflow-parallel";function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function m(){var e=y(["\n padding-top: 2em;\n\n > button {\n line-height: 1;\n\n .anticon {\n transform: rotate(45deg);\n }\n }\n "]);return m=function(){return e},e}function v(){var e=y(["\n visibility: ",";\n "]);return v=function(){return e},e}function g(){var e=y(["\n position: relative;\n top: 1em;\n line-height: 1;\n transform-origin: center;\n transform: rotate(45deg);\n\n .anticon {\n transform-origin: center;\n transform: rotate(-45deg);\n }\n "]);return g=function(){return e},e}function w(n){var u,l=n.data,p=(0,t.useStyles)().styles,d=l.id;l.config.mode;var b=(0,t.useFlowContext)().nodes,y=(0,t.useWorkflowExecuted)(),h=b.reduce(function(e,t){return t.upstreamId===d&&null!=t.branchIndex?e.concat(t):e},[]).sort(function(e,t){return e.branchIndex-t.branchIndex}),w=(u=(0,r.useState)(Math.max(2,h.length)),function(e){if(Array.isArray(e))return e}(u)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],c=!0,i=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){i=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(i)throw r}}return a}}(u,2)||function(e,t){if(e){if("string"==typeof e)return s(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(u,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x=w[0],O=w[1],j=(0,t.useGetAriaLabelOfAddButton)(l).getAriaLabel,S=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=n,(0,i.useTranslation)(f,t)).t)(e)}("Add branch"),k=Array(Math.max(0,x-h.length)).fill(null),E=h[h.length-1];return o().createElement(t.NodeDefaultView,{data:l},o().createElement("div",{className:p.nodeSubtreeClass},o().createElement("div",{className:p.branchBlockClass},h.map(function(e){return o().createElement(t.Branch,{key:e.id,from:l,entry:e,branchIndex:e.branchIndex})}),k.map(function(n,r){return o().createElement(t.Branch,{key:"temp_".concat(h.length+r),from:l,branchIndex:(E?E.branchIndex:0)+r+1,controller:h.length+r>1?o().createElement("div",{className:(0,e.css)(m())},o().createElement(a.Button,{shape:"circle",icon:o().createElement(c.PlusOutlined,null),onClick:function(){return O(x-1)},disabled:y>0,size:"small"})):null})})),o().createElement(a.Tooltip,{title:S,className:(0,e.css)(v(),y>0?"hidden":"visible")},o().createElement(a.Button,{"aria-label":j("add-branch"),icon:o().createElement(c.PlusOutlined,null),className:(0,e.css)(g()),size:"small",onClick:function(){return O(x+1)},disabled:y>0}))))}var x=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,a=arguments,r=d(r),p(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(r,a||[],d(this).constructor):r.apply(this,a)),"title",'{{t("Parallel branch", { ns: "'.concat(f,'" })}}')),p(e,"type","parallel"),p(e,"group","control"),p(e,"description",'{{t("Run multiple branch processes in parallel.", { ns: "'.concat(f,'" })}}')),p(e,"icon",o().createElement(c.ApartmentOutlined,{style:{}})),p(e,"fieldset",{mode:{type:"string",title:'{{t("Mode", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{value:"all",label:"{{t('All succeeded', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after all branches succeeded', { ns: \"".concat(f,'" })}}')},{value:"any",label:"{{t('Any succeeded', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after any branch succeeded', { ns: \"".concat(f,'" })}}')},{value:"race",label:"{{t('Any succeeded or failed', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: \"".concat(f,'" })}}')},{value:"allSettled",label:"{{t('Run all branch (ignore failures)', { ns: \"".concat(f,'" })}}'),tooltip:"{{t('Always continue after all branches end, regardless of success or failure.', { ns: \"".concat(f,'" })}}')}]},default:"all"}}),p(e,"branching",!0),p(e,"components",{RadioWithTooltip:t.RadioWithTooltip}),p(e,"Component",w),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&b(n,e),n}(t.Instruction);function O(e,t,n,r,o,a,c){try{var i=e[a](c),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,o)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function c(e){O(a,r,o,c,i,"next",e)}function i(e){O(a,r,o,c,i,"throw",e)}c(void 0)})}}function S(e,t,n){return(S=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&E(o,n.prototype),o}).apply(null,arguments)}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t="function"==typeof Map?new Map:void 0;return(P=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return S(e,arguments,k(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function A(e,t){var n,r,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var I=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=k(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],k(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&E(r,e),t=[{key:"afterAdd",value:function(){return j(function(){return A(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return j(function(){return A(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return j(function(){return A(this,function(t){return e.app.pm.get(n()).registerInstruction("parallel",x),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(P(e.Plugin))}(),l}()});
@@ -11,11 +11,11 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "antd": "5.24.2",
13
13
  "@ant-design/icons": "5.6.1",
14
- "@nocobase/client": "1.9.0-beta.4",
15
- "@nocobase/plugin-workflow": "1.9.0-beta.4",
14
+ "@nocobase/client": "1.9.0-beta.5",
15
+ "@nocobase/plugin-workflow": "1.9.0-beta.5",
16
16
  "react-i18next": "11.18.6",
17
- "@nocobase/server": "1.9.0-beta.4",
18
- "@nocobase/plugin-workflow-test": "1.9.0-beta.4",
19
- "@nocobase/test": "1.9.0-beta.4",
20
- "@nocobase/utils": "1.9.0-beta.4"
17
+ "@nocobase/server": "1.9.0-beta.5",
18
+ "@nocobase/plugin-workflow-test": "1.9.0-beta.5",
19
+ "@nocobase/test": "1.9.0-beta.5",
20
+ "@nocobase/utils": "1.9.0-beta.5"
21
21
  };
@@ -6,7 +6,9 @@
6
6
  "All succeeded": "全部成功",
7
7
  "Any succeeded": "任意成功",
8
8
  "Any succeeded or failed": "任意成功或失败",
9
+ "Run all branch (ignore failures)": "全部执行(忽略失败)",
9
10
  "Continue after all branches succeeded": "全部分支都成功后才能继续",
10
11
  "Continue after any branch succeeded": "任意分支成功后就继续",
11
- "Continue after any branch succeeded, or exit after any branch failed.": "任意分支成功就继续流程,或者任意分支失败就退出流程。"
12
+ "Continue after any branch succeeded, or exit after any branch failed.": "任意分支成功就继续流程,或者任意分支失败就退出流程。",
13
+ "Always continue after all branches end, regardless of success or failure.": "无论分支成功或失败,始终在所有分支结束后继续。"
12
14
  }
@@ -11,6 +11,7 @@ export declare const PARALLEL_MODE: {
11
11
  readonly ALL: "all";
12
12
  readonly ANY: "any";
13
13
  readonly RACE: "race";
14
+ readonly ALL_SETTLED: "allSettled";
14
15
  };
15
16
  export default class extends Instruction {
16
17
  run(node: FlowNodeModel, prevJob: JobModel, processor: Processor): Promise<any>;
@@ -34,7 +34,8 @@ var import_plugin_workflow = require("@nocobase/plugin-workflow");
34
34
  const PARALLEL_MODE = {
35
35
  ALL: "all",
36
36
  ANY: "any",
37
- RACE: "race"
37
+ RACE: "race",
38
+ ALL_SETTLED: "allSettled"
38
39
  };
39
40
  const Modes = {
40
41
  [PARALLEL_MODE.ALL]: {
@@ -80,12 +81,23 @@ const Modes = {
80
81
  }
81
82
  return import_plugin_workflow.JOB_STATUS.PENDING;
82
83
  }
84
+ },
85
+ [PARALLEL_MODE.ALL_SETTLED]: {
86
+ next() {
87
+ return true;
88
+ },
89
+ getStatus(result) {
90
+ if (result.some((status) => status === import_plugin_workflow.JOB_STATUS.PENDING)) {
91
+ return import_plugin_workflow.JOB_STATUS.PENDING;
92
+ }
93
+ return import_plugin_workflow.JOB_STATUS.RESOLVED;
94
+ }
83
95
  }
84
96
  };
85
97
  class ParallelInstruction_default extends import_plugin_workflow.Instruction {
86
98
  async run(node, prevJob, processor) {
87
99
  const branches = processor.getBranches(node);
88
- const job = await processor.saveJob({
100
+ const job = processor.saveJob({
89
101
  status: import_plugin_workflow.JOB_STATUS.PENDING,
90
102
  result: Array(branches.length).fill(null),
91
103
  nodeId: node.id,
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": "1.9.0-beta.4",
7
+ "version": "1.9.0-beta.5",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-parallel",
@@ -22,7 +22,7 @@
22
22
  "@nocobase/server": "1.x",
23
23
  "@nocobase/test": "1.x"
24
24
  },
25
- "gitHead": "0276aa12d87f82c73d62a9712134fe363e2c772a",
25
+ "gitHead": "9a61c60dd3db5af64244e82447309b0cb17aabb6",
26
26
  "keywords": [
27
27
  "Workflow"
28
28
  ]