@browserstack/mcp-server 1.2.28 → 1.2.29-beta.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.
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { apiClient } from "../../lib/apiClient.js";
|
|
2
2
|
import { parse } from "csv-parse/sync";
|
|
3
|
+
import logger from "../../logger.js";
|
|
3
4
|
export async function parseAccessibilityReportFromCSV(reportLink, { maxCharacterLength = 5000, nextPage = 0 } = {}) {
|
|
4
5
|
// 1) Download & parse
|
|
5
6
|
const res = await apiClient.get({ url: reportLink });
|
|
6
7
|
if (!res.ok)
|
|
7
8
|
throw new Error(`Failed to download report: ${res.statusText}`);
|
|
8
9
|
const text = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = parse(text, {
|
|
13
|
+
columns: true,
|
|
14
|
+
skip_empty_lines: true,
|
|
15
|
+
relax_column_count_less: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
logger.error(`[AccessibilityReport] CSV parse failed (${text.length} chars): ${err instanceof Error ? err.message : String(err)}`);
|
|
20
|
+
throw err;
|
|
21
|
+
}
|
|
22
|
+
const all = parsed.map((row) => ({
|
|
13
23
|
issue_type: row["Issue type"],
|
|
14
24
|
component: row["Component"],
|
|
15
25
|
issue_description: row["Issue description"],
|