@datatruck/cli 0.37.0 → 0.38.1
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 +130 -74
- package/lib/actions/BackupAction.d.ts +55 -19
- package/lib/actions/BackupAction.js +31 -7
- package/lib/actions/CleanCacheAction.d.ts +6 -7
- package/lib/actions/CleanCacheAction.js +2 -1
- package/lib/actions/ConfigAction.d.ts +3 -5
- package/lib/actions/ConfigAction.js +0 -1
- package/lib/actions/CopyAction.d.ts +37 -11
- package/lib/actions/CopyAction.js +29 -2
- package/lib/actions/ExportAction.d.ts +94 -0
- package/lib/actions/ExportAction.js +236 -0
- package/lib/actions/InitAction.d.ts +17 -7
- package/lib/actions/InitAction.js +9 -1
- package/lib/actions/PruneAction.d.ts +76 -17
- package/lib/actions/PruneAction.js +62 -2
- package/lib/actions/RestoreAction.d.ts +55 -21
- package/lib/actions/RestoreAction.js +44 -56
- package/lib/actions/SnapshotsAction.d.ts +80 -21
- package/lib/actions/SnapshotsAction.js +82 -1
- package/lib/cli.d.ts +0 -3
- package/lib/cli.js +14 -93
- package/lib/commands/BackupCommand.d.ts +120 -13
- package/lib/commands/BackupCommand.js +22 -50
- package/lib/commands/CleanCacheCommand.d.ts +10 -3
- package/lib/commands/CleanCacheCommand.js +14 -6
- package/lib/commands/CommandAbstract.d.ts +10 -10
- package/lib/commands/CommandAbstract.js +6 -9
- package/lib/commands/ConfigCommand.d.ts +72 -9
- package/lib/commands/ConfigCommand.js +36 -28
- package/lib/commands/CopyCommand.d.ts +102 -10
- package/lib/commands/CopyCommand.js +18 -40
- package/lib/commands/ExportCommand.d.ts +143 -0
- package/lib/commands/ExportCommand.js +50 -0
- package/lib/commands/InitCommand.d.ts +42 -7
- package/lib/commands/InitCommand.js +15 -17
- package/lib/commands/PruneCommand.d.ts +237 -17
- package/lib/commands/PruneCommand.js +27 -99
- package/lib/commands/RestoreCommand.d.ts +126 -13
- package/lib/commands/RestoreCommand.js +20 -49
- package/lib/commands/RunCommand.d.ts +23 -4
- package/lib/commands/RunCommand.js +21 -12
- package/lib/commands/SnapshotsCommand.d.ts +240 -23
- package/lib/commands/SnapshotsCommand.js +23 -101
- package/lib/commands/StartServerCommand.d.ts +10 -3
- package/lib/commands/StartServerCommand.js +11 -3
- package/lib/repositories/DatatruckRepository.js +1 -1
- package/lib/repositories/GitRepository.js +5 -2
- package/lib/tasks/MssqlTask.js +1 -1
- package/lib/tasks/MysqlDumpTask.js +1 -1
- package/lib/tasks/SqlDumpTaskAbstract.js +2 -2
- package/lib/utils/cli.d.ts +0 -17
- package/lib/utils/cli.js +1 -47
- package/lib/utils/datatruck/command.d.ts +6 -5
- package/lib/utils/datatruck/command.js +9 -5
- package/lib/utils/datatruck/job.js +17 -12
- package/lib/utils/datatruck/repository.d.ts +1 -0
- package/lib/utils/datatruck/repository.js +8 -1
- package/lib/utils/git.d.ts +5 -1
- package/lib/utils/git.js +7 -3
- package/lib/utils/math.js +1 -1
- package/lib/utils/object.d.ts +5 -0
- package/lib/utils/object.js +10 -1
- package/lib/utils/options.d.ts +24 -0
- package/lib/utils/options.js +94 -0
- package/lib/utils/progress.js +1 -1
- package/lib/utils/restic.js +1 -1
- package/lib/utils/string.d.ts +2 -1
- package/lib/utils/string.js +5 -1
- package/lib/utils/watcher.js +1 -1
- package/package.json +4 -4
package/config.schema.json
CHANGED
|
@@ -1466,13 +1466,13 @@
|
|
|
1466
1466
|
"type": "string"
|
|
1467
1467
|
}
|
|
1468
1468
|
},
|
|
1469
|
-
"
|
|
1469
|
+
"keepMinutely": {
|
|
1470
1470
|
"type": "number"
|
|
1471
1471
|
},
|
|
1472
|
-
"
|
|
1472
|
+
"keepDaily": {
|
|
1473
1473
|
"type": "number"
|
|
1474
1474
|
},
|
|
1475
|
-
"
|
|
1475
|
+
"keepHourly": {
|
|
1476
1476
|
"type": "number"
|
|
1477
1477
|
},
|
|
1478
1478
|
"keepLast": {
|
|
@@ -1676,34 +1676,7 @@
|
|
|
1676
1676
|
"const": "backup"
|
|
1677
1677
|
},
|
|
1678
1678
|
"options": {
|
|
1679
|
-
"
|
|
1680
|
-
"properties": {
|
|
1681
|
-
"package": {
|
|
1682
|
-
"type": "string"
|
|
1683
|
-
},
|
|
1684
|
-
"packageTask": {
|
|
1685
|
-
"type": "string"
|
|
1686
|
-
},
|
|
1687
|
-
"repository": {
|
|
1688
|
-
"type": "string"
|
|
1689
|
-
},
|
|
1690
|
-
"repositoryType": {
|
|
1691
|
-
"type": "string"
|
|
1692
|
-
},
|
|
1693
|
-
"tag": {
|
|
1694
|
-
"type": "string"
|
|
1695
|
-
},
|
|
1696
|
-
"dryRun": {
|
|
1697
|
-
"type": "boolean"
|
|
1698
|
-
},
|
|
1699
|
-
"date": {
|
|
1700
|
-
"type": "string"
|
|
1701
|
-
},
|
|
1702
|
-
"prune": {
|
|
1703
|
-
"type": "boolean"
|
|
1704
|
-
}
|
|
1705
|
-
},
|
|
1706
|
-
"additionalProperties": false
|
|
1679
|
+
"$ref": "#/definitions/BackupCommandOptions"
|
|
1707
1680
|
},
|
|
1708
1681
|
"schedule": {
|
|
1709
1682
|
"anyOf": [
|
|
@@ -1828,31 +1801,7 @@
|
|
|
1828
1801
|
"const": "copy"
|
|
1829
1802
|
},
|
|
1830
1803
|
"options": {
|
|
1831
|
-
"
|
|
1832
|
-
"properties": {
|
|
1833
|
-
"id": {
|
|
1834
|
-
"type": "string"
|
|
1835
|
-
},
|
|
1836
|
-
"last": {
|
|
1837
|
-
"type": "number"
|
|
1838
|
-
},
|
|
1839
|
-
"package": {
|
|
1840
|
-
"type": "string"
|
|
1841
|
-
},
|
|
1842
|
-
"packageTask": {
|
|
1843
|
-
"type": "string"
|
|
1844
|
-
},
|
|
1845
|
-
"repository": {
|
|
1846
|
-
"type": "string"
|
|
1847
|
-
},
|
|
1848
|
-
"repository2": {
|
|
1849
|
-
"type": "string"
|
|
1850
|
-
}
|
|
1851
|
-
},
|
|
1852
|
-
"additionalProperties": false,
|
|
1853
|
-
"required": [
|
|
1854
|
-
"repository"
|
|
1855
|
-
]
|
|
1804
|
+
"$ref": "#/definitions/CopyCommandOptions"
|
|
1856
1805
|
},
|
|
1857
1806
|
"schedule": {
|
|
1858
1807
|
"anyOf": [
|
|
@@ -2095,31 +2044,147 @@
|
|
|
2095
2044
|
}
|
|
2096
2045
|
]
|
|
2097
2046
|
},
|
|
2098
|
-
"
|
|
2047
|
+
"BackupCommandOptions": {
|
|
2048
|
+
"additionalProperties": false,
|
|
2099
2049
|
"type": "object",
|
|
2100
2050
|
"properties": {
|
|
2101
|
-
"
|
|
2102
|
-
"type": "
|
|
2051
|
+
"dryRun": {
|
|
2052
|
+
"type": "boolean"
|
|
2103
2053
|
},
|
|
2104
|
-
"
|
|
2054
|
+
"date": {
|
|
2105
2055
|
"type": "string"
|
|
2106
2056
|
},
|
|
2107
|
-
"
|
|
2057
|
+
"prune": {
|
|
2058
|
+
"type": "boolean"
|
|
2059
|
+
},
|
|
2060
|
+
"repositoryNames": {
|
|
2061
|
+
"type": "array",
|
|
2062
|
+
"items": {
|
|
2063
|
+
"type": "string"
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
"repositoryTypes": {
|
|
2067
|
+
"type": "array",
|
|
2068
|
+
"items": {
|
|
2069
|
+
"type": "string"
|
|
2070
|
+
}
|
|
2071
|
+
},
|
|
2072
|
+
"packageNames": {
|
|
2073
|
+
"type": "array",
|
|
2074
|
+
"items": {
|
|
2075
|
+
"type": "string"
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
"packageTaskNames": {
|
|
2079
|
+
"type": "array",
|
|
2080
|
+
"items": {
|
|
2081
|
+
"type": "string"
|
|
2082
|
+
}
|
|
2083
|
+
},
|
|
2084
|
+
"tags": {
|
|
2085
|
+
"type": "array",
|
|
2086
|
+
"items": {
|
|
2087
|
+
"type": "string"
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
},
|
|
2092
|
+
"CopyCommandOptions": {
|
|
2093
|
+
"additionalProperties": false,
|
|
2094
|
+
"type": "object",
|
|
2095
|
+
"properties": {
|
|
2096
|
+
"repositoryName": {
|
|
2108
2097
|
"type": "string"
|
|
2109
2098
|
},
|
|
2099
|
+
"repositoryNames2": {
|
|
2100
|
+
"type": "array",
|
|
2101
|
+
"items": {
|
|
2102
|
+
"type": "string"
|
|
2103
|
+
}
|
|
2104
|
+
},
|
|
2105
|
+
"packageNames": {
|
|
2106
|
+
"type": "array",
|
|
2107
|
+
"items": {
|
|
2108
|
+
"type": "string"
|
|
2109
|
+
}
|
|
2110
|
+
},
|
|
2111
|
+
"packageTaskNames": {
|
|
2112
|
+
"type": "array",
|
|
2113
|
+
"items": {
|
|
2114
|
+
"type": "string"
|
|
2115
|
+
}
|
|
2116
|
+
},
|
|
2117
|
+
"ids": {
|
|
2118
|
+
"type": "array",
|
|
2119
|
+
"items": {
|
|
2120
|
+
"type": "string"
|
|
2121
|
+
}
|
|
2122
|
+
},
|
|
2123
|
+
"last": {
|
|
2124
|
+
"type": "number"
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
"required": [
|
|
2128
|
+
"repositoryName"
|
|
2129
|
+
]
|
|
2130
|
+
},
|
|
2131
|
+
"Omit<PruneCommandOptions,\"confirm\">": {
|
|
2132
|
+
"type": "object",
|
|
2133
|
+
"properties": {
|
|
2134
|
+
"tags": {
|
|
2135
|
+
"type": "array",
|
|
2136
|
+
"items": {
|
|
2137
|
+
"type": "string"
|
|
2138
|
+
}
|
|
2139
|
+
},
|
|
2140
|
+
"ids": {
|
|
2141
|
+
"type": "array",
|
|
2142
|
+
"items": {
|
|
2143
|
+
"type": "string"
|
|
2144
|
+
}
|
|
2145
|
+
},
|
|
2146
|
+
"repositoryNames": {
|
|
2147
|
+
"type": "array",
|
|
2148
|
+
"items": {
|
|
2149
|
+
"type": "string"
|
|
2150
|
+
}
|
|
2151
|
+
},
|
|
2152
|
+
"repositoryTypes": {
|
|
2153
|
+
"type": "array",
|
|
2154
|
+
"items": {
|
|
2155
|
+
"type": "string"
|
|
2156
|
+
}
|
|
2157
|
+
},
|
|
2158
|
+
"packageNames": {
|
|
2159
|
+
"type": "array",
|
|
2160
|
+
"items": {
|
|
2161
|
+
"type": "string"
|
|
2162
|
+
}
|
|
2163
|
+
},
|
|
2110
2164
|
"groupBy": {
|
|
2111
|
-
"type": "
|
|
2165
|
+
"type": "array",
|
|
2166
|
+
"items": {
|
|
2167
|
+
"enum": [
|
|
2168
|
+
"packageName",
|
|
2169
|
+
"repositoryName",
|
|
2170
|
+
"repositoryType"
|
|
2171
|
+
],
|
|
2172
|
+
"type": "string"
|
|
2173
|
+
}
|
|
2112
2174
|
},
|
|
2113
2175
|
"dryRun": {
|
|
2114
2176
|
"type": "boolean"
|
|
2115
2177
|
},
|
|
2116
|
-
"
|
|
2178
|
+
"showAll": {
|
|
2179
|
+
"type": "string"
|
|
2180
|
+
},
|
|
2181
|
+
"keepMinutely": {
|
|
2117
2182
|
"type": "number"
|
|
2118
2183
|
},
|
|
2119
|
-
"
|
|
2184
|
+
"keepDaily": {
|
|
2120
2185
|
"type": "number"
|
|
2121
2186
|
},
|
|
2122
|
-
"
|
|
2187
|
+
"keepHourly": {
|
|
2123
2188
|
"type": "number"
|
|
2124
2189
|
},
|
|
2125
2190
|
"keepLast": {
|
|
@@ -2134,17 +2199,8 @@
|
|
|
2134
2199
|
"keepYearly": {
|
|
2135
2200
|
"type": "number"
|
|
2136
2201
|
},
|
|
2137
|
-
"package": {
|
|
2138
|
-
"type": "string"
|
|
2139
|
-
},
|
|
2140
|
-
"tag": {
|
|
2141
|
-
"type": "string"
|
|
2142
|
-
},
|
|
2143
2202
|
"longId": {
|
|
2144
2203
|
"type": "boolean"
|
|
2145
|
-
},
|
|
2146
|
-
"showAll": {
|
|
2147
|
-
"type": "boolean"
|
|
2148
2204
|
}
|
|
2149
2205
|
},
|
|
2150
2206
|
"additionalProperties": false
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { PreSnapshot } from "../repositories/RepositoryAbstract";
|
|
2
2
|
import { DataFormat } from "../utils/data-format";
|
|
3
|
-
import type { Config, PackageConfig
|
|
3
|
+
import type { Config, PackageConfig } from "../utils/datatruck/config-type";
|
|
4
4
|
import { ReportListTaskContext } from "../utils/datatruck/report-list";
|
|
5
5
|
import { Listr3TaskResultEnd } from "../utils/list";
|
|
6
|
+
import { InferOptions } from "../utils/options";
|
|
6
7
|
import { Progress, ProgressMode } from "../utils/progress";
|
|
7
8
|
import { StdStreams } from "../utils/stream";
|
|
8
|
-
import { IfRequireKeys } from "../utils/ts";
|
|
9
|
-
export type BackupActionOptions = {
|
|
10
|
-
repositoryNames?: string[];
|
|
11
|
-
repositoryTypes?: RepositoryConfig["type"][];
|
|
12
|
-
packageNames?: string[];
|
|
13
|
-
packageTaskNames?: string[];
|
|
14
|
-
tags?: string[];
|
|
15
|
-
dryRun?: boolean;
|
|
16
|
-
verbose?: boolean;
|
|
17
|
-
date?: string;
|
|
18
|
-
tty?: "auto" | boolean;
|
|
19
|
-
progress?: ProgressMode;
|
|
20
|
-
streams?: StdStreams;
|
|
21
|
-
prune?: boolean;
|
|
22
|
-
};
|
|
23
9
|
type Context = {
|
|
24
10
|
snapshot: {
|
|
25
11
|
id: string;
|
|
@@ -46,10 +32,60 @@ type Context = {
|
|
|
46
32
|
pruned: number;
|
|
47
33
|
};
|
|
48
34
|
} & ReportListTaskContext;
|
|
49
|
-
export declare
|
|
35
|
+
export declare const backupActionOptions: {
|
|
36
|
+
dryRun: {
|
|
37
|
+
description: string;
|
|
38
|
+
value: "boolean";
|
|
39
|
+
};
|
|
40
|
+
date: {
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
prune: {
|
|
44
|
+
description: string;
|
|
45
|
+
value: "boolean";
|
|
46
|
+
};
|
|
47
|
+
repositoryNames: {
|
|
48
|
+
description: string;
|
|
49
|
+
shortFlag: string;
|
|
50
|
+
value: "array";
|
|
51
|
+
};
|
|
52
|
+
repositoryTypes: {
|
|
53
|
+
description: string;
|
|
54
|
+
shortFlag: string;
|
|
55
|
+
value: "array";
|
|
56
|
+
};
|
|
57
|
+
packageNames: {
|
|
58
|
+
description: string;
|
|
59
|
+
shortFlag: string;
|
|
60
|
+
value: "array";
|
|
61
|
+
};
|
|
62
|
+
packageTaskNames: {
|
|
63
|
+
description: string;
|
|
64
|
+
shortFlag: string;
|
|
65
|
+
value: "array";
|
|
66
|
+
};
|
|
67
|
+
tags: {
|
|
68
|
+
description: string;
|
|
69
|
+
shortFlag: string;
|
|
70
|
+
value: "array";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type BackupActionOptions = InferOptions<typeof backupActionOptions> & {
|
|
74
|
+
verbose?: boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare class BackupAction {
|
|
50
77
|
readonly config: Config;
|
|
51
|
-
readonly options:
|
|
52
|
-
|
|
78
|
+
readonly options: BackupActionOptions;
|
|
79
|
+
readonly settings: {
|
|
80
|
+
tty?: "auto" | boolean;
|
|
81
|
+
progress?: ProgressMode;
|
|
82
|
+
streams?: StdStreams;
|
|
83
|
+
};
|
|
84
|
+
constructor(config: Config, options: BackupActionOptions, settings: {
|
|
85
|
+
tty?: "auto" | boolean;
|
|
86
|
+
progress?: ProgressMode;
|
|
87
|
+
streams?: StdStreams;
|
|
88
|
+
});
|
|
53
89
|
protected prepareSnapshot(): PreSnapshot;
|
|
54
90
|
protected getPackages(snapshot: PreSnapshot): PackageConfig[];
|
|
55
91
|
protected getRepositoryNames(repositoryNames: string[]): {
|
|
@@ -48,7 +48,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.BackupAction = void 0;
|
|
51
|
+
exports.BackupAction = exports.backupActionOptions = void 0;
|
|
52
52
|
const bytes_1 = require("../utils/bytes");
|
|
53
53
|
const cli_1 = require("../utils/cli");
|
|
54
54
|
const data_format_1 = require("../utils/data-format");
|
|
@@ -60,20 +60,44 @@ const date_1 = require("../utils/date");
|
|
|
60
60
|
const error_1 = require("../utils/error");
|
|
61
61
|
const fs_1 = require("../utils/fs");
|
|
62
62
|
const list_1 = require("../utils/list");
|
|
63
|
+
const object_1 = require("../utils/object");
|
|
63
64
|
const progress_1 = require("../utils/progress");
|
|
64
65
|
const temp_1 = require("../utils/temp");
|
|
65
66
|
const PruneAction_1 = require("./PruneAction");
|
|
67
|
+
const SnapshotsAction_1 = require("./SnapshotsAction");
|
|
66
68
|
const assert_1 = require("assert");
|
|
67
69
|
const chalk_1 = __importDefault(require("chalk"));
|
|
68
70
|
const crypto_1 = require("crypto");
|
|
69
71
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
70
72
|
const os_1 = require("os");
|
|
73
|
+
exports.backupActionOptions = {
|
|
74
|
+
...(0, object_1.pickProps)(SnapshotsAction_1.snapshotsActionOptions, {
|
|
75
|
+
repositoryNames: true,
|
|
76
|
+
repositoryTypes: true,
|
|
77
|
+
packageNames: true,
|
|
78
|
+
packageTaskNames: true,
|
|
79
|
+
tags: true,
|
|
80
|
+
}),
|
|
81
|
+
dryRun: {
|
|
82
|
+
description: "Skip execution",
|
|
83
|
+
value: "boolean",
|
|
84
|
+
},
|
|
85
|
+
date: {
|
|
86
|
+
description: "Date time (ISO)",
|
|
87
|
+
},
|
|
88
|
+
prune: {
|
|
89
|
+
description: "Prune backups",
|
|
90
|
+
value: "boolean",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
71
93
|
class BackupAction {
|
|
72
94
|
config;
|
|
73
95
|
options;
|
|
74
|
-
|
|
96
|
+
settings;
|
|
97
|
+
constructor(config, options, settings) {
|
|
75
98
|
this.config = config;
|
|
76
99
|
this.options = options;
|
|
100
|
+
this.settings = settings;
|
|
77
101
|
}
|
|
78
102
|
prepareSnapshot() {
|
|
79
103
|
const date = this.options.date ?? new Date().toISOString();
|
|
@@ -217,15 +241,15 @@ class BackupAction {
|
|
|
217
241
|
});
|
|
218
242
|
}
|
|
219
243
|
async exec() {
|
|
220
|
-
const { options } = this;
|
|
244
|
+
const { options, settings } = this;
|
|
221
245
|
const gc = new temp_1.GargabeCollector();
|
|
222
246
|
const pm = new progress_1.ProgressManager({
|
|
223
247
|
verbose: options.verbose,
|
|
224
|
-
tty:
|
|
225
|
-
mode:
|
|
248
|
+
tty: settings.tty,
|
|
249
|
+
mode: settings.progress,
|
|
226
250
|
});
|
|
227
251
|
const l = new list_1.Listr3({
|
|
228
|
-
streams:
|
|
252
|
+
streams: settings.streams,
|
|
229
253
|
progressManager: pm,
|
|
230
254
|
gargabeCollector: gc,
|
|
231
255
|
});
|
|
@@ -274,7 +298,7 @@ class BackupAction {
|
|
|
274
298
|
try {
|
|
275
299
|
const progress = __addDisposableResource(env_1, pm.create(task), false);
|
|
276
300
|
taskResult = await (0, task_1.createTask)(pkg.task).backup({
|
|
277
|
-
options,
|
|
301
|
+
options: this.options,
|
|
278
302
|
package: pkg,
|
|
279
303
|
snapshot,
|
|
280
304
|
onProgress: progress.update,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
constructor(options: IfRequireKeys<TRequired, CleanCacheActionOptions>);
|
|
1
|
+
import { InferOptions } from "../utils/options";
|
|
2
|
+
export declare const cleanCacheActionOptions: {};
|
|
3
|
+
export type CleanCacheActionOptions = InferOptions<typeof cleanCacheActionOptions>;
|
|
4
|
+
export declare class CleanCacheAction {
|
|
5
|
+
readonly options: CleanCacheActionOptions;
|
|
6
|
+
constructor(options: CleanCacheActionOptions);
|
|
8
7
|
exec(): Promise<{
|
|
9
8
|
errors: never[];
|
|
10
9
|
path: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CleanCacheAction = void 0;
|
|
3
|
+
exports.CleanCacheAction = exports.cleanCacheActionOptions = void 0;
|
|
4
4
|
const fs_1 = require("../utils/fs");
|
|
5
5
|
const temp_1 = require("../utils/temp");
|
|
6
6
|
const promises_1 = require("fs/promises");
|
|
7
|
+
exports.cleanCacheActionOptions = {};
|
|
7
8
|
class CleanCacheAction {
|
|
8
9
|
options;
|
|
9
10
|
constructor(options) {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { GlobalOptions } from "../commands/CommandAbstract";
|
|
2
2
|
import type { Config } from "../utils/datatruck/config-type";
|
|
3
|
-
import { IfRequireKeys } from "../utils/ts";
|
|
4
3
|
export type ConfigActionOptions = {
|
|
5
4
|
path: string;
|
|
6
|
-
verbose?: boolean;
|
|
7
5
|
};
|
|
8
|
-
export declare class ConfigAction
|
|
9
|
-
readonly options:
|
|
10
|
-
constructor(options:
|
|
6
|
+
export declare class ConfigAction {
|
|
7
|
+
readonly options: ConfigActionOptions;
|
|
8
|
+
constructor(options: ConfigActionOptions);
|
|
11
9
|
static validate(config: Config): void;
|
|
12
10
|
static check(config: Config): void;
|
|
13
11
|
static normalize(config: Config): Config;
|
|
@@ -4,16 +4,42 @@ import type { Config, RepositoryConfig } from "../utils/datatruck/config-type";
|
|
|
4
4
|
import { ReportListTaskContext } from "../utils/datatruck/report-list";
|
|
5
5
|
import { Listr3TaskResultEnd } from "../utils/list";
|
|
6
6
|
import { StrictMap } from "../utils/object";
|
|
7
|
+
import { InferOptions } from "../utils/options";
|
|
7
8
|
import { Progress, ProgressMode } from "../utils/progress";
|
|
8
9
|
import { StdStreams } from "../utils/stream";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export declare const copyActionOptions: {
|
|
11
|
+
repositoryNames2: {
|
|
12
|
+
description: string;
|
|
13
|
+
shortFlag: string;
|
|
14
|
+
value: "array";
|
|
15
|
+
};
|
|
16
|
+
packageNames: {
|
|
17
|
+
description: string;
|
|
18
|
+
shortFlag: string;
|
|
19
|
+
value: "array";
|
|
20
|
+
};
|
|
21
|
+
packageTaskNames: {
|
|
22
|
+
description: string;
|
|
23
|
+
shortFlag: string;
|
|
24
|
+
value: "array";
|
|
25
|
+
};
|
|
26
|
+
ids: {
|
|
27
|
+
description: string;
|
|
28
|
+
shortFlag: string;
|
|
29
|
+
value: "array";
|
|
30
|
+
};
|
|
31
|
+
last: {
|
|
32
|
+
description: string;
|
|
33
|
+
shortFlag: string;
|
|
34
|
+
value: "number";
|
|
35
|
+
};
|
|
36
|
+
repositoryName: {
|
|
37
|
+
description: string;
|
|
38
|
+
shortFlag: string;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type CopyActionOptions = InferOptions<typeof copyActionOptions> & {
|
|
17
43
|
verbose?: boolean;
|
|
18
44
|
tty?: "auto" | boolean;
|
|
19
45
|
progress?: ProgressMode;
|
|
@@ -34,10 +60,10 @@ export type Context = {
|
|
|
34
60
|
bytes: number;
|
|
35
61
|
};
|
|
36
62
|
} & ReportListTaskContext;
|
|
37
|
-
export declare class CopyAction
|
|
63
|
+
export declare class CopyAction {
|
|
38
64
|
readonly config: Config;
|
|
39
|
-
readonly options:
|
|
40
|
-
constructor(config: Config, options:
|
|
65
|
+
readonly options: CopyActionOptions;
|
|
66
|
+
constructor(config: Config, options: CopyActionOptions);
|
|
41
67
|
dataFormat(result: Listr3TaskResultEnd<Context>[], options?: {
|
|
42
68
|
streams?: StdStreams;
|
|
43
69
|
verbose?: number;
|
|
@@ -48,7 +48,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.CopyAction = void 0;
|
|
51
|
+
exports.CopyAction = exports.copyActionOptions = void 0;
|
|
52
52
|
const bytes_1 = require("../utils/bytes");
|
|
53
53
|
const cli_1 = require("../utils/cli");
|
|
54
54
|
const data_format_1 = require("../utils/data-format");
|
|
@@ -62,8 +62,35 @@ const list_1 = require("../utils/list");
|
|
|
62
62
|
const object_1 = require("../utils/object");
|
|
63
63
|
const progress_1 = require("../utils/progress");
|
|
64
64
|
const temp_1 = require("../utils/temp");
|
|
65
|
+
const SnapshotsAction_1 = require("./SnapshotsAction");
|
|
65
66
|
const chalk_1 = __importDefault(require("chalk"));
|
|
66
67
|
const os_1 = require("os");
|
|
68
|
+
exports.copyActionOptions = {
|
|
69
|
+
ids: {
|
|
70
|
+
description: "Filter by identifiers",
|
|
71
|
+
shortFlag: "i",
|
|
72
|
+
value: "array",
|
|
73
|
+
},
|
|
74
|
+
last: {
|
|
75
|
+
description: "Last snapshots",
|
|
76
|
+
shortFlag: "l",
|
|
77
|
+
value: "number",
|
|
78
|
+
},
|
|
79
|
+
repositoryName: {
|
|
80
|
+
description: "Filter by repository name",
|
|
81
|
+
shortFlag: "r",
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
...(0, object_1.pickProps)(SnapshotsAction_1.snapshotsActionOptions, {
|
|
85
|
+
packageNames: true,
|
|
86
|
+
packageTaskNames: true,
|
|
87
|
+
}),
|
|
88
|
+
repositoryNames2: {
|
|
89
|
+
description: "Filter by repository names",
|
|
90
|
+
shortFlag: "r2",
|
|
91
|
+
value: "array",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
67
94
|
class CopyAction {
|
|
68
95
|
config;
|
|
69
96
|
options;
|
|
@@ -156,7 +183,7 @@ class CopyAction {
|
|
|
156
183
|
await repo.restore({
|
|
157
184
|
options: {
|
|
158
185
|
verbose: this.options.verbose,
|
|
159
|
-
|
|
186
|
+
id: snapshot.id,
|
|
160
187
|
},
|
|
161
188
|
snapshot: { id: snapshot.id, date: snapshot.date },
|
|
162
189
|
package: { name: snapshot.packageName },
|