@datatruck/cli 0.34.1 → 0.34.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 (34) hide show
  1. package/config.schema.json +337 -72
  2. package/lib/actions/BackupAction.d.ts +4 -4
  3. package/lib/actions/BackupAction.js +2 -2
  4. package/lib/actions/CopyAction.d.ts +3 -3
  5. package/lib/actions/CopyAction.js +2 -2
  6. package/lib/actions/RestoreAction.d.ts +4 -4
  7. package/lib/actions/RestoreAction.js +5 -5
  8. package/lib/commands/CleanCacheCommand.js +2 -2
  9. package/lib/commands/CommandAbstract.d.ts +4 -4
  10. package/lib/commands/CommandAbstract.js +1 -1
  11. package/lib/commands/ConfigCommand.js +2 -2
  12. package/lib/commands/InitCommand.js +2 -2
  13. package/lib/commands/PruneCommand.js +2 -2
  14. package/lib/commands/SnapshotsCommand.js +2 -2
  15. package/lib/repositories/GitRepository.js +6 -6
  16. package/lib/repositories/ResticRepository.d.ts +1 -1
  17. package/lib/repositories/ResticRepository.js +9 -9
  18. package/lib/tasks/GitTask.js +2 -1
  19. package/lib/utils/async-process.js +18 -13
  20. package/lib/utils/{DataFormat.d.ts → data-format.d.ts} +4 -4
  21. package/lib/utils/{DataFormat.js → data-format.js} +1 -1
  22. package/lib/utils/datatruck/command.d.ts +2 -2
  23. package/lib/utils/datatruck/config-type.d.ts +1 -1
  24. package/lib/utils/fs.d.ts +0 -6
  25. package/lib/utils/fs.js +3 -9
  26. package/lib/utils/list.d.ts +4 -4
  27. package/lib/utils/list.js +1 -1
  28. package/lib/utils/stream.d.ts +8 -2
  29. package/lib/utils/stream.js +10 -3
  30. package/package.json +2 -2
  31. /package/lib/utils/{Git.d.ts → git.d.ts} +0 -0
  32. /package/lib/utils/{Git.js → git.js} +0 -0
  33. /package/lib/utils/{Restic.d.ts → restic.d.ts} +0 -0
  34. /package/lib/utils/{Restic.js → restic.js} +0 -0
package/lib/utils/fs.js CHANGED
@@ -3,10 +3,11 @@ 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.asFile = exports.groupFiles = exports.ensureFreeDiskSpace = exports.checkFreeDiskSpace = exports.fetchDiskStats = exports.initEmptyDir = exports.tryRm = exports.safeRename = exports.fetchData = exports.countFileLines = exports.createWriteStreamPool = exports.createFileScanner = exports.createProgress = exports.cpy = exports.readTextFile = exports.isNotFoundError = exports.updateFileStats = exports.copyFileWithStreams = exports.waitForClose = exports.writeGitIgnoreList = exports.fastglobToGitIgnore = exports.forEachFile = exports.readDir = exports.readPartialFile = exports.fastFolderSizeAsync = exports.findFile = exports.parsePackageFile = exports.parseFile = exports.include = exports.parseFileExtensions = exports.writeJSONFile = exports.existsFile = exports.existsDir = exports.safeStat = exports.ensureExistsDir = exports.ensureSingleFile = exports.ensureEmptyDir = exports.mkdirIfNotExists = exports.isLocalDir = exports.isEmptyDir = exports.isWSLSystem = void 0;
6
+ exports.asFile = exports.groupFiles = exports.ensureFreeDiskSpace = exports.checkFreeDiskSpace = exports.fetchDiskStats = exports.initEmptyDir = exports.tryRm = exports.safeRename = exports.fetchData = exports.countFileLines = exports.createWriteStreamPool = exports.createFileScanner = exports.createProgress = exports.cpy = exports.readTextFile = exports.isNotFoundError = exports.updateFileStats = exports.copyFileWithStreams = exports.writeGitIgnoreList = exports.fastglobToGitIgnore = exports.forEachFile = exports.readDir = exports.readPartialFile = exports.fastFolderSizeAsync = exports.findFile = exports.parsePackageFile = exports.parseFile = exports.include = exports.parseFileExtensions = exports.writeJSONFile = exports.existsFile = exports.existsDir = exports.safeStat = exports.ensureExistsDir = exports.ensureSingleFile = exports.ensureEmptyDir = exports.mkdirIfNotExists = exports.isLocalDir = exports.isEmptyDir = exports.isWSLSystem = void 0;
7
7
  const pkg_1 = require("../pkg");
8
8
  const bytes_1 = require("./bytes");
9
9
  const math_1 = require("./math");
10
+ const stream_1 = require("./stream");
10
11
  const string_1 = require("./string");
11
12
  const temp_1 = require("./temp");
12
13
  const async_1 = require("async");
@@ -246,13 +247,6 @@ async function writeGitIgnoreList(options) {
246
247
  return path;
247
248
  }
248
249
  exports.writeGitIgnoreList = writeGitIgnoreList;
