@nocobase/plugin-async-task-manager 1.5.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 +159 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/AsyncTaskManagerProvider.d.ts +4 -0
- package/dist/client/TaskResultRendererManager.d.ts +6 -0
- package/dist/client/components/AsyncTasks.d.ts +3 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +2 -0
- package/dist/externalVersion.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +5 -0
- package/dist/locale/zh-CN.json +45 -0
- package/dist/node_modules/uuid/AUTHORS +5 -0
- package/dist/node_modules/uuid/bin/uuid +65 -0
- package/dist/node_modules/uuid/index.js +1 -0
- package/dist/node_modules/uuid/lib/bytesToUuid.js +26 -0
- package/dist/node_modules/uuid/lib/md5-browser.js +216 -0
- package/dist/node_modules/uuid/lib/md5.js +25 -0
- package/dist/node_modules/uuid/lib/rng-browser.js +34 -0
- package/dist/node_modules/uuid/lib/rng.js +8 -0
- package/dist/node_modules/uuid/lib/sha1-browser.js +89 -0
- package/dist/node_modules/uuid/lib/sha1.js +25 -0
- package/dist/node_modules/uuid/lib/v35.js +57 -0
- package/dist/node_modules/uuid/package.json +1 -0
- package/dist/node_modules/uuid/v1.js +109 -0
- package/dist/node_modules/uuid/v3.js +4 -0
- package/dist/node_modules/uuid/v4.js +29 -0
- package/dist/node_modules/uuid/v5.js +3 -0
- package/dist/server/base-task-manager.d.ts +23 -0
- package/dist/server/base-task-manager.js +135 -0
- package/dist/server/command-task-type.d.ts +8 -0
- package/dist/server/command-task-type.js +121 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +50 -0
- package/dist/server/interfaces/async-task-manager.d.ts +58 -0
- package/dist/server/interfaces/async-task-manager.js +41 -0
- package/dist/server/interfaces/task.d.ts +37 -0
- package/dist/server/interfaces/task.js +24 -0
- package/dist/server/plugin.d.ts +7 -0
- package/dist/server/plugin.js +163 -0
- package/dist/server/resourcers/async-tasks.d.ts +8 -0
- package/dist/server/resourcers/async-tasks.js +73 -0
- package/dist/server/static-import.d.ts +1 -0
- package/dist/server/static-import.js +39 -0
- package/dist/server/task-type.d.ts +93 -0
- package/dist/server/task-type.js +197 -0
- package/package.json +16 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Updated Date: October 15, 2024
|
|
2
|
+
|
|
3
|
+
NocoBase License Agreement
|
|
4
|
+
|
|
5
|
+
NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at #03-01 ROBINSON 112 ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("the User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
|
|
6
|
+
|
|
7
|
+
This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
|
|
8
|
+
|
|
9
|
+
The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
|
|
10
|
+
|
|
11
|
+
==============
|
|
12
|
+
1. Definitions
|
|
13
|
+
==============
|
|
14
|
+
|
|
15
|
+
1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
|
|
16
|
+
|
|
17
|
+
1.2 "Community Edition" refers to the free version of the Software provided to the User through public channels.
|
|
18
|
+
|
|
19
|
+
1.3 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. It consists of three versions: Standard Edition, Professional Edition, and Enterprise Edition.
|
|
20
|
+
|
|
21
|
+
1.4 "Marketplace" refers to the marketplace provided by the Company for selling Software plugins and solutions.
|
|
22
|
+
|
|
23
|
+
1.5 "Commercial Plugin" refers to the paid plugins sold in the Marketplace.
|
|
24
|
+
|
|
25
|
+
1.6 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
|
|
26
|
+
|
|
27
|
+
1.7 "Customer" refers to the clients who purchase the User's Upper Layer Application.
|
|
28
|
+
|
|
29
|
+
1.8 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
|
|
30
|
+
|
|
31
|
+
===================================
|
|
32
|
+
2. Intellectual Property Protection
|
|
33
|
+
===================================
|
|
34
|
+
|
|
35
|
+
Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
|
|
36
|
+
|
|
37
|
+
=============
|
|
38
|
+
3. Disclaimer
|
|
39
|
+
=============
|
|
40
|
+
|
|
41
|
+
3.1 The User shall not use the Software and Commercial Plugins to engage in activities that violate local laws and regulations, religious beliefs. All legal responsibilities and legal consequences arising from the use of Software and Commercial Plugins shall be borne by the User.
|
|
42
|
+
|
|
43
|
+
3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
|
|
44
|
+
|
|
45
|
+
===============
|
|
46
|
+
4. License Type
|
|
47
|
+
===============
|
|
48
|
+
|
|
49
|
+
4.1 The Software uses a dual license type of AGPL-3.0 Open Source License https://www.gnu.org/licenses/agpl-3..en.htm and Commercial License.
|
|
50
|
+
|
|
51
|
+
4.2 The Community Edition uses the AGPL-3.0 Open Source License https://www.gnu.org/licenses/agpl-3.0.en.html.
|
|
52
|
+
|
|
53
|
+
4.3 The Commercial Edition (including Standard, Professional, and Enterprise Editions) uses the Commercial License.
|
|
54
|
+
|
|
55
|
+
4.4 Commercial Plugins use the Commercial Plugin License.
|
|
56
|
+
|
|
57
|
+
================================================
|
|
58
|
+
5. Rights and Obligations of Open Source License
|
|
59
|
+
================================================
|
|
60
|
+
|
|
61
|
+
5.1 The Software can be used for commercial purposes.
|
|
62
|
+
|
|
63
|
+
5.2 The User can sell plugins developed for the Software in the Marketplace.
|
|
64
|
+
|
|
65
|
+
5.3 Outside the Marketplace, changes and plugins to the Software developed by the User or third parties, and third-party applications developed based on the Software must all be open-sourced under the AGPL-3.0 license.
|
|
66
|
+
|
|
67
|
+
5.4 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
|
|
68
|
+
|
|
69
|
+
5.5 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
70
|
+
|
|
71
|
+
5.6 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.
|
|
72
|
+
|
|
73
|
+
5.7 Comply with all requirements of the AGPL-3.0 agreement.
|
|
74
|
+
|
|
75
|
+
===============================
|
|
76
|
+
6. Rights of Commercial License
|
|
77
|
+
===============================
|
|
78
|
+
|
|
79
|
+
6.1 Obtain a permanent commercial license of the Software.
|
|
80
|
+
|
|
81
|
+
6.2 Get 12 months of upgrade and exclusive technical support.
|
|
82
|
+
|
|
83
|
+
6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
|
|
84
|
+
|
|
85
|
+
6.4 Changes and plugins to the Software, and applications integrated with the Software do not need to be open sourced.
|
|
86
|
+
|
|
87
|
+
6.5 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
|
|
88
|
+
|
|
89
|
+
6.6 Can sell plugins developed for Software in the Marketplace.
|
|
90
|
+
|
|
91
|
+
6.7 The User with a Professional or Enterprise Edition License can sell Upper Layer Application to their clients.
|
|
92
|
+
|
|
93
|
+
6.8 Not restricted by the AGPL-3.0 agreement.
|
|
94
|
+
|
|
95
|
+
6.9 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
|
|
96
|
+
|
|
97
|
+
====================================
|
|
98
|
+
7. Obligations of Commercial License
|
|
99
|
+
====================================
|
|
100
|
+
|
|
101
|
+
7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
102
|
+
|
|
103
|
+
7.2 It is not allowed to sell, transfer, lease, share, or distribute the Commercial License.
|
|
104
|
+
|
|
105
|
+
7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code platform, or developer tools developed based on Software.
|
|
106
|
+
|
|
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
|
+
|
|
109
|
+
7.5 It is not allowed for the User with a Standard Edition license to sell Upper Layer Application to clients without a Commercial license.
|
|
110
|
+
|
|
111
|
+
7.6 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
|
|
112
|
+
|
|
113
|
+
7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
114
|
+
|
|
115
|
+
7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
116
|
+
|
|
117
|
+
======================================
|
|
118
|
+
8. Rights of Commercial Plugin License
|
|
119
|
+
======================================
|
|
120
|
+
|
|
121
|
+
8.1 Obtain a permanent Commercial Plugin License for the Commercial Plugin.
|
|
122
|
+
|
|
123
|
+
8.2 Receive 12 months of upgrades and exclusive technical support.
|
|
124
|
+
|
|
125
|
+
8.3 Can be used for commercial purposes without restrictions on the number of applications or users.
|
|
126
|
+
|
|
127
|
+
8.4 The User with a Professional or Enterprise Edition License can use the Commercial Plugin in Upper Layer Applications sold to their customers.
|
|
128
|
+
|
|
129
|
+
8.5 Not restricted by the AGPL-3.0 agreement.
|
|
130
|
+
|
|
131
|
+
8.6 If there are other agreements in the contract regarding the above rights, the contract agreement shall prevail.
|
|
132
|
+
|
|
133
|
+
===========================================
|
|
134
|
+
9. Obligations of Commercial Plugin License
|
|
135
|
+
===========================================
|
|
136
|
+
|
|
137
|
+
9.1 It is not allowed to remove or change any intellectual property statements about NocoBase and the plugin authors in the code.
|
|
138
|
+
|
|
139
|
+
9.2 It is not allowed to sell, transfer, lease, share, or gift the Commercial Plugin.
|
|
140
|
+
|
|
141
|
+
9.3 It is not allowed to use reverse engineering, decompilation, or other methods to attempt to discover the source code of Commercial Plugins without obtaining a source code license.
|
|
142
|
+
|
|
143
|
+
9.4 It is not allowed to disclose the source code of Commercial Plugins to any third party.
|
|
144
|
+
|
|
145
|
+
9.5 If there is any violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
146
|
+
|
|
147
|
+
9.6 If there are other agreements in the contract regarding the above obligations, the contract agreement shall prevail.
|
|
148
|
+
|
|
149
|
+
=============================================================
|
|
150
|
+
10. Legal Jurisdiction, Interpretation, and Dispute Resolution
|
|
151
|
+
=============================================================
|
|
152
|
+
|
|
153
|
+
10.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
|
|
154
|
+
|
|
155
|
+
10.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
|
|
156
|
+
|
|
157
|
+
10.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
|
|
158
|
+
|
|
159
|
+
10.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @nocobase/plugin-async-export
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
import { TaskResultRendererManager } from './TaskResultRendererManager';
|
|
3
|
+
export declare class PluginAsyncExportClient extends Plugin {
|
|
4
|
+
taskResultRendererManager: TaskResultRendererManager;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export default PluginAsyncExportClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("@nocobase/client"),require("dayjs"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-async-task-manager",["antd","@nocobase/client","dayjs","react"],t):"object"==typeof exports?exports["@nocobase/plugin-async-task-manager"]=t(require("antd"),require("@nocobase/client"),require("dayjs"),require("react")):e["@nocobase/plugin-async-task-manager"]=t(e.antd,e["@nocobase/client"],e.dayjs,e.react)}(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(t){"use strict";t.exports=e},760:function(e){"use strict";e.exports=n},156:function(e){"use strict";e.exports=r}},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 I},PluginAsyncExportClient:function(){return Y}});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"]})}}a().extend(u());var d=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)))},p=function(){var o=w(),s=o.tasks,i=o.popoverVisible,c=o.setPopoverVisible,u=o.hasProcessingTasks,l=o.cancellingTasks,p=o.modalVisible,y=o.setModalVisible,m=o.currentError,v=o.setCurrentError,b=o.resultModalVisible,h=o.setResultModalVisible,g=o.currentTask,k=o.setCurrentTask,E=o.handleCancelTask,O=(0,e.usePlugin)("async-task-manager"),_=(0,e.useApp)(),x=f();(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 S=function(e){k(e),h(!0),c(!1)},T=[{title:x("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:x("Task"),dataIndex:"title",key:"title",render:function(e,t){var n=t.title;if(!n)return"-";var r={export:x("Export"),import:x("Import"),"export-attachments":x("Export attachments")}[n.actionType]||n.actionType;return(({"export-attachments":x("Export {collection} attachments"),export:x("Export {collection} data"),import:x("Import {collection} data")})[n.actionType]||"".concat(r," ").concat(n.collection," ").concat(x("Data"))).replace("{collection}",n.collection)}},{title:x("Status"),dataIndex:"status",key:"status",width:160,render:function(t,o){var a,s={pending:{color:"default",text:x("Waiting"),icon:"ClockCircleOutlined"},running:{color:"processing",text:x("Processing"),icon:"LoadingOutlined"},success:{color:"success",text:x("Completed"),icon:"CheckCircleOutlined"},failed:{color:"error",text:x("Failed"),icon:"CloseCircleOutlined"},cancelled:{color:"warning",text:x("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}}),d(t,x))}},{title:x("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)&&a.push(n().createElement(r.Popconfirm,{key:"cancel",title:x("Confirm cancel"),description:x("Confirm cancel description"),onConfirm:function(){return E(o.taskId)},okText:x("Confirm"),cancelText:x("Cancel"),disabled:s},n().createElement(r.Button,{type:"link",size:"small",icon:n().createElement(e.Icon,{type:s?"LoadingOutlined":"StopOutlined"}),disabled:s},s?x("Cancelling"):x("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=_.apiClient.auth.token,t=_.getApiUrl("asyncTasks:fetchFile/".concat(o.taskId,"?token=").concat(e,"&__appName=").concat(_.name));window.open(t)}},x("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 S(o)}},x("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(){v(o.status.errors),y(!0),c(!1)}},x("Error details"))),n().createElement(r.Space,{size:"middle"},a)}}],C=n().createElement("div",{style:{width:s.length>0?800:200}},s.length>0?n().createElement(r.Table,{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:x("No tasks"),image:r.Empty.PRESENTED_IMAGE_SIMPLE})));return n().createElement(n().Fragment,null,n().createElement(r.Popover,{content:C,trigger:"hover",placement:"bottom",open:i,onOpenChange:c},n().createElement(r.Button,{className:"sync-task-button",icon:n().createElement(e.Icon,{type:"SyncOutlined",spin:u}),onClick:function(){return c(!i)}})),function(){if(!!g){var e=g.status.payload,t=O.taskResultRendererManager.get(g.title.actionType);return n().createElement(r.Modal,{title:x("Task result"),open:b,footer:[n().createElement(r.Button,{key:"close",onClick:function(){return h(!1)}},x("Close"))],onCancel:function(){return h(!1)}},t?n().createElement(t,{payload:e,task:g}):n().createElement("div",null,x("No renderer available for this task type, payload: ".concat(e))))}}(),n().createElement(r.Modal,{title:x("Error Details"),open:p,onCancel:function(){return y(!1)},footer:[n().createElement(r.Button,{key:"ok",type:"primary",onClick:function(){return y(!1)}},x("OK"))],width:400},null==m?void 0:m.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}},x("Error code"),": ",e.code))})))};function y(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 m(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 v(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 b(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 h(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)||g(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 g(e,t){if(e){if("string"==typeof e)return y(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 y(e,t)}}var k=(0,t.createContext)(null),w=function(){var e=(0,t.useContext)(k);if(!e)throw Error("useAsyncTask must be used within AsyncTaskManagerProvider");return e},E=function(o){var a,s,i=(0,e.useApp)(),c=f(),u=h((0,t.useState)([]),2),l=u[0],d=u[1],w=h((0,t.useState)(!1),2),E=w[0],O=w[1],_=h((0,t.useState)(!1),2),x=_[0],S=_[1],T=h((0,t.useState)(new Set),2),C=T[0],P=T[1],M=h((0,t.useState)(!1),2),j=M[0],Y=M[1],I=h((0,t.useState)(null),2),L=I[0],A=I[1],B=h((0,t.useState)(!1),2),D=B[0],z=B[1],V=h((0,t.useState)(null),2),q=V[0],N=V[1],R=h((0,t.useState)(function(){return i.isWsAuthorized}),2),H=R[0],F=R[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 y(e)}(n=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||g(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?b(v({},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")),b(v({},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),H&&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,H]);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){m(o,n,r,s,i,"next",e)}function i(e){m(o,n,r,s,i,"throw",e)}s(void 0)})}),function(e){return s.apply(this,arguments)});return n().createElement(k.Provider,{value:{tasks:l,popoverVisible:E,setPopoverVisible:O,hasProcessingTasks:x,cancellingTasks:C,modalVisible:j,setModalVisible:Y,currentError:L,setCurrentError:A,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:p}},o.children)))};function O(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 _=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)}}],O(e.prototype,t),r}();function x(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 S(e,t,n){return(S=j()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&P(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 C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e){var t="function"==typeof Map?new Map:void 0;return(M=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 S(e,arguments,C(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),P(r,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}var Y=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=C(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,j()?Reflect.construct(n,r||[],C(t).constructor):n.apply(t,r)),s="taskResultRendererManager",i=new _,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&&P(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(E),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function s(e){x(a,r,o,s,i,"next",e)}function i(e){x(a,r,o,s,i,"throw",e)}s(void 0)})})()}}],T(t.prototype,n),o}(M(e.Plugin)),I=Y}(),i}()});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
"@nocobase/client": "1.5.0-beta.20",
|
|
12
|
+
"react": "18.2.0",
|
|
13
|
+
"antd": "5.12.8",
|
|
14
|
+
"@nocobase/logger": "1.5.0-beta.20",
|
|
15
|
+
"@nocobase/server": "1.5.0-beta.20",
|
|
16
|
+
"@nocobase/plugin-error-handler": "1.5.0-beta.20",
|
|
17
|
+
"@ant-design/icons": "5.2.6",
|
|
18
|
+
"dayjs": "1.11.10"
|
|
19
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
default: () => import_server.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
43
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
+
var import_server = __toESM(require("./server"));
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
...require("./server")
|
|
48
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Export": "导出",
|
|
3
|
+
"Import": "导入",
|
|
4
|
+
"Data": "数据",
|
|
5
|
+
"Task": "任务",
|
|
6
|
+
"Status": "状态",
|
|
7
|
+
"Actions": "操作",
|
|
8
|
+
"Created at": "创建时间",
|
|
9
|
+
"Type": "类型",
|
|
10
|
+
"Waiting": "等待中",
|
|
11
|
+
"Processing": "进行中",
|
|
12
|
+
"Completed": "已完成",
|
|
13
|
+
"Failed": "执行失败",
|
|
14
|
+
"Cancelled": "已取消",
|
|
15
|
+
"Cancel": "取消",
|
|
16
|
+
"Cancelling": "取消中",
|
|
17
|
+
"Download": "下载",
|
|
18
|
+
"Error details": "错误详情",
|
|
19
|
+
"Confirm cancel": "确认取消",
|
|
20
|
+
"Confirm cancel description": "确定要取消这个任务吗?",
|
|
21
|
+
"Confirm": "确定",
|
|
22
|
+
"Task cancelled": "任务已取消",
|
|
23
|
+
"Task completed": "任务已完成",
|
|
24
|
+
"Task failed": "任务执行失败",
|
|
25
|
+
"Error Details": "错误详情",
|
|
26
|
+
"Close": "关闭",
|
|
27
|
+
"Error code": "错误代码",
|
|
28
|
+
"Unknown error": "未知错误",
|
|
29
|
+
"OK": "确定",
|
|
30
|
+
"Import result": "导入结果",
|
|
31
|
+
"Import completed": "导入完成:{{success}} 条记录已导入,{{updated}} 条记录已更新,{{skipped}} 条记录已跳过,共 {{total}} 条记录",
|
|
32
|
+
"Import summary": "已导入 {{success}}/{{total}} 条记录",
|
|
33
|
+
"Import details": "成功导入 {{success}} 条,更新 {{updated}} 条,跳过 {{skipped}} 条,共 {{total}} 条",
|
|
34
|
+
"Imported": "已导入 {{count}}/{{total}}",
|
|
35
|
+
"Successfully imported": "成功导入",
|
|
36
|
+
"Updated records": "已更新记录",
|
|
37
|
+
"Skipped records": "已跳过记录",
|
|
38
|
+
"Total records": "总记录数",
|
|
39
|
+
"View result": "查看结果",
|
|
40
|
+
"ImportResult": "已导入 {{success}} 条,更新 {{updated}} 条,跳过 {{skipped}} 条,共 {{total}} 条",
|
|
41
|
+
"Task result": "任务结果",
|
|
42
|
+
"Export {collection} attachments": "导出{collection}附件",
|
|
43
|
+
"Export {collection} data": "导出{collection}记录",
|
|
44
|
+
"Import {collection} data": "导入{collection}数据"
|
|
45
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var assert = require('assert');
|
|
3
|
+
|
|
4
|
+
function usage() {
|
|
5
|
+
console.log('Usage:');
|
|
6
|
+
console.log(' uuid');
|
|
7
|
+
console.log(' uuid v1');
|
|
8
|
+
console.log(' uuid v3 <name> <namespace uuid>');
|
|
9
|
+
console.log(' uuid v4');
|
|
10
|
+
console.log(' uuid v5 <name> <namespace uuid>');
|
|
11
|
+
console.log(' uuid --help');
|
|
12
|
+
console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var args = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
if (args.indexOf('--help') >= 0) {
|
|
18
|
+
usage();
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
var version = args.shift() || 'v4';
|
|
22
|
+
|
|
23
|
+
switch (version) {
|
|
24
|
+
case 'v1':
|
|
25
|
+
var uuidV1 = require('../v1');
|
|
26
|
+
console.log(uuidV1());
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
case 'v3':
|
|
30
|
+
var uuidV3 = require('../v3');
|
|
31
|
+
|
|
32
|
+
var name = args.shift();
|
|
33
|
+
var namespace = args.shift();
|
|
34
|
+
assert(name != null, 'v3 name not specified');
|
|
35
|
+
assert(namespace != null, 'v3 namespace not specified');
|
|
36
|
+
|
|
37
|
+
if (namespace == 'URL') namespace = uuidV3.URL;
|
|
38
|
+
if (namespace == 'DNS') namespace = uuidV3.DNS;
|
|
39
|
+
|
|
40
|
+
console.log(uuidV3(name, namespace));
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
case 'v4':
|
|
44
|
+
var uuidV4 = require('../v4');
|
|
45
|
+
console.log(uuidV4());
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case 'v5':
|
|
49
|
+
var uuidV5 = require('../v5');
|
|
50
|
+
|
|
51
|
+
var name = args.shift();
|
|
52
|
+
var namespace = args.shift();
|
|
53
|
+
assert(name != null, 'v5 name not specified');
|
|
54
|
+
assert(namespace != null, 'v5 namespace not specified');
|
|
55
|
+
|
|
56
|
+
if (namespace == 'URL') namespace = uuidV5.URL;
|
|
57
|
+
if (namespace == 'DNS') namespace = uuidV5.DNS;
|
|
58
|
+
|
|
59
|
+
console.log(uuidV5(name, namespace));
|
|
60
|
+
break;
|
|
61
|
+
|
|
62
|
+
default:
|
|
63
|
+
usage();
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var r={155:function(r,e,n){var a=n(749);var t=n(824);var i=t;i.v1=a;i.v4=t;r.exports=i},707:function(r){var e=[];for(var n=0;n<256;++n){e[n]=(n+256).toString(16).substr(1)}function bytesToUuid(r,n){var a=n||0;var t=e;return[t[r[a++]],t[r[a++]],t[r[a++]],t[r[a++]],"-",t[r[a++]],t[r[a++]],"-",t[r[a++]],t[r[a++]],"-",t[r[a++]],t[r[a++]],"-",t[r[a++]],t[r[a++]],t[r[a++]],t[r[a++]],t[r[a++]],t[r[a++]]].join("")}r.exports=bytesToUuid},859:function(r,e,n){var a=n(113);r.exports=function nodeRNG(){return a.randomBytes(16)}},749:function(r,e,n){var a=n(859);var t=n(707);var i;var u;var o=0;var v=0;function v1(r,e,n){var f=e&&n||0;var s=e||[];r=r||{};var c=r.node||i;var _=r.clockseq!==undefined?r.clockseq:u;if(c==null||_==null){var d=a();if(c==null){c=i=[d[0]|1,d[1],d[2],d[3],d[4],d[5]]}if(_==null){_=u=(d[6]<<8|d[7])&16383}}var l=r.msecs!==undefined?r.msecs:(new Date).getTime();var p=r.nsecs!==undefined?r.nsecs:v+1;var x=l-o+(p-v)/1e4;if(x<0&&r.clockseq===undefined){_=_+1&16383}if((x<0||l>o)&&r.nsecs===undefined){p=0}if(p>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}o=l;v=p;u=_;l+=122192928e5;var b=((l&268435455)*1e4+p)%4294967296;s[f++]=b>>>24&255;s[f++]=b>>>16&255;s[f++]=b>>>8&255;s[f++]=b&255;var y=l/4294967296*1e4&268435455;s[f++]=y>>>8&255;s[f++]=y&255;s[f++]=y>>>24&15|16;s[f++]=y>>>16&255;s[f++]=_>>>8|128;s[f++]=_&255;for(var q=0;q<6;++q){s[f+q]=c[q]}return e?e:t(s)}r.exports=v1},824:function(r,e,n){var a=n(859);var t=n(707);function v4(r,e,n){var i=e&&n||0;if(typeof r=="string"){e=r==="binary"?new Array(16):null;r=null}r=r||{};var u=r.random||(r.rng||a)();u[6]=u[6]&15|64;u[8]=u[8]&63|128;if(e){for(var o=0;o<16;++o){e[i+o]=u[o]}}return e||t(u)}r.exports=v4},113:function(r){"use strict";r.exports=require("crypto")}};var e={};function __nccwpck_require__(n){var a=e[n];if(a!==undefined){return a.exports}var t=e[n]={exports:{}};var i=true;try{r[n](t,t.exports,__nccwpck_require__);i=false}finally{if(i)delete e[n]}return t.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(155);module.exports=n})();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
3
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
4
|
+
*/
|
|
5
|
+
var byteToHex = [];
|
|
6
|
+
for (var i = 0; i < 256; ++i) {
|
|
7
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function bytesToUuid(buf, offset) {
|
|
11
|
+
var i = offset || 0;
|
|
12
|
+
var bth = byteToHex;
|
|
13
|
+
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
14
|
+
return ([
|
|
15
|
+
bth[buf[i++]], bth[buf[i++]],
|
|
16
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
|
17
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
|
18
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
|
19
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
|
20
|
+
bth[buf[i++]], bth[buf[i++]],
|
|
21
|
+
bth[buf[i++]], bth[buf[i++]],
|
|
22
|
+
bth[buf[i++]], bth[buf[i++]]
|
|
23
|
+
]).join('');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = bytesToUuid;
|