@tachybase/module-backup 0.23.8

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 (125) hide show
  1. package/.turbo/turbo-build.log +12 -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 +5 -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/ko_KR.json +50 -0
  18. package/dist/locale/pt-BR.d.ts +26 -0
  19. package/dist/locale/pt-BR.js +48 -0
  20. package/dist/locale/zh-CN.json +50 -0
  21. package/dist/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  22. package/dist/node_modules/@hapi/topo/lib/index.js +1 -0
  23. package/dist/node_modules/@hapi/topo/package.json +1 -0
  24. package/dist/node_modules/archiver/LICENSE +22 -0
  25. package/dist/node_modules/archiver/index.js +68 -0
  26. package/dist/node_modules/archiver/lib/core.js +974 -0
  27. package/dist/node_modules/archiver/lib/error.js +40 -0
  28. package/dist/node_modules/archiver/lib/plugins/json.js +110 -0
  29. package/dist/node_modules/archiver/lib/plugins/tar.js +167 -0
  30. package/dist/node_modules/archiver/lib/plugins/zip.js +120 -0
  31. package/dist/node_modules/archiver/package.json +1 -0
  32. package/dist/node_modules/decompress/index.js +16 -0
  33. package/dist/node_modules/decompress/license +9 -0
  34. package/dist/node_modules/decompress/package.json +1 -0
  35. package/dist/node_modules/mkdirp/LICENSE +21 -0
  36. package/dist/node_modules/mkdirp/bin/cmd.js +68 -0
  37. package/dist/node_modules/mkdirp/index.js +1 -0
  38. package/dist/node_modules/mkdirp/lib/find-made.js +29 -0
  39. package/dist/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
  40. package/dist/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
  41. package/dist/node_modules/mkdirp/lib/opts-arg.js +23 -0
  42. package/dist/node_modules/mkdirp/lib/path-arg.js +29 -0
  43. package/dist/node_modules/mkdirp/lib/use-native.js +10 -0
  44. package/dist/node_modules/mkdirp/package.json +1 -0
  45. package/dist/node_modules/mkdirp/readme.markdown +266 -0
  46. package/dist/node_modules/semver/LICENSE +15 -0
  47. package/dist/node_modules/semver/bin/semver.js +188 -0
  48. package/dist/node_modules/semver/classes/comparator.js +141 -0
  49. package/dist/node_modules/semver/classes/index.js +5 -0
  50. package/dist/node_modules/semver/classes/range.js +554 -0
  51. package/dist/node_modules/semver/classes/semver.js +302 -0
  52. package/dist/node_modules/semver/functions/clean.js +6 -0
  53. package/dist/node_modules/semver/functions/cmp.js +52 -0
  54. package/dist/node_modules/semver/functions/coerce.js +60 -0
  55. package/dist/node_modules/semver/functions/compare-build.js +7 -0
  56. package/dist/node_modules/semver/functions/compare-loose.js +3 -0
  57. package/dist/node_modules/semver/functions/compare.js +5 -0
  58. package/dist/node_modules/semver/functions/diff.js +65 -0
  59. package/dist/node_modules/semver/functions/eq.js +3 -0
  60. package/dist/node_modules/semver/functions/gt.js +3 -0
  61. package/dist/node_modules/semver/functions/gte.js +3 -0
  62. package/dist/node_modules/semver/functions/inc.js +19 -0
  63. package/dist/node_modules/semver/functions/lt.js +3 -0
  64. package/dist/node_modules/semver/functions/lte.js +3 -0
  65. package/dist/node_modules/semver/functions/major.js +3 -0
  66. package/dist/node_modules/semver/functions/minor.js +3 -0
  67. package/dist/node_modules/semver/functions/neq.js +3 -0
  68. package/dist/node_modules/semver/functions/parse.js +16 -0
  69. package/dist/node_modules/semver/functions/patch.js +3 -0
  70. package/dist/node_modules/semver/functions/prerelease.js +6 -0
  71. package/dist/node_modules/semver/functions/rcompare.js +3 -0
  72. package/dist/node_modules/semver/functions/rsort.js +3 -0
  73. package/dist/node_modules/semver/functions/satisfies.js +10 -0
  74. package/dist/node_modules/semver/functions/sort.js +3 -0
  75. package/dist/node_modules/semver/functions/valid.js +6 -0
  76. package/dist/node_modules/semver/index.js +1 -0
  77. package/dist/node_modules/semver/internal/constants.js +35 -0
  78. package/dist/node_modules/semver/internal/debug.js +9 -0
  79. package/dist/node_modules/semver/internal/identifiers.js +23 -0
  80. package/dist/node_modules/semver/internal/lrucache.js +40 -0
  81. package/dist/node_modules/semver/internal/parse-options.js +15 -0
  82. package/dist/node_modules/semver/internal/re.js +217 -0
  83. package/dist/node_modules/semver/package.json +1 -0
  84. package/dist/node_modules/semver/preload.js +2 -0
  85. package/dist/node_modules/semver/range.bnf +16 -0
  86. package/dist/node_modules/semver/ranges/gtr.js +4 -0
  87. package/dist/node_modules/semver/ranges/intersects.js +7 -0
  88. package/dist/node_modules/semver/ranges/ltr.js +4 -0
  89. package/dist/node_modules/semver/ranges/max-satisfying.js +25 -0
  90. package/dist/node_modules/semver/ranges/min-satisfying.js +24 -0
  91. package/dist/node_modules/semver/ranges/min-version.js +61 -0
  92. package/dist/node_modules/semver/ranges/outside.js +80 -0
  93. package/dist/node_modules/semver/ranges/simplify.js +47 -0
  94. package/dist/node_modules/semver/ranges/subset.js +247 -0
  95. package/dist/node_modules/semver/ranges/to-comparators.js +8 -0
  96. package/dist/node_modules/semver/ranges/valid.js +11 -0
  97. package/dist/server/app-migrator.d.ts +16 -0
  98. package/dist/server/app-migrator.js +61 -0
  99. package/dist/server/collection-group-manager.d.ts +4 -0
  100. package/dist/server/collection-group-manager.js +29 -0
  101. package/dist/server/commands/restore-command.d.ts +2 -0
  102. package/dist/server/commands/restore-command.js +67 -0
  103. package/dist/server/dumper.d.ts +71 -0
  104. package/dist/server/dumper.js +421 -0
  105. package/dist/server/errors/restore-check-error.d.ts +3 -0
  106. package/dist/server/errors/restore-check-error.js +32 -0
  107. package/dist/server/field-value-writer.d.ts +9 -0
  108. package/dist/server/field-value-writer.js +99 -0
  109. package/dist/server/index.d.ts +1 -0
  110. package/dist/server/index.js +33 -0
  111. package/dist/server/locale/zh-CN.d.ts +9 -0
  112. package/dist/server/locale/zh-CN.js +30 -0
  113. package/dist/server/resourcers/backup-files.d.ts +25 -0
  114. package/dist/server/resourcers/backup-files.js +206 -0
  115. package/dist/server/restorer.d.ts +35 -0
  116. package/dist/server/restorer.js +320 -0
  117. package/dist/server/server.d.ts +8 -0
  118. package/dist/server/server.js +52 -0
  119. package/dist/server/utils.d.ts +5 -0
  120. package/dist/server/utils.js +78 -0
  121. package/dist/swagger/index.d.ts +392 -0
  122. package/dist/swagger/index.js +447 -0
  123. package/package.json +48 -0
  124. package/server.d.ts +2 -0
  125. package/server.js +1 -0
