@nocobase/plugin-workflow 1.5.0-beta.2 → 1.5.0-beta.3

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.
@@ -514,7 +514,7 @@
514
514
  `},"x-component":"CollectionFieldset"},ot={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=T.useForm(),[t,o]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(o,t),className:l.css`
515
515
  position: relative;
516
516
  width: 100%;
517
- `}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},or={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"}}},nr={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},default:20}}}}}}},We={type:"array",title:`{{t("Preload associations", { ns: "${u}" })}}`,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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=T.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function rr(){const e=l.useAPIClient(),t=T.useForm(),{field:o,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=se.useNavigate(),i=T.useFieldSchema(),c=T.useField(),p=l.useCompile(),{modal:d}=g.App.useApp(),m=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return J(this,null,function*(){var M,S,E;const{onSuccess:b,skipValidator:f,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};f||(yield t.submit());const F=yield m();c.data=o.data||{},c.data.loading=!0;try{const L=yield e.resource("workflows").trigger({values:F,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=L,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(b!=null&&b.successMessage))return;b!=null&&b.manualClose?d.success({title:p(b==null?void 0:b.successMessage),onOk:()=>J(this,null,function*(){yield t.reset(),b!=null&&b.redirecting&&(b!=null&&b.redirectTo)&&(Q.isURL(b.redirectTo)?window.location.href=b.redirectTo:a(b.redirectTo))})}):g.message.success(p(b==null?void 0:b.successMessage))}catch(L){c.data.loading=!1}})}}}function sr(){var b;const e=l.useCompile(),t=l.useAPIClient(),o=l.useRecord(),r=T.useField(),s=T.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:p}=l.useActionContext(),{modal:d}=g.App.useApp(),m=se.useNavigate(),{onSuccess:h,triggerWorkflows:v}=(b=s==null?void 0:s["x-action-settings"])!=null?b:{};return{onClick(k,F){return J(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:v!=null&&v.length?v.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),F&&F(),c==null||c(!1),p==null||p(!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 J(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(Q.isURL(h.redirectTo)?window.location.href=h.redirectTo:m(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{r.data.loading=!1}})}}}function lr(){const{workflow:e}=H();return!!(e!=null&&e.executed)}function yo(){const{workflow:e}=H();return!!(e!=null&&e.allExecuted)}const Se={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},ar=[{label:`{{t("After record added", { ns: "${u}" })}}`,value:Se.CREATED},{label:`{{t("After record updated", { ns: "${u}" })}}`,value:Se.UPDATED},{label:`{{t("After record added or updated", { ns: "${u}" })}}`,value:Se.SAVED},{label:`{{t("After record deleted", { ns: "${u}" })}}`,value:Se.DELETED}];function ir(e,t){var p;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:O("Trigger data")}}];return Te(A(C({appends:["data",...((p=e.appends)==null?void 0:p.map(d=>`data.${d}`))||[]]},t),{fields:i,compile:s,getCollectionFields:a}))}class cr extends Mt{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${u}" })}}`);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: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...de["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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${u}" })}}`,className:"auto-width"},enum:ar,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${u}" })}}`,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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Se.UPDATED})}}`}}}]},condition:A(C({},ot),{title:`{{t("Only triggers when match conditions", { ns: "${u}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${Se.DELETED})}}`}}}]}),appends:A(C({},We),{"x-reactions":[...We["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Se.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:yo});w(this,"components",{FieldsSelect:Ct});w(this,"useVariables",ir)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}const Ae={STATIC:0,DATE_FIELD:1};function dr(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function go({value:e,onChange:t}){const o=e!=null?e:{},{t:r}=X.useTranslation(),[s,a]=y.useState(o.offset?o.offset/Math.abs(o.offset):0);return n.jsxs("fieldset",{className:l.css`
517
+ `}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},or={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"}}},nr={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},default:20}}}}}}},We={type:"array",title:`{{t("Preload associations", { ns: "${u}" })}}`,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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=T.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function rr(){const e=l.useAPIClient(),t=T.useForm(),{field:o,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=se.useNavigate(),i=T.useFieldSchema(),c=T.useField(),p=l.useCompile(),{modal:d}=g.App.useApp(),m=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return J(this,null,function*(){var M,S,E;const{onSuccess:b,skipValidator:f,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};f||(yield t.submit());const F=yield m();c.data=o.data||{},c.data.loading=!0;try{const L=yield e.resource("workflows").trigger({values:F,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=L,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(b!=null&&b.successMessage))return;b!=null&&b.manualClose?d.success({title:p(b==null?void 0:b.successMessage),onOk:()=>J(this,null,function*(){yield t.reset(),b!=null&&b.redirecting&&(b!=null&&b.redirectTo)&&(Q.isURL(b.redirectTo)?window.location.href=b.redirectTo:a(b.redirectTo))})}):g.message.success(p(b==null?void 0:b.successMessage))}catch(L){c.data.loading=!1}})}}}function sr(){var b;const e=l.useCompile(),t=l.useAPIClient(),o=l.useRecord(),r=T.useField(),s=T.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:p}=l.useActionContext(),{modal:d}=g.App.useApp(),m=se.useNavigate(),{onSuccess:h,triggerWorkflows:v}=(b=s==null?void 0:s["x-action-settings"])!=null?b:{};return{onClick(k,F){return J(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:v!=null&&v.length?v.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),F&&F(),c==null||c(!1),p==null||p(!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 J(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(Q.isURL(h.redirectTo)?window.location.href=h.redirectTo:m(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{r.data.loading=!1}})}}}function lr(){const{workflow:e}=H();return!!(e!=null&&e.executed)}function yo(){const{workflow:e}=H();return!!(e!=null&&e.allExecuted)}const Se={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},ar=[{label:`{{t("After record added", { ns: "${u}" })}}`,value:Se.CREATED},{label:`{{t("After record updated", { ns: "${u}" })}}`,value:Se.UPDATED},{label:`{{t("After record added or updated", { ns: "${u}" })}}`,value:Se.SAVED},{label:`{{t("After record deleted", { ns: "${u}" })}}`,value:Se.DELETED}];function ir(e,t){var p;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:O("Trigger data")}}];return Te(A(C({appends:["data",...((p=e.appends)==null?void 0:p.map(d=>`data.${d}`))||[]]},t),{fields:i,compile:s,getCollectionFields:a}))}class cr extends Mt{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${u}" })}}`);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: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...de["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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${u}" })}}`,className:"auto-width"},enum:ar,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${u}" })}}`,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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Se.UPDATED})}}`}}}]},condition:A(C({},ot),{title:`{{t("Only triggers when match conditions", { ns: "${u}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${Se.DELETED})}}`}}}]}),appends:A(C({},We),{"x-reactions":[...We["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Se.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:yo});w(this,"components",{FieldsSelect:Ct});w(this,"useVariables",ir)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}const Ae={STATIC:0,DATE_FIELD:1};function dr(e){return!e.hidden&&(e.uiSchema?["date","datetimeTz","datetimeNoTz"].includes(e.type):!1)}function go({value:e,onChange:t}){const o=e!=null?e:{},{t:r}=X.useTranslation(),[s,a]=y.useState(o.offset?o.offset/Math.abs(o.offset):0);return n.jsxs("fieldset",{className:l.css`
518
518
  display: flex;
