@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,78 @@
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var utils_exports = {};
29
+ __export(utils_exports, {
30
+ DUMPED_EXTENSION: () => DUMPED_EXTENSION,
31
+ humanFileSize: () => humanFileSize,
32
+ readLines: () => readLines,
33
+ sqlAdapter: () => sqlAdapter
34
+ });
35
+ module.exports = __toCommonJS(utils_exports);
36
+ var import_fs = __toESM(require("fs"));
37
+ var import_readline = __toESM(require("readline"));
38
+ var import_lodash = __toESM(require("lodash"));
39
+ const DUMPED_EXTENSION = "tbdump";
40
+ function sqlAdapter(database, sql) {
41
+ if (database.isMySQLCompatibleDialect()) {
42
+ return import_lodash.default.replace(sql, /"/g, "`");
43
+ }
44
+ return sql;
45
+ }
46
+ async function readLines(filePath) {
47
+ const results = [];
48
+ const fileStream = import_fs.default.createReadStream(filePath);
49
+ const rl = import_readline.default.createInterface({
50
+ input: fileStream,
51
+ crlfDelay: Infinity
52
+ });
53
+ for await (const line of rl) {
54
+ results.push(line);
55
+ }
56
+ return results;
57
+ }
58
+ function humanFileSize(bytes, si = false, dp = 1) {
59
+ const thresh = si ? 1e3 : 1024;
60
+ if (Math.abs(bytes) < thresh) {
61
+ return bytes + " B";
62
+ }
63
+ const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
64
+ let u = -1;
65
+ const r = 10 ** dp;
66
+ do {
67
+ bytes /= thresh;
68
+ ++u;
69
+ } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
70
+ return bytes.toFixed(dp) + " " + units[u];
71
+ }
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ DUMPED_EXTENSION,
75
+ humanFileSize,
76
+ readLines,
77
+ sqlAdapter
78
+ });
@@ -0,0 +1,392 @@
1
+ declare const _default: {
2
+ info: {
3
+ title: string;
4
+ };
5
+ tags: any[];
6
+ paths: {
7
+ '/backupFiles:create': {
8
+ post: {
9
+ summary: string;
10
+ requestBody: {
11
+ required: boolean;
12
+ content: {
13
+ 'application/json': {
14
+ schema: {
15
+ $ref: string;
16
+ };
17
+ };
18
+ };
19
+ };
20
+ responses: {
21
+ '200': {
22
+ description: string;
23
+ content: {
24
+ 'application/json': {
25
+ schema: {
26
+ type: string;
27
+ properties: {
28
+ key: {
29
+ type: string;
30
+ };
31
+ };
32
+ };
33
+ };
34
+ };
35
+ };
36
+ };
37
+ };
38
+ };
39
+ '/backupFiles:list': {
40
+ get: {
41
+ summary: string;
42
+ parameters: {
43
+ name: string;
44
+ in: string;
45
+ description: string;
46
+ required: boolean;
47
+ schema: {
48
+ type: string;
49
+ format: string;
50
+ default: number;
51
+ };
52
+ }[];
53
+ responses: {
54
+ '200': {
55
+ description: string;
56
+ content: {
57
+ 'application/json': {
58
+ schema: {
59
+ type: string;
60
+ properties: {
61
+ data: {
62
+ type: string;
63
+ items: {
64
+ oneOf: {
65
+ $ref: string;
66
+ }[];
67
+ };
68
+ };
69
+ meta: {
70
+ type: string;
71
+ properties: {
72
+ page: {
73
+ type: string;
74
+ format: string;
75
+ };
76
+ pageSize: {
77
+ type: string;
78
+ format: string;
79
+ };
80
+ count: {
81
+ type: string;
82
+ format: string;
83
+ };
84
+ totalPage: {
85
+ type: string;
86
+ format: string;
87
+ };
88
+ };
89
+ };
90
+ };
91
+ required: string[];
92
+ };
93
+ };
94
+ };
95
+ };
96
+ };
97
+ };
98
+ };
99
+ '/backupFiles:get': {
100
+ get: {
101
+ summary: string;
102
+ parameters: {
103
+ name: string;
104
+ in: string;
105
+ required: boolean;
106
+ schema: {
107
+ type: string;
108
+ };
109
+ }[];
110
+ responses: {
111
+ '200': {
112
+ description: string;
113
+ content: {
114
+ 'application/json': {
115
+ schema: {
116
+ oneOf: {
117
+ $ref: string;
118
+ }[];
119
+ };
120
+ };
121
+ };
122
+ };
123
+ };
124
+ };
125
+ };
126
+ '/backupFiles:download': {
127
+ get: {
128
+ summary: string;
129
+ parameters: {
130
+ name: string;
131
+ in: string;
132
+ required: boolean;
133
+ schema: {
134
+ type: string;
135
+ };
136
+ }[];
137
+ responses: {
138
+ '200': {
139
+ description: string;
140
+ content: {
141
+ 'application/octet-stream': {
142
+ schema: {
143
+ type: string;
144
+ format: string;
145
+ };
146
+ };
147
+ };
148
+ };
149
+ };
150
+ };
151
+ };
152
+ '/backupFiles:destroy': {
153
+ post: {
154
+ summary: string;
155
+ parameters: {
156
+ name: string;
157
+ in: string;
158
+ required: boolean;
159
+ schema: {
160
+ type: string;
161
+ };
162
+ }[];
163
+ responses: {
164
+ '200': {
165
+ description: string;
166
+ content: {
167
+ 'application/json': {
168
+ schema: {
169
+ type: string;
170
+ properties: {
171
+ status: {
172
+ type: string;
173
+ };
174
+ };
175
+ };
176
+ };
177
+ };
178
+ };
179
+ };
180
+ };
181
+ };
182
+ '/backupFiles:upload': {
183
+ post: {
184
+ summary: string;
185
+ requestBody: {
186
+ required: boolean;
187
+ content: {
188
+ 'multipart/form-data': {
189
+ schema: {
190
+ type: string;
191
+ properties: {
192
+ file: {
193
+ type: string;
194
+ format: string;
195
+ };
196
+ };
197
+ };
198
+ };
199
+ };
200
+ };
201
+ responses: {
202
+ 200: {
203
+ description: string;
204
+ content: {
205
+ 'application/json': {
206
+ schema: {
207
+ type: string;
208
+ properties: {
209
+ key: {
210
+ type: string;
211
+ };
212
+ };
213
+ };
214
+ };
215
+ };
216
+ };
217
+ };
218
+ };
219
+ };
220
+ '/backupFiles:restore': {
221
+ post: {
222
+ summary: string;
223
+ requestBody: {
224
+ required: boolean;
225
+ content: {
226
+ 'application/json': {
227
+ schema: {
228
+ type: string;
229
+ properties: {
230
+ filterByTk: {
231
+ type: string;
232
+ };
233
+ dataTypes: {
234
+ type: string;
235
+ items: {
236
+ $ref: string;
237
+ };
238
+ uniqueItems: boolean;
239
+ };
240
+ key: {
241
+ type: string;
242
+ };
243
+ };
244
+ oneOf: {
245
+ required: string[];
246
+ }[];
247
+ };
248
+ };
249
+ };
250
+ };
251
+ responses: {
252
+ '200': {
253
+ description: string;
254
+ content: {
255
+ 'application/json': {
256
+ schema: {
257
+ type: string;
258
+ properties: {
259
+ status: {
260
+ type: string;
261
+ };
262
+ };
263
+ };
264
+ };
265
+ };
266
+ };
267
+ };
268
+ };
269
+ };
270
+ '/backupFiles:dumpableCollections': {
271
+ get: {
272
+ summary: string;
273
+ responses: {
274
+ '200': {
275
+ description: string;
276
+ content: {
277
+ 'application/json': {
278
+ schema: {
279
+ type: string;
280
+ properties: {
281
+ meta: {
282
+ type: string;
283
+ items: {
284
+ type: string;
285
+ properties: {
286
+ name: {
287
+ type: string;
288
+ };
289
+ title: {
290
+ type: string;
291
+ };
292
+ };
293
+ };
294
+ };
295
+ config: {
296
+ type: string;
297
+ items: {
298
+ type: string;
299
+ properties: {
300
+ name: {
301
+ type: string;
302
+ };
303
+ title: {
304
+ type: string;
305
+ };
306
+ };
307
+ };
308
+ };
309
+ business: {
310
+ type: string;
311
+ items: {
312
+ type: string;
313
+ properties: {
314
+ name: {
315
+ type: string;
316
+ };
317
+ title: {
318
+ type: string;
319
+ };
320
+ };
321
+ };
322
+ };
323
+ };
324
+ required: string[];
325
+ };
326
+ };
327
+ };
328
+ };
329
+ };
330
+ };
331
+ };
332
+ };
333
+ components: {
334
+ schemas: {
335
+ BackUpStatusOk: {
336
+ type: string;
337
+ properties: {
338
+ name: {
339
+ type: string;
340
+ };
341
+ createdAt: {
342
+ type: string;
343
+ format: string;
344
+ };
345
+ fileSize: {
346
+ type: string;
347
+ };
348
+ status: {
349
+ type: string;
350
+ enum: string[];
351
+ };
352
+ };
353
+ required: string[];
354
+ };
355
+ BackUpStatusDoing: {
356
+ type: string;
357
+ properties: {
358
+ name: {
359
+ type: string;
360
+ };
361
+ inProgress: {
362
+ type: string;
363
+ enum: boolean[];
364
+ };
365
+ status: {
366
+ type: string;
367
+ enum: string[];
368
+ };
369
+ };
370
+ required: string[];
371
+ };
372
+ DumpDataType: {
373
+ type: string;
374
+ enum: string[];
375
+ };
376
+ DumpOptions: {
377
+ type: string;
378
+ properties: {
379
+ dataTypes: {
380
+ type: string;
381
+ items: {
382
+ $ref: string;
383
+ };
384
+ uniqueItems: boolean;
385
+ };
386
+ };
387
+ required: string[];
388
+ };
389
+ };
390
+ };
391
+ };
392
+ export default _default;