@tachybase/module-backup 0.23.40 → 0.23.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +6 -6
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/semver/package.json +1 -1
- package/dist/node_modules/yauzl/package.json +1 -1
- package/dist/server/app-migrator.js +0 -2
- package/dist/server/collection-group-manager.js +1 -1
- package/dist/server/dumper.js +13 -9
- package/dist/server/field-value-writer.js +6 -5
- package/dist/server/restorer.js +3 -4
- package/package.json +9 -9
package/dist/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "0.23.
|
|
4
|
-
"@tachybase/components": "0.23.
|
|
3
|
+
"@tachybase/client": "0.23.47",
|
|
4
|
+
"@tachybase/components": "0.23.47",
|
|
5
5
|
"@ant-design/icons": "5.5.2",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
|
-
"@tachybase/server": "0.23.
|
|
8
|
-
"@tachybase/utils": "0.23.
|
|
9
|
-
"@tachybase/database": "0.23.
|
|
7
|
+
"@tachybase/server": "0.23.47",
|
|
8
|
+
"@tachybase/utils": "0.23.47",
|
|
9
|
+
"@tachybase/database": "0.23.47",
|
|
10
10
|
"dayjs": "1.11.13",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
12
|
"react-i18next": "15.2.0",
|
|
13
|
-
"@tachybase/actions": "0.23.
|
|
13
|
+
"@tachybase/actions": "0.23.47"
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-
|
|
1
|
+
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-02-21T02:27:09.069Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"archiver","version":"5.3.2","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 10"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^2.1.0","async":"^3.2.4","buffer-crc32":"^0.2.1","readable-stream":"^3.6.0","readdir-glob":"^1.1.2","tar-stream":"^2.2.0","zip-stream":"^4.1.0"},"devDependencies":{"archiver-jsdoc-theme":"^1.1.3","chai":"^4.3.7","jsdoc":"^3.6.4","mkdirp":"^2.1.5","mocha":"^9.0.2","rimraf":"^4.3.1","stream-bench":"^0.1.2","tar":"^6.1.13","yauzl":"^2.9.0"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-
|
|
1
|
+
{"name":"archiver","version":"5.3.2","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 10"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^2.1.0","async":"^3.2.4","buffer-crc32":"^0.2.1","readable-stream":"^3.6.0","readdir-glob":"^1.1.2","tar-stream":"^2.2.0","zip-stream":"^4.1.0"},"devDependencies":{"archiver-jsdoc-theme":"^1.1.3","chai":"^4.3.7","jsdoc":"^3.6.4","mkdirp":"^2.1.5","mocha":"^9.0.2","rimraf":"^4.3.1","stream-bench":"^0.1.2","tar":"^6.1.13","yauzl":"^2.9.0"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-02-21T02:27:08.876Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2025-
|
|
1
|
+
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2025-02-21T02:27:08.972Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"semver","version":"7.6.3","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","postlint":"template-oss-check","lintfix":"npm run lint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.22.0","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.22.0","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-
|
|
1
|
+
{"name":"semver","version":"7.6.3","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","postlint":"template-oss-check","lintfix":"npm run lint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.22.0","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.22.0","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-02-21T02:27:09.304Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-
|
|
1
|
+
{"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-02-21T02:27:09.462Z"}
|
|
@@ -37,8 +37,6 @@ var os = __toESM(require("os"));
|
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
38
|
var import_utils = require("@tachybase/utils");
|
|
39
39
|
class AppMigrator extends import_events.default {
|
|
40
|
-
workDir;
|
|
41
|
-
app;
|
|
42
40
|
constructor(app, options) {
|
|
43
41
|
super();
|
|
44
42
|
this.app = app;
|
|
@@ -21,8 +21,8 @@ __export(collection_group_manager_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(collection_group_manager_exports);
|
|
23
23
|
class CollectionGroupManager {
|
|
24
|
-
static collectionGroups = [];
|
|
25
24
|
}
|
|
25
|
+
CollectionGroupManager.collectionGroups = [];
|
|
26
26
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
27
|
0 && (module.exports = {
|
|
28
28
|
CollectionGroupManager
|
package/dist/server/dumper.js
CHANGED
|
@@ -46,10 +46,12 @@ var import_app_migrator = require("./app-migrator");
|
|
|
46
46
|
var import_field_value_writer = require("./field-value-writer");
|
|
47
47
|
var import_utils = require("./utils");
|
|
48
48
|
const finished = import_util.default.promisify(import_stream.default.finished);
|
|
49
|
-
class
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
this.direction = "dump";
|
|
53
|
+
this.sqlContent = {};
|
|
54
|
+
}
|
|
53
55
|
static getTaskPromise(taskId) {
|
|
54
56
|
return this.dumpTasks.get(taskId);
|
|
55
57
|
}
|
|
@@ -183,7 +185,7 @@ class Dumper extends import_app_migrator.AppMigrator {
|
|
|
183
185
|
await import_promises.default.unlink(filePath);
|
|
184
186
|
}
|
|
185
187
|
async runDumpTask(options) {
|
|
186
|
-
const backupFileName =
|
|
188
|
+
const backupFileName = _Dumper.generateFileName();
|
|
187
189
|
await this.writeLockFile(backupFileName);
|
|
188
190
|
if (import_worker_threads.isMainThread) {
|
|
189
191
|
const promise = this.dump({
|
|
@@ -191,10 +193,10 @@ class Dumper extends import_app_migrator.AppMigrator {
|
|
|
191
193
|
fileName: backupFileName
|
|
192
194
|
}).finally(() => {
|
|
193
195
|
this.cleanLockFile(backupFileName);
|
|
194
|
-
|
|
196
|
+
_Dumper.dumpTasks.delete(backupFileName);
|
|
195
197
|
this.app.noticeManager.notify("backup", { msg: "Done" });
|
|
196
198
|
});
|
|
197
|
-
|
|
199
|
+
_Dumper.dumpTasks.set(backupFileName, promise);
|
|
198
200
|
} else {
|
|
199
201
|
try {
|
|
200
202
|
await this.dump({
|
|
@@ -232,7 +234,7 @@ class Dumper extends import_app_migrator.AppMigrator {
|
|
|
232
234
|
delayCollections: [...delayCollections]
|
|
233
235
|
});
|
|
234
236
|
await this.dumpDb(options);
|
|
235
|
-
const backupFileName = options.fileName ||
|
|
237
|
+
const backupFileName = options.fileName || _Dumper.generateFileName();
|
|
236
238
|
const filePath = await this.packDumpedDir(backupFileName);
|
|
237
239
|
await this.clearWorkDir();
|
|
238
240
|
return filePath;
|
|
@@ -413,7 +415,9 @@ class Dumper extends import_app_migrator.AppMigrator {
|
|
|
413
415
|
dirname
|
|
414
416
|
};
|
|
415
417
|
}
|
|
416
|
-
}
|
|
418
|
+
};
|
|
419
|
+
_Dumper.dumpTasks = /* @__PURE__ */ new Map();
|
|
420
|
+
let Dumper = _Dumper;
|
|
417
421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
418
422
|
0 && (module.exports = {
|
|
419
423
|
Dumper
|
|
@@ -43,15 +43,14 @@ const getMapFieldWriter = (field) => {
|
|
|
43
43
|
return val;
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
class
|
|
47
|
-
static writers = /* @__PURE__ */ new Map();
|
|
46
|
+
const _FieldValueWriter = class _FieldValueWriter {
|
|
48
47
|
static write(field, val) {
|
|
49
48
|
if (val === null) return val;
|
|
50
49
|
if (field.type == "point" || field.type == "lineString" || field.type == "circle" || field.type === "polygon") {
|
|
51
50
|
return getMapFieldWriter(field)(import_lodash.default.isString(val) ? JSON.parse(val) : val);
|
|
52
51
|
}
|
|
53
52
|
const fieldType = field.typeToString();
|
|
54
|
-
const writer =
|
|
53
|
+
const writer = _FieldValueWriter.writers[fieldType];
|
|
55
54
|
if (writer) {
|
|
56
55
|
val = writer(val);
|
|
57
56
|
}
|
|
@@ -70,10 +69,12 @@ class FieldValueWriter {
|
|
|
70
69
|
}
|
|
71
70
|
static registerWriter(types, writer) {
|
|
72
71
|
for (const type of import_lodash.default.castArray(types)) {
|
|
73
|
-
|
|
72
|
+
_FieldValueWriter.writers[type] = writer;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
}
|
|
75
|
+
};
|
|
76
|
+
_FieldValueWriter.writers = /* @__PURE__ */ new Map();
|
|
77
|
+
let FieldValueWriter = _FieldValueWriter;
|
|
77
78
|
function isJSONObjectOrArrayString(str) {
|
|
78
79
|
try {
|
|
79
80
|
const parsed = JSON.parse(str);
|
package/dist/server/restorer.js
CHANGED
|
@@ -43,12 +43,11 @@ var import_restore_check_error = require("./errors/restore-check-error");
|
|
|
43
43
|
var import_field_value_writer = require("./field-value-writer");
|
|
44
44
|
var import_utils = require("./utils");
|
|
45
45
|
class Restorer extends import_app_migrator.AppMigrator {
|
|
46
|
-
direction = "restore";
|
|
47
|
-
backUpFilePath;
|
|
48
|
-
decompressed = false;
|
|
49
|
-
importedCollections = [];
|
|
50
46
|
constructor(app, options) {
|
|
51
47
|
super(app, options);
|
|
48
|
+
this.direction = "restore";
|
|
49
|
+
this.decompressed = false;
|
|
50
|
+
this.importedCollections = [];
|
|
52
51
|
const { backUpFilePath } = options;
|
|
53
52
|
if (backUpFilePath) {
|
|
54
53
|
this.setBackUpFilePath(backUpFilePath);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-backup",
|
|
3
3
|
"displayName": "App backup & restore",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.47",
|
|
5
5
|
"description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"System management"
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"semver": "^7.6.3",
|
|
31
31
|
"tar": "^6.2.1",
|
|
32
32
|
"yauzl": "^3.2.0",
|
|
33
|
-
"@tachybase/components": "0.23.
|
|
34
|
-
"@tachybase/module-worker-thread": "0.23.
|
|
33
|
+
"@tachybase/components": "0.23.47",
|
|
34
|
+
"@tachybase/module-worker-thread": "0.23.47"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@tachybase/actions": "0.23.
|
|
38
|
-
"@tachybase/client": "0.23.
|
|
39
|
-
"@tachybase/
|
|
40
|
-
"@tachybase/
|
|
41
|
-
"@tachybase/
|
|
42
|
-
"@tachybase/
|
|
37
|
+
"@tachybase/actions": "0.23.47",
|
|
38
|
+
"@tachybase/client": "0.23.47",
|
|
39
|
+
"@tachybase/server": "0.23.47",
|
|
40
|
+
"@tachybase/database": "0.23.47",
|
|
41
|
+
"@tachybase/utils": "0.23.47",
|
|
42
|
+
"@tachybase/test": "0.23.47"
|
|
43
43
|
},
|
|
44
44
|
"description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。",
|
|
45
45
|
"displayName.zh-CN": "应用的备份与还原",
|