@datatruck/cli 0.32.1 → 0.32.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/config.schema.json +1224 -1271
- package/{Action → lib/Action}/BackupAction.d.ts +9 -9
- package/{Action → lib/Action}/BackupAction.js +27 -8
- package/{Action → lib/Action}/ConfigAction.d.ts +9 -9
- package/{Action → lib/Action}/ConfigAction.js +4 -2
- package/{Action → lib/Action}/CopyAction.d.ts +5 -5
- package/{Action → lib/Action}/InitAction.d.ts +3 -3
- package/{Action → lib/Action}/PruneAction.d.ts +5 -5
- package/{Action → lib/Action}/RestoreAction.d.ts +5 -5
- package/{Action → lib/Action}/SnapshotsAction.d.ts +5 -5
- package/{Command → lib/Command}/BackupCommand.d.ts +2 -2
- package/{Command → lib/Command}/CommandAbstract.d.ts +4 -4
- package/{Command → lib/Command}/ConfigCommand.d.ts +2 -2
- package/{Command → lib/Command}/InitCommand.d.ts +2 -2
- package/{Command → lib/Command}/PruneCommand.d.ts +2 -2
- package/{Command → lib/Command}/RestoreCommand.d.ts +2 -2
- package/{Command → lib/Command}/SnapshotsCommand.d.ts +2 -2
- package/lib/Config/Config.d.ts +28 -0
- package/lib/Config/PackageConfig.d.ts +24 -0
- package/lib/Config/PackageConfig.js +2 -0
- package/lib/Config/PackageRepositoryConfig.d.ts +15 -0
- package/lib/Config/PackageRepositoryConfig.js +2 -0
- package/lib/Config/PrunePolicyConfig.d.ts +2 -0
- package/lib/Config/PrunePolicyConfig.js +2 -0
- package/lib/Config/RepositoryConfig.d.ts +27 -0
- package/lib/Config/RepositoryConfig.js +2 -0
- package/lib/Config/TaskConfig.d.ts +31 -0
- package/lib/Config/TaskConfig.js +2 -0
- package/{Factory → lib/Factory}/CommandFactory.d.ts +5 -5
- package/lib/Factory/RepositoryFactory.d.ts +3 -0
- package/lib/Factory/TaskFactory.d.ts +3 -0
- package/{Repository → lib/Repository}/DatatruckRepository.d.ts +9 -12
- package/{Repository → lib/Repository}/DatatruckRepository.js +1 -38
- package/lib/Repository/GitRepository.d.ts +28 -0
- package/{Repository → lib/Repository}/GitRepository.js +1 -15
- package/{Repository → lib/Repository}/RepositoryAbstract.d.ts +8 -8
- package/{Repository → lib/Repository}/ResticRepository.d.ts +11 -14
- package/{Repository → lib/Repository}/ResticRepository.js +1 -63
- package/{Task → lib/Task}/GitTask.d.ts +2 -4
- package/{Task → lib/Task}/GitTask.js +1 -42
- package/{Task → lib/Task}/MariadbTask.d.ts +2 -4
- package/{Task → lib/Task}/MariadbTask.js +1 -54
- package/{Task → lib/Task}/MssqlTask.d.ts +2 -4
- package/{Task → lib/Task}/MssqlTask.js +1 -14
- package/{Task → lib/Task}/MysqlDumpTask.d.ts +4 -5
- package/{Task → lib/Task}/MysqlDumpTask.js +1 -11
- package/{Task → lib/Task}/PostgresqlDumpTask.d.ts +5 -7
- package/{Task → lib/Task}/PostgresqlDumpTask.js +1 -5
- package/lib/Task/ScriptTask.d.ts +30 -0
- package/lib/Task/ScriptTask.js +55 -0
- package/{Task → lib/Task}/SqlDumpTaskAbstract.d.ts +5 -7
- package/{Task → lib/Task}/SqlDumpTaskAbstract.js +1 -43
- package/{Task → lib/Task}/TaskAbstract.d.ts +2 -2
- package/lib/cli.d.ts +4 -0
- package/lib/config.schema.d.ts +2 -0
- package/lib/config.schema.js +10 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.js +21 -0
- package/{utils → lib/utils}/DataFormat.d.ts +4 -4
- package/{utils → lib/utils}/Git.d.ts +6 -6
- package/{utils → lib/utils}/Restic.d.ts +14 -14
- package/{utils → lib/utils}/datatruck/config.d.ts +20 -20
- package/lib/utils/datatruck/paths.d.ts +17 -0
- package/{utils → lib/utils}/datatruck/paths.js +3 -3
- package/{utils → lib/utils}/datatruck/repository-server.d.ts +1 -1
- package/{utils → lib/utils}/datatruck/snapshot.d.ts +2 -2
- package/{utils → lib/utils}/date.d.ts +3 -3
- package/{utils → lib/utils}/exit.d.ts +3 -3
- package/{utils → lib/utils}/mysql.d.ts +5 -4
- package/{utils → lib/utils}/mysql.js +2 -2
- package/{utils → lib/utils}/process.d.ts +8 -5
- package/lib/utils/reportSteps.d.ts +26 -0
- package/lib/utils/reportSteps.js +41 -0
- package/lib/utils/spawnSteps.d.ts +36 -0
- package/lib/utils/spawnSteps.js +74 -0
- package/{utils → lib/utils}/string.d.ts +3 -3
- package/{utils → lib/utils}/string.js +3 -3
- package/{utils → lib/utils}/tar.d.ts +0 -8
- package/{utils → lib/utils}/tar.js +1 -18
- package/package.json +39 -25
- package/CHANGELOG.md +0 -569
- package/Config/Config.d.ts +0 -28
- package/Config/Config.js +0 -140
- package/Config/PackageConfig.d.ts +0 -23
- package/Config/PackageConfig.js +0 -51
- package/Config/PackageRepositoryConfig.d.ts +0 -17
- package/Config/PackageRepositoryConfig.js +0 -37
- package/Config/PrunePolicyConfig.d.ts +0 -4
- package/Config/PrunePolicyConfig.js +0 -28
- package/Config/RepositoryConfig.d.ts +0 -24
- package/Config/RepositoryConfig.js +0 -62
- package/Config/TaskConfig.d.ts +0 -27
- package/Config/TaskConfig.js +0 -41
- package/Factory/RepositoryFactory.d.ts +0 -3
- package/Factory/TaskFactory.d.ts +0 -3
- package/JsonSchema/DefinitionEnum.d.ts +0 -26
- package/JsonSchema/DefinitionEnum.js +0 -33
- package/JsonSchema/JsonSchema.d.ts +0 -4
- package/JsonSchema/JsonSchema.js +0 -65
- package/JsonSchema/backup-def.d.ts +0 -30
- package/JsonSchema/backup-def.js +0 -18
- package/JsonSchema/copy-def.d.ts +0 -24
- package/JsonSchema/copy-def.js +0 -15
- package/Repository/GitRepository.d.ts +0 -31
- package/Task/ScriptTask.d.ts +0 -38
- package/Task/ScriptTask.js +0 -163
- package/cli.d.ts +0 -4
- package/index.d.ts +0 -1
- package/utils/datatruck/paths.d.ts +0 -17
- package/utils/path.d.ts +0 -1
- package/utils/path.js +0 -8
- package/utils/schema.d.ts +0 -34
- package/utils/schema.js +0 -36
- package/utils/steps.d.ts +0 -43
- package/utils/steps.js +0 -97
- /package/{Action → lib/Action}/CleanCacheAction.d.ts +0 -0
- /package/{Action → lib/Action}/CleanCacheAction.js +0 -0
- /package/{Action → lib/Action}/CopyAction.js +0 -0
- /package/{Action → lib/Action}/InitAction.js +0 -0
- /package/{Action → lib/Action}/PruneAction.js +0 -0
- /package/{Action → lib/Action}/RestoreAction.js +0 -0
- /package/{Action → lib/Action}/SnapshotsAction.js +0 -0
- /package/{Command → lib/Command}/BackupCommand.js +0 -0
- /package/{Command → lib/Command}/CleanCacheCommand.d.ts +0 -0
- /package/{Command → lib/Command}/CleanCacheCommand.js +0 -0
- /package/{Command → lib/Command}/CommandAbstract.js +0 -0
- /package/{Command → lib/Command}/ConfigCommand.js +0 -0
- /package/{Command → lib/Command}/CopyCommand.d.ts +0 -0
- /package/{Command → lib/Command}/CopyCommand.js +0 -0
- /package/{Command → lib/Command}/InitCommand.js +0 -0
- /package/{Command → lib/Command}/PruneCommand.js +0 -0
- /package/{Command → lib/Command}/RestoreCommand.js +0 -0
- /package/{Command → lib/Command}/SnapshotsCommand.js +0 -0
- /package/{Command → lib/Command}/StartServerCommand.d.ts +0 -0
- /package/{Command → lib/Command}/StartServerCommand.js +0 -0
- /package/{index.js → lib/Config/Config.js} +0 -0
- /package/{Error → lib/Error}/AppError.d.ts +0 -0
- /package/{Error → lib/Error}/AppError.js +0 -0
- /package/{Factory → lib/Factory}/CommandFactory.js +0 -0
- /package/{Factory → lib/Factory}/RepositoryFactory.js +0 -0
- /package/{Factory → lib/Factory}/TaskFactory.js +0 -0
- /package/{Repository → lib/Repository}/RepositoryAbstract.js +0 -0
- /package/{Task → lib/Task}/TaskAbstract.js +0 -0
- /package/{bin.d.ts → lib/bin.d.ts} +0 -0
- /package/{bin.js → lib/bin.js} +0 -0
- /package/{cli.js → lib/cli.js} +0 -0
- /package/{globalData.d.ts → lib/globalData.d.ts} +0 -0
- /package/{globalData.js → lib/globalData.js} +0 -0
- /package/{pkg.d.ts → lib/pkg.d.ts} +0 -0
- /package/{pkg.js → lib/pkg.js} +0 -0
- /package/{utils → lib/utils}/DataFormat.js +0 -0
- /package/{utils → lib/utils}/Git.js +0 -0
- /package/{utils → lib/utils}/Restic.js +0 -0
- /package/{utils → lib/utils}/async.d.ts +0 -0
- /package/{utils → lib/utils}/async.js +0 -0
- /package/{utils → lib/utils}/bytes.d.ts +0 -0
- /package/{utils → lib/utils}/bytes.js +0 -0
- /package/{utils → lib/utils}/cli.d.ts +0 -0
- /package/{utils → lib/utils}/cli.js +0 -0
- /package/{utils → lib/utils}/crypto.d.ts +0 -0
- /package/{utils → lib/utils}/crypto.js +0 -0
- /package/{utils → lib/utils}/datatruck/client.d.ts +0 -0
- /package/{utils → lib/utils}/datatruck/client.js +0 -0
- /package/{utils → lib/utils}/datatruck/config.js +0 -0
- /package/{utils → lib/utils}/datatruck/cron-server.d.ts +0 -0
- /package/{utils → lib/utils}/datatruck/cron-server.js +0 -0
- /package/{utils → lib/utils}/datatruck/repository-server.js +0 -0
- /package/{utils → lib/utils}/datatruck/snapshot.js +0 -0
- /package/{utils → lib/utils}/date.js +0 -0
- /package/{utils → lib/utils}/exit.js +0 -0
- /package/{utils → lib/utils}/fs.d.ts +0 -0
- /package/{utils → lib/utils}/fs.js +0 -0
- /package/{utils → lib/utils}/http.d.ts +0 -0
- /package/{utils → lib/utils}/http.js +0 -0
- /package/{utils → lib/utils}/list.d.ts +0 -0
- /package/{utils → lib/utils}/list.js +0 -0
- /package/{utils → lib/utils}/math.d.ts +0 -0
- /package/{utils → lib/utils}/math.js +0 -0
- /package/{utils → lib/utils}/object.d.ts +0 -0
- /package/{utils → lib/utils}/object.js +0 -0
- /package/{utils → lib/utils}/process.js +0 -0
- /package/{utils → lib/utils}/progress.d.ts +0 -0
- /package/{utils → lib/utils}/progress.js +0 -0
- /package/{utils → lib/utils}/stream.d.ts +0 -0
- /package/{utils → lib/utils}/stream.js +0 -0
- /package/{utils → lib/utils}/temp.d.ts +0 -0
- /package/{utils → lib/utils}/temp.js +0 -0
- /package/{utils → lib/utils}/virtual-fs.d.ts +0 -0
- /package/{utils → lib/utils}/virtual-fs.js +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CompressOptions } from "../utils/tar";
|
|
2
2
|
import { RepositoryAbstract, RepoBackupData, RepoInitData, RepoRestoreData, RepoFetchSnapshotsData, Snapshot, RepoPruneData, RepoCopyData } from "./RepositoryAbstract";
|
|
3
|
-
|
|
4
|
-
export type MetaDataType = {
|
|
3
|
+
export type MetaData = {
|
|
5
4
|
id: string;
|
|
6
5
|
date: string;
|
|
7
6
|
package: string;
|
|
@@ -15,7 +14,7 @@ export type MetaDataType = {
|
|
|
15
14
|
checksum: string;
|
|
16
15
|
}>;
|
|
17
16
|
};
|
|
18
|
-
export type
|
|
17
|
+
export type DatatruckRepositoryConfig = {
|
|
19
18
|
backend: string;
|
|
20
19
|
compress?: boolean | CompressOptions;
|
|
21
20
|
};
|
|
@@ -26,14 +25,12 @@ type PackObject = {
|
|
|
26
25
|
exclude?: string[];
|
|
27
26
|
onePackByResult?: boolean;
|
|
28
27
|
};
|
|
29
|
-
export type
|
|
28
|
+
export type DatatruckPackageRepositoryConfig = {
|
|
30
29
|
compress?: boolean | CompressOptions;
|
|
31
30
|
packs?: PackObject[];
|
|
32
31
|
};
|
|
33
32
|
export declare const datatruckRepositoryName = "datatruck";
|
|
34
|
-
export declare
|
|
35
|
-
export declare const datatruckPackageRepositoryDefinition: JSONSchema7;
|
|
36
|
-
export declare class DatatruckRepository extends RepositoryAbstract<DatatruckRepositoryConfigType> {
|
|
33
|
+
export declare class DatatruckRepository extends RepositoryAbstract<DatatruckRepositoryConfig> {
|
|
37
34
|
static zipBasenameTpl: string;
|
|
38
35
|
static buildSnapshotName(snapshot: {
|
|
39
36
|
id: string;
|
|
@@ -47,14 +44,14 @@ export declare class DatatruckRepository extends RepositoryAbstract<DatatruckRep
|
|
|
47
44
|
snapshotShortId: string;
|
|
48
45
|
sourcePath: string;
|
|
49
46
|
} | null;
|
|
50
|
-
static parseMetaData(data: string): Promise<
|
|
47
|
+
static parseMetaData(data: string): Promise<MetaData>;
|
|
51
48
|
getSource(): string;
|
|
52
|
-
fetchDiskStats(config:
|
|
49
|
+
fetchDiskStats(config: DatatruckRepositoryConfig): Promise<import("../utils/fs").DiskStats>;
|
|
53
50
|
init(data: RepoInitData): Promise<void>;
|
|
54
51
|
prune(data: RepoPruneData): Promise<void>;
|
|
55
52
|
fetchSnapshots(data: RepoFetchSnapshotsData): Promise<Snapshot[]>;
|
|
56
|
-
backup(data: RepoBackupData<
|
|
57
|
-
copy(data: RepoCopyData<
|
|
58
|
-
restore(data: RepoRestoreData<
|
|
53
|
+
backup(data: RepoBackupData<DatatruckPackageRepositoryConfig>): Promise<void>;
|
|
54
|
+
copy(data: RepoCopyData<DatatruckRepositoryConfig>): Promise<void>;
|
|
55
|
+
restore(data: RepoRestoreData<DatatruckPackageRepositoryConfig>): Promise<void>;
|
|
59
56
|
}
|
|
60
57
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatatruckRepository = exports.
|
|
3
|
+
exports.DatatruckRepository = exports.datatruckRepositoryName = void 0;
|
|
4
4
|
const AppError_1 = require("../Error/AppError");
|
|
5
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
6
5
|
const cli_1 = require("../utils/cli");
|
|
7
6
|
const crypto_1 = require("../utils/crypto");
|
|
8
7
|
const client_1 = require("../utils/datatruck/client");
|
|
@@ -18,42 +17,6 @@ const promises_1 = require("fs/promises");
|
|
|
18
17
|
const micromatch_1 = require("micromatch");
|
|
19
18
|
const path_1 = require("path");
|
|
20
19
|
exports.datatruckRepositoryName = "datatruck";
|
|
21
|
-
exports.datatruckRepositoryDefinition = {
|
|
22
|
-
type: "object",
|
|
23
|
-
required: ["backend"],
|
|
24
|
-
additionalProperties: false,
|
|
25
|
-
properties: {
|
|
26
|
-
backend: { type: "string" },
|
|
27
|
-
compress: {
|
|
28
|
-
anyOf: [{ type: "boolean" }, (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.compressUtil)],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
exports.datatruckPackageRepositoryDefinition = {
|
|
33
|
-
type: "object",
|
|
34
|
-
additionalProperties: false,
|
|
35
|
-
properties: {
|
|
36
|
-
compress: {
|
|
37
|
-
anyOf: [{ type: "boolean" }, (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.compressUtil)],
|
|
38
|
-
},
|
|
39
|
-
packs: {
|
|
40
|
-
type: "array",
|
|
41
|
-
items: {
|
|
42
|
-
type: "object",
|
|
43
|
-
additionalProperties: false,
|
|
44
|
-
properties: {
|
|
45
|
-
name: { type: "string" },
|
|
46
|
-
compress: {
|
|
47
|
-
anyOf: [{ type: "boolean" }, (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.compressUtil)],
|
|
48
|
-
},
|
|
49
|
-
include: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
50
|
-
exclude: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
51
|
-
onePackByResult: { type: "boolean" },
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
20
|
class DatatruckRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
58
21
|
static zipBasenameTpl = `.*.dd.tar.gz`;
|
|
59
22
|
static buildSnapshotName(snapshot, pkg) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RepositoryAbstract, RepoBackupData, RepoInitData, RepoRestoreData, RepoFetchSnapshotsData, Snapshot, SnapshotTagEnum, SnapshotTagObject, RepoPruneData, RepoCopyData } from "./RepositoryAbstract";
|
|
2
|
+
export type GitRepositoryConfig = {
|
|
3
|
+
repo: string;
|
|
4
|
+
branch?: string;
|
|
5
|
+
};
|
|
6
|
+
export type GitPackageRepositoryConfig = {};
|
|
7
|
+
export declare const gitRepositoryName = "git";
|
|
8
|
+
export declare class GitRepository extends RepositoryAbstract<GitRepositoryConfig> {
|
|
9
|
+
static refPrefix: string;
|
|
10
|
+
getSource(): string;
|
|
11
|
+
fetchDiskStats(config: GitRepositoryConfig): Promise<import("../utils/fs").DiskStats | undefined>;
|
|
12
|
+
static buildSnapshotTagName(tag: Pick<SnapshotTagObject, SnapshotTagEnum.PACKAGE | SnapshotTagEnum.ID>): string;
|
|
13
|
+
static buildSnapshotTag(tag: SnapshotTagObject): {
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
static isSnapshotTag(name: string): boolean;
|
|
18
|
+
static parseSnapshotTag(name: string, message: string): (Omit<SnapshotTagObject, "tags"> & {
|
|
19
|
+
tags: string[];
|
|
20
|
+
}) | null;
|
|
21
|
+
static buildBranchName(packageName: string): string;
|
|
22
|
+
init(data: RepoInitData): Promise<void>;
|
|
23
|
+
prune(data: RepoPruneData): Promise<void>;
|
|
24
|
+
fetchSnapshots(data: RepoFetchSnapshotsData): Promise<Snapshot[]>;
|
|
25
|
+
backup(data: RepoBackupData<GitPackageRepositoryConfig>): Promise<void>;
|
|
26
|
+
copy(data: RepoCopyData<GitRepositoryConfig>): Promise<void>;
|
|
27
|
+
restore(data: RepoRestoreData<GitPackageRepositoryConfig>): Promise<void>;
|
|
28
|
+
}
|
|
@@ -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.GitRepository = exports.
|
|
6
|
+
exports.GitRepository = exports.gitRepositoryName = void 0;
|
|
7
7
|
const Git_1 = require("../utils/Git");
|
|
8
8
|
const cli_1 = require("../utils/cli");
|
|
9
9
|
const paths_1 = require("../utils/datatruck/paths");
|
|
@@ -16,20 +16,6 @@ const promises_1 = require("fs/promises");
|
|
|
16
16
|
const micromatch_1 = require("micromatch");
|
|
17
17
|
const path_1 = require("path");
|
|
18
18
|
exports.gitRepositoryName = "git";
|
|
19
|
-
exports.gitRepositoryDefinition = {
|
|
20
|
-
type: "object",
|
|
21
|
-
additionalProperties: false,
|
|
22
|
-
required: ["repo"],
|
|
23
|
-
properties: {
|
|
24
|
-
repo: { type: "string" },
|
|
25
|
-
branch: { type: "string" },
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
exports.gitPackageRepositoryDefinition = {
|
|
29
|
-
type: "object",
|
|
30
|
-
additionalProperties: false,
|
|
31
|
-
properties: {},
|
|
32
|
-
};
|
|
33
19
|
class GitRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
34
20
|
static refPrefix = "dt";
|
|
35
21
|
getSource() {
|
|
@@ -2,8 +2,8 @@ import type { BackupActionOptions } from "../Action/BackupAction";
|
|
|
2
2
|
import type { InitActionOptions } from "../Action/InitAction";
|
|
3
3
|
import type { RestoreActionOptions } from "../Action/RestoreAction";
|
|
4
4
|
import type { ExtendedSnapshot, SnapshotsActionOptions } from "../Action/SnapshotsAction";
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
5
|
+
import type { PackageConfig } from "../Config/PackageConfig";
|
|
6
|
+
import type { RepositoryConfig } from "../Config/RepositoryConfig";
|
|
7
7
|
import { type DiskStats } from "../utils/fs";
|
|
8
8
|
import type { Progress } from "../utils/progress";
|
|
9
9
|
export type PreSnapshot = {
|
|
@@ -26,14 +26,14 @@ export type RepoFetchSnapshotsData = {
|
|
|
26
26
|
export type RepoCopyData<TRepositoryConfig> = {
|
|
27
27
|
options: BackupActionOptions;
|
|
28
28
|
snapshot: PreSnapshot;
|
|
29
|
-
package:
|
|
29
|
+
package: PackageConfig;
|
|
30
30
|
mirrorRepositoryConfig: TRepositoryConfig;
|
|
31
31
|
onProgress: (data: Progress) => void;
|
|
32
32
|
};
|
|
33
33
|
export type RepoBackupData<TPackageConfig> = {
|
|
34
34
|
options: BackupActionOptions;
|
|
35
35
|
snapshot: PreSnapshot;
|
|
36
|
-
package: Omit<
|
|
36
|
+
package: Omit<PackageConfig, "path"> & {
|
|
37
37
|
path: string;
|
|
38
38
|
};
|
|
39
39
|
packageConfig: TPackageConfig | undefined;
|
|
@@ -42,7 +42,7 @@ export type RepoBackupData<TPackageConfig> = {
|
|
|
42
42
|
export type RepoRestoreData<TPackageConfig> = {
|
|
43
43
|
options: RestoreActionOptions;
|
|
44
44
|
snapshot: PreSnapshot;
|
|
45
|
-
package:
|
|
45
|
+
package: PackageConfig;
|
|
46
46
|
snapshotPath: string;
|
|
47
47
|
packageConfig: TPackageConfig;
|
|
48
48
|
onProgress: (data: Progress) => void;
|
|
@@ -63,7 +63,7 @@ export declare enum SnapshotTagEnum {
|
|
|
63
63
|
VERSION = "version",
|
|
64
64
|
SIZE = "size"
|
|
65
65
|
}
|
|
66
|
-
export type
|
|
66
|
+
export type SnapshotTagObject = {
|
|
67
67
|
[SnapshotTagEnum.ID]: string;
|
|
68
68
|
[SnapshotTagEnum.SHORT_ID]: string;
|
|
69
69
|
[SnapshotTagEnum.DATE]: string;
|
|
@@ -74,9 +74,9 @@ export type SnapshotTagObjectType = {
|
|
|
74
74
|
[SnapshotTagEnum.SIZE]: string;
|
|
75
75
|
};
|
|
76
76
|
export declare abstract class RepositoryAbstract<TConfig> {
|
|
77
|
-
readonly repository:
|
|
77
|
+
readonly repository: RepositoryConfig;
|
|
78
78
|
readonly config: TConfig;
|
|
79
|
-
constructor(repository:
|
|
79
|
+
constructor(repository: RepositoryConfig);
|
|
80
80
|
abstract getSource(): string;
|
|
81
81
|
abstract fetchDiskStats(config: TConfig): Promise<DiskStats | undefined>;
|
|
82
82
|
ensureFreeDiskSpace(config: TConfig, minFreeDiskSpace: number | string): Promise<void>;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RepositoryAbstract, RepoBackupData, RepoInitData, RepoRestoreData, RepoFetchSnapshotsData, Snapshot,
|
|
3
|
-
|
|
4
|
-
export type ResticRepositoryConfigType = {
|
|
1
|
+
import { ResticRepositoryUri } from "../utils/Restic";
|
|
2
|
+
import { RepositoryAbstract, RepoBackupData, RepoInitData, RepoRestoreData, RepoFetchSnapshotsData, Snapshot, SnapshotTagObject, SnapshotTagEnum, RepoPruneData, RepoCopyData } from "./RepositoryAbstract";
|
|
3
|
+
export type ResticRepositoryConfig = {
|
|
5
4
|
password: string | {
|
|
6
5
|
path: string;
|
|
7
6
|
};
|
|
8
|
-
repository:
|
|
7
|
+
repository: ResticRepositoryUri;
|
|
9
8
|
};
|
|
10
|
-
export type
|
|
9
|
+
export type ResticPackageRepositoryConfig = {};
|
|
11
10
|
export declare const resticRepositoryName = "restic";
|
|
12
|
-
export declare
|
|
13
|
-
export declare const resticPackageRepositoryDefinition: JSONSchema7;
|
|
14
|
-
export declare class ResticRepository extends RepositoryAbstract<ResticRepositoryConfigType> {
|
|
11
|
+
export declare class ResticRepository extends RepositoryAbstract<ResticRepositoryConfig> {
|
|
15
12
|
static refPrefix: string;
|
|
16
13
|
protected env: {
|
|
17
14
|
RESTIC_PASSWORD?: string;
|
|
@@ -28,15 +25,15 @@ export declare class ResticRepository extends RepositoryAbstract<ResticRepositor
|
|
|
28
25
|
name: SnapshotTagEnum;
|
|
29
26
|
value: string;
|
|
30
27
|
} | null;
|
|
31
|
-
static parseSnapshotTags(tags: string[]):
|
|
28
|
+
static parseSnapshotTags(tags: string[]): SnapshotTagObject & {
|
|
32
29
|
tags: string[];
|
|
33
30
|
};
|
|
34
31
|
getSource(): string;
|
|
35
|
-
fetchDiskStats(config:
|
|
32
|
+
fetchDiskStats(config: ResticRepositoryConfig): Promise<import("../utils/fs").DiskStats | undefined>;
|
|
36
33
|
init(data: RepoInitData): Promise<void>;
|
|
37
34
|
fetchSnapshots(data: RepoFetchSnapshotsData): Promise<Snapshot[]>;
|
|
38
35
|
prune(data: RepoPruneData): Promise<void>;
|
|
39
|
-
backup(data: RepoBackupData<
|
|
40
|
-
copy(data: RepoCopyData<
|
|
41
|
-
restore(data: RepoRestoreData<
|
|
36
|
+
backup(data: RepoBackupData<ResticPackageRepositoryConfig>): Promise<void>;
|
|
37
|
+
copy(data: RepoCopyData<ResticRepositoryConfig>): Promise<void>;
|
|
38
|
+
restore(data: RepoRestoreData<ResticPackageRepositoryConfig>): Promise<void>;
|
|
42
39
|
}
|
|
@@ -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.ResticRepository = exports.
|
|
6
|
+
exports.ResticRepository = exports.resticRepositoryName = void 0;
|
|
7
7
|
const AppError_1 = require("../Error/AppError");
|
|
8
8
|
const Restic_1 = require("../utils/Restic");
|
|
9
9
|
const cli_1 = require("../utils/cli");
|
|
@@ -18,68 +18,6 @@ const promises_1 = require("fs/promises");
|
|
|
18
18
|
const micromatch_1 = require("micromatch");
|
|
19
19
|
const path_1 = require("path");
|
|
20
20
|
exports.resticRepositoryName = "restic";
|
|
21
|
-
exports.resticRepositoryDefinition = {
|
|
22
|
-
type: "object",
|
|
23
|
-
required: ["password", "repository"],
|
|
24
|
-
additionalProperties: false,
|
|
25
|
-
properties: {
|
|
26
|
-
password: {
|
|
27
|
-
anyOf: [
|
|
28
|
-
{ type: "string" },
|
|
29
|
-
{
|
|
30
|
-
type: "object",
|
|
31
|
-
additionalProperties: false,
|
|
32
|
-
required: ["path"],
|
|
33
|
-
properties: {
|
|
34
|
-
path: { type: "string" },
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
repository: {
|
|
40
|
-
type: "object",
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
required: ["backend"],
|
|
43
|
-
properties: {
|
|
44
|
-
name: { type: "string" },
|
|
45
|
-
env: {
|
|
46
|
-
type: "object",
|
|
47
|
-
patternProperties: {
|
|
48
|
-
".+": { type: "string" },
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
backend: {
|
|
52
|
-
enum: ["local", "rest", "sftp", "s3", "azure", "gs", "rclone"],
|
|
53
|
-
},
|
|
54
|
-
protocol: {
|
|
55
|
-
enum: ["http", "https"],
|
|
56
|
-
},
|
|
57
|
-
host: { type: "string" },
|
|
58
|
-
username: { type: "string" },
|
|
59
|
-
password: {
|
|
60
|
-
anyOf: [
|
|
61
|
-
{ type: "string" },
|
|
62
|
-
{
|
|
63
|
-
type: "object",
|
|
64
|
-
additionalProperties: false,
|
|
65
|
-
required: ["path"],
|
|
66
|
-
properties: {
|
|
67
|
-
path: { type: "string" },
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
port: { type: "integer" },
|
|
73
|
-
path: { type: "string" },
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
exports.resticPackageRepositoryDefinition = {
|
|
79
|
-
type: "object",
|
|
80
|
-
additionalProperties: false,
|
|
81
|
-
properties: {},
|
|
82
|
-
};
|
|
83
21
|
class ResticRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
84
22
|
static refPrefix = "dt-";
|
|
85
23
|
env;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TaskBackupData, TaskRestoreData, TaskAbstract } from "./TaskAbstract";
|
|
2
|
-
|
|
3
|
-
export type GitTaskConfigType = {
|
|
2
|
+
export type GitTaskConfig = {
|
|
4
3
|
command?: string;
|
|
5
4
|
/**
|
|
6
5
|
* @default true
|
|
@@ -24,8 +23,7 @@ export type GitTaskConfigType = {
|
|
|
24
23
|
fileCopyConcurrency?: number;
|
|
25
24
|
};
|
|
26
25
|
export declare const gitTaskName = "git";
|
|
27
|
-
export declare
|
|
28
|
-
export declare class GitTask extends TaskAbstract<GitTaskConfigType> {
|
|
26
|
+
export declare class GitTask extends TaskAbstract<GitTaskConfig> {
|
|
29
27
|
protected verbose?: boolean;
|
|
30
28
|
private get command();
|
|
31
29
|
backup(data: TaskBackupData): Promise<{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitTask = exports.
|
|
4
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
3
|
+
exports.GitTask = exports.gitTaskName = void 0;
|
|
5
4
|
const cli_1 = require("../utils/cli");
|
|
6
5
|
const fs_1 = require("../utils/fs");
|
|
7
6
|
const math_1 = require("../utils/math");
|
|
@@ -15,46 +14,6 @@ const micromatch_1 = require("micromatch");
|
|
|
15
14
|
const path_1 = require("path");
|
|
16
15
|
const readline_1 = require("readline");
|
|
17
16
|
exports.gitTaskName = "git";
|
|
18
|
-
exports.gitTaskDefinition = {
|
|
19
|
-
type: "object",
|
|
20
|
-
additionalProperties: false,
|
|
21
|
-
properties: {
|
|
22
|
-
command: {
|
|
23
|
-
type: "string",
|
|
24
|
-
},
|
|
25
|
-
includeModified: {
|
|
26
|
-
anyOf: [
|
|
27
|
-
{
|
|
28
|
-
type: "boolean",
|
|
29
|
-
},
|
|
30
|
-
(0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
includeUntracked: {
|
|
34
|
-
anyOf: [
|
|
35
|
-
{
|
|
36
|
-
type: "boolean",
|
|
37
|
-
},
|
|
38
|
-
(0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
includeIgnored: {
|
|
42
|
-
anyOf: [
|
|
43
|
-
{
|
|
44
|
-
type: "boolean",
|
|
45
|
-
},
|
|
46
|
-
(0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
includeConfig: {
|
|
50
|
-
type: "boolean",
|
|
51
|
-
},
|
|
52
|
-
fileCopyConcurrency: {
|
|
53
|
-
type: "integer",
|
|
54
|
-
minimum: 1,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
17
|
class GitTask extends TaskAbstract_1.TaskAbstract {
|
|
59
18
|
verbose;
|
|
60
19
|
get command() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TaskBackupData, TaskRestoreData, TaskAbstract } from "./TaskAbstract";
|
|
2
|
-
|
|
3
|
-
export type MariadbTaskConfigType = {
|
|
2
|
+
export type MariadbTaskConfig = {
|
|
4
3
|
command?: string;
|
|
5
4
|
hostname: string;
|
|
6
5
|
username: string;
|
|
@@ -24,8 +23,7 @@ export type MariadbTaskConfigType = {
|
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
export declare const mariadbTaskName = "mariadb";
|
|
27
|
-
export declare
|
|
28
|
-
export declare class MariadbTask extends TaskAbstract<MariadbTaskConfigType> {
|
|
26
|
+
export declare class MariadbTask extends TaskAbstract<MariadbTaskConfig> {
|
|
29
27
|
protected verbose?: boolean;
|
|
30
28
|
private get command();
|
|
31
29
|
backup(data: TaskBackupData): Promise<{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MariadbTask = exports.
|
|
4
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
3
|
+
exports.MariadbTask = exports.mariadbTaskName = void 0;
|
|
5
4
|
const cli_1 = require("../utils/cli");
|
|
6
5
|
const fs_1 = require("../utils/fs");
|
|
7
6
|
const math_1 = require("../utils/math");
|
|
@@ -15,58 +14,6 @@ const promises_1 = require("fs/promises");
|
|
|
15
14
|
const os_1 = require("os");
|
|
16
15
|
const path_1 = require("path");
|
|
17
16
|
exports.mariadbTaskName = "mariadb";
|
|
18
|
-
exports.mariadbTaskDefinition = {
|
|
19
|
-
type: "object",
|
|
20
|
-
required: ["hostname", "username", "password"],
|
|
21
|
-
additionalProperties: false,
|
|
22
|
-
properties: {
|
|
23
|
-
command: { type: "string" },
|
|
24
|
-
hostname: { type: "string" },
|
|
25
|
-
username: { type: "string" },
|
|
26
|
-
password: {
|
|
27
|
-
anyOf: [
|
|
28
|
-
{
|
|
29
|
-
type: "string",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: "object",
|
|
33
|
-
additionalProperties: false,
|
|
34
|
-
required: ["path"],
|
|
35
|
-
properties: {
|
|
36
|
-
path: { type: "string" },
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
includeTables: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
42
|
-
excludeTables: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
43
|
-
includeDatabases: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
44
|
-
excludeDatabases: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
45
|
-
parallel: {
|
|
46
|
-
anyOf: [{ type: "integer", minimum: 1 }, { enum: ["auto"] }],
|
|
47
|
-
},
|
|
48
|
-
compress: {
|
|
49
|
-
anyOf: [
|
|
50
|
-
{
|
|
51
|
-
type: "object",
|
|
52
|
-
additionalProperties: false,
|
|
53
|
-
properties: {
|
|
54
|
-
command: { type: "string" },
|
|
55
|
-
args: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: "object",
|
|
60
|
-
additionalProperties: false,
|
|
61
|
-
properties: {
|
|
62
|
-
type: { enum: ["gzip", "pigz"] },
|
|
63
|
-
args: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
17
|
function normalizeConfig(input) {
|
|
71
18
|
let parallel = input.parallel ?? "auto";
|
|
72
19
|
let cores = (0, os_1.cpus)().length;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TaskBackupData, TaskRestoreData, TaskAbstract } from "./TaskAbstract";
|
|
2
|
-
|
|
3
|
-
export type MssqlTaskConfigType = {
|
|
2
|
+
export type MssqlTaskConfig = {
|
|
4
3
|
command?: string;
|
|
5
4
|
hostname?: string;
|
|
6
5
|
username?: string;
|
|
@@ -10,8 +9,7 @@ export type MssqlTaskConfigType = {
|
|
|
10
9
|
excludeDatabases?: string[];
|
|
11
10
|
};
|
|
12
11
|
export declare const mssqlTaskName = "mssql";
|
|
13
|
-
export declare
|
|
14
|
-
export declare class MssqlTask extends TaskAbstract<MssqlTaskConfigType> {
|
|
12
|
+
export declare class MssqlTask extends TaskAbstract<MssqlTaskConfig> {
|
|
15
13
|
static SUFFIX: string;
|
|
16
14
|
protected verbose?: boolean;
|
|
17
15
|
private get command();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MssqlTask = exports.
|
|
3
|
+
exports.MssqlTask = exports.mssqlTaskName = void 0;
|
|
4
4
|
const AppError_1 = require("../Error/AppError");
|
|
5
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
6
5
|
const config_1 = require("../utils/datatruck/config");
|
|
7
6
|
const fs_1 = require("../utils/fs");
|
|
8
7
|
const process_1 = require("../utils/process");
|
|
@@ -12,18 +11,6 @@ const promises_1 = require("fs/promises");
|
|
|
12
11
|
const micromatch_1 = require("micromatch");
|
|
13
12
|
const path_1 = require("path");
|
|
14
13
|
exports.mssqlTaskName = "mssql";
|
|
15
|
-
exports.mssqlTaskDefinition = {
|
|
16
|
-
type: "object",
|
|
17
|
-
additionalProperties: false,
|
|
18
|
-
properties: {
|
|
19
|
-
command: { type: "string" },
|
|
20
|
-
hostname: { type: "string" },
|
|
21
|
-
username: { type: "string" },
|
|
22
|
-
passwordFile: { type: "string" },
|
|
23
|
-
includeDatabases: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
24
|
-
excludeDatabases: (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.stringListUtil),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
14
|
class MssqlTask extends TaskAbstract_1.TaskAbstract {
|
|
28
15
|
static SUFFIX = ".BAK";
|
|
29
16
|
verbose;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CompressOptions } from "../utils/tar";
|
|
2
|
-
import {
|
|
2
|
+
import { SqlDumpTaskConfig } from "./SqlDumpTaskAbstract";
|
|
3
3
|
import { TaskBackupData, TaskPrepareRestoreData, TaskRestoreData, TaskAbstract } from "./TaskAbstract";
|
|
4
4
|
export declare const mysqlDumpTaskName = "mysql-dump";
|
|
5
|
-
export type
|
|
5
|
+
export type MysqlDumpTaskConfig = {
|
|
6
6
|
/**
|
|
7
7
|
* @default "sql"
|
|
8
8
|
*/
|
|
@@ -13,9 +13,8 @@ export type MysqlDumpTaskConfigType = {
|
|
|
13
13
|
*/
|
|
14
14
|
concurrency?: number;
|
|
15
15
|
compress?: boolean | CompressOptions;
|
|
16
|
-
} &
|
|
17
|
-
export declare
|
|
18
|
-
export declare class MysqlDumpTask extends TaskAbstract<MysqlDumpTaskConfigType> {
|
|
16
|
+
} & SqlDumpTaskConfig;
|
|
17
|
+
export declare class MysqlDumpTask extends TaskAbstract<MysqlDumpTaskConfig> {
|
|
19
18
|
backup(data: TaskBackupData): Promise<{
|
|
20
19
|
snapshotPath: string;
|
|
21
20
|
}>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MysqlDumpTask = exports.
|
|
3
|
+
exports.MysqlDumpTask = exports.mysqlDumpTaskName = void 0;
|
|
4
4
|
const AppError_1 = require("../Error/AppError");
|
|
5
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
6
5
|
const async_1 = require("../utils/async");
|
|
7
6
|
const cli_1 = require("../utils/cli");
|
|
8
7
|
const config_1 = require("../utils/datatruck/config");
|
|
@@ -12,19 +11,10 @@ const mysql_1 = require("../utils/mysql");
|
|
|
12
11
|
const string_1 = require("../utils/string");
|
|
13
12
|
const tar_1 = require("../utils/tar");
|
|
14
13
|
const temp_1 = require("../utils/temp");
|
|
15
|
-
const SqlDumpTaskAbstract_1 = require("./SqlDumpTaskAbstract");
|
|
16
14
|
const TaskAbstract_1 = require("./TaskAbstract");
|
|
17
15
|
const promises_1 = require("fs/promises");
|
|
18
16
|
const path_1 = require("path");
|
|
19
17
|
exports.mysqlDumpTaskName = "mysql-dump";
|
|
20
|
-
exports.mysqlDumpTaskDefinition = (0, SqlDumpTaskAbstract_1.sqlDumpTaskDefinition)({
|
|
21
|
-
dataFormat: { enum: ["csv", "sql"] },
|
|
22
|
-
concurrency: { type: "integer", minimum: 1 },
|
|
23
|
-
csvSharedPath: { type: "string" },
|
|
24
|
-
compress: {
|
|
25
|
-
anyOf: [{ type: "boolean" }, (0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.compressUtil)],
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
18
|
const suffix = {
|
|
29
19
|
database: ".database.sql",
|
|
30
20
|
stored: ".stored-programs.sql",
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { SqlDumpTaskAbstract,
|
|
2
|
-
import { JSONSchema7 } from "json-schema";
|
|
1
|
+
import { SqlDumpTaskAbstract, SqlDumpTaskConfig, TargetDatabase } from "./SqlDumpTaskAbstract";
|
|
3
2
|
export declare const postgresqlDumpTaskName = "postgresql-dump";
|
|
4
|
-
export type
|
|
5
|
-
export declare
|
|
6
|
-
export declare class PostgresqlDumpTask extends SqlDumpTaskAbstract<PostgresqlDumpTaskConfigType> {
|
|
3
|
+
export type PostgresqlDumpTaskConfig = SqlDumpTaskConfig;
|
|
4
|
+
export declare class PostgresqlDumpTask extends SqlDumpTaskAbstract<PostgresqlDumpTaskConfig> {
|
|
7
5
|
buildConnectionArgs(database?: string): Promise<string[]>;
|
|
8
6
|
onDatabaseIsEmpty(name: string): Promise<boolean>;
|
|
9
|
-
onCreateDatabase(database:
|
|
10
|
-
onExecQuery(query: string): Promise<import("../utils/process").
|
|
7
|
+
onCreateDatabase(database: TargetDatabase): Promise<void>;
|
|
8
|
+
onExecQuery(query: string): Promise<import("../utils/process").ExecResult>;
|
|
11
9
|
onFetchTableNames(database: string): Promise<string[]>;
|
|
12
10
|
onExportTables(tableNames: string[], output: string, onProgress: (progress: {
|
|
13
11
|
totalBytes: number;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostgresqlDumpTask = exports.
|
|
4
|
-
const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
|
|
3
|
+
exports.PostgresqlDumpTask = exports.postgresqlDumpTaskName = void 0;
|
|
5
4
|
const process_1 = require("../utils/process");
|
|
6
5
|
const SqlDumpTaskAbstract_1 = require("./SqlDumpTaskAbstract");
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
7
|
const path_1 = require("path");
|
|
9
8
|
exports.postgresqlDumpTaskName = "postgresql-dump";
|
|
10
|
-
exports.postgresqlDumpTaskDefinition = {
|
|
11
|
-
allOf: [(0, DefinitionEnum_1.makeRef)(DefinitionEnum_1.DefinitionEnum.sqlDumpTask)],
|
|
12
|
-
};
|
|
13
9
|
class PostgresqlDumpTask extends SqlDumpTaskAbstract_1.SqlDumpTaskAbstract {
|
|
14
10
|
async buildConnectionArgs(database) {
|
|
15
11
|
const password = await this.fetchPassword();
|