@webx-ui/module-audit 0.2.1 → 0.4.0

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.
@@ -0,0 +1,13 @@
1
+ import { LinkType } from '@webx-ui/core';
2
+ /**
3
+ * An address on one line, opened in a new tab: a long one loses its middle rather than wrapping,
4
+ * since the start names the site and the end tells two addresses apart. The whole of it is in the
5
+ * panel's tooltip.
6
+ */
7
+ type __VLS_Props = {
8
+ href: string;
9
+ type?: LinkType;
10
+ strong?: boolean;
11
+ };
12
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -4,9 +4,15 @@ import { AuditDetails } from './types';
4
4
  * the check gave one, a table whose cells are drawn by their type — an address opens, a code is
5
5
  * coloured, a missing value is said in red, an editor link goes to the record in the panel, and
6
6
  * markup quoted from the page is shown as code.
7
+ *
8
+ * The columns have widths by their type, not by what they hold, so the tables of one check line
9
+ * up under each other. A `location` address beside a `url` is where that address leads: the row
10
+ * reads as from → to, and a difference of a slash, `www.` or `https` is named.
7
11
  */
8
12
  type __VLS_Props = {
9
13
  details: AuditDetails;
14
+ /** The count is shown elsewhere (the head of the finding) — the summary line would repeat it. */
15
+ counted?: boolean;
10
16
  };
11
17
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
12
18
  export default _default;
@@ -0,0 +1,15 @@
1
+ import { OutlineEntry } from './headings';
2
+ /**
3
+ * The page's headings as a tree: each one indented by its level, in the order the page has them.
4
+ * The indent is the level itself, not the nesting the page managed — so a level the page jumped
5
+ * over is drawn where it should have been, as an empty dashed row, and the gap is seen rather
6
+ * than read about. Above the tree, what departs from the usual order, in plain words.
7
+ */
8
+ type __VLS_Props = {
9
+ /** `[level, text]` in document order; null on a run crawled before the outline was kept. */
10
+ outline: OutlineEntry[] | null;
11
+ /** How many headings of each level — to tell «none» from «not kept». */
12
+ counts: Record<string, number>;
13
+ };
14
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
15
+ export default _default;
@@ -1,7 +1,10 @@
1
1
  /**
2
- * Where one host stands, under its row on «Outgoing»: the pages that link to it with the anchor
3
- * and what it answered, and the fields of the database that hold it, with «Open in the editor».
4
- * Fifty of each, broken links first — enough to see the pattern, and the findings list the rest.
2
+ * Where one host stands, under its row on «Outgoing»: the addresses on it the pages point at, each
3
+ * a card with the pages under it — a font or a profile link sits in the layout and is on every
4
+ * page, so by page it would be the same line forty times — and the fields of the database that
5
+ * hold it, with «Open in the editor». A link's `target` and `rel` sit beside its address, or
6
+ * beside each page when the pages write it differently. Fifty of each, broken links first; a card counts all its
7
+ * pages and lists fifty.
5
8
  */
