@nocobase/plugin-workflow 2.1.0-beta.15 → 2.1.0-beta.16

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.
Files changed (125) hide show
  1. package/dist/client/214.7e602cfe7a8251b8.js +10 -0
  2. package/dist/client/261.7722d7400942730e.js +10 -0
  3. package/dist/client/67.f904ef4520868b8a.js +10 -0
  4. package/dist/client/964.6251d37b35710747.js +10 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/client/nodes/create.d.ts +10 -0
  7. package/dist/client/nodes/destroy.d.ts +10 -0
  8. package/dist/client/nodes/index.d.ts +3 -0
  9. package/dist/client/nodes/query.d.ts +10 -0
  10. package/dist/client/nodes/update.d.ts +10 -0
  11. package/dist/client/triggers/collection.d.ts +14 -1
  12. package/dist/client/triggers/index.d.ts +4 -0
  13. package/dist/client/triggers/schedule/constants.d.ts +4 -0
  14. package/dist/client/triggers/schedule/index.d.ts +15 -0
  15. package/dist/common/collections/jobs.js +7 -0
  16. package/dist/externalVersion.js +12 -12
  17. package/dist/locale/zh-CN.json +1 -0
  18. package/dist/node_modules/cron-parser/lib/parser.js +1 -1
  19. package/dist/node_modules/cron-parser/package.json +1 -1
  20. package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
  21. package/dist/node_modules/joi/lib/annotate.js +175 -0
  22. package/dist/node_modules/joi/lib/base.js +1069 -0
  23. package/dist/node_modules/joi/lib/cache.js +143 -0
  24. package/dist/node_modules/joi/lib/common.js +216 -0
  25. package/dist/node_modules/joi/lib/compile.js +283 -0
  26. package/dist/node_modules/joi/lib/errors.js +271 -0
  27. package/dist/node_modules/joi/lib/extend.js +312 -0
  28. package/dist/node_modules/joi/lib/index.d.ts +2365 -0
  29. package/dist/node_modules/joi/lib/index.js +1 -0
  30. package/dist/node_modules/joi/lib/manifest.js +476 -0
  31. package/dist/node_modules/joi/lib/messages.js +178 -0
  32. package/dist/node_modules/joi/lib/modify.js +267 -0
  33. package/dist/node_modules/joi/lib/ref.js +414 -0
  34. package/dist/node_modules/joi/lib/schemas.js +302 -0
  35. package/dist/node_modules/joi/lib/state.js +166 -0
  36. package/dist/node_modules/joi/lib/template.js +463 -0
  37. package/dist/node_modules/joi/lib/trace.js +346 -0
  38. package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
  39. package/dist/node_modules/joi/lib/types/any.js +174 -0
  40. package/dist/node_modules/joi/lib/types/array.js +809 -0
  41. package/dist/node_modules/joi/lib/types/binary.js +100 -0
  42. package/dist/node_modules/joi/lib/types/boolean.js +150 -0
  43. package/dist/node_modules/joi/lib/types/date.js +233 -0
  44. package/dist/node_modules/joi/lib/types/function.js +93 -0
  45. package/dist/node_modules/joi/lib/types/keys.js +1067 -0
  46. package/dist/node_modules/joi/lib/types/link.js +168 -0
  47. package/dist/node_modules/joi/lib/types/number.js +363 -0
  48. package/dist/node_modules/joi/lib/types/object.js +22 -0
  49. package/dist/node_modules/joi/lib/types/string.js +850 -0
  50. package/dist/node_modules/joi/lib/types/symbol.js +102 -0
  51. package/dist/node_modules/joi/lib/validator.js +750 -0
  52. package/dist/node_modules/joi/lib/values.js +263 -0
  53. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  54. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
  55. package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
  56. package/dist/node_modules/joi/package.json +1 -0
  57. package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
  58. package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
  59. package/dist/node_modules/lru-cache/dist/commonjs/index.d.ts +1381 -0
  60. package/dist/node_modules/lru-cache/dist/commonjs/index.js +1692 -0
  61. package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -0
  62. package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
  63. package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  64. package/dist/node_modules/lru-cache/dist/esm/browser/index.d.ts +1381 -0
  65. package/dist/node_modules/lru-cache/dist/{mjs → esm/browser}/index.js +537 -179
  66. package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  67. package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
  68. package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  69. package/dist/node_modules/lru-cache/dist/esm/index.d.ts +1381 -0
  70. package/dist/node_modules/lru-cache/dist/{cjs → esm}/index.js +538 -184
  71. package/dist/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  72. package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
  73. package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
  74. package/dist/node_modules/lru-cache/dist/esm/node/index.d.ts +1381 -0
  75. package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
  76. package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  77. package/dist/node_modules/lru-cache/package.json +1 -1
  78. package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
  79. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  80. package/dist/server/Plugin.d.ts +1 -0
  81. package/dist/server/Plugin.js +28 -3
  82. package/dist/server/actions/nodes.d.ts +5 -0
  83. package/dist/server/actions/nodes.js +38 -5
  84. package/dist/server/actions/workflows.d.ts +6 -0
  85. package/dist/server/actions/workflows.js +38 -0
  86. package/dist/server/instructions/ConditionInstruction.d.ts +2 -0
  87. package/dist/server/instructions/ConditionInstruction.js +17 -0
  88. package/dist/server/instructions/CreateInstruction.d.ts +3 -0
  89. package/dist/server/instructions/CreateInstruction.js +25 -0
  90. package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
  91. package/dist/server/instructions/DestroyInstruction.js +25 -0
  92. package/dist/server/instructions/EndInstruction.d.ts +2 -0
  93. package/dist/server/instructions/EndInstruction.js +4 -0
  94. package/dist/server/instructions/MultiConditionsInstruction.d.ts +2 -0
  95. package/dist/server/instructions/MultiConditionsInstruction.js +23 -0
  96. package/dist/server/instructions/OutputInstruction.d.ts +2 -0
  97. package/dist/server/instructions/OutputInstruction.js +14 -0
  98. package/dist/server/instructions/QueryInstruction.d.ts +3 -0
  99. package/dist/server/instructions/QueryInstruction.js +30 -0
  100. package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
  101. package/dist/server/instructions/UpdateInstruction.js +27 -0
  102. package/dist/server/instructions/index.d.ts +6 -1
  103. package/dist/server/instructions/index.js +18 -0
  104. package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
  105. package/dist/server/triggers/CollectionTrigger.js +28 -0
  106. package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
  107. package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
  108. package/dist/server/triggers/index.d.ts +3 -0
  109. package/dist/server/triggers/index.js +18 -0
  110. package/dist/server/utils.d.ts +2 -0
  111. package/dist/server/utils.js +22 -2
  112. package/package.json +4 -3
  113. package/dist/client/10.54a0831f49cae121.js +0 -10
  114. package/dist/client/626.7d24ff2a47742f1b.js +0 -10
  115. package/dist/client/771.5e7be8b4d4ac579f.js +0 -10
  116. package/dist/client/781.d46db08dcfead1b0.js +0 -10
  117. package/dist/node_modules/lru-cache/LICENSE +0 -15
  118. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
  119. package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
  120. package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
  121. package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
  122. package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
  123. package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
  124. /package/dist/node_modules/lru-cache/dist/{cjs → commonjs}/package.json +0 -0
  125. /package/dist/node_modules/lru-cache/dist/{mjs → esm}/package.json +0 -0
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).push([["626"],{144:function(e,t,r){r.d(t,{g:function(){return x}});var n=r(2721),o=r(8156),l=r.n(o);let a=(0,o.createContext)(null),i={didCatch:!1,error:null};class c extends o.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=i}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,o=Array(n),l=0;l<n;l++)o[l]=arguments[l];null==(t=(r=this.props).onReset)||t.call(r,{args:o,reason:"imperative-api"}),this.setState(i)}}componentDidCatch(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var o,l;null==(o=(l=this.props).onReset)||o.call(l,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(i)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:l,error:i}=this.state,c=e;if(l){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if((0,o.isValidElement)(n))c=n;else if("function"==typeof t)c=t(e);else if(r)c=(0,o.createElement)(r,e);else throw i}return(0,o.createElement)(a.Provider,{value:{didCatch:l,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}var s=r(482),u=r(3772),d=r(8218),f=r(2415),p=r(7058),m=r(8551),v=r(5329),y=r(4477),b=r(8562);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(){var e=w(["\n margin-top: 0 !important;\n "]);return g=function(){return e},e}function E(){var e=w(["\n margin-bottom: 1em;\n "]);return E=function(){return e},e}function k(){var e=w(["\n margin-top: 0 !important;\n "]);return k=function(){return e},e}function x(e){var t,r,o=e.entry,a=(0,v.Z)().styles,i=(0,b.RY)(),w=(0,p.H)(),x=(0,u.useCompile)(),C=(0,u.usePlugin)(d.default),A=(t=l().useState(100),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw n}}return l}}(t,2)||function(e,t){if(e){if("string"==typeof e)return h(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),O=A[0],S=A[1],P=null==w?void 0:w.clipboard,j=P?C.instructions.get(P.type):null,N=P?j?x(j.title):P.type:"";return l().createElement("div",{className:"workflow-canvas-wrapper"},l().createElement(c,{FallbackComponent:u.ErrorFallback,onError:console.error},l().createElement("div",{className:"workflow-canvas",style:{zoom:O/100}},l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(g()))},l().createElement("div",{className:a.branchClass},i?l().createElement(n.Alert,{type:"warning",message:(0,m.KQ)("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:(0,u.css)(E())}):null,l().createElement(y.Gk,null),l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(k()))},l().createElement(f.I0,{entry:o})),l().createElement("div",{className:a.terminalClass},(0,m.KQ)("End")))))),P?l().createElement("div",{className:a.clipboardPreviewClass},l().createElement("div",{className:"workflow-clipboard-header"},l().createElement("span",null,(0,m.KQ)("Copied node")),l().createElement(n.Button,{type:"text",size:"small",icon:l().createElement(s.CloseOutlined,null),onClick:function(){var e;return null==w||null==(e=w.clearClipboard)?void 0:e.call(w)}})),l().createElement("div",{className:"workflow-clipboard-card"},l().createElement("div",{className:"workflow-clipboard-type"},N),l().createElement("div",{className:"workflow-clipboard-title"},null!=(r=P.title)?r:P.type))):null,l().createElement("div",{className:"workflow-canvas-zoomer"},l().createElement(n.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:O,onChange:S})))}},6443:function(e,t,r){r.r(t),r.d(t,{WorkflowPage:function(){return L}});var n=r(3772),o=r(8156),l=r.n(o),a=r(6128),i=r(5329),c=r(3238),s=r(2721),u=r(482),d=r(3505),f=r(7584),p=r(144),m=r(4665),v=r(1113),y=r(8398),b=r(8551),h=r(1685),w=r(9315),g=r(8303),E=r(1600),k=r(4477),x=r(1682),C=r(7032),A=r(8562),O=r(2495),S=r(2743),P=r(1501),j=r(7058),N=r(6871);function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function K(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){T(l,n,o,a,i,"next",e)}function i(e){T(l,n,o,a,i,"throw",e)}a(void 0)})}}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function B(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function F(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),!t||l.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function V(){var e,t,r=(e=["\n margin-bottom: 1em;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return V=function(){return r},r}function z(e){var t,r=e.request,o=(e.filter,F(e,["request","filter"])),a=(0,y.G2)().workflow,i=B(I({},o),{request:B(I({},r),{params:B(I({},null==r?void 0:r.params),{filter:B(I({},null==r||null==(t=r.params)?void 0:t.filter),{key:a.key})})})});return l().createElement(n.ResourceActionProvider,i)}function G(e){var t=e.data,r=e.option,o=(0,n.useCompile)()(r.label);return l().createElement(c.Trans,{ns:b.A7,values:{statusText:o}},"Workflow executed, the result status is ",l().createElement(s.Tag,{color:r.color},"{{statusText}}"),l().createElement(a.Link,{to:(0,w.s_)(t.id)},"View the execution"))}function _(){var e=(0,y.G2)().workflow,t=(0,d.useForm)(),r=(0,n.useResourceContext)().resource,o=(0,n.useActionContext)(),a=(0,n.useNavigateNoUpdate)(),i=s.App.useApp().message,c=(0,A.RY)();return{run:function(){return K(function(){var n,s,u,d;return D(this,function(f){switch(f.label){case 0:return s=(n=t.values).autoRevision,u=F(n,["autoRevision"]),[4,t.submit()];case 1:return f.sent(),[4,r.execute(I({filterByTk:e.id,values:u},!c&&s?{autoRevision:1}:{}))];case 2:var p,m,v,y;return d=f.sent().data.data,t.reset(),o.setFormValueChanged(!1),o.setVisible(!1),null==i||i.open((m=(p=d.execution).id,v=p.status,(y=x.uy[v])?{type:"info",content:l().createElement(G,{data:{id:m},option:y})}:null)),d.newVersionId&&a((0,w.SI)(d.newVersionId)),[2]}})})()}}}function M(e){var t=e.children,r=(0,d.useField)(),n=(0,y.G2)().workflow,o=(0,k.cC)(),a=o.validate(n.config),i="";switch(!0){case!a:i=(0,b.KQ)("The trigger is not configured correctly, please check the trigger configuration.");break;case!o.triggerFieldset:i=(0,b.KQ)("This type of trigger has not been supported to be executed manually.")}return r.setPattern(i?"disabled":"editable"),i?l().createElement(s.Tooltip,{title:i},t):t}function W(){var e,t=(0,y.G2)().workflow,r=(0,A.RY)(),o=(0,k.cC)();return l().createElement(y.zQ.Provider,{value:t},l().createElement(C.XA.Provider,{value:!0},l().createElement(n.SchemaComponent,{components:I({Alert:s.Alert,Fieldset:g.p,ActionDisabledProvider:M},o.components),scope:I({useCancelAction:n.useCancelAction,useExecuteConfirmAction:_},o.scope),schema:{name:"trigger-modal-".concat(t.type,"-").concat(t.id),type:"void","x-decorator":"ActionDisabledProvider","x-component":"Action","x-component-props":{openSize:"small"},title:"{{t('Execute manually', { ns: \"".concat(b.A7,'" })}}'),properties:{drawer:{type:"void","x-decorator":"FormV2","x-component":"Action.Modal",title:"{{t('Execute manually', { ns: \"".concat(b.A7,'" })}}'),properties:B(I(B(I({},Object.keys(null!=(e=o.triggerFieldset)?e:{}).length?{alert:{type:"void","x-component":"Alert","x-component-props":{message:"{{t('Trigger variables need to be filled for executing.', { ns: \"".concat(b.A7,'" })}}'),className:(0,n.css)(V())}}}:{description:{type:"void","x-component":"p","x-content":"{{t('This will perform all the actions configured in the workflow. Are you sure you want to continue?', { ns: \"".concat(b.A7,'" })}}')}}),{fieldset:{type:"void","x-decorator":"FormItem","x-component":"Fieldset",title:"{{t('Trigger variables', { ns: \"".concat(b.A7,'" })}}'),properties:o.triggerFieldset}}),r?{}:{autoRevision:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":"{{t('Automatically create a new version after execution', { ns: \"".concat(b.A7,'" })}}'),default:!0}}),{footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:"{{t('Cancel')}}","x-component":"Action","x-component-props":{useAction:"{{useCancelAction}}"}},submit:{type:"void",title:"{{t('Confirm')}}","x-component":"Action","x-component-props":{type:"primary",useAction:"{{useExecuteConfirmAction}}"}}}}})}}}})))}function q(){var e=(0,y.G2)(),t=e.workflow,r=e.revisions,i=void 0===r?[]:r,d=Q((0,o.useState)(!1),2),f=d[0],p=d[1],g=(0,a.useNavigate)(),k=(0,c.useTranslation)().t,C=s.App.useApp().modal,O=(0,n.useApp)(),S=(0,n.useResourceContext)().resource,P=(0,n.useResourceActionContext)().refresh,j=s.App.useApp().message,R=(0,A.U3)(),T=(0,o.useCallback)(K(function(){var e;return D(this,function(r){switch(r.label){case 0:return[4,S.revision({filterByTk:t.id,filter:{key:t.key}})];case 1:return e=r.sent().data.data,j.success(k("Operation succeeded")),g((0,w.SI)(e.id)),[2]}})}),[S,t.id,t.key,j,k,g]),I=(0,o.useCallback)(K(function(){var e;return D(this,function(r){return e=t.current?(0,b.KQ)("This is a main version, delete it will cause the whole workflow to be deleted (including all other revisions)."):(0,b.KQ)("Current version will be deleted (without affecting other versions)."),C.confirm({title:k("Are you sure you want to delete it?"),content:e,onOk:function(){return K(function(){var e,r,n,o;return D(this,function(l){switch(l.label){case 0:return[4,S.destroy({filterByTk:t.id})];case 1:if(l.sent(),j.success(k("Operation succeeded")),e=O.pluginSettingsManager.getRoutePath("workflow"),t.current)return[2,g(e)];return i.length&&g((0,w.SI)(null==(r=i.find(function(e){return e.current}))?void 0:r.id)),[4,S.list({filter:{key:t.key,current:!0},fields:["id"],pageSize:1})];case 2:if(200!==(n=l.sent()).status)return[2];if(!(o=Q(n.data.data,1)[0]))return[2,g(e)];return[2,g((0,w.SI)(o.id))]}})})()}}),[2]})}),[t,C,k,S,j,g,O.pluginSettingsManager,i]),B=(0,o.useCallback)(function(e){switch(e.key){case"refresh":P();return;case"history":p(!0);return;case"revision":return T();case"delete":return I()}},[I,T,P]);return l().createElement(l().Fragment,null,l().createElement(s.Dropdown,{menu:{items:[{key:"key",label:"Key: ".concat(t.key),disabled:!0},{type:"divider"},{role:"button","aria-label":"refresh",key:"refresh",label:k("Refresh")},{role:"button","aria-label":"history",key:"history",label:(0,b.KQ)("Execution history"),disabled:!R},{role:"button","aria-label":"revision",key:"revision",label:(0,b.KQ)("Copy to new version")},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:k("Delete")}],onClick:B}},l().createElement(s.Button,{"aria-label":"more",type:"text",icon:l().createElement(u.EllipsisOutlined,null)})),l().createElement(n.ActionContextProvider,{value:{visible:f,setVisible:p}},l().createElement(n.SchemaComponent,{schema:h.V,components:{ExecutionResourceProvider:z,ExecutionLink:v.a,ExecutionStatusColumn:m.rV},scope:{useRefreshActionProps:E.X,useResourceFilterActionProps:N.K,ExecutionStatusOptions:x.C6}})))}function U(){var e,t=(0,i.Z)().styles,r=(0,a.useNavigate)(),c=(0,y.G2)().workflow,d=(0,o.useCallback)(function(e){var t=e.key;t!=c.id&&r((0,w.SI)(t))},[c.id,r]),p=(0,n.useRequest)({resource:"workflows",action:"list",params:{filter:{key:c.key},fields:["id","createdAt","current","enabled","versionStats.executed"],sort:"-id"}},{refreshDeps:[c.id],manual:!0}),m=p.data,v=p.run,h=(0,o.useCallback)(function(e){e&&v()},[v]),g=null!=(e=null==m?void 0:m.data)?e:[];return l().createElement(s.Dropdown,{className:"workflow-versions",trigger:["click"],onOpenChange:h,menu:{onClick:d,defaultSelectedKeys:["".concat(c.id)],className:(0,n.cx)(t.dropdownClass,t.workflowVersionDropdownClass),items:g.sort(function(e,t){return t.id-e.id}).map(function(e,t){return{role:"button","aria-label":"version-".concat(t),key:"".concat(e.id),icon:e.current?l().createElement(u.RightOutlined,null):null,className:(0,n.cx)({executed:e.versionStats.executed>0,unexecuted:0==e.versionStats.executed,enabled:e.enabled}),label:l().createElement(l().Fragment,null,l().createElement("strong",null,"#".concat(e.id)),l().createElement("time",null,(0,f.dayjs)(e.createdAt).fromNow()))}})}},l().createElement(s.Button,{type:"text","aria-label":"version"},l().createElement("label",null,(0,b.KQ)("Version")),l().createElement("span",null,(null==c?void 0:c.id)?"#".concat(c.id):null),l().createElement(u.DownOutlined,null)))}function Y(){var e,t,r,i,c=(0,a.useNavigate)(),u=(0,n.useApp)(),d=(0,n.useResourceActionContext)(),f=d.data,m=d.refresh,v=d.loading,h=(0,n.useResourceContext)().resource,g=(0,n.useDocumentTitle)().setTitle,E=Q((0,o.useState)(null!=(r=null==f||null==(t=f.data)?void 0:t.enabled)&&r),2),k=E[0],x=E[1],C=Q((0,o.useState)(!1),2),A=C[0],N=C[1],R=null!=(i=null==f?void 0:f.data)?i:{},T=R.nodes,I=void 0===T?[]:T,B=F(R,["nodes"]);(0,w.Yc)(I),(0,o.useEffect)(function(){var e,t=null!=(e=null==f?void 0:f.data)?e:{},r=t.title,n=t.enabled;null==g||g("".concat((0,b.KQ)("Workflow")).concat(r?": ".concat(r):"")),x(n)},[null==f?void 0:f.data,g]);var V=(0,o.useCallback)((e=K(function(e){return D(this,function(t){switch(t.label){case 0:return N(!0),[4,h.update({filterByTk:B.id,values:{enabled:e}})];case 1:return t.sent(),N(!1),x(e),[2]}})}),function(t){return e.apply(this,arguments)}),[h,B.id]);if(!(null==f?void 0:f.data))return v?l().createElement(s.Spin,null):l().createElement(s.Result,{status:"404",title:"Not found",extra:l().createElement(s.Button,{onClick:function(){return c(-1)}},(0,b.KQ)("Go back"))});var z=I.find(function(e){return!e.upstream});return l().createElement(y.iT.Provider,{value:{workflow:B,nodes:I,refresh:m}},l().createElement("div",{className:"workflow-toolbar"},l().createElement("header",null,l().createElement(s.Breadcrumb,{items:[{title:l().createElement(a.Link,{to:u.pluginSettingsManager.getRoutePath("workflow")},(0,b.KQ)("Workflow"))},{title:l().createElement(s.Tooltip,{title:"Key: ".concat(B.key)},l().createElement("strong",null,B.title))}]}),B.sync?l().createElement(s.Tag,{color:"orange"},(0,b.KQ)("Synchronously")):l().createElement(s.Tag,{color:"cyan"},(0,b.KQ)("Asynchronously"))),l().createElement("aside",null,l().createElement(W,null),l().createElement(U,null),l().createElement(s.Switch,{checked:k,onChange:V,checkedChildren:(0,b.KQ)("On"),unCheckedChildren:(0,b.KQ)("Off"),loading:A}),l().createElement(q,null))),l().createElement(O.E1,null,l().createElement(S.I,null,l().createElement(P.V,null,l().createElement(j.n,null,l().createElement(p.g,{entry:z}))))))}var L=function(){var e,t,r,o=(0,a.useParams)(),c=(0,i.Z)().styles;return l().createElement("div",{className:(0,n.cx)(c.workflowPageClass)},l().createElement(n.SchemaComponent,{schema:{type:"void",properties:(e={},t="provider_".concat(o.id),r={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:o.id},appends:["nodes","stats.executed","versionStats.executed"]}}},"x-component":"WorkflowCanvas"},t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e)},components:{WorkflowCanvas:Y}}))}}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).push([["771"],{144:function(e,t,n){n.d(t,{g:function(){return x}});var r=n(2721),o=n(8156),l=n.n(o);let a=(0,o.createContext)(null),i={didCatch:!1,error:null};class c extends o.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=i}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,o=Array(r),l=0;l<r;l++)o[l]=arguments[l];null==(t=(n=this.props).onReset)||t.call(n,{args:o,reason:"imperative-api"}),this.setState(i)}}componentDidCatch(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)){var o,l;null==(o=(l=this.props).onReset)||o.call(l,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(i)}}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:l,error:i}=this.state,c=e;if(l){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if((0,o.isValidElement)(r))c=r;else if("function"==typeof t)c=t(e);else if(n)c=(0,o.createElement)(n,e);else throw i}return(0,o.createElement)(a.Provider,{value:{didCatch:l,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}var s=n(482),u=n(3772),d=n(8218),m=n(2415),f=n(7058),p=n(8551),y=n(5329),v=n(4477),b=n(8562);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function w(){var e=h(["\n margin-top: 0 !important;\n "]);return w=function(){return e},e}function g(){var e=h(["\n margin-bottom: 1em;\n "]);return g=function(){return e},e}function k(){var e=h(["\n margin-top: 0 !important;\n "]);return k=function(){return e},e}function x(e){var t,n,o=e.entry,a=(0,y.Z)().styles,i=(0,b.RY)(),h=(0,f.H)(),x=(0,u.useCompile)(),C=(0,u.usePlugin)(d.default),O=(t=l().useState(100),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),l.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return l}}(t,2)||function(e,t){if(e){if("string"==typeof e)return E(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),S=O[0],j=O[1],A=null==h?void 0:h.clipboard,P=A?C.instructions.get(A.type):null,N=A?P?x(P.title):A.type:"";return l().createElement("div",{className:"workflow-canvas-wrapper"},l().createElement(c,{FallbackComponent:u.ErrorFallback,onError:console.error},l().createElement("div",{className:"workflow-canvas",style:{zoom:S/100}},l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(w()))},l().createElement("div",{className:a.branchClass},i?l().createElement(r.Alert,{type:"warning",message:(0,p.KQ)("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:(0,u.css)(g())}):null,l().createElement(v.Gk,null),l().createElement("div",{className:(0,u.cx)(a.branchBlockClass,(0,u.css)(k()))},l().createElement(m.I0,{entry:o})),l().createElement("div",{className:a.terminalClass},(0,p.KQ)("End")))))),A?l().createElement("div",{className:a.clipboardPreviewClass},l().createElement("div",{className:"workflow-clipboard-header"},l().createElement("span",null,(0,p.KQ)("Copied node")),l().createElement(r.Button,{type:"text",size:"small",icon:l().createElement(s.CloseOutlined,null),onClick:function(){var e;return null==h||null==(e=h.clearClipboard)?void 0:e.call(h)}})),l().createElement("div",{className:"workflow-clipboard-card"},l().createElement("div",{className:"workflow-clipboard-type"},N),l().createElement("div",{className:"workflow-clipboard-title"},null!=(n=A.title)?n:A.type))):null,l().createElement("div",{className:"workflow-canvas-zoomer"},l().createElement(r.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:S,onChange:j})))}},2378:function(e,t,n){n.r(t),n.d(t,{ExecutionPage:function(){return P}});var r=n(3772),o=n(8156),l=n.n(o),a=n(6128),i=n(2721),c=n(7584),s=n(482),u=n(3238),d=n(8218),m=n(144),f=n(118),p=n(1682),y=n(8398),v=n(8551),b=n(5329),E=n(9315),h=n(467);function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return l}}(e,t)||C(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(e,t)}}function O(e){var t,n,o=(0,y.G2)().viewJob,a=(0,r.useRequest)({resource:"jobs",action:"get",params:{filterByTk:o.id}}),c=a.data;if(a.loading)return l().createElement(i.Spin,null);var s=(0,h.get)(c,"data.result");return l().createElement(r.Input.JSON,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){g(e,t,n[t])})}return e}({},e),n=n={value:s,disabled:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function S(){var e=(0,r.usePlugin)(d.default).instructions,t=(0,r.useCompile)(),n=(0,y.G2)(),o=n.viewJob,a=n.setViewJob,c=(0,b.Z)().styles,s=(null!=o?o:{}).node,u=void 0===s?{}:s,m=e.get(u.type);return l().createElement(r.ActionContextProvider,{value:{visible:!!o,setVisible:a}},l().createElement(r.SchemaComponent,{components:{JobResult:O},schema:{type:"void",properties:g({},"".concat(null==o?void 0:o.id,"-").concat(null==o?void 0:o.updatedAt,"-modal"),{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:l().createElement("div",{className:c.nodeTitleClass},l().createElement(i.Tag,null,t(null==m?void 0:m.title)),l().createElement("strong",null,u.title),l().createElement("span",{className:"workflow-node-id"},"#",u.id)),properties:{status:{type:"number",title:'{{t("Status", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Select",enum:p.Vh,"x-read-pretty":!0},updatedAt:{type:"string",title:'{{t("Executed at", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:'{{t("Node result", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"JobResult","x-component-props":{className:c.nodeJobResultClass,autoSize:{minRows:4,maxRows:32}}}}})}}))}function j(e){var t=(0,y.G2)().execution,n=(0,r.useAPIClient)(),u=(0,a.useNavigate)(),d=(0,b.Z)().styles,m=(0,r.useResourceActionContext)().refresh,v=k((0,o.useState)([]),2),h=v[0],w=v[1],g=k((0,o.useState)([]),2),C=g[0],O=g[1],S=k((0,o.useState)(null),2),j=S[0],A=S[1],P=k((0,o.useState)(null),2),N=P[0],I=P[1],D=k((0,o.useState)(null),2),R=D[0],B=D[1],T=(0,o.useCallback)(function(e){t&&e&&(j!==t.id&&n.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-id",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){var n=e.data;A(t.id),w(n.data)}).catch(function(){}),(N!==t.id||R&&Date.now()-Number(R)>6e4&&C.length<10)&&n.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"id",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){var n=e.data;I(t.id),B(Date.now()),O(n.data.reverse())}).catch(function(){}))},[t,j,N,R,C.length,n]),K=(0,o.useCallback)(function(e){var n=e.key;n!=t.id&&u((0,E.s_)(n))},[t.id,u]);return t?l().createElement(i.Space,null,l().createElement(i.Dropdown,{onOpenChange:T,menu:{onClick:K,defaultSelectedKeys:["".concat(t.id)],className:(0,r.cx)(d.dropdownClass,d.executionsDropdownRowClass),items:x(C).concat([t],x(h)).map(function(e){return{key:e.id,label:l().createElement(l().Fragment,null,l().createElement("span",{className:"id"},"#".concat(e.id)),l().createElement("time",null,(0,c.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss"))),icon:l().createElement("span",null,l().createElement(f.Y,{statusMap:p.uy,status:e.status}))}})}},l().createElement(i.Space,null,l().createElement("strong",null,"#".concat(t.id)),l().createElement(s.DownOutlined,null))),l().createElement(i.Button,{type:"link",size:"small",icon:l().createElement(s.ReloadOutlined,null),onClick:m})):null}function A(){var e,t=(0,u.useTranslation)().t,n=(0,r.useCompile)(),d=(0,r.useResourceActionContext)(),f=d.data,b=d.loading,h=d.refresh,w=(0,r.useDocumentTitle)().setTitle,g=k((0,o.useState)(null),2),x=g[0],C=g[1],O=(0,r.useApp)(),A=(0,r.useAPIClient)();(0,o.useEffect)(function(){var e,t=(null!=(e=null==f?void 0:f.data)?e:{}).workflow;null==w||w("".concat((null==t?void 0:t.title)?"".concat(t.title," - "):"").concat((0,v.KQ)("Execution history")))},[null==f?void 0:f.data,w]);var P=(0,o.useCallback)(function(){i.Modal.confirm({title:(0,v.KQ)("Cancel the execution"),icon:l().createElement(s.ExclamationCircleFilled,null),content:(0,v.KQ)("Are you sure you want to cancel the execution?"),onOk:function(){A.resource("executions").cancel({filterByTk:null==f?void 0:f.data.id}).then(function(){i.message.success(t("Operation succeeded")),h()}).catch(function(e){console.error(e.data.error)})}})},[null==f?void 0:f.data]),N=(0,o.useCallback)(function(){history.back()},[]);if(!(null==f?void 0:f.data))return b?l().createElement(i.Spin,null):l().createElement(i.Result,{status:"404",title:"Not found"});var I=null!=(e=null==f?void 0:f.data)?e:{},D=I.jobs,R=I.workflow,B=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(I,["jobs","workflow"]),T=(R||{}).nodes,K=void 0===T?[]:T;(0,E.Yc)(K),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map;e.forEach(function(e){e.jobs=[],n.set(e.id,e)}),t.forEach(function(e){var t=n.get(e.nodeId);t&&(t.jobs.push(e),e.node={id:t.id,key:t.key,title:t.title,type:t.type})}),e.forEach(function(e){e.jobs=e.jobs.sort(function(e,t){return e.id-t.id})})}(K,void 0===D?[]:D);var M=K.find(function(e){return!e.upstream}),Q=p.uy[B.status];return R?l().createElement(y.iT.Provider,{value:{workflow:R.type?R:null,nodes:K,execution:B,viewJob:x,setViewJob:C}},l().createElement("div",{className:"workflow-toolbar"},l().createElement("header",null,l().createElement(i.Breadcrumb,{items:[{title:l().createElement(a.Link,{to:O.pluginSettingsManager.getRoutePath("workflow")},(0,v.KQ)("Workflow"))},{title:l().createElement(i.Tooltip,{title:"Key: ".concat(R.key)},l().createElement(a.Link,{to:(0,E.SI)(R.id)},R.title))},{title:l().createElement(j,null)}]})),l().createElement("aside",null,l().createElement(i.Tag,{color:Q.color},n(Q.label)),B.status?null:l().createElement(i.Tooltip,{title:(0,v.KQ)("Cancel the execution")},l().createElement(i.Button,{type:"link",danger:!0,onClick:P,shape:"circle",size:"small",icon:l().createElement(s.StopOutlined,null)})),l().createElement("time",null,(0,c.str2moment)(B.updatedAt).format("YYYY-MM-DD HH:mm:ss")))),l().createElement(m.g,{entry:M}),l().createElement(S,null)):l().createElement(i.Result,{status:"404",title:(0,v.KQ)("Not found"),subTitle:(0,v.KQ)("Workflow of execution is not existed"),extra:l().createElement(i.Button,{onClick:N},(0,v.KQ)("Go back"))})}var P=function(){var e,t,n,o=(0,a.useParams)(),i=(0,b.Z)().styles;return l().createElement("div",{className:(0,r.cx)(i.workflowPageClass)},l().createElement(r.SchemaComponent,{schema:{type:"void",properties:(e={},t="execution_".concat(o.id),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:o,appends:["jobs","workflow","workflow.nodes","workflow.versionStats","workflow.stats"],except:["jobs.result","workflow.options"]}}},"x-component":"ExecutionCanvas"},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},components:{ExecutionCanvas:A}}))}}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).push([["781"],{1113:function(e,t,n){n.d(t,{a:function(){return a}});var o=n(8156),r=n.n(o),c=n(3238),i=n(6128),l=n(3772),u=n(9315),a=function(){var e=(0,c.useTranslation)().t,t=(0,l.useRecord)().id,n=(0,l.useActionContext)().setVisible;return r().createElement(i.Link,{to:(0,u.s_)(t),onClick:function(){return n(!1)}},e("View"))}},4665:function(e,t,n){n.d(t,{qo:function(){return f},rV:function(){return m},uL:function(){return d}});var o=n(8156),r=n.n(o),c=n(2721),i=n(482),l=n(3238),u=n(3772),a=n(1682),s=n(8551);function p(){var e,t,n=(e=["\n display: flex;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return p=function(){return n},n}function f(e){var t,n=(0,u.useCompile)()(e.label),o=(null!=(t=a.uy[e.value])?t:{}).color;return r().createElement(c.Tag,{color:o,closable:e.closable,onClose:e.onClose},n)}function d(e){var t=(0,u.useCompile)();return r().createElement(r().Fragment,null,r().createElement(f,e.data),e.data.description?r().createElement("span",null,t(e.data.description)):null)}function m(e){var t=(0,l.useTranslation)().t,n=(0,u.useResourceActionContext)().refresh,a=(0,u.useResourceContext)().resource,f=(0,u.useRecord)(),d=(0,o.useCallback)(function(){c.Modal.confirm({title:(0,s.KQ)("Cancel the execution"),icon:r().createElement(i.ExclamationCircleFilled,null),content:(0,s.KQ)("Are you sure you want to cancel the execution?"),onOk:function(){a.cancel({filterByTk:f.id}).then(function(){c.message.success(t("Operation succeeded")),n()}).catch(function(e){console.error(e.data.error)})}})},[f]);return r().createElement("div",{className:(0,u.css)(p())},e.children,f.status?null:r().createElement(c.Tooltip,{title:(0,s.KQ)("Cancel the execution")},r().createElement(c.Button,{type:"link",danger:!0,onClick:d,shape:"circle",size:"small",icon:r().createElement(i.StopOutlined,null)})))}},1685:function(e,t,n){n.d(t,{V:function(){return y}});var o,r=n(8156),c=n.n(r),i=n(6128),l=n(3238),u=n(2721),a=n(3772),s=n(9601),p=n(1682),f=n(8551),d=n(9315);function m(e,t,n,o,r,c,i){try{var l=e[c](i),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(o,r)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y={type:"void",name:"executionHistoryDrawer",title:'{{t("Execution history", { ns: "'.concat(f.A7,'" })}}'),"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:s.Z,resourceName:"executions",request:{resource:"executions",action:"list",params:{pageSize:20,sort:["-id"],except:["context","output","stack"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useResourceFilterActionProps","x-component-props":{icon:"FilterOutlined",nonfilterable:["workflow"]},"x-align":"left",default:{$and:[{status:{$eq:void 0}}]}},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},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?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction:function(){var e=(0,l.useTranslation)().t,t=(0,a.useResourceActionContext)(),n=t.refresh,o=t.defaultRequest,r=(0,a.useResourceContext)().resource,c=(0,a.useActionContext)().setVisible;return{run:function(){var t;return(t=function(){var t;return function(e,t){var n,o,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,r.destroy({filter:null==(t=o.params)?void 0:t.filter})];case 1:return i.sent(),u.message.success(e("Operation succeeded")),n(),c(!1),[2]}})},function(){var e=this,n=arguments;return new Promise(function(o,r){var c=t.apply(e,n);function i(e){m(c,o,r,i,l,"next",e)}function l(e){m(c,o,r,i,l,"throw",e)}i(void 0)})})()}}},confirm:{title:'{{t("Clear all executions", { ns: "'.concat(f.A7,'" })}}'),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: "'.concat(f.A7,'" })}}')}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},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:"string","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Version", { ns: "'.concat(f.A7,'" })}}'),properties:{workflowId:(x(o={type:"number"},"x-component",function(e){var t=e.value,n=(0,a.useActionContext)().setVisible;return c().createElement(i.Link,{to:(0,d.SI)(t),onClick:function(){return n(!1)}},"#".concat(t))}),x(o,"x-read-pretty",!0),o)}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Status", { ns: "'.concat(f.A7,'" })}}'),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"},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 }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:"{{ $deps[0] !== ".concat(p.r9.STARTED," }}")}}}]}}}}}}}}}}}},1600:function(e,t,n){n.d(t,{X:function(){return c}});var o=n(3772);function r(e,t,n,o,r,c,i){try{var l=e[c](i),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(o,r)}function c(){var e=(0,o.useResourceActionContext)();return{onClick:function(){var t;return(t=function(){var t;return function(e,t){var n,o,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){return null==e||null==(t=e.refresh)||t.call(e),[2]})},function(){var e=this,n=arguments;return new Promise(function(o,c){var i=t.apply(e,n);function l(e){r(i,o,c,l,u,"next",e)}function u(e){r(i,o,c,l,u,"throw",e)}l(void 0)})})()}}}},6871:function(e,t,n){n.d(t,{K:function(){return r}});var o=n(3772),r=function(){var e,t,n=(0,o.useResourceContext)().collection,r=(0,o.useFilterFieldOptions)(n.fields),c=(0,o.useResourceActionContext)();return(0,o.useFilterFieldProps)({options:r,params:(null==(t=c.state)||null==(e=t.params)?void 0:e[0])||c.params,service:c})}}}]);
@@ -1,15 +0,0 @@
1
- The ISC License
2
-
3
- Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -1,7 +0,0 @@
1
- import LRUCache from './index.js';
2
- declare const _default: typeof LRUCache & {
3
- default: typeof LRUCache;
4
- LRUCache: typeof LRUCache;
5
- };
6
- export = _default;
7
- //# sourceMappingURL=index-cjs.d.ts.map
@@ -1 +0,0 @@
1
- (function(){"use strict";var t={914:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const n=s(i(947));t.exports=Object.assign(n.default,{default:n.default,LRUCache:n.default})},947:function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.LRUCache=void 0;const i=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const s=new Set;const emitWarning=(t,e,i,s)=>{typeof process==="object"&&process&&typeof process.emitWarning==="function"?process.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)};const shouldWarn=t=>!s.has(t);const n=Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{heap;length;static#t=false;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#t=true;const i=new Stack(t,e);Stack.#t=false;return i}constructor(t,e){if(!Stack.#t){throw new TypeError("instantiate Stack using Stack.create(n)")}this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#e;#i;#s;#n;#h;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#o;#r;#l;#c;#f;#d;#u;#p;#g;#S;#y;#m;#z;#w;#_;#L;static unsafeExposeInternals(t){return{starts:t.#m,ttls:t.#z,sizes:t.#y,keyMap:t.#r,keyList:t.#l,valList:t.#c,next:t.#f,prev:t.#d,get head(){return t.#u},get tail(){return t.#p},free:t.#g,isBackgroundFetch:e=>t.#v(e),backgroundFetch:(e,i,s,n)=>t.#k(e,i,s,n),moveToTail:e=>t.#x(e),indexes:e=>t.#F(e),rindexes:e=>t.#A(e),isStale:e=>t.#T(e)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#o}get size(){return this.#a}get fetchMethod(){return this.#h}get dispose(){return this.#s}get disposeAfter(){return this.#n}constructor(t){const{max:e=0,ttl:i,ttlResolution:n=1,ttlAutopurge:h,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:r,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:u=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:S,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:w,ignoreFetchAbort:_}=t;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const L=e?getUintArray(e):Array;if(!L){throw new Error("invalid max value: "+e)}this.#e=e;this.#i=u;this.maxEntrySize=p||this.#i;this.sizeCalculation=g;if(this.sizeCalculation){if(!this.#i&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}if(S!==undefined&&typeof S!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.#h=S;this.#_=!!S;this.#r=new Map;this.#l=new Array(e).fill(undefined);this.#c=new Array(e).fill(undefined);this.#f=new L(e);this.#d=new L(e);this.#u=0;this.#p=0;this.#g=Stack.create(e);this.#a=0;this.#o=0;if(typeof l==="function"){this.#s=l}if(typeof c==="function"){this.#n=c;this.#S=[]}else{this.#n=undefined;this.#S=undefined}this.#w=!!this.#s;this.#L=!!this.#n;this.noDisposeOnSet=!!f;this.noUpdateTTL=!!d;this.noDeleteOnFetchRejection=!!y;this.allowStaleOnFetchRejection=!!z;this.allowStaleOnFetchAbort=!!w;this.ignoreFetchAbort=!!_;if(this.maxEntrySize!==0){if(this.#i!==0){if(!isPosInt(this.#i)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.#b()}this.allowStale=!!r;this.noDeleteOnStaleGet=!!m;this.updateAgeOnGet=!!a;this.updateAgeOnHas=!!o;this.ttlResolution=isPosInt(n)||n===0?n:1;this.ttlAutopurge=!!h;this.ttl=i||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.#O()}if(this.#e===0&&this.ttl===0&&this.#i===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.#e&&!this.#i){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){s.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#r.has(t)?Infinity:0}#O(){const t=new ZeroArray(this.#e);const e=new ZeroArray(this.#e);this.#z=t;this.#m=e;this.#D=(s,n,h=i.now())=>{e[s]=n!==0?h:0;t[s]=n;if(n!==0&&this.ttlAutopurge){const t=setTimeout((()=>{if(this.#T(s)){this.delete(this.#l[s])}}),n+1);if(t.unref){t.unref()}}};this.#E=s=>{e[s]=t[s]!==0?i.now():0};this.#M=(i,n)=>{if(t[n]){const h=t[n];const a=e[n];i.ttl=h;i.start=a;i.now=s||getNow();i.remainingTTL=i.now+h-a}};let s=0;const getNow=()=>{const t=i.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);if(e.unref){e.unref()}}return t};this.getRemainingTTL=i=>{const n=this.#r.get(i);if(n===undefined){return 0}return t[n]===0||e[n]===0?Infinity:e[n]+t[n]-(s||getNow())};this.#T=i=>t[i]!==0&&e[i]!==0&&(s||getNow())-e[i]>t[i]}#E=()=>{};#M=()=>{};#D=()=>{};#T=()=>false;#b(){const t=new ZeroArray(this.#e);this.#o=0;this.#y=t;this.#C=e=>{this.#o-=t[e];t[e]=0};this.#R=(t,e,i,s)=>{if(this.#v(e)){return 0}if(!isPosInt(i)){if(s){if(typeof s!=="function"){throw new TypeError("sizeCalculation must be a function")}i=s(e,t);if(!isPosInt(i)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation "+"or size must be set.")}}return i};this.#W=(e,i,s)=>{t[e]=i;if(this.#i){const i=this.#i-t[e];while(this.#o>i){this.#B(true)}}this.#o+=t[e];if(s){s.entrySize=i;s.totalCalculatedSize=this.#o}}}#C=t=>{};#W=(t,e,i)=>{};#R=(t,e,i,s)=>{if(i||s){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}return 0};*#F({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#p;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#u){break}else{e=this.#d[e]}}}}*#A({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#u;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#p){break}else{e=this.#f[e]}}}}#I(t){return t!==undefined&&this.#r.get(this.#l[t])===t}*entries(){for(const t of this.#F()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*rentries(){for(const t of this.#A()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*keys(){for(const t of this.#F()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*rkeys(){for(const t of this.#A()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*values(){for(const t of this.#F()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}*rvalues(){for(const t of this.#A()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;if(t(n,this.#l[i],this)){return this.get(this.#l[i],e)}}}forEach(t,e=this){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}rforEach(t,e=this){for(const i of this.#A()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}purgeStale(){let t=false;for(const e of this.#A({allowStale:true})){if(this.#T(e)){this.delete(this.#l[e]);t=true}}return t}dump(){const t=[];for(const e of this.#F({allowStale:true})){const s=this.#l[e];const n=this.#c[e];const h=this.#v(n)?n.__staleWhileFetching:n;if(h===undefined||s===undefined)continue;const a={value:h};if(this.#z&&this.#m){a.ttl=this.#z[e];const t=i.now()-this.#m[e];a.start=Math.floor(Date.now()-t)}if(this.#y){a.size=this.#y[e]}t.unshift([s,a])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=i.now()-t}this.set(e,s.value,s)}}set(t,e,i={}){const{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i;let{noUpdateTTL:r=this.noUpdateTTL}=i;const l=this.#R(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize){if(o){o.set="miss";o.maxEntrySizeExceeded=true}this.delete(t);return this}let c=this.#a===0?undefined:this.#r.get(t);if(c===undefined){c=this.#a===0?this.#p:this.#g.length!==0?this.#g.pop():this.#a===this.#e?this.#B(false):this.#a;this.#l[c]=t;this.#c[c]=e;this.#r.set(t,c);this.#f[this.#p]=c;this.#d[c]=this.#p;this.#p=c;this.#a++;this.#W(c,l,o);if(o)o.set="add";r=false}else{this.#x(c);const i=this.#c[c];if(e!==i){if(this.#_&&this.#v(i)){i.__abortController.abort(new Error("replaced"))}else if(!h){if(this.#w){this.#s?.(i,t,"set")}if(this.#L){this.#S?.push([i,t,"set"])}}this.#C(c);this.#W(c,l,o);this.#c[c]=e;if(o){o.set="replace";const t=i&&this.#v(i)?i.__staleWhileFetching:i;if(t!==undefined)o.oldValue=t}}else if(o){o.set="update"}}if(s!==0&&!this.#z){this.#O()}if(this.#z){if(!r){this.#D(c,s,n)}if(o)this.#M(o,c)}if(!h&&this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return this}pop(){try{while(this.#a){const t=this.#c[this.#u];this.#B(true);if(this.#v(t)){if(t.__staleWhileFetching){return t.__staleWhileFetching}}else if(t!==undefined){return t}}}finally{if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}#B(t){const e=this.#u;const i=this.#l[e];const s=this.#c[e];if(this.#_&&this.#v(s)){s.__abortController.abort(new Error("evicted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(s,i,"evict")}if(this.#L){this.#S?.push([s,i,"evict"])}}this.#C(e);if(t){this.#l[e]=undefined;this.#c[e]=undefined;this.#g.push(e)}if(this.#a===1){this.#u=this.#p=0;this.#g.length=0}else{this.#u=this.#f[e]}this.#r.delete(i);this.#a--;return e}has(t,e={}){const{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e;const n=this.#r.get(t);if(n!==undefined){const t=this.#c[n];if(this.#v(t)&&t.__staleWhileFetching===undefined){return false}if(!this.#T(n)){if(i){this.#E(n)}if(s){s.has="hit";this.#M(s,n)}return true}else if(s){s.has="stale";this.#M(s,n)}}else if(s){s.has="miss"}return false}peek(t,e={}){const{allowStale:i=this.allowStale}=e;const s=this.#r.get(t);if(s!==undefined&&(i||!this.#T(s))){const t=this.#c[s];return this.#v(t)?t.__staleWhileFetching:t}}#k(t,e,i,s){const n=e===undefined?undefined:this.#c[e];if(this.#v(n)){return n}const h=new AbortController;const{signal:a}=i;a?.addEventListener("abort",(()=>h.abort(a.reason)),{signal:h.signal});const o={signal:h.signal,options:i,context:s};const cb=(s,n=false)=>{const{aborted:a}=h.signal;const l=i.ignoreFetchAbort&&s!==undefined;if(i.status){if(a&&!n){i.status.fetchAborted=true;i.status.fetchError=h.signal.reason;if(l)i.status.fetchAbortIgnored=true}else{i.status.fetchResolved=true}}if(a&&!l&&!n){return fetchFail(h.signal.reason)}const c=r;if(this.#c[e]===r){if(s===undefined){if(c.__staleWhileFetching){this.#c[e]=c.__staleWhileFetching}else{this.delete(t)}}else{if(i.status)i.status.fetchUpdated=true;this.set(t,s,o.options)}}return s};const eb=t=>{if(i.status){i.status.fetchRejected=true;i.status.fetchError=t}return fetchFail(t)};const fetchFail=s=>{const{aborted:n}=h.signal;const a=n&&i.allowStaleOnFetchAbort;const o=a||i.allowStaleOnFetchRejection;const l=o||i.noDeleteOnFetchRejection;const c=r;if(this.#c[e]===r){const i=!l||c.__staleWhileFetching===undefined;if(i){this.delete(t)}else if(!a){this.#c[e]=c.__staleWhileFetching}}if(o){if(i.status&&c.__staleWhileFetching!==undefined){i.status.returnedStale=true}return c.__staleWhileFetching}else if(c.__returned===c){throw s}};const pcall=(e,s)=>{const a=this.#h?.(t,n,o);if(a&&a instanceof Promise){a.then((t=>e(t)),s)}h.signal.addEventListener("abort",(()=>{if(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort){e();if(i.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(i.status)i.status.fetchDispatched=true;const r=new Promise(pcall).then(cb,eb);const l=Object.assign(r,{__abortController:h,__staleWhileFetching:n,__returned:undefined});if(e===undefined){this.set(t,l,{...o.options,status:undefined});e=this.#r.get(t)}else{this.#c[e]=l}return l}#v(t){if(!this.#_)return false;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}async fetch(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=false,status:S,signal:y}=e;if(!this.#_){if(S)S.fetch="get";return this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:S})}const m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:a,size:o,sizeCalculation:r,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,status:S,signal:y};let z=this.#r.get(t);if(z===undefined){if(S)S.fetch="miss";const e=this.#k(t,z,m,p);return e.__returned=e}else{const e=this.#c[z];if(this.#v(e)){const t=i&&e.__staleWhileFetching!==undefined;if(S){S.fetch="inflight";if(t)S.returnedStale=true}return t?e.__staleWhileFetching:e.__returned=e}const n=this.#T(z);if(!g&&!n){if(S)S.fetch="hit";this.#x(z);if(s){this.#E(z)}if(S)this.#M(S,z);return e}const h=this.#k(t,z,m,p);const a=h.__staleWhileFetching!==undefined;const o=a&&i;if(S){S.fetch=n?"stale":"refresh";if(o&&n)S.returnedStale=true}return o?h.__staleWhileFetching:h.__returned=h}}get(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e;const a=this.#r.get(t);if(a!==undefined){const e=this.#c[a];const o=this.#v(e);if(h)this.#M(h,a);if(this.#T(a)){if(h)h.get="stale";if(!o){if(!n){this.delete(t)}if(h&&i)h.returnedStale=true;return i?e:undefined}else{if(h&&i&&e.__staleWhileFetching!==undefined){h.returnedStale=true}return i?e.__staleWhileFetching:undefined}}else{if(h)h.get="hit";if(o){return e.__staleWhileFetching}this.#x(a);if(s){this.#E(a)}return e}}else if(h){h.get="miss"}}#U(t,e){this.#d[e]=t;this.#f[t]=e}#x(t){if(t!==this.#p){if(t===this.#u){this.#u=this.#f[t]}else{this.#U(this.#d[t],this.#f[t])}this.#U(this.#p,t);this.#p=t}}delete(t){let e=false;if(this.#a!==0){const i=this.#r.get(t);if(i!==undefined){e=true;if(this.#a===1){this.clear()}else{this.#C(i);const e=this.#c[i];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(e,t,"delete")}if(this.#L){this.#S?.push([e,t,"delete"])}}this.#r.delete(t);this.#l[i]=undefined;this.#c[i]=undefined;if(i===this.#p){this.#p=this.#d[i]}else if(i===this.#u){this.#u=this.#f[i]}else{this.#f[this.#d[i]]=this.#f[i];this.#d[this.#f[i]]=this.#d[i]}this.#a--;this.#g.push(i)}}}if(this.#L&&this.#S?.length){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return e}clear(){for(const t of this.#A({allowStale:true})){const e=this.#c[t];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else{const i=this.#l[t];if(this.#w){this.#s?.(e,i,"delete")}if(this.#L){this.#S?.push([e,i,"delete"])}}}this.#r.clear();this.#c.fill(undefined);this.#l.fill(undefined);if(this.#z&&this.#m){this.#z.fill(0);this.#m.fill(0)}if(this.#y){this.#y.fill(0)}this.#u=0;this.#p=0;this.#g.length=0;this.#o=0;this.#a=0;if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}e.LRUCache=LRUCache;e["default"]=LRUCache}};var e={};function __nccwpck_require__(i){var s=e[i];if(s!==undefined){return s.exports}var n=e[i]={exports:{}};var h=true;try{t[i].call(n.exports,n,n.exports,__nccwpck_require__);h=false}finally{if(h)delete e[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(914);module.exports=i})();