@nocobase/plugin-workflow-action-trigger 2.1.0-alpha.13 → 2.1.0-alpha.15

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-i18next"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-action-trigger",["react-i18next","react","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-action-trigger"]=t(require("react-i18next"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-action-trigger"]=t(e["react-i18next"],e.react,e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,o,r,n){return function(){"use strict";var i={230:function(e){e.exports=r},342:function(e){e.exports=o},990:function(e){e.exports=n},155:function(e){e.exports=t},953:function(t){t.exports=e}},c={};function a(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return i[e](o,o.exports,a),o.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(l=a.g.location+"");var l,u=a.g.document;if(!l&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(l=u.currentScript.src),!l)){var s=u.getElementsByTagName("script");if(s.length)for(var p=s.length-1;p>-1&&(!l||!/^http(s?):/.test(l));)l=s[p--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");a.p=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var f={},d=window.__nocobase_public_path__||"";if(!d&&window.location&&window.location.pathname){var b=window.location.pathname||"/",y=b.indexOf("/v2/");d=y>=0?b.slice(0,y+1):"/"}return d&&(d=d.replace(/\/v2\/?$/,"/")),d||(d="/"),"/"!==d.charAt(d.length-1)&&(d+="/"),a.p=d+"static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/",!function(){a.r(f),a.d(f,{default:function(){return P}});var e=a(342),t=a(990),o=a(230),r=a(953),n="workflow-action-trigger";function i(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=o,(0,r.useTranslation)(n,t)).t)(e)}var c=a(155),l=a.n(c);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function s(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){s(e,t,o[t])})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return u(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return u(e,t)}}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function v(o,r){var n,c,a=function(e){if(Array.isArray(e))return e}(n=(0,e.parseCollectionName)(o.collection))||function(e){var t,o,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(n.push(t.value),2!==n.length);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return n}}(n)||m(n,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.")}(),l=a[0],u=a[1],s=(0,e.useCompile)(),p=(0,t.useGetDataSourceCollectionManager)(l),f=(0,t.useGetDataSourceCollectionManager)(),y=i("Trigger data"),h=i("User acted"),v=i("Role of user acted");return g((0,t.getCollectionFieldOptions)(b(d({appends:["data"].concat(g((null==(c=o.appends)?void 0:c.map(function(e){return"data.".concat(e)}))||[]))},r),{fields:[{collectionName:u,name:"data",type:"hasOne",target:u,uiSchema:{title:y}}],compile:s,collectionManager:p}))).concat(g((0,t.getCollectionFieldOptions)(b(d({appends:["user"]},r),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:h}},{name:"roleName",uiSchema:{title:v}}],compile:s,collectionManager:f}))))}var w=function(r){var i;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function c(){var r,i,a;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,a=arguments,i=p(i),s(r=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"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(i,a||[],p(this).constructor):i.apply(this,a)),"title",'{{t("Post-action event", { ns: "'.concat(n,'" })}}')),s(r,"description","{{t('Triggered after the completion of a request initiated through an action button or API, such as after adding or updating data. Suitable for data processing, sending notifications, etc., after actions are completed.', { ns: \"".concat(n,'" })}}')),s(r,"presetFieldset",{collection:{type:"string",title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),s(r,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("The collection to which the triggered data belongs.", { ns: "'.concat(n,'" })}}')},"x-component":"DataSourceCollectionCascader","x-disabled":!0,title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Local mode, triggered after the completion of actions bound to this workflow", { ns: "'.concat(n,'" })}}'),value:!1},{label:'{{t("Global mode, triggered after the completion of the following actions", { ns: "'.concat(n,'" })}}'),value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Create record action", { ns: "'.concat(n,'" })}}'),value:"create"},{label:'{{t("Update record action", { ns: "'.concat(n,'" })}}'),value:"update"}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(n,'" })}}'),description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection:function(){var e=(0,o.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),s(r,"triggerFieldset",{data:{type:"object",title:'{{t("Trigger data", { ns: "workflow" })}}',description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),s(r,"scope",{useCollectionDataSource:e.useCollectionDataSource,useWorkflowAnyExecuted:t.useWorkflowAnyExecuted}),s(r,"components",{RadioWithTooltip:t.RadioWithTooltip,CheckboxGroupWithTooltip:t.CheckboxGroupWithTooltip,TriggerCollectionRecordSelect:t.TriggerCollectionRecordSelect,WorkflowVariableWrapper:t.WorkflowVariableWrapper}),s(r,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update"].includes(t.buttonAction)}),s(r,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),s(r,"useVariables",v),r}return c.prototype=Object.create(r&&r.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),r&&y(c,r),i=[{key:"validate",value:function(e){return e.collection}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),Component:t.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}:null}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}')}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,i),c}(t.Trigger);function O(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function x(e,t,o){return(x=T()?Reflect.construct:function(e,t,o){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return o&&j(n,o.prototype),n}).apply(null,arguments)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=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,o)}function o(){return x(e,arguments,S(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),j(o,e)})(e)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}var P=function(e){var o;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=S(e),function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,T()?Reflect.construct(e,t||[],S(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&j(r,e),o=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var o,r,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(o)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(o=1,r&&(n=2&u[0]?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{o=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("action",w),this.app.addScopes({useTriggerWorkflowsActionProps:t.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:t.useRecordTriggerWorkflowsActionProps}),[2]})},function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){O(i,r,n,c,a,"next",e)}function a(e){O(i,r,n,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o),r}(k(e.Plugin))}(),f}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-action-trigger",["react-i18next","react","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-action-trigger"]=t(require("react-i18next"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-action-trigger"]=t(e["react-i18next"],e.react,e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,o,r,n){return function(){"use strict";var i={230:function(e){e.exports=r},342:function(e){e.exports=o},990:function(e){e.exports=n},155:function(e){e.exports=t},953:function(t){t.exports=e}},c={};function a(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return i[e](o,o.exports,a),o.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(l=a.g.location+"");var l,u=a.g.document;if(!l&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(l=u.currentScript.src),!l)){var s=u.getElementsByTagName("script");if(s.length)for(var p=s.length-1;p>-1&&(!l||!/^http(s?):/.test(l));)l=s[p--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");a.p=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var f={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),e=o+"static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",n=r.indexOf("/v2/");e=n>=0?r.slice(0,n+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/"}a.p=e}(),!function(){a.r(f),a.d(f,{default:function(){return P}});var e=a(342),t=a(990),o=a(230),r=a(953),n="workflow-action-trigger";function i(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=o,(0,r.useTranslation)(n,t)).t)(e)}var c=a(155),l=a.n(c);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function s(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){s(e,t,o[t])})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return u(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return u(e,t)}}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function v(o,r){var n,c,a=function(e){if(Array.isArray(e))return e}(n=(0,e.parseCollectionName)(o.collection))||function(e){var t,o,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(n.push(t.value),2!==n.length);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return n}}(n)||m(n,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.")}(),l=a[0],u=a[1],s=(0,e.useCompile)(),p=(0,t.useGetDataSourceCollectionManager)(l),f=(0,t.useGetDataSourceCollectionManager)(),g=i("Trigger data"),h=i("User acted"),v=i("Role of user acted");return y((0,t.getCollectionFieldOptions)(b(d({appends:["data"].concat(y((null==(c=o.appends)?void 0:c.map(function(e){return"data.".concat(e)}))||[]))},r),{fields:[{collectionName:u,name:"data",type:"hasOne",target:u,uiSchema:{title:g}}],compile:s,collectionManager:p}))).concat(y((0,t.getCollectionFieldOptions)(b(d({appends:["user"]},r),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:h}},{name:"roleName",uiSchema:{title:v}}],compile:s,collectionManager:f}))))}var w=function(r){var i;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function c(){var r,i,a;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,a=arguments,i=p(i),s(r=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"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(i,a||[],p(this).constructor):i.apply(this,a)),"title",'{{t("Post-action event", { ns: "'.concat(n,'" })}}')),s(r,"description","{{t('Triggered after the completion of a request initiated through an action button or API, such as after adding or updating data. Suitable for data processing, sending notifications, etc., after actions are completed.', { ns: \"".concat(n,'" })}}')),s(r,"presetFieldset",{collection:{type:"string",title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),s(r,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("The collection to which the triggered data belongs.", { ns: "'.concat(n,'" })}}')},"x-component":"DataSourceCollectionCascader","x-disabled":!0,title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Local mode, triggered after the completion of actions bound to this workflow", { ns: "'.concat(n,'" })}}'),value:!1},{label:'{{t("Global mode, triggered after the completion of the following actions", { ns: "'.concat(n,'" })}}'),value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Create record action", { ns: "'.concat(n,'" })}}'),value:"create"},{label:'{{t("Update record action", { ns: "'.concat(n,'" })}}'),value:"update"}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(n,'" })}}'),description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection:function(){var e=(0,o.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),s(r,"triggerFieldset",{data:{type:"object",title:'{{t("Trigger data", { ns: "workflow" })}}',description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),s(r,"scope",{useCollectionDataSource:e.useCollectionDataSource,useWorkflowAnyExecuted:t.useWorkflowAnyExecuted}),s(r,"components",{RadioWithTooltip:t.RadioWithTooltip,CheckboxGroupWithTooltip:t.CheckboxGroupWithTooltip,TriggerCollectionRecordSelect:t.TriggerCollectionRecordSelect,WorkflowVariableWrapper:t.WorkflowVariableWrapper}),s(r,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update"].includes(t.buttonAction)}),s(r,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),s(r,"useVariables",v),r}return c.prototype=Object.create(r&&r.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),r&&g(c,r),i=[{key:"validate",value:function(e){return e.collection}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),Component:t.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}:null}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}')}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,i),c}(t.Trigger);function O(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function x(e,t,o){return(x=T()?Reflect.construct:function(e,t,o){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return o&&j(n,o.prototype),n}).apply(null,arguments)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=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,o)}function o(){return x(e,arguments,S(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),j(o,e)})(e)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}var P=function(e){var o;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=S(e),function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,T()?Reflect.construct(e,t||[],S(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&j(r,e),o=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var o,r,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(o)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(o=1,r&&(n=2&u[0]?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{o=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("action",w),this.app.addScopes({useTriggerWorkflowsActionProps:t.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:t.useRecordTriggerWorkflowsActionProps}),[2]})},function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){O(i,r,n,c,a,"next",e)}function a(e){O(i,r,n,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o),r}(k(e.Plugin))}(),f}()});
@@ -9,19 +9,19 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.7",
12
- "@nocobase/client": "2.1.0-alpha.13",
13
- "@nocobase/plugin-workflow": "2.1.0-alpha.13",
12
+ "@nocobase/client": "2.1.0-alpha.15",
13
+ "@nocobase/plugin-workflow": "2.1.0-alpha.15",
14
14
  "react": "18.2.0",
