@nocobase/plugin-async-task-manager 1.7.0-beta.16 → 1.7.0-beta.18
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/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -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/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/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("@nocobase/client"),require("dayjs"),require("react"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-async-task-manager",["@nocobase/client","dayjs","react","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-async-task-manager"]=t(require("@nocobase/client"),require("dayjs"),require("react"),require("antd")):e["@nocobase/plugin-async-task-manager"]=t(e["@nocobase/client"],e.dayjs,e.react,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,i,l){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=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=d[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)}}},e.exports=n()},772:function(t){"use strict";t.exports=e},721:function(e){"use strict";e.exports=r},760:function(e){"use strict";e.exports=t},156:function(e){"use strict";e.exports=n}},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,{default:function(){return Y},PluginAsyncExportClient:function(){return j}});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 d(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 p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){d(a,r,o,i,l,"next",e)}function l(e){d(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){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}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,l])}}}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)||void 0===a?void 0:null===(o=a.message)||void 0===o?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,d=t.hasProcessingTasks,y=(0,e.useApp)(),b=(0,e.useAPIClient)(),g=(0,e.useCurrentAppInfo)();var 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?void 0:e.current)/(null===(a=o.progress)||void 0===a?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?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:p(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?void 0:null===(e=o.title)||void 0===e?void 0:e.actionType)==="export-attachments"?"-attachments.zip":".xlsx",s="".concat(i).concat(l),c=(null==o?void 0:null===(t=o.title)||void 0===t?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?void 0:null===(n=g.data)||void 0===n?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?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:d}),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++){if(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),d=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)(p(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,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}({tasks:o,refresh:a,popoverVisible:c,setPopoverVisible:u,hasProcessingTasks:d},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))};function E(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(e.prototype,t),r}();function _(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 O(e,t,n){return(O=M()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&S(o,n.prototype),o}).apply(null,arguments)}function T(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 S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){var t="function"==typeof Map?new Map:void 0;return(C=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 O(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),S(r,e)})(e)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var j=function(e){var t,n,r;function o(){var e,t,n,r,a,i,l;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,M()?Reflect.construct(n,r||[],P(t).constructor):n.apply(t,r)),i="taskResultRendererManager",l=new x,i in a?Object.defineProperty(a,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[i]=l,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&&S(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,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){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}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,l])}}}(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){_(a,r,o,i,l,"next",e)}function l(e){_(a,r,o,i,l,"throw",e)}i(void 0)})})()}}],T(t.prototype,n),o}(C(e.Plugin)),Y=j}(),l}()});
|
|
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.18",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/logger": "1.7.0-beta.
|
|
14
|
-
"@nocobase/server": "1.7.0-beta.
|
|
13
|
+
"@nocobase/logger": "1.7.0-beta.18",
|
|
14
|
+
"@nocobase/server": "1.7.0-beta.18",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
|
-
"@nocobase/plugin-error-handler": "1.7.0-beta.
|
|
16
|
+
"@nocobase/plugin-error-handler": "1.7.0-beta.18",
|
|
17
17
|
"antd": "5.24.2",
|
|
18
18
|
"dayjs": "1.11.13"
|
|
19
19
|
};
|
|
@@ -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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = rng;
|
|
7
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
8
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
9
|
+
// generators (like Math.random()).
|
|
10
|
+
let getRandomValues;
|
|
11
|
+
const rnds8 = new Uint8Array(16);
|
|
12
|
+
|
|
13
|
+
function rng() {
|
|
14
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
15
|
+
if (!getRandomValues) {
|
|
16
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
17
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
18
|
+
|
|
19
|
+
if (!getRandomValues) {
|
|
20
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return getRandomValues(rnds8);
|
|
25
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
// Adapted from Chris Veness' SHA1 code at
|
|
9
|
+
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
10
|
+
function f(s, x, y, z) {
|
|
11
|
+
switch (s) {
|
|
12
|
+
case 0:
|
|
13
|
+
return x & y ^ ~x & z;
|
|
14
|
+
|
|
15
|
+
case 1:
|
|
16
|
+
return x ^ y ^ z;
|
|
17
|
+
|
|
18
|
+
case 2:
|
|
19
|
+
return x & y ^ x & z ^ y & z;
|
|
20
|
+
|
|
21
|
+
case 3:
|
|
22
|
+
return x ^ y ^ z;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ROTL(x, n) {
|
|
27
|
+
return x << n | x >>> 32 - n;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function sha1(bytes) {
|
|
31
|
+
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
32
|
+
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
33
|
+
|
|
34
|
+
if (typeof bytes === 'string') {
|
|
35
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
36
|
+
|
|
37
|
+
bytes = [];
|
|
38
|
+
|
|
39
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
40
|
+
bytes.push(msg.charCodeAt(i));
|
|
41
|
+
}
|
|
42
|
+
} else if (!Array.isArray(bytes)) {
|
|
43
|
+
// Convert Array-like to Array
|
|
44
|
+
bytes = Array.prototype.slice.call(bytes);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
bytes.push(0x80);
|
|
48
|
+
const l = bytes.length / 4 + 2;
|
|
49
|
+
const N = Math.ceil(l / 16);
|
|
50
|
+
const M = new Array(N);
|
|
51
|
+
|
|
52
|
+
for (let i = 0; i < N; ++i) {
|
|
53
|
+
const arr = new Uint32Array(16);
|
|
54
|
+
|
|
55
|
+
for (let j = 0; j < 16; ++j) {
|
|
56
|
+
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
M[i] = arr;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
63
|
+
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
64
|
+
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
65
|
+
|
|
66
|
+
for (let i = 0; i < N; ++i) {
|
|
67
|
+
const W = new Uint32Array(80);
|
|
68
|
+
|
|
69
|
+
for (let t = 0; t < 16; ++t) {
|
|
70
|
+
W[t] = M[i][t];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
for (let t = 16; t < 80; ++t) {
|
|
74
|
+
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let a = H[0];
|
|
78
|
+
let b = H[1];
|
|
79
|
+
let c = H[2];
|
|
80
|
+
let d = H[3];
|
|
81
|
+
let e = H[4];
|
|
82
|
+
|
|
83
|
+
for (let t = 0; t < 80; ++t) {
|
|
84
|
+
const s = Math.floor(t / 20);
|
|
85
|
+
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
86
|
+
e = d;
|
|
87
|
+
d = c;
|
|
88
|
+
c = ROTL(b, 30) >>> 0;
|
|
89
|
+
b = a;
|
|
90
|
+
a = T;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
H[0] = H[0] + a >>> 0;
|
|
94
|
+
H[1] = H[1] + b >>> 0;
|
|
95
|
+
H[2] = H[2] + c >>> 0;
|
|
96
|
+
H[3] = H[3] + d >>> 0;
|
|
97
|
+
H[4] = H[4] + e >>> 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var _default = sha1;
|
|
104
|
+
exports.default = _default;
|