@nocobase/plugin-async-task-manager 1.7.0-beta.2 → 1.7.0-beta.20
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/LICENSE.txt +4 -4
- package/dist/client/AsyncTaskManagerProvider.d.ts +8 -2
- package/dist/client/components/AsyncTasks.d.ts +8 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +6 -6
- package/dist/locale/it-IT.json +2 -2
- package/dist/locale/nl-NL.json +45 -4
- package/dist/node_modules/uuid/dist/bin/uuid +2 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/index.js +79 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/md5.js +223 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/native.js +11 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/nil.js +8 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/parse.js +45 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/regex.js +8 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/rng.js +25 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/sha1.js +104 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/stringify.js +44 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/v1.js +107 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/v3.js +16 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/v35.js +80 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/v4.js +43 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/v5.js +16 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/validate.js +17 -0
- package/dist/node_modules/uuid/dist/commonjs-browser/version.js +21 -0
- package/dist/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/dist/node_modules/uuid/{lib/md5-browser.js → dist/esm-browser/md5.js} +80 -81
- package/dist/node_modules/uuid/dist/esm-browser/native.js +4 -0
- package/dist/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +18 -0
- package/dist/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +33 -0
- package/dist/node_modules/uuid/dist/esm-browser/v1.js +95 -0
- package/dist/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/dist/node_modules/uuid/dist/esm-browser/v35.js +66 -0
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +29 -0
- package/dist/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/dist/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/dist/node_modules/uuid/dist/esm-node/index.js +9 -0
- package/dist/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/dist/node_modules/uuid/dist/esm-node/native.js +4 -0
- package/dist/node_modules/uuid/dist/esm-node/nil.js +1 -0
- package/dist/node_modules/uuid/dist/esm-node/parse.js +35 -0
- package/dist/node_modules/uuid/dist/esm-node/regex.js +1 -0
- package/dist/node_modules/uuid/dist/esm-node/rng.js +12 -0
- package/dist/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/dist/node_modules/uuid/dist/esm-node/stringify.js +33 -0
- package/dist/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/dist/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/dist/node_modules/uuid/dist/esm-node/v35.js +66 -0
- package/dist/node_modules/uuid/dist/esm-node/v4.js +29 -0
- package/dist/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/dist/node_modules/uuid/dist/esm-node/validate.js +7 -0
- package/dist/node_modules/uuid/dist/esm-node/version.js +11 -0
- package/dist/node_modules/uuid/dist/index.js +1 -0
- package/dist/node_modules/uuid/dist/md5-browser.js +223 -0
- package/dist/node_modules/uuid/dist/md5.js +23 -0
- package/dist/node_modules/uuid/dist/native-browser.js +11 -0
- package/dist/node_modules/uuid/dist/native.js +15 -0
- package/dist/node_modules/uuid/dist/nil.js +8 -0
- package/dist/node_modules/uuid/dist/parse.js +45 -0
- package/dist/node_modules/uuid/dist/regex.js +8 -0
- package/dist/node_modules/uuid/dist/rng-browser.js +25 -0
- package/dist/node_modules/uuid/dist/rng.js +24 -0
- package/dist/node_modules/uuid/dist/sha1-browser.js +104 -0
- package/dist/node_modules/uuid/dist/sha1.js +23 -0
- package/dist/node_modules/uuid/dist/stringify.js +44 -0
- package/dist/node_modules/uuid/dist/uuid-bin.js +85 -0
- package/dist/node_modules/uuid/dist/v1.js +107 -0
- package/dist/node_modules/uuid/dist/v3.js +16 -0
- package/dist/node_modules/uuid/dist/v35.js +80 -0
- package/dist/node_modules/uuid/dist/v4.js +43 -0
- package/dist/node_modules/uuid/dist/v5.js +16 -0
- package/dist/node_modules/uuid/dist/validate.js +17 -0
- package/dist/node_modules/uuid/dist/version.js +21 -0
- package/dist/node_modules/uuid/package.json +1 -1
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.js +1 -3
- package/dist/server/plugin.d.ts +8 -0
- package/dist/server/plugin.js +2 -2
- package/dist/server/resourcers/async-tasks.d.ts +10 -0
- package/dist/server/resourcers/async-tasks.js +29 -2
- package/package.json +2 -2
- package/dist/node_modules/uuid/AUTHORS +0 -5
- package/dist/node_modules/uuid/bin/uuid +0 -65
- package/dist/node_modules/uuid/index.js +0 -1
- package/dist/node_modules/uuid/lib/bytesToUuid.js +0 -26
- package/dist/node_modules/uuid/lib/md5.js +0 -25
- package/dist/node_modules/uuid/lib/rng-browser.js +0 -34
- package/dist/node_modules/uuid/lib/rng.js +0 -8
- package/dist/node_modules/uuid/lib/sha1-browser.js +0 -89
- package/dist/node_modules/uuid/lib/sha1.js +0 -25
- package/dist/node_modules/uuid/lib/v35.js +0 -57
- package/dist/node_modules/uuid/v1.js +0 -109
- package/dist/node_modules/uuid/v3.js +0 -4
- package/dist/node_modules/uuid/v4.js +0 -29
- package/dist/node_modules/uuid/v5.js +0 -3
- package/dist/server/static-import.d.ts +0 -1
- package/dist/server/static-import.js +0 -39
package/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Updated Date:
|
|
1
|
+
Updated Date: April 1, 2025
|
|
2
2
|
|
|
3
3
|
NocoBase License Agreement
|
|
4
4
|
|
|
@@ -88,7 +88,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
88
88
|
|
|
89
89
|
6.6 Can sell plugins developed for Software in the Marketplace.
|
|
90
90
|
|
|
91
|
-
6.7 The User with
|
|
91
|
+
6.7 The User with a Professional or Enterprise Edition License can sell Upper Layer Application to their clients.
|
|
92
92
|
|
|
93
93
|
6.8 Not restricted by the AGPL-3.0 agreement.
|
|
94
94
|
|
|
@@ -106,9 +106,9 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
106
106
|
|
|
107
107
|
7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
|
|
108
108
|
|
|
109
|
-
7.5 It is not allowed for the User withot
|
|
109
|
+
7.5 It is not allowed for the User withot a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
|
|
110
110
|
|
|
111
|
-
7.6 It is not allowed for the User with
|
|
111
|
+
7.6 It is not allowed for the User with a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
|
|
112
112
|
|
|
113
113
|
7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
|
|
114
114
|
|
|
@@ -1,4 +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
|
+
*/
|
|
1
9
|
import React from 'react';
|
|
2
|
-
export declare const AsyncTaskContext: React.Context<any>;
|
|
3
|
-
export declare const useAsyncTask: () => any;
|
|
4
10
|
export declare const AsyncTaskManagerProvider: (props: any) => React.JSX.Element;
|
|
@@ -1,3 +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
|
+
*/
|
|
1
9
|
import React from 'react';
|
|
2
10
|
import 'dayjs/locale/zh-cn';
|
|
3
11
|
export declare const AsyncTasks: () => React.JSX.Element;
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("dayjs"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-async-task-manager",["react","@nocobase/client","dayjs","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-async-task-manager"]=t(require("react"),require("@nocobase/client"),require("dayjs"),require("antd")):e["@nocobase/plugin-async-task-manager"]=t(e.react,e["@nocobase/client"],e.dayjs,e.antd)}(self,function(e,t,n,r){return function(){var o={379:function(e,t,n){var r,o;r=0,o=function(e){"use strict";var t,n=(t=e)&&"object"==typeof t&&"default"in t?t:{default:t},r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r},e.exports=o(n(760))},809:function(e){var t,n;t=0,n=function(){return 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,s,i){for(var c,u,l,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&&(c=s?n(t).diff(a,m.d,!0):a.diff(t,m.d,!0));var v=(e.rounding||Math.round)(Math.abs(c));if(l=c>0,v<=m.r||!m.r){v<=1&&y>0&&(m=d[y-1]);var b=f[m.l];i&&(v=i(""+v)),u="string"==typeof b?b.replace("%d",v):b(v,r,m.l,l);break}}if(r)return u;var h=l?f.future:f.past;return"function"==typeof h?h(u):h.replace("%s",u)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var s=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(s(this),e)},r.fromNow=function(e){return this.from(s(this),e)}}},e.exports=n()},772:function(e){"use strict";e.exports=t},721:function(e){"use strict";e.exports=r},760:function(e){"use strict";e.exports=n},156:function(t){"use strict";t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e].call(n.exports,n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return!function(){"use strict";s.r(i),s.d(i,{default:function(){return A},PluginAsyncExportClient:function(){return I}});var e=s("772"),t=s("156"),n=s.n(t),r=s("721"),o=s("760"),a=s.n(o);s("379");var c=s("809"),u=s.n(c),l=JSON.parse('{"u2":"@nocobase/plugin-async-task-manager"}');function f(){var t=(0,e.useApp)();return function(e){return t.i18n.t(e,{ns:[l.u2,"client"]})}}var d=(0,e.createStyles)(function(e){return{button:{color:e.token.colorTextHeaderMenu+" !important"}}});a().extend(u());var p=function(e,t){if("success"!==e.type||!(null===(a=e.payload)||void 0===a?void 0:null===(o=a.message)||void 0===o?void 0:o.messageId))return null;var o,a,s=e.payload.message,i=s.messageId,c=s.messageValues;return n().createElement("div",{style:{marginLeft:8}},n().createElement(r.Tag,{color:"success"},t(i,c)))},y=function(){var o=E(),s=o.tasks,i=o.popoverVisible,c=o.setPopoverVisible,u=o.hasProcessingTasks,l=o.cancellingTasks,y=o.modalVisible,m=o.setModalVisible,v=o.currentError,b=o.setCurrentError,h=o.resultModalVisible,g=o.setResultModalVisible,k=o.currentTask,w=o.setCurrentTask,O=o.handleCancelTask,_=(0,e.usePlugin)("async-task-manager"),x=(0,e.useApp)(),S=(0,e.useCurrentAppInfo)(),T=f(),C=d().styles;(0,t.useEffect)(function(){var e=function(e){if(i){var t=document.querySelectorAll(".ant-popover"),n=document.querySelector(".sync-task-button"),r=!1;t.forEach(function(t){t.contains(e.target)&&(r=!0)}),(null==n?void 0:n.contains(e.target))&&(r=!0),!r&&c(!1)}};return document.addEventListener("click",e),function(){document.removeEventListener("click",e)}},[i,c]);var P=function(e){w(e),g(!0),c(!1)},M=[{title:T("Created at"),dataIndex:"createdAt",key:"createdAt",width:180,render:function(e){return n().createElement(r.Tooltip,{title:a()(e).format("YYYY-MM-DD HH:mm:ss")},a()(e).fromNow())}},{title:T("Task"),dataIndex:"title",key:"title",render:function(e,t){var n=t.title;if(!n)return"-";var r={export:T("Export"),import:T("Import"),"export-attachments":T("Export attachments")}[n.actionType]||n.actionType;return(({"export-attachments":T("Export {collection} attachments"),export:T("Export {collection} data"),import:T("Import {collection} data")})[n.actionType]||"".concat(r)).replace("{collection}",n.collection)}},{title:T("Status"),dataIndex:"status",key:"status",width:160,render:function(t,o){var a,s={pending:{color:"default",text:T("Waiting"),icon:"ClockCircleOutlined"},running:{color:"processing",text:T("Processing"),icon:"LoadingOutlined"},success:{color:"success",text:T("Completed"),icon:"CheckCircleOutlined"},failed:{color:"error",text:T("Failed"),icon:"CloseCircleOutlined"},cancelled:{color:"warning",text:T("Cancelled"),icon:"StopOutlined"}},i=s[t.type]||{},c=i.color;return i.text,n().createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},n().createElement("div",{style:{flex:1}},function(){var e,a,s={width:100,margin:0};switch(t.indicator){case"spinner":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"active",showInfo:!1,style:s});case"progress":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:Number(((null===(e=o.progress)||void 0===e?void 0:e.current)/(null===(a=o.progress)||void 0===a?void 0:a.total)*100).toFixed(2)),status:"active",style:s,format:function(e){return"".concat(e.toFixed(1),"%")}});case"success":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"success",style:s,format:function(){return""}});case"error":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"exception",style:s,format:function(){return""}});default:return null}}()),n().createElement(r.Tag,{color:c,icon:(null===(a=s[t.type])||void 0===a?void 0:a.icon)?n().createElement(e.Icon,{type:s[t.type].icon}):null,style:{margin:0,padding:"0 4px",height:22,width:22}}),p(t,T))}},{title:T("Actions"),key:"actions",width:180,render:function(t,o){var a=[],s=l.has(o.taskId);return("running"===o.status.type||"pending"===o.status.type)&&o.cancelable&&a.push(n().createElement(r.Popconfirm,{key:"cancel",title:T("Confirm cancel"),description:T("Confirm cancel description"),onConfirm:function(){return O(o.taskId)},okText:T("Confirm"),cancelText:T("Cancel"),disabled:s},n().createElement(r.Button,{type:"link",size:"small",icon:n().createElement(e.Icon,{type:s?"LoadingOutlined":"StopOutlined"}),disabled:s},s?T("Cancelling"):T("Cancel")))),"success"===o.status.type&&("file"===o.status.resultType?a.push(n().createElement(r.Button,{key:"download",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"DownloadOutlined"}),onClick:function(){var e,t=x.apiClient.auth.token,n=x.getApiUrl("asyncTasks:fetchFile/".concat(o.taskId,"?token=").concat(t,"&__appName=").concat((null==S?void 0:null===(e=S.data)||void 0===e?void 0:e.name)||x.name));window.open(n)}},T("Download"))):o.status.payload&&a.push(n().createElement(r.Button,{key:"view",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"EyeOutlined"}),onClick:function(){return P(o)}},T("View result")))),"failed"===o.status.type&&a.push(n().createElement(r.Button,{key:"error",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"ExclamationCircleOutlined"}),onClick:function(){b(o.status.errors),m(!0),c(!1)}},T("Error details"))),n().createElement(r.Space,{size:"middle"},a)}}],j=n().createElement("div",{style:{width:s.length>0?800:200}},s.length>0?n().createElement(r.Table,{columns:M,dataSource:s,size:"small",pagination:!1,rowKey:"taskId"}):n().createElement("div",{style:{padding:"24px 0",display:"flex",justifyContent:"center"}},n().createElement(r.Empty,{description:T("No tasks"),image:r.Empty.PRESENTED_IMAGE_SIMPLE})));return n().createElement(n().Fragment,null,n().createElement(r.Popover,{content:j,trigger:"hover",placement:"bottom",open:i,onOpenChange:c},n().createElement(r.Button,{className:["sync-task-button",C.button].join(" "),icon:n().createElement(e.Icon,{type:"SyncOutlined",spin:u}),onClick:function(){return c(!i)}})),function(){if(!!k){var e=k.status.payload,t=_.taskResultRendererManager.get(k.title.actionType);return n().createElement(r.Modal,{title:T("Task result"),open:h,footer:[n().createElement(r.Button,{key:"close",onClick:function(){return g(!1)}},T("Close"))],onCancel:function(){return g(!1)}},t?n().createElement(t,{payload:e,task:k}):n().createElement("div",null,T("No renderer available for this task type, payload: ".concat(e))))}}(),n().createElement(r.Modal,{title:T("Error Details"),open:y,onCancel:function(){return m(!1)},footer:[n().createElement(r.Button,{key:"ok",type:"primary",onClick:function(){return m(!1)}},T("OK"))],width:400},null==v?void 0:v.map(function(e,t){return n().createElement("div",{key:t,style:{marginBottom:16}},n().createElement("div",{style:{color:"#ff4d4f",marginBottom:8}},e.message),e.code&&n().createElement("div",{style:{color:"#999",fontSize:12}},T("Error code"),": ",e.code))})))};function m(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 v(e,t,n,r,o,a,s){try{var i=e[a](s),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function b(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,o,a;r=e,o=t,a=n[t],o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function g(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 a=[],s=!0,i=!1;try{for(o=o.call(e);!(s=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){i=!0,r=e}finally{try{!s&&null!=o.return&&o.return()}finally{if(i)throw r}}return a}}(e,t)||k(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 k(e,t){if(e){if("string"==typeof e)return m(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 m(e,t)}}var w=(0,t.createContext)(null),E=function(){var e=(0,t.useContext)(w);if(!e)throw Error("useAsyncTask must be used within AsyncTaskManagerProvider");return e},O=function(o){var a,s,i=(0,e.useApp)(),c=f(),u=g((0,t.useState)([]),2),l=u[0],d=u[1],p=g((0,t.useState)(!1),2),E=p[0],O=p[1],_=g((0,t.useState)(!1),2),x=_[0],S=_[1],T=g((0,t.useState)(new Set),2),C=T[0],P=T[1],M=g((0,t.useState)(!1),2),j=M[0],Y=M[1],I=g((0,t.useState)(null),2),A=I[0],L=I[1],B=g((0,t.useState)(!1),2),D=B[0],z=B[1],V=g((0,t.useState)(null),2),q=V[0],N=V[1],H=g((0,t.useState)(function(){return i.isWsAuthorized}),2),R=H[0],F=H[1];(0,t.useEffect)(function(){S(l.some(function(e){return"success"!==e.status.type&&"failed"!==e.status.type}))},[l]);var W=(0,t.useCallback)(function(e){var t=e.detail;d(t?t.sort(function(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}):[])},[]),G=(0,t.useCallback)(function(e){var t=e.detail;d(function(e){var n;return[t].concat(function(e){if(Array.isArray(e))return m(e)}(n=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||k(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).sort(function(e,t){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()})}),O(!0)},[]),J=(0,t.useCallback)(function(e){var t=e.detail,n=t.taskId,r=t.progress;d(function(e){return e.map(function(e){return e.taskId===n?h(b({},e),{progress:r}):e})})},[]),$=(0,t.useCallback)(function(e){var t=e.detail,n=t.taskId,o=t.status;"cancelled"===o.type?d(function(e){return e.filter(function(e){return e.taskId!==n})}):d(function(e){return e.map(function(e){return e.taskId===n?("success"===o.type&&"success"!==e.status.type&&r.message.success(c("Task completed")),"failed"===o.type&&"failed"!==e.status.type&&r.message.error(c("Task failed")),h(b({},e),{status:o})):e})})},[]),K=(0,t.useCallback)(function(){F(!0)},[]),U=(0,t.useCallback)(function(e){var t=e.detail.taskId;P(function(e){var n=new Set(e);return n.delete(t),n}),r.message.success(c("Task cancelled"))},[]);(0,t.useEffect)(function(){return i.eventBus.addEventListener("ws:message:async-tasks",W),i.eventBus.addEventListener("ws:message:async-tasks:created",G),i.eventBus.addEventListener("ws:message:async-tasks:progress",J),i.eventBus.addEventListener("ws:message:async-tasks:status",$),i.eventBus.addEventListener("ws:message:authorized",K),i.eventBus.addEventListener("ws:message:async-tasks:cancelled",U),R&&i.ws.send(JSON.stringify({type:"request:async-tasks:list"})),function(){i.eventBus.removeEventListener("ws:message:async-tasks",W),i.eventBus.removeEventListener("ws:message:async-tasks:created",G),i.eventBus.removeEventListener("ws:message:async-tasks:progress",J),i.eventBus.removeEventListener("ws:message:async-tasks:status",$),i.eventBus.removeEventListener("ws:message:authorized",K),i.eventBus.removeEventListener("ws:message:async-tasks:cancelled",U)}},[i,W,G,J,$,K,U,R]);var Q=(s=(a=function(e){return function(e,t){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,function(t){P(function(t){return new Set(t).add(e)});try{i.ws.send(JSON.stringify({type:"request:async-tasks:cancel",payload:{taskId:e}}))}catch(t){console.error("Failed to cancel task:",t),P(function(t){var n=new Set(t);return n.delete(e),n})}return[2]})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=a.apply(e,t);function s(e){v(o,n,r,s,i,"next",e)}function i(e){v(o,n,r,s,i,"throw",e)}s(void 0)})}),function(e){return s.apply(this,arguments)});return n().createElement(w.Provider,{value:{tasks:l,popoverVisible:E,setPopoverVisible:O,hasProcessingTasks:x,cancellingTasks:C,modalVisible:j,setModalVisible:Y,currentError:A,setCurrentError:L,resultModalVisible:D,setResultModalVisible:z,currentTask:q,setCurrentTask:N,handleCancelTask:Q}},n().createElement(e.PinnedPluginListProvider,{items:l.length>0?{asyncTasks:{order:300,component:"AsyncTasks",pin:!0,snippet:"*"}}:{}},n().createElement(e.SchemaComponentOptions,{components:{AsyncTasks:y}},o.children)))};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)}}var x=function(){var e,t,n;function r(){var e,t,n;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),e=this,t="renderers",n=new Map,t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}return e=r,t=[{key:"register",value:function(e,t){this.renderers.set(e,t)}},{key:"get",value:function(e){return this.renderers.get(e)}}],_(e.prototype,t),r}();function S(e,t,n,r,o,a,s){try{var i=e[a](s),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function T(e,t,n){return(T=Y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&M(o,n.prototype),o}).apply(null,arguments)}function C(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)}}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var t="function"==typeof Map?new Map:void 0;return(j=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return T(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),M(r,e)})(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var I=function(e){var t,n,r;function o(){var e,t,n,r,a,s,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=P(n),a=e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,Y()?Reflect.construct(n,r||[],P(t).constructor):n.apply(t,r)),s="taskResultRendererManager",i=new x,s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&M(e,t)}(o,e),t=o,n=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,function(e){return t.app.use(O),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function s(e){S(a,r,o,s,i,"next",e)}function i(e){S(a,r,o,s,i,"throw",e)}s(void 0)})})()}}],C(t.prototype,n),o}(j(e.Plugin)),A=I}(),i}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("dayjs"),require("@nocobase/client"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-async-task-manager",["react","dayjs","@nocobase/client","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-async-task-manager"]=t(require("react"),require("dayjs"),require("@nocobase/client"),require("antd")):e["@nocobase/plugin-async-task-manager"]=t(e.react,e.dayjs,e["@nocobase/client"],e.antd)}(self,function(e,t,n,r){var o={379:function(e,t,n){e.exports=function(e){"use strict";var t={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};return(e&&"object"==typeof e&&"default"in e?e:{default:e}).default.locale(t,null,!0),t}(n(760))},809: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,i,l){for(var s,c,u,f=a.$locale().relativeTime||o,p=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"}],d=p.length,y=0;y<d;y+=1){var m=p[y];m.d&&(s=i?n(t).diff(a,m.d,!0):a.diff(t,m.d,!0));var v=(e.rounding||Math.round)(Math.abs(s));if(u=s>0,v<=m.r||!m.r){v<=1&&y>0&&(m=p[y-1]);var h=f[m.l];l&&(v=l(""+v)),c="string"==typeof h?h.replace("%d",v):h(v,r,m.l,u);break}}if(r)return c;var b=u?f.future:f.past;return"function"==typeof b?b(c):b.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 i=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(i(this),e)},r.fromNow=function(e){return this.from(i(this),e)}}},772:function(e){"use strict";e.exports=n},721:function(e){"use strict";e.exports=r},760:function(e){"use strict";e.exports=t},156:function(t){"use strict";t.exports=e}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e].call(n.exports,n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return!function(){"use strict";i.r(l),i.d(l,{PluginAsyncExportClient:function(){return C},default:function(){return M}});var e=i(772),t=i(156),n=i.n(t),r=i(721),o=i(760),a=i.n(o);i(379);var s=i(809),c=i.n(s),u=JSON.parse('{"u2":"@nocobase/plugin-async-task-manager"}');function f(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 p(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){p(a,r,o,i,l,"next",e)}function l(e){p(a,r,o,i,l,"throw",e)}i(void 0)})}}function y(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 a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(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 f(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 m(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var s=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var v=(0,e.createStyles)(function(e){return{button:{color:e.token.colorTextHeaderMenu+" !important"}}});a().extend(c());var h=function(e,t){if("success"!==e.type||!(null==(a=e.payload)||null==(o=a.message)?void 0:o.messageId))return null;var o,a,i=e.payload.message,l=i.messageId,s=i.messageValues;return n().createElement("div",{style:{marginLeft:8}},n().createElement(r.Tag,{color:"success"},t(l,s)))},b=function(){var t=(0,e.useRequest)({url:"asyncTasks:list"}),n=t.data,r=t.refreshAsync;return{loading:t.loading,tasks:(null==n?void 0:n.data)||[],refresh:r}},g=function(t){var o,i=t.popoverVisible,l=t.setPopoverVisible,s=t.tasks,c=t.refresh,f=t.loading,p=t.hasProcessingTasks,y=(0,e.useApp)(),b=(0,e.useAPIClient)(),g=(0,e.useCurrentAppInfo)(),k=(o=(0,e.useApp)(),function(e){return o.i18n.t(e,{ns:[u.u2,"client"]})}),w=v().styles,E=(0,e.usePlugin)("async-task-manager"),x=(0,e.useCollectionManager)(),_=(0,e.useCompile)(),O=function(e){l(!1)},T=[{title:k("Created at"),dataIndex:"createdAt",key:"createdAt",width:180,render:function(e){return n().createElement(r.Tooltip,{title:a()(e).format("YYYY-MM-DD HH:mm:ss")},a()(e).fromNow())}},{title:k("Task"),dataIndex:"title",key:"title",render:function(e,t){var n=t.title;if(!n)return"-";var r=x.getCollection(n.collection),o={export:k("Export"),import:k("Import"),"export-attachments":k("Export attachments")}[n.actionType]||n.actionType;return(({"export-attachments":k("Export {collection} attachments"),export:k("Export {collection} data"),import:k("Import {collection} data")})[n.actionType]||"".concat(o)).replace("{collection}",_((null==r?void 0:r.title)||n.collection))}},{title:k("Status"),dataIndex:"status",key:"status",width:160,render:function(t,o){var a,i={pending:{color:"default",text:k("Waiting"),icon:"ClockCircleOutlined"},running:{color:"processing",text:k("Processing"),icon:"LoadingOutlined"},success:{color:"success",text:k("Completed"),icon:"CheckCircleOutlined"},failed:{color:"error",text:k("Failed"),icon:"CloseCircleOutlined"},cancelled:{color:"warning",text:k("Cancelled"),icon:"StopOutlined"}},l=i[t.type]||{},s=l.color;return l.text,n().createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},n().createElement("div",{style:{flex:1}},function(){var e,a,i={width:100,margin:0};switch(t.indicator){case"spinner":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"active",showInfo:!1,style:i});case"progress":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:Number(((null==(e=o.progress)?void 0:e.current)/(null==(a=o.progress)?void 0:a.total)*100).toFixed(2)),status:"active",style:i,format:function(e){return"".concat(e.toFixed(1),"%")}});case"success":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"success",style:i,format:function(){return""}});case"error":return n().createElement(r.Progress,{type:"line",size:"small",strokeWidth:4,percent:100,status:"exception",style:i,format:function(){return""}});default:return null}}()),n().createElement(r.Tag,{color:s,icon:(null==(a=i[t.type])?void 0:a.icon)?n().createElement(e.Icon,{type:i[t.type].icon}):null,style:{margin:0,padding:"0 4px",height:22,width:22}}),h(t,k))}},{title:k("Actions"),key:"actions",width:180,render:function(t,o){var a=[];return("running"===o.status.type||"pending"===o.status.type)&&o.cancelable&&a.push(n().createElement(r.Popconfirm,{key:"cancel",title:k("Confirm cancel"),description:k("Confirm cancel description"),onConfirm:d(function(){return m(this,function(e){switch(e.label){case 0:return[4,b.request({url:"asyncTasks:cancel",params:{filterByTk:o.taskId}})];case 1:return e.sent(),c(),[2]}})}),okText:k("Confirm"),cancelText:k("Cancel"),disabled:!1},n().createElement(r.Button,{type:"link",size:"small",icon:n().createElement(e.Icon,{type:"StopOutlined"}),disabled:!1},k("Cancel")))),"success"===o.status.type&&("file"===o.status.resultType?a.push(n().createElement(r.Button,{key:"download",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"DownloadOutlined"}),onClick:function(){var e,t,n,r=y.apiClient.auth.token,a=x.getCollection(o.title.collection),i=_(null==a?void 0:a.title),l=(null==o||null==(e=o.title)?void 0:e.actionType)==="export-attachments"?"-attachments.zip":".xlsx",s="".concat(i).concat(l),c=(null==o||null==(t=o.title)?void 0:t.actionType)!=="create migration"?encodeURIComponent(s):null,u=y.getApiUrl("asyncTasks:fetchFile/".concat(o.taskId,"?token=").concat(r,"&__appName=").concat(encodeURIComponent((null==g||null==(n=g.data)?void 0:n.name)||y.name)).concat(c?"&filename=".concat(c):""));window.open(u)}},k("Download"))):o.status.payload&&a.push(n().createElement(r.Button,{key:"view",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"EyeOutlined"}),onClick:function(){O(o);var e=o.status.payload,t=E.taskResultRendererManager.get(o.title.actionType);r.Modal.info({title:k("Task result"),content:t?n().createElement(t,{payload:e,task:o}):n().createElement("div",null,k("No renderer available for this task type, payload: ".concat(e)))})}},k("View result")))),"failed"===o.status.type&&a.push(n().createElement(r.Button,{key:"error",type:"link",size:"small",icon:n().createElement(e.Icon,{type:"ExclamationCircleOutlined"}),onClick:function(){var e;l(!1),r.Modal.info({title:k("Error Details"),content:null==(e=o.status.errors)?void 0:e.map(function(e,t){return n().createElement("div",{key:t,style:{marginBottom:16}},n().createElement("div",{style:{color:"#ff4d4f",marginBottom:8}},e.message),e.code&&n().createElement("div",{style:{color:"#999",fontSize:12}},k("Error code"),": ",e.code))}),closable:!0,width:400})}},k("Error details"))),n().createElement(r.Space,{size:"middle"},a)}}],P=n().createElement("div",{style:{maxHeight:"70vh",overflow:"auto",width:s.length>0?800:200}},s.length>0?n().createElement(r.Table,{loading:f,columns:T,dataSource:s,size:"small",pagination:!1,rowKey:"taskId"}):n().createElement("div",{style:{padding:"24px 0",display:"flex",justifyContent:"center"}},n().createElement(r.Empty,{description:k("No tasks"),image:r.Empty.PRESENTED_IMAGE_SIMPLE})));return n().createElement(n().Fragment,null,n().createElement(r.Popover,{content:P,trigger:"hover",placement:"bottom",open:i,onOpenChange:l},n().createElement(r.Button,{className:["sync-task-button",w.button].join(" "),icon:n().createElement(e.Icon,{type:"SyncOutlined",spin:p}),onClick:function(){return l(!i)}})))},k=function(){var r=b(),o=r.tasks,a=r.refresh,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(r,["tasks","refresh"]),l=(0,e.useApp)(),s=y((0,t.useState)(!1),2),c=s[0],u=s[1],f=y((0,t.useState)(!1),2),p=f[0],v=f[1];(0,t.useEffect)(function(){v(o.some(function(e){return"success"!==e.status.type&&"failed"!==e.status.type}))},[o]);var h=(0,t.useCallback)(d(function(){return m(this,function(e){return u(!0),[2]})}),[]),k=(0,t.useCallback)(function(){a(),console.log("handleTaskProgress")},[]),w=(0,t.useCallback)(function(){a(),console.log("handleTaskStatus")},[]),E=(0,t.useCallback)(function(){a(),console.log("handleTaskCancelled")},[]);return(0,t.useEffect)(function(){return l.eventBus.addEventListener("ws:message:async-tasks:created",h),l.eventBus.addEventListener("ws:message:async-tasks:progress",k),l.eventBus.addEventListener("ws:message:async-tasks:status",w),l.eventBus.addEventListener("ws:message:async-tasks:cancelled",E),function(){l.eventBus.removeEventListener("ws:message:async-tasks:created",h),l.eventBus.removeEventListener("ws:message:async-tasks:progress",k),l.eventBus.removeEventListener("ws:message:async-tasks:status",w),l.eventBus.removeEventListener("ws:message:async-tasks:cancelled",E)}},[l,E,h,k,w]),(null==o?void 0:o.length)>0&&n().createElement(g,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}({tasks:o,refresh:a,popoverVisible:c,setPopoverVisible:u,hasProcessingTasks:p},i))},w=function(t){return n().createElement(e.PinnedPluginListProvider,{items:{asyncTasks:{order:300,component:"AsyncTasks",pin:!0,snippet:"*"}}},n().createElement(e.SchemaComponentOptions,{components:{AsyncTasks:k}},t.children))},E=function(){var e;function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");e="renderers",n=new Map,e in this?Object.defineProperty(this,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[e]=n}return e=[{key:"register",value:function(e,t){this.renderers.set(e,t)}},{key:"get",value:function(e){return this.renderers.get(e)}}],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)}}(t.prototype,e),t}();function x(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function _(e,t,n){return(_=S()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&T(o,n.prototype),o}).apply(null,arguments)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t="function"==typeof Map?new Map:void 0;return(P=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 _(e,arguments,O(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),T(n,e)})(e)}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}var C=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,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=O(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,S()?Reflect.construct(t,r||[],O(this).constructor):t.apply(this,r)),a="taskResultRendererManager",i=new E,a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&T(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var s=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(e){return t.app.use(w),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){x(a,r,o,i,l,"next",e)}function l(e){x(a,r,o,i,l,"throw",e)}i(void 0)})})()}}],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}(P(e.Plugin)),M=C}(),l});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.7.0-beta.
|
|
11
|
+
"@nocobase/client": "1.7.0-beta.20",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"
|
|
14
|
-
"@nocobase/
|
|
15
|
-
"@nocobase/server": "1.7.0-beta.2",
|
|
13
|
+
"@nocobase/logger": "1.7.0-beta.20",
|
|
14
|
+
"@nocobase/server": "1.7.0-beta.20",
|
|
16
15
|
"lodash": "4.17.21",
|
|
17
|
-
"@nocobase/plugin-error-handler": "1.7.0-beta.
|
|
18
|
-
"
|
|
16
|
+
"@nocobase/plugin-error-handler": "1.7.0-beta.20",
|
|
17
|
+
"antd": "5.24.2",
|
|
18
|
+
"dayjs": "1.11.13"
|
|
19
19
|
};
|
package/dist/locale/it-IT.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"Data": "Dati",
|
|
5
5
|
"Task": "Attività",
|
|
6
6
|
"Status": "Stato",
|
|
7
|
-
"Actions": "
|
|
7
|
+
"Actions": "Azioni",
|
|
8
8
|
"Created at": "Creato alle",
|
|
9
9
|
"Type": "Tipo",
|
|
10
10
|
"Waiting": "In attesa",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"Total records": "Record totali",
|
|
39
39
|
"View result": "Visualizza risultato",
|
|
40
40
|
"ImportResult": "Importati {{success}}, aggiornati {{updated}}, saltati {{skipped}}, totale {{total}}",
|
|
41
|
-
"Task result": "Risultato attività"
|
|
41
|
+
"Task result": "Risultato attività",
|
|
42
42
|
"Export {collection} attachments": "Esporta allegati {collection}",
|
|
43
43
|
"Export {collection} data": "Esporta dati {collection}",
|
|
44
44
|
"Import {collection} data": "Importa dati {collection}"
|
package/dist/locale/nl-NL.json
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Export
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
2
|
+
"Export": "Exporteer",
|
|
3
|
+
"Import": "Importeer",
|
|
4
|
+
"Data": "Data",
|
|
5
|
+
"Task": "Taak",
|
|
6
|
+
"Status": "Status",
|
|
7
|
+
"Actions": "Acties",
|
|
8
|
+
"Created at": "Aangemaakt op",
|
|
9
|
+
"Type": "Type",
|
|
10
|
+
"Waiting": "Wachten",
|
|
11
|
+
"Processing": "Verwerken",
|
|
12
|
+
"Completed": "Voltooid",
|
|
13
|
+
"Failed": "Mislukt",
|
|
14
|
+
"Cancelled": "Geannuleerd",
|
|
15
|
+
"Cancel": "Annuleren",
|
|
16
|
+
"Cancelling": "Annuleren",
|
|
17
|
+
"Download": "Downloaden",
|
|
18
|
+
"Error details": "Foutdetails",
|
|
19
|
+
"Confirm cancel": "Bevestig annuleren",
|
|
20
|
+
"Confirm cancel description": "Weet je zeker dat je deze taak wilt annuleren?",
|
|
21
|
+
"Confirm": "Bevestigen",
|
|
22
|
+
"Task cancelled": "Taak geannuleerd",
|
|
23
|
+
"Task completed": "Taak voltooid",
|
|
24
|
+
"Task failed": "Taak mislukt",
|
|
25
|
+
"Error Details": "Foutdetails",
|
|
26
|
+
"Close": "Sluiten",
|
|
27
|
+
"Error code": "Foutcode",
|
|
28
|
+
"Unknown error": "Onbekende fout",
|
|
29
|
+
"OK": "OK",
|
|
30
|
+
"Import result": "Importresultaat",
|
|
31
|
+
"Import completed": "Import voltooid: {{success}} records geïmporteerd, {{updated}} records bijgewerkt, {{skipped}} records overgeslagen, totaal {{total}} records",
|
|
32
|
+
"Import summary": "Importeer {{success}}/{{total}}",
|
|
33
|
+
"Import details": "{{success}} records zijn geïmporteerd, {{updated}} records zijn bijgewerkt, {{skipped}} records zijn overgeslagen, totaal {{total}} records",
|
|
34
|
+
"Imported": "{{count}}/{{total}}",
|
|
35
|
+
"Successfully imported": "Succesvol geïmporteerd",
|
|
36
|
+
"Updated records": "Bijgewerkte records",
|
|
37
|
+
"Skipped records": "Overgeslagen records",
|
|
38
|
+
"Total records": "Totaal aantal records",
|
|
39
|
+
"View result": "Toon",
|
|
40
|
+
"ImportResult": "{{success}} records zijn geïmporteerd, {{updated}} records zijn bijgewerkt, {{skipped}} records zijn overgeslagen, totaal {{total}} records",
|
|
41
|
+
"Task result": "Taakresultaat",
|
|
42
|
+
"Export {collection} attachments": "Exporteer {collection} bijlagen",
|
|
43
|
+
"Export {collection} data": "Exporteer {collection} gegevens",
|
|
44
|
+
"Import {collection} data": "Importeer {collection} gegevens"
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "NIL", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _nil.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "parse", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _parse.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "stringify", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _stringify.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "v1", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _v.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "v3", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _v2.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "v4", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _v3.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "v5", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _v4.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "validate", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _validate.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "version", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _version.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
var _v = _interopRequireDefault(require("./v1.js"));
|
|
62
|
+
|
|
63
|
+
var _v2 = _interopRequireDefault(require("./v3.js"));
|
|
64
|
+
|
|
65
|
+
var _v3 = _interopRequireDefault(require("./v4.js"));
|
|
66
|
+
|
|
67
|
+
var _v4 = _interopRequireDefault(require("./v5.js"));
|
|
68
|
+
|
|
69
|
+
var _nil = _interopRequireDefault(require("./nil.js"));
|
|
70
|
+
|
|
71
|
+
var _version = _interopRequireDefault(require("./version.js"));
|
|
72
|
+
|
|
73
|
+
var _validate = _interopRequireDefault(require("./validate.js"));
|
|
74
|
+
|
|
75
|
+
var _stringify = _interopRequireDefault(require("./stringify.js"));
|
|
76
|
+
|
|
77
|
+
var _parse = _interopRequireDefault(require("./parse.js"));
|
|
78
|
+
|
|
79
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Browser-compatible JavaScript MD5
|
|
10
|
+
*
|
|
11
|
+
* Modification of JavaScript MD5
|
|
12
|
+
* https://github.com/blueimp/JavaScript-MD5
|
|
13
|
+
*
|
|
14
|
+
* Copyright 2011, Sebastian Tschan
|
|
15
|
+
* https://blueimp.net
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the MIT license:
|
|
18
|
+
* https://opensource.org/licenses/MIT
|
|
19
|
+
*
|
|
20
|
+
* Based on
|
|
21
|
+
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
|
22
|
+
* Digest Algorithm, as defined in RFC 1321.
|
|
23
|
+
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
|
24
|
+
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
|
25
|
+
* Distributed under the BSD License
|
|
26
|
+
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
27
|
+
*/
|
|
28
|
+
function md5(bytes) {
|
|
29
|
+
if (typeof bytes === 'string') {
|
|
30
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
31
|
+
|
|
32
|
+
bytes = new Uint8Array(msg.length);
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
35
|
+
bytes[i] = msg.charCodeAt(i);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
|
40
|
+
}
|
|
41
|
+
/*
|
|
42
|
+
* Convert an array of little-endian words to an array of bytes
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function md5ToHexEncodedArray(input) {
|
|
47
|
+
const output = [];
|
|
48
|
+
const length32 = input.length * 32;
|
|
49
|
+
const hexTab = '0123456789abcdef';
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < length32; i += 8) {
|
|
52
|
+
const x = input[i >> 5] >>> i % 32 & 0xff;
|
|
53
|
+
const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
54
|
+
output.push(hex);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return output;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Calculate output length with padding and bit length
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function getOutputLength(inputLength8) {
|
|
65
|
+
return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
|
|
66
|
+
}
|
|
67
|
+
/*
|
|
68
|
+
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function wordsToMd5(x, len) {
|
|
73
|
+
/* append padding */
|
|
74
|
+
x[len >> 5] |= 0x80 << len % 32;
|
|
75
|
+
x[getOutputLength(len) - 1] = len;
|
|
76
|
+
let a = 1732584193;
|
|
77
|
+
let b = -271733879;
|
|
78
|
+
let c = -1732584194;
|
|
79
|
+
let d = 271733878;
|
|
80
|
+
|
|
81
|
+
for (let i = 0; i < x.length; i += 16) {
|
|
82
|
+
const olda = a;
|
|
83
|
+
const oldb = b;
|
|
84
|
+
const oldc = c;
|
|
85
|
+
const oldd = d;
|
|
86
|
+
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
87
|
+
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
88
|
+
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
89
|
+
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
90
|
+
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
91
|
+
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
92
|
+
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
93
|
+
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
94
|
+
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
95
|
+
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
96
|
+
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
97
|
+
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
98
|
+
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
99
|
+
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
100
|
+
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
101
|
+
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
102
|
+
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
103
|
+
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
104
|
+
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
105
|
+
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
106
|
+
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
107
|
+
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
108
|
+
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
109
|
+
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
110
|
+
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
111
|
+
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
112
|
+
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
113
|
+
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
114
|
+
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
115
|
+
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
116
|
+
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
117
|
+
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
118
|
+
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
119
|
+
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
120
|
+
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
121
|
+
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
122
|
+
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
123
|
+
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
124
|
+
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
125
|
+
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
126
|
+
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
127
|
+
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
128
|
+
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
129
|
+
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
130
|
+
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
131
|
+
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
132
|
+
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
133
|
+
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
134
|
+
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
135
|
+
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
136
|
+
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
137
|
+
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
138
|
+
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
139
|
+
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
140
|
+
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
141
|
+
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
142
|
+
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
143
|
+
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
144
|
+
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
145
|
+
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
146
|
+
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
147
|
+
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
148
|
+
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
149
|
+
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
150
|
+
a = safeAdd(a, olda);
|
|
151
|
+
b = safeAdd(b, oldb);
|
|
152
|
+
c = safeAdd(c, oldc);
|
|
153
|
+
d = safeAdd(d, oldd);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return [a, b, c, d];
|
|
157
|
+
}
|
|
158
|
+
/*
|
|
159
|
+
* Convert an array bytes to an array of little-endian words
|
|
160
|
+
* Characters >255 have their high-byte silently ignored.
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
function bytesToWords(input) {
|
|
165
|
+
if (input.length === 0) {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const length8 = input.length * 8;
|
|
170
|
+
const output = new Uint32Array(getOutputLength(length8));
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i < length8; i += 8) {
|
|
173
|
+
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return output;
|
|
177
|
+
}
|
|
178
|
+
/*
|
|
179
|
+
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
180
|
+
* to work around bugs in some JS interpreters.
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
function safeAdd(x, y) {
|
|
185
|
+
const lsw = (x & 0xffff) + (y & 0xffff);
|
|
186
|
+
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
187
|
+
return msw << 16 | lsw & 0xffff;
|
|
188
|
+
}
|
|
189
|
+
/*
|
|
190
|
+
* Bitwise rotate a 32-bit number to the left.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
function bitRotateLeft(num, cnt) {
|
|
195
|
+
return num << cnt | num >>> 32 - cnt;
|
|
196
|
+
}
|
|
197
|
+
/*
|
|
198
|
+
* These functions implement the four basic operations the algorithm uses.
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
function md5cmn(q, a, b, x, s, t) {
|
|
203
|
+
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function md5ff(a, b, c, d, x, s, t) {
|
|
207
|
+
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function md5gg(a, b, c, d, x, s, t) {
|
|
211
|
+
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function md5hh(a, b, c, d, x, s, t) {
|
|
215
|
+
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function md5ii(a, b, c, d, x, s, t) {
|
|
219
|
+
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
var _default = md5;
|
|
223
|
+
exports.default = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
8
|
+
var _default = {
|
|
9
|
+
randomUUID
|
|
10
|
+
};
|
|
11
|
+
exports.default = _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _validate = _interopRequireDefault(require("./validate.js"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function parse(uuid) {
|
|
13
|
+
if (!(0, _validate.default)(uuid)) {
|
|
14
|
+
throw TypeError('Invalid UUID');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let v;
|
|
18
|
+
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
19
|
+
|
|
20
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
21
|
+
arr[1] = v >>> 16 & 0xff;
|
|
22
|
+
arr[2] = v >>> 8 & 0xff;
|
|
23
|
+
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
24
|
+
|
|
25
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
26
|
+
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
27
|
+
|
|
28
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
29
|
+
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
30
|
+
|
|
31
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
32
|
+
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
33
|
+
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
34
|
+
|
|
35
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
36
|
+
arr[11] = v / 0x100000000 & 0xff;
|
|
37
|
+
arr[12] = v >>> 24 & 0xff;
|
|
38
|
+
arr[13] = v >>> 16 & 0xff;
|
|
39
|
+
arr[14] = v >>> 8 & 0xff;
|
|
40
|
+
arr[15] = v & 0xff;
|
|
41
|
+
return arr;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var _default = parse;
|
|
45
|
+
exports.default = _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
8
|
+
exports.default = _default;
|