Persistence for axe-core accessibility violations (AUTO-016).
One row per (run, page, ruleId, node-set) — the axe-core node array is
stored as a JSON blob in nodesJson rather than a separate table to keep
crawl-time inserts cheap. Rows cascade-delete with their parent run.
Methods
(static) bulkCreate(violations) → {number}
Insert a batch of normalised violation records for a single page.
Records are produced by mapA11yViolations() in
backend/src/pipeline/crawlBrowser.js. The insert is wrapped in a single
prepared statement and a transaction so a 50-violation page is one
round-trip rather than 50.
Parameters:
| Name | Type | Description |
|---|---|---|
violations |
Array.<Object> |
Returns:
rows inserted
- Type
- number
(static) countByRunIds(runIds) → {Record.<string, number>}
Count violations grouped by runId for a set of run IDs.
Used by the dashboard "top accessibility offenders" rollup so we can
aggregate counts in a single query instead of N SELECT * calls.
Parameters:
| Name | Type | Description |
|---|---|---|
runIds |
Array.<string> |
Returns:
runId → violation count (only runs with > 0 are present)
- Type
- Record.<string, number>
(static) getByRunAndPage(runId, pageUrl) → {Array.<Object>}
List violations for a single page within a run.
Parameters:
| Name | Type | Description |
|---|---|---|
runId |
string | |
pageUrl |
string |
Returns:
- Type
- Array.<Object>
(static) getByRunId(runId) → {Array.<Object>}
List all violations for a run, ordered by page then rule.
Parameters:
| Name | Type | Description |
|---|---|---|
runId |
string |
Returns:
- Type
- Array.<Object>