sf-delta-tests 0.0.21 → 0.0.23
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.
- package/README.md +146 -146
- package/lib/commands/delta/test-classes.js +7 -3
- package/lib/commands/delta/test-classes.js.map +1 -1
- package/lib/elements/object-types.d.ts +1 -0
- package/lib/elements/object-types.js +5 -1
- package/lib/elements/object-types.js.map +1 -1
- package/lib/services/apex-class-service.js +1 -0
- package/lib/services/apex-class-service.js.map +1 -1
- package/lib/services/cli-service.js +2 -2
- package/lib/services/dependency-service.d.ts +0 -1
- package/lib/services/dependency-service.js +10 -42
- package/lib/services/dependency-service.js.map +1 -1
- package/lib/services/dependency-services.test.js +2 -5
- package/lib/services/dependency-services.test.js.map +1 -1
- package/lib/services/output-service.d.ts +0 -1
- package/lib/services/output-service.js +0 -12
- package/lib/services/output-service.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
# sf-delta-tests
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/focus-tests) [](https://npmjs.org/package/focus-tests) [](https://raw.githubusercontent.com/salesforcecli/focus-tests/main/LICENSE.txt)
|
|
4
|
-
|
|
5
|
-
## Using the template
|
|
6
|
-
|
|
7
|
-
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
|
|
8
|
-
|
|
9
|
-
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
|
|
10
|
-
2. Generate your plugin:
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
sf plugins install dev
|
|
14
|
-
sf dev generate plugin
|
|
15
|
-
|
|
16
|
-
git init -b main
|
|
17
|
-
git add . && git commit -m "chore: initial commit"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
3. Create your plugin's repo in the salesforcecli github org
|
|
21
|
-
4. When you're ready, replace the contents of this README with the information you want.
|
|
22
|
-
|
|
23
|
-
## Learn about `sf` plugins
|
|
24
|
-
|
|
25
|
-
Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
|
|
26
|
-
|
|
27
|
-
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
|
|
28
|
-
|
|
29
|
-
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
|
|
30
|
-
|
|
31
|
-
### Tooling
|
|
32
|
-
|
|
33
|
-
- [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
|
|
34
|
-
- [@salesforce/kit](https://github.com/forcedotcom/kit)
|
|
35
|
-
- [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
|
|
36
|
-
- [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
|
|
37
|
-
- [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
|
|
38
|
-
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
|
|
39
|
-
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
|
|
40
|
-
|
|
41
|
-
### Hooks
|
|
42
|
-
|
|
43
|
-
For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
|
|
44
|
-
|
|
45
|
-
This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
|
|
46
|
-
|
|
47
|
-
# Everything past here is only a suggestion as to what should be in your specific plugin's description
|
|
48
|
-
|
|
49
|
-
This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
|
|
50
|
-
|
|
51
|
-
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
|
|
52
|
-
|
|
53
|
-
## Install
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
sf plugins install focus-tests@x.y.z
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Issues
|
|
60
|
-
|
|
61
|
-
Please report any issues at https://github.com/forcedotcom/cli/issues
|
|
62
|
-
|
|
63
|
-
## Contributing
|
|
64
|
-
|
|
65
|
-
1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
66
|
-
2. Create a new issue before starting your project so that we can keep track of
|
|
67
|
-
what you are trying to add/fix. That way, we can also offer suggestions or
|
|
68
|
-
let you know if there is already an effort in progress.
|
|
69
|
-
3. Fork this repository.
|
|
70
|
-
4. [Build the plugin locally](#build)
|
|
71
|
-
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
|
|
72
|
-
6. Edit the code in your fork.
|
|
73
|
-
7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
|
|
74
|
-
8. Sign CLA (see [CLA](#cla) below).
|
|
75
|
-
9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
|
|
76
|
-
|
|
77
|
-
### CLA
|
|
78
|
-
|
|
79
|
-
External contributors will be required to sign a Contributor's License
|
|
80
|
-
Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
|
|
81
|
-
|
|
82
|
-
### Build
|
|
83
|
-
|
|
84
|
-
To build the plugin locally, make sure to have yarn installed and run the following commands:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
# Clone the repository
|
|
88
|
-
git clone git@github.com:salesforcecli/focus-tests
|
|
89
|
-
|
|
90
|
-
# Install the dependencies and compile
|
|
91
|
-
yarn && yarn build
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
# Run using local run file.
|
|
98
|
-
./bin/dev hello world
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
# Link your plugin to the sf cli
|
|
105
|
-
sf plugins link .
|
|
106
|
-
# To verify
|
|
107
|
-
sf plugins
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Commands
|
|
111
|
-
|
|
112
|
-
<!-- commands -->
|
|
113
|
-
|
|
114
|
-
- [`sf delta test-classes`](#sf-delta-test-classes)
|
|
115
|
-
|
|
116
|
-
## `sf delta test-classes`
|
|
117
|
-
|
|
118
|
-
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
USAGE
|
|
122
|
-
$ sf delta test-classes -o <value> -c <value> [--json] [-n <value>]
|
|
123
|
-
|
|
124
|
-
FLAGS
|
|
125
|
-
-c, --changed-metadata=<value> (required) Comma seperated list of changed metadata.
|
|
126
|
-
-n, --name=<value> Description of a flag.
|
|
127
|
-
-o, --target-org=<value> (required) The org you want to check the dependencies against.
|
|
128
|
-
|
|
129
|
-
GLOBAL FLAGS
|
|
130
|
-
--json Format output as json.
|
|
131
|
-
|
|
132
|
-
DESCRIPTION
|
|
133
|
-
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
134
|
-
|
|
135
|
-
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
136
|
-
|
|
137
|
-
EXAMPLES
|
|
138
|
-
$ sf delta test-classes
|
|
139
|
-
|
|
140
|
-
FLAG DESCRIPTIONS
|
|
141
|
-
-n, --name=<value> Description of a flag.
|
|
142
|
-
|
|
143
|
-
More information about a flag. Don't repeat the summary.
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
<!-- commandsstop -->
|
|
1
|
+
# sf-delta-tests
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/focus-tests) [](https://npmjs.org/package/focus-tests) [](https://raw.githubusercontent.com/salesforcecli/focus-tests/main/LICENSE.txt)
|
|
4
|
+
|
|
5
|
+
## Using the template
|
|
6
|
+
|
|
7
|
+
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
|
|
8
|
+
|
|
9
|
+
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
|
|
10
|
+
2. Generate your plugin:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
sf plugins install dev
|
|
14
|
+
sf dev generate plugin
|
|
15
|
+
|
|
16
|
+
git init -b main
|
|
17
|
+
git add . && git commit -m "chore: initial commit"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. Create your plugin's repo in the salesforcecli github org
|
|
21
|
+
4. When you're ready, replace the contents of this README with the information you want.
|
|
22
|
+
|
|
23
|
+
## Learn about `sf` plugins
|
|
24
|
+
|
|
25
|
+
Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
|
|
26
|
+
|
|
27
|
+
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
|
|
28
|
+
|
|
29
|
+
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
|
|
30
|
+
|
|
31
|
+
### Tooling
|
|
32
|
+
|
|
33
|
+
- [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
|
|
34
|
+
- [@salesforce/kit](https://github.com/forcedotcom/kit)
|
|
35
|
+
- [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
|
|
36
|
+
- [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
|
|
37
|
+
- [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
|
|
38
|
+
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
|
|
39
|
+
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
|
|
40
|
+
|
|
41
|
+
### Hooks
|
|
42
|
+
|
|
43
|
+
For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
|
|
44
|
+
|
|
45
|
+
This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
|
|
46
|
+
|
|
47
|
+
# Everything past here is only a suggestion as to what should be in your specific plugin's description
|
|
48
|
+
|
|
49
|
+
This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
|
|
50
|
+
|
|
51
|
+
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
sf plugins install focus-tests@x.y.z
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Issues
|
|
60
|
+
|
|
61
|
+
Please report any issues at https://github.com/forcedotcom/cli/issues
|
|
62
|
+
|
|
63
|
+
## Contributing
|
|
64
|
+
|
|
65
|
+
1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
66
|
+
2. Create a new issue before starting your project so that we can keep track of
|
|
67
|
+
what you are trying to add/fix. That way, we can also offer suggestions or
|
|
68
|
+
let you know if there is already an effort in progress.
|
|
69
|
+
3. Fork this repository.
|
|
70
|
+
4. [Build the plugin locally](#build)
|
|
71
|
+
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
|
|
72
|
+
6. Edit the code in your fork.
|
|
73
|
+
7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
|
|
74
|
+
8. Sign CLA (see [CLA](#cla) below).
|
|
75
|
+
9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
|
|
76
|
+
|
|
77
|
+
### CLA
|
|
78
|
+
|
|
79
|
+
External contributors will be required to sign a Contributor's License
|
|
80
|
+
Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
|
|
81
|
+
|
|
82
|
+
### Build
|
|
83
|
+
|
|
84
|
+
To build the plugin locally, make sure to have yarn installed and run the following commands:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Clone the repository
|
|
88
|
+
git clone git@github.com:salesforcecli/focus-tests
|
|
89
|
+
|
|
90
|
+
# Install the dependencies and compile
|
|
91
|
+
yarn && yarn build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Run using local run file.
|
|
98
|
+
./bin/dev hello world
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Link your plugin to the sf cli
|
|
105
|
+
sf plugins link .
|
|
106
|
+
# To verify
|
|
107
|
+
sf plugins
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
<!-- commands -->
|
|
113
|
+
|
|
114
|
+
- [`sf delta test-classes`](#sf-delta-test-classes)
|
|
115
|
+
|
|
116
|
+
## `sf delta test-classes`
|
|
117
|
+
|
|
118
|
+
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
USAGE
|
|
122
|
+
$ sf delta test-classes -o <value> -c <value> [--json] [-n <value>]
|
|
123
|
+
|
|
124
|
+
FLAGS
|
|
125
|
+
-c, --changed-metadata=<value> (required) Comma seperated list of changed metadata.
|
|
126
|
+
-n, --name=<value> Description of a flag.
|
|
127
|
+
-o, --target-org=<value> (required) The org you want to check the dependencies against.
|
|
128
|
+
|
|
129
|
+
GLOBAL FLAGS
|
|
130
|
+
--json Format output as json.
|
|
131
|
+
|
|
132
|
+
DESCRIPTION
|
|
133
|
+
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
134
|
+
|
|
135
|
+
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
136
|
+
|
|
137
|
+
EXAMPLES
|
|
138
|
+
$ sf delta test-classes
|
|
139
|
+
|
|
140
|
+
FLAG DESCRIPTIONS
|
|
141
|
+
-n, --name=<value> Description of a flag.
|
|
142
|
+
|
|
143
|
+
More information about a flag. Don't repeat the summary.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
<!-- commandsstop -->
|
|
@@ -25,10 +25,12 @@ class TestClasses extends sf_plugins_core_1.SfCommand {
|
|
|
25
25
|
const org = flags['target-org'];
|
|
26
26
|
const conn = org.getConnection(undefined);
|
|
27
27
|
this.dependencyService.connect(conn);
|
|
28
|
+
this.debug('Getting dependencies from SF');
|
|
28
29
|
// Download all dependencies from SF
|
|
29
30
|
const combinedApexClassData = await this.dependencyService.getDependenciesByObjects();
|
|
30
31
|
// Write into output folder
|
|
31
32
|
await this.outputService.dependencyData(combinedApexClassData);
|
|
33
|
+
this.debug(`Loading metadata from ${flags['package-path']}`);
|
|
32
34
|
// Get manifest data and transform that into a list of metadata
|
|
33
35
|
const manifestData = await this.manifestService.parseManifest(flags['package-path']);
|
|
34
36
|
const changedMetadata = this.manifestService.extractMetadataComponents(manifestData);
|
|
@@ -48,24 +50,25 @@ class TestClasses extends sf_plugins_core_1.SfCommand {
|
|
|
48
50
|
this.log(this.cliService.allTests());
|
|
49
51
|
return { testNames: [], cli: this.cliService.allTests() };
|
|
50
52
|
}
|
|
53
|
+
this.debug('Calculating the related apex classes...');
|
|
51
54
|
// The magic function. From the changed metadata get all the Apex Classes that could be connected to the changed metadata
|
|
52
55
|
const classList = this.dependencyService.getRelatedApexClasses(combinedApexClassData, changedMetadata);
|
|
53
56
|
this.debug({ classList });
|
|
57
|
+
this.debug('Filtering the apex classes to only tests...');
|
|
54
58
|
// Filter the total class list to only tests
|
|
55
59
|
const testNames = await this.apexClassService.filterApexTest(classList);
|
|
56
60
|
const simpleTestNames = this.apexClassService.filterApexTestSimple(classList);
|
|
57
|
-
this.debug({
|
|
61
|
+
this.debug({ testNames, simpleTestNames });
|
|
58
62
|
if (testNames.length === 0) {
|
|
59
63
|
this.debug('No relevant tests found, skip running tests');
|
|
60
64
|
// TODO: Debate this one, if we found no relevant tests, should all or none be ran?
|
|
61
65
|
this.log(this.cliService.noTests());
|
|
62
66
|
return {
|
|
63
|
-
testNames
|
|
67
|
+
testNames,
|
|
64
68
|
cli: this.cliService.noTests(),
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
71
|
this.debug(`Found meaningful and related tests: ${testNames.join(', ')}`);
|
|
68
|
-
// Actual meaningful output
|
|
69
72
|
this.log(this.cliService.specificTests(testNames));
|
|
70
73
|
return {
|
|
71
74
|
testNames,
|
|
@@ -85,6 +88,7 @@ TestClasses.summary = messages.getMessage('summary');
|
|
|
85
88
|
TestClasses.description = messages.getMessage('description');
|
|
86
89
|
TestClasses.examples = messages.getMessages('examples');
|
|
87
90
|
// TODO: Add in parameters to tune the max revision depth, max changed metadata
|
|
91
|
+
// TODO: Add in parameters to allow fetching other object types for dependencies and meaningful types
|
|
88
92
|
TestClasses.flags = {
|
|
89
93
|
'target-org': sf_plugins_core_1.Flags.requiredOrg({
|
|
90
94
|
summary: messages.getMessage('flags.target-org.summary'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-classes.js","sourceRoot":"","sources":["../../../src/commands/delta/test-classes.ts"],"names":[],"mappings":";;AAAA,iEAA+D;AAC/D,2CAA4C;AAE5C,0EAAsE;AACtE,0EAAqE;AACrE,sEAAkE;AAClE,kEAA8D;AAC9D,4DAAwD;AAExD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AAO/E,MAAqB,WAAY,SAAQ,2BAAiC;
|
|
1
|
+
{"version":3,"file":"test-classes.js","sourceRoot":"","sources":["../../../src/commands/delta/test-classes.ts"],"names":[],"mappings":";;AAAA,iEAA+D;AAC/D,2CAA4C;AAE5C,0EAAsE;AACtE,0EAAqE;AACrE,sEAAkE;AAClE,kEAA8D;AAC9D,4DAAwD;AAExD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AAO/E,MAAqB,WAAY,SAAQ,2BAAiC;IA0BxE,YACE,IAAc,EACd,MAAc,EACd,iBAAiB,GAAG,IAAI,sCAAiB,EAAE,EAC3C,gBAAgB,GAAG,IAAI,qCAAgB,EAAE,EACzC,aAAa,GAAG,IAAI,8BAAa,EAAE,EACnC,eAAe,GAAG,IAAI,kCAAe,EAAE,EACvC,UAAU,GAAG,IAAI,wBAAU,EAAE;QAE7B,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAC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C3B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;QAC1D,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,sBAAsB;KAChC,CAAC;CACH,CAAC;kBAlBiB,WAAW"}
|
|
@@ -4,5 +4,6 @@ export declare const CUSTOM_OBJECT = "CustomObject";
|
|
|
4
4
|
export declare const FLOW = "Flow";
|
|
5
5
|
export declare const LIGHTNING_COMPONENT_BUNDLE = "LightningComponentBundle";
|
|
6
6
|
export declare const AURA_DEFINITION_BUNDLE = "AuraDefinitionBundle";
|
|
7
|
+
export declare const CUSTOM_METADATA = "CustomMetadata";
|
|
7
8
|
export declare const defaultTypesToFetchFromDependencyServer: string[];
|
|
8
9
|
export declare const meaningfulMetadataChanges: string[];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.meaningfulMetadataChanges = exports.defaultTypesToFetchFromDependencyServer = exports.AURA_DEFINITION_BUNDLE = exports.LIGHTNING_COMPONENT_BUNDLE = exports.FLOW = exports.CUSTOM_OBJECT = exports.APEX_TRIGGER = exports.APEX_CLASS = void 0;
|
|
3
|
+
exports.meaningfulMetadataChanges = exports.defaultTypesToFetchFromDependencyServer = exports.CUSTOM_METADATA = exports.AURA_DEFINITION_BUNDLE = exports.LIGHTNING_COMPONENT_BUNDLE = exports.FLOW = exports.CUSTOM_OBJECT = exports.APEX_TRIGGER = exports.APEX_CLASS = void 0;
|
|
4
4
|
exports.APEX_CLASS = 'ApexClass';
|
|
5
5
|
exports.APEX_TRIGGER = 'ApexTrigger';
|
|
6
6
|
exports.CUSTOM_OBJECT = 'CustomObject';
|
|
7
7
|
exports.FLOW = 'Flow';
|
|
8
8
|
exports.LIGHTNING_COMPONENT_BUNDLE = 'LightningComponentBundle';
|
|
9
9
|
exports.AURA_DEFINITION_BUNDLE = 'AuraDefinitionBundle';
|
|
10
|
+
exports.CUSTOM_METADATA = 'CustomMetadata';
|
|
11
|
+
// TODO: Consider Setting
|
|
10
12
|
exports.defaultTypesToFetchFromDependencyServer = [
|
|
11
13
|
exports.APEX_CLASS,
|
|
12
14
|
exports.APEX_TRIGGER,
|
|
@@ -14,6 +16,7 @@ exports.defaultTypesToFetchFromDependencyServer = [
|
|
|
14
16
|
exports.FLOW,
|
|
15
17
|
exports.LIGHTNING_COMPONENT_BUNDLE,
|
|
16
18
|
exports.AURA_DEFINITION_BUNDLE,
|
|
19
|
+
exports.CUSTOM_METADATA,
|
|
17
20
|
];
|
|
18
21
|
// TODO: Review
|
|
19
22
|
exports.meaningfulMetadataChanges = [
|
|
@@ -23,5 +26,6 @@ exports.meaningfulMetadataChanges = [
|
|
|
23
26
|
exports.FLOW,
|
|
24
27
|
exports.LIGHTNING_COMPONENT_BUNDLE,
|
|
25
28
|
exports.AURA_DEFINITION_BUNDLE,
|
|
29
|
+
exports.CUSTOM_METADATA,
|
|
26
30
|
];
|
|
27
31
|
//# sourceMappingURL=object-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-types.js","sourceRoot":"","sources":["../../src/elements/object-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,aAAa,GAAG,cAAc,CAAC;AAC/B,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AACxD,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"object-types.js","sourceRoot":"","sources":["../../src/elements/object-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,aAAa,GAAG,cAAc,CAAC;AAC/B,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AACxD,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAChD,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAChD,yBAAyB;AACZ,QAAA,uCAAuC,GAAG;IACrD,kBAAU;IACV,oBAAY;IACZ,qBAAa;IACb,YAAI;IACJ,kCAA0B;IAC1B,8BAAsB;IACtB,uBAAe;CAChB,CAAC;AAEF,eAAe;AACF,QAAA,yBAAyB,GAAG;IACvC,kBAAU;IACV,oBAAY;IACZ,qBAAa;IACb,YAAI;IACJ,kCAA0B;IAC1B,8BAAsB;IACtB,uBAAe;CAChB,CAAC"}
|
|
@@ -9,6 +9,7 @@ class ApexClassService {
|
|
|
9
9
|
filterApexTestSimple(classList) {
|
|
10
10
|
return classList.filter((className) => className.toLowerCase().includes('test'));
|
|
11
11
|
}
|
|
12
|
+
// TODO: Allow this to be a flag for root path
|
|
12
13
|
// eslint-disable-next-line class-methods-use-this
|
|
13
14
|
async filterApexTest(classList, rootPath = 'force-app/main/default/classes') {
|
|
14
15
|
// Get all Apex Classes with the filenames `${className}.cls` in the root directory and all subdirectories
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apex-class-service.js","sourceRoot":"","sources":["../../src/services/apex-class-service.ts"],"names":[],"mappings":";;;AAAA,+BAA4D;AAC5D,0CAAuC;AACvC,+BAA4B;AAE5B,MAAa,gBAAgB;IAC3B,kDAAkD;IAC3C,oBAAoB,CAAC,SAAmB;QAC7C,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,cAAc,CAAC,SAAmB,EAAE,QAAQ,GAAG,gCAAgC;QAC1F,0GAA0G;QAC1G,MAAM,WAAW,GAAG,QAAQ,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QACvD,MAAM,cAAc,GAAG,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,MAAM,cAAc,GAAG,MAAM,IAAA,WAAI,EAAC,WAAW,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAElE,MAAM,cAAc,GAAa,EAAE,CAAC;QACpC,MAAM,WAAW,GAAG,UAAU,CAAC;QAE/B,yEAAyE;QACzE,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;YAC1C,MAAM,UAAU,GAAG,IAAA,WAAQ,EAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YACrD,MAAM,UAAU,GAAG,IAAA,YAAS,EAAC,UAAU,CAAC,CAAC;YACzC,4CAA4C;YAC5C,MAAM,WAAW,GAAG,CAAC,MAAM,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC5D,IAAI,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC1C,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;aAC1D;SACF;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA7BD,4CA6BC"}
|
|
@@ -4,10 +4,10 @@ exports.CliService = void 0;
|
|
|
4
4
|
/* eslint-disable class-methods-use-this */
|
|
5
5
|
class CliService {
|
|
6
6
|
specificTests(tests) {
|
|
7
|
-
return `--test-level
|
|
7
|
+
return `--test-level=RunSpecifiedTests --tests="${tests.join(',')}"`;
|
|
8
8
|
}
|
|
9
9
|
allTests() {
|
|
10
|
-
return '--test-level
|
|
10
|
+
return '--test-level=RunLocalTests';
|
|
11
11
|
}
|
|
12
12
|
noTests() {
|
|
13
13
|
return '';
|
|
@@ -10,7 +10,6 @@ export declare class DependencyService {
|
|
|
10
10
|
connect(connection: Connection): void;
|
|
11
11
|
getDependenciesByObjects(additionalObjects?: string[]): Promise<MetadataComponentDependency[]>;
|
|
12
12
|
getRelatedApexClasses(dependencyList: MetadataComponentDependency[], changedMetadata: string[]): string[];
|
|
13
|
-
private isApexClass;
|
|
14
13
|
private getRelations;
|
|
15
14
|
private getDependencyByObject;
|
|
16
15
|
private getDependencySoql;
|
|
@@ -28,61 +28,29 @@ class DependencyService {
|
|
|
28
28
|
directDependencies.add(depData);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
const dependencies = Array.from(this.getRelations(dependencyList, directDependencies));
|
|
31
|
+
const dependencies = Array.from(this.getRelations(dependencyList.filter((depData) => depData.RefMetadataComponentType === object_types_1.APEX_CLASS), directDependencies));
|
|
32
32
|
return (0, lodash_1.uniq)(dependencies
|
|
33
|
-
.filter((dependency) =>
|
|
33
|
+
.filter((dependency) => dependency.MetadataComponentType === object_types_1.APEX_CLASS)
|
|
34
34
|
.map((dependency) => dependency.MetadataComponentName));
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
for (const metadata of dependencyList) {
|
|
38
|
-
if ((metadata.MetadataComponentType === object_types_1.APEX_CLASS &&
|
|
39
|
-
metadata.MetadataComponentName === dependency.MetadataComponentName) ||
|
|
40
|
-
(metadata.RefMetadataComponentType === object_types_1.APEX_CLASS &&
|
|
41
|
-
metadata.RefMetadataComponentName === dependency.MetadataComponentName)) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
getRelations(allDependencies, relatedDependencies, relationCounter = 0) {
|
|
36
|
+
getRelations(dependenciesRelatingToApex, relatedDependencies, relationCounter = 0) {
|
|
48
37
|
const newDependencies = Array.from(relatedDependencies);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (matchedDeps.length > 0) {
|
|
56
|
-
matchedDeps.forEach((matchedDep) => newDependencies.push(matchedDep));
|
|
57
|
-
}
|
|
58
|
-
}*/
|
|
59
|
-
// Should be more efficient than above...
|
|
60
|
-
/* for (const depData of allDependencies) {
|
|
61
|
-
if (depData.RefMetadataComponentType === APEX_CLASS) {
|
|
62
|
-
for (const newDep of newDependencies) {
|
|
63
|
-
if (newDep.MetadataComponentName === depData.RefMetadataComponentName) {
|
|
64
|
-
newDependencies.push(newDep);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}*/
|
|
69
|
-
// Inverse
|
|
70
|
-
for (const newDep of newDependencies) {
|
|
71
|
-
for (const depData of allDependencies) {
|
|
72
|
-
if (newDep.MetadataComponentName === depData.RefMetadataComponentName) {
|
|
73
|
-
if (depData.RefMetadataComponentType === object_types_1.APEX_CLASS) {
|
|
74
|
-
newDependencies.push(depData);
|
|
75
|
-
}
|
|
38
|
+
for (const newDep of Array.from(relatedDependencies)) {
|
|
39
|
+
for (const depRelatingToApex of dependenciesRelatingToApex) {
|
|
40
|
+
if (newDep.MetadataComponentName === depRelatingToApex.RefMetadataComponentName) {
|
|
41
|
+
newDependencies.push(depRelatingToApex);
|
|
42
|
+
// TODO: Would it make sense to short circuit this loop?
|
|
76
43
|
}
|
|
77
44
|
}
|
|
78
45
|
}
|
|
79
46
|
const newDependenciesSet = new Set(newDependencies);
|
|
80
47
|
// Stop looking at more than 8 layers of relations
|
|
81
48
|
if (relationCounter >= 8) {
|
|
49
|
+
// TODO: Add debug statement, maybe tune 8
|
|
82
50
|
return newDependenciesSet;
|
|
83
51
|
}
|
|
84
52
|
if (newDependenciesSet.size !== relatedDependencies.size) {
|
|
85
|
-
return this.getRelations(
|
|
53
|
+
return this.getRelations(dependenciesRelatingToApex, newDependenciesSet, relationCounter + 1);
|
|
86
54
|
}
|
|
87
55
|
return newDependenciesSet;
|
|
88
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-service.js","sourceRoot":"","sources":["../../src/services/dependency-service.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;AAG3C,yCAAyC;AACzC,mCAAsC;AACtC,2DAA+F;AAU/F,MAAa,iBAAiB;IAGrB,OAAO,C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AAC,UAAU,CAAC,CACnC,CAAC;QACF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CACzD,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CACtC,CAAC;QAEF,OAAO,IAAA,YAAM,EACX,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,EACrD,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CACtD,CAAC;IACJ,CAAC;IAEO,iBAAiB,CAAC,UAAkB;QAC1C,OAAO;;uCAE4B,UAAU;;iDAEA,CAAC;IAChD,CAAC;IAEO,oBAAoB,CAAC,UAAkB;QAC7C,OAAO;;0CAE+B,UAAU;;iDAEH,CAAC;IAChD,CAAC;CACF;AA/GD,8CA+GC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// import { TestContext } from '@salesforce/core/lib/testSetup';
|
|
4
|
-
// import { expect } from 'chai';
|
|
5
4
|
// import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
|
|
6
|
-
// import World from '../../../src/commands/hello/world';
|
|
7
5
|
const fs_1 = require("fs");
|
|
8
|
-
const mocha_1 = require("mocha");
|
|
9
6
|
const chai_1 = require("chai");
|
|
10
7
|
const dependency_service_1 = require("./dependency-service");
|
|
11
8
|
describe('dependency-services', () => {
|
|
@@ -14,13 +11,13 @@ describe('dependency-services', () => {
|
|
|
14
11
|
before(() => {
|
|
15
12
|
dependencyList = JSON.parse((0, fs_1.readFileSync)('test/fixtures/dependency-exploration-sf.json').toString());
|
|
16
13
|
});
|
|
17
|
-
|
|
14
|
+
beforeEach(() => {
|
|
18
15
|
dependencyService = new dependency_service_1.DependencyService();
|
|
19
16
|
});
|
|
20
17
|
describe('getRelatedApexClasses', () => {
|
|
21
18
|
it('test', () => {
|
|
22
19
|
const results = dependencyService.getRelatedApexClasses(dependencyList, ['APIUsers']);
|
|
23
|
-
(0, chai_1.expect)(results).to.deep.eq(['APIUsersTest']);
|
|
20
|
+
(0, chai_1.expect)(results).to.deep.eq(['APIUsers', 'APIUsersTest']);
|
|
24
21
|
});
|
|
25
22
|
});
|
|
26
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-services.test.js","sourceRoot":"","sources":["../../src/services/dependency-services.test.ts"],"names":[],"mappings":";;AAAA,gEAAgE;AAChE,
|
|
1
|
+
{"version":3,"file":"dependency-services.test.js","sourceRoot":"","sources":["../../src/services/dependency-services.test.ts"],"names":[],"mappings":";;AAAA,gEAAgE;AAChE,iEAAiE;AACjE,2BAAkC;AAClC,+BAA8B;AAC9B,6DAAsF;AAEtF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,iBAAoC,CAAC;IACzC,IAAI,cAA6C,CAAC;IAElD,MAAM,CAAC,GAAG,EAAE;QACV,cAAc,GAAG,IAAI,CAAC,KAAK,CACzB,IAAA,iBAAY,EAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE,CACvC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,GAAG,EAAE;QACd,iBAAiB,GAAG,IAAI,sCAAiB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACd,MAAM,OAAO,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YACtF,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -3,6 +3,5 @@ export declare class OutputService {
|
|
|
3
3
|
private readonly outputFolder;
|
|
4
4
|
constructor(outputFolder?: string);
|
|
5
5
|
dependencyData(dependencyData: MetadataComponentDependency[]): Promise<void>;
|
|
6
|
-
mermaidGraph(dependencyData: MetadataComponentDependency[]): Promise<void>;
|
|
7
6
|
private write;
|
|
8
7
|
}
|
|
@@ -11,18 +11,6 @@ class OutputService {
|
|
|
11
11
|
async dependencyData(dependencyData) {
|
|
12
12
|
return this.write('dependency-graph.json', JSON.stringify(dependencyData));
|
|
13
13
|
}
|
|
14
|
-
// TODO: Refactor to be readable :)
|
|
15
|
-
async mermaidGraph(dependencyData) {
|
|
16
|
-
const dependencyStrings = new Set(dependencyData
|
|
17
|
-
.filter((dependency) => !(dependency.RefMetadataComponentType === 'CustomField' ||
|
|
18
|
-
dependency.MetadataComponentType === 'CustomField'))
|
|
19
|
-
.map((dependency) => `\t${dependency.MetadataComponentType.replace(' ', '_')}.${dependency.MetadataComponentName.replace(' ', '_')} --> ${dependency.RefMetadataComponentType.replace(' ', '_')}.${dependency.RefMetadataComponentName.replace(' ', '_')}`));
|
|
20
|
-
const mermaidGraphString = `
|
|
21
|
-
flowchart TD
|
|
22
|
-
${Array.from(dependencyStrings).join('\n')}
|
|
23
|
-
`;
|
|
24
|
-
return this.write('mermaid.graph', mermaidGraphString);
|
|
25
|
-
}
|
|
26
14
|
async write(fileName, data) {
|
|
27
15
|
const path = (0, path_1.join)(this.outputFolder, fileName);
|
|
28
16
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-service.js","sourceRoot":"","sources":["../../src/services/output-service.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,0CAAuD;AACvD,2BAA+B;AAG/B,MAAa,aAAa;IAExB,YAAmB,YAAY,GAAG,iBAAiB;QACjD,IAAI,CAAC,YAAY,GAAG,IAAA,cAAO,EAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,cAAc,CAAC,cAA6C;QACvE,OAAO,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,CAAC;
|
|
1
|
+
{"version":3,"file":"output-service.js","sourceRoot":"","sources":["../../src/services/output-service.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,0CAAuD;AACvD,2BAA+B;AAG/B,MAAa,aAAa;IAExB,YAAmB,YAAY,GAAG,iBAAiB;QACjD,IAAI,CAAC,YAAY,GAAG,IAAA,cAAO,EAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,cAAc,CAAC,cAA6C;QACvE,OAAO,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,IAAY;QAChD,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAE/C,IAAI;YACF,MAAM,IAAA,iBAAM,EAAC,IAAI,CAAC,YAAY,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;SACjD;QAAC,MAAM;YACN,MAAM,IAAA,gBAAK,EAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAChC;QAED,OAAO,IAAA,oBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AApBD,sCAoBC"}
|
package/oclif.manifest.json
CHANGED