@nocobase/plugin-backup-restore 0.19.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +118 -0
  3. package/README.zh-CN.md +118 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/Configuration.d.ts +2 -0
  7. package/dist/client/DuplicatorProvider.d.ts +2 -0
  8. package/dist/client/index.d.ts +5 -0
  9. package/dist/client/index.js +1 -0
  10. package/dist/client/locale/index.d.ts +4 -0
  11. package/dist/externalVersion.js +14 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.js +39 -0
  14. package/dist/locale/en-US.json +44 -0
  15. package/dist/locale/ja-JP.d.ts +25 -0
  16. package/dist/locale/ja-JP.js +46 -0
  17. package/dist/locale/pt-BR.d.ts +26 -0
  18. package/dist/locale/pt-BR.js +48 -0
  19. package/dist/locale/zh-CN.json +50 -0
  20. package/dist/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  21. package/dist/node_modules/@hapi/topo/lib/index.js +1 -0
  22. package/dist/node_modules/@hapi/topo/package.json +1 -0
  23. package/dist/node_modules/archiver/LICENSE +22 -0
  24. package/dist/node_modules/archiver/index.js +68 -0
  25. package/dist/node_modules/archiver/lib/core.js +974 -0
  26. package/dist/node_modules/archiver/lib/error.js +40 -0
  27. package/dist/node_modules/archiver/lib/plugins/json.js +110 -0
  28. package/dist/node_modules/archiver/lib/plugins/tar.js +167 -0
  29. package/dist/node_modules/archiver/lib/plugins/zip.js +120 -0
  30. package/dist/node_modules/archiver/node_modules/readable-stream/errors-browser.js +127 -0
  31. package/dist/node_modules/archiver/node_modules/readable-stream/errors.js +116 -0
  32. package/dist/node_modules/archiver/node_modules/readable-stream/experimentalWarning.js +17 -0
  33. package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
  34. package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
  35. package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
  36. package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_transform.js +190 -0
  37. package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_writable.js +641 -0
  38. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  39. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  40. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  41. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  42. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  43. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  44. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  45. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  46. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  47. package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  48. package/dist/node_modules/archiver/node_modules/readable-stream/package.json +68 -0
  49. package/dist/node_modules/archiver/node_modules/readable-stream/readable-browser.js +9 -0
  50. package/dist/node_modules/archiver/node_modules/readable-stream/readable.js +16 -0
  51. package/dist/node_modules/archiver/node_modules/string_decoder/lib/string_decoder.js +296 -0
  52. package/dist/node_modules/archiver/node_modules/string_decoder/package.json +34 -0
  53. package/dist/node_modules/archiver/node_modules/tar-stream/extract.js +257 -0
  54. package/dist/node_modules/archiver/node_modules/tar-stream/headers.js +295 -0
  55. package/dist/node_modules/archiver/node_modules/tar-stream/index.js +2 -0
  56. package/dist/node_modules/archiver/node_modules/tar-stream/pack.js +255 -0
  57. package/dist/node_modules/archiver/node_modules/tar-stream/package.json +58 -0
  58. package/dist/node_modules/archiver/node_modules/tar-stream/sandbox.js +11 -0
  59. package/dist/node_modules/archiver/package.json +1 -0
  60. package/dist/node_modules/decompress/index.js +16 -0
  61. package/dist/node_modules/decompress/license +9 -0
  62. package/dist/node_modules/decompress/node_modules/make-dir/index.js +85 -0
  63. package/dist/node_modules/decompress/node_modules/make-dir/license +9 -0
  64. package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js +84 -0
  65. package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/license +9 -0
  66. package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json +51 -0
  67. package/dist/node_modules/decompress/node_modules/make-dir/package.json +54 -0
  68. package/dist/node_modules/decompress/package.json +1 -0
  69. package/dist/node_modules/mkdirp/LICENSE +21 -0
  70. package/dist/node_modules/mkdirp/bin/cmd.js +68 -0
  71. package/dist/node_modules/mkdirp/index.js +1 -0
  72. package/dist/node_modules/mkdirp/lib/find-made.js +29 -0
  73. package/dist/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
  74. package/dist/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
  75. package/dist/node_modules/mkdirp/lib/opts-arg.js +23 -0
  76. package/dist/node_modules/mkdirp/lib/path-arg.js +29 -0
  77. package/dist/node_modules/mkdirp/lib/use-native.js +10 -0
  78. package/dist/node_modules/mkdirp/package.json +1 -0
  79. package/dist/node_modules/mkdirp/readme.markdown +266 -0
  80. package/dist/node_modules/semver/LICENSE +15 -0
  81. package/dist/node_modules/semver/bin/semver.js +197 -0
  82. package/dist/node_modules/semver/classes/comparator.js +141 -0
  83. package/dist/node_modules/semver/classes/index.js +5 -0
  84. package/dist/node_modules/semver/classes/range.js +539 -0
  85. package/dist/node_modules/semver/classes/semver.js +302 -0
  86. package/dist/node_modules/semver/functions/clean.js +6 -0
  87. package/dist/node_modules/semver/functions/cmp.js +52 -0
  88. package/dist/node_modules/semver/functions/coerce.js +52 -0
  89. package/dist/node_modules/semver/functions/compare-build.js +7 -0
  90. package/dist/node_modules/semver/functions/compare-loose.js +3 -0
  91. package/dist/node_modules/semver/functions/compare.js +5 -0
  92. package/dist/node_modules/semver/functions/diff.js +65 -0
  93. package/dist/node_modules/semver/functions/eq.js +3 -0
  94. package/dist/node_modules/semver/functions/gt.js +3 -0
  95. package/dist/node_modules/semver/functions/gte.js +3 -0
  96. package/dist/node_modules/semver/functions/inc.js +19 -0
  97. package/dist/node_modules/semver/functions/lt.js +3 -0
  98. package/dist/node_modules/semver/functions/lte.js +3 -0
  99. package/dist/node_modules/semver/functions/major.js +3 -0
  100. package/dist/node_modules/semver/functions/minor.js +3 -0
  101. package/dist/node_modules/semver/functions/neq.js +3 -0
  102. package/dist/node_modules/semver/functions/parse.js +16 -0
  103. package/dist/node_modules/semver/functions/patch.js +3 -0
  104. package/dist/node_modules/semver/functions/prerelease.js +6 -0
  105. package/dist/node_modules/semver/functions/rcompare.js +3 -0
  106. package/dist/node_modules/semver/functions/rsort.js +3 -0
  107. package/dist/node_modules/semver/functions/satisfies.js +10 -0
  108. package/dist/node_modules/semver/functions/sort.js +3 -0
  109. package/dist/node_modules/semver/functions/valid.js +6 -0
  110. package/dist/node_modules/semver/index.js +1 -0
  111. package/dist/node_modules/semver/internal/constants.js +35 -0
  112. package/dist/node_modules/semver/internal/debug.js +9 -0
  113. package/dist/node_modules/semver/internal/identifiers.js +23 -0
  114. package/dist/node_modules/semver/internal/parse-options.js +15 -0
  115. package/dist/node_modules/semver/internal/re.js +212 -0
  116. package/dist/node_modules/semver/package.json +1 -0
  117. package/dist/node_modules/semver/preload.js +2 -0
  118. package/dist/node_modules/semver/range.bnf +16 -0
  119. package/dist/node_modules/semver/ranges/gtr.js +4 -0
  120. package/dist/node_modules/semver/ranges/intersects.js +7 -0
  121. package/dist/node_modules/semver/ranges/ltr.js +4 -0
  122. package/dist/node_modules/semver/ranges/max-satisfying.js +25 -0
  123. package/dist/node_modules/semver/ranges/min-satisfying.js +24 -0
  124. package/dist/node_modules/semver/ranges/min-version.js +61 -0
  125. package/dist/node_modules/semver/ranges/outside.js +80 -0
  126. package/dist/node_modules/semver/ranges/simplify.js +47 -0
  127. package/dist/node_modules/semver/ranges/subset.js +247 -0
  128. package/dist/node_modules/semver/ranges/to-comparators.js +8 -0
  129. package/dist/node_modules/semver/ranges/valid.js +11 -0
  130. package/dist/server/app-migrator.d.ts +17 -0
  131. package/dist/server/app-migrator.js +61 -0
  132. package/dist/server/collection-group-manager.d.ts +4 -0
  133. package/dist/server/collection-group-manager.js +29 -0
  134. package/dist/server/commands/restore-command.d.ts +2 -0
  135. package/dist/server/commands/restore-command.js +67 -0
  136. package/dist/server/dumper.d.ts +71 -0
  137. package/dist/server/dumper.js +406 -0
  138. package/dist/server/errors/restore-check-error.d.ts +3 -0
  139. package/dist/server/errors/restore-check-error.js +32 -0
  140. package/dist/server/field-value-writer.d.ts +9 -0
  141. package/dist/server/field-value-writer.js +101 -0
  142. package/dist/server/index.d.ts +1 -0
  143. package/dist/server/index.js +33 -0
  144. package/dist/server/locale/zh-CN.d.ts +9 -0
  145. package/dist/server/locale/zh-CN.js +30 -0
  146. package/dist/server/resourcers/backup-files.d.ts +25 -0
  147. package/dist/server/resourcers/backup-files.js +193 -0
  148. package/dist/server/restorer.d.ts +36 -0
  149. package/dist/server/restorer.js +326 -0
  150. package/dist/server/server.d.ts +5 -0
  151. package/dist/server/server.js +41 -0
  152. package/dist/server/utils.d.ts +5 -0
  153. package/dist/server/utils.js +78 -0
  154. package/dist/swagger/index.d.ts +392 -0
  155. package/dist/swagger/index.js +447 -0
  156. package/package.json +40 -0
  157. package/server.d.ts +2 -0
  158. package/server.js +1 -0
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Duplicator
2
+
3
+ English | [中文](./README.zh-CN.md)
4
+
5
+ NocoBase 应用的备份与还原插件,可用于应用的复制、迁移、升级等场景。
6
+
7
+ ## 安装激活
8
+
9
+ 内置插件无需手动安装激活。
10
+
11
+ ## 使用方法
12
+
13
+ Duplicator 插件提供了 `dump` 和 `restore` 命令,分别用于备份和还原应用数据,可用于单应用的备份和还原,也可以跨应用。如果跨应用还原数据,请保证目标应用 NocoBase 版本与源应用一致,相对应插件也已下载本地。
14
+
15
+ **⚠️ 如果使用了继承(PostgreSQL)、视图、触发器等不兼容的特性,跨数据库还原备份数据可能失败。**
16
+
17
+ ### 备份数据
18
+
19
+ ```bash
20
+ yarn nocobase dump
21
+ ```
22
+
23
+ 选择需要备份的插件表结构及其数据
24
+
25
+ ```bash
26
+ ? Select the plugin collections to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
27
+ == Required ==
28
+ - migration (core) (Disabled)
29
+ - collections (collection-manager) (Disabled)
30
+ - uiSchemas (ui-schema-storage) (Disabled)
31
+ - uiRoutes (ui-routes-storage) (Disabled)
32
+ - acl (acl) (Disabled)
33
+ - workflowConfig (workflow) (Disabled)
34
+ - snapshot-field (snapshot-field) (Disabled)
35
+ - sequences (sequence-field) (Disabled)
36
+ == Optional ==
37
+ ❯◉ executionLogs (workflow)
38
+ ◉ users (users)
39
+ ◉ storageSetting (file-manager)
40
+ ◉ attachmentRecords (file-manager)
41
+ ◉ systemSettings (system-settings)
42
+ ◉ verificationProviders (verification)
43
+ ◉ verificationData (verification)
44
+ ◉ oidcProviders (oidc)
45
+ ◉ samlProviders (saml)
46
+ ◉ mapConfiguration (map)
47
+ (Move up and down to reveal more choices)
48
+ ```
49
+
50
+ 选择需要备份的其他数据表的记录
51
+
52
+ ```bash
53
+ ? Select the collection records to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
54
+ ❯◉ Test1
55
+ ❯◉ Test2
56
+ ❯◉ Test3
57
+ ```
58
+
59
+ 数据备份成功之后,备份文件位于 `storage/duplicator` 目录下:
60
+
61
+ ```bash
62
+ dumped to /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump
63
+ dumped file size: 20.8 kB
64
+ ```
65
+
66
+ ### 还原数据
67
+
68
+ ```bash
69
+ yarn nocobase restore /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump
70
+ ```
71
+
72
+ 导入前请先备份数据
73
+
74
+ ```bash
75
+ ? Danger !!! This action will overwrite your current data, please make sure you have a backup❗️❗️ (y/N)
76
+ ```
77
+
78
+ 选择需要还原的插件表结构及其数据
79
+
80
+ ```bash
81
+ ? Select the plugin collections to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
82
+ == Required ==
83
+ - migration (core) (Disabled)
84
+ - collections (collection-manager) (Disabled)
85
+ - uiSchemas (ui-schema-storage) (Disabled)
86
+ - uiRoutes (ui-routes-storage) (Disabled)
87
+ - acl (acl) (Disabled)
88
+ - workflowConfig (workflow) (Disabled)
89
+ - sequences (sequence-field) (Disabled)
90
+ == Optional ==
91
+ ❯◯ executionLogs (workflow)
92
+ ◯ users (users)
93
+ ◯ storageSetting (file-manager)
94
+ ◯ attachmentRecords (file-manager)
95
+ ◯ systemSettings (system-settings)
96
+ ◯ verificationProviders (verification)
97
+ ◯ verificationData (verification)
98
+ ◯ auditLogs (audit-logs)
99
+ ◯ iframe html storage (iframe-block)
100
+ ```
101
+
102
+ 选择需要还原的其他数据表的记录
103
+
104
+ ```bash
105
+ ? Select the collection records to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
106
+ ❯◉ Test1
107
+ ❯◉ Test2
108
+ ❯◉ Test3
109
+ ```
110
+
111
+ 成功之后,重启应用
112
+
113
+ ```bash
114
+ # for development
115
+ yarn dev
116
+ # for production
117
+ yarn start
118
+ ```
@@ -0,0 +1,118 @@
1
+ # Duplicator
2
+
3
+ [English](./README.md) | 中文
4
+
5
+ NocoBase 应用的备份与还原插件,可用于应用的复制、迁移、升级等场景。
6
+
7
+ ## 安装激活
8
+
9
+ 内置插件无需手动安装激活。
10
+
11
+ ## 使用方法
12
+
13
+ Duplicator 插件提供了 `dump` 和 `restore` 命令,分别用于备份和还原应用数据,可用于单应用的备份和还原,也可以跨应用。如果跨应用还原数据,请保证目标应用 NocoBase 版本与源应用一致,相对应插件也已下载本地。
14
+
15
+ **⚠️ 如果使用了继承(PostgreSQL)、视图、触发器等不兼容的特性,跨数据库还原备份数据可能失败。**
16
+
17
+ ### 备份数据
18
+
19
+ ```bash
20
+ yarn nocobase dump
21
+ ```
22
+
23
+ 选择需要备份的插件表结构及其数据
24
+
25
+ ```bash
26
+ ? Select the plugin collections to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
27
+ == Required ==
28
+ - migration (core) (Disabled)
29
+ - collections (collection-manager) (Disabled)
30
+ - uiSchemas (ui-schema-storage) (Disabled)
31
+ - uiRoutes (ui-routes-storage) (Disabled)
32
+ - acl (acl) (Disabled)
33
+ - workflowConfig (workflow) (Disabled)
34
+ - snapshot-field (snapshot-field) (Disabled)
35
+ - sequences (sequence-field) (Disabled)
36
+ == Optional ==
37
+ ❯◉ executionLogs (workflow)
38
+ ◉ users (users)
39
+ ◉ storageSetting (file-manager)
40
+ ◉ attachmentRecords (file-manager)
41
+ ◉ systemSettings (system-settings)
42
+ ◉ verificationProviders (verification)
43
+ ◉ verificationData (verification)
44
+ ◉ oidcProviders (oidc)
45
+ ◉ samlProviders (saml)
46
+ ◉ mapConfiguration (map)
47
+ (Move up and down to reveal more choices)
48
+ ```
49
+
50
+ 选择需要备份的其他数据表的记录
51
+
52
+ ```bash
53
+ ? Select the collection records to be dumped (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
54
+ ❯◉ Test1
55
+ ❯◉ Test2
56
+ ❯◉ Test3
57
+ ```
58
+
59
+ 数据备份成功之后,备份文件位于 `storage/duplicator` 目录下:
60
+
61
+ ```bash
62
+ dumped to /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump
63
+ dumped file size: 20.8 kB
64
+ ```
65
+
66
+ ### 还原数据
67
+
68
+ ```bash
69
+ yarn nocobase restore /your/apps/a/storage/duplicator/dump-20230210T223910.nbdump
70
+ ```
71
+
72
+ 导入前请先备份数据
73
+
74
+ ```bash
75
+ ? Danger !!! This action will overwrite your current data, please make sure you have a backup❗️❗️ (y/N)
76
+ ```
77
+
78
+ 选择需要还原的插件表结构及其数据
79
+
80
+ ```bash
81
+ ? Select the plugin collections to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
82
+ == Required ==
83
+ - migration (core) (Disabled)
84
+ - collections (collection-manager) (Disabled)
85
+ - uiSchemas (ui-schema-storage) (Disabled)
86
+ - uiRoutes (ui-routes-storage) (Disabled)
87
+ - acl (acl) (Disabled)
88
+ - workflowConfig (workflow) (Disabled)
89
+ - sequences (sequence-field) (Disabled)
90
+ == Optional ==
91
+ ❯◯ executionLogs (workflow)
92
+ ◯ users (users)
93
+ ◯ storageSetting (file-manager)
94
+ ◯ attachmentRecords (file-manager)
95
+ ◯ systemSettings (system-settings)
96
+ ◯ verificationProviders (verification)
97
+ ◯ verificationData (verification)
98
+ ◯ auditLogs (audit-logs)
99
+ ◯ iframe html storage (iframe-block)
100
+ ```
101
+
102
+ 选择需要还原的其他数据表的记录
103
+
104
+ ```bash
105
+ ? Select the collection records to be restored (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
106
+ ❯◉ Test1
107
+ ❯◉ Test2
108
+ ❯◉ Test3
109
+ ```
110
+
111
+ 成功之后,重启应用
112
+
113
+ ```bash
114
+ # for development
115
+ yarn dev
116
+ # for production
117
+ yarn start
118
+ ```
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client';
2
+ export { default } from './dist/client';
package/client.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client/index.js');
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const BackupAndRestoreList: () => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const DuplicatorProvider: FC;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@nocobase/client';
2
+ export declare class DuplicatorPlugin extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default DuplicatorPlugin;
@@ -0,0 +1 @@
1
+ (function(d,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@ant-design/icons"),require("@formily/antd-v5"),require("antd"),require("react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@ant-design/icons","@formily/antd-v5","antd","react","react-i18next"],l):(d=typeof globalThis!="undefined"?globalThis:d||self,l(d["@nocobase/plugin-backup-restore"]={},d["@nocobase/client"],d.jsxRuntime,d["@ant-design/icons"],d["@formily/antd-v5"],d.antd,d.react,d["react-i18next"]))})(this,function(d,l,e,B,E,h,g,P){"use strict";var Z=Object.defineProperty,R=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var W=(d,l,e)=>l in d?Z(d,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[l]=e,q=(d,l)=>{for(var e in l||(l={}))te.call(l,e)&&W(d,e,l[e]);if(z)for(var e of z(l))oe.call(l,e)&&W(d,e,l[e]);return d},L=(d,l)=>R(d,ee(l));var C=(d,l,e)=>new Promise((B,E)=>{var h=m=>{try{P(e.next(m))}catch(M){E(M)}},g=m=>{try{P(e.throw(m))}catch(M){E(M)}},P=m=>m.done?B(m.value):Promise.resolve(m.value).then(h,g);P((e=e.apply(d,l)).next())});var m=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},M={exports:{}};(function(a,k){(function(p,r){r()})(m,function(){function p(t,o){return typeof o=="undefined"?o={autoBom:!1}:typeof o!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\uFEFF",t],{type:t.type}):t}function r(t,o,b){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){w(n.response,o,b)},n.onerror=function(){console.error("could not download file")},n.send()}function c(t){var o=new XMLHttpRequest;o.open("HEAD",t,!1);try{o.send()}catch(b){}return 200<=o.status&&299>=o.status}function f(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(b){var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof m=="object"&&m.global===m?m:void 0,v=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),w=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!v?function(t,o,b){var n=u.URL||u.webkitURL,i=document.createElement("a");o=o||t.name||"download",i.download=o,i.rel="noopener",typeof t=="string"?(i.href=t,i.origin===location.origin?f(i):c(i.href)?r(t,o,b):f(i,i.target="_blank")):(i.href=n.createObjectURL(t),setTimeout(function(){n.revokeObjectURL(i.href)},4e4),setTimeout(function(){f(i)},0))}:"msSaveOrOpenBlob"in navigator?function(t,o,b){if(o=o||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(p(t,b),o);else if(c(t))r(t,o,b);else{var n=document.createElement("a");n.href=t,n.target="_blank",setTimeout(function(){f(n)})}}:function(t,o,b,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof t=="string")return r(t,o,b);var i=t.type==="application/octet-stream",s=/constructor/i.test(u.HTMLElement)||u.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||i&&s||v)&&typeof FileReader!="undefined"){var S=new FileReader;S.onloadend=function(){var x=S.result;x=y?x:x.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=x:location=x,n=null},S.readAsDataURL(t)}else{var T=u.URL||u.webkitURL,A=T.createObjectURL(t);n?n.location=A:location.href=A,n=null,setTimeout(function(){T.revokeObjectURL(A)},4e4)}});u.saveAs=w.saveAs=w,a.exports=w})})(M);var K=M.exports;const j="backup-restore";function D(){return P.useTranslation(j,{nsMode:"fallback"})}const{Dragger:X}=h.Upload;function J(a){const k=r=>{var c;(c=a.onChange)==null||c.call(a,r)},p=l.useAPIClient();return L(q({},a),{customRequest({action:r,data:c,file:f,filename:u,headers:v,onError:w,onProgress:t,onSuccess:o,withCredentials:b}){const n=new FormData;return c&&Object.keys(c).forEach(i=>{n.append(i,c[i])}),n.append(u,f),p.axios.post(r,n,{withCredentials:b,headers:v,onUploadProgress:({total:i,loaded:s})=>{t({percent:Math.round(s/i*100).toFixed(2)},f)}}).then(({data:i})=>{o(i,f)}).catch(w).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:k})}const U=a=>{const{collectionsData:k}=a,{t:p}=D(),[r,c]=g.useState(!1),[f,u]=g.useState(k);g.useEffect(()=>{u(k)},[k]);const v=l.useAPIClient(),w=l.useCompile(),t=g.useMemo(()=>v.resource("backupFiles"),[v]),o=()=>C(this,null,function*(){if(a.isBackup){const y=yield t.dumpableCollections();u(y==null?void 0:y.data),c(!0)}c(!0)}),b=()=>{c(!1)},n=()=>{c(!1)},i=[{title:p("Collection"),dataIndex:"collection",key:"collection",render:(y,S)=>{const T=w(S.title);return S.name===T?T:e.jsxs("div",{children:[S.name," ",e.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",w(S.title),")"]})]})}},{title:p("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],s=Object.keys(f||{}).map(y=>({key:y,label:p(`${y}.title`),children:e.jsxs(e.Fragment,{children:[e.jsx(h.Alert,{style:{marginBottom:16},message:p(`${y}.description`)}),e.jsx(h.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:f[y],columns:i,scroll:{y:400}})]})}));return e.jsxs(e.Fragment,{children:[e.jsx("a",{onClick:o,children:p("Learn more")}),e.jsx(h.Modal,{title:p("Backup instructions"),width:"80vw",open:r,footer:null,onOk:b,onCancel:n,children:e.jsx(h.Tabs,{defaultActiveKey:"required",items:s})})]})},G=({ButtonComponent:a=h.Button,title:k,upload:p=!1,fileData:r})=>{const{t:c}=D(),[f,u]=g.useState(["required"]),[v,w]=g.useState(!1),[t,o]=g.useState(null),[b,n]=g.useState(!1),i=l.useAPIClient(),s=g.useMemo(()=>i.resource("backupFiles"),[i]),[y,S]=g.useState([]);g.useEffect(()=>{S(Object.keys((t==null?void 0:t.dumpableCollectionsGroupByGroup)||[]).map(O=>({value:O,label:c(`${O}.title`),disabled:["required","skipped"].includes(O)})))},[t]);const T=()=>C(this,null,function*(){var O,H,N;if(w(!0),!p){n(!0);const{data:F}=yield s.get({filterByTk:r.name});S(Object.keys(((H=(O=F==null?void 0:F.data)==null?void 0:O.meta)==null?void 0:H.dumpableCollectionsGroupByGroup)||[]).map(I=>({value:I,label:c(`${I}.title`),disabled:["required","skipped"].includes(I)}))),o((N=F==null?void 0:F.data)==null?void 0:N.meta),n(!1)}}),A=()=>{s.restore({values:{dataTypes:f,filterByTk:r==null?void 0:r.name,key:t==null?void 0:t.key}}),w(!1)},x=()=>{w(!1),o(null),u(["required"])};return e.jsxs(e.Fragment,{children:[e.jsx(a,{onClick:T,children:k}),e.jsx(h.Modal,{title:c("Restore"),width:800,footer:p&&!t?null:void 0,open:v,onOk:A,onCancel:x,children:e.jsxs(h.Spin,{spinning:b,children:[p&&!t&&e.jsx(V,{setRestoreData:o}),(!p||t)&&[e.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[c("Select the data to be restored")," (",e.jsx(U,{collectionsData:t==null?void 0:t.dumpableCollectionsGroupByGroup}),"):"]},"info"),e.jsx("div",{style:{lineHeight:2,marginBottom:8},children:e.jsx(E.FormItem,{children:e.jsx(l.Checkbox.Group,{options:y,style:{flexDirection:"column"},value:f,onChange:O=>u(O)})})},"dataType")]]})})]})},Q=({ButtonComponent:a=h.Button,refresh:k})=>{const{t:p}=D(),[r,c]=g.useState(!1),[f,u]=g.useState(["required"]),v=l.useAPIClient(),[w,t]=g.useState([]),o=()=>C(this,null,function*(){const{data:i}=yield v.resource("backupFiles").dumpableCollections();t(Object.keys(i||[]).map(s=>({value:s,label:p(`${s}.title`),disabled:["required","skipped"].includes(s)}))),c(!0)}),b=()=>{v.request({url:"backupFiles:create",method:"post",data:{dataTypes:f}}),c(!1),u(["required"]),setTimeout(()=>{k()},500)},n=()=>{c(!1),u(["required"])};return e.jsxs(e.Fragment,{children:[e.jsx(a,{icon:e.jsx(B.PlusOutlined,{}),type:"primary",onClick:o,children:p("New backup")}),e.jsxs(h.Modal,{title:p("New backup"),width:800,open:r,onOk:b,onCancel:n,children:[e.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[p("Select the data to be backed up")," (",e.jsx(U,{isBackup:!0}),"):"]}),e.jsx("div",{style:{lineHeight:2,marginBottom:8},children:e.jsx(l.Checkbox.Group,{options:w,style:{flexDirection:"column"},onChange:i=>u(i),value:f})})]})]})},V=a=>{const{t:k}=D(),p={multiple:!1,action:"/backupFiles:upload",onChange(r){var f,u,v;r.fileList.length>1&&r.fileList.splice(0,r.fileList.length-1);const{status:c}=r.file;c==="done"?(h.message.success(`${r.file.name} `+k("file uploaded successfully")),a.setRestoreData(L(q({},(u=(f=r.file.response)==null?void 0:f.data)==null?void 0:u.meta),{key:(v=r.file.response)==null?void 0:v.data.key}))):c==="error"&&h.message.error(`${r.file.name} `+k("file upload failed"))},onDrop(r){console.log("Dropped files",r.dataTransfer.files)}};return e.jsxs(X,L(q({},J(p)),{children:[e.jsx("p",{className:"ant-upload-drag-icon",children:e.jsx(B.InboxOutlined,{})}),e.jsxs("p",{className:"ant-upload-text",children:[" ",k("Click or drag file to this area to upload")]})]}))},Y=()=>{const{t:a}=D(),k=l.useAPIClient(),[p,r]=g.useState([]),[c,f]=g.useState(!1),[u,v]=g.useState(!1),{modal:w}=h.App.useApp(),t=g.useMemo(()=>k.resource("backupFiles"),[k]);g.useEffect(()=>{o()},[]);const o=()=>C(this,null,function*(){f(!0);const{data:s}=yield t.list();r(s.data),f(!1)}),b=s=>C(this,null,function*(){v(s.name);const y=yield k.request({url:"backupFiles:download",method:"get",params:{filterByTk:s.name},responseType:"blob"});v(!1);const S=new Blob([y.data]);K.saveAs(S,s.name)}),n=()=>C(this,null,function*(){yield o()}),i=s=>{w.confirm({title:a("Delete record",{ns:"client"}),content:a("Are you sure you want to delete it?",{ns:"client"}),onOk:()=>C(this,null,function*(){yield t.destroy({filterByTk:s.name}),yield o(),h.message.success(a("Deleted successfully"))})})};return e.jsx("div",{children:e.jsxs(h.Card,{bordered:!1,children:[e.jsxs(h.Space,{style:{float:"right",marginBottom:16},children:[e.jsx(h.Button,{onClick:n,icon:e.jsx(B.ReloadOutlined,{}),children:a("Refresh")}),e.jsx(G,{upload:!0,title:e.jsxs(e.Fragment,{children:[e.jsx(B.UploadOutlined,{})," ",a("Restore backup from local")]})}),e.jsx(Q,{refresh:n})]}),e.jsx(h.Table,{dataSource:p,loading:c,columns:[{title:a("Backup file"),dataIndex:"name",width:400,onCell:s=>s.inProgress?{colSpan:4}:{},render:(s,y)=>y.inProgress?e.jsxs("div",{style:{color:"rgba(0, 0, 0, 0.88)"},children:[s,"(",a("Backing up"),"...)"]}):e.jsx("div",{children:s})},{title:a("File size"),dataIndex:"fileSize",onCell:s=>s.inProgress?{colSpan:0}:{}},{title:a("Created at",{ns:"client"}),dataIndex:"createdAt",onCell:s=>s.inProgress?{colSpan:0}:{},render:s=>e.jsx(l.DatePicker.ReadPretty,{value:s,showTime:!0})},{title:a("Actions",{ns:"client"}),dataIndex:"actions",onCell:s=>s.inProgress?{colSpan:0}:{},render:(s,y)=>e.jsxs(h.Space,{split:e.jsx(h.Divider,{type:"vertical"}),children:[e.jsx(G,{ButtonComponent:"a",title:a("Restore"),fileData:y}),e.jsx("a",{type:"link",onClick:()=>b(y),children:a("Download")}),e.jsx("a",{onClick:()=>i(y),children:a("Delete")})]})}]})]})})},_=function(a){return e.jsx(l.CurrentAppInfoProvider,{children:e.jsx(l.SchemaComponentOptions,{children:a.children})})};_.displayName="DuplicatorProvider";class $ extends l.Plugin{load(){return C(this,null,function*(){this.app.use(_),this.app.pluginSettingsManager.add(j,{title:`{{t("Backup & Restore", { ns: "${j}" })}}`,icon:"CloudServerOutlined",Component:Y,aclSnippet:"pm.backup.restore"})})}}d.DuplicatorPlugin=$,d.default=$,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,4 @@
1
+ export declare const NAMESPACE = "backup-restore";
2
+ export declare function lang(key: string): string;
3
+ export declare function generateNTemplate(key: string): string;
4
+ export declare function useDuplicatorTranslation(): import("react-i18next").UseTranslationResponse<"backup-restore", undefined>;
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ "@ant-design/icons": "5.2.6",
3
+ "@formily/antd-v5": "1.1.9",
4
+ "@nocobase/client": "0.19.0-alpha.1",
5
+ "antd": "5.12.8",
6
+ "react": "18.2.0",
7
+ "@nocobase/server": "0.19.0-alpha.1",
8
+ "@nocobase/utils": "0.19.0-alpha.1",
9
+ "@nocobase/database": "0.19.0-alpha.1",
10
+ "dayjs": "1.11.10",
11
+ "lodash": "4.17.21",
12
+ "react-i18next": "11.18.6",
13
+ "@nocobase/actions": "0.19.0-alpha.1"
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from './server';
2
+ export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
39
+ });
@@ -0,0 +1,44 @@
1
+ {
2
+ "Backup file": "Backup file",
3
+ "System metadata": "System metadata",
4
+ "System config": "System config",
5
+ "Business data": "Business data",
6
+ "Backup & Restore": "Backup & Restore",
7
+ "Backup": "Backup",
8
+ "Restore": "Restore",
9
+ "Configuration": "Configuration",
10
+ "Select the data to be backed up": "Select the data to be backed up",
11
+ "Select the data to be restored": "Select the data to be restored",
12
+ "Click or drag file to this area to upload": "Click or drag file to this area to upload",
13
+ "Learn more": "Learn more",
14
+ "Start backup": "Start backup",
15
+ "Start restore": "Start restore",
16
+ "Backed up successfully": "Backed up successfully",
17
+ "Plugin": "Plugin",
18
+ "file uploaded successfully": "file uploaded successfully",
19
+ "file upload failed": "file upload failed",
20
+ "Download": "Download",
21
+ "Restore backup from local": "Restore backup from local",
22
+ "Backup instructions": "Backup instructions",
23
+ "File size": "File size",
24
+ "New backup": "New backup",
25
+ "Origin": "Origin",
26
+ "Backing up": "Backing up",
27
+ "Refresh": "Refresh",
28
+ "Delete": "Delete",
29
+ "Deleted successfully": "Deleted successfully",
30
+ "required.title": "Required data",
31
+ "user.title": "User data",
32
+ "log.title": "Log data",
33
+ "custom.title": "Custom collection data",
34
+ "skipped.title": "Skipped data",
35
+ "unknown.title": "Unknown",
36
+ "third-party.title": "Third-party service information",
37
+ "required.description": "Required data",
38
+ "user.description": "User data",
39
+ "log.description": "Log data",
40
+ "custom.description": "Custom collection data",
41
+ "skipped.description": "Skipped data",
42
+ "unknown.description": "Data without configured dump rules",
43
+ "third-party.description": "Third-party service information"
44
+ }
@@ -0,0 +1,25 @@
1
+ declare const _default: {
2
+ 'System metadata': string;
3
+ 'System config': string;
4
+ 'Business data': string;
5
+ 'Backup & Restore': string;
6
+ Backup: string;
7
+ Restore: string;
8
+ Configuration: string;
9
+ 'Select the data to be backed up': string;
10
+ 'Select the data to be restored': string;
11
+ 'Learn more': string;
12
+ 'Start backup': string;
13
+ 'Start restore': string;
14
+ 'Backed up successfully': string;
15
+ Plugin: string;
16
+ 'file uploaded successfully': string;
17
+ Download: string;
18
+ 'Restore backup from local': string;
19
+ 'Backup instructions': string;
20
+ 'File size': string;
21
+ 'New backup': string;
22
+ Origin: string;
23
+ 'Backing up': string;
24
+ };
25
+ export default _default;
@@ -0,0 +1,46 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var ja_JP_exports = {};
19
+ __export(ja_JP_exports, {
20
+ default: () => ja_JP_default
21
+ });
22
+ module.exports = __toCommonJS(ja_JP_exports);
23
+ var ja_JP_default = {
24
+ "System metadata": "\u30B7\u30B9\u30C6\u30E0\u30E1\u30BF\u30C7\u30FC\u30BF",
25
+ "System config": "\u30B7\u30B9\u30C6\u30E0\u69CB\u6210",
26
+ "Business data": "\u30D3\u30B8\u30CD\u30B9\u30C7\u30FC\u30BF",
27
+ "Backup & Restore": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3068\u30EA\u30B9\u30C8\u30A2",
28
+ Backup: "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7",
29
+ Restore: "\u30EA\u30B9\u30C8\u30A2",
30
+ Configuration: "\u69CB\u6210",
31
+ "Select the data to be backed up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3055\u308C\u305F\u30C7\u30FC\u30BF\u306E\u9078\u629E",
32
+ "Select the data to be restored": "\u30EA\u30B9\u30C8\u30A2\u3055\u308C\u305F\u30C7\u30FC\u30BF\u306E\u9078\u629E",
33
+ "Learn more": "\u8A73\u7D30",
34
+ "Start backup": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u958B\u59CB",
35
+ "Start restore": "\u30EA\u30B9\u30C8\u30A2\u3092\u958B\u59CB",
36
+ "Backed up successfully": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u6210\u529F",
37
+ Plugin: "\u30D7\u30E9\u30B0\u30A4\u30F3",
38
+ "file uploaded successfully": "\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
39
+ Download: "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",
40
+ "Restore backup from local": "\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306B\u8FD4\u4FE1",
41
+ "Backup instructions": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u8AAC\u660E",
42
+ "File size": "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA",
43
+ "New backup": "\u65B0\u898F\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7",
44
+ "Origin": "\u30BD\u30FC\u30B9",
45
+ "Backing up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E2D"
46
+ };
@@ -0,0 +1,26 @@
1
+ declare const locale: {
2
+ 'System metadata': string;
3
+ 'System config': string;
4
+ 'Business data': string;
5
+ 'Backup & Restore': string;
6
+ Backup: string;
7
+ Restore: string;
8
+ Configuration: string;
9
+ 'Select the data to be backed up': string;
10
+ 'Select the data to be restored': string;
11
+ 'Learn more': string;
12
+ 'Start restore': string;
13
+ 'Start backup': string;
14
+ 'Backed up successfully': string;
15
+ Plugin: string;
16
+ 'file uploaded successfully': string;
17
+ 'file upload failed': string;
18
+ Download: string;
19
+ 'Restore backup from local': string;
20
+ 'Backup instructions': string;
21
+ 'File size': string;
22
+ 'New backup': string;
23
+ Origin: string;
24
+ 'Backing up': string;
25
+ };
26
+ export default locale;
@@ -0,0 +1,48 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var pt_BR_exports = {};
19
+ __export(pt_BR_exports, {
20
+ default: () => pt_BR_default
21
+ });
22
+ module.exports = __toCommonJS(pt_BR_exports);
23
+ const locale = {
24
+ "System metadata": "Metadados do Sistema",
25
+ "System config": "configura\xE7\xE3o do sistema",
26
+ "Business data": "Dados comerciais",
27
+ "Backup & Restore": "C\xF3pia de Seguran\xE7a e Restaura\xE7\xE3o",
28
+ Backup: "c\xF3pias de seguran\xE7a",
29
+ Restore: "redu\xE7\xE3o",
30
+ Configuration: "atribui\xE7\xE3o",
31
+ "Select the data to be backed up": "Seleccionar os dados de c\xF3pia de seguran\xE7a",
32
+ "Select the data to be restored": "Seleccionar os dados restaurados",
33
+ "Learn more": "Saiba mais",
34
+ "Start restore": "Iniciar a Restaura\xE7\xE3o",
35
+ "Start backup": "Iniciar a c\xF3pia de seguran\xE7a",
36
+ "Backed up successfully": "C\xF3pia de seguran\xE7a bem sucedida",
37
+ "Plugin": "Plugins",
38
+ "file uploaded successfully": "O ficheiro foi enviado com sucesso",
39
+ "file upload failed": "O envio do ficheiro falhou",
40
+ "Download": "download",
41
+ "Restore backup from local": "Restaurar a c\xF3pia de seguran\xE7a localmente",
42
+ "Backup instructions": "Instru\xE7\xF5es de c\xF3pia de seguran\xE7a",
43
+ "File size": "tamanho do ficheiro",
44
+ "New backup": "Nova C\xF3pia de Seguran\xE7a",
45
+ "Origin": "fonte",
46
+ "Backing up": "C\xF3pia de seguran\xE7a em curso"
47
+ };
48
+ var pt_BR_default = locale;
@@ -0,0 +1,50 @@
1
+ {
2
+ "Backup file": "备份文件",
3
+ "Select Import data": "请选择导入数据",
4
+ "Select Import Plugins": "请选择导入插件",
5
+ "Select User Collections": "请选择用户数据",
6
+ "Basic Data": "基础数据",
7
+ "Optional Data": "可选数据",
8
+ "User Data": "用户数据",
9
+ "System metadata": "系统元数据",
10
+ "System config": "系统配置",
11
+ "Business data": "业务数据",
12
+ "Backup & Restore": "备份和还原",
13
+ "Backup": "备份",
14
+ "Restore": "还原",
15
+ "Configuration": "配置",
16
+ "Select the data to be backed up": "选择备份的数据",
17
+ "Select the data to be restored": "选择还原的数据",
18
+ "Click or drag file to this area to upload": "点击或拖拽文件至此区域即可上传",
19
+ "Learn more": "了解更多",
20
+ "Start backup": "开始备份",
21
+ "Start restore": "开始还原",
22
+ "Backed up successfully": "备份成功",
23
+ "Deleted successfully": "删除成功",
24
+ "Plugin": "插件",
25
+ "file uploaded successfully": "文件上传成功",
26
+ "file upload failed": "文件上传失败",
27
+ "Download": "下载",
28
+ "Restore backup from local": "从本地恢复备份",
29
+ "Backup instructions": "备份说明",
30
+ "File size":"文件大小",
31
+ "New backup":"新建备份",
32
+ "Origin":"来源",
33
+ "Backing up":"备份中",
34
+ "Refresh": "刷新",
35
+ "Delete": "删除",
36
+ "required.title": "必备数据",
37
+ "user.title": "用户数据",
38
+ "log.title": "日志数据",
39
+ "custom.title": "自建表数据",
40
+ "skipped.title": "跳过的数据",
41
+ "unknown.title": "未知数据",
42
+ "third-party.title": "第三方服务信息",
43
+ "required.description": "必备数据",
44
+ "user.description": "用户数据",
45
+ "log.description": "日志数据",
46
+ "custom.description": "自建表数据",
47
+ "skipped.description": "跳过的数据",
48
+ "unknown.description": "没有配置备份规则的数据",
49
+ "third-party.description": "第三方服务信息"
50
+ }
@@ -0,0 +1,60 @@
1
+ export class Sorter<T> {
2
+
3
+ /**
4
+ * An array of the topologically sorted nodes. This list is renewed upon each call to topo.add().
5
+ */
6
+ nodes: T[];
7
+
8
+ /**
9
+ * Adds a node or list of nodes to be added and topologically sorted
10
+ *
11
+ * @param nodes - A mixed value or array of mixed values to be added as nodes to the topologically sorted list.
12
+ * @param options - Optional sorting information about the nodes.
13
+ *
14
+ * @returns Returns an array of the topologically sorted nodes.
15
+ */
16
+ add(nodes: T | T[], options?: Options): T[];
17
+
18
+ /**
19
+ * Merges another Sorter object into the current object.
20
+ *
21
+ * @param others - The other object or array of objects to be merged into the current one.
22
+ *
23
+ * @returns Returns an array of the topologically sorted nodes.
24
+ */
25
+ merge(others: Sorter<T> | Sorter<T>[]): T[];
26
+
27
+ /**
28
+ * Sorts the nodes array (only required if the manual option is used when adding items)
29
+ */
30
+ sort(): T[];
31
+ }
32
+
33
+
34
+ export interface Options {
35
+
36
+ /**
37
+ * The sorting group the added items belong to
38
+ */
39
+ readonly group?: string;
40
+
41
+ /**
42
+ * The group or groups the added items must come before
43
+ */
44
+ readonly before?: string | string[];
45
+
46
+ /**
47
+ * The group or groups the added items must come after
48
+ */
49
+ readonly after?: string | string[];
50
+
51
+ /**
52
+ * A number used to sort items with equal before/after requirements
53
+ */
54
+ readonly sort?: number;
55
+
56
+ /**
57
+ * If true, the array is not sorted automatically until sort() is called
58
+ */
59
+ readonly manual?: boolean;
60
+ }