@datatruck/cli 0.17.1 → 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 +10 -10
  65. package/package.json +1 -1
  66. package/{util → utils}/DataFormat.d.ts +0 -0
  67. package/{util → utils}/DataFormat.js +0 -0
  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
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SqlDumpTaskAbstract = exports.sqlDumpTaskDefinition = void 0;
4
4
  const AppError_1 = require("../Error/AppError");
5
5
  const DefinitionEnum_1 = require("../JsonSchema/DefinitionEnum");
6
- const cli_util_1 = require("../util/cli-util");
7
- const config_util_1 = require("../util/datatruck/config-util");
8
- const fs_util_1 = require("../util/fs-util");
9
- const math_util_1 = require("../util/math-util");
6
+ const cli_1 = require("../utils/cli");
7
+ const config_1 = require("../utils/datatruck/config");
8
+ const fs_1 = require("../utils/fs");
9
+ const math_1 = require("../utils/math");
10
10
  const TaskAbstract_1 = require("./TaskAbstract");
11
11
  const assert_1 = require("assert");
12
12
  const promises_1 = require("fs/promises");
@@ -114,7 +114,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
114
114
  return true;
115
115
  });
116
116
  (0, assert_1.ok)(typeof outputPath === "string");
117
- if (!(await (0, fs_util_1.checkDir)(outputPath)))
117
+ if (!(await (0, fs_1.checkDir)(outputPath)))
118
118
  await (0, promises_1.mkdir)(outputPath, { recursive: true });
119
119
  if (!this.config.oneFileByTable) {
120
120
  const outPath = (0, path_1.join)(outputPath, serializeSqlFile({ database: this.config.database }));
@@ -144,7 +144,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
144
144
  absolute: {
145
145
  total: tableNames.length,
146
146
  current: current,
147
- percent: (0, math_util_1.progressPercent)(tableNames.length, current),
147
+ percent: (0, math_1.progressPercent)(tableNames.length, current),
148
148
  },
149
149
  });
150
150
  const outPath = (0, path_1.join)(outputPath, serializeSqlFile({ table: tableName }));
@@ -159,7 +159,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
159
159
  absolute: {
160
160
  total: tableNames.length,
161
161
  current: current,
162
- percent: (0, math_util_1.progressPercent)(tableNames.length, current),
162
+ percent: (0, math_1.progressPercent)(tableNames.length, current),
163
163
  },
164
164
  });
165
165
  });
@@ -181,7 +181,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
181
181
  this.verbose = data.options.verbose;
182
182
  (0, assert_1.ok)(typeof restorePath === "string");