15
- "@nocobase/flow-engine": "2.1.0-alpha.13",
15
+ "@nocobase/flow-engine": "2.1.0-alpha.15",
16
16
  "react-i18next": "11.18.6",
17
17
  "lodash": "4.17.21",
18
18
  "sequelize": "6.35.2",
19
- "@nocobase/database": "2.1.0-alpha.13",
20
- "@nocobase/server": "2.1.0-alpha.13",
21
- "@nocobase/actions": "2.1.0-alpha.13",
22
- "@nocobase/plugin-error-handler": "2.1.0-alpha.13",
23
- "@nocobase/data-source-manager": "2.1.0-alpha.13",
24
- "@nocobase/plugin-workflow-test": "2.1.0-alpha.13",
25
- "@nocobase/test": "2.1.0-alpha.13",
26
- "@nocobase/utils": "2.1.0-alpha.13"
19
+ "@nocobase/database": "2.1.0-alpha.15",
20
+ "@nocobase/server": "2.1.0-alpha.15",
21
+ "@nocobase/actions": "2.1.0-alpha.15",
22
+ "@nocobase/plugin-error-handler": "2.1.0-alpha.15",
23
+ "@nocobase/data-source-manager": "2.1.0-alpha.15",
24
+ "@nocobase/plugin-workflow-test": "2.1.0-alpha.15",
25
+ "@nocobase/test": "2.1.0-alpha.15",
26
+ "@nocobase/utils": "2.1.0-alpha.15"
27
27
  };
