@provartesting/provardx-cli 0.0.2 → 0.0.4

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 (65) hide show
  1. package/README.md +21 -16
  2. package/lib/Utility/errorCode.js +1 -2
  3. package/lib/Utility/errorCode.js.map +1 -1
  4. package/lib/Utility/errorHandler.d.ts +1 -1
  5. package/lib/Utility/errorHandler.js +2 -7
  6. package/lib/Utility/errorHandler.js.map +1 -1
  7. package/lib/Utility/fileSupport.js +5 -36
  8. package/lib/Utility/fileSupport.js.map +1 -1
  9. package/lib/Utility/jsonSupport.js +4 -11
  10. package/lib/Utility/jsonSupport.js.map +1 -1
  11. package/lib/Utility/propertyFileValidator.d.ts +1 -1
  12. package/lib/Utility/propertyFileValidator.js +26 -44
  13. package/lib/Utility/propertyFileValidator.js.map +1 -1
  14. package/lib/Utility/provarConfig.d.ts +1 -1
  15. package/lib/Utility/provarConfig.js +3 -7
  16. package/lib/Utility/provarConfig.js.map +1 -1
  17. package/lib/Utility/sfProvarCommandResult.d.ts +1 -1
  18. package/lib/Utility/sfProvarCommandResult.js +1 -5
  19. package/lib/Utility/sfProvarCommandResult.js.map +1 -1
  20. package/lib/Utility/stringSupport.js +2 -7
  21. package/lib/Utility/stringSupport.js.map +1 -1
  22. package/lib/commands/{sf/provar → provar}/config/generate.d.ts +3 -3
  23. package/lib/commands/provar/config/generate.js +70 -0
  24. package/lib/commands/provar/config/generate.js.map +1 -0
  25. package/lib/commands/{sf/provar → provar}/config/get.d.ts +1 -1
  26. package/lib/commands/provar/config/get.js +74 -0
  27. package/lib/commands/provar/config/get.js.map +1 -0
  28. package/lib/commands/{sf/provar → provar}/config/load.d.ts +2 -2
  29. package/lib/commands/provar/config/load.js +55 -0
  30. package/lib/commands/provar/config/load.js.map +1 -0
  31. package/lib/commands/{sf/provar → provar}/config/set.d.ts +1 -1
  32. package/lib/commands/provar/config/set.js +85 -0
  33. package/lib/commands/provar/config/set.js.map +1 -0
  34. package/lib/commands/{sf/provar → provar}/config/validate.d.ts +1 -1
  35. package/lib/commands/provar/config/validate.js +31 -0
  36. package/lib/commands/provar/config/validate.js.map +1 -0
  37. package/lib/constants/commandConstants.d.ts +5 -5
  38. package/lib/constants/commandConstants.js +7 -10
  39. package/lib/constants/commandConstants.js.map +1 -1
  40. package/lib/constants/errorMessages.js +2 -5
  41. package/lib/constants/errorMessages.js.map +1 -1
  42. package/lib/constants/propertyFileContent.d.ts +24 -0
  43. package/lib/constants/propertyFileContent.js +25 -0
  44. package/lib/constants/propertyFileContent.js.map +1 -0
  45. package/lib/constants/propertyFileSchema.d.ts +7 -0
  46. package/lib/constants/propertyFileSchema.js +9 -4
  47. package/lib/constants/propertyFileSchema.js.map +1 -1
  48. package/messages/sf.provar.config.generate.md +33 -33
  49. package/messages/sf.provar.config.get.md +17 -17
  50. package/messages/sf.provar.config.load.md +29 -29
  51. package/messages/sf.provar.config.set.md +17 -17
  52. package/messages/sf.provar.config.validate.md +21 -21
  53. package/oclif.manifest.json +176 -74
  54. package/package.json +24 -47
  55. package/lib/commands/sf/provar/config/generate.js +0 -102
  56. package/lib/commands/sf/provar/config/generate.js.map +0 -1
  57. package/lib/commands/sf/provar/config/get.js +0 -106
  58. package/lib/commands/sf/provar/config/get.js.map +0 -1
  59. package/lib/commands/sf/provar/config/load.js +0 -87
  60. package/lib/commands/sf/provar/config/load.js.map +0 -1
  61. package/lib/commands/sf/provar/config/set.js +0 -117
  62. package/lib/commands/sf/provar/config/set.js.map +0 -1
  63. package/lib/commands/sf/provar/config/validate.js +0 -40
  64. package/lib/commands/sf/provar/config/validate.js.map +0 -1
  65. package/lib/constants/propertyFileContent.json +0 -24
