@provartesting/provardx-cli 1.1.0 → 1.1.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 (89) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +235 -10
  3. package/lib/commands/provar/automation/config/generate.d.ts +1 -1
  4. package/lib/commands/provar/automation/config/generate.js +1 -5
  5. package/lib/commands/provar/automation/config/generate.js.map +1 -1
  6. package/lib/commands/provar/automation/config/get.d.ts +1 -1
  7. package/lib/commands/provar/automation/config/get.js +1 -6
  8. package/lib/commands/provar/automation/config/get.js.map +1 -1
  9. package/lib/commands/provar/automation/config/load.d.ts +1 -1
  10. package/lib/commands/provar/automation/config/load.js +1 -6
  11. package/lib/commands/provar/automation/config/load.js.map +1 -1
  12. package/lib/commands/provar/automation/config/set.d.ts +1 -1
  13. package/lib/commands/provar/automation/config/set.js +1 -6
  14. package/lib/commands/provar/automation/config/set.js.map +1 -1
  15. package/lib/commands/provar/automation/config/validate.d.ts +1 -1
  16. package/lib/commands/provar/automation/config/validate.js +1 -4
  17. package/lib/commands/provar/automation/config/validate.js.map +1 -1
  18. package/oclif.manifest.json +1 -247
  19. package/package.json +10 -7
  20. package/lib/Utility/GenericError.d.ts +0 -11
  21. package/lib/Utility/GenericError.js +0 -26
  22. package/lib/Utility/GenericError.js.map +0 -1
  23. package/lib/Utility/TestRunError.d.ts +0 -8
  24. package/lib/Utility/TestRunError.js +0 -20
  25. package/lib/Utility/TestRunError.js.map +0 -1
  26. package/lib/Utility/errorCode.d.ts +0 -1
  27. package/lib/Utility/errorCode.js +0 -8
  28. package/lib/Utility/errorCode.js.map +0 -1
  29. package/lib/Utility/errorHandler.d.ts +0 -15
  30. package/lib/Utility/errorHandler.js +0 -22
  31. package/lib/Utility/errorHandler.js.map +0 -1
  32. package/lib/Utility/fileSupport.d.ts +0 -12
  33. package/lib/Utility/fileSupport.js +0 -63
  34. package/lib/Utility/fileSupport.js.map +0 -1
  35. package/lib/Utility/genericErrorHandler.d.ts +0 -10
  36. package/lib/Utility/genericErrorHandler.js +0 -22
  37. package/lib/Utility/genericErrorHandler.js.map +0 -1
  38. package/lib/Utility/jsonSupport.d.ts +0 -8
  39. package/lib/Utility/jsonSupport.js +0 -48
  40. package/lib/Utility/jsonSupport.js.map +0 -1
  41. package/lib/Utility/propertyFileValidator.d.ts +0 -13
  42. package/lib/Utility/propertyFileValidator.js +0 -85
  43. package/lib/Utility/propertyFileValidator.js.map +0 -1
  44. package/lib/Utility/provarConfig.d.ts +0 -12
  45. package/lib/Utility/provarConfig.js +0 -38
  46. package/lib/Utility/provarConfig.js.map +0 -1
  47. package/lib/Utility/provardxExecutor.d.ts +0 -7
  48. package/lib/Utility/provardxExecutor.js +0 -31
  49. package/lib/Utility/provardxExecutor.js.map +0 -1
  50. package/lib/Utility/sfProvarCommandResult.d.ts +0 -13
  51. package/lib/Utility/sfProvarCommandResult.js +0 -30
  52. package/lib/Utility/sfProvarCommandResult.js.map +0 -1
  53. package/lib/Utility/stringSupport.d.ts +0 -8
  54. package/lib/Utility/stringSupport.js +0 -37
  55. package/lib/Utility/stringSupport.js.map +0 -1
  56. package/lib/Utility/userSupport.d.ts +0 -16
  57. package/lib/Utility/userSupport.js +0 -66
  58. package/lib/Utility/userSupport.js.map +0 -1
  59. package/lib/commands/provar/automation/metadata/download.d.ts +0 -13
  60. package/lib/commands/provar/automation/metadata/download.js +0 -96
  61. package/lib/commands/provar/automation/metadata/download.js.map +0 -1
  62. package/lib/commands/provar/automation/project/compile.d.ts +0 -9
  63. package/lib/commands/provar/automation/project/compile.js +0 -69
  64. package/lib/commands/provar/automation/project/compile.js.map +0 -1
  65. package/lib/commands/provar/automation/setup.d.ts +0 -12
  66. package/lib/commands/provar/automation/setup.js +0 -65
  67. package/lib/commands/provar/automation/setup.js.map +0 -1
  68. package/lib/commands/provar/automation/test/run.d.ts +0 -13
  69. package/lib/commands/provar/automation/test/run.js +0 -156
  70. package/lib/commands/provar/automation/test/run.js.map +0 -1
  71. package/lib/constants/commandConstants.d.ts +0 -11
  72. package/lib/constants/commandConstants.js +0 -13
  73. package/lib/constants/commandConstants.js.map +0 -1
  74. package/lib/constants/errorMessages.d.ts +0 -15
  75. package/lib/constants/errorMessages.js +0 -23
  76. package/lib/constants/errorMessages.js.map +0 -1
  77. package/lib/constants/propertyFileContent.d.ts +0 -24
  78. package/lib/constants/propertyFileContent.js +0 -25
  79. package/lib/constants/propertyFileContent.js.map +0 -1
  80. package/lib/constants/propertyFileSchema.d.ts +0 -254
  81. package/lib/constants/propertyFileSchema.js +0 -248
  82. package/lib/constants/propertyFileSchema.js.map +0 -1
  83. package/lib/constants/sfCommandConstants.d.ts +0 -5
  84. package/lib/constants/sfCommandConstants.js +0 -7
  85. package/lib/constants/sfCommandConstants.js.map +0 -1
  86. package/messages/provar.automation.project.compile.md +0 -21
  87. package/messages/provar.automation.setup.md +0 -23
  88. package/messages/provar.automation.test.run.md +0 -19
  89. package/messages/provar.metadata.download.md +0 -23