6
9
  type __VLS_Props = {
7
10
  host: string;
@@ -4,6 +4,9 @@ import { AuditIssueQuery } from './types';
4
4
  * fifty at a time. A check that has fixes gets a button on each address; the dialog shows what
5
5
  * it would change before anything does. «Hide» asks for the reason; on the list of hidden ones
6
6
  * each says why, and «Show again» removes the rule.
7
+ *
8
+ * Each finding is a card: the address with its count, the table under it. A check of links that
9
+ * redirect can also be read by link — every page loaded, one card per link with its pages.
7
10
  */
8
11
  type __VLS_Props = {
9
12
  run: number;
@@ -1,3 +1,4 @@
1
+ import { ScreenAction } from '@webx-ui/module-admin';
1
2
  /**
2
3
  * The head of the section: its name, its views — the overview, the findings, the pages, the
3
4
  * hosts the site points at and the runs — and the way to the section's own settings.
@@ -7,6 +8,8 @@ type __VLS_Props = {
7
8
  current: 'overview' | 'issues' | 'pages' | 'hosts' | 'runs' | 'settings';
8
9
  /** A card around the slot — the tables want one, the overview draws its own. */
9
10
  card?: boolean;
11
+ /** What the view itself offers in the head, before the way to the settings. */
12
+ actions?: ScreenAction[];
10
13
  };
11
14
  declare function __VLS_template(): {
12
15
  attrs: Partial<{}>;
@@ -21,6 +24,7 @@ declare function __VLS_template(): {
21
24
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
25
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
23
26
  card: boolean;
27
+ actions: ScreenAction[];
24
28
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
25
29
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
26
30
  export default _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A link's `target` and `rel`, as they are in the markup: `_blank`, `nofollow`, `noopener`… Nothing
3
+ * when the link has neither — a plain link is the usual case, not an empty cell. `_blank` without
4
+ * `noopener` or `noreferrer` is marked: current browsers add `noopener` themselves, older ones
5
+ * hand the opened page control of this one.
6
+ */
7
+ type __VLS_Props = {
8
+ rel?: string | null;
9
+ target?: string | null;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { AuditIssue } from './types';
2
+ /**
3
+ * The findings of a redirect check turned inside out: one card per link, the pages it is on
4
+ * under it. A link in the footer or the menu is on every page and is fixed once, in one place —
5
+ * by page, it would be the same row forty times.
6
+ */
7
+ type __VLS_Props = {
8
+ issues: AuditIssue[];
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
+ export default _default;
@@ -2,7 +2,8 @@
2
2
  * The history (§8 «Runs»): every run kept, newest first, with its health and counts. Ticking a
3
3
  * run compares it with the one it was analysed against; ticking two compares those two — by
4
4
  * fingerprint (decision 8): what is new in the later one, what both have, what is gone. `?to=`
5
- * opens on one run already ticked — the way the page card's recheck leads here.
5
+ * opens on one run already ticked — the way the page card's recheck leads here. In the head, for
6
+ * whoever manages the section, the way to clear every run at once, behind a warning.
6
7
  */
7
8
  type __VLS_Props = {
8
9
  base: string;
@@ -2,7 +2,8 @@
2
2
  * The section's settings (§8): where the site is and which hosts are its stands, the limits of
3
3
  * the crawl and the paths it leaves out, the thresholds, the nightly run and how much history
4
4
  * to keep. The form is the screen the server describes (`audit.settings`), so a project patches
5
- * a field in the way it does everywhere else; saving is this page's own.
5
+ * a field in the way it does everywhere else; saving is this page's own. «Back» beside «Save» returns
6
+ * to the overview — the tabs above cannot, their «Overview» is already the lit one.
6
7
  */
7
8
  type __VLS_Props = {
8
9
  base: string;
@@ -0,0 +1,14 @@
1
+ import { BadgeSize } from '@webx-ui/core';
2
+ /**
3
+ * An answer's code as a badge of its colour, and what it means in the tooltip: the name and what
4
+ * to do about it. A code with no line of its own is explained by its class (4xx…); none at all, or
5
+ * 0, is «no answer».
6
+ */
7
+ type __VLS_Props = {
8
+ code: number | null | undefined;
9
+ size?: BadgeSize;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ size: BadgeSize;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { BadgeType } from '@webx-ui/core';
2
+ /** What tells a redirect's target from its source when the rest of the address is the same. */
3
+ export type AddressDifference = 'slash' | 'www' | 'https';
4
+ /**
5
+ * The small differences between where a link points and where it lands: a trailing slash, `www.`,
6
+ * `http` → `https`. Empty when the addresses differ in anything else (the page really moved) or
7
+ * either is not an address — then there is nothing small to name.
8
+ */
9
+ export declare function differences(from: string, to: string): AddressDifference[];
10
+ /**
11
+ * An address cut in two for an ellipsis in the middle: the head gives way, the tail stays —
12
+ * the end of an address is what tells two of them apart.
13
+ */
14
+ export declare function splitMiddle(text: string): [string, string];
15
+ /** The colour of an answer's code. */
16
+ export declare function statusType(value: unknown): BadgeType;
17
+ /** The dictionary key of what an answer means: `code-404`, `code-5xx`, or `code-none`. */
18
+ export declare function statusKey(code: number | null | undefined): string;
package/dist/api.d.ts CHANGED
@@ -15,6 +15,8 @@ export interface AuditApi {
15
15
  */
16
16
  start(scope: AuditScope, urls?: string[]): Promise<AuditRun>;
17
17
  cancel(id: number): Promise<AuditRun>;
18
+ /** Deletes every run with all it found; refused with 409 while a run is going. */
19
+ clear(): Promise<number>;
18
20
  /** The checks of a run that found something, worst first. */
19
21
  checks(run: number, query?: AuditIssueQuery): Promise<AuditCheckRow[]>;
20
22
  /** The findings of a run — of one check when `check` is given. */
@@ -0,0 +1,20 @@
1
+ /** One heading as the parser kept it: its level and its text. */
2
+ export type OutlineEntry = [number, string];
3
+ /** A row of the drawn tree — a heading, or a level the page jumped over (`missing`). */
4
+ export interface OutlineRow {
5
+ level: number;
6
+ text: string;
7
+ missing: boolean;
8
+ /** For a missing level: the level the page jumped from. */
9
+ after?: number;
10
+ }
11
+ /**
12
+ * The tree to draw: every heading, and between two of them the levels skipped on the way down,
13
+ * so a gap stands where the heading should have been.
14
+ */
15
+ export declare function outlineRows(outline: OutlineEntry[]): OutlineRow[];
16
+ /**
17
+ * What breaks the usual order — one H1, first; each level one step below the one above; text in
18
+ * every heading — as sentences in the reader's language. Empty when the order is fine.
19
+ */
20
+ export declare function outlineHints(outline: OutlineEntry[], t: (key: string, params?: Record<string, string | number>) => string): string[];