@datatruck/cli 0.32.1 → 0.32.3

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.
Files changed (189) hide show
  1. package/config.schema.json +1224 -1271
  2. package/{Action → lib/Action}/BackupAction.d.ts +9 -9
  3. package/{Action → lib/Action}/BackupAction.js +27 -8
  4. package/{Action → lib/Action}/ConfigAction.d.ts +9 -9
  5. package/{Action → lib/Action}/ConfigAction.js +4 -2
  6. package/{Action → lib/Action}/CopyAction.d.ts +5 -5
  7. package/{Action → lib/Action}/InitAction.d.ts +3 -3
  8. package/{Action → lib/Action}/PruneAction.d.ts +5 -5
  9. package/{Action → lib/Action}/RestoreAction.d.ts +5 -5
  10. package/{Action → lib/Action}/SnapshotsAction.d.ts +5 -5
  11. package/{Command → lib/Command}/BackupCommand.d.ts +2 -2
  12. package/{Command → lib/Command}/CommandAbstract.d.ts +4 -4
  13. package/{Command → lib/Command}/ConfigCommand.d.ts +2 -2
  14. package/{Command → lib/Command}/InitCommand.d.ts +2 -2
  15. package/{Command → lib/Command}/PruneCommand.d.ts +2 -2
  16. package/{Command → lib/Command}/RestoreCommand.d.ts +2 -2
  17. package/{Command → lib/Command}/SnapshotsCommand.d.ts +2 -2
  18. package/lib/Config/Config.d.ts +28 -0
  19. package/lib/Config/PackageConfig.d.ts +24 -0
  20. package/lib/Config/PackageConfig.js +2 -0
  21. package/lib/Config/PackageRepositoryConfig.d.ts +15 -0
  22. package/lib/Config/PackageRepositoryConfig.js +2 -0
  23. package/lib/Config/PrunePolicyConfig.d.ts +2 -0
  24. package/lib/Config/PrunePolicyConfig.js +2 -0
  25. package/lib/Config/RepositoryConfig.d.ts +27 -0
  26. package/lib/Config/RepositoryConfig.js +2 -0
  27. package/lib/Config/TaskConfig.d.ts +31 -0
  28. package/lib/Config/TaskConfig.js +2 -0
  29. package/{Factory → lib/Factory}/CommandFactory.d.ts +5 -5
  30. package/lib/Factory/RepositoryFactory.d.ts +3 -0
  31. package/lib/Factory/TaskFactory.d.ts +3 -0
  32. package/{Repository → lib/Repository}/DatatruckRepository.d.ts +9 -12
  33. package/{Repository → lib/Repository}/DatatruckRepository.js +1 -38
  34. package/lib/Repository/GitRepository.d.ts +28 -0
  35. package/{Repository → lib/Repository}/GitRepository.js +1 -15
  36. package/{Repository → lib/Repository}/RepositoryAbstract.d.ts +8 -8
  37. package/{Repository → lib/Repository}/ResticRepository.d.ts +11 -14
  38. package/{Repository → lib/Repository}/ResticRepository.js +1 -63
  39. package/{Task → lib/Task}/GitTask.d.ts +2 -4
  40. package/{Task → lib/Task}/GitTask.js +1 -42
  41. package/{Task → lib/Task}/MariadbTask.d.ts +2 -4
  42. package/{Task → lib/Task}/MariadbTask.js +1 -54
  43. package/{Task → lib/Task}/MssqlTask.d.ts +2 -4
  44. package/{Task → lib/Task}/MssqlTask.js +1 -14
  45. package/{Task → lib/Task}/MysqlDumpTask.d.ts +4 -5
  46. package/{Task → lib/Task}/MysqlDumpTask.js +1 -11
  47. package/{Task → lib/Task}/PostgresqlDumpTask.d.ts +5 -7
  48. package/{Task → lib/Task}/PostgresqlDumpTask.js +1 -5
  49. package/lib/Task/ScriptTask.d.ts +30 -0
  50. package/lib/Task/ScriptTask.js +55 -0
  51. package/{Task → lib/Task}/SqlDumpTaskAbstract.d.ts +5 -7
  52. package/{Task → lib/Task}/SqlDumpTaskAbstract.js +1 -43
  53. package/{Task → lib/Task}/TaskAbstract.d.ts +2 -2
  54. package/lib/cli.d.ts +4 -0
  55. package/lib/config.schema.d.ts +2 -0
  56. package/lib/config.schema.js +10 -0
  57. package/lib/index.d.ts +24 -0
  58. package/lib/index.js +21 -0
  59. package/{utils → lib/utils}/DataFormat.d.ts +4 -4
  60. package/{utils → lib/utils}/Git.d.ts +6 -6
  61. package/{utils → lib/utils}/Restic.d.ts +14 -14
  62. package/{utils → lib/utils}/datatruck/config.d.ts +20 -20
  63. package/lib/utils/datatruck/paths.d.ts +17 -0
  64. package/{utils → lib/utils}/datatruck/paths.js +3 -3
  65. package/{utils → lib/utils}/datatruck/repository-server.d.ts +1 -1
  66. package/{utils → lib/utils}/datatruck/snapshot.d.ts +2 -2
  67. package/{utils → lib/utils}/date.d.ts +3 -3
  68. package/{utils → lib/utils}/exit.d.ts +3 -3
  69. package/{utils → lib/utils}/mysql.d.ts +5 -4
  70. package/{utils → lib/utils}/mysql.js +2 -2
  71. package/{utils → lib/utils}/process.d.ts +8 -5
  72. package/lib/utils/reportSteps.d.ts +26 -0
  73. package/lib/utils/reportSteps.js +41 -0
  74. package/lib/utils/spawnSteps.d.ts +36 -0
  75. package/lib/utils/spawnSteps.js +74 -0
  76. package/{utils → lib/utils}/string.d.ts +3 -3
  77. package/{utils → lib/utils}/string.js +3 -3
  78. package/{utils → lib/utils}/tar.d.ts +0 -8
  79. package/{utils → lib/utils}/tar.js +1 -18
  80. package/package.json +39 -25
  81. package/CHANGELOG.md +0 -569
  82. package/Config/Config.d.ts +0 -28
  83. package/Config/Config.js +0 -140
  84. package/Config/PackageConfig.d.ts +0 -23
  85. package/Config/PackageConfig.js +0 -51
  86. package/Config/PackageRepositoryConfig.d.ts +0 -17
  87. package/Config/PackageRepositoryConfig.js +0 -37
  88. package/Config/PrunePolicyConfig.d.ts +0 -4
  89. package/Config/PrunePolicyConfig.js +0 -28
  90. package/Config/RepositoryConfig.d.ts +0 -24
  91. package/Config/RepositoryConfig.js +0 -62
  92. package/Config/TaskConfig.d.ts +0 -27
  93. package/Config/TaskConfig.js +0 -41
  94. package/Factory/RepositoryFactory.d.ts +0 -3
  95. package/Factory/TaskFactory.d.ts +0 -3
  96. package/JsonSchema/DefinitionEnum.d.ts +0 -26
  97. package/JsonSchema/DefinitionEnum.js +0 -33
  98. package/JsonSchema/JsonSchema.d.ts +0 -4
  99. package/JsonSchema/JsonSchema.js +0 -65
  100. package/JsonSchema/backup-def.d.ts +0 -30
  101. package/JsonSchema/backup-def.js +0 -18
  102. package/JsonSchema/copy-def.d.ts +0 -24
  103. package/JsonSchema/copy-def.js +0 -15
  104. package/Repository/GitRepository.d.ts +0 -31
  105. package/Task/ScriptTask.d.ts +0 -38
  106. package/Task/ScriptTask.js +0 -163
  107. package/cli.d.ts +0 -4
  108. package/index.d.ts +0 -1
  109. package/utils/datatruck/paths.d.ts +0 -17
  110. package/utils/path.d.ts +0 -1
  111. package/utils/path.js +0 -8
  112. package/utils/schema.d.ts +0 -34
  113. package/utils/schema.js +0 -36
  114. package/utils/steps.d.ts +0 -43
  115. package/utils/steps.js +0 -97
  116. /package/{Action → lib/Action}/CleanCacheAction.d.ts +0 -0
  117. /package/{Action → lib/Action}/CleanCacheAction.js +0 -0
  118. /package/{Action → lib/Action}/CopyAction.js +0 -0
  119. /package/{Action → lib/Action}/InitAction.js +0 -0
  120. /package/{Action → lib/Action}/PruneAction.js +0 -0
  121. /package/{Action → lib/Action}/RestoreAction.js +0 -0
  122. /package/{Action → lib/Action}/SnapshotsAction.js +0 -0
  123. /package/{Command → lib/Command}/BackupCommand.js +0 -0
  124. /package/{Command → lib/Command}/CleanCacheCommand.d.ts +0 -0
  125. /package/{Command → lib/Command}/CleanCacheCommand.js +0 -0
  126. /package/{Command → lib/Command}/CommandAbstract.js +0 -0
  127. /package/{Command → lib/Command}/ConfigCommand.js +0 -0
  128. /package/{Command → lib/Command}/CopyCommand.d.ts +0 -0
  129. /package/{Command → lib/Command}/CopyCommand.js +0 -0
  130. /package/{Command → lib/Command}/InitCommand.js +0 -0
  131. /package/{Command → lib/Command}/PruneCommand.js +0 -0
  132. /package/{Command → lib/Command}/RestoreCommand.js +0 -0
  133. /package/{Command → lib/Command}/SnapshotsCommand.js +0 -0
  134. /package/{Command → lib/Command}/StartServerCommand.d.ts +0 -0
  135. /package/{Command → lib/Command}/StartServerCommand.js +0 -0
  136. /package/{index.js → lib/Config/Config.js} +0 -0
  137. /package/{Error → lib/Error}/AppError.d.ts +0 -0
  138. /package/{Error → lib/Error}/AppError.js +0 -0
  139. /package/{Factory → lib/Factory}/CommandFactory.js +0 -0
  140. /package/{Factory → lib/Factory}/RepositoryFactory.js +0 -0
  141. /package/{Factory → lib/Factory}/TaskFactory.js +0 -0
  142. /package/{Repository → lib/Repository}/RepositoryAbstract.js +0 -0
  143. /package/{Task → lib/Task}/TaskAbstract.js +0 -0
  144. /package/{bin.d.ts → lib/bin.d.ts} +0 -0
  145. /package/{bin.js → lib/bin.js} +0 -0
  146. /package/{cli.js → lib/cli.js} +0 -0
  147. /package/{globalData.d.ts → lib/globalData.d.ts} +0 -0
  148. /package/{globalData.js → lib/globalData.js} +0 -0
  149. /package/{pkg.d.ts → lib/pkg.d.ts} +0 -0
  150. /package/{pkg.js → lib/pkg.js} +0 -0
  151. /package/{utils → lib/utils}/DataFormat.js +0 -0
  152. /package/{utils → lib/utils}/Git.js +0 -0
  153. /package/{utils → lib/utils}/Restic.js +0 -0
  154. /package/{utils → lib/utils}/async.d.ts +0 -0
  155. /package/{utils → lib/utils}/async.js +0 -0
  156. /package/{utils → lib/utils}/bytes.d.ts +0 -0
  157. /package/{utils → lib/utils}/bytes.js +0 -0
  158. /package/{utils → lib/utils}/cli.d.ts +0 -0
  159. /package/{utils → lib/utils}/cli.js +0 -0
  160. /package/{utils → lib/utils}/crypto.d.ts +0 -0
  161. /package/{utils → lib/utils}/crypto.js +0 -0
  162. /package/{utils → lib/utils}/datatruck/client.d.ts +0 -0
  163. /package/{utils → lib/utils}/datatruck/client.js +0 -0
  164. /package/{utils → lib/utils}/datatruck/config.js +0 -0
  165. /package/{utils → lib/utils}/datatruck/cron-server.d.ts +0 -0
  166. /package/{utils → lib/utils}/datatruck/cron-server.js +0 -0
  167. /package/{utils → lib/utils}/datatruck/repository-server.js +0 -0
  168. /package/{utils → lib/utils}/datatruck/snapshot.js +0 -0
  169. /package/{utils → lib/utils}/date.js +0 -0
  170. /package/{utils → lib/utils}/exit.js +0 -0
  171. /package/{utils → lib/utils}/fs.d.ts +0 -0
  172. /package/{utils → lib/utils}/fs.js +0 -0
  173. /package/{utils → lib/utils}/http.d.ts +0 -0
  174. /package/{utils → lib/utils}/http.js +0 -0
  175. /package/{utils → lib/utils}/list.d.ts +0 -0
  176. /package/{utils → lib/utils}/list.js +0 -0
  177. /package/{utils → lib/utils}/math.d.ts +0 -0
  178. /package/{utils → lib/utils}/math.js +0 -0
  179. /package/{utils → lib/utils}/object.d.ts +0 -0
  180. /package/{utils → lib/utils}/object.js +0 -0
  181. /package/{utils → lib/utils}/process.js +0 -0
  182. /package/{utils → lib/utils}/progress.d.ts +0 -0
  183. /package/{utils → lib/utils}/progress.js +0 -0
  184. /package/{utils → lib/utils}/stream.d.ts +0 -0
  185. /package/{utils → lib/utils}/stream.js +0 -0
  186. /package/{utils → lib/utils}/temp.d.ts +0 -0
  187. /package/{utils → lib/utils}/temp.js +0 -0
  188. /package/{utils → lib/utils}/virtual-fs.d.ts +0 -0
  189. /package/{utils → lib/utils}/virtual-fs.js +0 -0