249
- async function waitForClose(stream) {
250
- return new Promise((resolve, reject) => {
251
- stream.on("close", resolve);
252
- stream.on("error", reject);
253
- });
254
- }
255
- exports.waitForClose = waitForClose;
256
250
  async function copyFileWithStreams(source, target) {
257
251
  const r = (0, fs_1.createReadStream)(source);
258
252
  const w = (0, fs_2.createWriteStream)(target);
@@ -519,7 +513,7 @@ function createWriteStreamPool(options) {
519
513
  }
520
514
  await Promise.all(items
521
515
  .filter((item) => !item.finished)
522
- .map((item) => waitForClose(item.stream)));
516
+ .map((item) => (0, stream_1.waitForClose)(item.stream)));
523
517
  },
524
518
  };
525
519
  }
@@ -1,10 +1,10 @@
1
1
  import { Timer } from "./date";
2
2
  import { ProgressManager } from "./progress";
3
- import { Streams } from "./stream";
3
+ import { StdStreams } from "./stream";
4
4
  import { Listr, ListrGetRendererClassFromValue, ListrLogger, ListrTask, ListrTaskWrapper } from "listr2";
5
5
  export declare class List3Logger<Levels extends string = string> extends ListrLogger<Levels> {
6
6
  constructor(options?: {
7
- streams?: Partial<Streams>;
7
+ streams?: Partial<StdStreams>;
8
8
  });
9
9
  }
10
10
  export type Listr3Context = Record<string, Record<string, any>>;
@@ -41,7 +41,7 @@ export type Listr3TaskResult<T extends Listr3Context> = {
41
41
  export type Listr3TaskResultEnd<T extends Listr3Context> = Listr3TaskResult<T> | List3SummaryResult;
42
42
  export declare class Listr3<T extends Listr3Context> extends Listr<void, "default", "simple"> {
43
43
  readonly $options: {
44
- streams?: Streams;
44
+ streams?: StdStreams;
45
45
  progressManager?: ProgressManager;
46
46
  };
47
47
  readonly resultMap: Record<string, Listr3TaskResult<T>>;
@@ -49,7 +49,7 @@ export declare class Listr3<T extends Listr3Context> extends Listr<void, "defaul
49
49
  readonly logger: List3Logger;
50
50
  protected execTimer: Timer;
51
51
  constructor($options: {
52
- streams?: Streams;
52
+ streams?: StdStreams;
53
53
  progressManager?: ProgressManager;
54
54
  });
55
55
  private serializeKeyIndex;
package/lib/utils/list.js CHANGED
@@ -7,7 +7,7 @@ const stream_1 = require("./stream");
7
7
  const listr2_1 = require("listr2");
8
8
  class List3Logger extends listr2_1.ListrLogger {
9
9
  constructor(options = {}) {
10
- const streams = (0, stream_1.createStreams)(options.streams);
10
+ const streams = (0, stream_1.createStdStreams)(options.streams);
11
11
  super({
12
12
  processOutput: new listr2_1.ProcessOutput(streams.stdout, streams.stderr),
13
13
  });
@@ -1,7 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { Writable } from "stream";
3
- export type Streams = {
3
+ export type StdStreams = {
4
4
  stdout: Writable;
5
5
  stderr: Writable;
6
6
  };
7
- export declare function createStreams(options?: Partial<Streams>): Streams;
7
+ export declare function createStdStreams(options?: Partial<StdStreams>): StdStreams;
8
+ export declare function waitForClose(stream: {
9
+ on(event: "close", cb: (...args: any[]) => any): any;
10
+ } | {
11
+ on(event: "close", cb: (...args: any[]) => any): any;
12
+ on(event: "error", cb: (...args: any[]) => any): any;
13
+ }): Promise<void>;
@@ -1,10 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createStreams = void 0;
4
- function createStreams(options = {}) {
3
+ exports.waitForClose = exports.createStdStreams = void 0;
4
+ function createStdStreams(options = {}) {
5
5
  return {
6
6
  stdout: options.stdout ?? process.stdout,
7
7
  stderr: options.stderr ?? process.stderr,
8
8
  };
9
9
  }
10
- exports.createStreams = createStreams;
10
+ exports.createStdStreams = createStdStreams;
11
+ async function waitForClose(stream) {
12
+ return new Promise((resolve, reject) => {
13
+ stream.on("close", resolve);
14
+ stream.on("error", reject);
15
+ });
16
+ }
17
+ exports.waitForClose = waitForClose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.34.1",
3
+ "version": "0.34.3",
4
4
  "description": "Tool for creating and managing backups",
5
5
  "homepage": "https://github.com/swordev/datatruck#readme",
6
6
  "bugs": {
@@ -37,7 +37,7 @@
37
37
  "fast-glob": "^3.3.2",
38
38
  "listr2": "^8.0.1",
39
39
  "micromatch": "^4.0.5",
40
- "mysql2": "^3.6.5",
40
+ "mysql2": "^3.7.0",
41
41
  "tty-table": "^4.2.3",
42
42
  "yaml": "^2.3.4"
43
43
  },
File without changes
File without changes
File without changes
File without changes