183
183
  const database = {
184
- name: (0, config_util_1.resolveDatabaseName)(this.config.database, {
184
+ name: (0, config_1.resolveDatabaseName)(this.config.database, {
185
185
  packageName: data.package.name,
186
186
  snapshotId: data.options.snapshotId,
187
187
  snapshotDate: data.snapshot.date,
@@ -190,7 +190,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
190
190
  }),
191
191
  };
192
192
  if (this.config.targetDatabase) {
193
- database.name = (0, config_util_1.resolveDatabaseName)(this.config.targetDatabase.name, {
193
+ database.name = (0, config_1.resolveDatabaseName)(this.config.targetDatabase.name, {
194
194
  packageName: data.package.name,
195
195
  snapshotId: data.options.snapshotId,
196
196
  snapshotDate: data.snapshot.date,
@@ -198,7 +198,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
198
198
  database: database.name,
199
199
  });
200
200
  }
201
- const items = (await (0, fs_util_1.readDir)(restorePath))
201
+ const items = (await (0, fs_1.readDir)(restorePath))
202
202
  .map(parseSqlFile)
203
203
  .filter((v) => !!v);
204
204
  // Database check
@@ -216,7 +216,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
216
216
  }
217
217
  await this.onCreateDatabase(database);
218
218
  if (this.verbose)
219
- (0, cli_util_1.logExec)("readdir", [restorePath]);
219
+ (0, cli_1.logExec)("readdir", [restorePath]);
220
220
  let current = 0;
221
221
  for (const item of items) {
222
222
  const path = (0, path_1.join)(restorePath, item.fileName);
@@ -228,7 +228,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
228
228
  absolute: {
229
229
  total: items.length,
230
230
  current: current,
231
- percent: (0, math_util_1.progressPercent)(items.length, current),
231
+ percent: (0, math_1.progressPercent)(items.length, current),
232
232
  },
233
233
  });
234
234
  await this.onImport(path, database.name);
@@ -2,7 +2,7 @@ import { BackupActionOptionsType } from "../Action/BackupAction";
2
2
  import { RestoreActionOptionsType } from "../Action/RestoreAction";
3
3
  import { PackageConfigType } from "../Config/PackageConfig";
4
4
  import { SnapshotType } from "../Repository/RepositoryAbstract";
5
- import { Progress } from "../util/progress";
5
+ import { Progress } from "../utils/progress";
6
6
  export type BackupDataType = {
7
7
  onProgress: (data: Progress) => Promise<void>;
8
8
  options: BackupActionOptionsType;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskAbstract = void 0;
4
- const fs_util_1 = require("../util/fs-util");
4
+ const fs_1 = require("../utils/fs");
5
5
  class TaskAbstract {
6
6
  constructor(config) {
7
7
  this.config = config;
8
8
  this.tmpDirs = [];
9
9
  }
10
10
  async mkTmpDir(prefix, id) {
11
- const dir = await (0, fs_util_1.mkTmpDir)(prefix, id);
11
+ const dir = await (0, fs_1.mkTmpDir)(prefix, id);
12
12
  this.tmpDirs.push(dir);
13
13
  return dir;
14
14
  }
package/cli.js CHANGED
@@ -8,13 +8,13 @@ const ConfigAction_1 = require("./Action/ConfigAction");
8
8
  const AppError_1 = require("./Error/AppError");
9
9
  const CommandFactory_1 = require("./Factory/CommandFactory");
10
10
  const globalData_1 = __importDefault(require("./globalData"));
11
- const cli_util_1 = require("./util/cli-util");
12
- const fs_util_1 = require("./util/fs-util");
13
- const process_util_1 = require("./util/process-util");
14
- const string_util_1 = require("./util/string-util");
11
+ const cli_1 = require("./utils/cli");
12
+ const fs_1 = require("./utils/fs");
13
+ const process_1 = require("./utils/process");
14
+ const string_1 = require("./utils/string");
15
15
  const chalk_1 = require("chalk");
16
16
  const commander_1 = require("commander");
17
- const fs_1 = require("fs");
17
+ const fs_2 = require("fs");
18
18
  const path_1 = require("path");
19
19
  function getGlobalOptions() {
20
20
  return program.opts();
@@ -72,7 +72,7 @@ function makeCommandAction(command) {
72
72
  };
73
73
  }
74
74
  const program = new commander_1.Command();
75
- const { version, description } = (0, fs_util_1.parsePackageFile)();
75
+ const { version, description } = (0, fs_1.parsePackageFile)();
76
76
  const cwd = process.cwd();
77
77
  program.name("datatruck");
78
78
  program.version(version);
@@ -94,7 +94,7 @@ makeCommand(CommandFactory_1.CommandEnum.restoreSessions).alias("rs");
94
94
  makeCommand(CommandFactory_1.CommandEnum.cleanCache).alias("cc");
95
95
  function buildArgs(input, options) {
96
96
  const optionsArray = Object.keys(options).flatMap((name) => [
97
- `--${(0, string_util_1.snakeCase)(name, "-")}`,
97
+ `--${(0, string_1.snakeCase)(name, "-")}`,
98
98
  options[name],
99
99
  ]);
100
100
  return [input, ...optionsArray];
@@ -103,16 +103,16 @@ exports.buildArgs = buildArgs;
103
103
  function parseArgs(args) {
104
104
  program.parse(args);
105
105
  const verbose = getGlobalOptions().verbose;
106
- (0, process_util_1.onExit)((eventName, error) => {
106
+ (0, process_1.onExit)((eventName, error) => {
107
107
  if (eventName !== "exit") {
108
- process.stdout.write(cli_util_1.showCursorCommand);
108
+ process.stdout.write(cli_1.showCursorCommand);
109
109
  console.info(`\nClosing... (reason: ${eventName})`);
110
110
  if (error instanceof Error)
111
111
  console.error((0, chalk_1.red)(error.stack));
112
112
  }
113
113
  if (!verbose)
114
114
  try {
115
- (0, fs_1.rmSync)((0, fs_util_1.sessionTmpDir)(), {
115
+ (0, fs_2.rmSync)((0, fs_1.sessionTmpDir)(), {
116
116
  force: true,
117
117
  recursive: true,
118
118
  maxRetries: 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "dependencies": {
5
5
  "ajv": "^8.11.2",
6
6
  "async": "^3.2.4",
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import { ExecSettingsInterface } from "./process-util";
2
- export declare class GitUtil {
1
+ import { ExecSettingsInterface } from "./process";
2
+ export declare class Git {
3
3
  readonly options: {
4
4
  dir: string;
5
5
  log?: boolean;
@@ -8,22 +8,22 @@ export declare class GitUtil {
8
8
  dir: string;
9
9
  log?: boolean;
10
10
  });
11
- exec(args: string[], settings?: ExecSettingsInterface, cwd?: boolean): Promise<import("./process-util").ExecResultType>;
11
+ exec(args: string[], settings?: ExecSettingsInterface, cwd?: boolean): Promise<import("./process").ExecResultType>;
12
12
  canBeInit(repo: string): Promise<boolean>;
13
13
  clone(options: {
14
14
  repo: string;
15
15
  branch?: string;
16
16
  orphan?: boolean;
17
- }): Promise<import("./process-util").ExecResultType>;
17
+ }): Promise<import("./process").ExecResultType>;
18
18
  checkout(options: {
19
19
  branchName: string;
20
20
  orphan?: boolean;
21
- }): Promise<import("./process-util").ExecResultType>;
21
+ }): Promise<import("./process").ExecResultType>;
22
22
  checkBranch(options: {
23
23
  name: string;
24
24
  repo?: string;
25
25
  }): Promise<boolean>;
26
- removeAll(): Promise<import("./process-util").ExecResultType>;
26
+ removeAll(): Promise<import("./process").ExecResultType>;
27
27
  haveChanges(): Promise<boolean>;
28
28
  fetchCommitId(tag: string): Promise<string>;
29
29
  getTags(names?: string[]): Promise<{
@@ -31,8 +31,8 @@ export declare class GitUtil {
31
31
  message?: string | undefined;
32
32
  }[]>;
33
33
  addTag(name: string, message?: string): Promise<void>;
34
- pushTags(): Promise<import("./process-util").ExecResultType>;
34
+ pushTags(): Promise<import("./process").ExecResultType>;
35
35
  push(options: {
36
36
  branchName: string;
37
- }): Promise<import("./process-util").ExecResultType>;
37
+ }): Promise<import("./process").ExecResultType>;
38
38
  }
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GitUtil = void 0;
4
- const fs_util_1 = require("./fs-util");
5
- const process_util_1 = require("./process-util");
6
- class GitUtil {
3
+ exports.Git = void 0;
4
+ const fs_1 = require("./fs");
5
+ const process_1 = require("./process");
6
+ class Git {
7
7
  constructor(options) {
8
8
  this.options = options;
9
9
  }
10
10
  async exec(args, settings, cwd) {
11
- return await (0, process_util_1.exec)("git", args, { cwd: cwd === false ? undefined : this.options.dir }, {
11
+ return await (0, process_1.exec)("git", args, { cwd: cwd === false ? undefined : this.options.dir }, {
12
12
  log: this.options.log,
13
13
  ...(settings ?? {}),
14
14
  });
15
15
  }
16
16
  async canBeInit(repo) {
17
- return ((0, fs_util_1.isLocalDir)(repo) &&
18
- (!(await (0, fs_util_1.checkDir)(repo)) || !(await (0, fs_util_1.readDir)(repo)).length));
17
+ return ((0, fs_1.isLocalDir)(repo) &&
18
+ (!(await (0, fs_1.checkDir)(repo)) || !(await (0, fs_1.readDir)(repo)).length));
19
19
  }
20
20
  async clone(options) {
21
21
  return await this.exec([
@@ -101,4 +101,4 @@ class GitUtil {
101
101
  ]);
102
102
  }
103
103
  }
104
- exports.GitUtil = GitUtil;
104
+ exports.Git = Git;
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import { ExecResultType, ExecSettingsInterface } from "./process-util";
2
- import { UriType } from "./string-util";
1
+ import { ExecResultType, ExecSettingsInterface } from "./process";
2
+ import { UriType } from "./string";
3
3
  export type RepositoryType = {
4
4
  name?: string;
5
5
  env?: Record<string, string>;
@@ -36,7 +36,7 @@ export type BackupStreamType = {
36
36
  total_duration: number;
37
37
  snapshot_id: string;
38
38
  };
39
- export declare class ResticUtil {
39
+ export declare class Restic {
40
40
  readonly options: {
41
41
  log?: boolean;
42
42
  env: Record<string, string>;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResticUtil = void 0;
4
- const fs_util_1 = require("./fs-util");
5
- const process_util_1 = require("./process-util");
6
- const string_util_1 = require("./string-util");
3
+ exports.Restic = void 0;
4
+ const fs_1 = require("./fs");
5
+ const process_1 = require("./process");
6
+ const string_1 = require("./string");
7
7
  const promises_1 = require("fs/promises");
8
8
  const path_1 = require("path");
9
- class ResticUtil {
9
+ class Restic {
10
10
  constructor(options) {
11
11
  this.options = options;
12
12
  }
@@ -24,10 +24,10 @@ class ResticUtil {
24
24
  : (await (0, promises_1.readFile)(input.password.path)).toString(),
25
25
  };
26
26
  }
27
- return `${input.backend}:${(0, string_util_1.formatUri)({ ...input, password: input.password }, hidePassword)}`;
27
+ return `${input.backend}:${(0, string_1.formatUri)({ ...input, password: input.password }, hidePassword)}`;
28
28
  }
29
29
  async exec(args, settings, options) {
30
- return await (0, process_util_1.exec)("restic", args, {
30
+ return await (0, process_1.exec)("restic", args, {
31
31
  stdio: ["ignore", "pipe", "pipe"],
32
32
  env: { ...process.env, ...this.options.env },
33
33
  cwd: options?.cwd,
@@ -185,7 +185,7 @@ class ResticUtil {
185
185
  const progressInterval = options.progressInterval ?? 30000;
186
186
  async function progressRutine() {
187
187
  try {
188
- const total_bytes = await (0, fs_util_1.fastFolderSizeAsync)(options.target);
188
+ const total_bytes = await (0, fs_1.fastFolderSizeAsync)(options.target);
189
189
  options.onStream?.({
190
190
  message_type: "restore-status",
191
191
  total_bytes,
@@ -219,4 +219,4 @@ class ResticUtil {
219
219
  }
220
220
  }
221
221
  }
222
- exports.ResticUtil = ResticUtil;
222
+ exports.Restic = Restic;
File without changes
File without changes
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.params = exports.dbNameParams = exports.pkgRestorePathParams = exports.pkgExcludeParams = exports.pkgIncludeParams = exports.pkgPathParams = exports.resolvePackages = exports.resolvePackage = exports.resolveDatabaseName = exports.resolvePackagePath = exports.filterPackages = exports.filterRepository = exports.findRepositoryOrFail = void 0;
4
4
  const AppError_1 = require("../../Error/AppError");
5
- const fs_util_1 = require("../fs-util");
6
- const string_util_1 = require("../string-util");
5
+ const fs_1 = require("../fs");
6
+ const string_1 = require("../string");
7
7
  const micromatch_1 = require("micromatch");
8
8
  function findRepositoryOrFail(config, repositoryName) {
9
9
  const repo = config.repositories.find((v) => v.name === repositoryName);
@@ -21,8 +21,8 @@ function filterRepository(repository, action) {
21
21
  }
22
22
  exports.filterRepository = filterRepository;
23
23
  function filterPackages(config, options) {
24
- const packagePatterns = (0, string_util_1.makePathPatterns)(options.packageNames);
25
- const taskNamePatterns = (0, string_util_1.makePathPatterns)(options.packageTaskNames);
24
+ const packagePatterns = (0, string_1.makePathPatterns)(options.packageNames);
25
+ const taskNamePatterns = (0, string_1.makePathPatterns)(options.packageTaskNames);
26
26
  return config.packages
27
27
  .map((pkg) => {
28
28
  pkg = Object.assign({}, pkg);
@@ -38,7 +38,7 @@ function filterPackages(config, options) {
38
38
  return pkg;
39
39
  })
40
40
  .filter((pkg) => {
41
- if (taskNamePatterns && !(0, string_util_1.checkMatch)(pkg.task?.name, taskNamePatterns))
41
+ if (taskNamePatterns && !(0, string_1.checkMatch)(pkg.task?.name, taskNamePatterns))
42
42
  return false;
43
43
  return ((typeof pkg.enabled !== "boolean" || pkg.enabled) &&
44
44
  !!pkg.repositoryNames?.length &&
@@ -47,16 +47,16 @@ function filterPackages(config, options) {
47
47
  }
48
48
  exports.filterPackages = filterPackages;
49
49
  function resolvePackagePath(value, params) {
50
- return (0, string_util_1.render)(value, {
50
+ return (0, string_1.render)(value, {
51
51
  ...params,
52
52
  ...{
53
- temp: (0, fs_util_1.tmpDir)("pkg"),
53
+ temp: (0, fs_1.tmpDir)("pkg"),
54
54
  },
55
55
  });
56
56
  }
57
57
  exports.resolvePackagePath = resolvePackagePath;
58
58
  function resolveDatabaseName(value, params) {
59
- return (0, string_util_1.render)(value, params);
59
+ return (0, string_1.render)(value, params);
60
60
  }
61
61
  exports.resolveDatabaseName = resolveDatabaseName;
62
62
  function resolvePackage(pkg, params) {
@@ -67,9 +67,9 @@ function resolvePackage(pkg, params) {
67
67
  path: undefined,
68
68
  };
69
69
  if (pkg.include)
70
- pkg.include = pkg.include.map((v) => typeof v === "string" ? (0, string_util_1.render)(v, pkgParams) : v);
70
+ pkg.include = pkg.include.map((v) => typeof v === "string" ? (0, string_1.render)(v, pkgParams) : v);
71
71
  if (pkg.exclude)
72
- pkg.exclude = pkg.exclude.map((v) => typeof v === "string" ? (0, string_util_1.render)(v, pkgParams) : v);
72
+ pkg.exclude = pkg.exclude.map((v) => typeof v === "string" ? (0, string_1.render)(v, pkgParams) : v);
73
73
  if (pkg.path)
74
74
  pkg.path = resolvePackagePath(pkg.path, pkgParams);
75
75
  if (pkg.restorePath)
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parsePaths = void 0;
4
- const process_util_1 = require("../process-util");
4
+ const process_1 = require("../process");
5
5
  async function parsePaths(values, options) {
6
6
  let paths = [];
7
7
  for (const value of values) {
@@ -9,7 +9,7 @@ async function parsePaths(values, options) {
9
9
  paths.push(value);
10
10
  }
11
11
  else if (value.type === "spawn") {
12
- const spawnResult = await (0, process_util_1.exec)(value.command, value.args, { cwd: options.cwd }, { log: options.verbose, stderr: { save: true }, stdout: { save: true } });
12
+ const spawnResult = await (0, process_1.exec)(value.command, value.args, { cwd: options.cwd }, { log: options.verbose, stderr: { save: true }, stdout: { save: true } });
13
13
  const spawnFiles = [spawnResult.stderr, spawnResult.stdout].flatMap((text) => text
14
14
  .split(/\r?\n/)
15
15
  .map((v) => v.trim())
@@ -1,4 +1,4 @@
1
1
  import { SnapshotGroupByType } from "../../Action/SnapshotsAction";
2
2
  import { SnapshotResultType } from "../../Repository/RepositoryAbstract";
3
- import { FilterByLastOptionsType } from "../date-util";
3
+ import { FilterByLastOptionsType } from "../date";
4
4
  export declare function groupAndFilter<TSnapshot extends SnapshotResultType>(snapshots: TSnapshot[], groupByKey?: SnapshotGroupByType[], filter?: FilterByLastOptionsType | ((groupedSnapshots: TSnapshot[]) => FilterByLastOptionsType), reasons?: Record<number, string[]>): TSnapshot[];
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.groupAndFilter = void 0;
4
- const date_util_1 = require("../date-util");
5
- const object_util_1 = require("../object-util");
4
+ const date_1 = require("../date");
5
+ const object_1 = require("../object");
6
6
  function groupAndFilter(snapshots, groupByKey, filter, reasons) {
7
7
  const grouped = groupByKey?.length
8
- ? (0, object_util_1.groupBy)(snapshots, groupByKey)
8
+ ? (0, object_1.groupBy)(snapshots, groupByKey)
9
9
  : { "": snapshots };
10
10
  const result = [];
11
11
  for (const key in grouped) {
@@ -13,7 +13,7 @@ function groupAndFilter(snapshots, groupByKey, filter, reasons) {
13
13
  const groupReasons = reasons
14
14
  ? {}
15
15
  : undefined;
16
- result.push(...(0, date_util_1.filterByLast)(grouped[key], typeof filter === "function" ? filter(grouped[key]) : filter, groupReasons));
16
+ result.push(...(0, date_1.filterByLast)(grouped[key], typeof filter === "function" ? filter(grouped[key]) : filter, groupReasons));
17
17
  if (groupReasons && reasons) {
18
18
  for (const groupItemIndex in groupReasons) {
19
19
  const snapshot = grouped[key][groupItemIndex];
File without changes
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createChron = exports.filterByLast = void 0;
7
- const string_util_1 = require("./string-util");
7
+ const string_1 = require("./string");
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  const advancedFormat_1 = __importDefault(require("dayjs/plugin/advancedFormat"));
10
10
  const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
@@ -82,7 +82,7 @@ function createChron() {
82
82
  throw new Error(`Chron was not started`);
83
83
  const seconds = (Date.now() - startTime) / 1000;
84
84
  if (formatted)
85
- return (0, string_util_1.formatSeconds)(seconds);
85
+ return (0, string_1.formatSeconds)(seconds);
86
86
  return seconds;
87
87
  },
88
88
  };
File without changes
File without changes
File without changes
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cpy = exports.isNotFoundError = exports.updateFileStats = exports.copyFileWithStreams = exports.waitForClose = exports.writeGitIgnoreList = exports.fastglobToGitIgnore = exports.forEachFile = exports.readDir = exports.checkDir = exports.checkFile = exports.readPartialFile = exports.mkTmpDir = exports.fastFolderSizeAsync = exports.tmpDir = exports.rmTmpDir = exports.isTmpDir = exports.sessionTmpDir = exports.parentTmpDir = exports.existsFile = exports.findFile = exports.parsePackageFile = exports.parseFile = exports.parseFileExtensions = exports.readdirIfExists = exports.writeJSONFile = exports.existsDir = exports.ensureEmptyDir = exports.mkdirIfNotExists = exports.isDirEmpty = exports.isLocalDir = exports.pathIterator = exports.applyPermissions = exports.isEmptyDir = exports.isWSLSystem = void 0;
7
7
  const globalData_1 = __importDefault(require("../globalData"));
8
- const path_util_1 = require("./path-util");
8
+ const path_1 = require("./path");
9
9
  const async_1 = require("async");
10
10
  const crypto_1 = require("crypto");
11
11
  const fast_folder_size_1 = __importDefault(require("fast-folder-size"));
@@ -14,8 +14,8 @@ const fs_1 = require("fs");
14
14
  const fs_2 = require("fs");
15
15
  const promises_1 = require("fs/promises");
16
16
  const os_1 = require("os");
17
- const path_1 = require("path");
18
17
  const path_2 = require("path");
18
+ const path_3 = require("path");
19
19
  const readline_1 = require("readline");
20
20
  const util_1 = require("util");
21
21
  exports.isWSLSystem = (0, os_1.release)().includes("microsoft-standard-WSL");
@@ -40,7 +40,7 @@ async function applyPermissions(baseDir, permissionsPath) {
40
40
  });
41
41
  for await (const line of singleReader) {
42
42
  const [rpath, rawUid, rawGui, rawMode] = line.split(":");
43
- const path = (0, path_1.join)(baseDir, rpath);
43
+ const path = (0, path_2.join)(baseDir, rpath);
44
44
  if (!path.startsWith(baseDir)) {
45
45
  throw new Error(`Entry path is out of the base dir: (${path}, ${baseDir})`);
46
46
  }
@@ -100,8 +100,8 @@ async function readdirIfExists(path) {
100
100
  exports.readdirIfExists = readdirIfExists;
101
101
  exports.parseFileExtensions = ["json", "js", "ts", "yaml", "yml"];
102
102
  async function parseFile(path, jsKey) {
103
- if (!(0, path_2.isAbsolute)(path))
104
- path = (0, path_1.join)(process.cwd(), path);
103
+ if (!(0, path_3.isAbsolute)(path))
104
+ path = (0, path_2.join)(process.cwd(), path);
105
105
  if (path.endsWith(".ts"))
106
106
  require("ts-node").register();
107
107
  if (path.endsWith(".yaml") || path.endsWith("yml")) {
@@ -119,7 +119,7 @@ async function parseFile(path, jsKey) {
119
119
  }
120
120
  exports.parseFile = parseFile;
121
121
  function parsePackageFile() {
122
- return require(`${path_util_1.rootPath}/package.json`);
122
+ return require(`${path_1.rootPath}/package.json`);
123
123
  }
124
124
  exports.parsePackageFile = parsePackageFile;
125
125
  async function findFile(sourcePath, baseName, extensions, errorMessage = "Path not found") {
@@ -127,7 +127,7 @@ async function findFile(sourcePath, baseName, extensions, errorMessage = "Path n
127
127
  let path;
128
128
  if (info.isDirectory()) {
129
129
  for (const ext of extensions) {
130
- const extPath = (0, path_1.join)(sourcePath, baseName) + "." + ext;
130
+ const extPath = (0, path_2.join)(sourcePath, baseName) + "." + ext;
131
131
  if (await existsFile(extPath)) {
132
132
  path = extPath;
133
133
  break;
@@ -153,11 +153,11 @@ async function existsFile(path) {
153
153
  }
154
154
  exports.existsFile = existsFile;
155
155
  function parentTmpDir() {
156
- return (0, path_1.join)(globalData_1.default.tempDir, "datatruck-temp");
156
+ return (0, path_2.join)(globalData_1.default.tempDir, "datatruck-temp");
157
157
  }
158
158
  exports.parentTmpDir = parentTmpDir;
159
159
  function sessionTmpDir() {
160
- return (0, path_1.join)(parentTmpDir(), process.pid.toString());
160
+ return (0, path_2.join)(parentTmpDir(), process.pid.toString());
161
161
  }
162
162
  exports.sessionTmpDir = sessionTmpDir;
163
163
  function isTmpDir(path) {
@@ -181,7 +181,7 @@ exports.rmTmpDir = rmTmpDir;
181
181
  function tmpDir(prefix, id) {
182
182
  if (!id)
183
183
  id = (0, crypto_1.randomUUID)().slice(0, 8);
184
- return (0, path_1.join)(sessionTmpDir(), `${prefix}-${id}`);
184
+ return (0, path_2.join)(sessionTmpDir(), `${prefix}-${id}`);
185
185
  }
186
186
  exports.tmpDir = tmpDir;
187
187
  async function fastFolderSizeAsync(path) {
@@ -261,7 +261,7 @@ exports.readDir = readDir;
261
261
  async function forEachFile(dirPath, cb, includeDir) {
262
262
  const files = await readDir(dirPath);
263
263
  for (const file of files) {
264
- const filePath = (0, path_1.join)(dirPath, file);
264
+ const filePath = (0, path_2.join)(dirPath, file);
265
265
  if ((await (0, promises_1.stat)(filePath)).isDirectory()) {
266
266
  if (includeDir)
267
267
  cb(filePath, true);
@@ -284,12 +284,12 @@ function fastglobToGitIgnore(patterns, baseDir) {
284
284
  exports.fastglobToGitIgnore = fastglobToGitIgnore;
285
285
  async function writeGitIgnoreList(options) {
286
286
  const { outDir } = options;
287
- const path = (0, path_1.join)(outDir, `.gitignore`);
287
+ const path = (0, path_2.join)(outDir, `.gitignore`);
288
288
  const stream = (0, fs_2.createWriteStream)(path);
289
289
  const dirs = new Set();
290
290
  stream.write("*\n");
291
291
  for await (const value of options.paths) {
292
- const dir = (0, path_1.dirname)(value.toString());
292
+ const dir = (0, path_2.dirname)(value.toString());
293
293
  if (dir !== ".") {
294
294
  let parentPath;
295
295
  for (const value of dir.split("/")) {
@@ -368,9 +368,9 @@ async function cpy(options) {
368
368
  const task = async (rawEntryPath, basePath) => {
369
369
  [rawEntryPath] = rawEntryPath.split(":");
370
370
  const isDir = rawEntryPath.endsWith("/");
371
- const entryPath = (0, path_1.normalize)(rawEntryPath);
372
- const entrySourcePath = (0, path_1.resolve)((0, path_1.join)(basePath, rawEntryPath));
373
- const entryTargetPath = (0, path_1.resolve)((0, path_1.join)(options.targetPath, rawEntryPath));
371
+ const entryPath = (0, path_2.normalize)(rawEntryPath);
372
+ const entrySourcePath = (0, path_2.resolve)((0, path_2.join)(basePath, rawEntryPath));
373
+ const entryTargetPath = (0, path_2.resolve)((0, path_2.join)(options.targetPath, rawEntryPath));
374
374
  const onPathResult = await options?.onPath?.({
375
375
  isDir,
376
376
  entryPath,
@@ -385,7 +385,7 @@ async function cpy(options) {
385
385
  await makeRecursiveDir(entryTargetPath);
386
386
  }
387
387
  else {
388
- const dir = (0, path_1.dirname)(entryTargetPath);
388
+ const dir = (0, path_2.dirname)(entryTargetPath);
389
389
  await makeRecursiveDir(dir);
390
390
  await options.onProgress?.({
391
391
  current: stats.files,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes