@mablhq/mabl-cli 2.78.5 → 2.79.1

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.
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHttpAgent = getHttpAgent;
4
+ const agent_base_1 = require("agent-base");
5
+ const socks_proxy_agent_1 = require("socks-proxy-agent");
6
+ const MablHttpAgent_1 = require("./MablHttpAgent");
7
+ const RequestFilteringHttpAgent_1 = require("./RequestFilteringHttpAgent");
8
+ function getHttpAgent(shouldFilterHttpRequests, linkServers, proxyConfig) {
9
+ const linkAgent = maybeGetSocksAgent(linkServers);
10
+ if (linkAgent) {
11
+ return MablHttpAgent_1.MablHttpAgent.createNewInstance({
12
+ httpAgent: linkAgent,
13
+ httpsAgent: linkAgent,
14
+ });
15
+ }
16
+ else if (shouldFilterHttpRequests) {
17
+ return RequestFilteringHttpAgent_1.RequestFilteringHttpAgent.createNewInstance();
18
+ }
19
+ return MablHttpAgent_1.MablHttpAgent.createNewInstance({ proxyConfig });
20
+ }
21
+ function maybeGetSocksAgent(linkServers) {
22
+ if (!linkServers?.length) {
23
+ return;
24
+ }
25
+ const agentOptions = linkServers.map((linkServer) => ({
26
+ host: linkServer.forwarding_host,
27
+ port: linkServer.forwarding_port,
28
+ userId: linkServer.workspace_id,
29
+ password: linkServer.label,
30
+ tls: {
31
+ rejectUnauthorized: false,
32
+ },
33
+ }));
34
+ if (agentOptions.length === 1) {
35
+ return new socks_proxy_agent_1.SocksProxyAgent(agentOptions[0]);
36
+ }
37
+ return new MultiSocksProxyAgent(agentOptions);
38
+ }
39
+ class MultiSocksProxyAgent extends agent_base_1.Agent {
40
+ constructor(options) {
41
+ super();
42
+ this.agents = options.map((proxy) => new socks_proxy_agent_1.SocksProxyAgent(proxy));
43
+ }
44
+ async callback(req, opts) {
45
+ return this.selectAgent().callback(req, opts);
46
+ }
47
+ selectAgent() {
48
+ return this.agents[Math.floor(Math.random() * this.agents.length)];
49
+ }
50
+ destroy() {
51
+ this.agents.forEach((agent) => agent.destroy());
52
+ }
53
+ }
package/http/httpUtil.js CHANGED
@@ -1,63 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = exports.EXECUTION_ENGINE_SSL_VERIFY = exports.USER_AGENT_HEADER = exports.USER_AGENT = void 0;
4
- exports.getHttpAgent = getHttpAgent;
5
4
  exports.postProcessHeaders = postProcessHeaders;
6
- const agent_base_1 = require("agent-base");
7
- const socks_proxy_agent_1 = require("socks-proxy-agent");
8
5
  const pureUtil_1 = require("../util/pureUtil");
9
- const MablHttpAgent_1 = require("./MablHttpAgent");
10
- const RequestFilteringHttpAgent_1 = require("./RequestFilteringHttpAgent");
11
6
  exports.USER_AGENT = `${(0, pureUtil_1.getCliName)()}@${(0, pureUtil_1.getCliVersion)()}`;
12
7
  exports.USER_AGENT_HEADER = 'User-Agent';
13
8
  exports.EXECUTION_ENGINE_SSL_VERIFY = false;
14
9
  exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = '-1';