@@ -1,85 +0,0 @@
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 * 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';
13
- /**
14
- * Contains code to load the config file and validation login for provardx-properties.json
15
- *
16
- */
17
- export default class PropertyFileValidator {
18
- validationResults;
19
- errorHandler;
20
- constructor(errorHandler) {
21
- this.errorHandler = errorHandler;
22
- }
23
- async validate() {
24
- const config = await ProvarConfig.loadConfig(this.errorHandler);
25
- const filePath = config.get('PROVARDX_PROPERTIES_FILE_PATH')?.toString();
26
- const missingRequiredProperties = [];
27
- const invalidPropertiesValue = [];
28
- if (filePath === undefined || !fileSystem.existsSync(filePath)) {
29
- this.errorHandler.addErrorsToList('MISSING_FILE', errorMessages.MISSING_FILE_ERROR);
30
- }
31
- else {
32
- /* eslint-disable */
33
- const jsonValidator = new Validator();
34
- try {
35
- this.validationResults = jsonValidator.validate(JSON.parse(fileSystem.readFileSync(filePath).toString()), propertyFileSchema);
36
- if (this.validationResults.errors.length > 0) {
37
- for (const validationError of this.validationResults.errors) {
38
- if (validationError.name === 'required') {
39
- let substring = substringAfter(validationError.property, '.');
40
- if (substring) {
41
- substring = substring.concat('.');
42
- }
43
- missingRequiredProperties.push(substring + validationError.argument);
44
- }
45
- else if (validationError.name === 'pattern') {
46
- let substring = substringAfter(validationError.property, '.');
47
- if (substring) {
48
- invalidPropertiesValue.push(substring);
49
- }
50
- }
51
- else if (validationError.name === 'enum' || validationError.name === 'type') {
52
- invalidPropertiesValue.push(substringAfter(validationError.property, '.'));
53
- }
54
- }
55
- }
56
- }
57
- catch (errors) {
58
- this.errorHandler.addErrorsToList('MALFORMED_FILE', errorMessages.MALFORMED_FILE_ERROR);
59
- return false;
60
- }
61
- const missingPropertiesCount = missingRequiredProperties.length;
62
- const invalidValuesCount = invalidPropertiesValue.length;
63
- if (missingPropertiesCount > 1) {
64
- this.errorHandler.addErrorsToList('MISSING_PROPERTIES', `The properties ${addQuotesAround(missingRequiredProperties).join(', ')} are missing.`);
65
- }
66
- else if (missingPropertiesCount == 1) {
67
- this.errorHandler.addErrorsToList('MISSING_PROPERTY', `The property ${addQuotesAround(missingRequiredProperties)} is missing.`);
68
- }
69
- if (invalidValuesCount > 1) {
70
- this.errorHandler.addErrorsToList('INVALID_VALUES', `The properties ${addQuotesAround(invalidPropertiesValue).join(', ')} values are not valid.`);
71
- }
72
- else if (invalidValuesCount == 1) {
73
- this.errorHandler.addErrorsToList('INVALID_VALUE', `The property ${addQuotesAround(invalidPropertiesValue)} value is not valid.`);
74
- }
75
- }
76
- if (this.errorHandler.getErrors().length > 0) {
77
- return false;
78
- }
79
- return true;
80
- }
81
- getValidationErrors() {
82
- return this.errorHandler.getErrors();
83
- }
84
- }
85
- //# sourceMappingURL=propertyFileValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propertyFileValidator.js","sourceRoot":"","sources":["../../src/Utility/propertyFileValidator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,UAAU,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;GAGG;AAEH,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACjC,iBAAiB,CAAmB;IACnC,YAAY,CAAe;IAEnC,YAAmB,YAA0B;QAC3C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,MAAM,MAAM,GAAiB,MAAM,YAAY,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,CAAC;YAC/D,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;QACtF,CAAC;aAAM,CAAC;YACN,oBAAoB;YACpB,MAAM,aAAa,GAAG,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import { Config } from '@salesforce/core';
2
- import ErrorHandler from './errorHandler.js';
3
- import GenericErrorHandler from './genericErrorHandler.js';
4
- /**
5
- * sfdxConfig extended class that deals with any operation over .sf/config.json.
6
- * ex: what all properties we can add to config.json.
7
- *
8
- */
9
- export declare class ProvarConfig extends Config {
10
- constructor();
11
- static loadConfig(errorHandler: ErrorHandler | GenericErrorHandler): Promise<ProvarConfig>;
12
- }
@@ -1,38 +0,0 @@
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 { Config, SfError } from '@salesforce/core';
8
- /**
9
- * sfdxConfig extended class that deals with any operation over .sf/config.json.
10
- * ex: what all properties we can add to config.json.
11
- *
12
- */
13
- export class ProvarConfig extends Config {
14
- constructor() {
15
- const option = { isGlobal: true, isState: true, filename: 'config.json', stateFolder: '.provardx' };
16
- const allowedProeprties = [];
17
- allowedProeprties.push({ key: 'PROVARDX_PROPERTIES_FILE_PATH', description: '' });
18
- ProvarConfig.addAllowedProperties(allowedProeprties);
19
- super(Object.assign({
20
- isGlobal: true,
21
- }, option));
22
- }
23
- static async loadConfig(errorHandler) {
24
- try {
25
- const config = await ProvarConfig.create();
26
- await config.read();
27
- return config;
28
- }
29
- catch (error) {
30
- if (error instanceof SfError) {
31
- // eslint-disable-next-line
32
- errorHandler.addErrorsToList(error.code, error.message);
33
- }
34
- throw error;
35
- }
36
- }
37
- }
38
- //# sourceMappingURL=provarConfig.js.map
@@ -1 +0,0 @@
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;AAIvE;;;;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,YAAgD;QAC7E,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;gBAC7B,2BAA2B;gBAC3B,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1D,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Executes the provided dx command.
3
- *
4
- * @param command Command string
5
- * @param message Message to be displayed while command execution is in progress.
6
- */
7
- export declare function executeCommand(command: string, message: string): Promise<any>;
@@ -1,31 +0,0 @@
1
- import { promisify } from 'node:util';
2
- import { exec } from 'node:child_process';
3
- import { cli } from 'cli-ux';
4
- /**
5
- * Executes the provided dx command.
6
- *
7
- * @param command Command string
8
- * @param message Message to be displayed while command execution is in progress.
9
- */
10
- /* eslint-disable */
11
- export async function executeCommand(command, message) {
12
- if (message) {
13
- cli.action.start(message);
14
- }
15
- let isSucessful = false;
16
- const execPromise = promisify(exec);
17
- try {
18
- const result = await execPromise(command);
19
- isSucessful = true;
20
- return result.stdout;
21
- }
22
- catch (e) {
23
- return e.stdout;
24
- }
25
- finally {
26
- if (message) {
27
- cli.action.stop(isSucessful ? 'successful' : 'failed');
28
- }
29
- }
30
- }
31
- //# sourceMappingURL=provardxExecutor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provardxExecutor.js","sourceRoot":"","sources":["../../src/Utility/provardxExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B;;;;;GAKG;AACH,oBAAoB;AACpB,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,OAAe;IACnE,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1C,WAAW,GAAG,IAAI,CAAC;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,CAAC;YACZ,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,13 +0,0 @@
1
- import { Messages } from '@salesforce/core';
2
- import ErrorHandler, { Error } from './errorHandler.js';
3
- import GenericErrorHandler from './genericErrorHandler.js';
4
- /**
5
- * Declaring return type and populating return object for async run method of the commands.
6
- *
7
- */
8
- export type SfProvarCommandResult = {
9
- success: boolean;
10
- value?: string;
11
- errors?: Error[] | object[];
12
- };
13
- export declare function populateResult(flags: any, errorHandler: ErrorHandler | GenericErrorHandler, messages: Messages<string>, log: Function, value?: string): SfProvarCommandResult;
@@ -1,30 +0,0 @@
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
- /* eslint-disable */
8
- export function populateResult(flags, errorHandler, messages, log, value) {
9
- let result = { success: true };
10
- const errorObjects = errorHandler.getErrors();
11
- if (errorObjects.length > 0) {
12
- if (!flags['json']) {
13
- throw messages.createError('error.MultipleFailure', errorHandler.errorsToStringArray());
14
- }
15
- result = {
16
- success: false,
17
- errors: errorObjects,
18
- };
19
- }
20
- else {
21
- messages.messages.has('success_message') ? log(messages.getMessage('success_message')) : '';
22
- value != null ? log(value) : '';
23
- result = {
24
- success: true,
25
- value: value,
26
- };
27
- }
28
- return result;
29
- }
30
- //# sourceMappingURL=sfProvarCommandResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sfProvarCommandResult.js","sourceRoot":"","sources":["../../src/Utility/sfProvarCommandResult.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,oBAAoB;AACpB,MAAM,UAAU,cAAc,CAC5B,KAAU,EACV,YAAgD,EAChD,QAA0B,EAC1B,GAAa,EACb,KAAc;IAEd,IAAI,MAAM,GAA0B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEtD,MAAM,YAAY,GAAuB,YAAY,CAAC,SAAS,EAAE,CAAC;IAClE,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACnB,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,EAAE,YAAY,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,GAAG;YACP,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,YAAY;SACrB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG;YACP,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Deals with the custom operations on strings.
3
- *
4
- */
5
- export declare function substringAfter(str: string, separator: string): string;
6
- export declare function addQuotesAround(array: string[]): string[];
7
- export declare function removeSpaces(str: string): string;
8
- export declare function getStringAfterSubstring(content: string, searchString: string): string;
@@ -1,37 +0,0 @@
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
- /**
8
- * Deals with the custom operations on strings.
9
- *
10
- */
11
- export function substringAfter(str, separator) {
12
- if (!str) {
13
- return str;
14
- }
15
- if (separator == null) {
16
- return '';
17
- }
18
- const pos = str.indexOf(separator);
19
- if (pos === -1) {
20
- return '';
21
- }
22
- return str.substring(pos + separator.length);
23
- }
24
- export function addQuotesAround(array) {
25
- return array.map((item) => "'" + item + "'");
26
- }
27
- export function removeSpaces(str) {
28
- return str.replace(/\s/g, '');
29
- }
30
- export function getStringAfterSubstring(content, searchString) {
31
- const index = content.toLowerCase().indexOf(searchString.toLowerCase());
32
- if (index === -1) {
33
- return '';
34
- }
35
- return content.slice(index + searchString.length);
36
- }
37
- //# sourceMappingURL=stringSupport.js.map
@@ -1 +0,0 @@
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,CAAC;QACT,OAAO,GAAG,CAAC;IACb,CAAC;IACD,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,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;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAe,EAAE,YAAoB;IAC3E,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACxE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC"}
@@ -1,16 +0,0 @@
1
- import ErrorHandler from './errorHandler.js';
2
- import GenericErrorHandler from './genericErrorHandler.js';
3
- export default class UserSupport {
4
- /**
5
- * Updates the dx properties json string before it is send to command executer.
6
- */
7
- prepareRawProperties(rawProperties: string): string;
8
- /**
9
- * Gets the dx user info and generated the password for dx user if not already created.
10
- *
11
- * @param overrides Connection overrides provided in dx property file.
12
- */
13
- getDxUsersInfo(overrides: any, errorHandler: ErrorHandler | GenericErrorHandler): Promise<any>;
14
- private generatePasswordIfNotPresent;
15
- private handleSpecialCharacters;
16
- }
@@ -1,66 +0,0 @@
1
- import { sfCommandConstants } from '../constants/sfCommandConstants.js';
2
- import GenericErrorHandler from './genericErrorHandler.js';
3
- import { GenericError } from './GenericError.js';
4
- import { executeCommand } from './provardxExecutor.js';
5
- export default class UserSupport {
6
- /**
7
- * Updates the dx properties json string before it is send to command executer.
8
- */
9
- /* eslint-disable */
10
- prepareRawProperties(rawProperties) {
11
- return '"' + rawProperties.replace(/"/g, '\\"') + '"';
12
- }
13
- /**
14
- * Gets the dx user info and generated the password for dx user if not already created.
15
- *
16
- * @param overrides Connection overrides provided in dx property file.
17
- */
18
- async getDxUsersInfo(overrides, errorHandler) {
19
- const dxUsers = [];
20
- if (overrides === undefined || overrides.length === 0) {
21
- return dxUsers;
22
- }
23
- for (const override of overrides) {
24
- const username = override.username;
25
- const message = 'Validating and retrieving dx user info: ' + username;
26
- let dxUserInfo = await executeCommand(sfCommandConstants.DISPLAY_USER_INFO + username, message);
27
- let jsonDxUser = JSON.parse(dxUserInfo);
28
- if (jsonDxUser.status !== 0) {
29
- if (errorHandler instanceof GenericErrorHandler) {
30
- const errorObj = new GenericError();
31
- errorObj.setCode('DOWNLOAD_ERROR');
32
- errorObj.setMessage(`The following connectionOverride username is not valid: ${username}`);
33
- errorHandler.addErrorsToList(errorObj);
34
- }
35
- else {
36
- errorHandler.addErrorsToList('DOWNLOAD_ERROR', `The following connectionOverride username is not valid: ${username}`);
37
- }
38
- continue;
39
- }
40
- ({ jsonDxUser, dxUserInfo } = await this.generatePasswordIfNotPresent(jsonDxUser, username, dxUserInfo));
41
- jsonDxUser.result.connection = override['connection'];
42
- jsonDxUser.result.password = this.handleSpecialCharacters(jsonDxUser.result.password);
43
- dxUsers.push(jsonDxUser);
44
- }
45
- if (dxUsers.length === 0) {
46
- return null;
47
- }
48
- return dxUsers;
49
- }
50
- async generatePasswordIfNotPresent(jsonDxUser, username, dxUserInfo) {
51
- if (jsonDxUser.result.password == null) {
52
- const generatePasswordCommand = sfCommandConstants.GENERATE_PASSWORD + username;
53
- await executeCommand(generatePasswordCommand, 'Generating password for user: ' + username);
54
- dxUserInfo = await executeCommand(sfCommandConstants.DISPLAY_USER_INFO + username, 'Getting generated password for user: ' + username);
55
- jsonDxUser = JSON.parse(dxUserInfo.toString());
56
- }
57
- return { jsonDxUser, dxUserInfo };
58
- }
59
- handleSpecialCharacters(password) {
60
- if (password) {
61
- password = encodeURIComponent(password);
62
- }
63
- return password;
64
- }
65
- }
66
- //# sourceMappingURL=userSupport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userSupport.js","sourceRoot":"","sources":["../../src/Utility/userSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B;;OAEG;IACH,oBAAoB;IACb,oBAAoB,CAAC,aAAqB;QAC/C,OAAO,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC;IACxD,CAAC;I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QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtF,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,4BAA4B,CAAC,UAAe,EAAE,QAAa,EAAE,UAAe;QACxF,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YACvC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,iBAAiB,GAAG,QAAQ,CAAC;YAChF,MAAM,cAAc,CAAC,uBAAuB,EAAE,gCAAgC,GAAG,QAAQ,CAAC,CAAC;YAC3F,UAAU,GAAG,MAAM,cAAc,CAC/B,kBAAkB,CAAC,iBAAiB,GAAG,QAAQ,EAC/C,uCAAuC,GAAG,QAAQ,CACnD,CAAC;YACF,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;IACpC,CAAC;IAEO,uBAAuB,CAAC,QAAgB;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { SfProvarCommandResult } from '../../../../Utility/sfProvarCommandResult.js';
3
- export default class ProvarMetadataDownload extends SfCommand<SfProvarCommandResult> {
4
- static readonly summary: string;
5
- static readonly description: string;
6
- static readonly examples: string[];
7
- static readonly flags: {
8
- connections: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- };
10
- private errorHandler;
11
- run(): Promise<SfProvarCommandResult>;
12
- private doConnectionOverrides;
13
- }
@@ -1,96 +0,0 @@
1
- import fileSystem from 'node:fs';
2
- import { spawnSync } from 'node:child_process';
3
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
4
- import { Messages } from '@salesforce/core';
5
- import ErrorHandler from '../../../../Utility/errorHandler.js';
6
- import { ProvarConfig } from '../../../../Utility/provarConfig.js';
7
- import { errorMessages } from '../../../../constants/errorMessages.js';
8
- import { populateResult } from '../../../../Utility/sfProvarCommandResult.js';
9
- import UserSupport from '../../../../Utility/userSupport.js';
10
- import { fileContainsString } from '../../../../Utility/fileSupport.js';
11
- import { removeSpaces, getStringAfterSubstring } from '../../../../Utility/stringSupport.js';
12
- import { sfCommandConstants } from '../../../../constants/sfCommandConstants.js';
13
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
14
- const messages = Messages.loadMessages('@provartesting/provardx-cli', 'provar.metadata.download');
15
- export default class ProvarMetadataDownload extends SfCommand {
16
- static summary = messages.getMessage('summary');
17
- static description = messages.getMessage('description');
18
- static examples = messages.getMessages('examples');
19
- static flags = {
20
- connections: Flags.string({
21
- summary: messages.getMessage('flags.connections.summary'),
22
- char: 'c',
23
- required: true,
24
- }),
25
- };
26
- errorHandler = new ErrorHandler();
27
- async run() {
28
- const { flags } = await this.parse(ProvarMetadataDownload);
29
- const config = await ProvarConfig.loadConfig(this.errorHandler);
30
- const propertiesFilePath = config.get('PROVARDX_PROPERTIES_FILE_PATH')?.toString();
31
- if (propertiesFilePath === undefined || !fileSystem.existsSync(propertiesFilePath)) {
32
- this.errorHandler.addErrorsToList('MISSING_FILE', errorMessages.MISSING_FILE_ERROR);
33
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
34
- }
35
- try {
36
- const propertiesdata = fileSystem.readFileSync(propertiesFilePath, { encoding: 'utf8' });
37
- /* eslint-disable */
38
- const propertiesInstance = JSON.parse(propertiesdata);
39
- if (flags.connections) {
40
- propertiesInstance.connectionName = removeSpaces(flags.connections);
41
- }
42
- this.doConnectionOverrides(propertiesInstance);
43
- const rawProperties = JSON.stringify(propertiesInstance);
44
- const userSupport = new UserSupport();
45
- const updateProperties = userSupport.prepareRawProperties(rawProperties);
46
- const userInfo = await userSupport.getDxUsersInfo(propertiesInstance.connectionOverride, this.errorHandler);
47
- if (userInfo === null) {
48
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
49
- }
50
- const userInfoString = userSupport.prepareRawProperties(JSON.stringify({ dxUsers: userInfo }));
51
- const provarDxJarPath = propertiesInstance.provarHome + '/provardx/provardx.jar';
52
- const downloadMetadatacommand = 'java -cp "' +
53
- provarDxJarPath +
54
- '"' +
55
- sfCommandConstants.DX_COMMAND_EXECUTER +
56
- updateProperties +
57
- ' ' +
58
- userInfoString +
59
- ' Metadata';
60
- const javaProcessOutput = spawnSync(downloadMetadatacommand, { shell: true });
61
- const downloadSuccessMessage = 'Download completed successfully';
62
- if (!fileContainsString(javaProcessOutput.stderr.toString(), downloadSuccessMessage)) {
63
- const errorMessage = `ERROR${getStringAfterSubstring(javaProcessOutput.stderr.toString(), 'ERROR')}`;
64
- this.errorHandler.addErrorsToList('DOWNLOAD_ERROR', `${errorMessage}`);
65
- }
66
- }
67
- catch (error) {
68
- if (error.name === 'SyntaxError') {
69
- this.errorHandler.addErrorsToList('MALFORMED_FILE', errorMessages.MALFORMED_FILE_ERROR);
70
- }
71
- else if (error.name === 'MultipleFailureError') {
72
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
73
- }
74
- else {
75
- this.errorHandler.addErrorsToList('DOWNLOAD_ERROR', `${error.errorMessage}`);
76
- }
77
- }
78
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
79
- }
80
- doConnectionOverrides(properties) {
81
- if (!properties.connectionOverride && !properties.connectionName) {
82
- return;
83
- }
84
- if (properties.connectionName && properties.connectionOverride) {
85
- const connections = properties.connectionName.split(',');
86
- const connectionOverride = [];
87
- for (const override of properties.connectionOverride) {
88
- if (connections.indexOf(override.connection) !== -1) {
89
- connectionOverride.push(override);
90
- }
91
- }
92
- properties.connectionOverride = connectionOverride;
93
- }
94
- }
95
- }
96
- //# sourceMappingURL=download.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../../src/commands/provar/automation/metadata/download.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAyB,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,0BAA0B,CAAC,CAAC;AAElG,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAgC;IAC3E,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,C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AAI,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;oBACpD,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;YACD,UAAU,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QACrD,CAAC;IACH,CAAC"}
@@ -1,9 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { SfProvarCommandResult } from '../../../../Utility/sfProvarCommandResult.js';
3
- export default class ProvarAutomationProjectCompile extends SfCommand<SfProvarCommandResult> {
4
- static readonly summary: string;
5
- static readonly description: string;
6
- static readonly examples: string[];
7
- private errorHandler;
8
- run(): Promise<SfProvarCommandResult>;
9
- }
@@ -1,69 +0,0 @@
1
- import * as fileSystem from 'node:fs';
2
- import { spawnSync } from 'node:child_process';
3
- import { SfCommand } from '@salesforce/sf-plugins-core';
4
- import { Messages } from '@salesforce/core';
5
- import { populateResult } from '../../../../Utility/sfProvarCommandResult.js';
6
- import ErrorHandler from '../../../../Utility/errorHandler.js';
7
- import { ProvarConfig } from '../../../../Utility/provarConfig.js';
8
- import { errorMessages } from '../../../../constants/errorMessages.js';
9
- import UserSupport from '../../../../Utility/userSupport.js';
10
- import { fileContainsString } from '../../../../Utility/fileSupport.js';
11
- import { getStringAfterSubstring } from '../../../../Utility/stringSupport.js';
12
- import { sfCommandConstants } from '../../../../constants/sfCommandConstants.js';
13
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
14
- const messages = Messages.loadMessages('@provartesting/provardx-cli', 'provar.automation.project.compile');
15
- export default class ProvarAutomationProjectCompile extends SfCommand {
16
- static summary = messages.getMessage('summary');
17
- static description = messages.getMessage('description');
18
- static examples = messages.getMessages('examples');
19
- errorHandler = new ErrorHandler();
20
- async run() {
21
- const { flags } = await this.parse(ProvarAutomationProjectCompile);
22
- const config = await ProvarConfig.loadConfig(this.errorHandler);
23
- const propertiesFilePath = config.get('PROVARDX_PROPERTIES_FILE_PATH')?.toString();
24
- if (propertiesFilePath === undefined || !fileSystem.existsSync(propertiesFilePath)) {
25
- this.errorHandler.addErrorsToList('MISSING_FILE', errorMessages.MISSING_FILE_ERROR);
26
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
27
- }
28
- try {
29
- /* eslint-disable */
30
- const propertiesdata = fileSystem.readFileSync(propertiesFilePath, { encoding: 'utf8' });
31
- const propertiesInstance = JSON.parse(propertiesdata);
32
- const rawProperties = JSON.stringify(propertiesInstance);
33
- const userSupport = new UserSupport();
34
- const updateProperties = userSupport.prepareRawProperties(rawProperties);
35
- const provarDxJarPath = propertiesInstance.provarHome + '/provardx/provardx.jar';
36
- const projectCompilecommand = 'java -cp "' +
37
- provarDxJarPath +
38
- '"' +
39
- sfCommandConstants.DX_COMMAND_EXECUTER +
40
- updateProperties +
41
- ' ' +
42
- 'NA' +
43
- ' ' +
44
- 'Compile';
45
- const javaProcessOutput = spawnSync(projectCompilecommand, { shell: true });
46
- const compileSuccessMessage = 'Compile task finished sucessfully.';
47
- if (!fileContainsString(javaProcessOutput.stderr.toString(), compileSuccessMessage)) {
48
- let errorMessage = getStringAfterSubstring(javaProcessOutput.stderr.toString(), 'ERROR');
49
- if (!errorMessage) {
50
- errorMessage = getStringAfterSubstring(javaProcessOutput.stderr.toString(), 'Compilation task failed.');
51
- }
52
- this.errorHandler.addErrorsToList('COMPILATION_ERROR', `${errorMessage}`);
53
- }
54
- }
55
- catch (error) {
56
- if (error.name === 'SyntaxError') {
57
- this.errorHandler.addErrorsToList('MALFORMED_FILE', errorMessages.MALFORMED_FILE_ERROR);
58
- }
59
- else if (error.name === 'MultipleFailureError') {
60
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
61
- }
62
- else {
63
- this.errorHandler.addErrorsToList('COMPILATION_ERROR', `${error.errorMessage}`);
64
- }
65
- }
66
- return populateResult(flags, this.errorHandler, messages, this.log.bind(this));
67
- }
68
- }
69
- //# sourceMappingURL=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-1,12 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { SfProvarCommandResult } from '../../../Utility/sfProvarCommandResult.js';
3
- export default class ProvarAutomationSetup extends SfCommand<SfProvarCommandResult> {
4
- static readonly summary: string;
5
- static readonly description: string;
6
- static readonly examples: string[];
7
- static readonly flags: {
8
- version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- };
10
- private errorHandler;
11
- run(): Promise<SfProvarCommandResult>;
12
- }