519
519
  gap: 0.5em;
520
520
  `,children:[n.jsx(Ct,{value:o.field,onChange:i=>t(A(C({},o),{field:i})),filter:dr,placeholder:r("Select field"),className:"auto-width"}),o.field?n.jsx(g.Select,{value:s,onChange:i=>{a(i),t(A(C({},o),{offset:Math.abs(o.offset)*i}))},options:[{value:0,label:O("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(g.InputNumber,{value:Math.abs(o.offset),onChange:i=>t(A(C({},o),{offset:(i!=null?i:0)*s}))}),n.jsx(g.Select,{value:o.unit||864e5,onChange:i=>t(A(C({},o),{unit:i})),options:[{value:864e5,label:O("Days")},{value:36e5,label:O("Hours")},{value:6e4,label:O("Minutes")},{value:1e3,label:O("Seconds")}],className:"auto-width"})]}):null]})}function ur({value:e,onChange:t}){const{t:o}=xt(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
@@ -11,24 +11,24 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.0",
13
13
  "@formily/react": "2.3.0",
14
- "@nocobase/client": "1.5.0-beta.2",
15
- "@nocobase/utils": "1.5.0-beta.2",
14
+ "@nocobase/client": "1.5.0-beta.3",
15
+ "@nocobase/utils": "1.5.0-beta.3",
16
16
  "antd": "5.12.8",
17
17
  "@ant-design/icons": "5.2.6",
18
18
  "react-router-dom": "6.21.0",
19
19
  "react-i18next": "11.18.6",
20
20
  "@formily/shared": "2.3.2",
21
21
  "lodash": "4.17.21",
22
- "@nocobase/database": "1.5.0-beta.2",
23
- "@nocobase/server": "1.5.0-beta.2",
24
- "@nocobase/logger": "1.5.0-beta.2",
25
- "@nocobase/evaluators": "1.5.0-beta.2",
22
+ "@nocobase/database": "1.5.0-beta.3",
23
+ "@nocobase/server": "1.5.0-beta.3",
24
+ "@nocobase/logger": "1.5.0-beta.3",
25
+ "@nocobase/evaluators": "1.5.0-beta.3",
26
26
  "@formily/antd-v5": "1.1.9",
27
27
  "@formily/reactive": "2.3.0",
28
- "@nocobase/actions": "1.5.0-beta.2",
28
+ "@nocobase/actions": "1.5.0-beta.3",
29
29
  "dayjs": "1.11.10",
30
- "@nocobase/data-source-manager": "1.5.0-beta.2",
30
+ "@nocobase/data-source-manager": "1.5.0-beta.3",
31
31
  "sequelize": "6.35.2",
32
- "@nocobase/plugin-workflow-test": "1.5.0-beta.2",
33
- "@nocobase/test": "1.5.0-beta.2"
32
+ "@nocobase/plugin-workflow-test": "1.5.0-beta.3",
33
+ "@nocobase/test": "1.5.0-beta.3"
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-12-06T09:00:37.111Z"}
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-12-10T07:18:30.391Z"}
@@ -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-12-06T09:00:36.725Z"}
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-12-10T07:18:30.032Z"}
@@ -500,7 +500,8 @@ class PluginWorkflowServer extends import_server.Plugin {
500
500
  async process(execution, job, options = {}) {
501
501
  var _a, _b;
502
502
  if (execution.status === import_constants.EXECUTION_STATUS.QUEUEING) {
503
- await execution.update({ status: import_constants.EXECUTION_STATUS.STARTED }, { transaction: options.transaction });
503
+ const transaction = await this.useDataSourceTransaction("main", options.transaction);
504
+ await execution.update({ status: import_constants.EXECUTION_STATUS.STARTED }, { transaction });
504
505
  }
505
506
  const logger = this.getLogger(execution.workflowId);
506
507
  const processor = this.createProcessor(execution, options);
@@ -32,6 +32,10 @@ export default class Processor {
32
32
  * @experimental
33
33
  */
34
34
  transaction: Transaction;
35
+ /**
36
+ * @experimental
37
+ */
38
+ mainTransaction: Transaction;
35
39
  /**
36
40
  * @experimental
37
41
  */
@@ -66,6 +66,10 @@ class Processor {
66
66
  * @experimental
67
67
  */
68
68
  transaction;
69
+ /**
70
+ * @experimental
71
+ */
72
+ mainTransaction;
69
73
  /**
70
74
  * @experimental
71
75
  */
@@ -111,12 +115,13 @@ class Processor {
111
115
  async prepare() {
112
116
  const {
113
117
  execution,
114
- transaction,
115
118
  options: { plugin }
116
119
  } = this;
117
120
  if (!execution.workflow) {
118
121
  execution.workflow = plugin.enabledCache.get(execution.workflowId);
119
122
  }
123
+ this.mainTransaction = plugin.useDataSourceTransaction("main", this.transaction);
124
+ const transaction = this.mainTransaction;
120
125
  const nodes = await execution.workflow.getNodes({ transaction });
121
126
  this.makeNodes(nodes);
122
127
  const jobs = await execution.getJobs({
@@ -154,7 +159,7 @@ class Processor {
154
159
  this.logger.debug(`config of node`, { data: node.config });
155
160
  job = await instruction(node, prevJob, this);
156
161
  if (!job) {
157
- return null;
162
+ return this.exit();
158
163
  }
159
164
  } catch (err) {
160
165
  this.logger.error(
@@ -227,7 +232,10 @@ class Processor {
227
232
  async exit(s) {
228
233
  if (typeof s === "number") {
229
234
  const status = this.constructor.StatusMap[s] ?? Math.sign(s);
230
- await this.execution.update({ status }, { transaction: this.transaction });
235
+ await this.execution.update({ status }, { transaction: this.mainTransaction });
236
+ }
237
+ if (this.mainTransaction && this.mainTransaction !== this.transaction) {
238
+ await this.mainTransaction.commit();
231
239
  }
232
240
  this.logger.info(`execution (${this.execution.id}) exiting with status ${this.execution.status}`);
233
241
  return null;
@@ -238,7 +246,7 @@ class Processor {
238
246
  */
239
247
  async saveJob(payload) {
240
248
  const { database } = this.execution.constructor;
241
- const { transaction } = this;
249
+ const { mainTransaction: transaction } = this;
242
250
  const { model } = database.getCollection("jobs");
243
251
  let job;
244
252
  if (payload instanceof model) {
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.5.0-beta.2",
7
+ "version": "1.5.0-beta.3",
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.5.0-beta.2"
13
+ "@nocobase/plugin-workflow-test": "1.5.0-beta.3"
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": "8a9c29fdac5c6295dcc7abf00c3fa81bd9e01a36",
47
+ "gitHead": "81afcf4affdb652faf4636e6d9351828ce8906be",
48
48
  "keywords": [
49
49
  "Workflow"
50
50
  ]