sfdx-deliverability-access 1.1.7 → 2.0.0

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
@@ -37,10 +37,25 @@ sfdx deliverability:access --help
37
37
 
38
38
  ## Requirements
39
39
 
40
- 1. [Node.js](https://nodejs.org/en/)
40
+ 1. [Node.js](https://nodejs.org/en/) 18 or newer (including the runtime used by Salesforce CLI)
41
41
  1. [Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm)
42
42
  1. [Salesforce Lightning](https://www.salesforce.com/products/platform/lightning/)
43
43
 
44
+ ## Browser setup
45
+
46
+ Puppeteer downloads a native browser automatically; **no separate Chrome is required**.
47
+ Installation needs network access, enabled dependency install scripts, and a writable
48
+ cache accessible at runtime (`~/.cache/puppeteer` or `PUPPETEER_CACHE_DIR`).
49
+
50
+ For a custom compatible executable (not the `.app` directory), use
51
+ `export PUPPETEER_EXECUTABLE_PATH="/path/to/browser"`.
52
+
53
+ Migrate the removed `npm_config_puppeteer_executable_path` and
54
+ `npm_package_config_puppeteer_executable_path` aliases to `PUPPETEER_EXECUTABLE_PATH`.
55
+
56
+ macOS error `-86` means an incompatible CPU type. Correct stale overrides and use a
57
+ browser matching the CLI's Node architecture (native ARM64 on Apple Silicon).
58
+
44
59
  ## License
45
60
 
46
61
  This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
@@ -0,0 +1,6 @@
1
+ import puppeteer = require('puppeteer');
2
+ type LaunchOptions = NonNullable<Parameters<typeof puppeteer.launch>[0]>;
3
+ export declare function getBrowserLaunchOptions(executablePath?: string | undefined): LaunchOptions;
4
+ export declare function getErrorMessage(error: unknown): string;
5
+ export declare function launchBrowser(): Promise<puppeteer.Browser>;
6
+ export {};
package/lib/browser.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.launchBrowser = exports.getErrorMessage = exports.getBrowserLaunchOptions = void 0;
4
+ const util_1 = require("util");
5
+ const puppeteer = require("puppeteer");
6
+ function getBrowserLaunchOptions(executablePath = process.env.PUPPETEER_EXECUTABLE_PATH) {
7
+ const options = {
8
+ headless: true,
9
+ args: ['--disable-web-security', '--no-sandbox'],
10
+ };
11
+ if (executablePath) {
12
+ options.executablePath = executablePath;
13
+ }
14
+ return options;
15
+ }
16
+ exports.getBrowserLaunchOptions = getBrowserLaunchOptions;
17
+ function getErrorMessage(error) {
18
+ if (error instanceof Error)
19
+ return error.message;
20
+ return typeof error === 'string' ? error : (0, util_1.inspect)(error, { customInspect: false, getters: false });
21
+ }
22
+ exports.getErrorMessage = getErrorMessage;
23
+ async function launchBrowser() {
24
+ const options = getBrowserLaunchOptions();
25
+ try {
26
+ return await puppeteer.launch(options);
27
+ }
28
+ catch (error) {
29
+ const browser = options.executablePath ? `browser at "${options.executablePath}"` : 'Puppeteer-managed Chrome';
30
+ const message = getErrorMessage(error);
31
+ const systemError = error instanceof Error ? error : undefined;
32
+ const macHint = process.platform === 'darwin' &&
33
+ (systemError?.errno === -86 || /\b(?:error|errno)\s*[:=]?\s*-86\b/i.test(message))
34
+ ? ' On macOS, spawn error -86 means the executable has an incompatible CPU type.'
35
+ : '';
36
+ throw new Error(`Unable to launch ${browser} on ${process.platform}/${process.arch}: ${message}. ` +
37
+ 'Reinstall the plugin with browser downloads enabled, or set ' +
38
+ 'PUPPETEER_EXECUTABLE_PATH to a compatible Chrome/Chromium executable.' +
39
+ macHint, { cause: error });
40
+ }
41
+ }
42
+ exports.launchBrowser = launchBrowser;
43
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uCAAwC;AAIxC,SAAgB,uBAAuB,CACrC,iBAAqC,OAAO,CAAC,GAAG,CAAC,yBAAyB;IAE1E,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AAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI;YAChF,8DAA8D;YAC9D,uEAAuE;YACvE,OAAO,EACT,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;KACH;AACH,CAAC;AArBD,sCAqBC"}
@@ -19,5 +19,6 @@ export default class Access extends SfdxCommand {
19
19
  run(): Promise<void>;
20
20
  private parseOrgData;
21
21
  private toggleDeliverability;
22
+ private waitForDeliverabilityField;
22
23
  private stopSpinnerAndLogError;
23
24
  }
@@ -5,8 +5,11 @@ const util = require("util");
5
5
  const child_process_1 = require("child_process");
6
6
  const command_1 = require("@salesforce/command");
7
7
  const core_1 = require("@salesforce/core");
8
- const puppeteer = require("puppeteer");
8
+ const browser_1 = require("../../browser");
9
9
  const execPromise = util.promisify(child_process_1.exec);
10
+ const setupFrameSelector = '#setupComponent > div.setupcontent > div > div > force-aloha-page > div > iframe';
11
+ const accessLevelSelector = '#thePage\\:theForm\\:editBlock\\:sendEmailAccessControlSection\\:sendEmailAccessControl\\:sendEmailAccessControlSelect';
12
+ const navigationErrorPattern = /Execution context was destroyed|Cannot find context with specified id|frame.*detached|detached frame/i;
10
13
  const accessValuesMap = new Map([
11
14
  ['none', '0'],
12
15
  ['n', '0'],
@@ -21,6 +24,19 @@ const accessValuesMap = new Map([
21
24
  core_1.Messages.importMessagesDirectory(__dirname);
22
25
  const messages = core_1.Messages.loadMessages('sfdx-deliverability-access', 'org');
23
26
  class Access extends command_1.SfdxCommand {
27
+ static description = messages.getMessage('commandDescription');
28
+ static examples = messages.getMessage('examples').split(os.EOL);
29
+ static flagsConfig = {
30
+ level: command_1.flags.string({
31
+ char: 'l',
32
+ description: messages.getMessage('levelFlagDescription'),
33
+ }),
34
+ user: command_1.flags.string({
35
+ char: 'u',
36
+ description: messages.getMessage('userFlagDescription'),
37
+ }),
38
+ };
39
+ static requiresProject = false;
24
40
  async run() {
25
41
  this.ux.startSpinner('Attempting to set Email Deliverability Access Level');
26
42
  const accessLevel = this.flags.level;
@@ -30,10 +46,10 @@ class Access extends command_1.SfdxCommand {
30
46
  if (accessUrl === undefined)
31
47
  return;
32
48
  try {
33
- void this.toggleDeliverability(accessUrl, accessLevelValue);
49
+ await this.toggleDeliverability(accessUrl, accessLevelValue);
34
50
  }
35
51
  catch (error) {
36
- this.stopSpinnerAndLogError(String(error));
52
+ this.stopSpinnerAndLogError(error);
37
53
  }
38
54
  }
39
55
  else {
@@ -56,55 +72,62 @@ class Access extends command_1.SfdxCommand {
56
72
  }
57
73
  }
58
74
  async toggleDeliverability(accessUrl, accessLevelValue) {
59
- let browser;
60
- let error;
61
75
  this.ux.setSpinnerStatus('Launching headless browser');
76
+ const browser = await (0, browser_1.launchBrowser)();
62
77
  try {
63
- browser = await puppeteer.launch({
64
- headless: true,
65
- args: ['--disable-web-security', '--no-sandbox'],
66
- });
67
78
  const page = await browser.newPage();
68
79
  await page.goto(accessUrl);
69
80
  this.ux.setSpinnerStatus('Waiting for page to load');
70
- const frame = await page.waitForSelector('#setupComponent > div.setupcontent > div > div > force-aloha-page > div > iframe');
71
- const contentFrame = await frame?.contentFrame();
72
- const accessLevelField = await contentFrame?.waitForSelector('#thePage\\:theForm\\:editBlock\\:sendEmailAccessControlSection\\:sendEmailAccessControl\\:sendEmailAccessControlSelect');
81
+ const { frame, field } = await this.waitForDeliverabilityField(page);
73
82
  this.ux.setSpinnerStatus('Selecting Deliverability Access Level');
74
- await accessLevelField?.select(accessLevelValue);
75
- await contentFrame?.click('#thePage\\:theForm\\:editBlock\\:buttons\\:saveBtn');
76
- await contentFrame?.waitForSelector('#thePage\\:theForm\\:successText');
77
- }
78
- catch (err) {
79
- error = String(err);
83
+ await field.select(accessLevelValue);
84
+ await frame.click('#thePage\\:theForm\\:editBlock\\:buttons\\:saveBtn');
85
+ await frame.waitForSelector('#thePage\\:theForm\\:successText');
80
86
  }
81
87
  finally {
82
- await browser?.close();
83
- if (error !== undefined) {
84
- this.stopSpinnerAndLogError(error);
88
+ await browser.close();
89
+ }
90
+ this.ux.stopSpinner('🎉 Email Deliverability Access Level has been set!');
91
+ }
92
+ async waitForDeliverabilityField(page) {
93
+ const deadline = Date.now() + 60000;
94
+ let navigationError;
95
+ while (Date.now() < deadline) {
96
+ const frameTimeout = deadline - Date.now();
97
+ if (frameTimeout <= 0)
98
+ break;
99
+ try {
100
+ const iframe = await page.waitForSelector(setupFrameSelector, { timeout: frameTimeout });
101
+ const frame = await iframe?.contentFrame();
102
+ const fieldTimeout = deadline - Date.now();
103
+ if (frame && fieldTimeout > 0) {
104
+ const field = await frame.waitForSelector(accessLevelSelector, { timeout: fieldTimeout });
105
+ if (field)
106
+ return { frame, field };
107
+ }
85
108
  }
86
- else {
87
- this.ux.stopSpinner('🎉 Email Deliverability Access Level has been set!');
109
+ catch (error) {
110
+ const cause = error instanceof Error ? error.cause : undefined;
111
+ if (!navigationErrorPattern.test(`${(0, browser_1.getErrorMessage)(error)} ${(0, browser_1.getErrorMessage)(cause)}`))
112
+ throw error;
113
+ navigationError = error;
88
114
  }
115
+ // A redirect can invalidate a handle after waitForSelector has resolved.
116
+ const remaining = deadline - Date.now();
117
+ if (remaining <= 0)
118
+ break;
119
+ this.ux.setSpinnerStatus('Waiting for setup navigation to finish');
120
+ await new Promise((resolve) => setTimeout(resolve, Math.min(100, remaining)));
89
121
  }
122
+ throw new Error('Timed out waiting for the Deliverability setup controls after 60000 ms', {
123
+ cause: navigationError,
124
+ });
90
125
  }
91
- stopSpinnerAndLogError(errorMessage) {
126
+ stopSpinnerAndLogError(error) {
92
127
  this.ux.stopSpinner('❌ Access Level could not be set.');
93
- throw new core_1.SfdxError(errorMessage);
128
+ const cause = error instanceof Error ? error : new Error((0, browser_1.getErrorMessage)(error), { cause: error });
129
+ throw new core_1.SfdxError(cause.message, undefined, undefined, undefined, cause);
94
130
  }
95
131
  }
96
132
  exports.default = Access;
97
- Access.description = messages.getMessage('commandDescription');
98
- Access.examples = messages.getMessage('examples').split(os.EOL);
99
- Access.flagsConfig = {
100
- level: command_1.flags.string({
101
- char: 'l',
102
- description: messages.getMessage('levelFlagDescription'),
103
- }),
104
- user: command_1.flags.string({
105
- char: 'u',
106
- description: messages.getMessage('userFlagDescription'),
107
- }),
108
- };
109
- Access.requiresProject = false;
110
133
  //# sourceMappingURL=access.js.map
@@ -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,uCAAwC;AACxC,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,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;CACX,CAAC,CAAC;AAEH,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;AAY5E,MAAqB,MAAO,SAAQ,qBAAW;IAkBtC,KAAK,CAAC,GAAG;QACd,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,qDAAqD,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC;QAC/C,MAAM,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,CAAC,CA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AAK,EAAE,CAAC,CAAC;QACnG,MAAM,IAAI,gBAAS,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;;AA3GH,yBA4GC"}
@@ -1 +1 @@
1
- {"version":"1.1.7","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":[]}}}
1
+ {"version":"2.0.0","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,11 +1,11 @@
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 Puppeteer and headless browsing to open Setup in the target org and set Email Deliverability Access Level to the desired value.",
4
- "version": "1.1.7",
4
+ "version": "2.0.0",
5
5
  "author": "gfarb @gfarb",
6
6
  "bugs": "https://github.com/gfarb/sfdx-deliverability-access/issues",
7
7
  "engines": {
8
- "node": ">=12.0.0"
8
+ "node": ">=18.0.0"
9
9
  },
10
10
  "files": [
11
11
  "/lib",
@@ -36,9 +36,9 @@
36
36
  "repository": "gfarb/sfdx-deliverability-access",
37
37
  "scripts": {
38
38
  "build": "tsc -p .",
39
- "lint": "eslint src/**/*.ts test/**/*.ts",
39
+ "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
40
40
  "postpack": "rm -f oclif.manifest.json",
41
- "posttest": "eslint src/**/*.ts test/**/*.ts",
41
+ "posttest": "npm run lint",
42
42
  "prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
43
43
  "test": "nyc --extension .ts --require ts-node/register mocha --forbid-only \"test/**/*.test.ts\"",
44
44
  "version": "oclif-dev readme && git add README.md"
@@ -49,11 +49,10 @@
49
49
  "@oclif/errors": "^1",
50
50
  "@salesforce/command": "4.2.2",
51
51
  "@salesforce/core": "2.37.1",
52
- "@types/node": "^17.0.21",
53
- "@types/puppeteer": "^5.4.7",
52
+ "@types/node": "^18",
54
53
  "install": "^0.13.0",
55
54
  "npm": "^8.18.0",
56
- "puppeteer": "^18.2.1",
55
+ "puppeteer": "^24.43.1",
57
56
  "tslib": "^2"
58
57
  },
59
58
  "devDependencies": {
@@ -87,6 +86,6 @@
87
86
  "pretty-quick": "^3",
88
87
  "sinon": "13.0.1",
89
88
  "ts-node": "^10",
90
- "typescript": "4.7.4"
89
+ "typescript": "5.2.2"
91
90
  }
92
91
  }