@datatruck/cli 0.17.0 → 0.17.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.
Files changed (101) hide show
  1. package/Action/BackupAction.d.ts +1 -1
  2. package/Action/BackupAction.js +14 -14
  3. package/Action/BackupSessionsAction.d.ts +1 -1
  4. package/Action/CleanCacheAction.d.ts +1 -1
  5. package/Action/CleanCacheAction.js +3 -3
  6. package/Action/ConfigAction.d.ts +1 -1
  7. package/Action/ConfigAction.js +5 -5
  8. package/Action/InitAction.d.ts +1 -1
  9. package/Action/InitAction.js +2 -2
  10. package/Action/PruneAction.d.ts +1 -1
  11. package/Action/PruneAction.js +4 -4
  12. package/Action/RestoreAction.d.ts +1 -1
  13. package/Action/RestoreAction.js +18 -18
  14. package/Action/RestoreSessionsAction.d.ts +1 -1
  15. package/Action/SnapshotsAction.d.ts +1 -1
  16. package/Action/SnapshotsAction.js +4 -4
  17. package/Command/BackupCommand.d.ts +2 -2
  18. package/Command/BackupCommand.js +6 -6
  19. package/Command/BackupSessionsCommand.d.ts +2 -2
  20. package/Command/BackupSessionsCommand.js +9 -9
  21. package/Command/CleanCacheCommand.d.ts +1 -1
  22. package/Command/CleanCacheCommand.js +2 -2
  23. package/Command/CommandAbstract.d.ts +3 -3
  24. package/Command/CommandAbstract.js +2 -2
  25. package/Command/ConfigCommand.d.ts +2 -2
  26. package/Command/ConfigCommand.js +8 -8
  27. package/Command/InitCommand.d.ts +2 -2
  28. package/Command/InitCommand.js +9 -9
  29. package/Command/PruneCommand.d.ts +2 -2
  30. package/Command/PruneCommand.js +10 -10
  31. package/Command/RestoreCommand.d.ts +2 -2
  32. package/Command/RestoreCommand.js +6 -6
  33. package/Command/RestoreSessionsCommand.d.ts +2 -2
  34. package/Command/RestoreSessionsCommand.js +9 -9
  35. package/Command/SnapshotsCommand.d.ts +2 -2
  36. package/Command/SnapshotsCommand.js +9 -9
  37. package/Entity/StateEntityAbstract.d.ts +1 -1
  38. package/Repository/DatatruckRepository.d.ts +1 -1
  39. package/Repository/DatatruckRepository.js +56 -52
  40. package/Repository/GitRepository.js +23 -23
  41. package/Repository/RepositoryAbstract.d.ts +1 -1
  42. package/Repository/RepositoryAbstract.js +2 -2
  43. package/Repository/ResticRepository.d.ts +1 -1
  44. package/Repository/ResticRepository.js +27 -27
  45. package/SessionDriver/ConsoleSessionDriver.d.ts +1 -1
  46. package/SessionDriver/ConsoleSessionDriver.js +10 -10
  47. package/SessionDriver/SqliteSessionDriver.js +12 -12
  48. package/SessionManager/BackupSessionManager.d.ts +2 -2
  49. package/SessionManager/BackupSessionManager.js +1 -1
  50. package/SessionManager/RestoreSessionManager.d.ts +2 -2
  51. package/SessionManager/RestoreSessionManager.js +1 -1
  52. package/Task/GitTask.js +21 -21
  53. package/Task/MariadbTask.js +11 -11
  54. package/Task/MssqlTask.js +8 -8
  55. package/Task/MysqlDumpTask.d.ts +1 -1
  56. package/Task/MysqlDumpTask.js +13 -13
  57. package/Task/PostgresqlDumpTask.d.ts +1 -1
  58. package/Task/PostgresqlDumpTask.js +4 -4
  59. package/Task/ScriptTask.js +7 -7
  60. package/Task/SqlDumpTaskAbstract.d.ts +1 -1
  61. package/Task/SqlDumpTaskAbstract.js +12 -12
  62. package/Task/TaskAbstract.d.ts +1 -1
  63. package/Task/TaskAbstract.js +2 -2
  64. package/cli.js +11 -11
  65. package/package.json +1 -1
  66. package/{util → utils}/DataFormat.d.ts +0 -0
  67. package/{util → utils}/DataFormat.js +5 -1
  68. package/{util/GitUtil.d.ts → utils/Git.d.ts} +8 -8
  69. package/{util/GitUtil.js → utils/Git.js} +8 -8
  70. package/{util → utils}/ObjectVault.d.ts +0 -0
  71. package/{util → utils}/ObjectVault.js +0 -0
  72. package/{util/ResticUtil.d.ts → utils/Restic.d.ts} +3 -3
  73. package/{util/ResticUtil.js → utils/Restic.js} +9 -9
  74. package/{util/cli-util.d.ts → utils/cli.d.ts} +0 -0
  75. package/{util/cli-util.js → utils/cli.js} +0 -0
  76. package/{util/datatruck/config-util.d.ts → utils/datatruck/config.d.ts} +0 -0
  77. package/{util/datatruck/config-util.js → utils/datatruck/config.js} +10 -10
  78. package/{util/datatruck/paths-util.d.ts → utils/datatruck/paths.d.ts} +0 -0
  79. package/{util/datatruck/paths-util.js → utils/datatruck/paths.js} +2 -2
  80. package/{util/datatruck/snapshot-util.d.ts → utils/datatruck/snapshot.d.ts} +1 -1
  81. package/{util/datatruck/snapshot-util.js → utils/datatruck/snapshot.js} +4 -4
  82. package/{util/date-util.d.ts → utils/date.d.ts} +0 -0
  83. package/{util/date-util.js → utils/date.js} +2 -2
  84. package/{util/entity-util.d.ts → utils/entity.d.ts} +0 -0
  85. package/{util/entity-util.js → utils/entity.js} +0 -0
  86. package/{util/fs-util.d.ts → utils/fs.d.ts} +0 -0
  87. package/{util/fs-util.js → utils/fs.js} +17 -17
  88. package/{util/math-util.d.ts → utils/math.d.ts} +0 -0
  89. package/{util/math-util.js → utils/math.js} +0 -0
  90. package/{util/object-util.d.ts → utils/object.d.ts} +0 -0
  91. package/{util/object-util.js → utils/object.js} +0 -0
  92. package/{util/path-util.d.ts → utils/path.d.ts} +0 -0
  93. package/{util/path-util.js → utils/path.js} +0 -0
  94. package/{util/process-util.d.ts → utils/process.d.ts} +0 -0
  95. package/{util/process-util.js → utils/process.js} +13 -13
  96. package/{util → utils}/progress.d.ts +0 -0
  97. package/{util → utils}/progress.js +0 -0
  98. package/{util/string-util.d.ts → utils/string.d.ts} +0 -0
  99. package/{util/string-util.js → utils/string.js} +0 -0
  100. package/{util/zip-util.d.ts → utils/zip.d.ts} +0 -0
  101. package/{util/zip-util.js → utils/zip.js} +5 -5
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.onExit = exports.exec = exports.logExecStderr = exports.logExecStdout = void 0;
7
- const cli_util_1 = require("./cli-util");
8
- const fs_util_1 = require("./fs-util");
9
- const math_util_1 = require("./math-util");
7
+ const cli_1 = require("./cli");
8
+ const fs_1 = require("./fs");
9
+ const math_1 = require("./math");
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  const child_process_1 = require("child_process");
12
- const fs_1 = require("fs");
12
+ const fs_2 = require("fs");
13
13
  const promises_1 = require("fs/promises");