15
- function getHttpAgent(shouldFilterHttpRequests, linkServers, proxyConfig) {
16
- const linkAgent = maybeGetSocksAgent(linkServers);
17
- if (linkAgent) {
18
- return MablHttpAgent_1.MablHttpAgent.createNewInstance({
19
- httpAgent: linkAgent,
20
- httpsAgent: linkAgent,
21
- });
22
- }
23
- else if (shouldFilterHttpRequests) {
24
- return RequestFilteringHttpAgent_1.RequestFilteringHttpAgent.createNewInstance();
25
- }
26
- return MablHttpAgent_1.MablHttpAgent.createNewInstance({ proxyConfig });
27
- }
28
- function maybeGetSocksAgent(linkServers) {
29
- if (!linkServers?.length) {
30
- return;
31
- }
32
- const agentOptions = linkServers.map((linkServer) => ({
33
- host: linkServer.forwarding_host,
34
- port: linkServer.forwarding_port,
35
- userId: linkServer.workspace_id,
36
- password: linkServer.label,
37
- tls: {
38
- rejectUnauthorized: false,
39
- },
40
- }));
41
- if (agentOptions.length === 1) {
42
- return new socks_proxy_agent_1.SocksProxyAgent(agentOptions[0]);
43
- }
44
- return new MultiSocksProxyAgent(agentOptions);
45
- }
46
- class MultiSocksProxyAgent extends agent_base_1.Agent {
47
- constructor(options) {
48
- super();
49
- this.agents = options.map((proxy) => new socks_proxy_agent_1.SocksProxyAgent(proxy));
50
- }
51
- async callback(req, opts) {
52
- return this.selectAgent().callback(req, opts);
53
- }
54
- selectAgent() {
55
- return this.agents[Math.floor(Math.random() * this.agents.length)];
56
- }
57
- destroy() {
58
- this.agents.forEach((agent) => agent.destroy());
59
- }
60
- }
61
10
  function postProcessHeaders(response) {
62
11
  const parsed = {};
63
12
  const rawHeaders = response.request?.res?.rawHeaders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "2.78.5",
3
+ "version": "2.79.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",
@@ -31,7 +31,6 @@
31
31
  "@types/adm-zip": "0.5.5",
32
32
  "@types/estree": "1.0.5",
33
33
  "@types/finalhandler": "1.2.4",
34
- "@types/send": "0.17.4",
35
34
  "@xmldom/xmldom": "0.8.10",
36
35
  "adm-zip": "0.5.10",
37
36
  "agent-base": "6.0.2",
package/util/clickUtil.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLICK_TYPE_TO_HUMAN_TEXT = exports.ClickType = void 0;
4
4
  exports.clickOnElement = clickOnElement;
5
5
  const messaging_1 = require("../core/messaging/messaging");
6
- const ExecutorUtils_1 = require("../execution/actions/ExecutorUtils");
6
+ const errorUtil_1 = require("./errorUtil");
7
7
  const loggingProvider_1 = require("../providers/logging/loggingProvider");
8
8
  const actionabilityUtil_1 = require("./actionabilityUtil");
9
9
  const logUtils_1 = require("./logUtils");
@@ -40,7 +40,7 @@ async function clickOnElement(elementHandle, executionContext, clickType = Click
40
40
  if (!noOverlappingElement || !elementHasSurfaceArea) {
41
41
  const isAttached = await elementHandle.evaluate((el) => el.isConnected);
42
42
  if (!isAttached) {
43
- throw new Error(ExecutorUtils_1.ELEMENT_NOT_ATTACHED_ERROR);
43
+ throw new Error(errorUtil_1.ELEMENT_NOT_ATTACHED_ERROR);
44
44
  }
45
45
  const jsClickReasons = [
46
46
  !noOverlappingElement && "there is a popup we couldn't dismiss",
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STRINGS_TO_RETRY_ON = exports.ELEMENT_NOT_ATTACHED_ERROR = exports.ELEMENT_NOT_READY_ERROR = void 0;
4
+ exports.isRetriableError = isRetriableError;
5
+ exports.ELEMENT_NOT_READY_ERROR = 'ELEMENT_NOT_READY_ERROR';
6
+ exports.ELEMENT_NOT_ATTACHED_ERROR = 'Element is not attached to the DOM';
7
+ const GET_CONTENT_FRAME_ERROR_TEXT = 'Could not get content frame from current frame';
8
+ const MABL_FIND_LOGIC_TIMEOUT_ERROR_TYPE = 'Mabl find logic timeout';
9
+ exports.STRINGS_TO_RETRY_ON = [
10
+ exports.ELEMENT_NOT_READY_ERROR,
11
+ 'Node is either not visible or',
12
+ 'Node is detached',
13
+ exports.ELEMENT_NOT_ATTACHED_ERROR,
14
+ 'Execution context was destroyed',
15
+ 'Element is not attached',
16
+ 'TimeoutError',
17
+ MABL_FIND_LOGIC_TIMEOUT_ERROR_TYPE,
18
+ 'Protocol error (DOM.describeNode)',
19
+ GET_CONTENT_FRAME_ERROR_TEXT,
20
+ 'frame.evaluate: Target closed',
21
+ 'frame.evaluateHandle: Frame was detached',
22
+ 'JSHandles can be evaluated only in the context they were created',
23
+ 'Unable to adopt element handle from a different document',
24
+ 'Cannot find context with specified id',
25
+ 'Cannot find object with id',
26
+ 'Node not found',
27
+ 'stale element reference',
28
+ 'referenced element is no longer attached',
29
+ 'is not present in the current view anymore',
30
+ 'addBinding',
31
+ ];
32
+ function isRetriableError(error) {
33
+ return exports.STRINGS_TO_RETRY_ON.some((errorMessage) => error.message.toLowerCase().includes(errorMessage.toLowerCase()));
34
+ }