@nocobase/plugin-async-task-manager 2.1.0-beta.47 → 2.1.0-beta.48

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.
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
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
+ (self.webpackChunk_nocobase_plugin_async_task_manager_client_v2=self.webpackChunk_nocobase_plugin_async_task_manager_client_v2||[]).push([["338"],{264:function(e){e.exports=function(e,t,n){e=e||{};var r=t.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(e,t,n,o){return r.fromToBase(e,t,n,o)}n.en.relativeTime=o,r.fromToBase=function(t,r,a,l,i){for(var s,c,u,f=a.$locale().relativeTime||o,d=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=d.length,y=0;y<p;y+=1){var m=d[y];m.d&&(s=l?n(t).diff(a,m.d,!0):a.diff(t,m.d,!0));var b=(e.rounding||Math.round)(Math.abs(s));if(u=s>0,b<=m.r||!m.r){b<=1&&y>0&&(m=d[y-1]);var h=f[m.l];i&&(b=i(""+b)),c="string"==typeof h?h.replace("%d",b):h(b,r,m.l,u);break}}if(r)return c;var v=u?f.future:f.past;return"function"==typeof v?v(c):v.replace("%s",c)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var l=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(l(this),e)},r.fromNow=function(e){return this.from(l(this),e)}}},33:function(e,t,n){"use strict";n.r(t),n.d(t,{AsyncTasksTopbarActionModel:function(){return _},default:function(){return B}});var r,o=n(375),a=n(485),l=n(694),i=n(625),s=n(59),c=n(185),u=n.n(c),f=n(264),d=n.n(f),p=n(155),y=n.n(p);function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b="@nocobase/plugin-async-task-manager",h=(m(r={},null,{value:null,label:"{{t('Waiting', { ns: '".concat(b,"' })}}"),color:"default",icon:"ClockCircleOutlined"}),m(r,0,{value:0,label:"{{t('Processing', { ns: '".concat(b,"' })}}"),color:"processing",icon:"LoadingOutlined"}),m(r,1,{value:1,label:"{{t('Completed', { ns: '".concat(b,"' })}}"),color:"success",icon:"CheckCircleOutlined"}),m(r,-1,{value:-1,label:"{{t('Failed', { ns: '".concat(b,"' })}}"),color:"error",icon:"CloseCircleOutlined"}),m(r,-2,{value:-2,label:"{{t('Cancelled', { ns: '".concat(b,"' })}}"),color:"warning",icon:"StopOutlined"}),r),v="@nocobase/plugin-async-task-manager";function g(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 k(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}function E(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){k(a,r,o,l,i,"next",e)}function i(e){k(a,r,o,l,i,"throw",e)}l(void 0)})}}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(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 P(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function C(e,t){if(e){if("string"==typeof e)return g(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 g(e,t)}}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function M(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var c=[i,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}u().extend(d());var A=y().memo(function(e){var t,n,r=e.popoverVisible,i=e.setPopoverVisible,c=e.tasks,f=e.refresh,d=e.loading,m=(0,a.useApp)(),b=(t=(0,l.useFlowEngine)(),function(e,n){return t.context.t(e,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){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[v,"client"],nsMode:"fallback"},n))}),g=s.theme.useToken().token,k=null!=(n=m.pm.get("async-task-manager"))?n:m.pm.get("@nocobase/plugin-async-task-manager"),O=(0,p.useMemo)(function(){return m.apiClient.resource("asyncTasks")},[m.apiClient]),S=(0,p.useMemo)(function(){return[{title:b("Created at"),dataIndex:"createdAt",key:"createdAt",width:5*g.controlHeight,render:function(e){return e?y().createElement(s.Tooltip,{title:u()(e).format("YYYY-MM-DD HH:mm:ss")},u()(e).fromNow()):"-"}},{title:b("Task"),dataIndex:"title",key:"title",ellipsis:!0},{title:b("Status"),dataIndex:"status",key:"status",width:5*g.controlHeight,render:function(e,t){var n,r=null!=(n=h[String(null!=e?e:null)])?n:h[String(null)];return y().createElement(s.Space,{align:"center",size:g.marginXS},y().createElement("span",null,function(){var n,o,a={width:3*g.controlHeight,margin:0};switch(e){case null:case -2:return y().createElement(s.Alert,{showIcon:!1,message:b(r.label),banner:!0});case 0:return y().createElement(s.Progress,{type:"line",size:"small",strokeWidth:g.lineWidthBold,percent:Number(((null!=(n=t.progressCurrent)?n:0)/(null!=(o=t.progressTotal)?o:1)*100).toFixed(2)),status:"active",style:a,format:function(e){return"".concat((null!=e?e:0).toFixed(1),"%")}});case 1:return y().createElement(s.Progress,{type:"line",size:"small",strokeWidth:g.lineWidthBold,percent:100,status:"success",style:a,format:function(){return""}});case -1:return y().createElement(s.Progress,{type:"line",size:"small",strokeWidth:g.lineWidthBold,percent:100,status:"exception",style:a,format:function(){return""}});default:return null}}()),y().createElement(s.Tag,{color:r.color,icon:r.icon?y().createElement(a.Icon,{type:r.icon}):null,style:{margin:0,paddingInline:g.paddingXXS,height:g.controlHeightSM,width:g.controlHeightSM}}))}},{title:b("Actions"),dataIndex:"result",key:"actions",width:6*g.controlHeight,render:function(e,t){var n,r=[],a=function(e,t){if(t)return null==e?void 0:e.taskOrigins.get(t)}(k,t.origin),l=null==a?void 0:a.Result,c=null==a?void 0:a.ResultButton;return t.cancelable&&(0===t.status||null===t.status)&&r.push(y().createElement(s.Popconfirm,{key:"cancel",title:b("Confirm cancel"),description:b("Confirm to cancel this task?"),onConfirm:function(){return E(function(){return M(this,function(e){switch(e.label){case 0:return[4,O.stop({filterByTk:t.id})];case 1:return e.sent(),f(),[2]}})})()},okText:b("Confirm"),cancelText:b("Cancel")},y().createElement(s.Button,{type:"link",size:"small",icon:y().createElement(o.StopOutlined,null)},b("Stop")))),1===t.status&&e&&(c?r.push(y().createElement(c,{key:"result-button",task:t})):r.push(y().createElement(s.Button,{key:"view",type:"link",size:"small",icon:y().createElement(o.EyeOutlined,null),onClick:function(){i(!1),s.Modal.info({title:b("Task result"),content:l?y().createElement(l,{payload:e,task:t}):y().createElement("div",null,b("No renderer available for this task type, payload: {{payload}}",{payload:String(e)}))})}},b("View result")))),-1===t.status&&(n=e)&&(void 0===n?"undefined":P(n))==="object"&&r.push(y().createElement(s.Button,{key:"error",type:"link",size:"small",icon:y().createElement(o.ExclamationCircleOutlined,null),onClick:function(){i(!1);var t,n,r,o,l=null!=(r=null==a?void 0:a.namespace)?r:"client";s.Modal.info({title:b("Error Details"),content:y().createElement(s.Typography.Text,null,b(null!=(o=e.message)?o:"",(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){w(e,t,n[t])})}return e}({},e.params),n=n={ns:l},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))),closable:!0,width:g.screenSM})}},b("Error details"))),y().createElement(s.Space,{size:g.marginSM},r)}}]},[k,f,i,b,O,g]),j=y().createElement("div",{style:{maxHeight:"70vh",overflow:"auto",width:c.length>0?g.screenLG:6*g.controlHeight}},c.length>0?y().createElement(s.Table,{loading:d,columns:S,dataSource:c,size:"small",pagination:!1,rowKey:"id"}):y().createElement("div",{style:{paddingBlock:g.paddingLG,display:"flex",justifyContent:"center"}},y().createElement(s.Empty,{description:b("No tasks"),image:s.Empty.PRESENTED_IMAGE_SIMPLE})));return y().createElement(s.Popover,{content:j,trigger:"click",placement:"bottom",open:r,onOpenChange:i},y().createElement(s.Button,{type:"text",onClick:function(){i(!r),r||f()},icon:y().createElement(o.SyncOutlined,{spin:c.some(function(e){return 0===e.status})}),"data-testid":"async-tasks-button"}))});A.displayName="AsyncTasksButton";var x=(0,l.observer)(function(){var e=(0,a.useApp)(),t=(0,a.useMobileLayout)().isMobileLayout,n=(0,i.useRequest)(function(){return E(function(){var t,n;return M(this,function(r){switch(r.label){case 0:return[4,e.apiClient.resource("asyncTasks").list({sort:"-createdAt"})];case 1:return[2,null!=(t=null==(n=r.sent())?void 0:n.data)?t:{data:[]}]}})})()}),r=n.data,o=n.refresh,l=n.loading,s=j((0,p.useState)([]),2),c=s[0],u=s[1],f=j((0,p.useState)(!1),2),d=f[0],m=f[1];(0,p.useEffect)(function(){u(Array.isArray(null==r?void 0:r.data)?r.data:[])},[r]);var b=(0,p.useCallback)(function(){m(!0),o()},[o]),h=(0,p.useCallback)(function(e){var t=e.detail;(null==t?void 0:t.id)&&u(function(e){var n=function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("u">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.")}(),r=n.findIndex(function(e){return e.id===t.id});return -1===r?n.unshift(t):n.splice(r,1,t),n})},[]),v=(0,p.useCallback)(function(){o()},[o]),k=(0,p.useCallback)(function(){o()},[o]);return((0,p.useEffect)(function(){return e.eventBus.addEventListener("ws:message:async-tasks:created",b),e.eventBus.addEventListener("ws:message:async-tasks:progress",h),e.eventBus.addEventListener("ws:message:async-tasks:status",v),e.eventBus.addEventListener("ws:message:async-tasks:deleted",k),function(){e.eventBus.removeEventListener("ws:message:async-tasks:created",b),e.eventBus.removeEventListener("ws:message:async-tasks:progress",h),e.eventBus.removeEventListener("ws:message:async-tasks:status",v),e.eventBus.removeEventListener("ws:message:async-tasks:deleted",k)}},[e.eventBus,b,k,h,v]),t||0===c.length)?null:y().createElement(A,{tasks:c,refresh:o,loading:l,popoverVisible:d,setPopoverVisible:m})},{displayName:"AsyncTasksTopbarAction"}),_=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=O(t),w(e=function(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,T()?Reflect.construct(t,r||[],O(this).constructor):t.apply(this,r)),"sort",300),w(e,"actionId","async-tasks"),w(e,"testId","async-tasks-button"),w(e,"tooltip",(0,l.tExpr)("Async tasks",{ns:[v,"client"],nsMode:"fallback"})),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&S(n,e),t=[{key:"render",value:function(){return y().createElement(x,null)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(a.TopbarActionModel),B=_}}]);
@@ -0,0 +1,10 @@
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
+ export { PluginAsyncTaskManagerClientV2 } from './plugin';
10
+ export { default } from './plugin';
@@ -0,0 +1,10 @@
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
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-async-task-manager/client-v2",["ahooks","@nocobase/client-v2","dayjs","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-async-task-manager/client-v2"]=t(require("ahooks"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):e["@nocobase/plugin-async-task-manager/client-v2"]=t(e.ahooks,e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i,a,c){return function(){"use strict";var u,l,s,f={375:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=a},768:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=o},185:function(e){e.exports=n},155:function(e){e.exports=r}},p={};function b(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return f[e].call(n.exports,n,n.exports,b),n.exports}b.m=f,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+".272bcdd5bb509394.js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},b.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-async-task-manager/client-v2:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-async-task-manager/client-v2:"+n),o.src=e),d[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var d,y,v=b.g.document;if(!y&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(y=v.currentScript.src),!y)){var g=v.getElementsByTagName("script");if(g.length)for(var h=g.length-1;h>-1&&(!y||!/^http(s?):/.test(y));)y=g[h--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},b.f.j=function(e,t){var n=b.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},l=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);a&&a(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(s=self.webpackChunk_nocobase_plugin_async_task_manager_client_v2=self.webpackChunk_nocobase_plugin_async_task_manager_client_v2||[]).forEach(l.bind(null,0)),s.push=l.bind(null,s.push.bind(s));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-async-task-manager/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",a=i.indexOf(o);e=a>=0?i.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-async-task-manager/dist/client-v2/"}b.p=e}(),!function(){b.r(m),b.d(m,{PluginAsyncTaskManagerClientV2:function(){return u},default:function(){return l}});var e=b(485),t=b(768);function n(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function r(e,t,n){return(r=c()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}b(155);function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,n,r,i,u,l;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return n=a,r=arguments,n=o(n),i=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(n,r||[],o(this).constructor):n.apply(this,r)),u="taskOrigins",l=new t.Registry,u in i?Object.defineProperty(i,u,{value:l,enumerable:!0,configurable:!0,writable:!0}):i[u]=l,e}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&i(a,e),r=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.flowEngine.registerModelLoaders({AsyncTasksTopbarActionModel:{extends:"TopbarActionModel",loader:function(){return b.e("338").then(b.bind(b,33))}}}),this.app.eventBus.dispatchEvent(new CustomEvent("plugin:async-task-manager:loaded",{detail:this})),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(a.prototype,r),a}(a(e.Plugin)),l=u}(),m}()});
@@ -0,0 +1,11 @@
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
+ export declare const NAMESPACE = "@nocobase/plugin-async-task-manager";
10
+ export declare function tExpr(key: string): string;
11
+ export declare function useT(): (key: string, options?: Record<string, unknown>) => string;
@@ -0,0 +1,18 @@
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
+ import { TopbarActionModel } from '@nocobase/client-v2';
10
+ import React from 'react';
11
+ export declare class AsyncTasksTopbarActionModel extends TopbarActionModel {
12
+ sort: number;
13
+ actionId: string;
14
+ testId: string;
15
+ tooltip: string;
16
+ render(): React.JSX.Element;
17
+ }
18
+ export default AsyncTasksTopbarActionModel;
@@ -0,0 +1,40 @@
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
+ import type { Application } from '@nocobase/client-v2';
10
+ import { Plugin } from '@nocobase/client-v2';
11
+ import { Registry } from '@nocobase/utils/client';
12
+ import React from 'react';
13
+ export type AsyncTaskRecord = {
14
+ id: string;
15
+ origin?: string;
16
+ type?: string;
17
+ title?: string;
18
+ status?: number | null;
19
+ result?: unknown;
20
+ cancelable?: boolean;
21
+ progressCurrent?: number | null;
22
+ progressTotal?: number | null;
23
+ createdAt?: string;
24
+ params?: Record<string, unknown>;
25
+ };
26
+ export type TaskOrigin = {
27
+ Result?: React.ComponentType<{
28
+ payload: unknown;
29
+ task: AsyncTaskRecord;
30
+ }>;
31
+ ResultButton?: React.ComponentType<{
32
+ task: AsyncTaskRecord;
33
+ }>;
34
+ namespace?: string;
35
+ };
36
+ export declare class PluginAsyncTaskManagerClientV2 extends Plugin<Record<string, never>, Application> {
37
+ taskOrigins: Registry<TaskOrigin>;
38
+ load(): Promise<void>;
39
+ }
40
+ export default PluginAsyncTaskManagerClientV2;
@@ -8,15 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.47",
11
+ "@nocobase/client": "2.1.0-beta.48",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "2.1.0-beta.47",
13
+ "@nocobase/utils": "2.1.0-beta.48",
14
+ "@nocobase/flow-engine": "2.1.0-beta.48",
15
+ "@nocobase/client-v2": "2.1.0-beta.48",
14
16
  "lodash": "4.18.1",
15
- "@nocobase/server": "2.1.0-beta.47",
16
- "@nocobase/logger": "2.1.0-beta.47",
17
- "@nocobase/database": "2.1.0-beta.47",
17
+ "@nocobase/server": "2.1.0-beta.48",
18
+ "@nocobase/logger": "2.1.0-beta.48",
19
+ "@nocobase/database": "2.1.0-beta.48",
18
20
  "antd": "5.24.2",
19
21
  "react-i18next": "11.18.6",
20
22
  "dayjs": "1.11.13",
21
- "@nocobase/actions": "2.1.0-beta.47"
23
+ "@ant-design/icons": "5.6.1",
24
+ "ahooks": "3.7.8",
25
+ "@nocobase/actions": "2.1.0-beta.48"
22
26
  };
package/package.json CHANGED
@@ -6,10 +6,11 @@
6
6
  "description": "Manage and monitor asynchronous tasks such as data import/export. Support task progress tracking and notification.",
7
7
  "description.ru-RU": "Управление асинхронными задачами и мониторинг (например, импорт/экспорт данных). Поддержка отслеживания прогресса и уведомлений о задачах.",
8
8
  "description.zh-CN": "管理和监控数据导入导出等异步任务。支持任务进度跟踪和通知。",
9
- "version": "2.1.0-beta.47",
9
+ "version": "2.1.0-beta.48",
10
10
  "main": "dist/server/index.js",
11
11
  "peerDependencies": {
12
12
  "@nocobase/client": "2.x",
13
+ "@nocobase/client-v2": "2.x",
13
14
  "@nocobase/plugin-error-handler": "2.x",
14
15
  "@nocobase/server": "2.x",
15
16
  "@nocobase/test": "2.x"
@@ -18,5 +19,5 @@
18
19
  "p-queue": "^6.6.2"
19
20
  },
20
21
  "license": "Apache-2.0",
21
- "gitHead": "bf8fc3790e3494c901b4d22861c5471a0d27c464"
22
+ "gitHead": "f8c27a286db015c5e433b48241f14c0412e50530"
22
23
  }