14
14
  const readline_1 = require("readline");
15
15
  function logExecStdout(input) {
@@ -40,17 +40,17 @@ async function exec(command, argv = [], options = null, settings = {}) {
40
40
  env[key] = value;
41
41
  return env;
42
42
  }, {});
43
- (0, cli_util_1.logExec)(command, pipe
43
+ (0, cli_1.logExec)(command, pipe
44
44
  ? [
45
45
  ...argv,
46
- pipe.stream instanceof fs_1.ReadStream ? "<" : ">",
46
+ pipe.stream instanceof fs_2.ReadStream ? "<" : ">",
47
47
  String(pipe.stream.path),
48
48
  ]
49
49
  : argv, logEnv, log.allToStderr);
50
50
  }
51
- if (typeof options?.cwd === "string" && !(await (0, fs_util_1.checkDir)(options.cwd)))
51
+ if (typeof options?.cwd === "string" && !(await (0, fs_1.checkDir)(options.cwd)))
52
52
  return reject(new Error(`Current working directory does not exist: ${options.cwd}`));
53
- if (pipe?.onReadProgress && pipe.stream instanceof fs_1.ReadStream) {
53
+ if (pipe?.onReadProgress && pipe.stream instanceof fs_2.ReadStream) {
54
54
  const fileInfo = await (0, promises_1.stat)(pipe.stream.path);
55
55
  const totalBytes = fileInfo.size;
56
56
  let currentBytes = 0;
@@ -59,7 +59,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
59
59
  pipe.onReadProgress?.({
60
60
  totalBytes: totalBytes,
61
61
  currentBytes: currentBytes,
62
- progress: (0, math_util_1.progressPercent)(totalBytes, currentBytes),
62
+ progress: (0, math_1.progressPercent)(totalBytes, currentBytes),
63
63
  });
64
64
  });
