@nocobase/plugin-workflow-parallel 1.9.0-beta.5 → 1.9.0-beta.7

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.
@@ -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,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}()});
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 branches (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.5",
15
- "@nocobase/plugin-workflow": "1.9.0-beta.5",
14
+ "@nocobase/client": "1.9.0-beta.7",
15
+ "@nocobase/plugin-workflow": "1.9.0-beta.7",
16
16
  "react-i18next": "11.18.6",
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"
17
+ "@nocobase/server": "1.9.0-beta.7",
18
+ "@nocobase/plugin-workflow-test": "1.9.0-beta.7",
19
+ "@nocobase/test": "1.9.0-beta.7",
20
+ "@nocobase/utils": "1.9.0-beta.7"
21
21
  };
@@ -6,7 +6,7 @@
6
6
  "All succeeded": "全部成功",
7
7
  "Any succeeded": "任意成功",
8
8
  "Any succeeded or failed": "任意成功或失败",
9
- "Run all branch (ignore failures)": "全部执行(忽略失败)",
9
+ "Run all branches (ignore failures)": "全部执行(忽略失败)",
10
10
  "Continue after all branches succeeded": "全部分支都成功后才能继续",
11
11
  "Continue after any branch succeeded": "任意分支成功后就继续",
12
12
  "Continue after any branch succeeded, or exit after any branch failed.": "任意分支成功就继续流程,或者任意分支失败就退出流程。",
@@ -14,6 +14,6 @@ export declare const PARALLEL_MODE: {
14
14
  readonly ALL_SETTLED: "allSettled";
15
15
  };
16
16
  export default class extends Instruction {
17
- run(node: FlowNodeModel, prevJob: JobModel, processor: Processor): Promise<any>;
18
- resume(node: FlowNodeModel, branchJob: any, processor: Processor): Promise<any>;
17
+ run(node: FlowNodeModel, prevJob: JobModel, processor: Processor): Promise<void>;
18
+ resume(node: FlowNodeModel, branchJob: any, processor: Processor): Promise<JobModel>;
19
19
  }
@@ -87,7 +87,7 @@ const Modes = {
87
87
  return true;
88
88
  },
89
89
  getStatus(result) {
90
- if (result.some((status) => status === import_plugin_workflow.JOB_STATUS.PENDING)) {
90
+ if (result.some((status) => !status)) {
91
91
  return import_plugin_workflow.JOB_STATUS.PENDING;
92
92
  }
93
93
  return import_plugin_workflow.JOB_STATUS.RESOLVED;
@@ -115,13 +115,13 @@ class ParallelInstruction_default extends import_plugin_workflow.Instruction {
115
115
  }),
116
116
  Promise.resolve()
117
117
  );
118
- return null;
119
118
  }
120
119
  async resume(node, branchJob, processor) {
121
120
  const job = processor.findBranchParentJob(branchJob, node);
122
121
  const { result, status } = job;
123
122
  if (status !== import_plugin_workflow.JOB_STATUS.PENDING) {
124
- return processor.exit();
123
+ processor.logger.warn(`parallel (${job.nodeId}) has been done, ignore newly resumed event`);
124
+ return null;
125
125
  }
126
126
  const jobNode = processor.nodesMap.get(branchJob.nodeId);
127
127
  const branchStartNode = processor.findBranchStartNode(jobNode, node);
@@ -134,8 +134,8 @@ class ParallelInstruction_default extends import_plugin_workflow.Instruction {
134
134
  status: Modes[mode].getStatus(newResult)
135
135
  });
136
136
  if (job.status === import_plugin_workflow.JOB_STATUS.PENDING) {
137
- await job.save({ transaction: processor.transaction });
138
- return processor.exit();
137
+ processor.saveJob(job);
138
+ return null;
139
139
  }
140
140
  return job;
141
141
  }
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.5",
7
+ "version": "1.9.0-beta.7",
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": "9a61c60dd3db5af64244e82447309b0cb17aabb6",
25
+ "gitHead": "4a5055c973b51611d5db1604aaaf6c1b73b4733c",
26
26
  "keywords": [
27
27
  "Workflow"
28
28
  ]