@applitools/ec-client 1.12.20 → 1.12.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.12.21](https://github.com/Applitools-Dev/sdk/compare/js/ec-client@1.12.20...js/ec-client@1.12.21) (2026-03-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * audit fix for fastify node >=20 ([#3578](https://github.com/Applitools-Dev/sdk/issues/3578)) ([7c7b9b2](https://github.com/Applitools-Dev/sdk/commit/7c7b9b295b68285d585092dd71b99a4e148c6f55))
9
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * @applitools/utils bumped to 1.14.2
15
+ #### Bug Fixes
16
+
17
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
18
+ * @applitools/logger bumped to 2.2.9
19
+ #### Bug Fixes
20
+
21
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
22
+
23
+
24
+
25
+ * @applitools/socket bumped to 1.3.10
26
+ #### Bug Fixes
27
+
28
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
29
+
30
+
31
+
32
+ * @applitools/req bumped to 1.9.1
33
+ #### Bug Fixes
34
+
35
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
36
+
37
+
38
+
39
+ * @applitools/image bumped to 1.2.8
40
+ #### Bug Fixes
41
+
42
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
43
+
44
+
45
+
46
+ * @applitools/snippets bumped to 2.7.1
47
+ #### Bug Fixes
48
+
49
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
50
+ * @applitools/driver bumped to 1.25.2
51
+ #### Bug Fixes
52
+
53
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
54
+
55
+
56
+
57
+ * @applitools/spec-driver-webdriver bumped to 1.5.7
58
+ #### Bug Fixes
59
+
60
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
61
+
62
+
63
+
64
+ * @applitools/tunnel-client bumped to 1.11.8
65
+ #### Bug Fixes
66
+
67
+ * audit fix for fastify node >=20 ([#3578](https://github.com/Applitools-Dev/sdk/issues/3578)) ([7c7b9b2](https://github.com/Applitools-Dev/sdk/commit/7c7b9b295b68285d585092dd71b99a4e148c6f55))
68
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
69
+
70
+
71
+
72
+ * @applitools/core-base bumped to 1.32.1
73
+ #### Bug Fixes
74
+
75
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
76
+
77
+
78
+
79
+ * @applitools/test-server bumped to 1.4.1
80
+ #### Bug Fixes
81
+
82
+ * unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
83
+
84
+
85
+
86
+
3
87
  ## [1.12.20](https://github.com/Applitools-Dev/sdk/compare/js/ec-client@1.12.19...js/ec-client@1.12.20) (2026-03-02)
4
88
 
5
89
 
package/dist/server.js CHANGED
@@ -54,9 +54,16 @@ async function makeServer({ settings, logger: mainLogger, }) {
54
54
  useDnsCache: settings.useDnsCache,
55
55
  });
56
56
  const core = (0, core_base_1.makeCore)({ agentId: `js/ec-client/${require('../package.json').version}` });
57
- const tunnels = ((_a = settings.tunnel) === null || _a === void 0 ? void 0 : _a.serviceUrl)
58
- ? await (0, manager_1.makeTunnelManager)({ settings: settings.tunnel, logger: serverLogger })
59
- : await (0, manager_client_1.makeTunnelManagerClient)({ settings: settings.tunnel, logger: serverLogger });
57
+ let tunnels;
58
+ try {
59
+ tunnels = ((_a = settings.tunnel) === null || _a === void 0 ? void 0 : _a.serviceUrl)
60
+ ? await (0, manager_1.makeTunnelManager)({ settings: settings.tunnel, logger: serverLogger })
61
+ : await (0, manager_client_1.makeTunnelManagerClient)({ settings: settings.tunnel, logger: serverLogger });
62
+ }
63
+ catch (error) {
64
+ serverLogger.warn('Tunnel manager could not be initialized. Tunnel functionality will be disabled.', error.message);
65
+ tunnels = undefined;
66
+ }
60
67
  const sessions = new Map();
61
68
  const commands = {
62
69
  startSession: (0, start_session_1.makeStartSession)({ settings, req, tunnels }),
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMakeTunnelClient = void 0;
4
+ const TUNNEL_CLIENT_PACKAGE = '@applitools/tunnel-client';
5
+ let tunnelClientModule = null;
6
+ let loadError = null;
7
+ async function loadTunnelClient() {
8
+ var _a;
9
+ if (tunnelClientModule) {
10
+ return tunnelClientModule;
11
+ }
12
+ if (loadError) {
13
+ throw loadError;
14
+ }
15
+ try {
16
+ tunnelClientModule = await import(TUNNEL_CLIENT_PACKAGE);
17
+ if (!tunnelClientModule || !tunnelClientModule.makeTunnelClient) {
18
+ throw new Error(`Invalid ${TUNNEL_CLIENT_PACKAGE} module structure`);
19
+ }
20
+ return tunnelClientModule;
21
+ }
22
+ catch (error) {
23
+ if (error.code === 'MODULE_NOT_FOUND' || ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Cannot find module'))) {
24
+ loadError = new Error(`The tunnel client functionality requires the optional dependency '${TUNNEL_CLIENT_PACKAGE}' to be installed. ` +
25
+ `Please install it using: npm install ${TUNNEL_CLIENT_PACKAGE}`);
26
+ }
27
+ else {
28
+ const currentNodeVersion = parseInt(process.version.slice(1).split('.')[0], 10);
29
+ if (currentNodeVersion < 20) {
30
+ const compatibilityMessage = `You are running an old version of Node.js (${process.version}). ` +
31
+ `You need to manually install ${TUNNEL_CLIENT_PACKAGE} with a version that is compatible with your version of Node.js.\n\n`;
32
+ loadError = new Error(compatibilityMessage + `Original error: ${error.message}`);
33
+ }
34
+ else {
35
+ loadError = error;
36
+ }
37
+ }
38
+ throw loadError;
39
+ }
40
+ }
41
+ async function getMakeTunnelClient() {
42
+ const module = await loadTunnelClient();
43
+ return module.makeTunnelClient;
44
+ }
45
+ exports.getMakeTunnelClient = getMakeTunnelClient;
@@ -10,30 +10,55 @@ async function makeTunnelManagerClient({ settings, logger, }) {
10
10
  (process.platform === 'win32' ? '\\\\.\\pipe\\applitools-tunnel-manager' : '/tmp/applitools-tunnel-manager.sock');
11
11
  const socket = (0, socket_1.makeSocket)((0, net_1.createConnection)({ path }), { transport: 'ipc' });
12
12
  let server;
13
- socket.once('error', async (error) => {
14
- try {
15
- if (['ECONNREFUSED', 'ENOENT'].includes(error.code)) {
16
- if (error.code === 'ECONNREFUSED') {
13
+ let initializationError;
14
+ await new Promise((resolve, reject) => {
15
+ socket.once('error', async (error) => {
16
+ let shouldReconnect = true;
17
+ try {
18
+ if (['ECONNREFUSED', 'ENOENT'].includes(error.code)) {
19
+ if (error.code === 'ECONNREFUSED') {
20
+ try {
21
+ await fs_1.promises.unlink(path);
22
+ }
23
+ catch { }
24
+ }
25
+ logger.log(`Starting tunnel manager in separate process using path ${path} and settings`, settings);
17
26
  try {
18
- await fs_1.promises.unlink(path);
27
+ server = await (0, manager_server_1.makeTunnelManagerServerProcess)({ settings, path });
28
+ resolve();
29
+ }
30
+ catch (error) {
31
+ if (error.code !== 'EADDRINUSE') {
32
+ logger.error('Failed to start tunnel manager server', error);
33
+ shouldReconnect = false;
34
+ initializationError = error;
35
+ reject(error);
36
+ }
37
+ else {
38
+ shouldReconnect = true;
39
+ }
19
40
  }
20
- catch { }
21
41
  }
22
- logger.log(`Starting tunnel manager in separate process using path ${path} and settings`, settings);
23
- try {
24
- server = await (0, manager_server_1.makeTunnelManagerServerProcess)({ settings, path });
42
+ else {
43
+ shouldReconnect = false;
44
+ initializationError = error;
45
+ reject(error);
46
+ }
47
+ }
48
+ finally {
49
+ if (shouldReconnect) {
50
+ socket.use((0, net_1.createConnection)({ path }));
25
51
  }
26
- catch (error) {
27
- if (error.code !== 'EADDRINUSE')
28
- throw error;
52
+ else if (initializationError) {
53
+ socket.cleanup();
29
54
  }
30
55
  }
31
- }
32
- finally {
33
- socket.use((0, net_1.createConnection)({ path }));
34
- }
56
+ });
57
+ socket.once('ready', () => {
58
+ socket.target.unref();
59
+ resolve();
60
+ });
35
61
  });
36
- socket.once('ready', () => socket.target.unref());
37
62
  return {
38
63
  acquire: (options) => socket.request('Tunnel.acquire', options),
39
64
  release: (options) => socket.request('Tunnel.release', options),
@@ -24,10 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.makeTunnelManager = void 0;
27
- const tunnel_client_1 = require("@applitools/tunnel-client");
27
+ const loader_1 = require("./loader");
28
28
  const utils = __importStar(require("@applitools/utils"));
29
29
  async function makeTunnelManager({ settings, logger, }) {
30
- const client = (0, tunnel_client_1.makeTunnelClient)({ settings, logger });
30
+ const createTunnelClient = await (0, loader_1.getMakeTunnelClient)();
31
+ const client = createTunnelClient({ settings, logger });
31
32
  const pools = new Map();
32
33
  return { acquire, release, close: client.close };
33
34
  async function acquire(credentials) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/ec-client",
3
- "version": "1.12.20",
3
+ "version": "1.12.21",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -52,21 +52,21 @@
52
52
  "test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/*.spec.ts'"
53
53
  },
54
54
  "dependencies": {
55
- "@applitools/core-base": "1.32.0",
56
- "@applitools/driver": "1.25.1",
57
- "@applitools/logger": "2.2.8",
58
- "@applitools/req": "1.9.0",
59
- "@applitools/socket": "1.3.9",
60
- "@applitools/spec-driver-webdriver": "1.5.6",
61
- "@applitools/tunnel-client": "1.11.7",
62
- "@applitools/utils": "1.14.1",
55
+ "@applitools/core-base": "1.32.1",
56
+ "@applitools/driver": "1.25.2",
57
+ "@applitools/logger": "2.2.9",
58
+ "@applitools/req": "1.9.1",
59
+ "@applitools/socket": "1.3.10",
60
+ "@applitools/spec-driver-webdriver": "1.5.7",
61
+ "@applitools/utils": "1.14.2",
63
62
  "abort-controller": "3.0.0",
64
63
  "webdriver": "7.31.1",
65
64
  "yargs": "^17.7.2"
66
65
  },
67
66
  "devDependencies": {
68
- "@applitools/test-server": "^1.4.0",
67
+ "@applitools/test-server": "^1.4.1",
69
68
  "@applitools/test-utils": "^1.5.17",
69
+ "@applitools/tunnel-client": "1.11.8",
70
70
  "@types/node": "^12.20.55",
71
71
  "@types/node-fetch": "^2.6.1",
72
72
  "@types/selenium-webdriver": "^4.0.19",
@@ -74,6 +74,9 @@
74
74
  "nock": "^13.3.2",
75
75
  "selenium-webdriver": "^4.15.0"
76
76
  },
77
+ "optionalDependencies": {
78
+ "@applitools/tunnel-client": ">=1.11.8"
79
+ },
77
80
  "engines": {
78
81
  "node": ">=12.13.0"
79
82
  },
@@ -0,0 +1,10 @@
1
+ import type { TunnelClient } from '@applitools/tunnel-client';
2
+ import { type Logger } from '@applitools/logger';
3
+ interface TunnelClientModule {
4
+ makeTunnelClient: (options: {
5
+ settings?: any;
6
+ logger: Logger;
7
+ }) => TunnelClient;
8
+ }
9
+ export declare function getMakeTunnelClient(): Promise<TunnelClientModule['makeTunnelClient']>;
10
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { TunnelManagerSettings } from '../types';
2
2
  import { type Logger } from '@applitools/logger';
3
- import { type Tunnel, type TunnelCredentials } from '@applitools/tunnel-client';
3
+ import type { Tunnel, TunnelCredentials } from '@applitools/tunnel-client';
4
4
  export interface TunnelManager {
5
5
  acquire(credentials: TunnelCredentials): Promise<Tunnel[]>;
6
6
  release(tunnels: Tunnel[]): Promise<void>;
package/types/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Proxy } from '@applitools/req';
2
2
  import { type Batch, type FunctionalSession } from '@applitools/core-base';
3
- import { type TunnelClientSettings, type Tunnel } from '@applitools/tunnel-client';
3
+ import type { TunnelClientSettings, Tunnel } from '@applitools/tunnel-client';
4
4
  export interface ECClient {
5
5
  readonly url: string;
6
6
  readonly port: number;