bdy 1.9.45-dev → 1.9.47-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 +3 -2
- package/distTs/src/command/agent/install.js +7 -0
- package/distTs/src/command/agent/uninstall.js +6 -0
- package/distTs/src/command/vt/compare/validation.js +172 -0
- package/distTs/src/command/vt/compare.js +92 -0
- package/distTs/src/command/vt/exec.js +1 -1
- package/distTs/src/command/vt.js +2 -0
- package/distTs/src/texts.js +20 -5
- package/distTs/src/visualTest/ci.js +2 -0
- package/distTs/src/visualTest/context.js +2 -2
- package/distTs/src/visualTest/linkUtils.js +21 -0
- package/distTs/src/visualTest/requests.js +36 -0
- package/package.json +3 -2
package/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.47-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"uuid": "10.0.0",
|
|
49
49
|
"which": "4.0.0",
|
|
50
50
|
"ws": "8.18.0",
|
|
51
|
-
"zod": "3.24.2"
|
|
51
|
+
"zod": "3.24.2",
|
|
52
|
+
"fast-xml-parser": "4.5.1"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@eslint/js": "9.13.0",
|
|
@@ -31,6 +31,12 @@ const removeAllAndExit = async (txt, id, host, token) => {
|
|
|
31
31
|
catch {
|
|
32
32
|
// do nothing
|
|
33
33
|
}
|
|
34
|
+
try {
|
|
35
|
+
manager_js_1.default.system.clearAgentFiles();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// do nothing
|
|
39
|
+
}
|
|
34
40
|
output_js_1.default.exitError(txt);
|
|
35
41
|
};
|
|
36
42
|
const commandAgentInstall = (0, utils_1.newCommand)('install', texts_js_1.DESC_COMMAND_AGENT_INSTALL);
|
|
@@ -89,6 +95,7 @@ commandAgentInstall.action(async (options) => {
|
|
|
89
95
|
if (!saved) {
|
|
90
96
|
await removeAllAndExit(texts_js_1.ERR_SWW_AGENT_ENABLING, id, host, token);
|
|
91
97
|
}
|
|
98
|
+
manager_js_1.default.system.clearAgentFiles();
|
|
92
99
|
await output_js_1.default.spinner(texts_js_1.TXT_ENABLING_AGENT);
|
|
93
100
|
if (process.env.DEBUG === '1') {
|
|
94
101
|
manager_js_1.default.start(id, host, token, port, !!options.start);
|
|
@@ -33,6 +33,12 @@ commandAgentUninstall.action(async () => {
|
|
|
33
33
|
catch {
|
|
34
34
|
// do nothing
|
|
35
35
|
}
|
|
36
|
+
try {
|
|
37
|
+
manager_js_1.default.system.clearAgentFiles();
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// do nothing
|
|
41
|
+
}
|
|
36
42
|
output_js_1.default.exitSuccess(texts_js_1.TXT_AGENT_DISABLED);
|
|
37
43
|
});
|
|
38
44
|
exports.default = commandAgentUninstall;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateOptions = validateOptions;
|
|
7
|
+
exports.checkIfMinimalOptionsAreProvided = checkIfMinimalOptionsAreProvided;
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const DEFAULT_SCOPE = '**';
|
|
11
|
+
const optionsSchema = zod_1.z.object({
|
|
12
|
+
urls: zod_1.z.string().optional(),
|
|
13
|
+
sitemap: zod_1.z.string().optional(),
|
|
14
|
+
urlsFile: zod_1.z.string().optional(),
|
|
15
|
+
follow: zod_1.z.boolean(),
|
|
16
|
+
respectRobots: zod_1.z.boolean(),
|
|
17
|
+
ignore: zod_1.z
|
|
18
|
+
.array(zod_1.z.string().regex(/^(?:([^:]+)::)?(?:(CSS|XPATH))=(.+)$/, {
|
|
19
|
+
message: "Ignore option must follow pattern '[scope::]type=value' where type must be CSS or XPATH (scope is optional)",
|
|
20
|
+
}))
|
|
21
|
+
.optional()
|
|
22
|
+
.transform((value) => value?.map((v) => {
|
|
23
|
+
let scope, type, value;
|
|
24
|
+
if (v.includes('::')) {
|
|
25
|
+
const parts = v.split('::');
|
|
26
|
+
scope = parts[0];
|
|
27
|
+
const typeValuePair = parts[1].split('=');
|
|
28
|
+
type = typeValuePair[0];
|
|
29
|
+
value = typeValuePair[1];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const typeValuePair = v.split('=');
|
|
33
|
+
type = typeValuePair[0];
|
|
34
|
+
value = typeValuePair[1];
|
|
35
|
+
scope = DEFAULT_SCOPE;
|
|
36
|
+
}
|
|
37
|
+
return { scope, type, value };
|
|
38
|
+
})),
|
|
39
|
+
cookie: zod_1.z
|
|
40
|
+
.array(zod_1.z
|
|
41
|
+
.string()
|
|
42
|
+
.max(4096, {
|
|
43
|
+
message: 'Cookie must be less than 4096 characters',
|
|
44
|
+
})
|
|
45
|
+
.regex(/^(?:([^:]+)::)?(.+)$/, {
|
|
46
|
+
message: "Cookie option must follow pattern '[scope::]cookie_value' (scope is optional)",
|
|
47
|
+
}))
|
|
48
|
+
.optional()
|
|
49
|
+
.transform((value) => value?.map((v) => {
|
|
50
|
+
let scope = DEFAULT_SCOPE;
|
|
51
|
+
let cookieValue = v;
|
|
52
|
+
if (v.includes('::')) {
|
|
53
|
+
const [scopePart, valuePart] = v.split('::');
|
|
54
|
+
scope = scopePart.trim();
|
|
55
|
+
cookieValue = valuePart.trim();
|
|
56
|
+
}
|
|
57
|
+
// Parse cookie string into components
|
|
58
|
+
const cookieParts = cookieValue.split(';').map((part) => part.trim());
|
|
59
|
+
const mainPart = cookieParts[0].split('=');
|
|
60
|
+
const key = mainPart[0].trim();
|
|
61
|
+
const value = mainPart[1].trim();
|
|
62
|
+
const cookie = {
|
|
63
|
+
scope,
|
|
64
|
+
key,
|
|
65
|
+
value,
|
|
66
|
+
httpOnly: false,
|
|
67
|
+
secure: false,
|
|
68
|
+
};
|
|
69
|
+
// Process additional cookie attributes
|
|
70
|
+
for (let i = 1; i < cookieParts.length; i++) {
|
|
71
|
+
const part = cookieParts[i].toLowerCase();
|
|
72
|
+
if (part === 'httponly') {
|
|
73
|
+
cookie.httpOnly = true;
|
|
74
|
+
}
|
|
75
|
+
else if (part === 'secure') {
|
|
76
|
+
cookie.secure = true;
|
|
77
|
+
}
|
|
78
|
+
else if (part.startsWith('domain=')) {
|
|
79
|
+
cookie.domain = part.substring(7);
|
|
80
|
+
}
|
|
81
|
+
else if (part.startsWith('path=')) {
|
|
82
|
+
cookie.path = part.substring(5);
|
|
83
|
+
}
|
|
84
|
+
else if (part.startsWith('samesite=')) {
|
|
85
|
+
const sameSiteValue = part.substring(9);
|
|
86
|
+
if (['strict', 'lax', 'none'].includes(sameSiteValue.toLowerCase())) {
|
|
87
|
+
cookie.sameSite = (sameSiteValue.charAt(0).toUpperCase() +
|
|
88
|
+
sameSiteValue.slice(1).toLowerCase());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return cookie;
|
|
93
|
+
})),
|
|
94
|
+
header: zod_1.z
|
|
95
|
+
.array(zod_1.z.string().regex(/^(?:([^:]+)::)?(.+)$/, {
|
|
96
|
+
message: "Header option must follow pattern '[scope::]header_value' (scope is optional)",
|
|
97
|
+
}))
|
|
98
|
+
.optional()
|
|
99
|
+
.transform((value) => value?.map((v) => {
|
|
100
|
+
if (v.includes('::')) {
|
|
101
|
+
const [scope, headerValue] = v.split('::');
|
|
102
|
+
const [name, value] = headerValue.split('=');
|
|
103
|
+
return {
|
|
104
|
+
scope: scope.trim(),
|
|
105
|
+
key: name.trim(),
|
|
106
|
+
value: value.trim(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const [name, value] = v.split('=');
|
|
111
|
+
return {
|
|
112
|
+
scope: DEFAULT_SCOPE,
|
|
113
|
+
key: name.trim(),
|
|
114
|
+
value: value.trim(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
})),
|
|
118
|
+
delay: zod_1.z
|
|
119
|
+
.array(zod_1.z.string().regex(/^(?:([^:]+)::)?(\d+)$/, {
|
|
120
|
+
message: "Delay option must follow pattern '[scope::]milliseconds' (scope is optional)",
|
|
121
|
+
}))
|
|
122
|
+
.optional()
|
|
123
|
+
.transform((value) => value?.map((v) => {
|
|
124
|
+
if (v.includes('::')) {
|
|
125
|
+
const [scope, milliseconds] = v.split('::');
|
|
126
|
+
return { scope: scope.trim(), value: Number(milliseconds) };
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
return { scope: DEFAULT_SCOPE, value: Number(v) };
|
|
130
|
+
}
|
|
131
|
+
})),
|
|
132
|
+
waitFor: zod_1.z
|
|
133
|
+
.array(zod_1.z.string().regex(/^(?:([^:]+)::)?(?:(CSS|XPATH))=(.+)$/, {
|
|
134
|
+
message: "WaitFor option must follow pattern '[scope::]type=value' where type must be CSS or XPATH (scope is optional)",
|
|
135
|
+
}))
|
|
136
|
+
.optional()
|
|
137
|
+
.transform((value) => value?.map((v) => {
|
|
138
|
+
let scope, type, value;
|
|
139
|
+
if (v.includes('::')) {
|
|
140
|
+
const parts = v.split('::');
|
|
141
|
+
scope = parts[0];
|
|
142
|
+
const typeValuePair = parts[1].split('=');
|
|
143
|
+
type = typeValuePair[0];
|
|
144
|
+
value = typeValuePair[1];
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const typeValuePair = v.split('=');
|
|
148
|
+
type = typeValuePair[0];
|
|
149
|
+
value = typeValuePair[1];
|
|
150
|
+
scope = DEFAULT_SCOPE;
|
|
151
|
+
}
|
|
152
|
+
return { scope, type, value };
|
|
153
|
+
})),
|
|
154
|
+
dryRun: zod_1.z.boolean().optional(),
|
|
155
|
+
});
|
|
156
|
+
function validateOptions(options) {
|
|
157
|
+
try {
|
|
158
|
+
const validatedOptions = optionsSchema.parse(options);
|
|
159
|
+
return validatedOptions;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (error instanceof zod_1.ZodError) {
|
|
163
|
+
output_1.default.exitError(error.errors.map((e) => e.message).join(', '));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function checkIfMinimalOptionsAreProvided(options) {
|
|
171
|
+
return !!options.urls || !!options.sitemap || !!options.urlsFile;
|
|
172
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_js_1 = require("../../texts.js");
|
|
8
|
+
const validation_1 = require("../../visualTest/validation");
|
|
9
|
+
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const linkUtils_1 = require("../../visualTest/linkUtils");
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const requests_1 = require("../../visualTest/requests");
|
|
13
|
+
const validation_2 = require("./compare/validation");
|
|
14
|
+
const commandVtCompare = (0, utils_1.newCommand)('compare', texts_js_1.DESC_COMMAND_VT_COMPARE);
|
|
15
|
+
commandVtCompare.option('--urls <urls>', texts_js_1.OPTION_COMPARE_URLS);
|
|
16
|
+
commandVtCompare.option('--sitemap <sitemap>', texts_js_1.OPTION_COMPARE_SITEMAP);
|
|
17
|
+
commandVtCompare.option('--urlsFile <urlsFile>', texts_js_1.OPTION_COMPARE_URLS_FILE);
|
|
18
|
+
commandVtCompare.option('--dryRun', texts_js_1.OPTION_COMPARE_DRY_RUN);
|
|
19
|
+
commandVtCompare.option('--follow', texts_js_1.OPTION_COMPARE_FOLLOW, false);
|
|
20
|
+
commandVtCompare.option('--respectRobots', texts_js_1.OPTION_COMPARE_RESPECT_ROBOTS, false);
|
|
21
|
+
commandVtCompare.option('--ignore <ignores...>', texts_js_1.OPTION_COMPARE_IGNORE);
|
|
22
|
+
commandVtCompare.option('--cookie <cookies...>', texts_js_1.OPTION_COMPARE_COOKIE);
|
|
23
|
+
commandVtCompare.option('--header <headers...>', texts_js_1.OPTION_COMPARE_HEADER);
|
|
24
|
+
commandVtCompare.option('--delay <delays...>', texts_js_1.OPTION_COMPARE_DELAY);
|
|
25
|
+
commandVtCompare.option('--waitFor <waitFors...>', texts_js_1.OPTION_COMPARE_WAIT_FOR);
|
|
26
|
+
commandVtCompare.action(async (options) => {
|
|
27
|
+
const validatedOptions = (0, validation_2.validateOptions)(options);
|
|
28
|
+
if (!(0, validation_1.checkToken)()) {
|
|
29
|
+
output_1.default.exitError(texts_js_1.ERR_MISSING_TOKEN);
|
|
30
|
+
}
|
|
31
|
+
if (!(0, validation_2.checkIfMinimalOptionsAreProvided)(validatedOptions)) {
|
|
32
|
+
output_1.default.exitError(texts_js_1.ERR_MISSING_URLS);
|
|
33
|
+
}
|
|
34
|
+
let urls = [];
|
|
35
|
+
let sitemapSource;
|
|
36
|
+
if (validatedOptions.urls) {
|
|
37
|
+
const urlsList = getUrlsFromUrlOption(validatedOptions.urls);
|
|
38
|
+
urls = urls.concat(urlsList);
|
|
39
|
+
}
|
|
40
|
+
else if (validatedOptions.urlsFile) {
|
|
41
|
+
const urlsList = getUrlsFromUrlFile(validatedOptions.urlsFile);
|
|
42
|
+
urls = urls.concat(urlsList);
|
|
43
|
+
}
|
|
44
|
+
else if (validatedOptions.sitemap) {
|
|
45
|
+
sitemapSource = (0, linkUtils_1.addProtocolIfMissing)(validatedOptions.sitemap);
|
|
46
|
+
}
|
|
47
|
+
const { filteredUrls, duplicates } = filterDuplicates(urls);
|
|
48
|
+
if (duplicates.length > 0) {
|
|
49
|
+
output_1.default.normal(`Detected ${duplicates.length} duplicated urls:`);
|
|
50
|
+
output_1.default.normal(duplicates.join('\n'));
|
|
51
|
+
}
|
|
52
|
+
if (validatedOptions.dryRun) {
|
|
53
|
+
output_1.default.exitSuccess(`List of urls:\n${filteredUrls.join('\n')}`);
|
|
54
|
+
}
|
|
55
|
+
else if (filteredUrls.length > 1) {
|
|
56
|
+
output_1.default.normal(`List of urls:\n${filteredUrls.join('\n')}`);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const response = await (0, requests_1.sendCompareLinks)(filteredUrls, validatedOptions, sitemapSource);
|
|
60
|
+
output_1.default.exitSuccess(response);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
output_1.default.exitError(`${error}`);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
function getUrlsFromUrlOption(urls) {
|
|
67
|
+
return urls.split(',').map((url) => (0, linkUtils_1.addProtocolIfMissing)(url).trim());
|
|
68
|
+
}
|
|
69
|
+
function getUrlsFromUrlFile(urlsFile) {
|
|
70
|
+
const urlsFromFile = (0, node_fs_1.readFileSync)(urlsFile, 'utf-8');
|
|
71
|
+
return urlsFromFile
|
|
72
|
+
.split('\n')
|
|
73
|
+
.filter((url) => url.trim().length > 0)
|
|
74
|
+
.map((url) => (0, linkUtils_1.addProtocolIfMissing)(url).trim());
|
|
75
|
+
}
|
|
76
|
+
function filterDuplicates(urls) {
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
const duplicates = new Set();
|
|
79
|
+
for (const url of urls) {
|
|
80
|
+
if (seen.has(url)) {
|
|
81
|
+
duplicates.add(url);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
seen.add(url);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
filteredUrls: Array.from(seen),
|
|
89
|
+
duplicates: Array.from(duplicates),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
exports.default = commandVtCompare;
|
|
@@ -21,7 +21,7 @@ commandVtExec.option('--skipDiscovery', texts_js_1.OPTION_EXEC_SKIP_DISCOVERY);
|
|
|
21
21
|
commandVtExec.option('--oneByOne', texts_js_1.OPTION_EXEC_ONE_BY_ONE);
|
|
22
22
|
commandVtExec.option('--parallel', texts_js_1.OPTION_EXEC_PARALLEL);
|
|
23
23
|
commandVtExec.action(async (command, options) => {
|
|
24
|
-
(0, context_1.
|
|
24
|
+
(0, context_1.setExecOptions)(options);
|
|
25
25
|
try {
|
|
26
26
|
const browserPath = await (0, browser_1.getBrowserPath)();
|
|
27
27
|
(0, context_1.setBrowserPath)(browserPath);
|
package/distTs/src/command/vt.js
CHANGED
|
@@ -9,11 +9,13 @@ const close_1 = __importDefault(require("./vt/close"));
|
|
|
9
9
|
const storybook_1 = __importDefault(require("./vt/storybook"));
|
|
10
10
|
const exec_1 = __importDefault(require("./vt/exec"));
|
|
11
11
|
const installBrowser_1 = __importDefault(require("./vt/installBrowser"));
|
|
12
|
+
const compare_1 = __importDefault(require("./vt/compare"));
|
|
12
13
|
const scrap_js_1 = __importDefault(require("./vt/scrap.js"));
|
|
13
14
|
const commandVt = (0, utils_1.newCommand)('vt', texts_js_1.DESC_COMMAND_VT);
|
|
14
15
|
commandVt.addCommand(close_1.default);
|
|
15
16
|
commandVt.addCommand(storybook_1.default);
|
|
16
17
|
commandVt.addCommand(exec_1.default);
|
|
17
18
|
commandVt.addCommand(installBrowser_1.default);
|
|
19
|
+
commandVt.addCommand(compare_1.default);
|
|
18
20
|
commandVt.addCommand(scrap_js_1.default);
|
|
19
21
|
exports.default = commandVt;
|
package/distTs/src/texts.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ERR_SWW = exports.ERR_NOT_FOUND = exports.ERR_FAILED_TO_CONNECT_TO_AGENT = exports.ERR_TUNNEL_REMOVED = exports.ERR_TUNNELS_DISABLED = exports.ERR_AGENT_LIMIT_REACHED = exports.ERR_TUNNEL_TARGET_INVALID = exports.ERR_TUNNEL_LIMIT_REACHED = exports.ERR_DOMAIN_RESTRICTED = exports.ERR_SUBDOMAIN_INVALID = exports.ERR_SUBDOMAIN_TAKEN = exports.ERR_AGENT_REMOVED = exports.ERR_FAILED_TO_CONNECT = exports.ERR_TUNNEL_ALREADY_EXISTS = exports.ERR_AGENT_NOT_SUPPORTED = exports.ERR_AGENT_ADMIN_RIGHTS = exports.ERR_AGENT_ENABLE = exports.ERR_SWW_AGENT_UPDATING = exports.ERR_SWW_AGENT_DISABLING = exports.ERR_SWW_AGENT_ENABLING = exports.ERR_AGENT_NOT_FOUND = exports.ERR_AGENT_NOT_RUNNING = exports.ERR_AGENT_NOT_ENABLED = exports.ERR_TUNNEL_NOT_FOUND = exports.ERR_WHITELIST_IS_NOT_VALID = exports.ERR_USER_AGENT_IS_NOT_VALID = exports.ERR_BA_IS_NOT_VALID = exports.ERR_BA_LOGIN_NOT_PROVIDED = exports.ERR_BA_PASSWORD_NOT_PROVIDED = exports.ERR_CB_THRESHOLD_IS_NOT_VALID = exports.ERR_DOMAIN_IS_NOT_VALID = exports.ERR_CERT_PATH_IS_NOT_VALID = exports.ERR_KEY_PATH_IS_NOT_VALID = exports.ERR_CA_PATH_IS_NOT_VALID = exports.ERR_WRONG_CA = exports.ERR_WRONG_KEY_CERT = exports.ERR_NAME_WITHOUT_ASTERISK = exports.ERR_PORT_IS_NOT_VALID = exports.ERR_REGION_IS_NOT_VALID = exports.ERR_PATH_IS_NOT_DIRECTORY = exports.ERR_DIRECTORY_DOES_NOT_EXISTS = exports.ERR_SUBDOMAIN_IS_TOO_LONG = exports.ERR_SUBDOMAIN_IS_TOO_SHORT = exports.ERR_SUBDOMAIN_IS_NOT_VALID = exports.ERR_TERMINATE_IS_NOT_VALID = exports.ERR_TIMEOUT_IS_NOT_VALID = exports.ERR_TYPE_IS_NOT_VALID = exports.ERR_TARGET_IS_NOT_VALID = exports.ERR_SAVING_AGENT_CONFIG = exports.ERR_AGENT_NOT_REGISTERED = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
4
|
+
exports.TXT_AGENT_IS_ENABLED_AND_HAVE_TROUBLES = exports.TXT_AGENT_IS_ENABLED_AND_INITIALIZING = exports.TXT_AGENT_IS_ENABLED_AND_STOPPED = exports.TXT_AGENT_IS_ENABLED_AND_STARTED = exports.TXT_AGENT_RESTARTED = exports.TXT_AGENT_STARTED = exports.TXT_AGENT_STOPPED = exports.WARN_BROWSER_VERSION = exports.ERR_NO_SNAPSHOTS_TO_SEND = exports.ERR_INVALID_SNAPSHOT = exports.ERR_GETTING_COMMIT_DETAILS = exports.ERR_GETTING_BASE_COMMIT = exports.ERR_HEAD_BRANCH_NOT_DEFINED = exports.ERR_BASE_BRANCH_NOT_DEFINED = exports.ERR_INVALID_COMMIT_HASH = exports.ERR_GETTING_COMMIT_HASH = exports.ERR_INVALID_BRANCH_NAME = exports.ERR_GETTING_BRANCH_NAME = exports.ERR_MISSING_HEAD_COMMIT_IN_FILE = exports.ERR_READING_FILE_WITH_HEAD_COMMIT = exports.ERR_MISSING_FILE_WITH_HEAD_COMMIT = exports.ERR_GITHUB_EVENT_PATH_NOT_FOUND = exports.ERR_TEST_EXECUTION = exports.ERR_INVALID_JSON = exports.ERR_INVALID_DOWNLOAD_RESPONSE = exports.ERR_INVALID_SCRAP_RESPONSE = exports.ERR_INVALID_COMPARE_LINKS_RESPONSE = exports.ERR_INVALID_STORYBOOK_RESPONSE = exports.ERR_INVALID_DEFAULT_SETTINGS_RESPONSE = exports.ERR_INVALID_CLOSE_SESSION_RESPONSE = exports.ERR_INVALID_SNAPSHOTS_RESPONSE = exports.ERR_INVALID_SNAPSHOT_RESPONSE = exports.ERR_MISSING_URLS = exports.ERR_RESOURCE_NOT_FOUND = exports.ERR_MISSING_EXEC_COMMAND = exports.ERR_PARSING_STORIES = exports.ERR_UNSUPPORTED_STORYBOOK = exports.ERR_MISSING_STORYBOOK_INDEX_FILE = exports.ERR_WRONG_STORYBOOK_DIRECTORY = exports.ERR_MISSING_BUILD_ID = exports.ERR_MISSING_TOKEN = exports.ERR_CONFIG_CORRUPTED = exports.ERR_WRONG_TOKEN = exports.ERR_TOKEN_NOT_PROVIDED = exports.ERR_CANT_CREATE_DIR_IN_HOME = exports.ERR_CONNECTION_ERROR = exports.ERR_CONNECTION_TIMEOUT = exports.ERR_WRONG_STREAM = exports.ERR_WRONG_HANDSHAKE = exports.ERR_FETCH_VERSION = void 0;
|
|
5
|
+
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_REMOVE = exports.DESC_COMMAND_AGENT_TUNNEL_STATUS = exports.DESC_COMMAND_AGENT_TUNNEL_LIST = 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 = exports.TXT_TUNNEL_STARTED = exports.TXT_AGENT_DISABLED = exports.TXT_AGENT_ALREADY_ENABLED = exports.TXT_AGENT_UPDATED = exports.TXT_AGENT_ENABLED = exports.TXT_AGENT_TARGET_DISABLED = exports.TXT_AGENT_TARGET_ENABLED = exports.TXT_AGENT_IS_DISABLED = void 0;
|
|
6
|
+
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_SCRAP = exports.DESC_COMMAND_VT_COMPARE = 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 = exports.DESC_COMMAND_HTTP = exports.DESC_COMMAND_CONFIG = exports.DESC_COMMAND_AGENT_VERSION = exports.DESC_COMMAND_AGENT_UPDATE = void 0;
|
|
7
|
+
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_SCRAP_OUTPUT_DIR = exports.OPTION_SCRAP_DELAY = exports.OPTION_SCRAP_DARK_MODE = exports.OPTION_SCRAP_WAIT_FOR_ELEMENT = exports.OPTION_SCRAP_DEVICE_PIXEL_RATIO = exports.OPTION_SCRAP_VIEWPORT = exports.OPTION_SCRAP_BROWSER = exports.OPTION_SCRAP_XPATH_SELECTOR = exports.OPTION_SCRAP_CSS_SELECTOR = exports.OPTION_SCRAP_FULL_PAGE = exports.OPTION_SCRAP_QUALITY = exports.OPTION_SCRAP_OUTPUT_TYPE = exports.OPTION_SCRAP_FOLLOW = exports.OPTION_SCRAP_URL = exports.OPTION_COMPARE_WAIT_FOR = exports.OPTION_COMPARE_DELAY = exports.OPTION_COMPARE_HEADER = exports.OPTION_COMPARE_COOKIE = exports.OPTION_COMPARE_IGNORE = exports.OPTION_COMPARE_DRY_RUN = exports.OPTION_COMPARE_URLS_FILE = exports.OPTION_COMPARE_SITEMAP = exports.OPTION_COMPARE_URLS = exports.OPTION_COMPARE_RESPECT_ROBOTS = exports.OPTION_COMPARE_FOLLOW = 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 = exports.OPTION_USER = exports.OPTION_AGENT_TOKEN = exports.OPTION_AGENT_START = exports.OPTION_AGENT_ID = exports.OPTION_ID = exports.OPTION_NAME = void 0;
|
|
8
|
+
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 = 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 = void 0;
|
|
9
|
+
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_SESSION_LINK = exports.LOG_SENDING_DATA = exports.LOG_SENDING_REQUEST = void 0;
|
|
9
10
|
const utils_1 = require("./utils");
|
|
10
11
|
exports.ERR_AGENT_NOT_REGISTERED = 'Agent not registered. Exiting.';
|
|
11
12
|
exports.ERR_SAVING_AGENT_CONFIG = 'Failed saving agent config. Exiting.';
|
|
@@ -99,11 +100,13 @@ const ERR_MISSING_EXEC_COMMAND = (command) => `Command not fund ${command}`;
|
|
|
99
100
|
exports.ERR_MISSING_EXEC_COMMAND = ERR_MISSING_EXEC_COMMAND;
|
|
100
101
|
const ERR_RESOURCE_NOT_FOUND = (resourceUrl) => `Resource ${resourceUrl} not found`;
|
|
101
102
|
exports.ERR_RESOURCE_NOT_FOUND = ERR_RESOURCE_NOT_FOUND;
|
|
103
|
+
exports.ERR_MISSING_URLS = 'Pass at least one url or sitemap';
|
|
102
104
|
exports.ERR_INVALID_SNAPSHOT_RESPONSE = `Invalid send snapshot response`;
|
|
103
105
|
exports.ERR_INVALID_SNAPSHOTS_RESPONSE = `Invalid send snapshots response`;
|
|
104
106
|
exports.ERR_INVALID_CLOSE_SESSION_RESPONSE = `Invalid close session response`;
|
|
105
107
|
exports.ERR_INVALID_DEFAULT_SETTINGS_RESPONSE = `Invalid default settings response`;
|
|
106
108
|
exports.ERR_INVALID_STORYBOOK_RESPONSE = `Invalid send storybook response`;
|
|
109
|
+
exports.ERR_INVALID_COMPARE_LINKS_RESPONSE = `Invalid compare links response`;
|
|
107
110
|
exports.ERR_INVALID_SCRAP_RESPONSE = `Invalid send scrap response`;
|
|
108
111
|
exports.ERR_INVALID_DOWNLOAD_RESPONSE = `Invalid download response`;
|
|
109
112
|
exports.ERR_INVALID_JSON = `Invalid JSON`;
|
|
@@ -202,6 +205,7 @@ exports.DESC_PROGRAM = 'Buddy exposes local networked services behinds NATs and
|
|
|
202
205
|
exports.DESC_COMMAND_VT = 'Commands to interact with the visual test service';
|
|
203
206
|
exports.DESC_COMMAND_VT_CLOSE = 'Close visual test session.';
|
|
204
207
|
exports.DESC_COMMAND_VT_STORYBOOK = 'Create visual test session from storybook';
|
|
208
|
+
exports.DESC_COMMAND_VT_COMPARE = 'Create visual test session for specific set of urls';
|
|
205
209
|
exports.DESC_COMMAND_VT_SCRAP = 'Scrap website';
|
|
206
210
|
exports.DESC_COMMAND_VT_EXEC = 'Run tests which use visual service plugin';
|
|
207
211
|
exports.DESC_COMMAND_VT_INSTALL_BROWSER = 'Install browser for visual test';
|
|
@@ -257,6 +261,17 @@ exports.OPTION_EXEC_COMMAND = 'Test runner command';
|
|
|
257
261
|
exports.OPTION_EXEC_SKIP_DISCOVERY = 'Skip resource discovery';
|
|
258
262
|
exports.OPTION_EXEC_ONE_BY_ONE = 'Send snapshots one by one';
|
|
259
263
|
exports.OPTION_EXEC_PARALLEL = 'Send parts of session from different processes';
|
|
264
|
+
exports.OPTION_COMPARE_FOLLOW = 'Scrap all subviews of the page';
|
|
265
|
+
exports.OPTION_COMPARE_RESPECT_ROBOTS = 'Respect robots.txt';
|
|
266
|
+
exports.OPTION_COMPARE_URLS = 'Urls to compare (comma separated list, e.g., --urls "https://example.com,https://example.org")';
|
|
267
|
+
exports.OPTION_COMPARE_SITEMAP = 'Url from which sitemap will be gathered (e.g., --sitemap "https://example.com")';
|
|
268
|
+
exports.OPTION_COMPARE_URLS_FILE = 'File with urls to compare (e.g., --urlsFile "urls.txt")';
|
|
269
|
+
exports.OPTION_COMPARE_DRY_RUN = 'Run command without sending urls list to Buddy';
|
|
270
|
+
exports.OPTION_COMPARE_IGNORE = 'Ignore elements matching selectors while comparing (format: [scope::]type=value, e.g., --ignore "CSS=.ad-banner" "XPATH=//div[@id=\'popup\']" "example.com::CSS=.cookie-notice")';
|
|
271
|
+
exports.OPTION_COMPARE_COOKIE = 'Set cookies used when visiting the urls (format: [scope::]cookie_value, e.g., --cookie "session=abc123" "example.com::auth=token123; Path=/; Secure; HttpOnly")';
|
|
272
|
+
exports.OPTION_COMPARE_HEADER = 'Set HTTP headers used when visiting the urls (format: [scope::]name=value, e.g., --header "Authorization=Bearer token" "example.com::Accept=application/json")';
|
|
273
|
+
exports.OPTION_COMPARE_DELAY = 'Add delay in milliseconds before taking screenshot (format: [scope::]milliseconds, e.g., --delay "1000" "example.com::2000")';
|
|
274
|
+
exports.OPTION_COMPARE_WAIT_FOR = 'Wait for elements to appear before taking screenshot (format: [scope::]type=value, e.g., --waitFor "CSS=#content" "example.com::XPATH=//div[@class=\'loaded\']")';
|
|
260
275
|
exports.OPTION_SCRAP_URL = 'URL to scrape';
|
|
261
276
|
exports.OPTION_SCRAP_FOLLOW = 'Scrape all subviews of the page';
|
|
262
277
|
exports.OPTION_SCRAP_OUTPUT_TYPE = 'Output type';
|
|
@@ -143,6 +143,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
143
143
|
const pipelineId = Number(process.env.BUDDY_PIPELINE_ID);
|
|
144
144
|
const actionId = Number(process.env.BUDDY_ACTION_ID);
|
|
145
145
|
const executionId = Number(process.env.BUDDY_EXECUTION_ID);
|
|
146
|
+
const executionUrl = process.env.BUDDY_RUN_URL;
|
|
146
147
|
return {
|
|
147
148
|
ci: ciInfo_js_1.CI.BUDDY,
|
|
148
149
|
branch,
|
|
@@ -155,6 +156,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
155
156
|
executionId: Number.isNaN(executionId) ? undefined : executionId,
|
|
156
157
|
invokerId: Number.isNaN(invokerId) ? undefined : invokerId,
|
|
157
158
|
commitDetails: await getCommitDetails(commit),
|
|
159
|
+
executionUrl,
|
|
158
160
|
};
|
|
159
161
|
}
|
|
160
162
|
if (isGithubAction) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.debug = exports.executionUrl = exports.browserPath = exports.commitDetails = exports.invokerId = exports.executionId = exports.actionId = exports.pipelineName = exports.pipelineId = exports.baseCommit = exports.commit = exports.pullRequestNumber = exports.branch = exports.ci = exports.defaultTimeout = exports.cliId = exports.buildId = exports.token = exports.parallel = exports.skipDiscovery = exports.oneByOne = exports.cliVersion = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.setExecOptions = setExecOptions;
|
|
5
5
|
exports.setBrowserPath = setBrowserPath;
|
|
6
6
|
exports.setCiAndCommitInfo = setCiAndCommitInfo;
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
@@ -17,7 +17,7 @@ exports.cliId = (0, uuid_1.v4)();
|
|
|
17
17
|
exports.defaultTimeout = Number(process.env.SNAPSHOTS_DEFAULT_TIMEOUT) || 60_000;
|
|
18
18
|
exports.ci = ciInfo_js_1.CI.NONE;
|
|
19
19
|
exports.debug = process.env.DEBUG === '1';
|
|
20
|
-
function
|
|
20
|
+
function setExecOptions(options) {
|
|
21
21
|
if (options.oneByOne) {
|
|
22
22
|
exports.oneByOne = true;
|
|
23
23
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addProtocolIfMissing = addProtocolIfMissing;
|
|
7
|
+
const output_1 = __importDefault(require("../output"));
|
|
8
|
+
function addProtocolIfMissing(url) {
|
|
9
|
+
let urlWithProtocol = url;
|
|
10
|
+
if (!url.toLowerCase().startsWith('http://') &&
|
|
11
|
+
!url.toLowerCase().startsWith('https://')) {
|
|
12
|
+
urlWithProtocol = `http://${url}`;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
new URL(urlWithProtocol);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
output_1.default.exitError(`Invalid url: ${urlWithProtocol}`);
|
|
19
|
+
}
|
|
20
|
+
return urlWithProtocol;
|
|
21
|
+
}
|
|
@@ -8,6 +8,7 @@ exports.sendSnapshots = sendSnapshots;
|
|
|
8
8
|
exports.closeSession = closeSession;
|
|
9
9
|
exports.getDefaultSettings = getDefaultSettings;
|
|
10
10
|
exports.sendStorybook = sendStorybook;
|
|
11
|
+
exports.sendCompareLinks = sendCompareLinks;
|
|
11
12
|
exports.sendScrap = sendScrap;
|
|
12
13
|
exports.downloadScrapPackage = downloadScrapPackage;
|
|
13
14
|
exports.connectToScrapSession = connectToScrapSession;
|
|
@@ -184,6 +185,41 @@ async function sendStorybook(snapshots, filePaths) {
|
|
|
184
185
|
}
|
|
185
186
|
return message;
|
|
186
187
|
}
|
|
188
|
+
async function sendCompareLinks(urls, validatedOptions, sitemapSource) {
|
|
189
|
+
const info = {
|
|
190
|
+
urls,
|
|
191
|
+
sitemapSource,
|
|
192
|
+
ignores: validatedOptions.ignore ?? [],
|
|
193
|
+
cookies: validatedOptions.cookie ?? [],
|
|
194
|
+
headers: validatedOptions.header ?? [],
|
|
195
|
+
delays: validatedOptions.delay ?? [],
|
|
196
|
+
waitFors: validatedOptions.waitFor ?? [],
|
|
197
|
+
follow: validatedOptions.follow,
|
|
198
|
+
respectRobots: validatedOptions.respectRobots,
|
|
199
|
+
token: context_js_1.token,
|
|
200
|
+
buildId: context_js_1.buildId,
|
|
201
|
+
cliVersion: context_js_1.cliVersion,
|
|
202
|
+
ci: context_js_1.ci,
|
|
203
|
+
branch: context_js_1.branch,
|
|
204
|
+
commit: context_js_1.commit,
|
|
205
|
+
baseCommit: context_js_1.baseCommit,
|
|
206
|
+
pipelineId: context_js_1.pipelineId,
|
|
207
|
+
pipelineName: context_js_1.pipelineName,
|
|
208
|
+
actionId: context_js_1.actionId,
|
|
209
|
+
executionId: context_js_1.executionId,
|
|
210
|
+
invokerId: context_js_1.invokerId,
|
|
211
|
+
commitDetails: context_js_1.commitDetails,
|
|
212
|
+
cliId: context_js_1.cliId,
|
|
213
|
+
};
|
|
214
|
+
const [message] = await sendRequest({
|
|
215
|
+
url: '/compareLinks',
|
|
216
|
+
payload: info,
|
|
217
|
+
});
|
|
218
|
+
if (!message) {
|
|
219
|
+
throw new Error(texts_1.ERR_INVALID_COMPARE_LINKS_RESPONSE);
|
|
220
|
+
}
|
|
221
|
+
return message;
|
|
222
|
+
}
|
|
187
223
|
async function sendScrap(url, outputType, follow, quality, fullPage, cssSelector, xpathSelector, browser, viewport, devicePixelRatio, darkMode, delay, waitForElement) {
|
|
188
224
|
const payload = {
|
|
189
225
|
token: context_js_1.token,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.47-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"uuid": "10.0.0",
|
|
49
49
|
"which": "4.0.0",
|
|
50
50
|
"ws": "8.18.0",
|
|
51
|
-
"zod": "3.24.2"
|
|
51
|
+
"zod": "3.24.2",
|
|
52
|
+
"fast-xml-parser": "4.5.1"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@eslint/js": "9.13.0",
|