package/README.md CHANGED
@@ -1,16 +1,21 @@
1
- Run In dev provardx plugin on your local
2
- # Prerequisite:
3
- Node, npm , nvm, yarn, Latest sf cli.
4
- # Steps to run on local:
5
- 1. git clone the Repo from the feature branch: https://github.com/ProvarTesting/provardx-cli/
6
- 2. Install the dependencies on your local from package.json: npm i
7
- 3. Build the project using the command: yarn prepack
8
- 4. Need to copy the bin/dev folder to run the commands locally in Dev. Plugin.
9
- 5. To run the command manually: bin/dev ${command} (example: bin/dev sf provar config generate)
10
- 6. To run NUTS on your local: yarn run test:nuts
11
-
12
- # Naming conventions used in provardx-cli development
13
- 1. camelCase for fileNames/methodNames/Variables
14
- 2. PascalCase for classNames.
15
-
16
- Also, we are adding the Copyright/licensing text over every ts file
1
+ Run In dev provardx plugin on your local
2
+
3
+ # Prerequisite:
4
+
5
+ Node, npm , nvm, yarn, Latest sf cli.
6
+
7
+ # Steps to run on local:
8
+
9
+ 1. git clone the Repo from the feature branch: https://github.com/ProvarTesting/provardx-cli/
10
+ 2. Install the dependencies on your local from package.json: npm i
11
+ 3. Build the project using the command: yarn prepack
12
+ 4. Need to copy the bin/dev folder to run the commands locally in Dev. Plugin.
13
+ 5. To run the command manually: bin/dev ${command} (example: bin/dev sf provar config generate)
14
+ 6. To run NUTS on your local: yarn run test:nuts
15
+
16
+ # Naming conventions used in provardx-cli development
17
+
18
+ 1. camelCase for fileNames/methodNames/Variables
19
+ 2. PascalCase for classNames.
20
+
21
+ Also, we are adding the Copyright/licensing text over every ts file
@@ -1,9 +1,8 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
7
+ export {};
9
8
  //# sourceMappingURL=errorCode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorCode.js","sourceRoot":"","sources":["../../src/Utility/errorCode.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"errorCode.js","sourceRoot":"","sources":["../../src/Utility/errorCode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from './errorCode';
1
+ import { ErrorCode } from './errorCode.js';
2
2
  /**
3
3
  * ErrorHandler to manage multiple errors thrown while execution of commands.
4
4
  *
@@ -1,15 +1,11 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- class ErrorHandler {
10
- constructor() {
11
- this.errors = [];
12
- }
7
+ export default class ErrorHandler {
8
+ errors = [];
13
9
  addErrorsToList(eCode, eMessage) {
14
10
  this.errors.push({
15
11
  code: eCode,
@@ -23,5 +19,4 @@ class ErrorHandler {
23
19
  return this.errors.map((e) => `[${e.code}] ${e.message}`);
24
20
  }
25
21
  }
26
- exports.default = ErrorHandler;
27
22
  //# sourceMappingURL=errorHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../src/Utility/errorHandler.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAcH,MAAqB,YAAY;IAAjC;QACU,WAAM,GAAY,EAAE,CAAC;IAgB/B,CAAC;IAdQ,eAAe,CAAC,KAAgB,EAAE,QAAgB;QACvD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;IACL,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF;AAjBD,+BAiBC"}
1
+ {"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../src/Utility/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,MAAM,CAAC,OAAO,OAAO,YAAY;IACvB,MAAM,GAAY,EAAE,CAAC;IAEtB,eAAe,CAAC,KAAgB,EAAE,QAAgB;QACvD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;IACL,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -1,51 +1,20 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.getExtension = exports.generateFile = void 0;
36
- const fs = __importStar(require("fs"));
37
- const propertyFileContent_json_1 = __importDefault(require("../constants/propertyFileContent.json"));
7
+ import * as fs from 'node:fs';
8
+ import { propertyFileContent } from '../constants/propertyFileContent.js';
38
9
  /**
39
10
  * Contains all the methods that deals with generic file related operations.
40
11
  *
41
12
  */