@@ -0,0 +1,447 @@
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 swagger_exports = {};
19
+ __export(swagger_exports, {
20
+ default: () => swagger_default
21
+ });
22
+ module.exports = __toCommonJS(swagger_exports);
23
+ var swagger_default = {
24
+ info: {
25
+ title: "TachyBase API - Backup & Restore plugin"
26
+ },
27
+ tags: [],
28
+ paths: {
29
+ "/backupFiles:create": {
30
+ post: {
31
+ summary: "Create a new backup file",
32
+ requestBody: {
33
+ required: true,
34
+ content: {
35
+ "application/json": {
36
+ schema: {
37
+ $ref: "#/components/schemas/DumpOptions"
38
+ }
39
+ }
40
+ }
41
+ },
42
+ responses: {
43
+ "200": {
44
+ description: "Dump successful",
45
+ content: {
46
+ "application/json": {
47
+ schema: {
48
+ type: "object",
49
+ properties: {
50
+ key: {
51
+ type: "string"
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "/backupFiles:list": {
62
+ get: {
63
+ summary: "Get backup file list",
64
+ parameters: [
65
+ {
66
+ name: "page",
67
+ in: "query",
68
+ description: "Page number of item to retrieve",
69
+ required: false,
70
+ schema: {
71
+ type: "integer",
72
+ format: "int32",
73
+ default: 1
74
+ }
75
+ },
76
+ {
77
+ name: "pageSize",
78
+ in: "query",
79
+ description: "Number of item to retrieve per page",
80
+ required: false,
81
+ schema: {
82
+ type: "integer",
83
+ format: "int32",
84
+ default: 10
85
+ }
86
+ }
87
+ ],
88
+ responses: {
89
+ "200": {
90
+ description: "A paged array of backup statuses",
91
+ content: {
92
+ "application/json": {
93
+ schema: {
94
+ type: "object",
95
+ properties: {
96
+ data: {
97
+ type: "array",
98
+ items: {
99
+ oneOf: [
100
+ {
101
+ $ref: "#/components/schemas/BackUpStatusOk"
102
+ },
103
+ {
104
+ $ref: "#/components/schemas/BackUpStatusDoing"
105
+ }
106
+ ]
107
+ }
108
+ },
109
+ meta: {
110
+ type: "object",
111
+ properties: {
112
+ page: {
113
+ type: "integer",
114
+ format: "int32"
115
+ },
116
+ pageSize: {
117
+ type: "integer",
118
+ format: "int32"
119
+ },
120
+ count: {
121
+ type: "integer",
122
+ format: "int64"
123
+ },
124
+ totalPage: {
125
+ type: "integer",
126
+ format: "int32"
127
+ }
128
+ }
129
+ }
130
+ },
131
+ required: ["data", "meta"]
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ },
139
+ "/backupFiles:get": {
140
+ get: {
141
+ summary: "Get backup file info",
142
+ parameters: [
143
+ {
144
+ name: "filterByTk",
145
+ in: "query",
146
+ required: true,
147
+ schema: {
148
+ type: "string"
149
+ }
150
+ }
151
+ ],
152
+ responses: {
153
+ "200": {
154
+ description: "Status of the backup operation",
155
+ content: {
156
+ "application/json": {
157
+ schema: {
158
+ oneOf: [
159
+ {
160
+ $ref: "#/components/schemas/BackUpStatusOk"
161
+ },
162
+ {
163
+ $ref: "#/components/schemas/BackUpStatusDoing"
164
+ }
165
+ ]
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ },
173
+ "/backupFiles:download": {
174
+ get: {
175
+ summary: "Download a backup file",
176
+ parameters: [
177
+ {
178
+ name: "filterByTk",
179
+ in: "query",
180
+ required: true,
181
+ schema: {
182
+ type: "string"
183
+ }
184
+ }
185
+ ],
186
+ responses: {
187
+ "200": {
188
+ description: "Download successful",
189
+ content: {
190
+ "application/octet-stream": {
191
+ schema: {
192
+ type: "string",
193
+ format: "binary"
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+ },
201
+ "/backupFiles:destroy": {
202
+ post: {
203
+ summary: "Destroy a backup file",
204
+ parameters: [
205
+ {
206
+ name: "filterByTk",
207
+ in: "query",
208
+ required: true,
209
+ schema: {
210
+ type: "string"
211
+ }
212
+ }
213
+ ],
214
+ responses: {
215
+ "200": {
216
+ description: "Destroy successful",
217
+ content: {
218
+ "application/json": {
219
+ schema: {
220
+ type: "object",
221
+ properties: {
222
+ status: {
223
+ type: "string"
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ },
233
+ "/backupFiles:upload": {
234
+ post: {
235
+ summary: "Upload a backup file",
236
+ requestBody: {
237
+ required: true,
238
+ content: {
239
+ "multipart/form-data": {
240
+ schema: {
241
+ type: "object",
242
+ properties: {
243
+ file: {
244
+ type: "string",
245
+ format: "binary"
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+ },
252
+ responses: {
253
+ 200: {
254
+ description: "Upload successful",
255
+ content: {
256
+ "application/json": {
257
+ schema: {
258
+ type: "object",
259
+ properties: {
260
+ key: {
261
+ type: "string"
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+ },
271
+ "/backupFiles:restore": {
272
+ post: {
273
+ summary: "Restore from a backup file",
274
+ requestBody: {
275
+ required: true,
276
+ content: {
277
+ "application/json": {
278
+ schema: {
279
+ type: "object",
280
+ properties: {
281
+ filterByTk: {
282
+ type: "string"
283
+ },
284
+ dataTypes: {
285
+ type: "array",
286
+ items: {
287
+ $ref: "#/components/schemas/DumpDataType"
288
+ },
289
+ uniqueItems: true
290
+ },
291
+ key: {
292
+ type: "string"
293
+ }
294
+ },
295
+ oneOf: [
296
+ {
297
+ required: ["filterByTk", "dataTypes"]
298
+ },
299
+ {
300
+ required: ["key", "dataTypes"]
301
+ }
302
+ ]
303
+ }
304
+ }
305
+ }
306
+ },
307
+ responses: {
308
+ "200": {
309
+ description: "Restore successful",
310
+ content: {
311
+ "application/json": {
312
+ schema: {
313
+ type: "object",
314
+ properties: {
315
+ status: {
316
+ type: "string"
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ }
324
+ }
325
+ },
326
+ "/backupFiles:dumpableCollections": {
327
+ get: {
328
+ summary: "Get dumpable collections",
329
+ responses: {
330
+ "200": {
331
+ description: "A list of dumpable collections",
332
+ content: {
333
+ "application/json": {
334
+ schema: {
335
+ type: "object",
336
+ properties: {
337
+ meta: {
338
+ type: "array",
339
+ items: {
340
+ type: "object",
341
+ properties: {
342
+ name: {
343
+ type: "string"
344
+ },
345
+ title: {
346
+ type: "string"
347
+ }
348
+ }
349
+ }
350
+ },
351
+ config: {
352
+ type: "array",
353
+ items: {
354
+ type: "object",
355
+ properties: {
356
+ name: {
357
+ type: "string"
358
+ },
359
+ title: {
360
+ type: "string"
361
+ }
362
+ }
363
+ }
364
+ },
365
+ business: {
366
+ type: "array",
367
+ items: {
368
+ type: "object",
369
+ properties: {
370
+ name: {
371
+ type: "string"
372
+ },
373
+ title: {
374
+ type: "string"
375
+ }
376
+ }
377
+ }
378
+ }
379
+ },
380
+ required: ["meta", "config", "business"]
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+ },
389
+ components: {
390
+ schemas: {
391
+ BackUpStatusOk: {
392
+ type: "object",
393
+ properties: {
394
+ name: {
395
+ type: "string"
396
+ },
397
+ createdAt: {
398
+ type: "string",
399
+ format: "date-time"
400
+ },
401
+ fileSize: {
402
+ type: "string"
403
+ },
404
+ status: {
405
+ type: "string",
406
+ enum: ["ok"]
407
+ }
408
+ },
409
+ required: ["name", "createdAt", "fileSize", "status"]
410
+ },
411
+ BackUpStatusDoing: {
412
+ type: "object",
413
+ properties: {
414
+ name: {
415
+ type: "string"
416
+ },
417
+ inProgress: {
418
+ type: "boolean",
419
+ enum: [true]
420
+ },
421
+ status: {
422
+ type: "string",
423
+ enum: ["in_progress"]
424
+ }
425
+ },
426
+ required: ["name", "inProgress", "status"]
427
+ },
428
+ DumpDataType: {
429
+ type: "string",
430
+ enum: ["meta", "config", "business"]
431
+ },
432
+ DumpOptions: {
433
+ type: "object",
434
+ properties: {
435
+ dataTypes: {
436
+ type: "array",
437
+ items: {
438
+ $ref: "#/components/schemas/DumpDataType"
439
+ },
440
+ uniqueItems: true
441
+ }
442
+ },
443
+ required: ["dataTypes"]
444
+ }
445
+ }
446
+ }
447
+ };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@tachybase/module-backup",
3
+ "displayName": "App backup & restore",
4
+ "version": "0.23.8",
5
+ "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.",
6
+ "keywords": [
7
+ "System management"
8
+ ],
9
+ "license": "Apache-2.0",
10
+ "main": "./dist/server/index.js",
11
+ "devDependencies": {
12
+ "@ant-design/icons": "^5.5.2",
13
+ "@hapi/topo": "^6.0.2",
14
+ "@types/archiver": "^5.3.4",
15
+ "@types/file-saver": "^2.0.7",
16
+ "@types/lodash": "4.17.13",
17
+ "antd": "5.22.5",
18
+ "archiver": "^5.3.2",
19
+ "content-disposition": "^0.5.4",
20
+ "dayjs": "1.11.13",
21
+ "decompress": "^4.2.1",
22
+ "file-saver": "^2.0.5",
23
+ "inquirer": "^8.2.6",
24
+ "koa-send": "^5.0.1",
25
+ "lodash": "4.17.21",
26
+ "mkdirp": "^1.0.4",
27
+ "object-path": "^0.11.8",
28
+ "react": "^18.3.1",
29
+ "react-i18next": "^15.2.0",
30
+ "semver": "^7.6.3",
31
+ "tar": "^6.2.1",
32
+ "@tachybase/components": "0.23.8",
33
+ "@tachybase/module-worker-thread": "0.23.8"
34
+ },
35
+ "peerDependencies": {
36
+ "@tachybase/actions": "0.23.8",
37
+ "@tachybase/test": "0.23.8",
38
+ "@tachybase/server": "0.23.8",
39
+ "@tachybase/client": "0.23.8",
40
+ "@tachybase/utils": "0.23.8",
41
+ "@tachybase/database": "0.23.8"
42
+ },
43
+ "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。",
44
+ "displayName.zh-CN": "应用的备份与还原",
45
+ "scripts": {
46
+ "build": "tachybase-build --no-dts @tachybase/module-backup"
47
+ }
48
+ }
package/server.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/server';
2
+ export { default } from './dist/server';
package/server.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/server/index.js');