@datatruck/cli 0.17.1 → 0.17.2
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/Action/BackupAction.d.ts +1 -1
- package/Action/BackupAction.js +14 -14
- package/Action/BackupSessionsAction.d.ts +1 -1
- package/Action/CleanCacheAction.d.ts +1 -1
- package/Action/CleanCacheAction.js +3 -3
- package/Action/ConfigAction.d.ts +1 -1
- package/Action/ConfigAction.js +5 -5
- package/Action/InitAction.d.ts +1 -1
- package/Action/InitAction.js +2 -2
- package/Action/PruneAction.d.ts +1 -1
- package/Action/PruneAction.js +4 -4
- package/Action/RestoreAction.d.ts +1 -1
- package/Action/RestoreAction.js +18 -18
- package/Action/RestoreSessionsAction.d.ts +1 -1
- package/Action/SnapshotsAction.d.ts +1 -1
- package/Action/SnapshotsAction.js +4 -4
- package/Command/BackupCommand.d.ts +2 -2
- package/Command/BackupCommand.js +6 -6
- package/Command/BackupSessionsCommand.d.ts +2 -2
- package/Command/BackupSessionsCommand.js +9 -9
- package/Command/CleanCacheCommand.d.ts +1 -1
- package/Command/CleanCacheCommand.js +2 -2
- package/Command/CommandAbstract.d.ts +3 -3
- package/Command/CommandAbstract.js +2 -2
- package/Command/ConfigCommand.d.ts +2 -2
- package/Command/ConfigCommand.js +8 -8
- package/Command/InitCommand.d.ts +2 -2
- package/Command/InitCommand.js +9 -9
- package/Command/PruneCommand.d.ts +2 -2
- package/Command/PruneCommand.js +10 -10
- package/Command/RestoreCommand.d.ts +2 -2
- package/Command/RestoreCommand.js +6 -6
- package/Command/RestoreSessionsCommand.d.ts +2 -2
- package/Command/RestoreSessionsCommand.js +9 -9
- package/Command/SnapshotsCommand.d.ts +2 -2
- package/Command/SnapshotsCommand.js +9 -9
- package/Entity/StateEntityAbstract.d.ts +1 -1
- package/Repository/DatatruckRepository.d.ts +1 -1
- package/Repository/DatatruckRepository.js +56 -52
- package/Repository/GitRepository.js +23 -23
- package/Repository/RepositoryAbstract.d.ts +1 -1
- package/Repository/RepositoryAbstract.js +2 -2
- package/Repository/ResticRepository.d.ts +1 -1
- package/Repository/ResticRepository.js +27 -27
- package/SessionDriver/ConsoleSessionDriver.d.ts +1 -1
- package/SessionDriver/ConsoleSessionDriver.js +10 -10
- package/SessionDriver/SqliteSessionDriver.js +12 -12
- package/SessionManager/BackupSessionManager.d.ts +2 -2
- package/SessionManager/BackupSessionManager.js +1 -1
- package/SessionManager/RestoreSessionManager.d.ts +2 -2
- package/SessionManager/RestoreSessionManager.js +1 -1
- package/Task/GitTask.js +21 -21
- package/Task/MariadbTask.js +11 -11
- package/Task/MssqlTask.js +8 -8
- package/Task/MysqlDumpTask.d.ts +1 -1
- package/Task/MysqlDumpTask.js +13 -13
- package/Task/PostgresqlDumpTask.d.ts +1 -1
- package/Task/PostgresqlDumpTask.js +4 -4
- package/Task/ScriptTask.js +7 -7
- package/Task/SqlDumpTaskAbstract.d.ts +1 -1
- package/Task/SqlDumpTaskAbstract.js +12 -12
- package/Task/TaskAbstract.d.ts +1 -1
- package/Task/TaskAbstract.js +2 -2
- package/cli.js +10 -10
- package/package.json +1 -1
- package/{util → utils}/DataFormat.d.ts +0 -0
- package/{util → utils}/DataFormat.js +0 -0
- package/{util/GitUtil.d.ts → utils/Git.d.ts} +8 -8
- package/{util/GitUtil.js → utils/Git.js} +8 -8
- package/{util → utils}/ObjectVault.d.ts +0 -0
- package/{util → utils}/ObjectVault.js +0 -0
- package/{util/ResticUtil.d.ts → utils/Restic.d.ts} +3 -3
- package/{util/ResticUtil.js → utils/Restic.js} +9 -9
- package/{util/cli-util.d.ts → utils/cli.d.ts} +0 -0
- package/{util/cli-util.js → utils/cli.js} +0 -0
- package/{util/datatruck/config-util.d.ts → utils/datatruck/config.d.ts} +0 -0
- package/{util/datatruck/config-util.js → utils/datatruck/config.js} +10 -10
- package/{util/datatruck/paths-util.d.ts → utils/datatruck/paths.d.ts} +0 -0
- package/{util/datatruck/paths-util.js → utils/datatruck/paths.js} +2 -2
- package/{util/datatruck/snapshot-util.d.ts → utils/datatruck/snapshot.d.ts} +1 -1
- package/{util/datatruck/snapshot-util.js → utils/datatruck/snapshot.js} +4 -4
- package/{util/date-util.d.ts → utils/date.d.ts} +0 -0
- package/{util/date-util.js → utils/date.js} +2 -2
- package/{util/entity-util.d.ts → utils/entity.d.ts} +0 -0
- package/{util/entity-util.js → utils/entity.js} +0 -0
- package/{util/fs-util.d.ts → utils/fs.d.ts} +0 -0
- package/{util/fs-util.js → utils/fs.js} +17 -17
- package/{util/math-util.d.ts → utils/math.d.ts} +0 -0
- package/{util/math-util.js → utils/math.js} +0 -0
- package/{util/object-util.d.ts → utils/object.d.ts} +0 -0
- package/{util/object-util.js → utils/object.js} +0 -0
- package/{util/path-util.d.ts → utils/path.d.ts} +0 -0
- package/{util/path-util.js → utils/path.js} +0 -0
- package/{util/process-util.d.ts → utils/process.d.ts} +0 -0
- package/{util/process-util.js → utils/process.js} +13 -13
- package/{util → utils}/progress.d.ts +0 -0
- package/{util → utils}/progress.js +0 -0
- package/{util/string-util.d.ts → utils/string.d.ts} +0 -0
- package/{util/string-util.js → utils/string.js} +0 -0
- package/{util/zip-util.d.ts → utils/zip.d.ts} +0 -0
- package/{util/zip-util.js → utils/zip.js} +5 -5
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.onExit = exports.exec = exports.logExecStderr = exports.logExecStdout = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const cli_1 = require("./cli");
|
|
8
|
+
const fs_1 = require("./fs");
|
|
9
|
+
const math_1 = require("./math");
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
|
-
const
|
|
12
|
+
const fs_2 = require("fs");
|
|
13
13
|
const promises_1 = require("fs/promises");
|
|
14
14
|
const readline_1 = require("readline");
|
|
15
15
|
function logExecStdout(input) {
|
|
@@ -40,17 +40,17 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
40
40
|
env[key] = value;
|
|
41
41
|
return env;
|
|
42
42
|
}, {});
|
|
43
|
-
(0,
|
|
43
|
+
(0, cli_1.logExec)(command, pipe
|
|
44
44
|
? [
|
|
45
45
|
...argv,
|
|
46
|
-
pipe.stream instanceof
|
|
46
|
+
pipe.stream instanceof fs_2.ReadStream ? "<" : ">",
|
|
47
47
|
String(pipe.stream.path),
|
|
48
48
|
]
|
|
49
49
|
: argv, logEnv, log.allToStderr);
|
|
50
50
|
}
|
|
51
|
-
if (typeof options?.cwd === "string" && !(await (0,
|
|
51
|
+
if (typeof options?.cwd === "string" && !(await (0, fs_1.checkDir)(options.cwd)))
|
|
52
52
|
return reject(new Error(`Current working directory does not exist: ${options.cwd}`));
|
|
53
|
-
if (pipe?.onReadProgress && pipe.stream instanceof
|
|
53
|
+
if (pipe?.onReadProgress && pipe.stream instanceof fs_2.ReadStream) {
|
|
54
54
|
const fileInfo = await (0, promises_1.stat)(pipe.stream.path);
|
|
55
55
|
const totalBytes = fileInfo.size;
|
|
56
56
|
let currentBytes = 0;
|
|
@@ -59,7 +59,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
59
59
|
pipe.onReadProgress?.({
|
|
60
60
|
totalBytes: totalBytes,
|
|
61
61
|
currentBytes: currentBytes,
|
|
62
|
-
progress: (0,
|
|
62
|
+
progress: (0, math_1.progressPercent)(totalBytes, currentBytes),
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -72,7 +72,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
72
72
|
exitCode: 0,
|
|
73
73
|
};
|
|
74
74
|
let finishListeners = 1;
|
|
75
|
-
if (pipe?.stream instanceof
|
|
75
|
+
if (pipe?.stream instanceof fs_2.WriteStream)
|
|
76
76
|
finishListeners++;
|
|
77
77
|
if (settings.stdout?.parseLines)
|
|
78
78
|
finishListeners++;
|
|
@@ -116,7 +116,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
116
116
|
streamError = error;
|
|
117
117
|
tryFinish();
|
|
118
118
|
});
|
|
119
|
-
if (pipe.stream instanceof
|
|
119
|
+
if (pipe.stream instanceof fs_2.WriteStream) {
|
|
120
120
|
if (!p.stdout)
|
|
121
121
|
throw new Error(`stdout is not defined`);
|
|
122
122
|
if (!p.stderr)
|
|
@@ -136,7 +136,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
136
136
|
p.stderr.pipe(pipe.stream, { end: false });
|
|
137
137
|
p.on("close", tryFinish);
|
|
138
138
|
}
|
|
139
|
-
else if (pipe.stream instanceof
|
|
139
|
+
else if (pipe.stream instanceof fs_2.ReadStream) {
|
|
140
140
|
if (!p.stdin)
|
|
141
141
|
throw new Error(`stdin is not defined`);
|
|
142
142
|
pipe.stream.pipe(p.stdin);
|
|
@@ -187,7 +187,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
|
|
|
187
187
|
}
|
|
188
188
|
p.on("error", (error) => (spawnError = error)).on("close", (exitCode) => {
|
|
189
189
|
spawnData.exitCode = exitCode ?? 0;
|
|
190
|
-
if (pipe?.stream instanceof
|
|
190
|
+
if (pipe?.stream instanceof fs_2.WriteStream)
|
|
191
191
|
pipe.stream.end();
|
|
192
192
|
tryFinish();
|
|
193
193
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.unzip = exports.zip = exports.listZip = exports.checkSSEOption = exports.buildArguments = void 0;
|
|
4
|
-
const
|
|
4
|
+
const process_1 = require("./process");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
function buildArguments(filters) {
|
|
7
7
|
const args = [];
|
|
@@ -32,7 +32,7 @@ function buildArguments(filters) {
|
|
|
32
32
|
exports.buildArguments = buildArguments;
|
|
33
33
|
let checkSSEOptionResult;
|
|
34
34
|
async function checkSSEOption(command = "7z") {
|
|
35
|
-
const result = await (0,
|
|
35
|
+
const result = await (0, process_1.exec)(command, [], {}, {
|
|
36
36
|
stdout: {
|
|
37
37
|
save: true,
|
|
38
38
|
},
|
|
@@ -68,7 +68,7 @@ function parseListZipLine(line, buffer) {
|
|
|
68
68
|
}
|
|
69
69
|
async function listZip(data) {
|
|
70
70
|
const buffer = {};
|
|
71
|
-
await (0,
|
|
71
|
+
await (0, process_1.exec)(data.command ?? "7z", ["l", data.path, "-slt"], {}, {
|
|
72
72
|
log: {
|
|
73
73
|
exec: data.verbose ?? false,
|
|
74
74
|
stderr: data.verbose ?? false,
|
|
@@ -124,7 +124,7 @@ async function zip(data) {
|
|
|
124
124
|
total: 0,
|
|
125
125
|
type: "start",
|
|
126
126
|
});
|
|
127
|
-
await (0,
|
|
127
|
+
await (0, process_1.exec)(data.command ?? "7z", [
|
|
128
128
|
"a",
|
|
129
129
|
// https://sourceforge.net/p/sevenzip/bugs/2099/,
|
|
130
130
|
// https://github.com/mcmilk/7-Zip/commit/87ba6f01ba3c5b2ce3186bddfe3d7d880639193c#diff-779d6b1bfa6196b288478f78ca96c4d4c6d7ac6cf8be15a28a20dabc9137ca36L515
|
|
@@ -192,7 +192,7 @@ async function unzip(data) {
|
|
|
192
192
|
percent: 0,
|
|
193
193
|
type: "start",
|
|
194
194
|
});
|
|
195
|
-
const result = await (0,
|
|
195
|
+
const result = await (0, process_1.exec)(data.command ?? "7z", [
|
|
196
196
|
"x",
|
|
197
197
|
"-bsp1",
|
|
198
198
|
(0, path_1.normalize)(data.input),
|