bdy 1.8.46-dev → 1.8.48-dev
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/distTs/package.json
CHANGED
package/distTs/src/texts.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.TXT_TUNNEL_STARTED = exports.TXT_AGENT_DISABLED = exports.TXT_AGENT_ALRE
|
|
|
5
5
|
exports.DESC_COMMAND_HTTP = exports.DESC_COMMAND_CONFIG = exports.DESC_COMMAND_AGENT_VERSION = exports.DESC_COMMAND_AGENT_UPDATE = exports.DESC_COMMAND_AGENT_TARGET = exports.DESC_COMMAND_AGENT_TUNNEL = exports.DESC_COMMAND_AGENT_STOP = exports.DESC_COMMAND_AGENT_TARGET_DISABLE = exports.DESC_COMMAND_AGENT_TARGET_ENABLE = exports.DESC_COMMAND_AGENT_TARGET_STATUS = exports.DESC_COMMAND_AGENT_STATUS = exports.DESC_COMMAND_AGENT_RESTART = exports.DESC_COMMAND_AGENT_START = exports.DESC_COMMAND_AGENT_INSTALL = exports.DESC_COMMAND_AGENT_UNINSTALL = exports.DESC_COMMAND_AGENT_TUNNEL_TLS = exports.DESC_COMMAND_AGENT_TUNNEL_TCP = exports.DESC_COMMAND_AGENT_TUNNEL_REMOVE = exports.DESC_COMMAND_AGENT_TUNNEL_STATUS = exports.DESC_COMMAND_AGENT_TUNNEL_START = exports.DESC_COMMAND_AGENT_TUNNEL_LIST = exports.DESC_COMMAND_AGENT_TUNNEL_HTTP = exports.DESC_COMMAND_CONFIG_SET = exports.DESC_COMMAND_CONFIG_REMOVE = exports.DESC_COMMAND_CONFIG_GET = exports.DESC_COMMAND_CONFIG_ADD = exports.DESC_COMMAND_CONFIG_SET_WHITELIST = exports.DESC_COMMAND_CONFIG_SET_TOKEN = exports.DESC_COMMAND_CONFIG_SET_TIMEOUT = exports.DESC_COMMAND_CONFIG_SET_REGION = exports.DESC_COMMAND_CONFIG_REMOVE_TUNNEL = exports.DESC_COMMAND_CONFIG_GET_WHITELIST = exports.DESC_COMMAND_CONFIG_GET_TUNNELS = exports.DESC_COMMAND_CONFIG_GET_TUNNEL = exports.DESC_COMMAND_CONFIG_GET_TOKEN = exports.DESC_COMMAND_CONFIG_GET_TIMEOUT = exports.DESC_COMMAND_CONFIG_GET_REGION = exports.DESC_COMMAND_CONFIG_ADD_TLS = exports.DESC_COMMAND_CONFIG_ADD_TCP = exports.DESC_COMMAND_CONFIG_ADD_HTTP = exports.AGENT_FETCH_RETRY = exports.NO_TUNNELS_STARTED = exports.TXT_TUNNEL_ADDED = exports.TXT_TUNNEL_REMOVED = exports.TXT_REGION_SAVED = exports.TXT_TIMEOUT_SAVED = exports.TXT_TOKEN_REMOVED = exports.TXT_TOKEN_SAVED = exports.TXT_WHITELIST_SAVED = exports.TXT_TUNNEL_STOPPED = void 0;
|
|
6
6
|
exports.OPTION_USER = exports.OPTION_AGENT_TOKEN = exports.OPTION_AGENT_START = exports.OPTION_AGENT_ID = exports.OPTION_ID = exports.OPTION_NAME = exports.OPTION_TARGET = exports.OPTION_TLS_TERMINATE = exports.OPTION_TLS_CA = exports.OPTION_TLS_CERT = exports.OPTION_TLS_KEY = exports.OPTION_HTTP_CIRCUIT_BREAKER = exports.OPTION_HTTP_COMPRESSION = exports.OPTION_HTTP_2 = exports.OPTION_HTTP_VERIFY = exports.OPTION_HTTP_LOG = exports.OPTION_HTTP_AUTH = exports.OPTION_HTTP_HOST = exports.OPTION_FORCE = exports.OPTION_TOKEN = exports.OPTION_TIMEOUT = exports.OPTION_DOMAIN = exports.OPTION_FOLLOW = exports.OPTION_SUBDOMAIN = exports.OPTION_SERVE = exports.OPTION_HEADER_USER_AGENT = exports.OPTION_RESPONSE_HEADER = exports.OPTION_HEADER = exports.OPTION_WHITELIST = exports.OPTION_DEFAULT_REGION = exports.OPTION_REGION = exports.TXT_CI_INFO = exports.TXT_STORIES_AMOUNT = exports.TXT_OPENING_TUNNEL = exports.TXT_UPDATING_AGENT = exports.TXT_ENABLING_AGENT = exports.TXT_DISABLING_AGENT = exports.TXT_NEW_AGENT_VERSION = exports.TXT_NEW_CLI_VERSION = exports.TXT_NEW_CLI_DOCKER_VERSION = exports.DESC_COMMAND_VT_INSTALL_BROWSER = exports.DESC_COMMAND_VT_EXEC = exports.DESC_COMMAND_VT_STORYBOOK = exports.DESC_COMMAND_VT_CLOSE = exports.DESC_COMMAND_VT = exports.DESC_PROGRAM = exports.DESC_COMMAND_TLS = exports.DESC_COMMAND_TCP = exports.DESC_COMMAND_START = exports.DESC_COMMAND_AGENT = void 0;
|
|
7
7
|
exports.LOG_ERROR_STARTING_AGENT_SERVER = exports.LOG_REQUEST = exports.LOG_SSH_CONNECTION = exports.LOG_WRONG_STREAM = exports.LOG_DETECTED_STREAM = exports.LOG_HTTP2_REQUEST = exports.LOG_HTTP2_CONNECTION = exports.LOG_HTTP1_REQUEST = exports.LOG_HTTP1_CONNECTION = exports.LOG_ERROR = exports.LOG_STOPPING_TUNNEL = exports.LOG_STARTING_TUNNEL = exports.LOG_ENABLING_AGENT_TARGET = exports.LOG_DISABLING_AGENT_TARGET = exports.LOG_REMOVING_TUNNEL = exports.LOG_TUNNEL_REGISTERED = exports.LOG_ERROR_WHILE_REFRESHING_AGENT = exports.LOG_REGISTERING_TUNNEL = exports.LOG_GETTING_AGENT = exports.LOG_UNREGISTERING_AGENT = exports.LOG_REGION_DETECTED = exports.LOG_AGENT_REGISTERED = exports.LOG_SOCKET_DISCONNECTED = exports.LOG_SOCKET_CONNECTED = exports.LOG_AGENT_NSSM_CLEARING = exports.LOG_AGENT_NSSM_EXTRACTING = exports.LOG_AGENT_NSSM_DOWNLOADING = exports.LOG_AGENT_ENABLED = exports.LOG_AGENT_STARTING_SYSTEM = exports.LOG_AGENT_STOPPING_SYSTEM = exports.LOG_AGENT_ENABLING_SYSTEM = exports.LOG_AGENT_SYSTEM_SERVICE_CONFIG = exports.LOG_AGENT_EXTRACTING_ARCHIVE = exports.LOG_AGENT_DOWNLOADING_ARCHIVE = exports.LOG_AGENT_SYSTEM_DIR = exports.LOG_ERROR_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_ERROR_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_ERROR_SAVING_AGENT_CONFIG = exports.LOG_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_SAVING_AGENT_CONFIG = exports.LOG_REGISTERING_AGENT = exports.OPTION_EXEC_PARALLEL = exports.OPTION_EXEC_ONE_BY_ONE = exports.OPTION_EXEC_SKIP_DISCOVERY = exports.OPTION_EXEC_COMMAND = exports.OPTION_AGENT_DEBUG = exports.OPTION_AGENT_PORT = exports.OPTION_AGENT_TARGET = exports.OPTION_PASS = void 0;
|
|
8
|
-
exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREAKER_OPEN = exports.LOG_TUNNEL_HTTP_RATE_LIMIT = exports.LOG_TUNNEL_HTTP_WRON_AUTH = exports.LOG_TUNNEL_IDENTIFIED = exports.LOG_TUNNEL_DISCONNECTED = exports.LOG_TUNNEL_FAILED = exports.LOG_TUNNEL_CONNECTED = exports.LOG_AGENT_STARTED = exports.LOG_AGENT_SERVER_STARTED = void 0;
|
|
8
|
+
exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREAKER_OPEN = exports.LOG_TUNNEL_HTTP_RATE_LIMIT = exports.LOG_TUNNEL_HTTP_WRON_AUTH = exports.LOG_TUNNEL_IDENTIFIED = exports.LOG_TUNNEL_DISCONNECTED = exports.LOG_TUNNEL_FAILED = exports.LOG_TUNNEL_CONNECTED = exports.LOG_AGENT_STARTED = exports.LOG_AGENT_SERVER_STARTED = void 0;
|
|
9
9
|
exports.ERR_AGENT_NOT_REGISTERED = 'Agent not registered. Exiting.';
|
|
10
10
|
exports.ERR_SAVING_AGENT_CONFIG = 'Failed saving agent config. Exiting.';
|
|
11
11
|
const ERR_TARGET_IS_NOT_VALID = (target) => `Target '${target}' invalid`;
|
|
@@ -352,6 +352,8 @@ const DEBUG_RESOURCE_SCRAPPING_URL = (url) => `Scraping resources from ${url}`;
|
|
|
352
352
|
exports.DEBUG_RESOURCE_SCRAPPING_URL = DEBUG_RESOURCE_SCRAPPING_URL;
|
|
353
353
|
exports.DEBUG_AUTO_SCROLL = 'Auto scroll';
|
|
354
354
|
exports.DEBUG_AUTO_WIDTH = 'Auto width';
|
|
355
|
-
const DEBUG_RESOURCE_DISCOVERY_TIMEOUT = (timeout) => `Additional resource discovery timeout: ${timeout}`;
|
|
355
|
+
const DEBUG_RESOURCE_DISCOVERY_TIMEOUT = (timeout) => `Additional resource discovery timeout: ${timeout}ms`;
|
|
356
356
|
exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = DEBUG_RESOURCE_DISCOVERY_TIMEOUT;
|
|
357
357
|
exports.DEBUG_WAIT_FOR_IDLE = 'Wait for network idle';
|
|
358
|
+
const DEBUG_WAIT_FOR_IDLE_TIMEOUT = (timeout) => `Wait for network idle timeout after ${timeout}ms`;
|
|
359
|
+
exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = DEBUG_WAIT_FOR_IDLE_TIMEOUT;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debug = exports.executionUrl = exports.browserPath = exports.commitDetails = exports.invokerId = exports.executionId = exports.actionId = exports.pipelineName = exports.pipelineId = exports.baseCommit = exports.commit = exports.branch = exports.ci = exports.cliId = exports.buildId = exports.token = exports.parallel = exports.skipDiscovery = exports.oneByOne = exports.cliVersion = void 0;
|
|
3
|
+
exports.debug = exports.executionUrl = exports.browserPath = exports.commitDetails = exports.invokerId = exports.executionId = exports.actionId = exports.pipelineName = exports.pipelineId = exports.baseCommit = exports.commit = exports.branch = exports.ci = exports.defaultTimeout = exports.cliId = exports.buildId = exports.token = exports.parallel = exports.skipDiscovery = exports.oneByOne = exports.cliVersion = void 0;
|
|
4
4
|
exports.setOptions = setOptions;
|
|
5
5
|
exports.setBrowserPath = setBrowserPath;
|
|
6
6
|
exports.setCiAndCommitInfo = setCiAndCommitInfo;
|
|
@@ -14,6 +14,7 @@ exports.parallel = false;
|
|
|
14
14
|
exports.token = process.env.BUDDY_VT_TOKEN || '';
|
|
15
15
|
exports.buildId = process.env.SNAPSHOTS_BUILD_ID || (0, uuid_1.v4)();
|
|
16
16
|
exports.cliId = (0, uuid_1.v4)();
|
|
17
|
+
exports.defaultTimeout = Number(process.env.SNAPSHOTS_DEFAULT_TIMEOUT) || 60_000;
|
|
17
18
|
exports.ci = ciInfo_js_1.CI.NONE;
|
|
18
19
|
exports.debug = process.env.DEBUG === '1';
|
|
19
20
|
function setOptions(options) {
|
|
@@ -52,7 +52,7 @@ function createFormData(info, files) {
|
|
|
52
52
|
}
|
|
53
53
|
return formData;
|
|
54
54
|
}
|
|
55
|
-
async function sendSnapshot(snapshot) {
|
|
55
|
+
async function sendSnapshot(snapshot, firstSnapshot) {
|
|
56
56
|
const files = [];
|
|
57
57
|
const preparedSnapshot = prepareSnapshot(snapshot, files);
|
|
58
58
|
const info = {
|
|
@@ -73,6 +73,7 @@ async function sendSnapshot(snapshot) {
|
|
|
73
73
|
commitDetails: context_js_1.commitDetails,
|
|
74
74
|
cliId: context_js_1.cliId,
|
|
75
75
|
executionUrl: context_js_1.executionUrl,
|
|
76
|
+
firstSnapshot,
|
|
76
77
|
};
|
|
77
78
|
const formData = createFormData(info, files);
|
|
78
79
|
const [message] = await sendRequest({
|
|
@@ -106,6 +107,7 @@ async function sendSnapshots(snapshots) {
|
|
|
106
107
|
commitDetails: context_js_1.commitDetails,
|
|
107
108
|
cliId: context_js_1.cliId,
|
|
108
109
|
executionUrl: context_js_1.executionUrl,
|
|
110
|
+
firstSnapshot: true,
|
|
109
111
|
};
|
|
110
112
|
const formData = createFormData(info, files);
|
|
111
113
|
const [message] = await sendRequest({
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.collectResources = collectResources;
|
|
7
|
-
const puppeteer_core_1 =
|
|
40
|
+
const puppeteer_core_1 = __importStar(require("puppeteer-core"));
|
|
8
41
|
const context_js_1 = require("./context.js");
|
|
9
42
|
const output_1 = __importDefault(require("../output"));
|
|
10
43
|
const texts_1 = require("../texts");
|
|
@@ -113,6 +146,7 @@ async function scrapeResources({ url, widths, height, resourceDiscoveryTimeout,
|
|
|
113
146
|
};
|
|
114
147
|
const browser = await puppeteer_core_1.default.launch(launchOptions);
|
|
115
148
|
const page = await browser.newPage();
|
|
149
|
+
page.setDefaultTimeout(context_js_1.defaultTimeout);
|
|
116
150
|
const initWidth = widths[0];
|
|
117
151
|
await page.setViewport({
|
|
118
152
|
width: initWidth,
|
|
@@ -162,7 +196,17 @@ async function scrapeResources({ url, widths, height, resourceDiscoveryTimeout,
|
|
|
162
196
|
output_1.default.warning((0, texts_1.DEBUG_RESOURCE_DISCOVERY_TIMEOUT)(resourceDiscoveryTimeout));
|
|
163
197
|
}
|
|
164
198
|
}
|
|
165
|
-
|
|
199
|
+
try {
|
|
200
|
+
await output_1.default.debugAction(texts_1.DEBUG_WAIT_FOR_IDLE, page.waitForNetworkIdle());
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
if (error instanceof puppeteer_core_1.TimeoutError) {
|
|
204
|
+
output_1.default.warning((0, texts_1.DEBUG_WAIT_FOR_IDLE_TIMEOUT)(context_js_1.defaultTimeout));
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
166
210
|
await browser.close();
|
|
167
211
|
return { scrapedResourcesUrls, duplicatedResourcesUrls };
|
|
168
212
|
}
|
|
@@ -15,6 +15,7 @@ const texts_1 = require("../texts");
|
|
|
15
15
|
const snapshots = [];
|
|
16
16
|
let defaultWidths = [];
|
|
17
17
|
let defaultScaleRatio = 1;
|
|
18
|
+
let firstSnapshot = true;
|
|
18
19
|
function setDefaultSettings({ defaultWidths: width, defaultScaleRatio: scaleRatio, }) {
|
|
19
20
|
defaultWidths = width;
|
|
20
21
|
defaultScaleRatio = scaleRatio;
|
|
@@ -26,11 +27,14 @@ function addSnapshot(snapshot) {
|
|
|
26
27
|
scaleRatio: defaultScaleRatio,
|
|
27
28
|
};
|
|
28
29
|
if (context_js_1.oneByOne) {
|
|
29
|
-
(0, queue_js_1.addToQueue)(() => processSnapshot(preparedSnapshots));
|
|
30
|
+
(0, queue_js_1.addToQueue)(() => processSnapshot(preparedSnapshots, firstSnapshot));
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
snapshots.push(preparedSnapshots);
|
|
33
34
|
}
|
|
35
|
+
if (firstSnapshot) {
|
|
36
|
+
firstSnapshot = false;
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
async function finishProcessingSnapshots(spawnedProcessExitCode) {
|
|
36
40
|
if (context_js_1.oneByOne) {
|
|
@@ -40,7 +44,7 @@ async function finishProcessingSnapshots(spawnedProcessExitCode) {
|
|
|
40
44
|
return await processSnapshots();
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
async function processSnapshot(snapshot) {
|
|
47
|
+
async function processSnapshot(snapshot, firstSnapshot) {
|
|
44
48
|
let t1;
|
|
45
49
|
if (context_js_1.debug) {
|
|
46
50
|
t1 = performance.now();
|
|
@@ -49,7 +53,7 @@ async function processSnapshot(snapshot) {
|
|
|
49
53
|
? snapshot
|
|
50
54
|
: await getSnapshotWithResources(snapshot);
|
|
51
55
|
try {
|
|
52
|
-
const response = await (0, requests_js_1.sendSnapshot)(preparedSnapshot);
|
|
56
|
+
const response = await (0, requests_js_1.sendSnapshot)(preparedSnapshot, firstSnapshot);
|
|
53
57
|
output_1.default.normal(response);
|
|
54
58
|
}
|
|
55
59
|
catch (error) {
|