@datatruck/cli 0.16.1 → 0.16.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 +14 -5
- package/Action/BackupAction.js +34 -11
- package/Action/BackupSessionsAction.d.ts +1 -1
- package/Action/CleanCacheAction.d.ts +1 -1
- package/Action/ConfigAction.d.ts +1 -1
- package/Action/InitAction.d.ts +1 -1
- package/Action/PruneAction.d.ts +2 -2
- package/Action/RestoreAction.d.ts +12 -6
- package/Action/RestoreAction.js +24 -10
- package/Action/RestoreSessionsAction.d.ts +1 -1
- package/Action/SnapshotsAction.d.ts +3 -3
- package/Command/BackupCommand.d.ts +1 -1
- package/Command/BackupSessionsCommand.d.ts +1 -1
- package/Command/CleanCacheCommand.d.ts +1 -1
- package/Command/CommandAbstract.d.ts +2 -2
- package/Command/ConfigCommand.d.ts +2 -2
- package/Command/InitCommand.d.ts +2 -2
- package/Command/PruneCommand.d.ts +1 -1
- package/Command/RestoreCommand.d.ts +1 -1
- package/Command/RestoreSessionsCommand.d.ts +1 -1
- package/Command/SnapshotsCommand.d.ts +2 -2
- package/Config/Config.d.ts +1 -1
- package/Config/PackageConfig.d.ts +2 -2
- package/Config/PackageRepositoryConfig.d.ts +1 -1
- package/Config/PrunePolicyConfig.d.ts +1 -1
- package/Config/RepositoryConfig.d.ts +3 -3
- package/Config/TaskConfig.d.ts +1 -1
- package/Decorator/EntityDecorator.d.ts +1 -1
- package/Factory/CommandFactory.d.ts +2 -2
- package/Repository/DatatruckRepository.d.ts +4 -4
- package/Repository/DatatruckRepository.js +1 -1
- package/Repository/GitRepository.d.ts +2 -2
- package/Repository/GitRepository.js +3 -3
- package/Repository/RepositoryAbstract.d.ts +11 -9
- package/Repository/RepositoryAbstract.js +7 -0
- package/Repository/ResticRepository.d.ts +2 -2
- package/Repository/ResticRepository.js +3 -1
- package/SessionDriver/ConsoleSessionDriver.d.ts +3 -3
- package/SessionDriver/SessionDriverAbstract.d.ts +4 -4
- package/SessionManager/SessionManagerAbstract.d.ts +1 -1
- package/Task/GitTask.d.ts +1 -1
- package/Task/GitTask.js +2 -2
- package/Task/MariadbTask.d.ts +1 -1
- package/Task/MariadbTask.js +1 -1
- package/Task/MssqlTask.d.ts +1 -1
- package/Task/MysqlDumpTask.d.ts +1 -1
- package/Task/PostgresqlDumpTask.d.ts +1 -1
- package/Task/ScriptTask.d.ts +5 -5
- package/Task/ScriptTask.js +6 -6
- package/Task/SqlDumpTaskAbstract.d.ts +2 -2
- package/Task/SqlDumpTaskAbstract.js +2 -2
- package/Task/TaskAbstract.d.ts +4 -2
- package/Task/TaskAbstract.js +7 -0
- package/package.json +8 -8
- package/util/DataFormat.d.ts +1 -1
- package/util/ObjectVault.d.ts +1 -1
- package/util/ResticUtil.d.ts +3 -2
- package/util/ResticUtil.js +12 -10
- package/util/cli-util.d.ts +1 -1
- package/util/datatruck/config-util.d.ts +9 -9
- package/util/date-util.d.ts +1 -1
- package/util/fs-util.d.ts +4 -1
- package/util/fs-util.js +21 -3
- package/util/object-util.d.ts +1 -1
- package/util/process-util.d.ts +3 -3
- package/util/progress.d.ts +2 -2
- package/util/string-util.d.ts +1 -1
- package/util/zip-util.d.ts +3 -3
|
@@ -10,17 +10,17 @@ export declare function filterPackages(config: ConfigType, options: {
|
|
|
10
10
|
repositoryTypes?: string[];
|
|
11
11
|
sourceAction?: RepositoryConfigEnabledActionType;
|
|
12
12
|
}): PackageConfigType[];
|
|
13
|
-
|
|
13
|
+
type ResolvePackagePathParamsType = ResolvePackageParamsType & {
|
|
14
14
|
packageName: string;
|
|
15
15
|
path: string | undefined;
|
|
16
16
|
};
|
|
17
17
|
export declare function resolvePackagePath(value: string, params: ResolvePackagePathParamsType): string;
|
|
18
|
-
|
|
18
|
+
type ResolveDatabaseNameParamsType = ResolvePackageParamsType & {
|
|
19
19
|
packageName: string;
|
|
20
20
|
database: string | undefined;
|
|
21
21
|
};
|
|
22
22
|
export declare function resolveDatabaseName(value: string, params: ResolveDatabaseNameParamsType): string;
|
|
23
|
-
|
|
23
|
+
type ResolvePackageParamsType = {
|
|
24
24
|
snapshotId: string;
|
|
25
25
|
snapshotDate: string;
|
|
26
26
|
action: "backup" | "restore";
|
|
@@ -32,15 +32,15 @@ export declare const pkgPathParams: {
|
|
|
32
32
|
};
|
|
33
33
|
export declare const pkgIncludeParams: {
|
|
34
34
|
packageName: string;
|
|
35
|
-
temp: string;
|
|
36
35
|
snapshotId: string;
|
|
36
|
+
temp: string;
|
|
37
37
|
snapshotDate: string;
|
|
38
38
|
action: string;
|
|
39
39
|
};
|
|
40
40
|
export declare const pkgExcludeParams: {
|
|
41
41
|
packageName: string;
|
|
42
|
-
temp: string;
|
|
43
42
|
snapshotId: string;
|
|
43
|
+
temp: string;
|
|
44
44
|
snapshotDate: string;
|
|
45
45
|
action: string;
|
|
46
46
|
};
|
|
@@ -53,30 +53,30 @@ export declare const dbNameParams: {
|
|
|
53
53
|
export declare const params: {
|
|
54
54
|
pkgPath: {
|
|
55
55
|
packageName: string;
|
|
56
|
-
temp: string;
|
|
57
56
|
snapshotId: string;
|
|
57
|
+
temp: string;
|
|
58
58
|
snapshotDate: string;
|
|
59
59
|
action: string;
|
|
60
60
|
};
|
|
61
61
|
pkgRestorePath: {
|
|
62
62
|
packageName: string;
|
|
63
63
|
path: string;
|
|
64
|
-
temp: string;
|
|
65
64
|
snapshotId: string;
|
|
65
|
+
temp: string;
|
|
66
66
|
snapshotDate: string;
|
|
67
67
|
action: string;
|
|
68
68
|
};
|
|
69
69
|
pkgInclude: {
|
|
70
70
|
packageName: string;
|
|
71
|
-
temp: string;
|
|
72
71
|
snapshotId: string;
|
|
72
|
+
temp: string;
|
|
73
73
|
snapshotDate: string;
|
|
74
74
|
action: string;
|
|
75
75
|
};
|
|
76
76
|
pkgExclude: {
|
|
77
77
|
packageName: string;
|
|
78
|
-
temp: string;
|
|
79
78
|
snapshotId: string;
|
|
79
|
+
temp: string;
|
|
80
80
|
snapshotDate: string;
|
|
81
81
|
action: string;
|
|
82
82
|
};
|
package/util/date-util.d.ts
CHANGED
package/util/fs-util.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { WriteStream } from "fs";
|
|
|
7
7
|
import { Interface } from "readline";
|
|
8
8
|
export declare const isWSLSystem: boolean;
|
|
9
9
|
export declare function isEmptyDir(path: string): Promise<boolean>;
|
|
10
|
-
|
|
10
|
+
type EntryObject = {
|
|
11
11
|
name: string;
|
|
12
12
|
path: string;
|
|
13
13
|
dirent: Dirent;
|
|
@@ -33,6 +33,8 @@ export declare function findFile(sourcePath: string, baseName: string, extension
|
|
|
33
33
|
export declare function existsFile(path: string): Promise<boolean>;
|
|
34
34
|
export declare function parentTmpDir(): string;
|
|
35
35
|
export declare function sessionTmpDir(): string;
|
|
36
|
+
export declare function isTmpDir(path: string): boolean;
|
|
37
|
+
export declare function rmTmpDir(input: string | string[]): Promise<void>;
|
|
36
38
|
export declare function tmpDir(prefix: string, id?: string): string;
|
|
37
39
|
export declare function fastFolderSizeAsync(path: string): Promise<number>;
|
|
38
40
|
export declare function mkTmpDir(prefix: string, id?: string): Promise<string>;
|
|
@@ -47,6 +49,7 @@ export declare function forEachFile(dirPath: string, cb: (path: string, dir: boo
|
|
|
47
49
|
export declare function fastglobToGitIgnore(patterns: string[], baseDir: string): string[];
|
|
48
50
|
export declare function writeGitIgnoreList(options: {
|
|
49
51
|
paths: NodeJS.ReadableStream | string[];
|
|
52
|
+
outDir: string;
|
|
50
53
|
}): Promise<string>;
|
|
51
54
|
export declare function waitForClose(stream: WriteStream): Promise<WriteStream>;
|
|
52
55
|
export declare function copyFileWithStreams(source: string, target: string): Promise<unknown>;
|
package/util/fs-util.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.cpy = exports.isNotFoundError = exports.updateFileStats = exports.copyFileWithStreams = exports.waitForClose = exports.writeGitIgnoreList = exports.fastglobToGitIgnore = exports.forEachFile = exports.readDir = exports.checkDir = exports.checkFile = exports.readPartialFile = exports.mkTmpDir = exports.fastFolderSizeAsync = exports.tmpDir = exports.sessionTmpDir = exports.parentTmpDir = exports.existsFile = exports.findFile = exports.parsePackageFile = exports.parseFile = exports.parseFileExtensions = exports.readdirIfExists = exports.writeJSONFile = exports.existsDir = exports.ensureEmptyDir = exports.mkdirIfNotExists = exports.isDirEmpty = exports.isLocalDir = exports.pathIterator = exports.applyPermissions = exports.isEmptyDir = exports.isWSLSystem = void 0;
|
|
6
|
+
exports.cpy = exports.isNotFoundError = exports.updateFileStats = exports.copyFileWithStreams = exports.waitForClose = exports.writeGitIgnoreList = exports.fastglobToGitIgnore = exports.forEachFile = exports.readDir = exports.checkDir = exports.checkFile = exports.readPartialFile = exports.mkTmpDir = exports.fastFolderSizeAsync = exports.tmpDir = exports.rmTmpDir = exports.isTmpDir = exports.sessionTmpDir = exports.parentTmpDir = exports.existsFile = exports.findFile = exports.parsePackageFile = exports.parseFile = exports.parseFileExtensions = exports.readdirIfExists = exports.writeJSONFile = exports.existsDir = exports.ensureEmptyDir = exports.mkdirIfNotExists = exports.isDirEmpty = exports.isLocalDir = exports.pathIterator = exports.applyPermissions = exports.isEmptyDir = exports.isWSLSystem = void 0;
|
|
7
7
|
const globalData_1 = __importDefault(require("../globalData"));
|
|
8
8
|
const path_util_1 = require("./path-util");
|
|
9
9
|
const async_1 = require("async");
|
|
@@ -160,6 +160,24 @@ function sessionTmpDir() {
|
|
|
160
160
|
return (0, path_1.join)(parentTmpDir(), process.pid.toString());
|
|
161
161
|
}
|
|
162
162
|
exports.sessionTmpDir = sessionTmpDir;
|
|
163
|
+
function isTmpDir(path) {
|
|
164
|
+
return path.startsWith(sessionTmpDir()) && path.includes("datatruck-temp");
|
|
165
|
+
}
|
|
166
|
+
exports.isTmpDir = isTmpDir;
|
|
167
|
+
async function rmTmpDir(input) {
|
|
168
|
+
if (typeof input === "string") {
|
|
169
|
+
if (!isTmpDir(input))
|
|
170
|
+
throw new Error(`Path is not a temp dir: ${input}`);
|
|
171
|
+
await (0, promises_1.rm)(input, {
|
|
172
|
+
recursive: true,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
for (const path of input)
|
|
177
|
+
await rmTmpDir(path);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.rmTmpDir = rmTmpDir;
|
|
163
181
|
function tmpDir(prefix, id) {
|
|
164
182
|
if (!id)
|
|
165
183
|
id = (0, crypto_1.randomUUID)().slice(0, 8);
|
|
@@ -265,8 +283,8 @@ function fastglobToGitIgnore(patterns, baseDir) {
|
|
|
265
283
|
}
|
|
266
284
|
exports.fastglobToGitIgnore = fastglobToGitIgnore;
|
|
267
285
|
async function writeGitIgnoreList(options) {
|
|
268
|
-
const
|
|
269
|
-
const path = (0, path_1.join)(
|
|
286
|
+
const { outDir } = options;
|
|
287
|
+
const path = (0, path_1.join)(outDir, `.gitignore`);
|
|
270
288
|
const stream = (0, fs_2.createWriteStream)(path);
|
|
271
289
|
const dirs = new Set();
|
|
272
290
|
stream.write("*\n");
|
package/util/object-util.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function merge<T extends Record<string, unknown>>(target: T, ...sources: Record<string, unknown>[]): T;
|
|
2
2
|
export declare function push<T>(map: Record<string, T[]>, key: string, object: T): void;
|
|
3
3
|
export declare function getErrorProperties(error: Error): Record<string, string>;
|
|
4
|
-
|
|
4
|
+
type GroupByKeyParamType<TItem> = ((item: TItem) => string[] | string) | (keyof TItem)[] | keyof TItem;
|
|
5
5
|
export declare function groupBy<TItem>(items: TItem[], keyOrCb: GroupByKeyParamType<TItem>): Record<string, TItem[]>;
|
|
6
6
|
export declare function groupBy<TItem>(items: TItem[], keyOrCb: GroupByKeyParamType<TItem>, single: true): Record<string, TItem>;
|
|
7
7
|
export {};
|
package/util/process-util.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { SpawnOptions, ChildProcess } from "child_process";
|
|
4
4
|
import { ReadStream, WriteStream } from "fs";
|
|
5
|
-
export
|
|
5
|
+
export type ExecLogSettingsType = {
|
|
6
6
|
colorize?: boolean;
|
|
7
7
|
exec?: boolean;
|
|
8
8
|
stdout?: boolean;
|
|
@@ -44,12 +44,12 @@ export declare function logExecStdout(input: {
|
|
|
44
44
|
lineSalt?: boolean;
|
|
45
45
|
}): void;
|
|
46
46
|
export declare function logExecStderr(data: string, colorize?: boolean): void;
|
|
47
|
-
export
|
|
47
|
+
export type ExecResultType = {
|
|
48
48
|
stdout: string;
|
|
49
49
|
stderr: string;
|
|
50
50
|
exitCode: number;
|
|
51
51
|
};
|
|
52
52
|
export declare function exec(command: string, argv?: string[], options?: SpawnOptions | null, settings?: ExecSettingsInterface): Promise<ExecResultType>;
|
|
53
|
-
|
|
53
|
+
type EventNameType = "exit" | "SIGINT" | "SIGUSR1" | "SIGUSR2" | "SIGTERM" | "uncaughtException";
|
|
54
54
|
export declare function onExit(cb: (eventName: EventNameType, ...args: any[]) => void): void;
|
|
55
55
|
export {};
|
package/util/progress.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ProgressStats = {
|
|
2
2
|
percent?: number;
|
|
3
3
|
total?: number;
|
|
4
4
|
current?: number;
|
|
@@ -6,7 +6,7 @@ export declare type ProgressStats = {
|
|
|
6
6
|
payload?: string;
|
|
7
7
|
format?: "amount" | "size";
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type Progress = {
|
|
10
10
|
absolute?: ProgressStats;
|
|
11
11
|
relative?: ProgressStats;
|
|
12
12
|
};
|
package/util/string-util.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function lcfirst(value: string): string;
|
|
|
4
4
|
export declare function snakeCase(value: string, char?: string): string;
|
|
5
5
|
export declare function render(subject: string, vars: Record<string, string | undefined>): string;
|
|
6
6
|
export declare function parseStringList(value: string, validValues?: string[]): string[];
|
|
7
|
-
export
|
|
7
|
+
export type UriType = {
|
|
8
8
|
protocol?: "http" | "https";
|
|
9
9
|
host?: string;
|
|
10
10
|
username?: string;
|
package/util/zip-util.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface UnzipDataType {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function buildArguments(filters: (ZipDataFilterType | string)[]): string[];
|
|
39
39
|
export declare function checkSSEOption(command?: string): Promise<boolean>;
|
|
40
|
-
|
|
40
|
+
type ListZipStream = {
|
|
41
41
|
Path?: string;
|
|
42
42
|
Folder?: string;
|
|
43
43
|
Size?: string;
|
|
@@ -62,7 +62,7 @@ export declare function listZip(data: {
|
|
|
62
62
|
onStream: (item: ListZipStream) => Promise<void>;
|
|
63
63
|
verbose?: boolean;
|
|
64
64
|
}): Promise<void>;
|
|
65
|
-
export
|
|
65
|
+
export type ZipStream = {
|
|
66
66
|
type: "progress";
|
|
67
67
|
data: {
|
|
68
68
|
progress: number;
|
|
@@ -80,7 +80,7 @@ export declare function zip(data: ZipDataType): Promise<{
|
|
|
80
80
|
folders: number;
|
|
81
81
|
files: number;
|
|
82
82
|
}>;
|
|
83
|
-
export
|
|
83
|
+
export type UnzipStream = {
|
|
84
84
|
type: "progress";
|
|
85
85
|
data: {
|
|
86
86
|
percent: number;
|