@applitools/ec-client 1.2.8 → 1.2.10
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.
|
@@ -45,8 +45,8 @@ async function makeTunnelManagerServer({ settings, path, unlink, idleTimeout = 6
|
|
|
45
45
|
server.on('listening', () => resolve(server));
|
|
46
46
|
});
|
|
47
47
|
const logger = (0, logger_1.makeLogger)({
|
|
48
|
-
handler: { type: 'rolling file', name: '
|
|
49
|
-
label: '
|
|
48
|
+
handler: { type: 'rolling file', name: 'ec-tunnel-manager', dirname: LOG_DIRNAME },
|
|
49
|
+
label: 'ec-tunnel-manager',
|
|
50
50
|
level: 'info',
|
|
51
51
|
colors: false,
|
|
52
52
|
});
|
package/dist/tunnels/manager.js
CHANGED
|
@@ -32,15 +32,8 @@ const req_1 = require("@applitools/req");
|
|
|
32
32
|
const execution_grid_tunnel_1 = __importDefault(require("@applitools/execution-grid-tunnel"));
|
|
33
33
|
const utils = __importStar(require("@applitools/utils"));
|
|
34
34
|
async function makeTunnelManager({ settings, logger, }) {
|
|
35
|
-
let
|
|
36
|
-
if (!settings || !(settings === null || settings === void 0 ? void 0 : settings.serverUrl)) {
|
|
37
|
-
const tunnelServer = await (0, execution_grid_tunnel_1.default)({ logger: null });
|
|
38
|
-
settings !== null && settings !== void 0 ? settings : (settings = {});
|
|
39
|
-
settings.serverUrl = `http://0.0.0.0:${tunnelServer.port}`;
|
|
40
|
-
cleanup = tunnelServer.cleanupFunction;
|
|
41
|
-
}
|
|
35
|
+
let server;
|
|
42
36
|
const req = (0, req_1.makeReq)({
|
|
43
|
-
baseUrl: settings === null || settings === void 0 ? void 0 : settings.serverUrl,
|
|
44
37
|
retry: {
|
|
45
38
|
validate: async ({ response }) => {
|
|
46
39
|
if (!response)
|
|
@@ -82,8 +75,13 @@ async function makeTunnelManager({ settings, logger, }) {
|
|
|
82
75
|
}
|
|
83
76
|
async function create(credentials) {
|
|
84
77
|
var _a, _b;
|
|
78
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.serverUrl)) {
|
|
79
|
+
settings !== null && settings !== void 0 ? settings : (settings = {});
|
|
80
|
+
settings.serverUrl = await open();
|
|
81
|
+
}
|
|
85
82
|
const response = await req('/tunnels', {
|
|
86
83
|
method: 'POST',
|
|
84
|
+
baseUrl: settings.serverUrl,
|
|
87
85
|
headers: {
|
|
88
86
|
'x-eyes-api-key': credentials.apiKey,
|
|
89
87
|
'x-eyes-server-url': credentials.eyesServerUrl,
|
|
@@ -97,8 +95,13 @@ async function makeTunnelManager({ settings, logger, }) {
|
|
|
97
95
|
}
|
|
98
96
|
async function destroy(tunnel) {
|
|
99
97
|
var _a, _b;
|
|
98
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.serverUrl)) {
|
|
99
|
+
settings !== null && settings !== void 0 ? settings : (settings = {});
|
|
100
|
+
settings.serverUrl = await open();
|
|
101
|
+
}
|
|
100
102
|
const response = await req(`/tunnels/${tunnel.tunnelId}`, {
|
|
101
103
|
method: 'DELETE',
|
|
104
|
+
baseUrl: settings.serverUrl,
|
|
102
105
|
headers: {
|
|
103
106
|
'x-eyes-api-key': tunnel.credentials.apiKey,
|
|
104
107
|
'x-eyes-server-url': tunnel.credentials.eyesServerUrl,
|
|
@@ -110,6 +113,14 @@ async function makeTunnelManager({ settings, logger, }) {
|
|
|
110
113
|
logger.error(`Failed to delete tunnel with status ${response.status} and code ${(_a = body === null || body === void 0 ? void 0 : body.message) !== null && _a !== void 0 ? _a : 'UNKNOWN_ERROR'}`);
|
|
111
114
|
throw new Error(`Failed to delete tunnel with code ${(_b = body === null || body === void 0 ? void 0 : body.message) !== null && _b !== void 0 ? _b : 'UNKNOWN_ERROR'}`);
|
|
112
115
|
}
|
|
116
|
+
async function open() {
|
|
117
|
+
const { port, cleanupFunction } = await (0, execution_grid_tunnel_1.default)({ logger });
|
|
118
|
+
server = { port, close: cleanupFunction };
|
|
119
|
+
return `http://0.0.0.0:${port}`;
|
|
120
|
+
}
|
|
121
|
+
async function cleanup() {
|
|
122
|
+
await (server === null || server === void 0 ? void 0 : server.close());
|
|
123
|
+
}
|
|
113
124
|
}
|
|
114
125
|
exports.makeTunnelManager = makeTunnelManager;
|
|
115
126
|
function makePool(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/ec-client",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"postversion": "bongo postversion --skip-release-notification"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@applitools/execution-grid-tunnel": "1.0.
|
|
67
|
-
"@applitools/logger": "1.1.
|
|
66
|
+
"@applitools/execution-grid-tunnel": "1.0.13",
|
|
67
|
+
"@applitools/logger": "1.1.46",
|
|
68
68
|
"@applitools/req": "1.1.30",
|
|
69
|
-
"@applitools/socket": "1.0.
|
|
69
|
+
"@applitools/socket": "1.0.8",
|
|
70
70
|
"@applitools/utils": "1.3.30",
|
|
71
71
|
"abort-controller": "3.0.0",
|
|
72
72
|
"yargs": "17.6.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@applitools/bongo": "^2.2.5",
|
|
76
|
-
"@applitools/test-server": "^1.1.
|
|
76
|
+
"@applitools/test-server": "^1.1.26",
|
|
77
77
|
"@types/mocha": "^9.1.1",
|
|
78
78
|
"@types/node": "12",
|
|
79
79
|
"@types/node-fetch": "^2.6.1",
|