@nocobase/plugin-workflow 1.2.9-alpha → 1.2.11-alpha

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,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(v,r){typeof exports=="object"&&typeof module!="undefined"?r(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("@formily/reactive"),require("@formily/react"),require("lodash"),require("@formily/shared"),require("dayjs"),require("@nocobase/evaluators/client"),require("@formily/antd-v5")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","@formily/reactive","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],r):(v=typeof globalThis!="undefined"?globalThis:v||self,r(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v["@formily/reactive"],v["@formily/react"],v.lodash,v["@formily/shared"],v.dayjs,v["@nocobase/evaluators"],v["@formily/antd-v5"]))})(this,function(v,r,l,J,te,b,g,Q,P,le,fo,L,ke,ho,Yt,De,jo){"use strict";var Nr=Object.defineProperty,Er=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var mo=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Vo=(v,r,l)=>r in v?Nr(v,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):v[r]=l,C=(v,r)=>{for(var l in r||(r={}))Gt.call(r,l)&&Vo(v,l,r[l]);if(mo)for(var l of mo(r))qt.call(r,l)&&Vo(v,l,r[l]);return v},A=(v,r)=>Er(v,$r(r));var Kt=v=>typeof v=="symbol"?v:v+"",Z=(v,r)=>{var l={};for(var J in v)Gt.call(v,J)&&r.indexOf(J)<0&&(l[J]=v[J]);if(v!=null&&mo)for(var J of mo(v))r.indexOf(J)<0&&qt.call(v,J)&&(l[J]=v[J]);return l};var w=(v,r,l)=>(Vo(v,typeof r!="symbol"?r+"":r,l),l);var U=(v,r,l)=>new Promise((J,te)=>{var b=P=>{try{Q(l.next(P))}catch(le){te(le)}},g=P=>{try{Q(l.throw(P))}catch(le){te(le)}},Q=P=>P.done?J(P.value):Promise.resolve(P.value).then(b,g);Q((l=l.apply(v,r)).next())});const _t=b.createContext(null),go={didCatch:!1,error:null};class Zt extends b.Component{constructor(o){super(o),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=go}static getDerivedStateFromError(o){return{didCatch:!0,error:o}}resetErrorBoundary(){const{error:o}=this.state;if(o!==null){for(var t,n,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(t=(n=this.props).onReset)===null||t===void 0||t.call(n,{args:a,reason:"imperative-api"}),this.setState(go)}}componentDidCatch(o,t){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,o,t)}componentDidUpdate(o,t){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&t.error!==null&&Qt(o.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:o.resetKeys,reason:"keys"}),this.setState(go)}}render(){const{children:o,fallbackRender:t,FallbackComponent:n,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=o;if(a){const u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(b.isValidElement(s))c=s;else if(typeof t=="function")c=t(u);else if(n)c=b.createElement(n,u);else throw i}return b.createElement(_t.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function Qt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==o.length||e.some((t,n)=>!Object.is(t,o[n]))}const Ie=b.createContext({});function G(){return b.useContext(Ie)}const p="workflow";function T(e,o={}){return l.i18n.t(e,A(C({},o),{ns:p}))}function yo(){return Q.useTranslation(p)}const ne=l.createStyles(({css:e,token:o})=>({workflowPageClass:e`
10
+ (function(v,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("@formily/reactive"),require("@formily/react"),require("lodash"),require("@formily/shared"),require("dayjs"),require("@nocobase/evaluators/client"),require("@formily/antd-v5")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","@formily/reactive","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],n):(v=typeof globalThis!="undefined"?globalThis:v||self,n(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v["@formily/reactive"],v["@formily/react"],v.lodash,v["@formily/shared"],v.dayjs,v["@nocobase/evaluators"],v["@formily/antd-v5"]))})(this,function(v,n,l,J,te,b,y,Q,I,le,fo,L,ke,ho,Yt,De,jo){"use strict";var Nr=Object.defineProperty,Er=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var mo=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Vo=(v,n,l)=>n in v?Nr(v,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):v[n]=l,C=(v,n)=>{for(var l in n||(n={}))Gt.call(n,l)&&Vo(v,l,n[l]);if(mo)for(var l of mo(n))qt.call(n,l)&&Vo(v,l,n[l]);return v},A=(v,n)=>Er(v,$r(n));var Kt=v=>typeof v=="symbol"?v:v+"",Z=(v,n)=>{var l={};for(var J in v)Gt.call(v,J)&&n.indexOf(J)<0&&(l[J]=v[J]);if(v!=null&&mo)for(var J of mo(v))n.indexOf(J)<0&&qt.call(v,J)&&(l[J]=v[J]);return l};var w=(v,n,l)=>(Vo(v,typeof n!="symbol"?n+"":n,l),l);var U=(v,n,l)=>new Promise((J,te)=>{var b=I=>{try{Q(l.next(I))}catch(le){te(le)}},y=I=>{try{Q(l.throw(I))}catch(le){te(le)}},Q=I=>I.done?J(I.value):Promise.resolve(I.value).then(b,y);Q((l=l.apply(v,n)).next())});const _t=b.createContext(null),yo={didCatch:!1,error:null};class Zt extends b.Component{constructor(o){super(o),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yo}static getDerivedStateFromError(o){return{didCatch:!0,error:o}}resetErrorBoundary(){const{error:o}=this.state;if(o!==null){for(var t,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:a,reason:"imperative-api"}),this.setState(yo)}}componentDidCatch(o,t){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,o,t)}componentDidUpdate(o,t){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&t.error!==null&&Qt(o.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:o.resetKeys,reason:"keys"}),this.setState(yo)}}render(){const{children:o,fallbackRender:t,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=o;if(a){const u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(b.isValidElement(s))c=s;else if(typeof t=="function")c=t(u);else if(r)c=b.createElement(r,u);else throw i}return b.createElement(_t.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function Qt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==o.length||e.some((t,r)=>!Object.is(t,o[r]))}const Ie=b.createContext({});function G(){return b.useContext(Ie)}const p="workflow";function T(e,o={}){return l.i18n.t(e,A(C({},o),{ns:p}))}function go(){return Q.useTranslation(p)}const ne=l.createStyles(({css:e,token:o})=>({workflowPageClass:e`
11
11
  flex-grow: 1;
12
12
  overflow: hidden;
13
13
  display: flex;
@@ -362,12 +362,12 @@
362
362
  border-radius: 50%;
363
363
  background-color: ${o.colorText};
364
364
  color: ${o.colorBgContainer};
365
- `}));function Wo(e){var k;const{upstream:o,branchIndex:t=null}=e,n=l.usePlugin(de),s=l.useCompile(),a=l.useAPIClient(),{workflow:i,refresh:c}=(k=G())!=null?k:{},u=Array.from(n.instructions.getValues()),{styles:d}=ne(),[f,h]=b.useState(!1),x=b.useMemo(()=>[{key:"control",label:`{{t("Control", { ns: "${p}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${p}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${p}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${p}" })}}`}].map(O=>{const M=u.filter(S=>S.group===O.key&&(S.isAvailable?S.isAvailable({engine:n,workflow:i,upstream:o,branchIndex:t}):!0));return A(C({},O),{type:"group",children:M.map(S=>({role:"button","aria-label":S.type,key:S.type,label:S.title,type:S.options?"subMenu":null,children:S.options?S.options.map(E=>({role:"button","aria-label":E.key,key:E.key,label:E.label})):null}))})}).filter(O=>O.children.length),[t,n,u,o,i]),y=b.useCallback(M=>U(this,[M],function*({keyPath:O}){var B,N,F;const S=O.pop(),[E]=O,W=n.instructions.get(S),$=W.createDefaultConfig();if(E){const{value:D}=(N=(B=W.options)==null?void 0:B.find(H=>H.key===E))!=null?N:{};Object.assign($,typeof D=="function"?D():D)}if(i){h(!0);try{yield a.resource("workflows.nodes",i.id).create({values:{type:S,upstreamId:(F=o==null?void 0:o.id)!=null?F:null,branchIndex:t,title:s(W.title),config:$}}),c()}catch(D){console.error(D)}finally{h(!1)}}}),[a,t,n.instructions,c,o==null?void 0:o.id,i]),m=b.useMemo(()=>({onClick:y,items:s(x)}),[x,y]);return i?r.jsx("div",{className:d.addButtonClass,children:r.jsx(g.Dropdown,{trigger:["click"],menu:m,disabled:i.executed,overlayClassName:l.css`
365
+ `}));function Wo(e){var k;const{upstream:o,branchIndex:t=null}=e,r=l.usePlugin(de),s=l.useCompile(),a=l.useAPIClient(),{workflow:i,refresh:c}=(k=G())!=null?k:{},u=Array.from(r.instructions.getValues()),{styles:d}=ne(),[f,h]=b.useState(!1),x=b.useMemo(()=>[{key:"control",label:`{{t("Control", { ns: "${p}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${p}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${p}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${p}" })}}`}].map(O=>{const B=u.filter(S=>S.group===O.key&&(S.isAvailable?S.isAvailable({engine:r,workflow:i,upstream:o,branchIndex:t}):!0));return A(C({},O),{type:"group",children:B.map(S=>({role:"button","aria-label":S.type,key:S.type,label:S.title,type:S.options?"subMenu":null,children:S.options?S.options.map(E=>({role:"button","aria-label":E.key,key:E.key,label:E.label})):null}))})}).filter(O=>O.children.length),[t,r,u,o,i]),g=b.useCallback(B=>U(this,[B],function*({keyPath:O}){var M,N,F;const S=O.pop(),[E]=O,W=r.instructions.get(S),$=W.createDefaultConfig();if(E){const{value:D}=(N=(M=W.options)==null?void 0:M.find(H=>H.key===E))!=null?N:{};Object.assign($,typeof D=="function"?D():D)}if(i){h(!0);try{yield a.resource("workflows.nodes",i.id).create({values:{type:S,upstreamId:(F=o==null?void 0:o.id)!=null?F:null,branchIndex:t,title:s(W.title),config:$}}),c()}catch(D){console.error(D)}finally{h(!1)}}}),[a,t,r.instructions,c,o==null?void 0:o.id,i]),m=b.useMemo(()=>({onClick:g,items:s(x)}),[x,g]);return i?n.jsx("div",{className:d.addButtonClass,children:n.jsx(y.Dropdown,{trigger:["click"],menu:m,disabled:i.executed,overlayClassName:l.css`
366
366
  .ant-dropdown-menu-root {
367
367
  max-height: 30em;
368
368
  overflow-y: auto;
369
369
  }
370
- `,children:r.jsx(g.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:r.jsx(P.PlusOutlined,{}),loading:f})})}):null}const bo=(e,o)=>({getAriaLabel:b.useCallback(n=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,o!=null?String(o):"",n].filter(Boolean).join("-"),[o,e==null?void 0:e.title,e==null?void 0:e.type])}),Xt=l.createStyles(({css:e,token:o})=>({container:e`
370
+ `,children:n.jsx(y.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:n.jsx(I.PlusOutlined,{}),loading:f})})}):null}const bo=(e,o)=>({getAriaLabel:b.useCallback(r=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,o!=null?String(o):"",r].filter(Boolean).join("-"),[o,e==null?void 0:e.title,e==null?void 0:e.type])}),Xt=l.createStyles(({css:e,token:o})=>({container:e`
371
371
  margin-bottom: 1.5em;
372
372
  padding: 1em;
373
373
  background-color: ${o.colorFillAlter};
@@ -392,11 +392,11 @@
392
392
  p {
393
393
  color: ${o.colorTextDescription};
394
394
  }
395
- `}));function Lo(e){const{label:o,title:t,description:n}=e,{styles:s}=Xt();return r.jsxs("div",{className:l.cx(s.container,e.className),children:[r.jsxs("dl",{children:[r.jsx("dt",{children:o}),r.jsx("dd",{children:r.jsx(g.Tag,{style:{background:"none"},children:t})})]}),n?r.jsx("p",{children:n}):null]})}function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zo={exports:{}};/*!
395
+ `}));function Lo(e){const{label:o,title:t,description:r}=e,{styles:s}=Xt();return n.jsxs("div",{className:l.cx(s.container,e.className),children:[n.jsxs("dl",{children:[n.jsx("dt",{children:o}),n.jsx("dd",{children:n.jsx(y.Tag,{style:{background:"none"},children:t})})]}),r?n.jsx("p",{children:r}):null]})}function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zo={exports:{}};/*!
396
396
  Copyright (c) 2018 Jed Watson.
397
397
  Licensed under the MIT License (MIT), see
398
398
  http://jedwatson.github.io/classnames
399
- */(function(e){(function(){var o={}.hasOwnProperty;function t(){for(var a="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(a=s(a,n(c)))}return a}function n(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return t.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var c in a)o.call(a,c)&&a[c]&&(i=s(i,c));return i}function s(a,i){return i?a?a+" "+i:a+i:a}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(zo);var en=zo.exports;const on=Rt(en),tn=l.createStyles(({css:e,token:o})=>({statusButtonClass:e`
399
+ */(function(e){(function(){var o={}.hasOwnProperty;function t(){for(var a="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(a=s(a,r(c)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return t.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var c in a)o.call(a,c)&&a[c]&&(i=s(i,c));return i}function s(a,i){return i?a?a+" "+i:a+i:a}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(zo);var en=zo.exports;const on=Rt(en),tn=l.createStyles(({css:e,token:o})=>({statusButtonClass:e`
400
400
  border: none;
401
401
  .ant-tag {
402
402
  width: 100%;
@@ -408,7 +408,7 @@
408
408
  }
409
409
  `,noStatusButtonClass:e`
410
410
  border-width: 2px;
411
- `}));function Pe(e){const i=e,{status:o,statusMap:t}=i,n=Z(i,["status","statusMap"]),{styles:s}=tn();let a=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];a=r.jsx(g.Tag,{color:u,children:c})}return r.jsx(g.Button,A(C({},n),{shape:"circle",size:"small",className:on(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const pe={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},He=[{value:pe.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:r.jsx(P.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:pe.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:r.jsx(P.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:pe.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:r.jsx(P.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:pe.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:pe.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:pe.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:pe.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:pe.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:pe.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],Ge=He.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},vo=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:r.jsx(P.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:r.jsx(P.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:r.jsx(P.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(P.RedoOutlined,{})}],qe=vo.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{});class ye{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"end")}createDefaultConfig(){return{}}}function nn(){const e=L.useForm(),o=l.useAPIClient(),t=l.useActionContext(),{refresh:n}=l.useResourceActionContext(),s=ve(),{workflow:a}=G();return{run(){return U(this,null,function*(){var c,u;if(a.executed){g.message.error(T("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(fo.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),n()})}}}const xo=b.createContext({});function ve(){return b.useContext(xo)}function Me(e=[]){const o=ve();return e.some(t=>ke.get(o.config,t)!=null)}function Jo(e,o){const t=[];if(!e)return[];for(let n=e.upstream;n;n=n.upstream)(typeof o!="function"||o(n))&&t.push(n);return t}function Uo(e){const o=[];if(!e)return[];for(let t=e;t;t=t.upstream)t.upstream&&t.branchIndex!=null&&o.push(t.upstream);return o}function Ho({data:e}){var i;const{styles:o}=ne(),{getAriaLabel:t}=bo(e),n=l.usePlugin(de),{Component:s=ko,end:a}=(i=n.instructions.get(e.type))!=null?i:{};return r.jsx(xo.Provider,{value:e,children:r.jsxs("div",{className:l.cx(o.nodeBlockClass),children:[r.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?r.jsx(Wo,{"aria-label":t(),upstream:e}):r.jsx("div",{className:"end-sign",children:r.jsx(P.CloseOutlined,{})})]})})}function wo(){var d;const{t:e}=Q.useTranslation(),o=l.useAPIClient(),{workflow:t,nodes:n,refresh:s}=(d=G())!=null?d:{},a=ve(),{modal:i}=g.App.useApp();if(!t)return null;const c=o.resource("flow_nodes");function u(){return U(this,null,function*(){function f(){return U(this,null,function*(){var m;yield(m=c.destroy)==null?void 0:m.call(c,{filterByTk:a.id}),s()})}const h=n.filter(m=>m===a?!1:J.parse(m.config).parameters.filter(({key:M})=>M.startsWith(`$jobsMapByNodeKey.${a.key}.`)||M===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:T("Can not delete"),content:T("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(m=>`#${m.id}`).join(", ")})});return}const y=!n.find(m=>m.upstream===a&&m.branchIndex!=null)?e("Are you sure you want to delete it?"):T("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:y,onOk:f})})}return t.executed?null:r.jsx(g.Button,{type:"text",shape:"circle",icon:r.jsx(P.DeleteOutlined,{}),onClick:u,className:"workflow-node-remove-button"})}function Co(){var a;const{execution:e,setViewJob:o}=G(),{jobs:t}=(a=ve())!=null?a:{},{styles:n}=ne();if(!e)return null;if(!t.length)return r.jsx(Pe,{className:n.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=t.find(u=>u.id==i);o(c)}return t.length>1?r.jsx(g.Dropdown,{menu:{items:t.map(i=>({key:i.id,label:r.jsxs(r.Fragment,{children:[r.jsx(Pe,{statusMap:qe,status:i.status}),r.jsx("time",{children:J.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:n.dropdownClass},children:r.jsx(Pe,{statusMap:qe,status:t[t.length-1].status,className:n.nodeJobButtonClass})}):r.jsx(Pe,{statusMap:qe,status:t[0].status,onClick:()=>o(t[0]),className:n.nodeJobButtonClass})}function rn(){return{form:L.useForm()}}function ko(e){var B;const{data:o,children:t}=e,n=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(B=G())!=null?B:{},{styles:c}=ne(),d=l.usePlugin(de).instructions.get(o.type),f=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,x]=b.useState(o.title),[y,m]=b.useState(!1),[k,O]=b.useState(!1),M=b.useMemo(()=>{const N=ke.cloneDeep(o.config);return le.createForm({initialValues:N,disabled:a.executed})},[o,a]),S=b.useCallback(N=>{m(N),N||M.reset()},[M]),E=b.useCallback(function(N){return U(this,null,function*(){var D,H;const F=N||n(d==null?void 0:d.title);x(F),F!==o.title&&(yield(H=(D=s.resource("flow_nodes")).update)==null?void 0:H.call(D,{filterByTk:o.id,values:{title:F}}),i())})},[o,d]),W=b.useCallback(function(N){if(N.target===N.currentTarget){m(!0);return}const F=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let D=N.target;D&&D!==N.currentTarget&&D!==document.documentElement;D=D.parentNode)if(Array.from(D.classList).some(H=>F.has(H))){m(!0),N.stopPropagation();return}},[]);if(!d)return r.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:r.jsx(g.Tooltip,{title:T("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:r.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),onClick:W,children:[r.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[r.jsx(g.Tag,{color:"error",children:T("Unknown node")}),r.jsx("span",{className:"workflow-node-id",children:o.id})]}),r.jsx(g.Input.TextArea,{value:h,disabled:!0,autoSize:!0}),r.jsx(wo,{}),r.jsx(Co,{})]})})});const $=n(d.title);return r.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:[r.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:y}),onClick:W,children:[r.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[r.jsx(g.Tag,{children:$}),r.jsx("span",{className:"workflow-node-id",children:o.id})]}),r.jsx(g.Input.TextArea,{disabled:a.executed,value:h,onChange:N=>x(N.target.value),onBlur:N=>E(N.target.value),autoSize:!0}),r.jsx(wo,{}),r.jsx(Co,{}),r.jsx(l.ActionContextProvider,{value:{visible:y,setVisible:S,formValueChanged:k,setFormValueChanged:O},children:r.jsx(l.FormProvider,{form:M,children:r.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:rn,useUpdateAction:nn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":f,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[o.id]:{type:"void",title:r.jsxs("div",{className:l.css`
411
+ `}));function Pe(e){const i=e,{status:o,statusMap:t}=i,r=Z(i,["status","statusMap"]),{styles:s}=tn();let a=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];a=n.jsx(y.Tag,{color:u,children:c})}return n.jsx(y.Button,A(C({},r),{shape:"circle",size:"small",className:on(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const pe={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},He=[{value:pe.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:n.jsx(I.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:pe.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:pe.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:pe.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:pe.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:pe.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:pe.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:pe.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:pe.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],Ge=He.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},vo=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{})}],qe=vo.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{});class ge{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"end")}createDefaultConfig(){return{}}}function nn(){const e=L.useForm(),o=l.useAPIClient(),t=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=ve(),{workflow:a}=G();return{run(){return U(this,null,function*(){var c,u;if(a.executed){y.message.error(T("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(fo.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),r()})}}}const xo=b.createContext({});function ve(){return b.useContext(xo)}function Me(e=[]){const o=ve();return e.some(t=>ke.get(o.config,t)!=null)}function Jo(e,o){const t=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof o!="function"||o(r))&&t.push(r);return t}function Uo(e){const o=[];if(!e)return[];for(let t=e;t;t=t.upstream)t.upstream&&t.branchIndex!=null&&o.push(t.upstream);return o}function Ho({data:e}){var i;const{styles:o}=ne(),{getAriaLabel:t}=bo(e),r=l.usePlugin(de),{Component:s=ko,end:a}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(xo.Provider,{value:e,children:n.jsxs("div",{className:l.cx(o.nodeBlockClass),children:[n.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?n.jsx(Wo,{"aria-label":t(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})})]})})}function wo(){var d;const{t:e}=Q.useTranslation(),o=l.useAPIClient(),{workflow:t,nodes:r,refresh:s}=(d=G())!=null?d:{},a=ve(),{modal:i}=y.App.useApp();if(!t)return null;const c=o.resource("flow_nodes");function u(){return U(this,null,function*(){function f(){return U(this,null,function*(){var m;yield(m=c.destroy)==null?void 0:m.call(c,{filterByTk:a.id}),s()})}const h=r.filter(m=>m===a?!1:J.parse(m.config).parameters.filter(({key:B})=>B.startsWith(`$jobsMapByNodeKey.${a.key}.`)||B===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:T("Can not delete"),content:T("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(m=>`#${m.id}`).join(", ")})});return}const g=!r.find(m=>m.upstream===a&&m.branchIndex!=null)?e("Are you sure you want to delete it?"):T("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:g,onOk:f})})}return t.executed?null:n.jsx(y.Button,{type:"text",shape:"circle",icon:n.jsx(I.DeleteOutlined,{}),onClick:u,className:"workflow-node-remove-button"})}function Co(){var a;const{execution:e,setViewJob:o}=G(),{jobs:t}=(a=ve())!=null?a:{},{styles:r}=ne();if(!e)return null;if(!t.length)return n.jsx(Pe,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=t.find(u=>u.id==i);o(c)}return t.length>1?n.jsx(y.Dropdown,{menu:{items:t.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Pe,{statusMap:qe,status:i.status}),n.jsx("time",{children:J.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Pe,{statusMap:qe,status:t[t.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Pe,{statusMap:qe,status:t[0].status,onClick:()=>o(t[0]),className:r.nodeJobButtonClass})}function rn(){return{form:L.useForm()}}function ko(e){var M;const{data:o,children:t}=e,r=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(M=G())!=null?M:{},{styles:c}=ne(),d=l.usePlugin(de).instructions.get(o.type),f=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,x]=b.useState(o.title),[g,m]=b.useState(!1),[k,O]=b.useState(!1),B=b.useMemo(()=>{const N=ke.cloneDeep(o.config);return le.createForm({initialValues:N,disabled:a.executed})},[o,a]),S=b.useCallback(N=>{m(N),N||B.reset()},[B]),E=b.useCallback(function(N){return U(this,null,function*(){var D,H;const F=N||r(d==null?void 0:d.title);x(F),F!==o.title&&(yield(H=(D=s.resource("flow_nodes")).update)==null?void 0:H.call(D,{filterByTk:o.id,values:{title:F}}),i())})},[o,d]),W=b.useCallback(function(N){if(N.target===N.currentTarget){m(!0);return}const F=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let D=N.target;D&&D!==N.currentTarget&&D!==document.documentElement;D=D.parentNode)if(Array.from(D.classList).some(H=>F.has(H))){m(!0),N.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:n.jsx(y.Tooltip,{title:T("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{color:"error",children:T("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{value:h,disabled:!0,autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{})]})})});const $=r(d.title);return n.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:g}),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{children:$}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{disabled:a.executed,value:h,onChange:N=>x(N.target.value),onBlur:N=>E(N.target.value),autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{}),n.jsx(l.ActionContextProvider,{value:{visible:g,setVisible:S,formValueChanged:k,setFormValueChanged:O},children:n.jsx(l.FormProvider,{form:B,children:n.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:rn,useUpdateAction:nn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":f,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[o.id]:{type:"void",title:n.jsxs("div",{className:l.css`
412
412
  display: flex;
413
413
  justify-content: space-between;
414
414
 
@@ -423,7 +423,7 @@
423
423
  code {
424
424
  font-weight: normal;
425
425
  }
426
- `,children:[r.jsx("strong",{children:o.title}),r.jsx(g.Tooltip,{title:T("Variable key of node"),children:r.jsx(g.Tag,{children:r.jsx("code",{children:o.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
426
+ `,children:[n.jsx("strong",{children:o.title}),n.jsx(y.Tooltip,{title:T("Variable key of node"),children:n.jsx(y.Tag,{children:n.jsx("code",{children:o.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
427
427
  .ant-input,
428
428
  .ant-select,
429
429
  .ant-cascader-picker,
@@ -435,36 +435,36 @@
435
435
  min-width: 6em;
436
436
  }
437
437
  }
438
- `},properties:d.fieldset},actions:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}})}})}})})})]}),t]})}function Ke({from:e=null,entry:o=null,branchIndex:t=null,controller:n=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=bo(e,t),u=[];for(let d=o;d;d=d.downstream)u.push(d);return r.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[r.jsx("div",{className:"workflow-branch-lines"}),n,r.jsx(Wo,{"aria-label":c(),upstream:e,branchIndex:t}),r.jsx("div",{className:"workflow-node-list",children:u.map(d=>r.jsx(Ho,{data:d},d.id))}),a?r.jsx("div",{className:"end-sign",children:r.jsx(P.CloseOutlined,{})}):null]})}function sn(){var a;const e=L.useForm(),o=l.useAPIClient(),{workflow:t}=(a=G())!=null?a:{},n=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return U(this,null,function*(){if(t.executed){g.message.error(T("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield o.resource("workflows").update({filterByTk:t.id,values:{config:e.values}}),n.setFormValueChanged(!1),n.setVisible(!1),s()})}}}class So{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function ln(){const e=l.useCompile(),{workflow:o,execution:t}=G(),{styles:n}=ne(),s=Ao();return t?r.jsx(l.SchemaComponent,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:r.jsx(P.InfoOutlined,{}),shape:"circle",size:"small",className:n.nodeJobButtonClass,type:"primary"},properties:{[t.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:r.jsxs("div",{className:l.cx(n.nodeTitleClass),children:[r.jsx(g.Tag,{children:e(s.title)}),r.jsx("strong",{children:o.title}),r.jsxs("span",{className:"workflow-node-id",children:["#",t.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
438
+ `},properties:d.fieldset},actions:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}})}})}})})})]}),t]})}function Ke({from:e=null,entry:o=null,branchIndex:t=null,controller:r=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=bo(e,t),u=[];for(let d=o;d;d=d.downstream)u.push(d);return n.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(Wo,{"aria-label":c(),upstream:e,branchIndex:t}),n.jsx("div",{className:"workflow-node-list",children:u.map(d=>n.jsx(Ho,{data:d},d.id))}),a?n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})}):null]})}function sn(){var a;const e=L.useForm(),o=l.useAPIClient(),{workflow:t}=(a=G())!=null?a:{},r=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return U(this,null,function*(){if(t.executed){y.message.error(T("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield o.resource("workflows").update({filterByTk:t.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class So{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function ln(){const e=l.useCompile(),{workflow:o,execution:t}=G(),{styles:r}=ne(),s=Ao();return t?n.jsx(l.SchemaComponent,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:n.jsx(I.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[t.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:l.cx(r.nodeTitleClass),children:[n.jsx(y.Tag,{children:e(s.title)}),n.jsx("strong",{children:o.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",t.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
439
439
  padding: 1em;
440
440
  background-color: #eee;
441
- `},"x-read-pretty":!0}}}}}}):null}function an(){return{form:L.useForm()}}const cn=()=>{const e=l.useAPIClient(),{workflow:o,refresh:t}=G(),[n,s]=b.useState(""),[a,i]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=l.useCompile(),h=Ao();b.useEffect(()=>{var $,B;o&&s((B=($=o.triggerTitle)!=null?$:o.title)!=null?B:f(h==null?void 0:h.title))},[o,h]);const x=b.useMemo(()=>{const $=ke.cloneDeep(o.config);return le.createForm({initialValues:$,disabled:o.executed})},[o]),y=b.useCallback($=>{i($),$||x.reset()},[x]),m=b.useCallback(function($){return U(this,null,function*(){const B=$||f(h==null?void 0:h.title);s(B),B!==o.triggerTitle&&(yield e.resource("workflows").update({filterByTk:o.id,values:{triggerTitle:B}}),t())})},[o,h]),k=b.useCallback(function($){var N;if($.target===$.currentTarget){i(!0);return}const B=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let F=$.target;F&&F!==$.currentTarget;F=F.parentNode)if(Array.from((N=F.classList)!=null?N:[]).some(D=>B.has(D))){i(!0),$.stopPropagation();return}},[]),O=o.executed?'{{t("View")}}':'{{t("Configure")}}',M=T("Trigger");if(!h)return r.jsx(g.Tooltip,{title:T("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:r.jsxs("div",{role:"button","aria-label":`${M}-${n}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[r.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:r.jsx(g.Tag,{color:"error",children:T("Unknown trigger")})}),r.jsx("div",{className:"workflow-node-title",children:r.jsx(g.Input.TextArea,{value:n,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:W}=h;return r.jsxs("div",{role:"button","aria-label":`${M}-${n}`,className:l.cx(d.nodeCardClass),onClick:k,children:[r.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:r.jsxs(g.Tag,{color:"gold",children:[r.jsx("span",{className:"trigger",children:M}),r.jsx("span",{className:"type",children:f(h.title)})]})}),r.jsx("div",{className:"workflow-node-title",children:r.jsx(g.Input.TextArea,{value:n,onChange:$=>s($.target.value),onBlur:$=>m($.target.value),autoSize:!0,disabled:o.executed})}),r.jsx(ln,{}),r.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:y,formValueChanged:c,setFormValueChanged:u},children:r.jsx(l.FormProvider,{form:x,children:r.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:an}),components:W,schema:{name:`workflow-trigger-${o.id}`,type:"void",properties:{config:{type:"void","x-content":O,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:M,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
441
+ `},"x-read-pretty":!0}}}}}}):null}function an(){return{form:L.useForm()}}const cn=()=>{const e=l.useAPIClient(),{workflow:o,refresh:t}=G(),[r,s]=b.useState(""),[a,i]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=l.useCompile(),h=Ao();b.useEffect(()=>{var $,M;o&&s((M=($=o.triggerTitle)!=null?$:o.title)!=null?M:f(h==null?void 0:h.title))},[o,h]);const x=b.useMemo(()=>{const $=ke.cloneDeep(o.config);return le.createForm({initialValues:$,disabled:o.executed})},[o]),g=b.useCallback($=>{i($),$||x.reset()},[x]),m=b.useCallback(function($){return U(this,null,function*(){const M=$||f(h==null?void 0:h.title);s(M),M!==o.triggerTitle&&(yield e.resource("workflows").update({filterByTk:o.id,values:{triggerTitle:M}}),t())})},[o,h]),k=b.useCallback(function($){var N;if($.target===$.currentTarget){i(!0);return}const M=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let F=$.target;F&&F!==$.currentTarget;F=F.parentNode)if(Array.from((N=F.classList)!=null?N:[]).some(D=>M.has(D))){i(!0),$.stopPropagation();return}},[]),O=o.executed?'{{t("View")}}':'{{t("Configure")}}',B=T("Trigger");if(!h)return n.jsx(y.Tooltip,{title:T("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(y.Tag,{color:"error",children:T("Unknown trigger")})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:W}=h;return n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(y.Tag,{color:"gold",children:[n.jsx(I.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:f(h.title)})]})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,onChange:$=>s($.target.value),onBlur:$=>m($.target.value),autoSize:!0,disabled:o.executed})}),n.jsx(ln,{}),n.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:g,formValueChanged:c,setFormValueChanged:u},children:n.jsx(l.FormProvider,{form:x,children:n.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:an}),components:W,schema:{name:`workflow-trigger-${o.id}`,type:"void",properties:{config:{type:"void","x-content":O,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:B,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
442
442
  .ant-select.auto-width {
443
443
  width: auto;
444
444
  min-width: 6em;
445
445
  }
446
- `},properties:S},actions:C({},o.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:sn}}}})})}}}})})})]})};function Ao(){const e=l.usePlugin(de),{workflow:o}=G();return e.triggers.get(o.type)}function Go({entry:e}){const{styles:o}=ne(),{workflow:t}=G(),[n,s]=b.useState(100);return r.jsxs("div",{className:"workflow-canvas-wrapper",children:[r.jsx(Zt,{FallbackComponent:l.ErrorFallback,onError:console.error,children:r.jsx("div",{className:"workflow-canvas",style:{zoom:n/100},children:r.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
446
+ `},properties:S},actions:C({},o.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:sn}}}})})}}}})})})]})};function Ao(){const e=l.usePlugin(de),{workflow:o}=G();return e.triggers.get(o.type)}function Go({entry:e}){const{styles:o}=ne(),{workflow:t}=G(),[r,s]=b.useState(100);return n.jsxs("div",{className:"workflow-canvas-wrapper",children:[n.jsx(Zt,{FallbackComponent:l.ErrorFallback,onError:console.error,children:n.jsx("div",{className:"workflow-canvas",style:{zoom:r/100},children:n.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
447
447
  margin-top: 0 !important;
448
- `),children:r.jsxs("div",{className:o.branchClass,children:[t!=null&&t.executed?r.jsx(g.Alert,{type:"warning",message:T("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:l.css`
448
+ `),children:n.jsxs("div",{className:o.branchClass,children:[t!=null&&t.executed?n.jsx(y.Alert,{type:"warning",message:T("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:l.css`
449
449
  margin-bottom: 1em;
450
- `}):null,r.jsx(cn,{}),r.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
450
+ `}):null,n.jsx(cn,{}),n.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
451
451
  margin-top: 0 !important;
452
- `),children:r.jsx(Ke,{entry:e})}),r.jsx("div",{className:o.terminalClass,children:T("End")})]})})})}),r.jsx("div",{className:"workflow-canvas-zoomer",children:r.jsx(g.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:n,onChange:s})})]})}function Fo(e){const o=new Map;e.forEach(t=>o.set(t.id,t));for(const t of o.values())t.upstreamId&&(t.upstream=o.get(t.upstreamId)),t.downstreamId&&(t.downstream=o.get(t.downstreamId))}function Oo(e,o){o(e),e.properties&&Object.keys(e.properties).forEach(t=>{Oo(e.properties[t],o)})}function xe(e){return`/admin/workflow/workflows/${e}`}function Ye(e){return`/admin/workflow/executions/${e}`}function dn(e,o=[]){const t=new Map;e.forEach(n=>{n.jobs=[],t.set(n.id,n)}),o.forEach(n=>{const s=t.get(n.nodeId);s.jobs.push(n),n.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(n=>{n.jobs=n.jobs.sort((s,a)=>s.id-a.id)})}function un(){const{instructions:e}=l.usePlugin(de),o=l.useCompile(),{viewJob:t,setViewJob:n}=G(),{styles:s}=ne(),{node:a={}}=t!=null?t:{},i=e.get(a.type);return r.jsx(l.ActionContextProvider,{value:{visible:!!t,setVisible:n},children:r.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`${t==null?void 0:t.id}-${t==null?void 0:t.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:r.jsxs("div",{className:s.nodeTitleClass,children:[r.jsx(g.Tag,{children:o(i==null?void 0:i.title)}),r.jsx("strong",{children:a.title}),r.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:vo,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function pn(e){const{execution:o}=G(),t=l.useAPIClient(),n=te.useNavigate(),{styles:s}=ne(),[a,i]=b.useState([]),[c,u]=b.useState([]);b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$lt:o.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{i(f.data)}).catch(()=>{})},[o]),b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$gt:o.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{u(f.data.reverse())}).catch(()=>{})},[o]);const d=b.useCallback(({key:f})=>{f!=o.id&&n(Ye(f))},[o]);return o?r.jsx(g.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${o.id}`],className:l.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,o,...a].map(f=>({key:f.id,label:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"id",children:`#${f.id}`}),r.jsx("time",{children:J.str2moment(f.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:r.jsx("span",{children:r.jsx(Pe,{statusMap:Ge,status:f.status})})}))},children:r.jsxs(g.Space,{children:[r.jsx("strong",{children:`#${o.id}`}),r.jsx(P.DownOutlined,{})]})}):null}function mn(){var S;const{t:e}=Q.useTranslation(),o=l.useCompile(),{data:t,loading:n,refresh:s}=l.useResourceActionContext(),{setTitle:a}=l.useDocumentTitle(),[i,c]=b.useState(null),u=l.useApp(),d=l.useAPIClient();b.useEffect(()=>{var N;const{workflow:B}=(N=t==null?void 0:t.data)!=null?N:{};a==null||a(`${B!=null&&B.title?`${B.title} - `:""}${T("Execution history")}`)},[t==null?void 0:t.data]);const f=b.useCallback(()=>{g.Modal.confirm({title:T("Cancel the execution"),icon:r.jsx(P.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:t==null?void 0:t.data.id}).then(()=>{g.message.success(e("Operation succeeded")),s()}).catch(B=>{console.error(B.data.error)})}})},[t==null?void 0:t.data]);if(!(t!=null&&t.data))return n?r.jsx(g.Spin,{}):r.jsx(g.Result,{status:"404",title:"Not found"});const E=(S=t==null?void 0:t.data)!=null?S:{},{jobs:h=[],workflow:W={}}=E,$=W,{nodes:x=[],revisions:y=[]}=$,m=Z($,["nodes","revisions"]),k=Z(E,["jobs","workflow"]);Fo(x),dn(x,h);const O=x.find(B=>!B.upstream),M=Ge[k.status];return r.jsxs(Ie.Provider,{value:{workflow:m.type?m:null,nodes:x,execution:k,viewJob:i,setViewJob:c},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(g.Breadcrumb,{items:[{title:r.jsx(te.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:r.jsx(g.Tooltip,{title:`Key: ${m.key}`,children:r.jsx(te.Link,{to:xe(m.id),children:m.title})})},{title:r.jsx(pn,{})}]})}),r.jsxs("aside",{children:[r.jsx(g.Tag,{color:M.color,children:o(M.label)}),k.status?null:r.jsx(g.Tooltip,{title:T("Cancel the execution"),children:r.jsx(g.Button,{type:"link",danger:!0,onClick:f,shape:"circle",size:"small",icon:r.jsx(P.StopOutlined,{})})}),r.jsx("time",{children:J.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),r.jsx(Go,{entry:O}),r.jsx(un,{})]})}const qo=()=>{const e=te.useParams(),{styles:o}=ne();return r.jsx("div",{className:l.cx(o.workflowPageClass),children:r.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:mn}})})},Ko=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext();return r.jsx(te.Link,{to:Ye(o),onClick:()=>t(!1),children:e("View")})},fn={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${p}" })}}`,"x-component"({value:e}){const{setVisible:o}=l.useActionContext();return r.jsx(te.Link,{to:xe(e),onClick:()=>o(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:He}}]},Yo={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${p}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:fn,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=Q.useTranslation(),{refresh:o,defaultRequest:t}=l.useResourceActionContext(),{resource:n}=l.useResourceContext(),{setVisible:s}=l.useActionContext();return{run(){return U(this,null,function*(){var i;yield n.destroy({filter:(i=t.params)==null?void 0:i.filter}),g.message.success(e("Operation succeeded")),o(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${p}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${p}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${p}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"}}}}}}}}}}};function _o(e){var a;const t=l.useCompile()(e.label),n=b.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(a=Ge[e.value])!=null?a:{};return r.jsx(g.Tag,{color:s,onMouseDown:n,closable:e.closable,onClose:e.onClose,children:t})}function hn(e){const o=l.useCompile();return r.jsxs(r.Fragment,{children:[r.jsx(_o,C({},e)),e.description?r.jsx("span",{children:o(e.description)}):null]})}function gn(o){var e=Z(o,[]);const t=e.multiple?"multiple":null;return r.jsx(g.Select,A(C({role:"button","data-testid":`select-${t||"single"}`},e),{mode:t,optionLabelProp:"label",tagRender:_o,children:He.filter(n=>!!n.value&&n.value!==pe.ABORTED).map(n=>r.jsx(g.Select.Option,A(C({},n),{children:r.jsx(hn,C({},n))}),n.value))}))}function Zo(e){const{t:o}=Q.useTranslation(),{refresh:t}=l.useResourceActionContext(),{resource:n}=l.useResourceContext(),s=l.useRecord(),a=b.useCallback(()=>{g.Modal.confirm({title:T("Cancel the execution"),icon:r.jsx(P.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{n.cancel({filterByTk:s.id}).then(()=>{g.message.success(o("Operation succeeded")),t()}).catch(i=>{console.error(i.data.error)})}})},[s]);return r.jsxs("div",{className:l.css`
452
+ `),children:n.jsx(Ke,{entry:e})}),n.jsx("div",{className:o.terminalClass,children:T("End")})]})})})}),n.jsx("div",{className:"workflow-canvas-zoomer",children:n.jsx(y.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:r,onChange:s})})]})}function Fo(e){const o=new Map;e.forEach(t=>o.set(t.id,t));for(const t of o.values())t.upstreamId&&(t.upstream=o.get(t.upstreamId)),t.downstreamId&&(t.downstream=o.get(t.downstreamId))}function Oo(e,o){o(e),e.properties&&Object.keys(e.properties).forEach(t=>{Oo(e.properties[t],o)})}function xe(e){return`/admin/workflow/workflows/${e}`}function Ye(e){return`/admin/workflow/executions/${e}`}function dn(e,o=[]){const t=new Map;e.forEach(r=>{r.jobs=[],t.set(r.id,r)}),o.forEach(r=>{const s=t.get(r.nodeId);s.jobs.push(r),r.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(r=>{r.jobs=r.jobs.sort((s,a)=>s.id-a.id)})}function un(){const{instructions:e}=l.usePlugin(de),o=l.useCompile(),{viewJob:t,setViewJob:r}=G(),{styles:s}=ne(),{node:a={}}=t!=null?t:{},i=e.get(a.type);return n.jsx(l.ActionContextProvider,{value:{visible:!!t,setVisible:r},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`${t==null?void 0:t.id}-${t==null?void 0:t.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:s.nodeTitleClass,children:[n.jsx(y.Tag,{children:o(i==null?void 0:i.title)}),n.jsx("strong",{children:a.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:vo,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function pn(e){const{execution:o}=G(),t=l.useAPIClient(),r=te.useNavigate(),{styles:s}=ne(),[a,i]=b.useState([]),[c,u]=b.useState([]);b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$lt:o.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{i(f.data)}).catch(()=>{})},[o]),b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$gt:o.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{u(f.data.reverse())}).catch(()=>{})},[o]);const d=b.useCallback(({key:f})=>{f!=o.id&&r(Ye(f))},[o]);return o?n.jsx(y.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${o.id}`],className:l.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,o,...a].map(f=>({key:f.id,label:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"id",children:`#${f.id}`}),n.jsx("time",{children:J.str2moment(f.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:n.jsx("span",{children:n.jsx(Pe,{statusMap:Ge,status:f.status})})}))},children:n.jsxs(y.Space,{children:[n.jsx("strong",{children:`#${o.id}`}),n.jsx(I.DownOutlined,{})]})}):null}function mn(){var S;const{t:e}=Q.useTranslation(),o=l.useCompile(),{data:t,loading:r,refresh:s}=l.useResourceActionContext(),{setTitle:a}=l.useDocumentTitle(),[i,c]=b.useState(null),u=l.useApp(),d=l.useAPIClient();b.useEffect(()=>{var N;const{workflow:M}=(N=t==null?void 0:t.data)!=null?N:{};a==null||a(`${M!=null&&M.title?`${M.title} - `:""}${T("Execution history")}`)},[t==null?void 0:t.data]);const f=b.useCallback(()=>{y.Modal.confirm({title:T("Cancel the execution"),icon:n.jsx(I.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:t==null?void 0:t.data.id}).then(()=>{y.message.success(e("Operation succeeded")),s()}).catch(M=>{console.error(M.data.error)})}})},[t==null?void 0:t.data]);if(!(t!=null&&t.data))return r?n.jsx(y.Spin,{}):n.jsx(y.Result,{status:"404",title:"Not found"});const E=(S=t==null?void 0:t.data)!=null?S:{},{jobs:h=[],workflow:W={}}=E,$=W,{nodes:x=[],revisions:g=[]}=$,m=Z($,["nodes","revisions"]),k=Z(E,["jobs","workflow"]);Fo(x),dn(x,h);const O=x.find(M=>!M.upstream),B=Ge[k.status];return n.jsxs(Ie.Provider,{value:{workflow:m.type?m:null,nodes:x,execution:k,viewJob:i,setViewJob:c},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(y.Breadcrumb,{items:[{title:n.jsx(te.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:n.jsx(y.Tooltip,{title:`Key: ${m.key}`,children:n.jsx(te.Link,{to:xe(m.id),children:m.title})})},{title:n.jsx(pn,{})}]})}),n.jsxs("aside",{children:[n.jsx(y.Tag,{color:B.color,children:o(B.label)}),k.status?null:n.jsx(y.Tooltip,{title:T("Cancel the execution"),children:n.jsx(y.Button,{type:"link",danger:!0,onClick:f,shape:"circle",size:"small",icon:n.jsx(I.StopOutlined,{})})}),n.jsx("time",{children:J.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),n.jsx(Go,{entry:O}),n.jsx(un,{})]})}const qo=()=>{const e=te.useParams(),{styles:o}=ne();return n.jsx("div",{className:l.cx(o.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:mn}})})},Ko=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext();return n.jsx(te.Link,{to:Ye(o),onClick:()=>t(!1),children:e("View")})},fn={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${p}" })}}`,"x-component"({value:e}){const{setVisible:o}=l.useActionContext();return n.jsx(te.Link,{to:xe(e),onClick:()=>o(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:He}}]},Yo={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${p}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:fn,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=Q.useTranslation(),{refresh:o,defaultRequest:t}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext();return{run(){return U(this,null,function*(){var i;yield r.destroy({filter:(i=t.params)==null?void 0:i.filter}),y.message.success(e("Operation succeeded")),o(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${p}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${p}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${p}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"}}}}}}}}}}};function _o(e){var a;const t=l.useCompile()(e.label),r=b.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(a=Ge[e.value])!=null?a:{};return n.jsx(y.Tag,{color:s,onMouseDown:r,closable:e.closable,onClose:e.onClose,children:t})}function hn(e){const o=l.useCompile();return n.jsxs(n.Fragment,{children:[n.jsx(_o,C({},e)),e.description?n.jsx("span",{children:o(e.description)}):null]})}function yn(o){var e=Z(o,[]);const t=e.multiple?"multiple":null;return n.jsx(y.Select,A(C({role:"button","data-testid":`select-${t||"single"}`},e),{mode:t,optionLabelProp:"label",tagRender:_o,children:He.filter(r=>!!r.value&&r.value!==pe.ABORTED).map(r=>n.jsx(y.Select.Option,A(C({},r),{children:n.jsx(hn,C({},r))}),r.value))}))}function Zo(e){const{t:o}=Q.useTranslation(),{refresh:t}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),s=l.useRecord(),a=b.useCallback(()=>{y.Modal.confirm({title:T("Cancel the execution"),icon:n.jsx(I.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{r.cancel({filterByTk:s.id}).then(()=>{y.message.success(o("Operation succeeded")),t()}).catch(i=>{console.error(i.data.error)})}})},[s]);return n.jsxs("div",{className:l.css`
453
453
  display: flex;
454
- `,children:[e.children,s.status?null:r.jsx(g.Tooltip,{title:T("Cancel the execution"),children:r.jsx(g.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:r.jsx(P.StopOutlined,{})})})]})}function Qo(){const e=l.useResourceActionContext();return{onClick(){return U(this,null,function*(){var t;(t=e==null?void 0:e.refresh)==null||t.call(e)})}}}function yn(n){var s=n,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const{workflow:a}=G(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(l.ResourceActionProvider,C({},i))}function bn(){var B;const e=te.useNavigate(),{t:o}=Q.useTranslation(),t=l.useApp(),{data:n,refresh:s,loading:a}=l.useResourceActionContext(),{resource:i}=l.useResourceContext(),{setTitle:c}=l.useDocumentTitle(),[u,d]=b.useState(!1),{styles:f}=ne(),{modal:h}=g.App.useApp();if(b.useEffect(()=>{var D;const{title:F}=(D=n==null?void 0:n.data)!=null?D:{};c==null||c(`${T("Workflow")}${F?`: ${F}`:""}`)},[n==null?void 0:n.data]),!(n!=null&&n.data))return a?r.jsx(g.Spin,{}):r.jsx(g.Result,{status:"404",title:"Not found",extra:r.jsx(g.Button,{onClick:()=>e(-1),children:T("Go back")})});const N=(B=n==null?void 0:n.data)!=null?B:{},{nodes:x=[],revisions:y=[]}=N,m=Z(N,["nodes","revisions"]);Fo(x);const k=x.find(F=>!F.upstream);function O({key:F}){F!=m.id&&e(xe(F))}function M(F){return U(this,null,function*(){yield i.update({filterByTk:m.id,values:{enabled:F}}),s()})}function S(){return U(this,null,function*(){const{data:{data:F}}=yield i.revision({filterByTk:m.id,filter:{key:m.key}});g.message.success(o("Operation succeeded")),e(`/admin/workflow/workflows/${F.id}`)})}function E(){return U(this,null,function*(){const F=m.current?T("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:o("Are you sure you want to delete it?"),content:F,onOk(){return U(this,null,function*(){var H;yield i.destroy({filterByTk:m.id}),g.message.success(o("Operation succeeded")),e(m.current?t.pluginSettingsManager.getRoutePath("workflow"):xe((H=y.find(K=>K.current))==null?void 0:H.id))})}})})}function W(D){return U(this,arguments,function*({key:F}){switch(F){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const $=m.executed&&!y.find(F=>!F.executed&&new Date(F.createdAt)>new Date(m.createdAt));return r.jsxs(Ie.Provider,{value:{workflow:m,nodes:x,refresh:s},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(g.Breadcrumb,{items:[{title:r.jsx(te.Link,{to:t.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:r.jsx(g.Tooltip,{title:`Key: ${m.key}`,children:r.jsx("strong",{children:m.title})})}]})}),r.jsxs("aside",{children:[r.jsx(g.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:O,defaultSelectedKeys:[`${m.id}`],className:l.cx(f.dropdownClass,f.workflowVersionDropdownClass),items:y.sort((F,D)=>D.id-F.id).map((F,D)=>({role:"button","aria-label":`version-${D}`,key:`${F.id}`,icon:F.current?r.jsx(P.RightOutlined,{}):null,className:l.cx({executed:F.executed,unexecuted:!F.executed,enabled:F.enabled}),label:r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:`#${F.id}`}),r.jsx("time",{children:J.str2moment(F.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:r.jsxs(g.Button,{type:"text","aria-label":"version",children:[r.jsx("label",{children:T("Version")}),r.jsx("span",{children:m!=null&&m.id?`#${m.id}`:null}),r.jsx(P.DownOutlined,{})]})}),r.jsx(g.Switch,{checked:m.enabled,onChange:M,checkedChildren:T("On"),unCheckedChildren:T("Off")}),r.jsx(g.Dropdown,{menu:{items:[{role:"button","aria-label":"history",key:"history",label:T("Execution history"),disabled:!m.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:T("Copy to new version"),disabled:!$},{role:"button","aria-label":"delete",key:"delete",label:o("Delete")}],onClick:W},children:r.jsx(g.Button,{"aria-label":"more",type:"text",icon:r.jsx(P.EllipsisOutlined,{})})}),r.jsx(l.ActionContextProvider,{value:{visible:u,setVisible:d},children:r.jsx(l.SchemaComponent,{schema:Yo,components:{ExecutionResourceProvider:yn,ExecutionLink:Ko,ExecutionStatusColumn:Zo},scope:{useRefreshActionProps:Qo}})})]})]}),r.jsx(Go,{entry:k})]})}const Xo=()=>{const e=te.useParams(),{styles:o}=ne();return r.jsx("div",{className:l.cx(o.workflowPageClass),children:r.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:bn}})})},vn=n=>{var s=n,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const a=l.useRecord(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(l.ResourceActionProvider,C({},i))},xn=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext(),{getAriaLabel:n}=l.useGetAriaLabelOfAction("Configure");return r.jsx(te.Link,{"aria-label":n(),to:xe(o),onClick:()=>t(!1),children:e("Configure")})};function wn(n){var s=n,{component:e="div",children:o}=s,t=Z(s,["component","children"]);const[a,i]=b.useState(!1),c=L.useFieldSchema();return r.jsxs(l.ActionContextProvider,{value:{visible:a,setVisible:i,fieldSchema:c},children:[b.createElement(e,A(C({},t),{onClick(){i(!0)}}),o),r.jsx(l.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Cn({data:e}){const{label:o,color:t,options:n}=e,s=l.useCompile();return r.jsxs(g.Space,{direction:"vertical",children:[r.jsx(g.Tag,{color:t,children:s(o)}),r.jsx(g.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(n.description)})]})}const Ro={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${p}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}",optionRender:Cn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${p}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${p}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${p}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},fe={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${p}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${p}" }) }}`},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${p}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},kn={type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Ro,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Ro},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${p}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${p}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=Q.useTranslation(),{resource:o}=l.useResourceContext(),t=l.useResourceActionContext();return{run(){return U(this,null,function*(){yield o.sync(),yield t==null?void 0:t.refresh(),g.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:fe.title,type:fe.type,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(o){const t=l.useRecord();return b.createElement("a",C({"aria-label":`executed-${t.title}`},o))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Yo}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:fe.title,enabled:fe.enabled,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${p}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${p}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=Q.useTranslation(),{refresh:o}=l.useResourceActionContext(),{resource:t,targetKey:n}=l.useResourceContext(),{setVisible:s}=l.useActionContext(),{[n]:a}=l.useRecord(),{values:i}=L.useForm();return{run(){return U(this,null,function*(){yield t.revision({filterByTk:a,values:i}),g.message.success(e("Operation succeeded")),o(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function Sn(e){const o=L.useField(),t=l.useRecord(),n=l.usePlugin(de);return L.useFormEffects(s=>{le.onFieldChange("type",a=>{let i=t.id||!a.value;if(a.value){const c=n.triggers.get(a.value);c.sync!=null?(i=!0,o.setValue(c.sync)):o.setInitialValue(!1)}o.setPattern(i?"disabled":"editable")})}),b.useEffect(()=>{if(t.id){o.setPattern("disabled");const s=n.triggers.get(t.type);s.sync!=null?o.setValue(s.sync):o.setInitialValue(!1)}},[t.id,o,n.triggers]),r.jsx(Te,C({},e))}function An(e){const o=l.useApp();e.visible=!!(l.usePlugin("multi-app-share-collection")||o.name!=="main")}function Fn(){const e=b.useContext(l.SchemaComponentContext),{getTriggersOptions:o}=l.usePlugin(de);return r.jsx(g.Card,{bordered:!1,children:r.jsx(l.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:r.jsx(l.SchemaComponent,{schema:kn,components:{WorkflowLink:xn,ExecutionResourceProvider:vn,ExecutionLink:Ko,OpenDrawer:wn,ExecutionStatusSelect:gn,SyncOptionSelect:Sn,ExecutionStatusColumn:Zo,Tooltip:g.Tooltip},scope:{getTriggersOptions:o,useWorkflowSyncAction:An,useRefreshActionProps:Qo}})})})}function On(n){var s=n,{collection:e,dataPath:o}=s,t=Z(s,["collection","dataPath"]);const{insert:a}=l.useSchemaInitializer(),{getTemplateSchemaByMode:i}=l.useSchemaTemplateManager(),{getCollection:c}=l.useCollectionManager_deprecated(),u=l.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,x]=l.parseCollectionName(e);d=c(x,h)}else d=e;function f(x){return U(this,arguments,function*({item:h}){const y=h.template?yield i(h):null,m={type:"void",name:ho.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:o},"x-component":"CardItem","x-component-props":{title:t.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:y||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};Oo(m,k=>{k["x-uid"]&&delete k["x-uid"]}),a(m)})}return r.jsx(l.SchemaInitializerItem,A(C({},t),{onClick:f,items:u}))}function Be(e){var a;const o=l.useSchemaInitializerItem(),t=(a=e==null?void 0:e.collection)!=null?a:o.collection;let n,s;if(typeof t=="string"){const i=l.parseCollectionName(t);n=i[0],s=i[1]}else s=t;return r.jsx(l.CollectionProvider_deprecated,{dataSource:n,collection:s,children:r.jsx(On,C(C({},o),e))})}function Tn(){return!0}const To=L.observer(e=>{const d=e,{filter:o=Tn}=d,t=Z(d,["filter"]),n=l.useCompile(),{getCollectionFields:s}=l.useCollectionManager_deprecated(),{values:a}=L.useForm(),[i,c]=l.parseCollectionName(a==null?void 0:a.collection),u=s(c,i);return r.jsx(g.Select,A(C({popupMatchSelectWidth:!1},t),{options:u.filter(o).map(f=>{var h;return{label:n((h=f.uiSchema)==null?void 0:h.title),value:f.name}})}))},{displayName:"FieldsSelect"}),ae={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},et={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:l.css`
454
+ `,children:[e.children,s.status?null:n.jsx(y.Tooltip,{title:T("Cancel the execution"),children:n.jsx(y.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:n.jsx(I.StopOutlined,{})})})]})}function Qo(){const e=l.useResourceActionContext();return{onClick(){return U(this,null,function*(){var t;(t=e==null?void 0:e.refresh)==null||t.call(e)})}}}function gn(r){var s=r,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const{workflow:a}=G(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))}function bn(){var M;const e=te.useNavigate(),{t:o}=Q.useTranslation(),t=l.useApp(),{data:r,refresh:s,loading:a}=l.useResourceActionContext(),{resource:i}=l.useResourceContext(),{setTitle:c}=l.useDocumentTitle(),[u,d]=b.useState(!1),{styles:f}=ne(),{modal:h}=y.App.useApp();if(b.useEffect(()=>{var D;const{title:F}=(D=r==null?void 0:r.data)!=null?D:{};c==null||c(`${T("Workflow")}${F?`: ${F}`:""}`)},[r==null?void 0:r.data]),!(r!=null&&r.data))return a?n.jsx(y.Spin,{}):n.jsx(y.Result,{status:"404",title:"Not found",extra:n.jsx(y.Button,{onClick:()=>e(-1),children:T("Go back")})});const N=(M=r==null?void 0:r.data)!=null?M:{},{nodes:x=[],revisions:g=[]}=N,m=Z(N,["nodes","revisions"]);Fo(x);const k=x.find(F=>!F.upstream);function O({key:F}){F!=m.id&&e(xe(F))}function B(F){return U(this,null,function*(){yield i.update({filterByTk:m.id,values:{enabled:F}}),s()})}function S(){return U(this,null,function*(){const{data:{data:F}}=yield i.revision({filterByTk:m.id,filter:{key:m.key}});y.message.success(o("Operation succeeded")),e(`/admin/workflow/workflows/${F.id}`)})}function E(){return U(this,null,function*(){const F=m.current?T("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:o("Are you sure you want to delete it?"),content:F,onOk(){return U(this,null,function*(){var H;yield i.destroy({filterByTk:m.id}),y.message.success(o("Operation succeeded")),e(m.current?t.pluginSettingsManager.getRoutePath("workflow"):xe((H=g.find(K=>K.current))==null?void 0:H.id))})}})})}function W(D){return U(this,arguments,function*({key:F}){switch(F){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const $=m.executed&&!g.find(F=>!F.executed&&new Date(F.createdAt)>new Date(m.createdAt));return n.jsxs(Ie.Provider,{value:{workflow:m,nodes:x,refresh:s},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(y.Breadcrumb,{items:[{title:n.jsx(te.Link,{to:t.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:n.jsx(y.Tooltip,{title:`Key: ${m.key}`,children:n.jsx("strong",{children:m.title})})}]})}),n.jsxs("aside",{children:[m.sync?n.jsx(y.Tag,{color:"orange",children:T("Synchronously")}):n.jsx(y.Tag,{color:"cyan",children:T("Asynchronously")}),n.jsx(y.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:O,defaultSelectedKeys:[`${m.id}`],className:l.cx(f.dropdownClass,f.workflowVersionDropdownClass),items:g.sort((F,D)=>D.id-F.id).map((F,D)=>({role:"button","aria-label":`version-${D}`,key:`${F.id}`,icon:F.current?n.jsx(I.RightOutlined,{}):null,className:l.cx({executed:F.executed,unexecuted:!F.executed,enabled:F.enabled}),label:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:`#${F.id}`}),n.jsx("time",{children:J.str2moment(F.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:n.jsxs(y.Button,{type:"text","aria-label":"version",children:[n.jsx("label",{children:T("Version")}),n.jsx("span",{children:m!=null&&m.id?`#${m.id}`:null}),n.jsx(I.DownOutlined,{})]})}),n.jsx(y.Switch,{checked:m.enabled,onChange:B,checkedChildren:T("On"),unCheckedChildren:T("Off")}),n.jsx(y.Dropdown,{menu:{items:[{key:"key",label:`Key: ${m.key}`,disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:T("Execution history"),disabled:!m.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:T("Copy to new version"),disabled:!$},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:o("Delete")}],onClick:W},children:n.jsx(y.Button,{"aria-label":"more",type:"text",icon:n.jsx(I.EllipsisOutlined,{})})}),n.jsx(l.ActionContextProvider,{value:{visible:u,setVisible:d},children:n.jsx(l.SchemaComponent,{schema:Yo,components:{ExecutionResourceProvider:gn,ExecutionLink:Ko,ExecutionStatusColumn:Zo},scope:{useRefreshActionProps:Qo}})})]})]}),n.jsx(Go,{entry:k})]})}const Xo=()=>{const e=te.useParams(),{styles:o}=ne();return n.jsx("div",{className:l.cx(o.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:bn}})})},vn=r=>{var s=r,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const a=l.useRecord(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))},xn=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext(),{getAriaLabel:r}=l.useGetAriaLabelOfAction("Configure");return n.jsx(te.Link,{"aria-label":r(),to:xe(o),onClick:()=>t(!1),children:e("Configure")})};function wn(r){var s=r,{component:e="div",children:o}=s,t=Z(s,["component","children"]);const[a,i]=b.useState(!1),c=L.useFieldSchema();return n.jsxs(l.ActionContextProvider,{value:{visible:a,setVisible:i,fieldSchema:c},children:[b.createElement(e,A(C({},t),{onClick(){i(!0)}}),o),n.jsx(l.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Cn({data:e}){const{label:o,color:t,options:r}=e,s=l.useCompile();return n.jsxs(y.Space,{direction:"vertical",children:[n.jsx(y.Tag,{color:t,children:s(o)}),n.jsx(y.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(r.description)})]})}const Ro={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${p}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}",optionRender:Cn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"select",uiSchema:{title:`{{t("Mode", { ns: "${p}" })}}`,type:"boolean","x-decorator":"FormItem","x-component":"Select",enum:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,color:"cyan"},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,color:"orange"}],required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${p}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${p}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${p}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},fe={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${p}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${p}" }) }}`},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${p}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},kn={type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Ro,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Ro},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${p}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${p}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=Q.useTranslation(),{resource:o}=l.useResourceContext(),t=l.useResourceActionContext();return{run(){return U(this,null,function*(){yield o.sync(),yield t==null?void 0:t.refresh(),y.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:fe.title,type:fe.type,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(o){const t=l.useRecord();return b.createElement("a",C({"aria-label":`executed-${t.title}`},o))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Yo}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:fe.title,enabled:fe.enabled,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${p}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${p}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=Q.useTranslation(),{refresh:o}=l.useResourceActionContext(),{resource:t,targetKey:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext(),{[r]:a}=l.useRecord(),{values:i}=L.useForm();return{run(){return U(this,null,function*(){yield t.revision({filterByTk:a,values:i}),y.message.success(e("Operation succeeded")),o(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function Sn(e){const o=L.useField(),t=l.useRecord(),r=l.usePlugin(de);return L.useFormEffects(s=>{le.onFieldChange("type",a=>{let i=t.id||!a.value;if(a.value){const c=r.triggers.get(a.value);c.sync!=null?(i=!0,o.setValue(c.sync)):o.setInitialValue(!1)}o.setPattern(i?"disabled":"editable")})}),b.useEffect(()=>{if(t.id){o.setPattern("disabled");const s=r.triggers.get(t.type);s.sync!=null?o.setValue(s.sync):o.setInitialValue(!1)}},[t.id,o,r.triggers]),n.jsx(Te,C({},e))}function An(e){const o=l.useApp();e.visible=!!(l.usePlugin("multi-app-share-collection")||o.name!=="main")}function Fn(){const e=b.useContext(l.SchemaComponentContext),{getTriggersOptions:o}=l.usePlugin(de);return n.jsx(y.Card,{bordered:!1,children:n.jsx(l.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:n.jsx(l.SchemaComponent,{schema:kn,components:{WorkflowLink:xn,ExecutionResourceProvider:vn,ExecutionLink:Ko,OpenDrawer:wn,ExecutionStatusSelect:yn,SyncOptionSelect:Sn,ExecutionStatusColumn:Zo,Tooltip:y.Tooltip},scope:{getTriggersOptions:o,useWorkflowSyncAction:An,useRefreshActionProps:Qo}})})})}function On(r){var s=r,{collection:e,dataPath:o}=s,t=Z(s,["collection","dataPath"]);const{insert:a}=l.useSchemaInitializer(),{getTemplateSchemaByMode:i}=l.useSchemaTemplateManager(),{getCollection:c}=l.useCollectionManager_deprecated(),u=l.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,x]=l.parseCollectionName(e);d=c(x,h)}else d=e;function f(x){return U(this,arguments,function*({item:h}){const g=h.template?yield i(h):null,m={type:"void",name:ho.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:o},"x-component":"CardItem","x-component-props":{title:t.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:g||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};Oo(m,k=>{k["x-uid"]&&delete k["x-uid"]}),a(m)})}return n.jsx(l.SchemaInitializerItem,A(C({},t),{onClick:f,items:u}))}function Be(e){var a;const o=l.useSchemaInitializerItem(),t=(a=e==null?void 0:e.collection)!=null?a:o.collection;let r,s;if(typeof t=="string"){const i=l.parseCollectionName(t);r=i[0],s=i[1]}else s=t;return n.jsx(l.CollectionProvider_deprecated,{dataSource:r,collection:s,children:n.jsx(On,C(C({},o),e))})}function Tn(){return!0}const To=L.observer(e=>{const d=e,{filter:o=Tn}=d,t=Z(d,["filter"]),r=l.useCompile(),{getCollectionFields:s}=l.useCollectionManager_deprecated(),{values:a}=L.useForm(),[i,c]=l.parseCollectionName(a==null?void 0:a.collection),u=s(c,i);return n.jsx(y.Select,A(C({popupMatchSelectWidth:!1},t),{options:u.filter(o).map(f=>{var h;return{label:r((h=f.uiSchema)==null?void 0:h.title),value:f.name}})}))},{displayName:"FieldsSelect"}),ae={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},et={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:l.css`
455
455
  flex-direction: column;
456
456
  `},"x-component":"CollectionFieldset"},_e={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=L.useForm(),[o,t]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(t,o),className:l.css`
457
457
  position: relative;
458
458
  width: 100%;
459
- `}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},Nn={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},En={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}},Ve={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=L.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},Se={label:"label",value:"value",children:"children"},ot={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=l.usePlugin(de),t=ve(),n=Jo(t),s=[];return n.forEach(a=>{var u;const i=o.get(a.type),c=(u=i.useVariables)==null?void 0:u.call(i,a,e);c&&s.push(c)}),s}},tt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:o}=l.usePlugin(de),{workflow:t}=G(),n=o.get(t.type);return(a=(s=n==null?void 0:n.useVariables)==null?void 0:s.call(n,t.config,e))!=null?a:null}},nt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Se,current:t}=e,{instructions:n}=l.usePlugin(de),s=ve(),a=t!=null?t:s,i=Uo(a),c=[];return i.forEach(u=>{var h,x;const d=n.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:f})}),c}},rt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Se}){return[...!e||e.includes("date")?[{key:"now",[o.label]:T("System time"),[o.value]:"now"}]:[]]}},Ze={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function st(e,o){var t,n,s,a,i,c;return typeof o=="string"?(t=Ze[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?No(e)?((n=o.options)==null?void 0:n.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((a=o.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function No(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Eo(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(n=>n.startsWith(t)).map(n=>n.replace(t,""))}function $o({fields:e,types:o,appends:t,depth:n=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>st(i,u)):!0;if(No(i)){if(t===null)return n?c||$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,depth:n-1,appends:t,compile:s,getCollectionFields:a}):!1;const u=Eo(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function Qe(e,o){var a,i;const t=l.useCompile(),n=(i=(a=e.useOptions)==null?void 0:a.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:n,disabled:!n||!n.length}}function me(e={}){var s;const o=Object.assign({},Se,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Qe(nt,t),Qe(ot,t),Qe(tt,t),Qe(rt,t)]}function Do(e,{compile:o,getCollectionFields:t}){var d,f,h,x;const[n,s]=l.parseCollectionName(e),a=t(s,n),i=[],c=[];a.forEach(y=>{if(y.isForeignKey)i.push(y);else{const m=a.find(k=>k.name===y.foreignKey);m&&i.push(m),c.push(y)}});const u=ke.uniqBy(i,"name");for(let y=c.length-1;y>=0;y--){const m=c[y];if(m.type==="belongsTo"){const k=u.find(O=>O.name===m.foreignKey);k?c.splice(y,0,A(C(C({},m),k),{uiSchema:A(C({},m.uiSchema),{title:(d=k.uiSchema)!=null&&d.title?o((f=k.uiSchema)==null?void 0:f.title):k.name})})):c.splice(y,0,A(C({},m),{name:m.foreignKey,type:"bigInt",isForeignKey:!0,interface:m.interface,uiSchema:A(C({},m.uiSchema),{title:(h=m.uiSchema)!=null&&h.title?`${o((x=m.uiSchema)==null?void 0:x.title)} ID`:m.name})}))}else m.type==="context"&&m.collectionName==="users"&&c.splice(y,1)}return ke.uniqBy(c,"name").filter(y=>y.interface&&!y.hidden)}function $n(e){const o=Eo(e.field,e.appends),t=Ae(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>st(e.field,s))||(e.disabled=!0))}function Ae(e){const{fields:o,collection:t,types:n,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:u=Se}=e,d=o!=null?o:Do(t,{compile:i,getCollectionFields:c}),f=$n.bind({compile:i,getCollectionFields:c,fieldNames:u});return $o({fields:d,types:n,depth:a,appends:s,compile:i,getCollectionFields:c}).map(x=>{var O;const y=i(((O=x.uiSchema)==null?void 0:O.title)||x.name),m=Eo(x,s),k=!No(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:y,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:n}})}function je(e){const o=l.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return b.useCallback(n=>t.getCollectionFields(n),[t])}function lt(t){var n=t,{variableOptions:e}=n,o=Z(n,["variableOptions"]);const s=me(e);return r.jsx(l.Variable.Input,C({scope:s},o))}function Io(t){var n=t,{variableOptions:e}=n,o=Z(n,["variableOptions"]);const s=me(e);return r.jsx(l.Variable.TextArea,C({scope:s},o))}function Dn(t){var n=t,{variableOptions:e}=n,o=Z(n,["variableOptions"]);const s=me(e);return r.jsx(l.Variable.RawTextArea,C({scope:s},o))}function In(t){var n=t,{variableOptions:e}=n,o=Z(n,["variableOptions"]);const s=me(e);return r.jsx(l.Variable.JSON,C({scope:s},o))}function Pn(){const e=l.useAPIClient(),o=L.useForm(),{field:t,__parent:n}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=te.useNavigate(),i=L.useFieldSchema(),c=L.useField(),u=l.useCompile(),{modal:d}=g.App.useApp(),f=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return U(this,null,function*(){var M,S,E;const{onSuccess:y,skipValidator:m,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};m||(yield o.submit());const O=yield f();c.data=t.data||{},c.data.loading=!0;try{const W=yield e.resource("workflows").trigger({values:O,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=W,(E=(S=n==null?void 0:n.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(y!=null&&y.successMessage))return;y!=null&&y.manualClose?d.success({title:u(y==null?void 0:y.successMessage),onOk:()=>U(this,null,function*(){yield o.reset(),y!=null&&y.redirecting&&(y!=null&&y.redirectTo)&&(J.isURL(y.redirectTo)?window.location.href=y.redirectTo:a(y.redirectTo))})}):g.message.success(u(y==null?void 0:y.successMessage))}catch(W){c.data.loading=!1}})}}}function Mn(){var y;const e=l.useCompile(),o=l.useAPIClient(),t=l.useRecord(),n=L.useField(),s=L.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=l.useActionContext(),{modal:d}=g.App.useApp(),f=te.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(y=s==null?void 0:s["x-action-settings"])!=null?y:{};return{onClick(k,O){return U(this,null,function*(){n.data=a.data||{},n.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),O&&O(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let M;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return U(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(J.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{n.data.loading=!1}})}}}function Bn(){const{workflow:e}=G();return!!(e!=null&&e.executed)}function it(){const{workflow:e}=G();return!!(e!=null&&e.allExecuted)}const Fe={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},Vn=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Fe.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Fe.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Fe.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Fe.DELETED}];function jn(e,o){var u;const[t,n]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[{collectionName:n,name:"data",type:"hasOne",target:n,uiSchema:{title:T("Trigger data")}}];return Ae(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:a}))}class Wn extends So{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:Vn,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,description:`{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Fe.UPDATED})}}`}}}]},condition:A(C({},_e),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:A(C({},Ve),{"x-reactions":[...Ve["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Fe.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:it});w(this,"components",{FieldsSelect:To});w(this,"useVariables",jn)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}const we={STATIC:0,DATE_FIELD:1};function Ln(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function at({value:e,onChange:o}){const t=e!=null?e:{},{t:n}=Q.useTranslation(),[s,a]=b.useState(t.offset?t.offset/Math.abs(t.offset):0);return r.jsxs("fieldset",{className:l.css`
459
+ `}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},Nn={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},En={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}},Ve={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=L.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},Se={label:"label",value:"value",children:"children"},ot={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=l.usePlugin(de),t=ve(),r=Jo(t),s=[];return r.forEach(a=>{var u;const i=o.get(a.type),c=(u=i.useVariables)==null?void 0:u.call(i,a,e);c&&s.push(c)}),s}},tt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:o}=l.usePlugin(de),{workflow:t}=G(),r=o.get(t.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,t.config,e))!=null?a:null}},nt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Se,current:t}=e,{instructions:r}=l.usePlugin(de),s=ve(),a=t!=null?t:s,i=Uo(a),c=[];return i.forEach(u=>{var h,x;const d=r.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:f})}),c}},rt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Se}){return[...!e||e.includes("date")?[{key:"now",[o.label]:T("System time"),[o.value]:"now"}]:[]]}},Ze={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function st(e,o){var t,r,s,a,i,c;return typeof o=="string"?(t=Ze[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?No(e)?((r=o.options)==null?void 0:r.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((a=o.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function No(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Eo(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(r=>r.startsWith(t)).map(r=>r.replace(t,""))}function $o({fields:e,types:o,appends:t,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>st(i,u)):!0;if(No(i)){if(t===null)return r?c||$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,depth:r-1,appends:t,compile:s,getCollectionFields:a}):!1;const u=Eo(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function Qe(e,o){var a,i;const t=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const o=Object.assign({},Se,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Qe(nt,t),Qe(ot,t),Qe(tt,t),Qe(rt,t)]}function Do(e,{compile:o,getCollectionFields:t}){var d,f,h,x;const[r,s]=l.parseCollectionName(e),a=t(s,r),i=[],c=[];a.forEach(g=>{if(g.isForeignKey)i.push(g);else{const m=a.find(k=>k.name===g.foreignKey);m&&i.push(m),c.push(g)}});const u=ke.uniqBy(i,"name");for(let g=c.length-1;g>=0;g--){const m=c[g];if(m.type==="belongsTo"){const k=u.find(O=>O.name===m.foreignKey);k?c.splice(g,0,A(C(C({},m),k),{uiSchema:A(C({},m.uiSchema),{title:(d=k.uiSchema)!=null&&d.title?o((f=k.uiSchema)==null?void 0:f.title):k.name})})):c.splice(g,0,A(C({},m),{name:m.foreignKey,type:"bigInt",isForeignKey:!0,interface:m.interface,uiSchema:A(C({},m.uiSchema),{title:(h=m.uiSchema)!=null&&h.title?`${o((x=m.uiSchema)==null?void 0:x.title)} ID`:m.name})}))}else m.type==="context"&&m.collectionName==="users"&&c.splice(g,1)}return ke.uniqBy(c,"name").filter(g=>g.interface&&!g.hidden)}function $n(e){const o=Eo(e.field,e.appends),t=Ae(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>st(e.field,s))||(e.disabled=!0))}function Ae(e){const{fields:o,collection:t,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:u=Se}=e,d=o!=null?o:Do(t,{compile:i,getCollectionFields:c}),f=$n.bind({compile:i,getCollectionFields:c,fieldNames:u});return $o({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(x=>{var O;const g=i(((O=x.uiSchema)==null?void 0:O.title)||x.name),m=Eo(x,s),k=!No(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:g,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:r}})}function je(e){const o=l.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return b.useCallback(r=>t.getCollectionFields(r),[t])}function lt(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},o))}function Io(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},o))}function Dn(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},o))}function In(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},o))}function Pn(){const e=l.useAPIClient(),o=L.useForm(),{field:t,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=te.useNavigate(),i=L.useFieldSchema(),c=L.useField(),u=l.useCompile(),{modal:d}=y.App.useApp(),f=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return U(this,null,function*(){var B,S,E;const{onSuccess:g,skipValidator:m,triggerWorkflows:k}=(B=i==null?void 0:i["x-action-settings"])!=null?B:{};m||(yield o.submit());const O=yield f();c.data=t.data||{},c.data.loading=!0;try{const W=yield e.resource("workflows").trigger({values:O,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=W,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(g!=null&&g.successMessage))return;g!=null&&g.manualClose?d.success({title:u(g==null?void 0:g.successMessage),onOk:()=>U(this,null,function*(){yield o.reset(),g!=null&&g.redirecting&&(g!=null&&g.redirectTo)&&(J.isURL(g.redirectTo)?window.location.href=g.redirectTo:a(g.redirectTo))})}):y.message.success(u(g==null?void 0:g.successMessage))}catch(W){c.data.loading=!1}})}}}function Mn(){var g;const e=l.useCompile(),o=l.useAPIClient(),t=l.useRecord(),r=L.useField(),s=L.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=l.useActionContext(),{modal:d}=y.App.useApp(),f=te.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(g=s==null?void 0:s["x-action-settings"])!=null?g:{};return{onClick(k,O){return U(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(B=>[B.workflowKey,B.context].filter(Boolean).join("!")).join(","):void 0}),O&&O(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let B;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return U(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(J.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else y.message.success(e(h==null?void 0:h.successMessage))}catch(B){console.error(B)}finally{r.data.loading=!1}})}}}function Bn(){const{workflow:e}=G();return!!(e!=null&&e.executed)}function it(){const{workflow:e}=G();return!!(e!=null&&e.allExecuted)}const Fe={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},Vn=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Fe.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Fe.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Fe.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Fe.DELETED}];function jn(e,o){var u;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:T("Trigger data")}}];return Ae(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:a}))}class Wn extends So{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:Vn,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,description:`{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Fe.UPDATED})}}`}}}]},condition:A(C({},_e),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:A(C({},Ve),{"x-reactions":[...Ve["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Fe.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:it});w(this,"components",{FieldsSelect:To});w(this,"useVariables",jn)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}const we={STATIC:0,DATE_FIELD:1};function Ln(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function at({value:e,onChange:o}){const t=e!=null?e:{},{t:r}=Q.useTranslation(),[s,a]=b.useState(t.offset?t.offset/Math.abs(t.offset):0);return n.jsxs("fieldset",{className:l.css`
460
460
  display: flex;
461
461
  gap: 0.5em;
462
- `,children:[r.jsx(To,{value:t.field,onChange:i=>o(A(C({},t),{field:i})),filter:Ln,placeholder:n("Select field"),className:"auto-width"}),t.field?r.jsx(g.Select,{value:s,onChange:i=>{a(i),o(A(C({},t),{offset:Math.abs(t.offset)*i}))},options:[{value:0,label:T("Exactly at")},{value:-1,label:n("Before")},{value:1,label:n("After")}],className:"auto-width"}):null,s?r.jsxs(r.Fragment,{children:[r.jsx(g.InputNumber,{value:Math.abs(t.offset),onChange:i=>o(A(C({},t),{offset:(i!=null?i:0)*s}))}),r.jsx(g.Select,{value:t.unit||864e5,onChange:i=>o(A(C({},t),{unit:i})),options:[{value:864e5,label:T("Days")},{value:36e5,label:T("Hours")},{value:6e4,label:T("Minutes")},{value:1e3,label:T("Seconds")}],className:"auto-width"})]}):null]})}function zn({value:e,onChange:o}){const{t}=yo(),n=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return r.jsxs("fieldset",{className:l.css`
462
+ `,children:[n.jsx(To,{value:t.field,onChange:i=>o(A(C({},t),{field:i})),filter:Ln,placeholder:r("Select field"),className:"auto-width"}),t.field?n.jsx(y.Select,{value:s,onChange:i=>{a(i),o(A(C({},t),{offset:Math.abs(t.offset)*i}))},options:[{value:0,label:T("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(y.InputNumber,{value:Math.abs(t.offset),onChange:i=>o(A(C({},t),{offset:(i!=null?i:0)*s}))}),n.jsx(y.Select,{value:t.unit||864e5,onChange:i=>o(A(C({},t),{unit:i})),options:[{value:864e5,label:T("Days")},{value:36e5,label:T("Hours")},{value:6e4,label:T("Minutes")},{value:1e3,label:T("Seconds")}],className:"auto-width"})]}):null]})}function zn({value:e,onChange:o}){const{t}=go(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
463
463
  display: flex;
464
464
  gap: 0.5em;
465
- `,children:[r.jsxs(g.Select,{value:n,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[r.jsx(g.Select.Option,{value:null,children:t("No end")}),r.jsx(g.Select.Option,{value:"field",children:t("By field")}),r.jsx(g.Select.Option,{value:"date",children:t("By custom date")})]}),n==="field"?r.jsx(at,{value:e,onChange:o}):null,n==="date"?r.jsx(g.DatePicker,{showTime:!0,value:Yt(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,n=arguments.length;t<n;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function ct(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)o.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(t[n[s]]=e[n[s]])}return t}function Xe(e,o,t){if(t||arguments.length===2)for(var n,s=0,a=o.length;s<a;s++)!n&&s in o||(n||(n=Array.prototype.slice.call(o,0,s)),n[s]=o[s]);return e.concat(n||Array.prototype.slice.call(o))}var Jn=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Ce=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],V={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function dt(e,o){for(var t=[],n=e;n<=o;n++)t.push(n);return t}function Re(e){return e.sort(function(o,t){return o-t}),e}function ut(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ce(e){return Object.entries(e).filter(function(o){var t=o[0],n=o[1];return t&&n}).map(function(o){return o[0]}).join(" ")}function pt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||V.errorInvalidCron})}function eo(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function mt(e,o,t,n,s,a,i,c,u,d,f,h,x,y){t&&t(void 0),o(!1);var m=!1;if(!e){if(n==="always"||a&&n==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void y("reboot");var k=Jn.find(function(S){return S.name===e});k&&(e=k.value)}try{var O=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(W,$){return function(B,N){if(B==="*"||B==="*/1")return[];var F=Re(ut(yt(function(H,K,ue){if(ue){H=H.toUpperCase();for(var I=0;I<ue.length;I++)H=H.replace(ue[I],"".concat(I+K))}return H}(B,N.min,N.alt).split(",").map(function(H){var K,ue=H.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(B,' for "').concat(N.type,'"'));var I=ue[0],j=ue[1];K=I==="*"?dt(N.min,N.max):function(q,Y,R){var ee=q.split("-");if(ee.length===1){var Le=eo(ee[0]);if(isNaN(Le))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));return[Le]}if(ee.length===2){var he=eo(ee[0]),Ee=eo(ee[1]);if(isNaN(he)||isNaN(Ee))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));if(Ee<he)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return dt(he,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(I,B,N);var z=function(q,Y){if(q!==void 0){var R=eo(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(Y.type));return R}}(j,N),se=function(q,Y){if(Y){var R=q[0];q=q.filter(function(ee){return ee%Y==R%Y||ee===R})}return q}(K,z);return se}).flat(),N))),D=bt(F,N);if(D!==void 0)throw new Error('Value "'.concat(D,'" out of range for ').concat(N.type));return F.length===N.total?[]:F}(W,Ce[$])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(O);y(M),u(O[0]),d(O[1]),f(O[2]),h(O[3]),x(O[4])}catch(S){m=!0}}m&&(s.current=e,o(!0),pt(t,i))}function ft(e,o,t,n,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=Ce[h];return ht(gt(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!n?[]:n],i);return c.join(" ")}function ht(e,o,t,n,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var f=c[d-1];if(c[d]-f!==u)return!1}return!0}(e,i)?function(c,u,d){var f=vt(c),h=xt(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(Oe(vt(e),o,t,n,s),"-").concat(Oe(xt(e),o,t,n,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(f,h,x){f!==x[h+1]-1?d!==null?(u.push([d,f]),d=null):u.push(f):d===null&&(d=f)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],o,t,n,s),"-").concat(Oe(c[1],o,t,n,s)):Oe(c,o,t,n,s)}).join(",")}return a}function Oe(e,o,t,n,s){var a=e.toString(),i=o.type,c=o.alt,u=o.min,d=n&&(n===!0||n.includes(i)),f=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(h)}return a}function gt(e,o){var t=Re(ut(yt(e,o)));if(t.length===0)return t;var n=bt(t,o);if(n!==void 0)throw new Error('Value "'.concat(n,'" out of range for ').concat(o.type));return t}function yt(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function bt(e,o){var t=e[0],n=e[e.length-1];return t<o.min?t:n>o.max?n:void 0}function vt(e){return e[0]}function xt(e){return e[e.length-1]}function We(e){var o=e.value,t=e.grid,n=t===void 0||t,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,y=e.period,m=e.unit,k=e.periodicityOnDoubleClick,O=e.mode,M=ct(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=b.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(I){return I.toString()})},[o]),E=b.useMemo(function(){return s?s.map(function(I,j){return{value:(m.min===0?j:j+1).toString(),label:I}}):Xe([],Array(m.total),!0).map(function(I,j){var z=m.min===0?j:j+1;return{value:z.toString(),label:Oe(z,m,u,h,x)}})},[s,h,u,x]),W=JSON.stringify(i),$=b.useCallback(function(I){var j=I.value;if(!o||o[0]!==Number(j))return r.jsx(r.Fragment,{});var z=ht(gt(o,m),m,u,h,x),se=z.match(/^\*\/([0-9]+),?/)||[];return r.jsx("div",{children:se[1]?"".concat(i.everyText||V.everyText," ").concat(se[1]):z})},[o,W,u,h,x]),B=b.useCallback(function(I){var j=Array.isArray(I)?Re(I):[I],z=j;o&&(z=O==="single"?[]:Xe([],o,!0),j.forEach(function(se){var q=Number(se);z=o.some(function(Y){return Y===q})?z.filter(function(Y){return Y!==q}):Re(Xe(Xe([],z,!0),[q],!1))})),z.length===m.total?a([]):a(z)},[a,o]),N=b.useCallback(function(I){if(I!==0&&I!==1){for(var j=m.total+m.min,z=[],se=m.min;se<j;se++)se%I==0&&z.push(se);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),Y=z.length===E.length;a(Y||q?[]:z)}else a([])},[o,E,a]),F=b.useRef([]),D=b.useCallback(function(I){if(!f){var j=F.current;j.push({time:new Date().getTime(),value:Number(I)});var z=window.setTimeout(function(){k&&j.length>1&&j[j.length-1].time-j[j.length-2].time<300?j[j.length-1].value===j[j.length-2].value?N(Number(I)):B([j[j.length-2].value,j[j.length-1].value]):B(Number(I)),F.current=[]},300);return function(){window.clearTimeout(z)}}},[F,B,N,f,k]),H=b.useCallback(function(){f||a([])},[a,f]),K=b.useMemo(function(){var I;return ce(((I={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,I))},[c]),ue=b.useMemo(function(){var I;return ce(((I={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,I["react-js-cron-custom-select-dropdown"]=!0,I["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,I["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&y!=="hour"&&y!=="day",I["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(y==="day"||y==="hour"),I["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",I["react-js-cron-custom-select-dropdown-grid"]=!!n,I["".concat(c,"-select-dropdown")]=!!c,I["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,I))},[c,n,x,y]);return r.jsx(g.Select,re({mode:O!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:S,onClear:H,tagRender:$,className:K,popupClassName:ue,options:E,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:D,onDeselect:D,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||y==="day"||y==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},M))}function Un(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var y;return ce(((y={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,y["".concat(s,"-hours")]=!!s,y))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixHours!==""&&r.jsx("span",{children:n.prefixHours||V.prefixHours}),r.jsx(We,{placeholder:n.emptyHours||V.emptyHours,value:o,unit:Ce[1],setValue:t,locale:n,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function Hn(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var y;return ce(((y={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,y["".concat(s,"-minutes")]=!!s,y))},[s]);return r.jsxs("div",re({className:x},{children:[d==="hour"?n.prefixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.prefixMinutesForHourPeriod||V.prefixMinutesForHourPeriod}):n.prefixMinutes!==""&&r.jsx("span",{children:n.prefixMinutes||V.prefixMinutes}),r.jsx(We,{placeholder:d==="hour"?n.emptyMinutesForHourPeriod||V.emptyMinutesForHourPeriod:n.emptyMinutes||V.emptyMinutes,value:o,unit:Ce[0],setValue:t,locale:n,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&n.suffixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.suffixMinutesForHourPeriod||V.suffixMinutesForHourPeriod})]}))}function Gn(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,y=b.useMemo(function(){var O;return ce(((O={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,O["".concat(s,"-month-days")]=!!s,O))},[s,x]),m=JSON.stringify(n),k=b.useMemo(function(){return x?n.emptyMonthDays||V.emptyMonthDays:n.emptyMonthDaysShort||V.emptyMonthDaysShort},[x,m]);return!c||o&&o.length>0||(!o||o.length===0)&&(!a||a.length===0)?r.jsxs("div",re({className:y},{children:[n.prefixMonthDays!==""&&r.jsx("span",{children:n.prefixMonthDays||V.prefixMonthDays}),r.jsx(We,{placeholder:k,value:o,setValue:t,unit:Ce[2],locale:n,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function qn(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=n.months||V.months,x=b.useMemo(function(){var y;return ce(((y={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,y["".concat(s,"-months")]=!!s,y))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixMonths!==""&&r.jsx("span",{children:n.prefixMonths||V.prefixMonths}),r.jsx(We,{placeholder:n.emptyMonths||V.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},Ce[3]),{alt:n.altMonths||V.altMonths}),setValue:t,locale:n,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function Kn(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:n.yearOption||V.yearOption}),u.includes("month")&&d.push({value:"month",label:n.monthOption||V.monthOption}),u.includes("week")&&d.push({value:"week",label:n.weekOption||V.weekOption}),u.includes("day")&&d.push({value:"day",label:n.dayOption||V.dayOption}),u.includes("hour")&&d.push({value:"hour",label:n.hourOption||V.hourOption}),u.includes("minute")&&d.push({value:"minute",label:n.minuteOption||V.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:n.rebootOption||V.rebootOption});var f=b.useCallback(function(m){i||t(m)},[t,i]),h=b.useMemo(function(){var m;return ce(((m={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,m["".concat(s,"-period")]=!!s,m))},[s]),x=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":n.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,n.prefixPeriod]),y=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,m["".concat(s,"-select-dropdown-period")]=!!s,m))},[s]);return r.jsxs("div",re({className:h},{children:[n.prefixPeriod!==""&&r.jsx("span",{children:n.prefixPeriod||V.prefixPeriod}),r.jsx(g.Select,{defaultValue:o,value:o,onChange:f,options:d,className:x,popupClassName:y,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(n))]}))}function Yn(e){var o=e.value,t=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=n.weekDays||V.weekDays,y=d==="week"||!i||i.length===0,m=b.useMemo(function(){var E;return ce(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!y})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,y]),k=JSON.stringify(n),O=b.useMemo(function(){return y?n.emptyWeekDays||V.emptyWeekDays:n.emptyWeekDaysShort||V.emptyWeekDaysShort},[y,k]),M=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return M?r.jsxs("div",re({className:m},{children:[n.prefixWeekDays!==""&&(d==="week"||!S)&&r.jsx("span",{children:n.prefixWeekDays||V.prefixWeekDays}),n.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&r.jsx("span",{children:n.prefixWeekDaysForMonthAndYearPeriod||V.prefixWeekDaysForMonthAndYearPeriod}),r.jsx(We,{placeholder:O,optionsList:x,grid:!1,value:o,unit:re(re({},Ce[4]),{alt:n.altWeekDays||V.altWeekDays}),setValue:t,locale:n,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function _n(e){var o=e.clearButton,t=o===void 0||o,n=e.clearButtonProps,s=n===void 0?{}:n,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?V:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,y=x===void 0||x,m=e.onError,k=e.className,O=e.defaultPeriod,M=O===void 0?"day":O,S=e.allowEmpty,E=S===void 0?"for-default-value":S,W=e.humanizeLabels,$=W===void 0||W,B=e.humanizeValue,N=B!==void 0&&B,F=e.disabled,D=F!==void 0&&F,H=e.readOnly,K=H!==void 0&&H,ue=e.leadingZero,I=ue!==void 0&&ue,j=e.shortcuts,z=j===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:j,se=e.clockFormat,q=e.periodicityOnDoubleClick,Y=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Le=e.allowedDropdowns,he=Le===void 0?["period","months","month-days","week-days","hours","minutes"]:Le,Ee=e.allowedPeriods,Ar=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=b.useRef(f),Po=b.useRef(M),$t=b.useState(),be=$t[0],to=$t[1],Dt=b.useState(),ze=Dt[0],no=Dt[1],It=b.useState(),ro=It[0],so=It[1],Pt=b.useState(),Je=Pt[0],lo=Pt[1],Mt=b.useState(),io=Mt[0],ao=Mt[1],Bt=b.useState(),co=Bt[0],uo=Bt[1],Vt=b.useState(!1),Mo=Vt[0],Ue=Vt[1],jt=b.useState(!1),po=jt[0],Wt=jt[1],Fr=function(_){var ge=b.useRef(_);return b.useEffect(function(){ge.current=_},[_]),ge.current}(po),Lt=JSON.stringify(u);b.useEffect(function(){mt(f,Ue,m,E,$e,!0,u,z,uo,ao,no,so,lo,to)},[]),b.useEffect(function(){f!==$e.current&&mt(f,Ue,m,E,$e,!1,u,z,uo,ao,no,so,lo,to)},[f,$e,Lt,E,z]),b.useEffect(function(){if(!(be||co||ro||ze||Je||io)||po||Fr)po&&Wt(!1);else{var _=be||Po.current,ge=ft(_,ro,ze,Je,io,co,N);h(ge,{selectedPeriod:_}),$e.current=ge,m&&m(void 0),Ue(!1)}},[be,ze,ro,Je,io,co,N,po]);var zt=b.useCallback(function(){no(void 0),so(void 0),lo(void 0),ao(void 0),uo(void 0);var _="",ge=be!=="reboot"&&be?be:Po.current;ge!==be&&to(ge),i==="fill-with-every"&&(_=ft(ge,void 0,void 0,void 0,void 0,void 0)),h(_,{selectedPeriod:ge}),$e.current=_,Wt(!0),E==="never"&&i==="empty"?(Ue(!0),pt(m,u)):(m&&m(void 0),Ue(!1))},[be,h,m,i]),Or=b.useMemo(function(){var _;return ce(((_={"react-js-cron":!0,"react-js-cron-error":Mo&&y,"react-js-cron-disabled":D,"react-js-cron-read-only":K})["".concat(k)]=!!k,_["".concat(k,"-error")]=Mo&&y&&!!k,_["".concat(k,"-disabled")]=D&&!!k,_["".concat(k,"-read-only")]=K&&!!k,_))},[k,Mo,y,D,K]),Bo=s.className,Jt=ct(s,["className"]),Ut=b.useMemo(function(){var _;return ce(((_={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,_["".concat(Bo)]=!!Bo,_))},[k,Bo]),Tr=JSON.stringify(Jt),Ht=b.useMemo(function(){return t&&!K?r.jsx(g.Button,re({className:Ut,danger:!0,type:"primary",disabled:D},Jt,{onClick:zt},{children:u.clearButtonText||V.clearButtonText})):null},[t,K,Lt,Ut,D,Tr,zt]),oe=be||Po.current;return r.jsxs("div",re({className:Or},{children:[he.includes("period")&&r.jsx(Kn,{value:oe,setValue:to,locale:u,className:k,disabled:D,readOnly:K,shortcuts:z,allowedPeriods:Ar}),oe==="reboot"?Ht:r.jsxs(r.Fragment,{children:[oe==="year"&&he.includes("months")&&r.jsx(qn,{value:ro,setValue:so,locale:u,className:k,humanizeLabels:$,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month")&&he.includes("month-days")&&r.jsx(Gn,{value:ze,setValue:no,locale:u,className:k,weekDays:Je,disabled:D,readOnly:K,leadingZero:I,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&he.includes("week-days")&&r.jsx(Yn,{value:Je,setValue:lo,locale:u,className:k,humanizeLabels:$,monthDays:ze,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),r.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&he.includes("hours")&&r.jsx(Un,{value:io,setValue:ao,locale:u,className:k,disabled:D,readOnly:K,leadingZero:I,clockFormat:se,period:oe,periodicityOnDoubleClick:Y,mode:ee}),oe!=="minute"&&he.includes("minutes")&&r.jsx(Hn,{value:co,setValue:uo,locale:u,period:oe,className:k,disabled:D,readOnly:K,leadingZero:I,clockFormat:se,periodicityOnDoubleClick:Y,mode:ee}),Ht]})]})]}))}const wt=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ct(e){return wt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function Zn(e){let o;switch(typeof e){case"number":return o=Ct(e),o?o.value:"none";case"string":return"cron"}return"none"}function Qn({value:e,onChange:o}){const{t}=yo(),n=Ct(e);return r.jsx(g.InputNumber,{value:e/n.value,onChange:s=>o(s*n.value),min:1,addonBefore:t("Every"),addonAfter:t(n.unitText),className:"auto-width"})}function Xn({value:e=null,onChange:o}){const{t}=yo(),n=Zn(e),s=b.useCallback(a=>{if(a==="none"){o(null);return}if(a==="cron"){o("0 * * * * *");return}o(a)},[o]);return r.jsxs("fieldset",{className:l.css`
465
+ `,children:[n.jsxs(y.Select,{value:r,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(y.Select.Option,{value:null,children:t("No end")}),n.jsx(y.Select.Option,{value:"field",children:t("By field")}),n.jsx(y.Select.Option,{value:"date",children:t("By custom date")})]}),r==="field"?n.jsx(at,{value:e,onChange:o}):null,r==="date"?n.jsx(y.DatePicker,{showTime:!0,value:Yt(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function ct(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)o.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(t[r[s]]=e[r[s]])}return t}function Xe(e,o,t){if(t||arguments.length===2)for(var r,s=0,a=o.length;s<a;s++)!r&&s in o||(r||(r=Array.prototype.slice.call(o,0,s)),r[s]=o[s]);return e.concat(r||Array.prototype.slice.call(o))}var Jn=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Ce=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],V={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function dt(e,o){for(var t=[],r=e;r<=o;r++)t.push(r);return t}function Re(e){return e.sort(function(o,t){return o-t}),e}function ut(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ce(e){return Object.entries(e).filter(function(o){var t=o[0],r=o[1];return t&&r}).map(function(o){return o[0]}).join(" ")}function pt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||V.errorInvalidCron})}function eo(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function mt(e,o,t,r,s,a,i,c,u,d,f,h,x,g){t&&t(void 0),o(!1);var m=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void g("reboot");var k=Jn.find(function(S){return S.name===e});k&&(e=k.value)}try{var O=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(W,$){return function(M,N){if(M==="*"||M==="*/1")return[];var F=Re(ut(gt(function(H,K,ue){if(ue){H=H.toUpperCase();for(var P=0;P<ue.length;P++)H=H.replace(ue[P],"".concat(P+K))}return H}(M,N.min,N.alt).split(",").map(function(H){var K,ue=H.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(M,' for "').concat(N.type,'"'));var P=ue[0],j=ue[1];K=P==="*"?dt(N.min,N.max):function(q,Y,R){var ee=q.split("-");if(ee.length===1){var Le=eo(ee[0]);if(isNaN(Le))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));return[Le]}if(ee.length===2){var he=eo(ee[0]),Ee=eo(ee[1]);if(isNaN(he)||isNaN(Ee))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));if(Ee<he)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return dt(he,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,M,N);var z=function(q,Y){if(q!==void 0){var R=eo(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(Y.type));return R}}(j,N),se=function(q,Y){if(Y){var R=q[0];q=q.filter(function(ee){return ee%Y==R%Y||ee===R})}return q}(K,z);return se}).flat(),N))),D=bt(F,N);if(D!==void 0)throw new Error('Value "'.concat(D,'" out of range for ').concat(N.type));return F.length===N.total?[]:F}(W,Ce[$])});throw new Error("Invalid cron string format")}(e),B=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(O);g(B),u(O[0]),d(O[1]),f(O[2]),h(O[3]),x(O[4])}catch(S){m=!0}}m&&(s.current=e,o(!0),pt(t,i))}function ft(e,o,t,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=Ce[h];return ht(yt(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function ht(e,o,t,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var f=c[d-1];if(c[d]-f!==u)return!1}return!0}(e,i)?function(c,u,d){var f=vt(c),h=xt(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(Oe(vt(e),o,t,r,s),"-").concat(Oe(xt(e),o,t,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(f,h,x){f!==x[h+1]-1?d!==null?(u.push([d,f]),d=null):u.push(f):d===null&&(d=f)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],o,t,r,s),"-").concat(Oe(c[1],o,t,r,s)):Oe(c,o,t,r,s)}).join(",")}return a}function Oe(e,o,t,r,s){var a=e.toString(),i=o.type,c=o.alt,u=o.min,d=r&&(r===!0||r.includes(i)),f=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(h)}return a}function yt(e,o){var t=Re(ut(gt(e,o)));if(t.length===0)return t;var r=bt(t,o);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(o.type));return t}function gt(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function bt(e,o){var t=e[0],r=e[e.length-1];return t<o.min?t:r>o.max?r:void 0}function vt(e){return e[0]}function xt(e){return e[e.length-1]}function We(e){var o=e.value,t=e.grid,r=t===void 0||t,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,g=e.period,m=e.unit,k=e.periodicityOnDoubleClick,O=e.mode,B=ct(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=b.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(P){return P.toString()})},[o]),E=b.useMemo(function(){return s?s.map(function(P,j){return{value:(m.min===0?j:j+1).toString(),label:P}}):Xe([],Array(m.total),!0).map(function(P,j){var z=m.min===0?j:j+1;return{value:z.toString(),label:Oe(z,m,u,h,x)}})},[s,h,u,x]),W=JSON.stringify(i),$=b.useCallback(function(P){var j=P.value;if(!o||o[0]!==Number(j))return n.jsx(n.Fragment,{});var z=ht(yt(o,m),m,u,h,x),se=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:se[1]?"".concat(i.everyText||V.everyText," ").concat(se[1]):z})},[o,W,u,h,x]),M=b.useCallback(function(P){var j=Array.isArray(P)?Re(P):[P],z=j;o&&(z=O==="single"?[]:Xe([],o,!0),j.forEach(function(se){var q=Number(se);z=o.some(function(Y){return Y===q})?z.filter(function(Y){return Y!==q}):Re(Xe(Xe([],z,!0),[q],!1))})),z.length===m.total?a([]):a(z)},[a,o]),N=b.useCallback(function(P){if(P!==0&&P!==1){for(var j=m.total+m.min,z=[],se=m.min;se<j;se++)se%P==0&&z.push(se);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),Y=z.length===E.length;a(Y||q?[]:z)}else a([])},[o,E,a]),F=b.useRef([]),D=b.useCallback(function(P){if(!f){var j=F.current;j.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&j.length>1&&j[j.length-1].time-j[j.length-2].time<300?j[j.length-1].value===j[j.length-2].value?N(Number(P)):M([j[j.length-2].value,j[j.length-1].value]):M(Number(P)),F.current=[]},300);return function(){window.clearTimeout(z)}}},[F,M,N,f,k]),H=b.useCallback(function(){f||a([])},[a,f]),K=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),ue=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&g!=="hour"&&g!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(g==="day"||g==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,P))},[c,r,x,g]);return n.jsx(y.Select,re({mode:O!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:S,onClear:H,tagRender:$,className:K,popupClassName:ue,options:E,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:D,onDeselect:D,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||g==="day"||g==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},B))}function Un(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-hours")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||V.prefixHours}),n.jsx(We,{placeholder:r.emptyHours||V.emptyHours,value:o,unit:Ce[1],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function Hn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-minutes")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||V.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||V.prefixMinutes}),n.jsx(We,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||V.emptyMinutesForHourPeriod:r.emptyMinutes||V.emptyMinutes,value:o,unit:Ce[0],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||V.suffixMinutesForHourPeriod})]}))}function Gn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,g=b.useMemo(function(){var O;return ce(((O={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,O["".concat(s,"-month-days")]=!!s,O))},[s,x]),m=JSON.stringify(r),k=b.useMemo(function(){return x?r.emptyMonthDays||V.emptyMonthDays:r.emptyMonthDaysShort||V.emptyMonthDaysShort},[x,m]);return!c||o&&o.length>0||(!o||o.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:g},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||V.prefixMonthDays}),n.jsx(We,{placeholder:k,value:o,setValue:t,unit:Ce[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function qn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=r.months||V.months,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-months")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||V.prefixMonths}),n.jsx(We,{placeholder:r.emptyMonths||V.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},Ce[3]),{alt:r.altMonths||V.altMonths}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function Kn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||V.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||V.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||V.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||V.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||V.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||V.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||V.rebootOption});var f=b.useCallback(function(m){i||t(m)},[t,i]),h=b.useMemo(function(){var m;return ce(((m={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,m["".concat(s,"-period")]=!!s,m))},[s]),x=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,r.prefixPeriod]),g=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,m["".concat(s,"-select-dropdown-period")]=!!s,m))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||V.prefixPeriod}),n.jsx(y.Select,{defaultValue:o,value:o,onChange:f,options:d,className:x,popupClassName:g,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function Yn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=r.weekDays||V.weekDays,g=d==="week"||!i||i.length===0,m=b.useMemo(function(){var E;return ce(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,g]),k=JSON.stringify(r),O=b.useMemo(function(){return g?r.emptyWeekDays||V.emptyWeekDays:r.emptyWeekDaysShort||V.emptyWeekDaysShort},[g,k]),B=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return B?n.jsxs("div",re({className:m},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||V.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||V.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(We,{placeholder:O,optionsList:x,grid:!1,value:o,unit:re(re({},Ce[4]),{alt:r.altWeekDays||V.altWeekDays}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function _n(e){var o=e.clearButton,t=o===void 0||o,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?V:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,g=x===void 0||x,m=e.onError,k=e.className,O=e.defaultPeriod,B=O===void 0?"day":O,S=e.allowEmpty,E=S===void 0?"for-default-value":S,W=e.humanizeLabels,$=W===void 0||W,M=e.humanizeValue,N=M!==void 0&&M,F=e.disabled,D=F!==void 0&&F,H=e.readOnly,K=H!==void 0&&H,ue=e.leadingZero,P=ue!==void 0&&ue,j=e.shortcuts,z=j===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:j,se=e.clockFormat,q=e.periodicityOnDoubleClick,Y=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Le=e.allowedDropdowns,he=Le===void 0?["period","months","month-days","week-days","hours","minutes"]:Le,Ee=e.allowedPeriods,Ar=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=b.useRef(f),Po=b.useRef(B),$t=b.useState(),be=$t[0],to=$t[1],Dt=b.useState(),ze=Dt[0],no=Dt[1],It=b.useState(),ro=It[0],so=It[1],Pt=b.useState(),Je=Pt[0],lo=Pt[1],Mt=b.useState(),io=Mt[0],ao=Mt[1],Bt=b.useState(),co=Bt[0],uo=Bt[1],Vt=b.useState(!1),Mo=Vt[0],Ue=Vt[1],jt=b.useState(!1),po=jt[0],Wt=jt[1],Fr=function(_){var ye=b.useRef(_);return b.useEffect(function(){ye.current=_},[_]),ye.current}(po),Lt=JSON.stringify(u);b.useEffect(function(){mt(f,Ue,m,E,$e,!0,u,z,uo,ao,no,so,lo,to)},[]),b.useEffect(function(){f!==$e.current&&mt(f,Ue,m,E,$e,!1,u,z,uo,ao,no,so,lo,to)},[f,$e,Lt,E,z]),b.useEffect(function(){if(!(be||co||ro||ze||Je||io)||po||Fr)po&&Wt(!1);else{var _=be||Po.current,ye=ft(_,ro,ze,Je,io,co,N);h(ye,{selectedPeriod:_}),$e.current=ye,m&&m(void 0),Ue(!1)}},[be,ze,ro,Je,io,co,N,po]);var zt=b.useCallback(function(){no(void 0),so(void 0),lo(void 0),ao(void 0),uo(void 0);var _="",ye=be!=="reboot"&&be?be:Po.current;ye!==be&&to(ye),i==="fill-with-every"&&(_=ft(ye,void 0,void 0,void 0,void 0,void 0)),h(_,{selectedPeriod:ye}),$e.current=_,Wt(!0),E==="never"&&i==="empty"?(Ue(!0),pt(m,u)):(m&&m(void 0),Ue(!1))},[be,h,m,i]),Or=b.useMemo(function(){var _;return ce(((_={"react-js-cron":!0,"react-js-cron-error":Mo&&g,"react-js-cron-disabled":D,"react-js-cron-read-only":K})["".concat(k)]=!!k,_["".concat(k,"-error")]=Mo&&g&&!!k,_["".concat(k,"-disabled")]=D&&!!k,_["".concat(k,"-read-only")]=K&&!!k,_))},[k,Mo,g,D,K]),Bo=s.className,Jt=ct(s,["className"]),Ut=b.useMemo(function(){var _;return ce(((_={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,_["".concat(Bo)]=!!Bo,_))},[k,Bo]),Tr=JSON.stringify(Jt),Ht=b.useMemo(function(){return t&&!K?n.jsx(y.Button,re({className:Ut,danger:!0,type:"primary",disabled:D},Jt,{onClick:zt},{children:u.clearButtonText||V.clearButtonText})):null},[t,K,Lt,Ut,D,Tr,zt]),oe=be||Po.current;return n.jsxs("div",re({className:Or},{children:[he.includes("period")&&n.jsx(Kn,{value:oe,setValue:to,locale:u,className:k,disabled:D,readOnly:K,shortcuts:z,allowedPeriods:Ar}),oe==="reboot"?Ht:n.jsxs(n.Fragment,{children:[oe==="year"&&he.includes("months")&&n.jsx(qn,{value:ro,setValue:so,locale:u,className:k,humanizeLabels:$,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month")&&he.includes("month-days")&&n.jsx(Gn,{value:ze,setValue:no,locale:u,className:k,weekDays:Je,disabled:D,readOnly:K,leadingZero:P,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&he.includes("week-days")&&n.jsx(Yn,{value:Je,setValue:lo,locale:u,className:k,humanizeLabels:$,monthDays:ze,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),n.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&he.includes("hours")&&n.jsx(Un,{value:io,setValue:ao,locale:u,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,period:oe,periodicityOnDoubleClick:Y,mode:ee}),oe!=="minute"&&he.includes("minutes")&&n.jsx(Hn,{value:co,setValue:uo,locale:u,period:oe,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,periodicityOnDoubleClick:Y,mode:ee}),Ht]})]})]}))}const wt=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ct(e){return wt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function Zn(e){let o;switch(typeof e){case"number":return o=Ct(e),o?o.value:"none";case"string":return"cron"}return"none"}function Qn({value:e,onChange:o}){const{t}=go(),r=Ct(e);return n.jsx(y.InputNumber,{value:e/r.value,onChange:s=>o(s*r.value),min:1,addonBefore:t("Every"),addonAfter:t(r.unitText),className:"auto-width"})}function Xn({value:e=null,onChange:o}){const{t}=go(),r=Zn(e),s=b.useCallback(a=>{if(a==="none"){o(null);return}if(a==="cron"){o("0 * * * * *");return}o(a)},[o]);return n.jsxs("fieldset",{className:l.css`
466
466
  display: flex;
467
- flex-direction: ${n==="cron"?"column":"row"};
467
+ flex-direction: ${r==="cron"?"column":"row"};
468
468
  align-items: flex-start;
469
469
  gap: 0.5em;
470
470
 
@@ -491,7 +491,7 @@
491
491
  }
492
492
  }
493
493
  }
494
- `,children:[r.jsx(g.Select,{value:n,onChange:s,className:"auto-width",children:wt.map(a=>r.jsx(g.Select.Option,{value:a.value,children:t(a.text)},a.value))}),typeof n=="number"?r.jsx(Qn,{value:e,onChange:o}):null,n==="cron"?r.jsx(_n,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>o(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const Rn={[we.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}}},[we.DATE_FIELD]:{collection:A(C({},ae),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}},appends:A(C({},Ve),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${we.DATE_FIELD} && $deps[1]}}`}}}]})}},er=[{value:we.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:we.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],or=()=>{const{values:e={},clearFormGraph:o}=L.useForm(),[t,n]=b.useState(e.mode);return L.useFormEffects(()=>{le.onFieldValueChange("mode",s=>{n(s.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),r.jsxs(r.Fragment,{children:[r.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:er},required:!0,default:we.STATIC}}),r.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${t}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
494
+ `,children:[n.jsx(y.Select,{value:r,onChange:s,className:"auto-width",children:wt.map(a=>n.jsx(y.Select.Option,{value:a.value,children:t(a.text)},a.value))}),typeof r=="number"?n.jsx(Qn,{value:e,onChange:o}):null,r==="cron"?n.jsx(_n,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>o(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const Rn={[we.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}}},[we.DATE_FIELD]:{collection:A(C({},ae),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}},appends:A(C({},Ve),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${we.DATE_FIELD} && $deps[1]}}`}}}]})}},er=[{value:we.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:we.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],or=()=>{const{values:e={},clearFormGraph:o}=L.useForm(),[t,r]=b.useState(e.mode);return L.useFormEffects(()=>{le.onFieldValueChange("mode",s=>{r(s.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:er},required:!0,default:we.STATIC}}),n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${t}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
495
495
  .ant-input-number {
496
496
  width: auto;
497
497
  min-width: 6em;
@@ -500,29 +500,29 @@
500
500
  .ant-picker {
501
501
  width: auto;
502
502
  }
503
- `},properties:Rn[t]}}},components:{OnField:at,RepeatField:Xn,EndsByField:zn}})]})};function tr(e,o){var c;const[t,n]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:T("Trigger time")}),e.mode===we.DATE_FIELD){const[u]=Ae(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},o),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:T("Trigger data")}}],compile:s,getCollectionFields:a}));u&&i.push(u)}return i}class nr extends So{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${p}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${p}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:or});w(this,"useVariables",tr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}function Te(e){const a=e,{options:o=[],direction:t}=a,n=Z(a,["options","direction"]),s=l.useCompile();return r.jsx(g.Radio.Group,A(C({},n),{children:r.jsx(g.Space,{direction:t,children:o.map(i=>r.jsxs(g.Radio,{value:i.value,children:[r.jsx("span",{className:l.css`
503
+ `},properties:Rn[t]}}},components:{OnField:at,RepeatField:Xn,EndsByField:zn}})]})};function tr(e,o){var c;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:T("Trigger time")}),e.mode===we.DATE_FIELD){const[u]=Ae(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},o),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:T("Trigger data")}}],compile:s,getCollectionFields:a}));u&&i.push(u)}return i}class nr extends So{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${p}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${p}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:or});w(this,"useVariables",tr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}function Te(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Radio.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Radio,{value:i.value,children:[n.jsx("span",{className:l.css`
504
504
  & + .anticon {
505
505
  margin-left: 0.25em;
506
506
  }
507
- `,children:s(i.label)}),i.tooltip&&r.jsx(g.Tooltip,{title:s(i.tooltip),children:r.jsx(P.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function kt(){const e=L.useFieldSchema(),o=l.useCompile();return r.jsxs(l.GeneralSchemaDesigner,{title:o(e.title),children:[r.jsx(l.SchemaSettingsBlockTitleItem,{}),r.jsx(l.SchemaSettingsDivider,{}),r.jsx(l.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Ne=()=>null;function rr(){const a=l.useSchemaInitializerItem(),{node:o,resultTitle:t}=a,n=Z(a,["node","resultTitle"]),{insert:s}=l.useSchemaInitializer();return r.jsx(l.SchemaInitializerItem,A(C({},n),{onClick:()=>{var i;s({type:"void",name:o.id,title:o.title,"x-component":"CardItem","x-component-props":{title:(i=o.title)!=null?i:`#${o.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:t,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${o.key}}}`}}}})}}))}function sr({dataSource:e}){var s;const o=L.useFieldSchema(),{execution:t}=G();if(!t)return o.title;const n=J.parse(e)({$jobsMapByNodeKey:((s=t.jobs)!=null?s:[]).reduce((a,i)=>Object.assign(a,{[i.nodeKey]:i.result}),{})});return r.jsx("pre",{className:l.css`
507
+ `,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function kt(){const e=L.useFieldSchema(),o=l.useCompile();return n.jsxs(l.GeneralSchemaDesigner,{title:o(e.title),children:[n.jsx(l.SchemaSettingsBlockTitleItem,{}),n.jsx(l.SchemaSettingsDivider,{}),n.jsx(l.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Ne=()=>null;function rr(){const a=l.useSchemaInitializerItem(),{node:o,resultTitle:t}=a,r=Z(a,["node","resultTitle"]),{insert:s}=l.useSchemaInitializer();return n.jsx(l.SchemaInitializerItem,A(C({},r),{onClick:()=>{var i;s({type:"void",name:o.id,title:o.title,"x-component":"CardItem","x-component-props":{title:(i=o.title)!=null?i:`#${o.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:t,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${o.key}}}`}}}})}}))}function sr({dataSource:e}){var s;const o=L.useFieldSchema(),{execution:t}=G();if(!t)return o.title;const r=J.parse(e)({$jobsMapByNodeKey:((s=t.jobs)!=null?s:[]).reduce((a,i)=>Object.assign(a,{[i.nodeKey]:i.result}),{})});return n.jsx("pre",{className:l.css`
508
508
  margin: 0;
509
- `,children:JSON.stringify(n,null,2)})}Ne.Initializer=rr,Ne.Result=sr,Ne.Designer=kt;const St=e=>{const o=De.evaluators.get(e);return o&&o.link?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:l.css`
509
+ `,children:JSON.stringify(r,null,2)})}Ne.Initializer=rr,Ne.Result=sr,Ne.Designer=kt;const St=e=>{const o=De.evaluators.get(e);return o&&o.link?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:l.css`
510
510
  &:after {
511
511
  content: ':';
512
512
  }
513
513
  & + a {
514
514
  margin-left: 0.25em;
515
515
  }
516
- `,children:l.i18n.t("Syntax references")}),r.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null};class lr extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","control");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,n,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:St});w(this,"components",{WorkflowVariableTextArea:Io,RadioWithTooltip:Te,ValueBlock:Ne})}useVariables({key:t,title:n},{types:s,fieldNames:a=Se}){return s&&!s.some(i=>i in Ze||Object.values(Ze).some(c=>c.has(i)))?null:{value:t,label:n}}useInitializers(t){var n,s;return{name:(n=t.title)!=null?n:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Ne.Initializer,node:t,resultTitle:T("Calculation result")}}}const X=new J.Registry;X.register("equal",{name:"=",type:"boolean",group:"boolean"}),X.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),X.register("gt",{name:">",type:"boolean",group:"boolean"}),X.register("gte",{name:"≥",type:"boolean",group:"boolean"}),X.register("lt",{name:"<",type:"boolean",group:"boolean"}),X.register("lte",{name:"≤",type:"boolean",group:"boolean"}),X.register("add",{name:"+",type:"number",group:"number"}),X.register("minus",{name:"-",type:"number",group:"number"}),X.register("multiple",{name:"*",type:"number",group:"number"}),X.register("divide",{name:"/",type:"number",group:"number"}),X.register("mod",{name:"%",type:"number",group:"number"}),X.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),X.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),X.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),X.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),X.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),X.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),X.register("concat",{name:`{{t("concat", { ns: "${p}" })}}`,type:"string",group:"string"});const ir=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${p}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${p}" })}}`},{value:"date",title:`{{t("Date", { ns: "${p}" })}}`}];function At(e){return Array.from(X.getEntities()).filter(([o,t])=>t.group===e)}function ar({calculator:e,operands:o=[],onChange:t}){const n=l.useCompile(),s=me(),a=me(),i=b.useCallback(d=>t({calculator:e,operands:[d,o[1]]}),[e,t,o]),c=b.useCallback(d=>t({calculator:e,operands:[o[0],d]}),[e,t,o]),u=b.useCallback(d=>t({operands:o,calculator:d}),[t,o]);return r.jsxs("fieldset",{className:l.css`
516
+ `,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null};class lr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","control");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:St});w(this,"components",{WorkflowVariableTextArea:Io,RadioWithTooltip:Te,ValueBlock:Ne})}useVariables({key:t,title:r},{types:s,fieldNames:a=Se}){return s&&!s.some(i=>i in Ze||Object.values(Ze).some(c=>c.has(i)))?null:{value:t,label:r}}useInitializers(t){var r,s;return{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Ne.Initializer,node:t,resultTitle:T("Calculation result")}}}const X=new J.Registry;X.register("equal",{name:"=",type:"boolean",group:"boolean"}),X.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),X.register("gt",{name:">",type:"boolean",group:"boolean"}),X.register("gte",{name:"≥",type:"boolean",group:"boolean"}),X.register("lt",{name:"<",type:"boolean",group:"boolean"}),X.register("lte",{name:"≤",type:"boolean",group:"boolean"}),X.register("add",{name:"+",type:"number",group:"number"}),X.register("minus",{name:"-",type:"number",group:"number"}),X.register("multiple",{name:"*",type:"number",group:"number"}),X.register("divide",{name:"/",type:"number",group:"number"}),X.register("mod",{name:"%",type:"number",group:"number"}),X.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),X.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),X.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),X.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),X.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),X.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),X.register("concat",{name:`{{t("concat", { ns: "${p}" })}}`,type:"string",group:"string"});const ir=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${p}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${p}" })}}`},{value:"date",title:`{{t("Date", { ns: "${p}" })}}`}];function At(e){return Array.from(X.getEntities()).filter(([o,t])=>t.group===e)}function ar({calculator:e,operands:o=[],onChange:t}){const r=l.useCompile(),s=me(),a=me(),i=b.useCallback(d=>t({calculator:e,operands:[d,o[1]]}),[e,t,o]),c=b.useCallback(d=>t({calculator:e,operands:[o[0],d]}),[e,t,o]),u=b.useCallback(d=>t({operands:o,calculator:d}),[t,o]);return n.jsxs("fieldset",{className:l.css`
517
517
  display: flex;
518
518
  gap: 0.5em;
519
519
  align-items: center;
520
520
  flex-wrap: wrap;
521
- `,children:[r.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[0],onChange:i,scope:s,useTypedConstant:!0}),r.jsx(g.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:u,placeholder:T("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:ir.filter(d=>!!At(d.value).length).map(d=>r.jsx(g.Select.OptGroup,{label:n(d.title),children:At(d.value).map(([f,{name:h}])=>r.jsx(g.Select.Option,{value:f,children:n(h)},f))},d.value))}),r.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[1],onChange:c,scope:a,useTypedConstant:!0})]})}function cr({value:e,onChange:o,onRemove:t}){if(!e)return null;const{calculator:n,operands:s=[]}=e;return r.jsxs("div",{className:l.css`
521
+ `,children:[n.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[0],onChange:i,scope:s,useTypedConstant:!0}),n.jsx(y.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:u,placeholder:T("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:ir.filter(d=>!!At(d.value).length).map(d=>n.jsx(y.Select.OptGroup,{label:r(d.title),children:At(d.value).map(([f,{name:h}])=>n.jsx(y.Select.Option,{value:f,children:r(h)},f))},d.value))}),n.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[1],onChange:c,scope:a,useTypedConstant:!0})]})}function cr({value:e,onChange:o,onRemove:t}){if(!e)return null;const{calculator:r,operands:s=[]}=e;return n.jsxs("div",{className:l.css`
522
522
  display: flex;
523
523
  position: relative;
524
524
  margin: 0.5em 0;
525
- `,children:[e.group?r.jsx(Ft,{value:e.group,onChange:a=>o(A(C({},e),{group:a}))}):r.jsx(ar,{operands:s,calculator:n,onChange:o}),r.jsx(g.Button,{"aria-label":"icon-close",onClick:t,type:"link",icon:r.jsx(P.CloseCircleOutlined,{})})]})}function Ft({value:e,onChange:o}){const{t}=Q.useTranslation(),{type:n="and",calculations:s=[]}=e;function a(){o(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))}function i(){o(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))}function c(d){s.splice(d,1),o(A(C({},e),{calculations:[...s]}))}function u(d,f){s.splice(d,1,f),o(A(C({},e),{calculations:[...s]}))}return r.jsxs("div",{className:l.cx("node-type-condition-group",l.css`
525
+ `,children:[e.group?n.jsx(Ft,{value:e.group,onChange:a=>o(A(C({},e),{group:a}))}):n.jsx(ar,{operands:s,calculator:r,onChange:o}),n.jsx(y.Button,{"aria-label":"icon-close",onClick:t,type:"link",icon:n.jsx(I.CloseCircleOutlined,{})})]})}function Ft({value:e,onChange:o}){const{t}=Q.useTranslation(),{type:r="and",calculations:s=[]}=e;function a(){o(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))}function i(){o(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))}function c(d){s.splice(d,1),o(A(C({},e),{calculations:[...s]}))}function u(d,f){s.splice(d,1,f),o(A(C({},e),{calculations:[...s]}))}return n.jsxs("div",{className:l.cx("node-type-condition-group",l.css`
526
526
  position: relative;
527
527
  width: 100%;
528
528
  .node-type-condition-group {
@@ -533,7 +533,7 @@
533
533
  position: absolute;
534
534
  right: 0;
535
535
  }
536
- `),children:[r.jsx("div",{className:l.css`
536
+ `),children:[n.jsx("div",{className:l.css`
537
537
  display: flex;
538
538
  align-items: center;
539
539
  gap: 0.5em;
@@ -541,18 +541,18 @@
541
541
  width: auto;
542
542
  min-width: 6em;
543
543
  }
544
- `,children:r.jsxs(Q.Trans,{children:["Meet ",r.jsxs(g.Select,{role:"button","data-testid":"filter-select-all-or-any",value:n,onChange:d=>o(A(C({},e),{type:d})),children:[r.jsx(g.Select.Option,{value:"and",children:"All"}),r.jsx(g.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),r.jsx("div",{className:"calculation-items",children:s.map((d,f)=>r.jsx(cr,{value:d,onChange:u.bind(this,f),onRemove:()=>c(f)},`${d.calculator}_${f}`))}),r.jsxs("div",{className:l.css`
544
+ `,children:n.jsxs(Q.Trans,{children:["Meet ",n.jsxs(y.Select,{role:"button","data-testid":"filter-select-all-or-any",value:r,onChange:d=>o(A(C({},e),{type:d})),children:[n.jsx(y.Select.Option,{value:"and",children:"All"}),n.jsx(y.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),n.jsx("div",{className:"calculation-items",children:s.map((d,f)=>n.jsx(cr,{value:d,onChange:u.bind(this,f),onRemove:()=>c(f)},`${d.calculator}_${f}`))}),n.jsxs("div",{className:l.css`
545
545
  button {
546
546
  padding: 0;
547
547
  &:not(:last-child) {
548
548
  margin-right: 1em;
549
549
  }
550
550
  }
551
- `,children:[r.jsx(g.Button,{type:"link",onClick:a,children:t("Add condition")}),r.jsx(g.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}function dr({value:e,onChange:o}){const t=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return r.jsx(Ft,{value:t.group,onChange:n=>o(A(C({},t),{group:n}))})}class ur extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[n,s])=>t.concat(C({value:n},s)),[])},required:!0,default:"basic"},calculation:{type:"string",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,n,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"options",[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,key:"branch",value:{rejectOnFalse:!1}}]);w(this,"scope",{renderEngineReference:St,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:dr,WorkflowVariableTextArea:Io,RadioWithTooltip:Te})}Component({data:t}){const{t:n}=Q.useTranslation(),{nodes:s}=G(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(f=>f.upstreamId===i&&f.branchIndex===1),d=s.find(f=>f.upstreamId===i&&f.branchIndex===0);return r.jsx(ko,{data:t,children:c?null:r.jsxs("div",{className:a.nodeSubtreeClass,children:[r.jsxs("div",{className:a.branchBlockClass,children:[r.jsx(Ke,{from:t,entry:d,branchIndex:0}),r.jsx(Ke,{from:t,entry:u,branchIndex:1})]}),r.jsxs("div",{className:a.conditionClass,children:[r.jsx("span",{style:{right:"4em"},children:n("No")}),r.jsx("span",{style:{left:"4em"},children:n("Yes")})]})]})})}}class pr extends ye{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ie.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ie.FAILED}],required:!0,default:ie.RESOLVED}});w(this,"end",!0)}}function oo({value:e,onChange:o,renderSchemaComponent:t}){const n=me();return r.jsx(l.Variable.Input,{value:e,onChange:o,scope:n,children:t()})}function mr(e){const{execution:o,nodes:t}=G(),n=b.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=b.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[n[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,n]);return b.useMemo(()=>ke.get(s,e),[s,e])}function fr({collection:e,dataPath:o,children:t}){const n=L.useField(),s=b.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),u=mr(o);let d,f;if(typeof e=="string"){const M=l.parseCollectionName(e);d=M[0],f=M[1]}else f=e;const h=b.useMemo(()=>le.createForm({values:u,readPretty:!0}),[u]),x={appends:i},y={loading:!1,data:{data:u}},k=l.useAPIClient().resource(f),O=l.useBlockRequestContext();return r.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:f,children:r.jsx(l.RecordProvider,{record:u,parent:null,children:r.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:n,service:y,resource:k,__parent:O},children:r.jsx(l.FormBlockContext.Provider,{value:{params:x,form:h,field:n,service:y,updateAssociationValues:c,formBlockRef:s},children:t})})})})}function hr(e){const a=e,{options:o=[],direction:t}=a,n=Z(a,["options","direction"]),s=l.useCompile();return r.jsx(g.Checkbox.Group,A(C({},n),{children:r.jsx(g.Space,{direction:t,children:o.map(i=>r.jsxs(g.Checkbox,{value:i.value,children:[r.jsx("span",{className:l.css`
551
+ `,children:[n.jsx(y.Button,{type:"link",onClick:a,children:t("Add condition")}),n.jsx(y.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}function dr({value:e,onChange:o}){const t=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(Ft,{value:t.group,onChange:r=>o(A(C({},t),{group:r}))})}class ur extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[r,s])=>t.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"string",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"options",[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,key:"branch",value:{rejectOnFalse:!1}}]);w(this,"scope",{renderEngineReference:St,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:dr,WorkflowVariableTextArea:Io,RadioWithTooltip:Te})}Component({data:t}){const{t:r}=Q.useTranslation(),{nodes:s}=G(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(f=>f.upstreamId===i&&f.branchIndex===1),d=s.find(f=>f.upstreamId===i&&f.branchIndex===0);return n.jsx(ko,{data:t,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(Ke,{from:t,entry:d,branchIndex:0}),n.jsx(Ke,{from:t,entry:u,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class pr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ie.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ie.FAILED}],required:!0,default:ie.RESOLVED}});w(this,"end",!0)}}function oo({value:e,onChange:o,renderSchemaComponent:t}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:o,scope:r,children:t()})}function mr(e){const{execution:o,nodes:t}=G(),r=b.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=b.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[r[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,r]);return b.useMemo(()=>ke.get(s,e),[s,e])}function fr({collection:e,dataPath:o,children:t}){const r=L.useField(),s=b.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),u=mr(o);let d,f;if(typeof e=="string"){const B=l.parseCollectionName(e);d=B[0],f=B[1]}else f=e;const h=b.useMemo(()=>le.createForm({values:u,readPretty:!0}),[u]),x={appends:i},g={loading:!1,data:{data:u}},k=l.useAPIClient().resource(f),O=l.useBlockRequestContext();return n.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:f,children:n.jsx(l.RecordProvider,{record:u,parent:null,children:n.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:g,resource:k,__parent:O},children:n.jsx(l.FormBlockContext.Provider,{value:{params:x,form:h,field:r,service:g,updateAssociationValues:c,formBlockRef:s},children:t})})})})}function hr(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Checkbox.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Checkbox,{value:i.value,children:[n.jsx("span",{className:l.css`
552
552
  & + .anticon {
553
553
  margin-left: 0.25em;
554
554
  }
555
- `,children:s(i.label)}),i.tooltip&&r.jsx(g.Tooltip,{title:s(i.tooltip),children:r.jsx(P.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function gr({key:e,title:o,config:t},n){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},n),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class yr extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${p}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${p}" })}}`},{label:`{{t("Multiple records", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${p}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:_e,sort:Nn,pagination:En,appends:Ve},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${p}" })}}`}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const t=l.useCompile(),{values:n}=L.useForm(),[s,a]=l.parseCollectionName(n.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const f=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(f!=null&&f.sortable)}).map(d=>{var f,h;return{value:d.name,label:(f=d==null?void 0:d.uiSchema)!=null&&f.title?t((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:jo.ArrayItems,FilterDynamicComponent:oo,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:lt,RadioWithTooltip:Te});w(this,"useVariables",gr)}useInitializers(t){var n,s;return!t.config.collection||t.config.multiple?null:{name:(n=t.title)!=null?n:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}}}function br(e){const{getCollectionFields:o}=l.useCollectionManager_deprecated(),{path:t}=L.useField(),n=t.segments[t.segments.length-1],{values:s}=L.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=o(i,a),{type:u}=c.find(h=>h.name===n),d=Array.isArray(e.value)?e.value.join(","):e.value,f=b.useCallback(h=>{const x=h.target.value.trim(),y=["belongsTo","hasOne"].includes(u)?x||null:x.split(",").map(m=>m.trim()).filter(m=>m!=="");e.onChange(y)},[e.onChange,u]);return r.jsx(g.Input,A(C({},e),{value:d,onChange:f}))}const Ot=L.observer(({value:e,disabled:o,onChange:t,filter:n})=>{const{token:s}=l.useToken(),{t:a}=Q.useTranslation(),i=l.useCompile(),c=L.useForm(),{getCollectionFields:u}=l.useCollectionManager_deprecated(),d=me(),{values:f}=c,[h,x]=l.parseCollectionName(f==null?void 0:f.collection),y=u(x,h).filter(S=>S.uiSchema),m=n?y.filter(n.bind(f)):y,k=b.useMemo(()=>m.filter(S=>!e||!(S.name in e)),[m,e]),O=o||c.disabled,M=b.useMemo(()=>({onClick:({key:S})=>{t(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,W;return{key:S.name,label:i((W=(E=S.uiSchema)==null?void 0:E.title)!=null?W:S.name)}})}),[t,k,e]);return r.jsx("fieldset",{className:l.css`
555
+ `,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function yr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class gr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${p}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${p}" })}}`},{label:`{{t("Multiple records", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${p}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:_e,sort:Nn,pagination:En,appends:Ve},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${p}" })}}`}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const t=l.useCompile(),{values:r}=L.useForm(),[s,a]=l.parseCollectionName(r.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const f=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(f!=null&&f.sortable)}).map(d=>{var f,h;return{value:d.name,label:(f=d==null?void 0:d.uiSchema)!=null&&f.title?t((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:jo.ArrayItems,FilterDynamicComponent:oo,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:lt,RadioWithTooltip:Te});w(this,"useVariables",yr)}useInitializers(t){var r,s;return!t.config.collection||t.config.multiple?null:{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}}}function br(e){const{getCollectionFields:o}=l.useCollectionManager_deprecated(),{path:t}=L.useField(),r=t.segments[t.segments.length-1],{values:s}=L.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=o(i,a),{type:u}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,f=b.useCallback(h=>{const x=h.target.value.trim(),g=["belongsTo","hasOne"].includes(u)?x||null:x.split(",").map(m=>m.trim()).filter(m=>m!=="");e.onChange(g)},[e.onChange,u]);return n.jsx(y.Input,A(C({},e),{value:d,onChange:f}))}const Ot=L.observer(({value:e,disabled:o,onChange:t,filter:r})=>{const{token:s}=l.useToken(),{t:a}=Q.useTranslation(),i=l.useCompile(),c=L.useForm(),{getCollectionFields:u}=l.useCollectionManager_deprecated(),d=me(),{values:f}=c,[h,x]=l.parseCollectionName(f==null?void 0:f.collection),g=u(x,h).filter(S=>S.uiSchema),m=r?g.filter(r.bind(f)):g,k=b.useMemo(()=>m.filter(S=>!e||!(S.name in e)),[m,e]),O=o||c.disabled,B=b.useMemo(()=>({onClick:({key:S})=>{t(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,W;return{key:S.name,label:i((W=(E=S.uiSchema)==null?void 0:E.title)!=null?W:S.name)}})}),[t,k,e]);return n.jsx("fieldset",{className:l.css`
556
556
  margin-top: 0.5em;
557
557
 
558
558
  > .ant-formily-item {
@@ -562,8 +562,8 @@
562
562
  line-height: 32px;
563
563
  }
564
564
  }
565
- `,children:m.length?r.jsxs(l.CollectionProvider_deprecated,{name:x,dataSource:h,children:[m.filter(S=>e&&S.name in e).map(S=>{var W,$;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?br:l.CollectionField;return r.jsxs(g.Form.Item,{label:i(($=(W=S.uiSchema)==null?void 0:W.title)!=null?$:S.name),labelAlign:"left",className:l.css`
565
+ `,children:m.length?n.jsxs(l.CollectionProvider_deprecated,{name:x,dataSource:h,children:[m.filter(S=>e&&S.name in e).map(S=>{var W,$;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?br:l.CollectionField;return n.jsxs(y.Form.Item,{label:i(($=(W=S.uiSchema)==null?void 0:W.title)!=null?$:S.name),labelAlign:"left",className:l.css`
566
566
  .ant-form-item-control-input-content {
567
567
  display: flex;
568
568
  }
569
- `,children:[r.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:B=>{t(A(C({},e),{[S.name]:B}))},children:r.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),O?null:r.jsx(g.Button,{"aria-label":"icon-close",type:"link",icon:r.jsx(P.CloseCircleOutlined,{}),onClick:()=>{var F;const D=e,{[F=S.name]:B}=D,N=Z(D,[Kt(F)]);t(N)}})]},S.name)}),k.length?r.jsx(g.Dropdown,{menu:M,children:r.jsx(g.Button,{icon:r.jsx(P.PlusOutlined,{}),children:a("Add field")})}):null]}):r.jsx("p",{style:{color:s.colorText},children:T("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Tt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Tt(t,o)})}function Nt(){return{name:ho.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Et(e){const{workflow:o}=G(),{setFormValueChanged:t}=l.useActionContext();l.useAPIClient();const n=me(),s=L.useForm(),{values:a,setValuesIn:i}=s,c=fo.toJS(a.params),[u,d]=l.parseCollectionName(a.collection),f=l.useSchemaOptionsContext(),[h,x]=b.useState(e.value&&Object.keys(e.value).length?e.value:Nt()),y=b.useMemo(()=>le.createForm({initialValues:c.values,disabled:o.executed,effects(){le.onFormValuesChange(k=>{i("params.values",fo.toJS(k.values)),t(!0)})}}),[o.executed]);L.useFormEffects(()=>{le.onFieldValueChange("collection",k=>U(this,null,function*(){y.clearFormGraph("*");const O=Nt();i("params.values",{}),x(O)}))});const m=b.useCallback(k=>{const[O]=Object.values(k.toJSON().properties);e.onChange(O);const M=new Set;Tt(O,E=>{var W;if(E["x-component"]==="AssignedField"&&(W=E["x-collection-field"])!=null&&W.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");M.add($)}});const S={};Array.from(M).forEach(E=>{E in y.values&&(S[E]=y.values[E])}),i("params.values",S)},[d,e.onChange]);return r.jsx(g.Card,{children:r.jsx(l.CollectionManagerProvider,{dataSource:u,children:r.jsx(l.CollectionProvider,{name:d,children:r.jsx(l.FormProvider,{form:y,children:r.jsx(jo.FormLayout,{layout:"vertical",children:r.jsx(l.VariableScopeProvider,{scope:n,children:r.jsx(l.SchemaComponentProvider,{form:y,designable:!s.disabled,children:r.jsx(l.SchemaComponentOptions,A(C({},f),{children:r.jsx(l.SchemaComponent,{schema:h,onChange:m})}))})})})})})})})}function vr({key:e,title:o,config:t},n){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},n),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class xr extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:Ve}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et});w(this,"useVariables",vr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var n,s;return t.config.collection?{name:(n=t.title)!=null?n:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class wr extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${p}" })}}`}]},default:!1},filter:A(C({},_e),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}}),values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{FilterDynamicComponent:oo,CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et,RadioWithTooltip:Te})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Cr extends ye{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},_e),{"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:oo})}}const kr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess,useVisible(){var o;const e=L.useFieldSchema();return ho.isValid((o=e==null?void 0:e["x-action-settings"])==null?void 0:o.onSuccess)}},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Sr({children:e,workflow:o,execution:t,nodes:n}){const s=l.usePlugin(de),a=s.triggers.get(o.type).components,i=n.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return r.jsx(Ie.Provider,{value:{workflow:o,nodes:n,execution:t},children:r.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class de extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new J.Registry);w(this,"instructions",new J.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[t,i]=a,c=i,{title:n}=c,s=Z(c,["title"]);return{value:t,label:n,color:"gold",options:s}}))}isWorkflowSync(t){var n,s;return(s=(n=this.triggers.get(t.type))==null?void 0:n.sync)!=null?s:t.sync}registerTrigger(t,n){if(typeof n=="function")this.triggers.register(t,new n);else if(n)this.triggers.register(t,n);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,n){if(typeof n=="function")this.instructions.register(t,new n);else if(n instanceof ye)this.instructions.register(t,n);else throw new TypeError("invalid instruction type to register")}load(){return U(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:xe(":id"),element:r.jsx(Xo,{})}),this.app.router.add("admin.workflow.executions.id",{path:Ye(":id"),element:r.jsx(qo,{})}),this.app.addComponents({WorkflowPage:Xo,ExecutionPage:qo}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:Fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(kr),this.registerTrigger("collection",Wn),this.registerTrigger("schedule",nr),this.registerInstruction("calculation",lr),this.registerInstruction("condition",ur),this.registerInstruction("end",pr),this.registerInstruction("query",yr),this.registerInstruction("create",xr),this.registerInstruction("update",wr),this.registerInstruction("destroy",Cr)})}}v.BaseTypeSets=Ze,v.Branch=Ke,v.CheckboxGroupWithTooltip=hr,v.CollectionBlockInitializer=Be,v.DetailsBlockProvider=fr,v.EXECUTION_STATUS=pe,v.ExecutionContextProvider=Sr,v.ExecutionStatusOptions=He,v.ExecutionStatusOptionsMap=Ge,v.FieldsSelect=To,v.FilterDynamicComponent=oo,v.FlowContext=Ie,v.Instruction=ye,v.JOB_STATUS=ie,v.JobButton=Co,v.JobStatusOptions=vo,v.JobStatusOptionsMap=qe,v.Node=Ho,v.NodeContext=xo,v.NodeDefaultView=ko,v.RadioWithTooltip=Te,v.RemoveButton=wo,v.SimpleDesigner=kt,v.Trigger=So,v.ValueBlock=Ne,v.WorkflowVariableInput=lt,v.WorkflowVariableJSON=In,v.WorkflowVariableRawTextArea=Dn,v.WorkflowVariableTextArea=Io,v.default=de,v.defaultFieldNames=Se,v.getCollectionFieldOptions=Ae,v.getWorkflowDetailPath=xe,v.getWorkflowExecutionsPath=Ye,v.linkNodes=Fo,v.nodesOptions=ot,v.scopeOptions=nt,v.systemOptions=rt,v.traverseSchema=Oo,v.triggerOptions=tt,v.useAvailableUpstreams=Jo,v.useFlowContext=G,v.useGetAriaLabelOfAddButton=bo,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Me,v.useRecordTriggerWorkflowsActionProps=Mn,v.useStyles=ne,v.useTrigger=Ao,v.useTriggerWorkflowsActionProps=Pn,v.useUpstreamScopes=Uo,v.useWorkflowAnyExecuted=it,v.useWorkflowExecuted=Bn,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
569
+ `,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:M=>{t(A(C({},e),{[S.name]:M}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),O?null:n.jsx(y.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(I.CloseCircleOutlined,{}),onClick:()=>{var F;const D=e,{[F=S.name]:M}=D,N=Z(D,[Kt(F)]);t(N)}})]},S.name)}),k.length?n.jsx(y.Dropdown,{menu:B,children:n.jsx(y.Button,{icon:n.jsx(I.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:T("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Tt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Tt(t,o)})}function Nt(){return{name:ho.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Et(e){const{workflow:o}=G(),{setFormValueChanged:t}=l.useActionContext();l.useAPIClient();const r=me(),s=L.useForm(),{values:a,setValuesIn:i}=s,c=fo.toJS(a.params),[u,d]=l.parseCollectionName(a.collection),f=l.useSchemaOptionsContext(),[h,x]=b.useState(e.value&&Object.keys(e.value).length?e.value:Nt()),g=b.useMemo(()=>le.createForm({initialValues:c.values,disabled:o.executed,effects(){le.onFormValuesChange(k=>{i("params.values",fo.toJS(k.values)),t(!0)})}}),[o.executed]);L.useFormEffects(()=>{le.onFieldValueChange("collection",k=>U(this,null,function*(){g.clearFormGraph("*");const O=Nt();i("params.values",{}),x(O)}))});const m=b.useCallback(k=>{const[O]=Object.values(k.toJSON().properties);e.onChange(O);const B=new Set;Tt(O,E=>{var W;if(E["x-component"]==="AssignedField"&&(W=E["x-collection-field"])!=null&&W.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");B.add($)}});const S={};Array.from(B).forEach(E=>{E in g.values&&(S[E]=g.values[E])}),i("params.values",S)},[d,e.onChange]);return n.jsx(y.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:u,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.FormProvider,{form:g,children:n.jsx(jo.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:g,designable:!s.disabled,children:n.jsx(l.SchemaComponentOptions,A(C({},f),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:m})}))})})})})})})})}function vr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class xr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:Ve}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et});w(this,"useVariables",vr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var r,s;return t.config.collection?{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class wr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${p}" })}}`}]},default:!1},filter:A(C({},_e),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}}),values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{FilterDynamicComponent:oo,CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et,RadioWithTooltip:Te})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Cr extends ge{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},_e),{"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:oo})}}const kr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess,useVisible(){var o;const e=L.useFieldSchema();return ho.isValid((o=e==null?void 0:e["x-action-settings"])==null?void 0:o.onSuccess)}},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Sr({children:e,workflow:o,execution:t,nodes:r}){const s=l.usePlugin(de),a=s.triggers.get(o.type).components,i=r.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return n.jsx(Ie.Provider,{value:{workflow:o,nodes:r,execution:t},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class de extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new J.Registry);w(this,"instructions",new J.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[t,i]=a,c=i,{title:r}=c,s=Z(c,["title"]);return{value:t,label:r,color:"gold",options:s}}))}isWorkflowSync(t){var r,s;return(s=(r=this.triggers.get(t.type))==null?void 0:r.sync)!=null?s:t.sync}registerTrigger(t,r){if(typeof r=="function")this.triggers.register(t,new r);else if(r)this.triggers.register(t,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,r){if(typeof r=="function")this.instructions.register(t,new r);else if(r instanceof ge)this.instructions.register(t,r);else throw new TypeError("invalid instruction type to register")}load(){return U(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:xe(":id"),element:n.jsx(Xo,{})}),this.app.router.add("admin.workflow.executions.id",{path:Ye(":id"),element:n.jsx(qo,{})}),this.app.addComponents({WorkflowPage:Xo,ExecutionPage:qo}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:Fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(kr),this.registerTrigger("collection",Wn),this.registerTrigger("schedule",nr),this.registerInstruction("calculation",lr),this.registerInstruction("condition",ur),this.registerInstruction("end",pr),this.registerInstruction("query",gr),this.registerInstruction("create",xr),this.registerInstruction("update",wr),this.registerInstruction("destroy",Cr)})}}v.BaseTypeSets=Ze,v.Branch=Ke,v.CheckboxGroupWithTooltip=hr,v.CollectionBlockInitializer=Be,v.DetailsBlockProvider=fr,v.EXECUTION_STATUS=pe,v.ExecutionContextProvider=Sr,v.ExecutionStatusOptions=He,v.ExecutionStatusOptionsMap=Ge,v.FieldsSelect=To,v.FilterDynamicComponent=oo,v.FlowContext=Ie,v.Instruction=ge,v.JOB_STATUS=ie,v.JobButton=Co,v.JobStatusOptions=vo,v.JobStatusOptionsMap=qe,v.Node=Ho,v.NodeContext=xo,v.NodeDefaultView=ko,v.RadioWithTooltip=Te,v.RemoveButton=wo,v.SimpleDesigner=kt,v.Trigger=So,v.ValueBlock=Ne,v.WorkflowVariableInput=lt,v.WorkflowVariableJSON=In,v.WorkflowVariableRawTextArea=Dn,v.WorkflowVariableTextArea=Io,v.default=de,v.defaultFieldNames=Se,v.getCollectionFieldOptions=Ae,v.getWorkflowDetailPath=xe,v.getWorkflowExecutionsPath=Ye,v.linkNodes=Fo,v.nodesOptions=ot,v.scopeOptions=nt,v.systemOptions=rt,v.traverseSchema=Oo,v.triggerOptions=tt,v.useAvailableUpstreams=Jo,v.useFlowContext=G,v.useGetAriaLabelOfAddButton=bo,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Me,v.useRecordTriggerWorkflowsActionProps=Mn,v.useStyles=ne,v.useTrigger=Ao,v.useTriggerWorkflowsActionProps=Pn,v.useUpstreamScopes=Uo,v.useWorkflowAnyExecuted=it,v.useWorkflowExecuted=Bn,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -11,24 +11,24 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "antd": "5.12.8",
13
13
  "@ant-design/icons": "5.2.6",
14
- "@nocobase/client": "1.2.9-alpha",
14
+ "@nocobase/client": "1.2.11-alpha",
15
15
  "react-router-dom": "6.21.0",
16
- "@nocobase/utils": "1.2.9-alpha",
16
+ "@nocobase/utils": "1.2.11-alpha",
17
17
  "react-i18next": "11.18.6",
18
18
  "@formily/core": "2.3.0",
19
19
  "@formily/react": "2.3.0",
20
20
  "lodash": "4.17.21",
21
- "@nocobase/database": "1.2.9-alpha",
22
- "@nocobase/server": "1.2.9-alpha",
23
- "@nocobase/logger": "1.2.9-alpha",
24
- "@nocobase/evaluators": "1.2.9-alpha",
21
+ "@nocobase/database": "1.2.11-alpha",
22
+ "@nocobase/server": "1.2.11-alpha",
23
+ "@nocobase/logger": "1.2.11-alpha",
24
+ "@nocobase/evaluators": "1.2.11-alpha",
25
25
  "@formily/antd-v5": "1.1.9",
26
26
  "@formily/reactive": "2.3.0",
27
27
  "@formily/shared": "2.3.0",
28
- "@nocobase/actions": "1.2.9-alpha",
29
- "@nocobase/data-source-manager": "1.2.9-alpha",
28
+ "@nocobase/actions": "1.2.11-alpha",
29
+ "@nocobase/data-source-manager": "1.2.11-alpha",
30
30
  "sequelize": "6.35.2",
31
- "@nocobase/plugin-workflow-test": "1.2.9-alpha",
32
- "@nocobase/test": "1.2.9-alpha",
31
+ "@nocobase/plugin-workflow-test": "1.2.11-alpha",
32
+ "@nocobase/test": "1.2.11-alpha",
33
33
  "dayjs": "1.11.10"
34
34
  };
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-06-27T03:13:29.760Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-06-28T03:53:08.246Z"}
@@ -1 +1 @@
1
- {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2024-06-27T03:13:29.406Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2024-06-28T03:53:07.888Z"}
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
6
6
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
7
- "version": "1.2.9-alpha",
7
+ "version": "1.2.11-alpha",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
12
12
  "dependencies": {
13
- "@nocobase/plugin-workflow-test": "1.2.9-alpha"
13
+ "@nocobase/plugin-workflow-test": "1.2.11-alpha"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@ant-design/icons": "5.x",
@@ -44,7 +44,7 @@
44
44
  "@nocobase/test": "1.x",
45
45
  "@nocobase/utils": "1.x"
46
46
  },
47
- "gitHead": "b80e4678e8098d60755195ec63f865122aba021a",
47
+ "gitHead": "251ff80e1ae6c0a9b4892fc6986dcdc0f5518fe8",
48
48
  "keywords": [
49
49
  "Workflow"
50
50
  ]