42
- function generateFile(filePath) {
43
- fs.writeFileSync(filePath, JSON.stringify(propertyFileContent_json_1.default, null, 3));
13
+ export function generateFile(filePath) {
14
+ fs.writeFileSync(filePath, JSON.stringify(propertyFileContent, null, 3));
44
15
  }
45
- exports.generateFile = generateFile;
46
- function getExtension(filename) {
16
+ export function getExtension(filename) {
47
17
  const i = filename.lastIndexOf('.');
48
18
  return i < 0 ? '' : filename.substr(i);
49
19
  }
50
- exports.getExtension = getExtension;
51
20
  //# sourceMappingURL=fileSupport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileSupport.js","sourceRoot":"","sources":["../../src/Utility/fileSupport.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qGAAwE;AAExE;;;GAGG;AAEH,SAAgB,YAAY,CAAC,QAAgB;IAC3C,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,kCAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,oCAEC;AAED,SAAgB,YAAY,CAAC,QAAgB;IAC3C,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAHD,oCAGC"}
1
+ {"version":3,"file":"fileSupport.js","sourceRoot":"","sources":["../../src/Utility/fileSupport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;GAGG;AAEH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -1,26 +1,22 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.parseJSONString = exports.setNestedProperty = exports.checkNestedProperty = exports.getNestedProperty = void 0;
10
7
  /**
11
8
  * Custom logics from JSON manipulation.
12
9
  *
13
10
  */
14
11
  /* eslint-disable */
15
- function getNestedProperty(jsonData, property) {
12
+ export function getNestedProperty(jsonData, property) {
16
13
  const propertyPath = property.split('.');
17
14
  for (let i = 0; i < propertyPath.length; i++) {
18
15
  jsonData = jsonData[propertyPath[i]];
19
16
  }
20
17
  return jsonData;
21
18
  }
22
- exports.getNestedProperty = getNestedProperty;
23
- function checkNestedProperty(jsonData, property) {
19
+ export function checkNestedProperty(jsonData, property) {
24
20
  const propertyPath = property.split('.');
25
21
  for (const nestedProperty of propertyPath) {
26
22
  if (!jsonData?.hasOwnProperty(nestedProperty)) {
@@ -30,8 +26,7 @@ function checkNestedProperty(jsonData, property) {
30
26
  }
31
27
  return true;
32
28
  }
33
- exports.checkNestedProperty = checkNestedProperty;
34
- function setNestedProperty(jsonData, property, value) {
29
+ export function setNestedProperty(jsonData, property, value) {
35
30
  const propertyPath = property.split('.');
36
31
  const propertyPathLength = propertyPath.length;
37
32
  for (var i = 0; i < propertyPathLength - 1; i++) {
@@ -42,8 +37,7 @@ function setNestedProperty(jsonData, property, value) {
42
37
  }
43
38
  jsonData[propertyPath[propertyPathLength - 1]] = value;
44
39
  }
45
- exports.setNestedProperty = setNestedProperty;
46
- function parseJSONString(jsonInput) {
40
+ export function parseJSONString(jsonInput) {
47
41
  try {
48
42
  return JSON.parse(jsonInput);
49
43
  }
@@ -51,5 +45,4 @@ function parseJSONString(jsonInput) {
51
45
  return jsonInput;
52
46
  }
53
47
  }
54
- exports.parseJSONString = parseJSONString;
55
48
  //# sourceMappingURL=jsonSupport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSupport.js","sourceRoot":"","sources":["../../src/Utility/jsonSupport.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;GAGG;AAEH,oBAAoB;AACpB,SAAgB,iBAAiB,CAAC,QAAa,EAAE,QAAgB;IAC/D,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC5C,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;KACtC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,8CAMC;AAED,SAAgB,mBAAmB,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D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KAC9B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { ValidatorResult } from 'jsonschema';
2
- import ErrorHandler, { Error } from './errorHandler';
2
+ import ErrorHandler, { Error } from './errorHandler.js';
3
3
  /**
4
4
  * Contains code to load the config file and validation login for provardx-properties.json
5
5
  *
@@ -1,93 +1,76 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- const fileSystem = __importStar(require("fs"));
33
- const jsonschema_1 = require("jsonschema");
34
- const errorMessages_1 = require("../constants/errorMessages");
35
- const propertyFileSchema_1 = require("../constants/propertyFileSchema");
36
- const stringSupport_1 = require("./stringSupport");
37
- const provarConfig_1 = require("./provarConfig");
7
+ import * as fileSystem from 'node:fs';
8
+ import { Validator } from 'jsonschema';
9
+ import { errorMessages } from '../constants/errorMessages.js';
10
+ import { propertyFileSchema } from '../constants/propertyFileSchema.js';
11
+ import { substringAfter, addQuotesAround } from './stringSupport.js';
12
+ import { ProvarConfig } from './provarConfig.js';
38
13
  /**
39
14
  * Contains code to load the config file and validation login for provardx-properties.json
40
15
  *
41
16
  */
42
- class PropertyFileValidator {
17
+ export default class PropertyFileValidator {
18
+ validationResults;
19
+ errorHandler;
43
20
  constructor(errorHandler) {
44
21
  this.errorHandler = errorHandler;
45
22
  }
46
23
  async validate() {
47
- const config = await provarConfig_1.ProvarConfig.loadConfig(this.errorHandler);
24
+ const config = await ProvarConfig.loadConfig(this.errorHandler);
48
25
  const filePath = config.get('PROVARDX_PROPERTIES_FILE_PATH')?.toString();
49
26
  const missingRequiredProperties = [];
50
27
  const invalidPropertiesValue = [];
51
28
  if (filePath === undefined || !fileSystem.existsSync(filePath)) {
52
- this.errorHandler.addErrorsToList('MISSING_FILE', errorMessages_1.errorMessages.MISSINGFILEERROR);
29
+ this.errorHandler.addErrorsToList('MISSING_FILE', errorMessages.MISSINGFILEERROR);
53
30
  }
54
31
  else {
55
32
  /* eslint-disable */
56
- const jsonValidator = new jsonschema_1.Validator();
33
+ const jsonValidator = new Validator();
57
34
  try {
58
- this.validationResults = jsonValidator.validate(JSON.parse(fileSystem.readFileSync(filePath).toString()), propertyFileSchema_1.propertyFileSchema);
35
+ this.validationResults = jsonValidator.validate(JSON.parse(fileSystem.readFileSync(filePath).toString()), propertyFileSchema);
59
36
  if (this.validationResults.errors.length > 0) {
60
37
  for (const validationError of this.validationResults.errors) {
61
38
  if (validationError.name === 'required') {
62
- let substring = (0, stringSupport_1.substringAfter)(validationError.property, '.');
39
+ let substring = substringAfter(validationError.property, '.');
63
40
  if (substring) {
64
41
  substring = substring.concat('.');
65
42
  }
66
43
  missingRequiredProperties.push(substring + validationError.argument);
67
44
  }
45
+ else if (validationError.name === 'pattern') {
46
+ let substring = substringAfter(validationError.property, '.');
47
+ if (substring) {
48
+ invalidPropertiesValue.push(substring);
49
+ }
50
+ }
68
51
  else if (validationError.name === 'enum' || validationError.name === 'type') {
69
- invalidPropertiesValue.push((0, stringSupport_1.substringAfter)(validationError.property, '.'));
52
+ invalidPropertiesValue.push(substringAfter(validationError.property, '.'));
70
53
  }
71
54
  }
72
55
  }
73
56
  }
74
57
  catch (errors) {
75
- this.errorHandler.addErrorsToList('MALFORMED_FILE', errorMessages_1.errorMessages.MALFORMEDFILEERROR);
58
+ this.errorHandler.addErrorsToList('MALFORMED_FILE', errorMessages.MALFORMEDFILEERROR);
76
59
  return false;
77
60
  }
78
61
  const missingPropertiesCount = missingRequiredProperties.length;
79
62
  const invalidValuesCount = invalidPropertiesValue.length;
80
63
  if (missingPropertiesCount > 1) {
81
- this.errorHandler.addErrorsToList('MISSING_PROPERTIES', `The properties ${(0, stringSupport_1.addQuotesAround)(missingRequiredProperties).join(', ')} are missing.`);
64
+ this.errorHandler.addErrorsToList('MISSING_PROPERTIES', `The properties ${addQuotesAround(missingRequiredProperties).join(', ')} are missing.`);
82
65
  }
83
66
  else if (missingPropertiesCount == 1) {
84
- this.errorHandler.addErrorsToList('MISSING_PROPERTY', `The property ${(0, stringSupport_1.addQuotesAround)(missingRequiredProperties)} is missing.`);
67
+ this.errorHandler.addErrorsToList('MISSING_PROPERTY', `The property ${addQuotesAround(missingRequiredProperties)} is missing.`);
85
68
  }
86
69
  if (invalidValuesCount > 1) {
87
- this.errorHandler.addErrorsToList('INVALID_VALUES', `The properties ${(0, stringSupport_1.addQuotesAround)(invalidPropertiesValue).join(', ')} values are not valid.`);
70
+ this.errorHandler.addErrorsToList('INVALID_VALUES', `The properties ${addQuotesAround(invalidPropertiesValue).join(', ')} values are not valid.`);
88
71
  }
89
72
  else if (invalidValuesCount == 1) {
90
- this.errorHandler.addErrorsToList('INVALID_VALUE', `The property ${(0, stringSupport_1.addQuotesAround)(invalidPropertiesValue)} value is not valid.`);
73
+ this.errorHandler.addErrorsToList('INVALID_VALUE', `The property ${addQuotesAround(invalidPropertiesValue)} value is not valid.`);
91
74
  }
92
75
  }
93
76
  if (this.errorHandler.getErrors().length > 0) {
@@ -99,5 +82,4 @@ class PropertyFileValidator {
99
82
  return this.errorHandler.getErrors();
100
83
  }
101
84
  }
102
- exports.default = PropertyFileValidator;
103
85
  //# sourceMappingURL=propertyFileValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"propertyFileValidator.js","sourceRoot":"","sources":["../../src/Utility/propertyFileValidator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAAiC;AACjC,2CAAwD;AACxD,8DAA2D;AAC3D,wEAAqE;AAErE,mDAAkE;AAClE,iDAA8C;AAE9C;;;GAGG;AAEH,MAAqB,qBAAqB;IAIxC,YAAmB,YAA0B;QAC3C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,MAAM,MAAM,GAAiB,MAAM,2BAAY,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,EAAE,QAAQ,EAAE,CAAC;QAEzE,MAAM,yBAAyB,GAAa,EAAE,CAAC;QAC/C,MAAM,sBAAsB,GAAa,EAAE,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAC9D,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,6BAAa,CAAC,gBAAgB,CAAC,CAAC;SACnF;aAAM;YACL,oBAAoB;YACpB,MAAM,aA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AAI,CAAC,YAAY,CAAC,eAAe,CAC/B,gBAAgB,EAChB,kBAAkB,eAAe,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAC7F,CAAC;aACH;iBAAM,IAAI,kBAAkB,IAAI,CAAC,EAAE;gBAClC,IAAI,CAAC,YAAY,CAAC,eAAe,CAC/B,eAAe,EACf,gBAAgB,eAAe,CAAC,sBAAsB,CAAC,sBAAsB,CAC9E,CAAC;aACH;SACF;QACD,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;IACvC,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { Config } from '@salesforce/core';
2
- import ErrorHandler from './errorHandler';
2
+ import ErrorHandler from './errorHandler.js';
3
3
  /**
4
4
  * sfdxConfig extended class that deals with any operation over .sf/config.json.
5
5
  * ex: what all properties we can add to config.json.
@@ -1,19 +1,16 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ProvarConfig = void 0;
10
- const core_1 = require("@salesforce/core");
7
+ import { Config, SfError } from '@salesforce/core';
11
8
  /**
12
9
  * sfdxConfig extended class that deals with any operation over .sf/config.json.
13
10
  * ex: what all properties we can add to config.json.
14
11
  *
15
12
  */
16
- class ProvarConfig extends core_1.Config {
13
+ export class ProvarConfig extends Config {
17
14
  constructor() {
18
15
  const option = { isGlobal: true, isState: true, filename: 'config.json', stateFolder: '.provardx' };
19
16
  const allowedProeprties = [];
@@ -30,7 +27,7 @@ class ProvarConfig extends core_1.Config {
30
27
  return config;
31
28
  }
32
29
  catch (error) {
33
- if (error instanceof core_1.SfError) {
30
+ if (error instanceof SfError) {
34
31
  // eslint-disable-next-line
35
32
  errorHandler.addErrorsToList(error.code, error.message);
36
33
  }
@@ -38,5 +35,4 @@ class ProvarConfig extends core_1.Config {
38
35
  }
39
36
  }
40
37
  }
41
- exports.ProvarConfig = ProvarConfig;
42
38
  //# sourceMappingURL=provarConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provarConfig.js","sourceRoot":"","sources":["../../src/Utility/provarConfig.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAuE;AAGvE;;;;GAIG;AAEH,MAAa,YAAa,SAAQ,aAAM;IACtC;QACE,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;QACpG,MAAM,iBAAiB,GAAyB,EAAE,CAAC;QACnD,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,+BAA+B,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAClF,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACrD,KAAK,CACH,MAAM,CAAC,MAAM,CACX;YACE,QAAQ,EAAE,IAAI;SACf,EACD,MAAM,CACP,CACF,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,cAAO,EAAE;gBAC5B,2BAA2B;gBAC3B,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACzD;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;CACF;AA7BD,oCA6BC"}
1
+ {"version":3,"file":"provarConfig.js","sourceRoot":"","sources":["../../src/Utility/provarConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAsB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGvE;;;;GAIG;AAEH,MAAM,OAAO,YAAa,SAAQ,MAAM;IACtC;QACE,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;QACpG,MAAM,iBAAiB,GAAyB,EAAE,CAAC;QACnD,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,+BAA+B,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAClF,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACrD,KAAK,CACH,MAAM,CAAC,MAAM,CACX;YACE,QAAQ,EAAE,IAAI;SACf,EACD,MAAM,CACP,CACF,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,OAAO,EAAE;gBAC5B,2BAA2B;gBAC3B,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACzD;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { Messages } from '@salesforce/core';
2
- import ErrorHandler, { Error } from './errorHandler';
2
+ import ErrorHandler, { Error } from './errorHandler.js';
3
3
  /**
4
4
  * Declaring return type and populating return object for async run method of the commands.
5
5
  *
@@ -1,14 +1,11 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.populateResult = void 0;
10
7
  /* eslint-disable */
11
- function populateResult(flags, errorHandler, messages, log, value) {
8
+ export function populateResult(flags, errorHandler, messages, log, value) {
12
9
  let result = { success: true };
13
10
  if (errorHandler.getErrors().length > 0) {
14
11
  const errorObjects = errorHandler.getErrors();
@@ -30,5 +27,4 @@ function populateResult(flags, errorHandler, messages, log, value) {
30
27
  }
31
28
  return result;
32
29
  }
33
- exports.populateResult = populateResult;
34
30
  //# sourceMappingURL=sfProvarCommandResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sfProvarCommandResult.js","sourceRoot":"","sources":["../../src/Utility/sfProvarCommandResult.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAgBH,oBAAoB;AACpB,SAAgB,cAAc,CAC5B,KAAU,EACV,YAA0B,EAC1B,QAA0B,EAC1B,GAAa,EACb,KAAc;IAEd,IAAI,MAAM,GAA0B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEtD,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;QACvC,MAAM,YAAY,GAAY,YAAY,CAAC,SAAS,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,EAAE,YAAY,CAAC,mBAAmB,EAAE,CAAC,CAAC;SACzF;QACD,MAAM,GAAG;YACP,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,YAAY;SACrB,C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CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG;YACP,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,KAAK;SACb,CAAC;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,17 +1,14 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2024 Provar Limited.
4
3
  * All rights reserved.
5
4
  * Licensed under the BSD 3-Clause license.
6
5
  * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.addQuotesAround = exports.substringAfter = void 0;
10
7
  /**
11
8
  * Deals with the custom operations on strings.
12
9
  *
13
10
  */
14
- function substringAfter(str, separator) {
11
+ export function substringAfter(str, separator) {
15
12
  if (!str) {
16
13
  return str;
17
14
  }
@@ -24,9 +21,7 @@ function substringAfter(str, separator) {
24
21
  }
25
22
  return str.substring(pos + separator.length);
26
23
  }
27
- exports.substringAfter = substringAfter;
28
- function addQuotesAround(array) {
24
+ export function addQuotesAround(array) {
29
25
  return array.map((item) => "'" + item + "'");
30
26
  }
31
- exports.addQuotesAround = addQuotesAround;
32
27
  //# sourceMappingURL=stringSupport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stringSupport.js","sourceRoot":"","sources":["../../src/Utility/stringSupport.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;GAGG;AAEH,SAAgB,cAAc,CAAC,GAAW,EAAE,SAAiB;IAC3D,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;QACd,OAAO,EAAE,CAAC;KACX;IAED,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAbD,wCAaC;AACD,SAAgB,eAAe,CAAC,KAAe;IAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;AAC/C,CAAC;AAFD,0CAEC"}
1
+ {"version":3,"file":"stringSupport.js","sourceRoot":"","sources":["../../src/Utility/stringSupport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AAEH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,SAAiB;IAC3D,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;QACd,OAAO,EAAE,CAAC;KACX;IAED,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AACD,MAAM,UAAU,eAAe,CAAC,KAAe;IAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { SfProvarCommandResult } from '../../../../Utility/sfProvarCommandResult';
2
+ import { SfProvarCommandResult } from '../../../Utility/sfProvarCommandResult.js';
3
3
  export default class SfProvarConfigGenerate extends SfCommand<SfProvarCommandResult> {
4
4
  static readonly summary: string;
5
5
  static readonly description: string;
6
6
  static readonly examples: string[];
7
7
  static readonly flags: {
8
- 'properties-file': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
- 'no-prompt': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ 'properties-file': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ 'no-prompt': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
10
10
  };
11
11
  private errorHandler;
12
12
  run(): Promise<SfProvarCommandResult>;
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (c) 2024 Provar Limited.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import fs from 'node:fs';
8
+ import { Messages } from '@salesforce/core';
9
+ import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
10
+ import { populateResult } from '../../../Utility/sfProvarCommandResult.js';
11
+ import { generateFile, getExtension } from '../../../Utility/fileSupport.js';
12
+ import ErrorHandler from '../../../Utility/errorHandler.js';
13
+ import { errorMessages } from '../../../constants/errorMessages.js';
14
+ /**
15
+ * Generates the boiler plate provardx-properties.json
16
+ *
17
+ */
18
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
19
+ const messages = Messages.loadMessages('@provartesting/provardx-cli', 'sf.provar.config.generate');
20
+ export default class SfProvarConfigGenerate extends SfCommand {
21
+ static summary = messages.getMessage('summary');
22
+ static description = messages.getMessage('description');
23
+ static examples = messages.getMessages('examples');
24
+ static flags = {
25
+ 'properties-file': Flags.string({
26
+ summary: messages.getMessage('flags.properties-file.summary'),
27
+ char: 'p',
28
+ required: true,
29
+ }),
30
+ 'no-prompt': Flags.boolean({
31
+ summary: messages.getMessage('flags.no-prompt.summary'),
32
+ char: 'n',
33
+ }),
34
+ };
35
+ errorHandler = new ErrorHandler();
36
+ async run() {
37
+ const { flags } = await this.parse(SfProvarConfigGenerate);
38
+ const PropertiesFileName = flags['properties-file'];
39
+ if (getExtension(PropertiesFileName) !== '.json') {
40
+ this.errorHandler.addErrorsToList('INVALID_FILE_EXTENSION', 'Only the .json file extension is supported.');
41
+ }
42
+ else if (fs.existsSync(PropertiesFileName) && !flags['no-prompt']) {
43
+ if (!(await this.confirm({ message: messages.getMessage('PropertiesFileOverwritePromptConfirm') }))) {
44
+ this.errorHandler.addErrorsToList('GENERATE_OPERATION_DENIED', errorMessages.GENERATE_OPERATION_DENIED);
45
+ }
46
+ else {
47
+ this.generatePropertiesFile(PropertiesFileName);
48
+ }
49
+ }
50
+ else {
51
+ this.generatePropertiesFile(PropertiesFileName);
52
+ }
53
+ return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
54
+ }
55
+ generatePropertiesFile(PropertiesFileName) {
56
+ try {
57
+ generateFile(PropertiesFileName);
58
+ /* eslint-disable */
59
+ }
60
+ catch (error) {
61
+ if (error.code === 'ENOENT') {
62
+ this.errorHandler.addErrorsToList('INVALID_PATH', errorMessages.INVALID_PATH);
63
+ }
64
+ else if (error.code === 'EPERM' || error.code === 'EACCES') {
65
+ this.errorHandler.addErrorsToList('INSUFFICIENT_PERMISSIONS', 'The user does not have permissions to create the file.');
66
+ }
67
+ }
68
+ }
69
+ }
70
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/commands/provar/config/generate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAyB,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,M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,KAAK,CAAC,WAAW,CAAC,EAAE;YACnE,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC,EAAE;gBACnG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,2BAA2B,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;aACzG;iBAAM;gBACL,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;aACjD;SACF;aAAM;YACL,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;SACjD;QAED,OAAO,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB,CAAC,kBAA0B;QACvD,IAAI;YACF,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,oBAAoB;SACrB;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC3B,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;aAC/E;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC5D,IAAI,CAAC,YAAY,CAAC,eAAe,CAC/B,0BAA0B,EAC1B,wDAAwD,CACzD,CAAC;aACH;SACF;IACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { SfProvarCommandResult } from '../../../../Utility/sfProvarCommandResult';
2
+ import { SfProvarCommandResult } from '../../../Utility/sfProvarCommandResult.js';
3
3
  export default class SfProvarConfigGet extends SfCommand<SfProvarCommandResult> {
4
4
  static readonly summary: string;
5
5
  static readonly description: string;