@@ -4,7 +4,10 @@
4
4
  import { SpawnOptions, ChildProcess, ChildProcessByStdio } from "child_process";
5
5
  import { ReadStream, WriteStream } from "fs";
6
6
  import { Readable, Writable } from "stream";
7
- export type ExecLogSettingsType = {
7
+ export type ProcessEnv = {
8
+ [name: string]: string | undefined;
9
+ };
10
+ export type ExecLogSettings = {
8
11
  colorize?: boolean;
9
12
  exec?: boolean;
10
13
  stdout?: boolean;
@@ -29,7 +32,7 @@ export interface ExecSettingsInterface {
29
32
  } | {
30
33
  stream: Readable;
31
34
  };
32
- log?: ExecLogSettingsType | boolean;
35
+ log?: ExecLogSettings | boolean;
33
36
  onSpawn?: (p: ChildProcess) => void | undefined;
34
37
  stdout?: {
35
38
  save?: boolean;
@@ -42,7 +45,7 @@ export interface ExecSettingsInterface {
42
45
  onData?: (data: string) => void;
43
46
  toExitCode?: boolean;
44
47
  };
45
- onExitCodeError?: (data: ExecResultType, error: Error) => Error | false;
48
+ onExitCodeError?: (data: ExecResult, error: Error) => Error | false;
46
49
  }
47
50
  export declare function logExecStdout(input: {
48
51
  data: string;
@@ -51,7 +54,7 @@ export declare function logExecStdout(input: {
51
54
  lineSalt?: boolean;
52
55
  }): void;
53
56
  export declare function logExecStderr(data: string, colorize?: boolean): void;
54
- export type ExecResultType = {
57
+ export type ExecResult = {
55
58
  stdout: string;
56
59
  stderr: string;
57
60
  exitCode: number;
@@ -102,5 +105,5 @@ export declare function createProcess<O1 extends boolean, O2 extends boolean>(co
102
105
  } : {}) & (O2 extends true ? {
103
106
  stderr: string;
104
107
  } : {})>;
105
- export declare function exec(command: string, argv?: string[], options?: SpawnOptions | null, settings?: ExecSettingsInterface): Promise<ExecResultType>;
108
+ export declare function exec(command: string, argv?: string[], options?: SpawnOptions | null, settings?: ExecSettingsInterface): Promise<ExecResult>;
106
109
  export {};
@@ -0,0 +1,26 @@
1
+ export type TelegramStepConfig = {
2
+ bot: string;
3
+ chatId: number;
4
+ };
5
+ export type NtfyStepConfig = {
6
+ token: string;
7
+ topic?: string;
8
+ };
9
+ export type ReportStep = {
10
+ type: "telegram";
11
+ config: TelegramStepConfig;
12
+ } | {
13
+ type: "ntfy";
14
+ config: NtfyStepConfig;
15
+ };
16
+ export type ReportStepOptions = {
17
+ data: {
18
+ title: string;
19
+ message: string;
20
+ success: boolean;
21
+ };
22
+ };
23
+ export declare function isReportStep(step: {
24
+ type: string;
25
+ }): step is Pick<ReportStep, "type">;
26
+ export declare function runReportSteps(input: ReportStep[] | ReportStep, options: ReportStepOptions): Promise<void>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runReportSteps = exports.isReportStep = void 0;
4
+ const http_1 = require("./http");
5
+ function isReportStep(step) {
6
+ return step.type === "telegram" || step.type === "ntfy";
7
+ }
8
+ exports.isReportStep = isReportStep;
9
+ async function runReportSteps(input, options) {
10
+ const steps = Array.isArray(input) ? input : [input];
11
+ for (const step of steps) {
12
+ if (step.type === "telegram") {
13
+ await (0, http_1.post)(`https://api.telegram.org/bot${step.config.bot}/sendMessage`, JSON.stringify({
14
+ chat_id: step.config.chatId.toString(),
15
+ text: options.data.message,
16
+ disable_notification: options.data.success ? false : true,
17
+ }), {
18
+ headers: {
19
+ "Content-Type": "application/json",
20
+ },
21
+ });
22
+ }
23
+ else if (step.type === "ntfy") {
24
+ const topic = [step.config.token, step.config.topic]
25
+ .filter(Boolean)
26
+ .join("-");
27
+ if (topic.length < 32)
28
+ throw new Error(`Topic is less than 32 characters: ${topic}`);
29
+ await (0, http_1.post)(`https://ntfy.sh/${topic}`, options.data.message, {
30
+ headers: {
31
+ Title: options.data.title,
32
+ Priority: options.data.success ? "default" : "high",
33
+ },
34
+ });
35
+ }
36
+ else {
37
+ throw new Error(`Invalid step type: ${step.type}`);
38
+ }
39
+ }
40
+ }
41
+ exports.runReportSteps = runReportSteps;
@@ -0,0 +1,36 @@
1
+ import { ProcessEnv } from "./process";
2
+ export type SpawnData = {
3
+ [name: string]: any;
4
+ };
5
+ export type CommonSpawnStepConfig = {
6
+ env?: ProcessEnv;
7
+ data?: SpawnData;
8
+ args?: (string | number)[];
9
+ };
10
+ export type ProcessStepConfig = CommonSpawnStepConfig & {
11
+ command: string;
12
+ };
13
+ export type NodeStepConfig = CommonSpawnStepConfig & {
14
+ code: string | string[];
15
+ };
16
+ export type ProcessStepConfigItem = {
17
+ type: "process";
18
+ config: ProcessStepConfig;
19
+ };
20
+ export type NodeStepConfigItem = {
21
+ type: "node";
22
+ config: NodeStepConfig;
23
+ };
24
+ export type SpawnStep = ProcessStepConfigItem | NodeStepConfigItem;
25
+ export type SpawnStepOptions<TData extends Record<string, any>> = {
26
+ env?: ProcessEnv;
27
+ data?: TData;
28
+ cwd?: string;
29
+ tempDir?: () => Promise<string>;
30
+ onLine?: (p: string) => any;
31
+ verbose?: boolean;
32
+ };
33
+ export declare function isSpawnStep(step: {
34
+ type: string;
35
+ }): step is Pick<SpawnStep, "type">;
36
+ export declare function runSpawnSteps<TData extends Record<string, any>>(input: SpawnStep[] | SpawnStep, options: SpawnStepOptions<TData>): Promise<void>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runSpawnSteps = exports.isSpawnStep = void 0;
4
+ const process_1 = require("./process");
5
+ const string_1 = require("./string");
6
+ const temp_1 = require("./temp");
7
+ const promises_1 = require("fs/promises");
8
+ const path_1 = require("path");
9
+ async function writeNodeScript(options) {
10
+ let tempDir;
11
+ if (options?.tempDir) {
12
+ tempDir = await options.tempDir();
13
+ }
14
+ else {
15
+ tempDir = await (0, temp_1.mkTmpDir)("node-step");
16
+ }
17
+ const scriptPath = (0, path_1.join)(tempDir, "script.js");
18
+ const data = options.data || {};
19
+ const keys = Object.keys(data);
20
+ const json = JSON.stringify(data);
21
+ const code = Array.isArray(options.code)
22
+ ? [...options.code].join(";\n")
23
+ : options.code;
24
+ await (0, promises_1.writeFile)(scriptPath, `(async function({ ${keys} }) {\n${code};\n})(${json});`);
25
+ return scriptPath;
26
+ }
27
+ function isSpawnStep(step) {
28
+ return step.type === "process" || step.type === "node";
29
+ }
30
+ exports.isSpawnStep = isSpawnStep;
31
+ async function runSpawnSteps(input, options) {
32
+ const steps = Array.isArray(input) ? input : [input];
33
+ for (const step of steps) {
34
+ if (step.type === "process" || step.type === "node") {
35
+ const command = step.type === "process" ? step.config.command : "node";
36
+ const data = {
37
+ ...step.config.data,
38
+ ...options.data,
39
+ };
40
+ const args = [
41
+ ...(step.type === "node"
42
+ ? [
43
+ await writeNodeScript({
44
+ code: step.config.code,
45
+ tempDir: options.tempDir,
46
+ data,
47
+ }),
48
+ ]
49
+ : []),
50
+ ...(step.config.args || []).map((arg) => (0, string_1.render)(arg.toString(), data)),
51
+ ];
52
+ await (0, process_1.exec)(command, args, {
53
+ cwd: options.cwd,
54
+ env: {
55
+ ...process.env,
56
+ ...options.env,
57
+ ...step.config.env,
58
+ },
59
+ }, {
60
+ log: options.verbose,
61
+ ...(options.onLine && {
62
+ stdout: {
63
+ parseLines: "skip-empty",
64
+ onData: (line) => options.onLine(line),
65
+ },
66
+ }),
67
+ });
68
+ }
69
+ else {
70
+ throw new Error(`Invalid step type: ${step.type}`);
71
+ }
72
+ }
73
+ }
74
+ exports.runSpawnSteps = runSpawnSteps;
@@ -1,8 +1,8 @@
1
1
  export declare function snakeCase(value: string, char?: string): string;
2
- export declare function render(subject: string, vars: Record<string, string | undefined>): string;
2
+ export declare function render(subject: string, data: Record<string, string | undefined>): string;
3
3
  type NoInfer<T> = [T][T extends any ? 0 : never];
4
4
  export declare function parseStringList<T>(value: string | undefined, validValues?: T[], defaultsValues?: NoInfer<T>[] | true): T[];
5
- export type UriType = {
5
+ export type Uri = {
6
6
  protocol?: "http" | "https";
7
7
  host?: string;
8
8
  username?: string;
@@ -10,7 +10,7 @@ export type UriType = {
10
10
  port?: number;
11
11
  path?: string;
12
12
  };
13
- export declare function formatUri(input: UriType, hidePassword?: boolean): string;
13
+ export declare function formatUri(input: Uri, hidePassword?: boolean): string;
14
14
  export declare function makePathPatterns(values: string[] | undefined): string[] | undefined;
15
15
  export declare function match(path: string, include?: string[], exclude?: string[]): boolean;
16
16
  export declare function endsWith(input: string, patterns: string[]): boolean;
@@ -7,7 +7,7 @@ function snakeCase(value, char = "_") {
7
7
  return value.replace(/[A-Z]/g, (letter) => `${char}${letter.toLowerCase()}`);
8
8
  }
9
9
  exports.snakeCase = snakeCase;
10
- function render(subject, vars) {
10
+ function render(subject, data) {
11
11
  return subject.replace(/{([\w\./]*)}/g, function (match, name) {
12
12
  if (!name.length) {
13
13
  return "{";
@@ -15,7 +15,7 @@ function render(subject, vars) {
15
15
  else if (name === "/") {
16
16
  return "}";
17
17
  }
18
- let ref = vars;
18
+ let ref = data;
19
19
  for (const key of name.split(".")) {
20
20
  if (!!ref && typeof ref === "object") {
21
21
  ref = ref[key];
@@ -30,7 +30,7 @@ function render(subject, vars) {
30
30
  typeof ref !== "boolean")
31
31
  throw new Error(`Variable is not valid: ${name}`, {
32
32
  cause: {
33
- vars,
33
+ data,
34
34
  value: ref,
35
35
  },
36
36
  });
@@ -1,5 +1,4 @@
1
1
  import { BasicProgress } from "./progress";
2
- import type { JSONSchema7 } from "json-schema";
3
2
  export type TarEntry = {
4
3
  path: string;
5
4
  progress: BasicProgress;
@@ -9,15 +8,9 @@ export type CoresOptions = number | {
9
8
  };
10
9
  export type CompressOptions = {
11
10
  level?: number;
12
- /**
13
- * @default {percent:50}
14
- */
15
11
  cores?: CoresOptions;
16
12
  };
17
13
  export type DecompressOptions = {
18
- /**
19
- * @default {percent:50}
20
- */
21
14
  cores?: CoresOptions;
22
15
  };
23
16
  export type CreateTarOptions = {
@@ -39,7 +32,6 @@ export interface ExtractOptions {
39
32
  total?: number;
40
33
  onEntry?: (entry: TarEntry) => void;
41
34
  }
42
- export declare const compressDefinition: JSONSchema7;
43
35
  export type TarVendor = "busybox" | "bsdtar" | "gnu";
44
36
  export declare function getTarVendor(cache?: boolean, log?: boolean): Promise<TarVendor | null>;
45
37
  export type ListTarOptions = {
@@ -1,29 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractTar = exports.normalizeTarPath = exports.createTar = exports.checkPigzLib = exports.listTar = exports.getTarVendor = exports.compressDefinition = void 0;
3
+ exports.extractTar = exports.normalizeTarPath = exports.createTar = exports.checkPigzLib = exports.listTar = exports.getTarVendor = void 0;
4
4
  const cli_1 = require("./cli");
5
5
  const fs_1 = require("./fs");
6
6
  const math_1 = require("./math");
7
7
  const process_1 = require("./process");
8
8
  const promises_1 = require("fs/promises");
9
9
  const os_1 = require("os");
10
- exports.compressDefinition = {
11
- type: "object",
12
- additionalProperties: false,
13
- properties: {
14
- level: { type: "integer" },
15
- cores: {
16
- anyOf: [
17
- { type: "integer" },
18
- {
19
- type: "object",
20
- required: ["percent"],
21
- properties: { percent: { type: "integer" } },
22
- },
23
- ],
24
- },
25
- },
26
- };
27
10
  let tarVendor;
28
11
  async function getTarVendor(cache = true, log = false) {
29
12
  if (cache && typeof tarVendor !== "undefined")
package/package.json CHANGED
@@ -1,28 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.32.1",
4
- "dependencies": {
5
- "@supercharge/promise-pool": "^3.1.0",
6
- "ajv": "^8.12.0",
7
- "async": "^3.2.4",
8
- "chalk": "^4.1.2",
9
- "commander": "^11.0.0",
10
- "croner": "^7.0.4",
11
- "dayjs": "^1.11.10",
12
- "fast-folder-size": "^2.2.0",
13
- "fast-glob": "^3.3.1",
14
- "listr2": "^7.0.1",
15
- "micromatch": "^4.0.5",
16
- "mysql2": "^3.6.1",
17
- "tty-table": "^4.2.2",
18
- "yaml": "^2.3.2"
19
- },
20
- "optionalDependencies": {
21
- "ts-node": "^10.9.1"
22
- },
23
- "engine": {
24
- "node": ">=16.0.0"
25
- },
3
+ "version": "0.32.3",
26
4
  "description": "Tool for creating and managing backups",
27
5
  "homepage": "https://github.com/swordev/datatruck#readme",
28
6
  "bugs": {
@@ -38,8 +16,44 @@
38
16
  "email": "juanrgm724@gmail.com",
39
17
  "url": "https://github.com/juanrgm"
40
18
  },
19
+ "main": "lib/index.js",
41
20
  "bin": {
42
- "datatruck": "bin.js",
43
- "dtt": "bin.js"
21
+ "datatruck": "lib/bin.js",
22
+ "dtt": "lib/bin.js"
23
+ },
24
+ "files": [
25
+ "lib",
26
+ "config.schema.json"
27
+ ],
28
+ "dependencies": {
29
+ "@supercharge/promise-pool": "^3.1.0",
30
+ "ajv": "^8.12.0",
31
+ "async": "^3.2.5",
32
+ "chalk": "^4.1.2",
33
+ "commander": "^11.1.0",
34
+ "croner": "^7.0.5",
35
+ "dayjs": "^1.11.10",
36
+ "fast-folder-size": "^2.2.0",
37
+ "fast-glob": "^3.3.2",
38
+ "listr2": "^8.0.0",
39
+ "micromatch": "^4.0.5",
40
+ "mysql2": "^3.6.5",
41
+ "tty-table": "^4.2.3",
42
+ "yaml": "^2.3.4"
43
+ },
44
+ "devDependencies": {
45
+ "@types/async": "^3.2.24",
46
+ "@types/micromatch": "^4.0.6"
47
+ },
48
+ "optionalDependencies": {
49
+ "ts-node": "^10.9.1"
50
+ },
51
+ "engine": {
52
+ "node": ">=20.0.0"
53
+ },
54
+ "scripts": {
55
+ "build": "tsc -b tsconfig.build.json",
56
+ "clean": "tsc -b tsconfig.build.json --clean",
57
+ "watch": "tsc -b tsconfig.build.json -w"
44
58
  }
45
59
  }