@datatruck/cli 0.26.1 → 0.26.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.
@@ -14,7 +14,7 @@ export type RestoreActionOptionsType = {
14
14
  repositoryNames?: string[];
15
15
  repositoryTypes?: string[];
16
16
  verbose?: boolean;
17
- noRestorePath?: boolean;
17
+ restorePath?: boolean;
18
18
  };
19
19
  type SnapshotType = SnapshotResultType & {
20
20
  repositoryName: string;
@@ -145,7 +145,7 @@ class RestoreAction {
145
145
  });
146
146
  let repoError;
147
147
  let repoInstance;
148
- if (this.options.noRestorePath)
148
+ if (!this.options.restorePath)
149
149
  pkg = {
150
150
  ...pkg,
151
151
  restorePath: pkg.path,
@@ -9,7 +9,7 @@ export type RestoreCommandOptionsType<TResolved = false> = {
9
9
  repository?: If<TResolved, string[]>;
10
10
  repositoryType?: If<TResolved, RepositoryConfigType["type"][]>;
11
11
  tag?: If<TResolved, string[]>;
12
- noRestorePath?: boolean;
12
+ restorePath?: boolean;
13
13
  };
14
14
  export declare class RestoreCommand extends CommandAbstract<RestoreCommandOptionsType<false>, RestoreCommandOptionsType<true>> {
15
15
  onOptions(): import("../utils/cli").OptionsType<RestoreCommandOptionsType<false>, RestoreCommandOptionsType<true>>;
@@ -21,7 +21,7 @@ class RestoreCommand extends CommandAbstract_1.CommandAbstract {
21
21
  option: "-p,--package <values>",
22
22
  parser: string_1.parseStringList,
23
23
  },
24
- noRestorePath: {
24
+ restorePath: {
25
25
  description: "Disable restore path",
26
26
  option: "--no-restore-path",
27
27
  },
@@ -63,7 +63,7 @@ class RestoreCommand extends CommandAbstract_1.CommandAbstract {
63
63
  repositoryTypes: this.options.repositoryType,
64
64
  tags: this.options.tag,
65
65
  verbose: verbose > 0,
66
- noRestorePath: this.options.noRestorePath,
66
+ restorePath: this.options.restorePath,
67
67
  });
68
68
  const sessionManager = new RestoreSessionManager_1.RestoreSessionManager({
69
69
  driver: new SqliteSessionDriver_1.SqliteSessionDriver({
@@ -163,7 +163,7 @@ class MysqlDumpTask extends TaskAbstract_1.TaskAbstract {
163
163
  const database = {
164
164
  name: (0, config_1.resolveDatabaseName)(this.config.database, params),
165
165
  };
166
- if (this.config.targetDatabase && !data.options.noRestorePath)
166
+ if (this.config.targetDatabase && data.options.restorePath)
167
167
  database.name = (0, config_1.resolveDatabaseName)(this.config.targetDatabase.name, {
168
168
  ...params,
169
169
  database: database.name,
@@ -192,7 +192,7 @@ class SqlDumpTaskAbstract extends TaskAbstract_1.TaskAbstract {
192
192
  database: undefined,
193
193
  }),
194
194
  };
195
- if (this.config.targetDatabase && !data.options.noRestorePath) {
195
+ if (this.config.targetDatabase && data.options.restorePath) {
196
196
  database.name = (0, config_1.resolveDatabaseName)(this.config.targetDatabase.name, {
197
197
  packageName: data.package.name,
198
198
  snapshotId: data.options.snapshotId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "dependencies": {
5
5
  "@supercharge/promise-pool": "^3.1.0",
6
6
  "ajv": "^8.12.0",
package/utils/cli.js CHANGED
@@ -96,7 +96,9 @@ exports.errorColumn = errorColumn;
96
96
  function parseOptions(object, options) {
97
97
  const result = {};
98
98
  for (const key in options) {
99
- const value = object?.[key] ?? options[key].defaults;
99
+ const isNegative = options[key].option.startsWith("--no");
100
+ const defaultsValue = isNegative ? true : options[key].defaults;
101
+ const value = object?.[key] ?? defaultsValue;
100
102
  const parser = options[key].parser;
101
103
  if (typeof value !== "undefined") {
102
104
  result[key] = parser ? parser(value) : value;