65
65
  }
@@ -72,7 +72,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
72
72
  exitCode: 0,
73
73
  };
74
74
  let finishListeners = 1;
75
- if (pipe?.stream instanceof fs_1.WriteStream)
75
+ if (pipe?.stream instanceof fs_2.WriteStream)
76
76
  finishListeners++;
77
77
  if (settings.stdout?.parseLines)
78
78
  finishListeners++;
@@ -116,7 +116,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
116
116
  streamError = error;
117
117
  tryFinish();
118
118
  });
119
- if (pipe.stream instanceof fs_1.WriteStream) {
119
+ if (pipe.stream instanceof fs_2.WriteStream) {
120
120
  if (!p.stdout)
121
121
  throw new Error(`stdout is not defined`);
122
122
  if (!p.stderr)
@@ -136,7 +136,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
136
136
  p.stderr.pipe(pipe.stream, { end: false });
137
137
  p.on("close", tryFinish);
138
138
  }
139
- else if (pipe.stream instanceof fs_1.ReadStream) {
139
+ else if (pipe.stream instanceof fs_2.ReadStream) {
140
140
  if (!p.stdin)
141
141
  throw new Error(`stdin is not defined`);
142
142
  pipe.stream.pipe(p.stdin);
@@ -187,7 +187,7 @@ async function exec(command, argv = [], options = null, settings = {}) {
187
187
  }
188
188
  p.on("error", (error) => (spawnError = error)).on("close", (exitCode) => {
189
189
  spawnData.exitCode = exitCode ?? 0;
190
- if (pipe?.stream instanceof fs_1.WriteStream)
190
+ if (pipe?.stream instanceof fs_2.WriteStream)
191
191
  pipe.stream.end();
192
192
  tryFinish();
193
193
  });
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unzip = exports.zip = exports.listZip = exports.checkSSEOption = exports.buildArguments = void 0;
4
- const process_util_1 = require("./process-util");
4
+ const process_1 = require("./process");
5
5
  const path_1 = require("path");
6
6
  function buildArguments(filters) {
7
7
  const args = [];
@@ -32,7 +32,7 @@ function buildArguments(filters) {
32
32
  exports.buildArguments = buildArguments;
33
33
  let checkSSEOptionResult;
34
34
  async function checkSSEOption(command = "7z") {
35
- const result = await (0, process_util_1.exec)(command, [], {}, {
35
+ const result = await (0, process_1.exec)(command, [], {}, {
36
36
  stdout: {
37
37
  save: true,
38
38
  },
@@ -68,7 +68,7 @@ function parseListZipLine(line, buffer) {
68
68
  }
69
69
  async function listZip(data) {
70
70
  const buffer = {};
71
- await (0, process_util_1.exec)(data.command ?? "7z", ["l", data.path, "-slt"], {}, {
71
+ await (0, process_1.exec)(data.command ?? "7z", ["l", data.path, "-slt"], {}, {
72
72
  log: {
73
73
  exec: data.verbose ?? false,
74
74
  stderr: data.verbose ?? false,
@@ -124,7 +124,7 @@ async function zip(data) {
124
124
  total: 0,
125
125
  type: "start",
126
126
  });
127
- await (0, process_util_1.exec)(data.command ?? "7z", [
127
+ await (0, process_1.exec)(data.command ?? "7z", [
128
128
  "a",
129
129
  // https://sourceforge.net/p/sevenzip/bugs/2099/,
130
130
  // https://github.com/mcmilk/7-Zip/commit/87ba6f01ba3c5b2ce3186bddfe3d7d880639193c#diff-779d6b1bfa6196b288478f78ca96c4d4c6d7ac6cf8be15a28a20dabc9137ca36L515
@@ -192,7 +192,7 @@ async function unzip(data) {
192
192
  percent: 0,
193
193
  type: "start",
194
194
  });
195
- const result = await (0, process_util_1.exec)(data.command ?? "7z", [
195
+ const result = await (0, process_1.exec)(data.command ?? "7z", [
196
196
  "x",
197
197
  "-bsp1",
198
198
  (0, path_1.normalize)(data.input),