@datatruck/cli 0.40.0 → 0.40.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/lib/actions/BackupAction.js +19 -12
- package/lib/actions/CopyAction.js +20 -12
- package/lib/actions/ExportAction.js +12 -5
- package/lib/actions/RestoreAction.js +12 -5
- package/lib/cli.js +2 -3
- package/lib/repositories/ResticRepository.d.ts +2 -2
- package/lib/tasks/MysqlDumpTask.js +12 -5
- package/lib/tasks/ScriptTask.js +2 -2
- package/lib/utils/async-process.d.ts +0 -5
- package/lib/utils/async.d.ts +0 -1
- package/lib/utils/async.js +1 -2
- package/lib/utils/bytes.js +2 -3
- package/lib/utils/cli.d.ts +0 -1
- package/lib/utils/cli.js +12 -12
- package/lib/utils/cron.js +1 -2
- package/lib/utils/crypto.js +2 -3
- package/lib/utils/datatruck/client.d.ts +1 -2
- package/lib/utils/datatruck/client.js +3 -3
- package/lib/utils/datatruck/command.js +3 -3
- package/lib/utils/datatruck/config.js +15 -15
- package/lib/utils/datatruck/cron-server.js +1 -2
- package/lib/utils/datatruck/job.js +4 -5
- package/lib/utils/datatruck/paths.js +2 -3
- package/lib/utils/datatruck/report-list.js +1 -2
- package/lib/utils/datatruck/repository-server.d.ts +0 -1
- package/lib/utils/datatruck/repository-server.js +7 -3
- package/lib/utils/datatruck/repository.js +4 -5
- package/lib/utils/datatruck/snapshot.js +1 -2
- package/lib/utils/datatruck/task.js +1 -2
- package/lib/utils/date.js +4 -5
- package/lib/utils/exit.js +4 -5
- package/lib/utils/fs.d.ts +0 -3
- package/lib/utils/fs.js +40 -40
- package/lib/utils/git.d.ts +1 -1
- package/lib/utils/http.d.ts +3 -7
- package/lib/utils/http.js +17 -17
- package/lib/utils/list.d.ts +2 -2
- package/lib/utils/list.js +36 -26
- package/lib/utils/logs.js +3 -3
- package/lib/utils/math.js +2 -2
- package/lib/utils/mongodb.js +2 -3
- package/lib/utils/mysql.d.ts +0 -1
- package/lib/utils/mysql.js +2 -3
- package/lib/utils/object.js +6 -6
- package/lib/utils/options.js +5 -4
- package/lib/utils/process.d.ts +0 -1
- package/lib/utils/process.js +3 -4
- package/lib/utils/progress.d.ts +0 -2
- package/lib/utils/progress.js +3 -3
- package/lib/utils/reportSteps.js +2 -3
- package/lib/utils/spawnSteps.js +2 -3
- package/lib/utils/stream.d.ts +0 -1
- package/lib/utils/stream.js +2 -3
- package/lib/utils/string.js +11 -12
- package/lib/utils/tar.js +6 -7
- package/lib/utils/temp.d.ts +0 -1
- package/lib/utils/temp.js +10 -10
- package/lib/utils/virtual-fs.js +2 -2
- package/lib/utils/watcher.js +1 -2
- package/package.json +14 -13
package/lib/utils/object.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StrictMap =
|
|
3
|
+
exports.StrictMap = void 0;
|
|
4
|
+
exports.merge = merge;
|
|
5
|
+
exports.omitProp = omitProp;
|
|
6
|
+
exports.pickProps = pickProps;
|
|
7
|
+
exports.getErrorProperties = getErrorProperties;
|
|
8
|
+
exports.groupBy = groupBy;
|
|
4
9
|
function merge(target, ...sources) {
|
|
5
10
|
const isObject = (o) => typeof o === "object" && o !== null;
|
|
6
11
|
for (const source of sources)
|
|
@@ -12,13 +17,11 @@ function merge(target, ...sources) {
|
|
|
12
17
|
}
|
|
13
18
|
return target;
|
|
14
19
|
}
|
|
15
|
-
exports.merge = merge;
|
|
16
20
|
function omitProp(object, name) {
|
|
17
21
|
const result = { ...object };
|
|
18
22
|
delete result[name];
|
|
19
23
|
return result;
|
|
20
24
|
}
|
|
21
|
-
exports.omitProp = omitProp;
|
|
22
25
|
function pickProps(object, input) {
|
|
23
26
|
const result = {};
|
|
24
27
|
for (const name in input) {
|
|
@@ -27,7 +30,6 @@ function pickProps(object, input) {
|
|
|
27
30
|
}
|
|
28
31
|
return result;
|
|
29
32
|
}
|
|
30
|
-
exports.pickProps = pickProps;
|
|
31
33
|
function getErrorProperties(error) {
|
|
32
34
|
const alt = {};
|
|
33
35
|
for (const key of Object.getOwnPropertyNames(error)) {
|
|
@@ -35,7 +37,6 @@ function getErrorProperties(error) {
|
|
|
35
37
|
}
|
|
36
38
|
return alt;
|
|
37
39
|
}
|
|
38
|
-
exports.getErrorProperties = getErrorProperties;
|
|
39
40
|
function groupBy(items, keyOrCb, single) {
|
|
40
41
|
const keyCb = typeof keyOrCb === "function"
|
|
41
42
|
? keyOrCb
|
|
@@ -64,7 +65,6 @@ function groupBy(items, keyOrCb, single) {
|
|
|
64
65
|
}, {});
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
exports.groupBy = groupBy;
|
|
68
68
|
class StrictMap {
|
|
69
69
|
serializeKey;
|
|
70
70
|
constructor(serializeKey) {
|
package/lib/utils/options.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createCommand = createCommand;
|
|
4
|
+
exports.stringifyOptions = stringifyOptions;
|
|
4
5
|
const string_1 = require("./string");
|
|
5
6
|
const commander_1 = require("commander");
|
|
6
7
|
function createCommand(config, action) {
|
|
@@ -49,7 +50,9 @@ function createCommand(config, action) {
|
|
|
49
50
|
for (const name in config.options) {
|
|
50
51
|
const option = config.options[name];
|
|
51
52
|
if (option.flag !== false) {
|
|
52
|
-
const parse = typeof option.value === "string"
|
|
53
|
+
const parse = typeof option.value === "string"
|
|
54
|
+
? parsers[option.value]
|
|
55
|
+
: option.value;
|
|
53
56
|
const cliValue = cliOptions[option.flag ?? name] ?? option.defaults;
|
|
54
57
|
if (cliValue !== undefined)
|
|
55
58
|
commandOptions[name] = parse ? parse(cliValue) : cliValue;
|
|
@@ -64,7 +67,6 @@ function createCommand(config, action) {
|
|
|
64
67
|
return await action(options);
|
|
65
68
|
});
|
|
66
69
|
}
|
|
67
|
-
exports.createCommand = createCommand;
|
|
68
70
|
function stringifyOptions(options, object) {
|
|
69
71
|
const result = [];
|
|
70
72
|
const prepend = [];
|
|
@@ -92,4 +94,3 @@ function stringifyOptions(options, object) {
|
|
|
92
94
|
}
|
|
93
95
|
return [...prepend, ...result];
|
|
94
96
|
}
|
|
95
|
-
exports.stringifyOptions = stringifyOptions;
|
package/lib/utils/process.d.ts
CHANGED
package/lib/utils/process.js
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.logStdout = logStdout;
|
|
7
|
+
exports.logStderr = logStderr;
|
|
8
|
+
exports.logProcess = logProcess;
|
|
7
9
|
const cli_1 = require("./cli");
|
|
8
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
11
|
const stream_1 = require("stream");
|
|
@@ -13,11 +15,9 @@ function logStdout(input) {
|
|
|
13
15
|
text += "\n";
|
|
14
16
|
input.stderr ? process.stderr.write(text) : process.stdout.write(text);
|
|
15
17
|
}
|
|
16
|
-
exports.logStdout = logStdout;
|
|
17
18
|
function logStderr(data, colorize) {
|
|
18
19
|
process.stdout.write(colorize ? chalk_1.default.red(data) : data);
|
|
19
20
|
}
|
|
20
|
-
exports.logStderr = logStderr;
|
|
21
21
|
async function logProcess(command, argv, options) {
|
|
22
22
|
const logEnv = options.envNames?.reduce((env, key) => {
|
|
23
23
|
const value = options?.env?.[key];
|
|
@@ -33,4 +33,3 @@ async function logProcess(command, argv, options) {
|
|
|
33
33
|
]
|
|
34
34
|
: argv, logEnv, options.toStderr);
|
|
35
35
|
}
|
|
36
|
-
exports.logProcess = logProcess;
|
package/lib/utils/progress.d.ts
CHANGED
package/lib/utils/progress.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ProgressManager = void 0;
|
|
4
|
+
exports.renderProgress = renderProgress;
|
|
5
|
+
exports.renderProgressStats = renderProgressStats;
|
|
4
6
|
const bytes_1 = require("./bytes");
|
|
5
7
|
const cli_1 = require("./cli");
|
|
6
8
|
const date_1 = require("./date");
|
|
@@ -121,7 +123,6 @@ function renderProgress(progress, bar) {
|
|
|
121
123
|
progress.relative && renderProgressStats(progress.relative, bar),
|
|
122
124
|
].filter((v) => !!v);
|
|
123
125
|
}
|
|
124
|
-
exports.renderProgress = renderProgress;
|
|
125
126
|
function renderProgressStats(stats, progressBar) {
|
|
126
127
|
const text = [];
|
|
127
128
|
if (typeof stats.percent === "number") {
|
|
@@ -160,4 +161,3 @@ function renderProgressStats(stats, progressBar) {
|
|
|
160
161
|
const sep = (0, chalk_1.grey)(`|`);
|
|
161
162
|
return text.join(` ${sep} `);
|
|
162
163
|
}
|
|
163
|
-
exports.renderProgressStats = renderProgressStats;
|
package/lib/utils/reportSteps.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isReportStep = isReportStep;
|
|
4
|
+
exports.runReportSteps = runReportSteps;
|
|
4
5
|
const error_1 = require("./error");
|
|
5
6
|
const http_1 = require("./http");
|
|
6
7
|
function isReportStep(step) {
|
|
7
8
|
return step.type === "telegram" || step.type === "ntfy";
|
|
8
9
|
}
|
|
9
|
-
exports.isReportStep = isReportStep;
|
|
10
10
|
async function runReportSteps(input, options) {
|
|
11
11
|
const steps = Array.isArray(input) ? input : [input];
|
|
12
12
|
for (const step of steps) {
|
|
@@ -39,4 +39,3 @@ async function runReportSteps(input, options) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.runReportSteps = runReportSteps;
|
package/lib/utils/spawnSteps.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isSpawnStep = isSpawnStep;
|
|
4
|
+
exports.runSpawnSteps = runSpawnSteps;
|
|
4
5
|
const async_process_1 = require("./async-process");
|
|
5
6
|
const string_1 = require("./string");
|
|
6
7
|
const temp_1 = require("./temp");
|
|
@@ -27,7 +28,6 @@ async function writeNodeScript(options) {
|
|
|
27
28
|
function isSpawnStep(step) {
|
|
28
29
|
return step.type === "process" || step.type === "node";
|
|
29
30
|
}
|
|
30
|
-
exports.isSpawnStep = isSpawnStep;
|
|
31
31
|
async function runSpawnSteps(input, options) {
|
|
32
32
|
const steps = Array.isArray(input) ? input : [input];
|
|
33
33
|
for (const step of steps) {
|
|
@@ -70,4 +70,3 @@ async function runSpawnSteps(input, options) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
exports.runSpawnSteps = runSpawnSteps;
|
package/lib/utils/stream.d.ts
CHANGED
package/lib/utils/stream.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createStdStreams = createStdStreams;
|
|
4
|
+
exports.waitForClose = waitForClose;
|
|
4
5
|
function createStdStreams(options = {}) {
|
|
5
6
|
return {
|
|
6
7
|
stdout: options.stdout ?? process.stdout,
|
|
7
8
|
stderr: options.stderr ?? process.stderr,
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
|
-
exports.createStdStreams = createStdStreams;
|
|
11
11
|
async function waitForClose(stream) {
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
stream.on("close", resolve);
|
|
14
14
|
stream.on("error", reject);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
exports.waitForClose = waitForClose;
|
package/lib/utils/string.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.snakeCase = snakeCase;
|
|
4
|
+
exports.camelize = camelize;
|
|
5
|
+
exports.render = render;
|
|
6
|
+
exports.parseStringList = parseStringList;
|
|
7
|
+
exports.formatUri = formatUri;
|
|
8
|
+
exports.splitPatterns = splitPatterns;
|
|
9
|
+
exports.match = match;
|
|
10
|
+
exports.createPatternFilter = createPatternFilter;
|
|
11
|
+
exports.endsWith = endsWith;
|
|
12
|
+
exports.undefIfEmpty = undefIfEmpty;
|
|
13
|
+
exports.compareJsons = compareJsons;
|
|
4
14
|
const error_1 = require("./error");
|
|
5
15
|
const micromatch_1 = require("micromatch");
|
|
6
16
|
function snakeCase(value, char = "_") {
|
|
7
17
|
return value.replace(/[A-Z]/g, (letter) => `${char}${letter.toLowerCase()}`);
|
|
8
18
|
}
|
|
9
|
-
exports.snakeCase = snakeCase;
|
|
10
19
|
function camelize(input) {
|
|
11
20
|
return input.replace(/-./g, (x) => x[1].toUpperCase());
|
|
12
21
|
}
|
|
13
|
-
exports.camelize = camelize;
|
|
14
22
|
function render(subject, data) {
|
|
15
23
|
return subject.replace(/{([\w\./]*)}/g, function (match, name) {
|
|
16
24
|
if (!name.length) {
|
|
@@ -41,7 +49,6 @@ function render(subject, data) {
|
|
|
41
49
|
return ref.toString();
|
|
42
50
|
});
|
|
43
51
|
}
|
|
44
|
-
exports.render = render;
|
|
45
52
|
function parseStringList(value, validValues, defaultsValues) {
|
|
46
53
|
const resultFallback = (defaultsValues === true ? validValues : defaultsValues) ?? [];
|
|
47
54
|
const result = value
|
|
@@ -54,7 +61,6 @@ function parseStringList(value, validValues, defaultsValues) {
|
|
|
54
61
|
throw new error_1.AppError(`Invalid value: ${v}`);
|
|
55
62
|
return result;
|
|
56
63
|
}
|
|
57
|
-
exports.parseStringList = parseStringList;
|
|
58
64
|
function formatUri(input, hidePassword) {
|
|
59
65
|
let uri = "";
|
|
60
66
|
if (input.protocol) {
|
|
@@ -74,7 +80,6 @@ function formatUri(input, hidePassword) {
|
|
|
74
80
|
uri += input.path;
|
|
75
81
|
return uri;
|
|
76
82
|
}
|
|
77
|
-
exports.formatUri = formatUri;
|
|
78
83
|
function splitPatterns(patterns, map) {
|
|
79
84
|
const include = [];
|
|
80
85
|
const exclude = [];
|
|
@@ -92,12 +97,10 @@ function splitPatterns(patterns, map) {
|
|
|
92
97
|
exclude: exclude.length ? exclude : undefined,
|
|
93
98
|
};
|
|
94
99
|
}
|
|
95
|
-
exports.splitPatterns = splitPatterns;
|
|
96
100
|
function match(path, include, exclude) {
|
|
97
101
|
return ((!include || (0, micromatch_1.isMatch)(path, include, { dot: true })) &&
|
|
98
102
|
(!exclude || !(0, micromatch_1.isMatch)(path, exclude, { dot: true })));
|
|
99
103
|
}
|
|
100
|
-
exports.match = match;
|
|
101
104
|
function createPatternFilter(patterns) {
|
|
102
105
|
if (patterns === undefined) {
|
|
103
106
|
return () => true;
|
|
@@ -108,16 +111,12 @@ function createPatternFilter(patterns) {
|
|
|
108
111
|
const { include, exclude } = patterns;
|
|
109
112
|
return (input) => match(input, include, exclude);
|
|
110
113
|
}
|
|
111
|
-
exports.createPatternFilter = createPatternFilter;
|
|
112
114
|
function endsWith(input, patterns) {
|
|
113
115
|
return patterns.some((pattern) => input.endsWith(pattern));
|
|
114
116
|
}
|
|
115
|
-
exports.endsWith = endsWith;
|
|
116
117
|
function undefIfEmpty(input) {
|
|
117
118
|
return input.length ? input : undefined;
|
|
118
119
|
}
|
|
119
|
-
exports.undefIfEmpty = undefIfEmpty;
|
|
120
120
|
function compareJsons(a, b) {
|
|
121
121
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
122
122
|
}
|
|
123
|
-
exports.compareJsons = compareJsons;
|
package/lib/utils/tar.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getTarVendor = getTarVendor;
|
|
4
|
+
exports.listTar = listTar;
|
|
5
|
+
exports.checkPigzLib = checkPigzLib;
|
|
6
|
+
exports.createTar = createTar;
|
|
7
|
+
exports.normalizeTarPath = normalizeTarPath;
|
|
8
|
+
exports.extractTar = extractTar;
|
|
4
9
|
const async_process_1 = require("./async-process");
|
|
5
10
|
const cli_1 = require("./cli");
|
|
6
11
|
const fs_1 = require("./fs");
|
|
@@ -28,7 +33,6 @@ async function getTarVendor(cache = true, log = false) {
|
|
|
28
33
|
};
|
|
29
34
|
return (tarVendor = find());
|
|
30
35
|
}
|
|
31
|
-
exports.getTarVendor = getTarVendor;
|
|
32
36
|
async function listTar(options) {
|
|
33
37
|
const vendor = await getTarVendor(true, options.verbose);
|
|
34
38
|
const p = new async_process_1.AsyncProcess("tar", [
|
|
@@ -40,7 +44,6 @@ async function listTar(options) {
|
|
|
40
44
|
options.onEntry?.({ path: normalizeTarPath(path) });
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
exports.listTar = listTar;
|
|
44
47
|
let pigzLib;
|
|
45
48
|
async function checkPigzLib(cache = true) {
|
|
46
49
|
if (cache && pigzLib !== undefined)
|
|
@@ -55,7 +58,6 @@ async function checkPigzLib(cache = true) {
|
|
|
55
58
|
return false;
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
exports.checkPigzLib = checkPigzLib;
|
|
59
61
|
async function resolveCores(input) {
|
|
60
62
|
if (!(await checkPigzLib()))
|
|
61
63
|
return 1;
|
|
@@ -140,7 +142,6 @@ async function createTar(options) {
|
|
|
140
142
|
await p.waitForClose();
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
|
-
exports.createTar = createTar;
|
|
144
145
|
/**
|
|
145
146
|
* Fix `tar.exe: Option --force-local is not supported`
|
|
146
147
|
*/
|
|
@@ -153,7 +154,6 @@ function toLocalPath(path) {
|
|
|
153
154
|
function normalizeTarPath(path) {
|
|
154
155
|
return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
155
156
|
}
|
|
156
|
-
exports.normalizeTarPath = normalizeTarPath;
|
|
157
157
|
async function extractTar(options) {
|
|
158
158
|
let total = options.onEntry
|
|
159
159
|
? options.total ??
|
|
@@ -205,4 +205,3 @@ async function extractTar(options) {
|
|
|
205
205
|
await p.waitForClose();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
exports.extractTar = extractTar;
|
package/lib/utils/temp.d.ts
CHANGED
package/lib/utils/temp.js
CHANGED
|
@@ -3,7 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GargabeCollector = exports.
|
|
6
|
+
exports.GargabeCollector = exports.collectors = void 0;
|
|
7
|
+
exports.parentTmpDir = parentTmpDir;
|
|
8
|
+
exports.sessionTmpDir = sessionTmpDir;
|
|
9
|
+
exports.ensureFreeDiskTempSpace = ensureFreeDiskTempSpace;
|
|
10
|
+
exports.isTmpDir = isTmpDir;
|
|
11
|
+
exports.rmTmpDir = rmTmpDir;
|
|
12
|
+
exports.tmpDir = tmpDir;
|
|
13
|
+
exports.mkTmpDir = mkTmpDir;
|
|
14
|
+
exports.useTempDir = useTempDir;
|
|
15
|
+
exports.useTempFile = useTempFile;
|
|
7
16
|
const globalData_1 = __importDefault(require("../globalData"));
|
|
8
17
|
const fs_1 = require("./fs");
|
|
9
18
|
const crypto_1 = require("crypto");
|
|
@@ -14,21 +23,17 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
|
14
23
|
function parentTmpDir() {
|
|
15
24
|
return (0, path_1.join)(globalData_1.default.tempDir, "datatruck-temp");
|
|
16
25
|
}
|
|
17
|
-
exports.parentTmpDir = parentTmpDir;
|
|
18
26
|
function sessionTmpDir() {
|
|
19
27
|
return (0, path_1.join)(parentTmpDir(), process.pid.toString());
|
|
20
28
|
}
|
|
21
|
-
exports.sessionTmpDir = sessionTmpDir;
|
|
22
29
|
async function ensureFreeDiskTempSpace(size) {
|
|
23
30
|
const path = sessionTmpDir();
|
|
24
31
|
await (0, fs_1.mkdirIfNotExists)(sessionTmpDir());
|
|
25
32
|
await (0, fs_1.ensureFreeDiskSpace)([path], size);
|
|
26
33
|
}
|
|
27
|
-
exports.ensureFreeDiskTempSpace = ensureFreeDiskTempSpace;
|
|
28
34
|
function isTmpDir(path) {
|
|
29
35
|
return path.startsWith(sessionTmpDir()) && path.includes("datatruck-temp");
|
|
30
36
|
}
|
|
31
|
-
exports.isTmpDir = isTmpDir;
|
|
32
37
|
async function rmTmpDir(input) {
|
|
33
38
|
if (typeof input === "string") {
|
|
34
39
|
if (!isTmpDir(input))
|
|
@@ -40,7 +45,6 @@ async function rmTmpDir(input) {
|
|
|
40
45
|
await rmTmpDir(path);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
|
-
exports.rmTmpDir = rmTmpDir;
|
|
44
48
|
function tmpDir(...keys) {
|
|
45
49
|
const id = (0, crypto_1.randomUUID)().slice(0, 8);
|
|
46
50
|
const path = (0, path_1.join)(sessionTmpDir(), [...keys, id].map(encodeURIComponent).join("-"));
|
|
@@ -51,14 +55,12 @@ function tmpDir(...keys) {
|
|
|
51
55
|
}
|
|
52
56
|
return path;
|
|
53
57
|
}
|
|
54
|
-
exports.tmpDir = tmpDir;
|
|
55
58
|
exports.collectors = new Set();
|
|
56
59
|
async function mkTmpDir(...keys) {
|
|
57
60
|
const path = tmpDir(...keys);
|
|
58
61
|
await (0, promises_1.mkdir)(path, { recursive: true });
|
|
59
62
|
return path;
|
|
60
63
|
}
|
|
61
|
-
exports.mkTmpDir = mkTmpDir;
|
|
62
64
|
async function useTempDir(...keys) {
|
|
63
65
|
const path = await mkTmpDir(...keys);
|
|
64
66
|
return {
|
|
@@ -71,7 +73,6 @@ async function useTempDir(...keys) {
|
|
|
71
73
|
},
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
|
-
exports.useTempDir = useTempDir;
|
|
75
76
|
function useTempFile(path) {
|
|
76
77
|
return {
|
|
77
78
|
path,
|
|
@@ -83,7 +84,6 @@ function useTempFile(path) {
|
|
|
83
84
|
},
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
|
-
exports.useTempFile = useTempFile;
|
|
87
87
|
class GargabeCollector {
|
|
88
88
|
parent;
|
|
89
89
|
paths = new Set();
|
package/lib/utils/virtual-fs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalFs = exports.AbstractFs =
|
|
3
|
+
exports.LocalFs = exports.AbstractFs = void 0;
|
|
4
|
+
exports.resolvePath = resolvePath;
|
|
4
5
|
const fs_1 = require("./fs");
|
|
5
6
|
const promises_1 = require("fs/promises");
|
|
6
7
|
const path_1 = require("path");
|
|
@@ -8,7 +9,6 @@ function resolvePath(path) {
|
|
|
8
9
|
const { pathname } = new URL(`file:///${path}`);
|
|
9
10
|
return pathname;
|
|
10
11
|
}
|
|
11
|
-
exports.resolvePath = resolvePath;
|
|
12
12
|
class AbstractFs {
|
|
13
13
|
options;
|
|
14
14
|
constructor(options) {
|
package/lib/utils/watcher.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWatcher =
|
|
3
|
+
exports.createWatcher = createWatcher;
|
|
4
4
|
function createWatcher(options) {
|
|
5
5
|
let prev;
|
|
6
6
|
let interval;
|
|
@@ -31,4 +31,3 @@ function createWatcher(options) {
|
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
exports.createWatcher = createWatcher;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datatruck/cli",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"description": "Tool for creating and managing backups",
|
|
5
5
|
"homepage": "https://github.com/swordev/datatruck#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -27,25 +27,26 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@supercharge/promise-pool": "^3.2.0",
|
|
30
|
-
"ajv": "^8.
|
|
31
|
-
"async": "^3.2.
|
|
30
|
+
"ajv": "^8.17.1",
|
|
31
|
+
"async": "^3.2.6",
|
|
32
32
|
"chalk": "^4.1.2",
|
|
33
|
-
"commander": "^12.
|
|
34
|
-
"croner": "^8.
|
|
35
|
-
"dayjs": "^1.11.
|
|
33
|
+
"commander": "^12.1.0",
|
|
34
|
+
"croner": "^8.1.1",
|
|
35
|
+
"dayjs": "^1.11.13",
|
|
36
36
|
"fast-folder-size": "^2.2.0",
|
|
37
37
|
"fast-glob": "^3.3.2",
|
|
38
|
-
"listr2": "^8.2.
|
|
39
|
-
"micromatch": "^4.0.
|
|
40
|
-
"mongodb": "^6.
|
|
41
|
-
"mysql2": "^3.
|
|
38
|
+
"listr2": "^8.2.4",
|
|
39
|
+
"micromatch": "^4.0.8",
|
|
40
|
+
"mongodb": "^6.9.0",
|
|
41
|
+
"mysql2": "^3.11.3",
|
|
42
42
|
"tty-table": "^4.2.3",
|
|
43
|
-
"
|
|
43
|
+
"undici": "^6.19.8",
|
|
44
|
+
"yaml": "^2.5.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/async": "^3.2.24",
|
|
47
|
-
"@types/micromatch": "^4.0.
|
|
48
|
-
"mongodb-memory-server": "^
|
|
48
|
+
"@types/micromatch": "^4.0.9",
|
|
49
|
+
"mongodb-memory-server": "^10.0.1"
|
|
49
50
|
},
|
|
50
51
|
"optionalDependencies": {
|
|
51
52
|
"ts-node": "^10.9.2"
|