@@ -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-03-27T05:55:05.990Z"}
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-04-10T12:41:01.008Z"}
@@ -214,28 +214,66 @@ class ActionTrigger_default extends import_plugin_workflow.Trigger {
214
214
  (workflow.sync ? syncGroup : asyncGroup).push([workflow, { data, ...userInfo }]);
215
215
  }
216
216
  }
217
- for (const event of syncGroup) {
218
- const processor = await this.workflow.trigger(event[0], event[1], { httpContext: context });
217
+ for (const [index, event] of syncGroup.entries()) {
218
+ const workflow = event[0];
219
+ const remainingSyncWorkflows = syncGroup.length - index - 1;
220
+ const syncLogMeta = {
221
+ workflowId: workflow.id,
222
+ workflowKey: workflow.key,
223
+ workflowTitle: workflow.title,
224
+ resourceName,
225
+ actionName,
226
+ currentSyncOrder: index + 1,
227
+ totalSyncWorkflows: syncGroup.length,
228
+ remainingSyncWorkflows,
229
+ pendingAsyncWorkflows: asyncGroup.length
230
+ };
231
+ context.logger.debug("[Workflow post-action]: executing sync workflow", syncLogMeta);
232
+ const processor = await this.workflow.trigger(workflow, event[1], { httpContext: context });
219
233
  if (!processor) {
220
- return context.throw(500);
234
+ context.logger.error(
235
+ "[Workflow post-action]: sync workflow trigger failed before execution created",
236
+ syncLogMeta
237
+ );
238
+ return context.throw(500, "Workflow on your action failed, please contact the administrator");
221
239
  }
222
240
  const { lastSavedJob, nodesMap } = processor;
223
241
  const lastNode = nodesMap.get(lastSavedJob == null ? void 0 : lastSavedJob.nodeId);
224
242
  if (processor.execution.status === import_plugin_workflow.EXECUTION_STATUS.RESOLVED) {
225
243
  if ((lastNode == null ? void 0 : lastNode.type) === "end") {
244
+ context.logger.debug("[Workflow post-action]: sync workflow ended request chain on end node", {
245
+ ...syncLogMeta,
246
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
247
+ });
226
248
  return;
227
249
  }
250
+ context.logger.debug("[Workflow post-action]: sync workflow finished successfully", {
251
+ ...syncLogMeta,
252
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
253
+ });
228
254
  continue;
229
255
  }
230
256
  if (processor.execution.status < import_plugin_workflow.EXECUTION_STATUS.STARTED) {
231
257
  if ((lastNode == null ? void 0 : lastNode.type) !== "end") {
258
+ context.logger.error("[Workflow post-action]: sync workflow failed", {
259
+ ...syncLogMeta,
260
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
261
+ });
232
262
  return context.throw(500, "Workflow on your action failed, please contact the administrator");
233
263
  }
264
+ context.logger.warn("[Workflow post-action]: sync workflow intercepted request on end node", {
265
+ ...syncLogMeta,
266
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
267
+ });
234
268
  const err = new RequestOnActionTriggerError("Request failed");
235
269
  err.status = 400;
236
270
  err.messages = context.state.messages;
237
271
  return context.throw(err.status, err);
238
272
  }
273
+ context.logger.error("[Workflow post-action]: sync workflow is still pending after trigger", {
274
+ ...syncLogMeta,
275
+ ...(0, import_plugin_workflow.getWorkflowExecutionLogMeta)(workflow, processor)
276
+ });
239
277
  return context.throw(500, "Workflow on your action hangs, please contact the administrator");
240
278
  }
241
279
  for (const event of asyncGroup) {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, deleting data, or \"submit to workflow\". Suitable for data processing, sending notifications, etc., after actions are completed.",
7
7
  "description.ru-RU": "Срабатывает после завершения запроса, инициированного кнопкой действия или API, например после добавления, обновления, удаления данных или «отправки в рабочий процесс». Подходит для обработки данных, отправки уведомлений и т.д. после выполнения действий.",
8
8
  "description.zh-CN": "通过操作按钮或 API 发起请求并在执行完成后触发,比如新增、更新、删除数据或者“提交至工作流”之后。适用于在操作完成后进行数据处理、发送通知等。",
9
- "version": "2.1.0-alpha.13",
9
+ "version": "2.1.0-alpha.15",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger",
@@ -21,11 +21,12 @@
21
21
  "peerDependencies": {
22
22
  "@nocobase/client": "2.x",
23
23
  "@nocobase/database": "2.x",
24
+ "@nocobase/plugin-error-handler": "2.x",
24
25
  "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
25
26
  "@nocobase/server": "2.x",
26
27
  "@nocobase/test": "2.x"
27
28
  },
28
- "gitHead": "2807a8948412d9c235115a31a81a66f7c82dd173",
29
+ "gitHead": "7c86e75b0af4b9f532c8ebf5ef96a7423b0ab60e",
29
30
  "keywords": [
30
31
  "Workflow"
31
32
  ]