sfdx-deliverability-access 0.1.16 → 0.1.19
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
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
sfdx-deliverability-access
|
|
2
|
-
|
|
1
|
+
# sfdx-deliverability-access
|
|
2
|
+
|
|
3
3
|
## `sfdx deliverability:access [-l <string>] [-u <string>]`
|
|
4
4
|
|
|
5
5
|
This SFDX Plugin was created to set Email Deliverability Access Level for an org easily and quickly. This project uses Selenium, Webdriver and headless browsing to open Setup in the target org and set Email Deliverability Access Level to the desired value.
|
|
6
|
+
|
|
6
7
|
```
|
|
7
8
|
USAGE
|
|
8
|
-
$ sfdx deliverability:access [-l <string>] [-u <string>] [--json] [--loglevel
|
|
9
|
+
$ sfdx deliverability:access [-l <string>] [-u <string>] [--json] [--loglevel
|
|
9
10
|
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
|
|
10
11
|
|
|
11
12
|
OPTIONS
|
|
@@ -41,11 +42,6 @@ sfdx deliverability:access --help
|
|
|
41
42
|
3. [Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm)
|
|
42
43
|
4. [Salesforce Lightning](https://www.salesforce.com/products/platform/lightning/)
|
|
43
44
|
|
|
44
|
-
## Version History
|
|
45
|
-
|
|
46
|
-
* 0.1.16 - Fixes bug by promisifying `exec()` so the plugin can be used in CI/CD flows
|
|
47
|
-
* Initial Release (0.1.4)
|
|
48
|
-
|
|
49
45
|
## License
|
|
50
46
|
|
|
51
47
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
@@ -8,8 +8,7 @@ const core_1 = require("@salesforce/core");
|
|
|
8
8
|
const webdriver = require("selenium-webdriver");
|
|
9
9
|
const chrome = require("selenium-webdriver/chrome");
|
|
10
10
|
const until = require("selenium-webdriver/lib/until");
|
|
11
|
-
|
|
12
|
-
const path = chromderiver.path;
|
|
11
|
+
require('chromedriver');
|
|
13
12
|
const execPromise = util.promisify(child_process_1.exec);
|
|
14
13
|
const accessValuesMap = new Map([
|
|
15
14
|
['none', '0'],
|
|
@@ -28,7 +27,7 @@ class Access extends command_1.SfdxCommand {
|
|
|
28
27
|
async run() {
|
|
29
28
|
this.ux.startSpinner('Attempting to set Email Deliverability Access Level');
|
|
30
29
|
const accessLevel = this.flags.level;
|
|
31
|
-
const childElementIndex = String(accessValuesMap.get(accessLevel
|
|
30
|
+
const childElementIndex = String(accessValuesMap.get(accessLevel?.toLowerCase()));
|
|
32
31
|
if (childElementIndex !== 'undefined' && Number(childElementIndex) > -1 && Number(childElementIndex) < 3) {
|
|
33
32
|
const accessUrl = await this.parseOrgData(String(this.flags.user));
|
|
34
33
|
void this.toggleDeliverability(accessUrl, childElementIndex);
|
|
@@ -40,7 +39,7 @@ class Access extends command_1.SfdxCommand {
|
|
|
40
39
|
}
|
|
41
40
|
async parseOrgData(user) {
|
|
42
41
|
try {
|
|
43
|
-
const orgDataCommand = user !== 'undefined' &&
|
|
42
|
+
const orgDataCommand = user !== 'undefined' && user?.length > 0
|
|
44
43
|
? `npx sfdx force:org:open -r --json -u ${user}`
|
|
45
44
|
: 'npx sfdx force:org:open -r --json';
|
|
46
45
|
const orgData = await execPromise(orgDataCommand);
|
|
@@ -55,13 +54,22 @@ class Access extends command_1.SfdxCommand {
|
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
async toggleDeliverability(accessUrl, childElementIndex) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
let driver;
|
|
58
|
+
try {
|
|
59
|
+
const options = new chrome.Options()
|
|
60
|
+
.addArguments('--no-sandbox')
|
|
61
|
+
.addArguments('--disable-dev-shm-usage')
|
|
62
|
+
.addArguments('--headless');
|
|
63
|
+
driver = await new webdriver.Builder().forBrowser('chrome').setChromeOptions(options).build();
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (String(error).includes('version of ChromeDriver only supports Chrome version')) {
|
|
67
|
+
this.ux.stopSpinner('❌ Access Level could not be set.');
|
|
68
|
+
throw new core_1.SfdxError(String(error), ' Please update to the latest version by running: npm update chromedriver');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (driver === undefined)
|
|
72
|
+
return;
|
|
65
73
|
try {
|
|
66
74
|
await driver.manage().setTimeouts({ implicit: 30000, pageLoad: 30000, script: 30000 });
|
|
67
75
|
await driver.get(accessUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../../src/commands/deliverability/access.ts"],"names":[],"mappings":";;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,iDAAqC;AACrC,iDAAyD;AACzD,2CAAuD;AACvD,gDAAiD;AACjD,oDAAqD;AACrD,sDAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../../src/commands/deliverability/access.ts"],"names":[],"mappings":";;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,iDAAqC;AACrC,iDAAyD;AACzD,2CAAuD;AACvD,gDAAiD;AACjD,oDAAqD;AACrD,sDAAuD;AACvD,OAAO,CAAC,cAAc,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAI,CAAC,CAAC;AAEzC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAiB;IAC9C,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,QAAQ,EAAE,GAAG,CAAC;IACf,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,KAAK,EAAE,GAAG,CAAC;IACZ,CAAC,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AsB,CAAC;KACzD,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;KACxD,CAAC;CACH,CAAC;AAEe,sBAAe,GAAG,KAAK,CAAC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.1.
|
|
1
|
+
{"version":"0.1.19","commands":{"deliverability:access":{"id":"deliverability:access","description":"Set Email Deliverability Access Level for an org.","usage":"<%= command.id %> [-l <string>] [-u <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"sfdx-deliverability-access","pluginType":"core","aliases":[],"examples":["sfdx deliverability:access --level All","sfdx deliverability:access --level None","sfdx deliverability:access --level System"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"level":{"name":"level","type":"option","char":"l","description":"No access: None, none, n, 0\nSystem email only: System, system, s, 1\nAll email: All, all, a, 2"},"user":{"name":"user","type":"option","char":"u","description":"Username or alias for the target org; overrides default target org"}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfdx-deliverability-access",
|
|
3
3
|
"description": "SFDX Plugin to set Email Deliverability Access Level for an org via command line. This project uses Selenium, Webdriver and headless browsing to open Setup in the target org and set Email Deliverability Access Level to the desired value.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
5
|
"author": "gfarb @gfarb",
|
|
6
6
|
"bugs": "https://github.com/gfarb/sfdx-deliverability-access/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"@oclif/config": "^1",
|
|
10
10
|
"@oclif/errors": "^1",
|
|
11
11
|
"@salesforce/command": "^4.2.2",
|
|
12
|
-
"@salesforce/core": "^2.
|
|
12
|
+
"@salesforce/core": "^2.37.1",
|
|
13
13
|
"@types/chromedriver": "^81.0.1",
|
|
14
14
|
"@types/node": "^17.0.21",
|
|
15
|
-
"chromedriver": "^
|
|
15
|
+
"chromedriver": "^103.0.0",
|
|
16
16
|
"install": "^0.13.0",
|
|
17
17
|
"npm": "^8.5.4",
|
|
18
18
|
"selenium-webdriver": "^4.1.1",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
|
34
34
|
"@typescript-eslint/parser": "^5.14.0",
|
|
35
35
|
"chai": "^4",
|
|
36
|
-
"chromedriver": "^99.0.0",
|
|
37
36
|
"eslint": "^8.10.0",
|
|
38
37
|
"eslint-config-oclif": "^4.0.0",
|
|
39
38
|
"eslint-config-prettier": "^8",
|