@nitpicker/report-google-sheets 0.18.1 → 0.20.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.
- package/lib/data/create-discrepancies.d.ts +10 -12
- package/lib/data/create-discrepancies.js +27 -31
- package/lib/data/create-image-list.d.ts +26 -6
- package/lib/data/create-image-list.js +65 -39
- package/lib/data/create-links.d.ts +18 -1
- package/lib/data/create-links.js +91 -55
- package/lib/data/create-page-list.d.ts +24 -24
- package/lib/data/create-page-list.js +178 -224
- package/lib/data/create-referrers-relational-table.d.ts +13 -7
- package/lib/data/create-referrers-relational-table.js +57 -47
- package/lib/data/create-resources-relational-table.d.ts +7 -0
- package/lib/data/create-resources-relational-table.js +41 -33
- package/lib/data/create-resources.d.ts +24 -124
- package/lib/data/create-resources.js +100 -264
- package/lib/data/create-violations.d.ts +7 -6
- package/lib/data/create-violations.js +34 -19
- package/lib/dedupe-progress-message.d.ts +17 -0
- package/lib/dedupe-progress-message.js +26 -0
- package/lib/format-progress-count.d.ts +19 -0
- package/lib/format-progress-count.js +22 -0
- package/lib/open-report-archive.d.ts +54 -0
- package/lib/open-report-archive.js +76 -0
- package/lib/report.d.ts +23 -10
- package/lib/report.js +146 -149
- package/lib/reports/get-plugin-reports.d.ts +14 -6
- package/lib/reports/get-plugin-reports.js +14 -34
- package/lib/sheets/create-sheets.d.ts +66 -36
- package/lib/sheets/create-sheets.js +228 -362
- package/lib/sheets/estimate-cell-budget.d.ts +55 -0
- package/lib/sheets/estimate-cell-budget.js +56 -0
- package/lib/sheets/types.d.ts +111 -91
- package/lib/test-helpers/assert-no-lazy-cells.d.ts +16 -0
- package/lib/test-helpers/assert-no-lazy-cells.js +23 -0
- package/lib/test-helpers/cell-inspection.d.ts +20 -0
- package/lib/test-helpers/cell-inspection.js +21 -0
- package/lib/test-helpers/create-mock-sheet.d.ts +30 -0
- package/lib/test-helpers/create-mock-sheet.js +71 -0
- package/lib/test-helpers/one-chunk.d.ts +8 -0
- package/lib/test-helpers/one-chunk.js +11 -0
- package/lib/utils/join-urls-for-note.d.ts +27 -0
- package/lib/utils/join-urls-for-note.js +48 -0
- package/lib/utils/truncate-note-text.d.ts +15 -0
- package/lib/utils/truncate-note-text.js +23 -0
- package/package.json +13 -12
- package/lib/archive.d.ts +0 -20
- package/lib/archive.js +0 -34
- package/lib/sheets/run-finalize-resources.d.ts +0 -40
- package/lib/sheets/run-finalize-resources.js +0 -44
- package/lib/types.d.ts +0 -11
- package/lib/types.js +0 -1
- package/lib/utils/canonicalize-url.d.ts +0 -53
- package/lib/utils/canonicalize-url.js +0 -105
- package/lib/utils/has-prop-filter.d.ts +0 -18
- package/lib/utils/has-prop-filter.js +0 -19
- package/lib/utils/sort-resources-by-url.d.ts +0 -69
- package/lib/utils/sort-resources-by-url.js +0 -223
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { streamAnchorFactEdges } from '@nitpicker/query';
|
|
1
2
|
import { pLog } from '../debug.js';
|
|
2
3
|
import { createCellData } from '../sheets/create-cell-data.js';
|
|
3
4
|
import { defaultCellFormat } from '../sheets/default-cell-format.js';
|
|
@@ -6,59 +7,78 @@ const log = pLog.extend('ReferrersRelationalTable');
|
|
|
6
7
|
/**
|
|
7
8
|
* Creates the "Referrers Relational Table" sheet configuration.
|
|
8
9
|
*
|
|
9
|
-
* Produces a normalized many-to-many table linking each page to
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Produces a normalized many-to-many table linking each page to the pages
|
|
11
|
+
* that reference it (referrers). Each row is one `viewer_anchor_facts`
|
|
12
|
+
* edge — a unique `(source, resolved destination)` pair, with an
|
|
13
|
+
* occurrence `Count` column, plus the destination's HTTP status info.
|
|
13
14
|
*
|
|
14
15
|
* This relational format (as opposed to the denormalized referrer
|
|
15
16
|
* column in "Links") enables pivot-table analysis and filtering
|
|
16
17
|
* in Google Sheets -- e.g. "which pages link to this 404 page?"
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* One row per edge (not per raw anchor observation): the redirect/alias
|
|
20
|
+
* resolution that collapses multiple raw anchors into one edge means a
|
|
21
|
+
* per-anchor "redirected from" note is no longer meaningful at this grain
|
|
22
|
+
* for every raw occurrence — but the edge's own raw href (before
|
|
23
|
+
* resolution) is still shown as a note on the "Link (To)" cell whenever it
|
|
24
|
+
* differs from the resolved destination, and the `Count` column reports how
|
|
25
|
+
* many raw anchor occurrences this edge summarizes.
|
|
26
|
+
* @param _reports
|
|
27
|
+
* @param accessor
|
|
21
28
|
*/
|
|
22
|
-
export const createReferrersRelationalTable = () => {
|
|
29
|
+
export const createReferrersRelationalTable = (_reports, accessor) => {
|
|
23
30
|
return {
|
|
24
31
|
name: 'Referrers Relational Table',
|
|
32
|
+
requiresReadModel: true,
|
|
25
33
|
createHeaders() {
|
|
26
34
|
return [
|
|
27
|
-
//
|
|
28
35
|
'Link (To)',
|
|
29
36
|
'Referrer (From)',
|
|
30
37
|
'Referrer Content',
|
|
38
|
+
'Count',
|
|
31
39
|
'Link Status Code',
|
|
32
40
|
'Link Status Text',
|
|
33
41
|
'Link Content Type',
|
|
34
42
|
];
|
|
35
43
|
},
|
|
36
|
-
async
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
async estimateRowCount() {
|
|
45
|
+
const knex = accessor.getKnex();
|
|
46
|
+
const [row] = await knex('viewer_anchor_facts').count({
|
|
47
|
+
count: '*',
|
|
48
|
+
});
|
|
49
|
+
return Number(row?.count ?? 0);
|
|
50
|
+
},
|
|
51
|
+
async run({ sheet, maxRows, estimatedTotal, onProgress }) {
|
|
52
|
+
let sent = 0;
|
|
53
|
+
const total = estimatedTotal;
|
|
54
|
+
for await (const chunk of streamAnchorFactEdges(accessor)) {
|
|
55
|
+
for (const edge of chunk) {
|
|
56
|
+
if (sent >= maxRows) {
|
|
57
|
+
await sheet.flush();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const text = edge.textContent || '__NO_TEXT_CONTENT__';
|
|
61
|
+
const redirectedFromNote = edge.rawDestUrl === edge.destUrl
|
|
62
|
+
? undefined
|
|
63
|
+
: `Redirected from: ${edge.rawDestUrl}`;
|
|
64
|
+
await sheet.appendRow([
|
|
65
|
+
createCellData({
|
|
66
|
+
value: edge.destUrl,
|
|
67
|
+
textFormat: { link: { uri: edge.destUrl } },
|
|
68
|
+
note: redirectedFromNote,
|
|
69
|
+
}, defaultCellFormat),
|
|
70
|
+
createCellData({ value: edge.sourceUrl, textFormat: { link: { uri: edge.sourceUrl } } }, defaultCellFormat),
|
|
71
|
+
createCellData({ value: text }, defaultCellFormat),
|
|
72
|
+
createCellData({ value: edge.count }, defaultCellFormat),
|
|
73
|
+
createCellData({ value: edge.status ?? -1 }, defaultCellFormat),
|
|
74
|
+
createCellData({ value: edge.statusText || '' }, defaultCellFormat),
|
|
75
|
+
createCellData({ value: edge.contentType || '' }, defaultCellFormat),
|
|
76
|
+
]);
|
|
77
|
+
sent++;
|
|
78
|
+
onProgress(sent, total);
|
|
79
|
+
}
|
|
60
80
|
}
|
|
61
|
-
|
|
81
|
+
await sheet.flush();
|
|
62
82
|
},
|
|
63
83
|
async updateSheet(sheet) {
|
|
64
84
|
await sheet.frozen(2, 1);
|
|
@@ -66,11 +86,7 @@ export const createReferrersRelationalTable = () => {
|
|
|
66
86
|
booleanRule: {
|
|
67
87
|
condition: {
|
|
68
88
|
type: 'NUMBER_GREATER_THAN_EQ',
|
|
69
|
-
values: [
|
|
70
|
-
{
|
|
71
|
-
userEnteredValue: '400',
|
|
72
|
-
},
|
|
73
|
-
],
|
|
89
|
+
values: [{ userEnteredValue: '400' }],
|
|
74
90
|
},
|
|
75
91
|
format: booleanFormatError,
|
|
76
92
|
},
|
|
@@ -79,18 +95,12 @@ export const createReferrersRelationalTable = () => {
|
|
|
79
95
|
booleanRule: {
|
|
80
96
|
condition: {
|
|
81
97
|
type: 'NUMBER_NOT_BETWEEN',
|
|
82
|
-
values: [
|
|
83
|
-
{
|
|
84
|
-
userEnteredValue: '200',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
userEnteredValue: '399',
|
|
88
|
-
},
|
|
89
|
-
],
|
|
98
|
+
values: [{ userEnteredValue: '200' }, { userEnteredValue: '399' }],
|
|
90
99
|
},
|
|
91
100
|
format: booleanFormatError,
|
|
92
101
|
},
|
|
93
102
|
});
|
|
103
|
+
log('Formatting applied');
|
|
94
104
|
},
|
|
95
105
|
};
|
|
96
106
|
};
|
|
@@ -10,5 +10,12 @@ import type { CreateSheet } from '../sheets/types.js';
|
|
|
10
10
|
* Unlike the "Resources" sheet which shows one row per resource
|
|
11
11
|
* with a referrer count, this relational table enables filtering
|
|
12
12
|
* and pivot analysis -- e.g. "which pages load this broken CSS file?"
|
|
13
|
+
*
|
|
14
|
+
* No read-model dependency: reads `resource_ref_edges` directly (write
|
|
15
|
+
* model), the same table `resource.getReferrers()` ultimately queried
|
|
16
|
+
* pre-rewrite — this sheet replaces that per-resource N+1 query pattern
|
|
17
|
+
* with one streamed scan.
|
|
18
|
+
* @param _reports
|
|
19
|
+
* @param accessor
|
|
13
20
|
*/
|
|
14
21
|
export declare const createResourcesRelationalTable: CreateSheet;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { streamResourceReferrerEdges } from '@nitpicker/query';
|
|
1
2
|
import { pLog } from '../debug.js';
|
|
2
3
|
import { createCellData } from '../sheets/create-cell-data.js';
|
|
3
4
|
import { defaultCellFormat } from '../sheets/default-cell-format.js';
|
|
4
5
|
import { booleanFormatError } from '../sheets/format.js';
|
|
5
|
-
const log = pLog.extend('
|
|
6
|
+
const log = pLog.extend('ResourcesRelationalTable');
|
|
6
7
|
/**
|
|
7
8
|
* Creates the "Resources Relational Table" sheet configuration.
|
|
8
9
|
*
|
|
@@ -14,13 +15,19 @@ const log = pLog.extend('ReferrersRelationalTable');
|
|
|
14
15
|
* Unlike the "Resources" sheet which shows one row per resource
|
|
15
16
|
* with a referrer count, this relational table enables filtering
|
|
16
17
|
* and pivot analysis -- e.g. "which pages load this broken CSS file?"
|
|
18
|
+
*
|
|
19
|
+
* No read-model dependency: reads `resource_ref_edges` directly (write
|
|
20
|
+
* model), the same table `resource.getReferrers()` ultimately queried
|
|
21
|
+
* pre-rewrite — this sheet replaces that per-resource N+1 query pattern
|
|
22
|
+
* with one streamed scan.
|
|
23
|
+
* @param _reports
|
|
24
|
+
* @param accessor
|
|
17
25
|
*/
|
|
18
|
-
export const createResourcesRelationalTable = () => {
|
|
26
|
+
export const createResourcesRelationalTable = (_reports, accessor) => {
|
|
19
27
|
return {
|
|
20
28
|
name: 'Resources Relational Table',
|
|
21
29
|
createHeaders() {
|
|
22
30
|
return [
|
|
23
|
-
//
|
|
24
31
|
'Referred Page (From)',
|
|
25
32
|
'Resource (To)',
|
|
26
33
|
'Resource Status Code',
|
|
@@ -29,24 +36,35 @@ export const createResourcesRelationalTable = () => {
|
|
|
29
36
|
'Resource Size',
|
|
30
37
|
];
|
|
31
38
|
},
|
|
32
|
-
async
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
async estimateRowCount() {
|
|
40
|
+
const knex = accessor.getKnex();
|
|
41
|
+
const [row] = await knex('resource_ref_edges').count({
|
|
42
|
+
count: '*',
|
|
43
|
+
});
|
|
44
|
+
return Number(row?.count ?? 0);
|
|
45
|
+
},
|
|
46
|
+
async run({ sheet, maxRows, estimatedTotal, onProgress }) {
|
|
47
|
+
let sent = 0;
|
|
48
|
+
const total = estimatedTotal;
|
|
49
|
+
for await (const chunk of streamResourceReferrerEdges(accessor)) {
|
|
50
|
+
for (const edge of chunk) {
|
|
51
|
+
if (sent >= maxRows) {
|
|
52
|
+
await sheet.flush();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
await sheet.appendRow([
|
|
56
|
+
createCellData({ value: edge.pageUrl, textFormat: { link: { uri: edge.pageUrl } } }, defaultCellFormat),
|
|
57
|
+
createCellData({ value: edge.resourceUrl }, defaultCellFormat),
|
|
58
|
+
createCellData({ value: edge.status }, defaultCellFormat),
|
|
59
|
+
createCellData({ value: edge.statusText }, defaultCellFormat),
|
|
60
|
+
createCellData({ value: edge.contentType }, defaultCellFormat),
|
|
61
|
+
createCellData({ value: edge.contentLength }, defaultCellFormat),
|
|
62
|
+
]);
|
|
63
|
+
sent++;
|
|
64
|
+
onProgress(sent, total);
|
|
65
|
+
}
|
|
48
66
|
}
|
|
49
|
-
|
|
67
|
+
await sheet.flush();
|
|
50
68
|
},
|
|
51
69
|
async updateSheet(sheet) {
|
|
52
70
|
await sheet.frozen(2, 1);
|
|
@@ -54,11 +72,7 @@ export const createResourcesRelationalTable = () => {
|
|
|
54
72
|
booleanRule: {
|
|
55
73
|
condition: {
|
|
56
74
|
type: 'NUMBER_GREATER_THAN_EQ',
|
|
57
|
-
values: [
|
|
58
|
-
{
|
|
59
|
-
userEnteredValue: '400',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
75
|
+
values: [{ userEnteredValue: '400' }],
|
|
62
76
|
},
|
|
63
77
|
format: booleanFormatError,
|
|
64
78
|
},
|
|
@@ -67,18 +81,12 @@ export const createResourcesRelationalTable = () => {
|
|
|
67
81
|
booleanRule: {
|
|
68
82
|
condition: {
|
|
69
83
|
type: 'NUMBER_NOT_BETWEEN',
|
|
70
|
-
values: [
|
|
71
|
-
{
|
|
72
|
-
userEnteredValue: '200',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
userEnteredValue: '399',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
84
|
+
values: [{ userEnteredValue: '200' }, { userEnteredValue: '399' }],
|
|
78
85
|
},
|
|
79
86
|
format: booleanFormatError,
|
|
80
87
|
},
|
|
81
88
|
});
|
|
89
|
+
log('Formatting applied');
|
|
82
90
|
},
|
|
83
91
|
};
|
|
84
92
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CreateSheet } from '../sheets/types.js';
|
|
2
|
+
import type { ResourceGroupStreamRow } from '@nitpicker/query';
|
|
2
3
|
/**
|
|
3
4
|
* Options for the {@link createResources} factory.
|
|
4
5
|
*/
|
|
@@ -13,145 +14,44 @@ export interface CreateResourcesOptions {
|
|
|
13
14
|
* `/pagead/viewthroughconversion/<id>/`) are preserved, so the
|
|
14
15
|
* aggregated rows still expose every tracker present in the archive.
|
|
15
16
|
*
|
|
16
|
-
* Defaults to `false` (raw mode — one row per raw resource URL).
|
|
17
|
+
* Defaults to `false` (raw mode — one row per raw resource URL). The
|
|
18
|
+
* CLI's `report`/`pipeline` commands default their own
|
|
19
|
+
* `--dedupe-resources` flag to `true` and always pass an explicit
|
|
20
|
+
* value here.
|
|
17
21
|
*/
|
|
18
22
|
readonly dedupe?: boolean;
|
|
19
23
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Safety cap for the joined referrer URL list inserted into a cell note.
|
|
22
|
-
* Google Sheets caps cell content / notes around 50,000 characters; we
|
|
23
|
-
* truncate well below that to leave room for the "and N more" suffix.
|
|
24
|
-
*/
|
|
25
|
-
export declare const NOTE_MAX_LENGTH = 49000;
|
|
26
|
-
/**
|
|
27
|
-
* Maximum number of unique values to keep per query parameter key in
|
|
28
|
-
* dedupe mode. The Query Pattern cell only shows unique counts, but
|
|
29
|
-
* we keep a small sample for cell notes and to avoid unbounded memory
|
|
30
|
-
* growth on trackers that send a unique-per-request value
|
|
31
|
-
* (e.g. session IDs).
|
|
32
|
-
*/
|
|
33
|
-
export declare const MAX_PARAM_VALUE_SAMPLES = 100;
|
|
34
|
-
/**
|
|
35
|
-
* Per-key tracker for query parameter values inside a dedupe entry.
|
|
36
|
-
* `values` is capped at {@link MAX_PARAM_VALUE_SAMPLES}; once the cap
|
|
37
|
-
* is reached, further observations increment `overflowedCount`
|
|
38
|
-
* instead of growing the set. {@link formatQueryPattern} uses
|
|
39
|
-
* `overflowedCount > 0` as the precise condition for appending `+`
|
|
40
|
-
* to the cell — so `key=100` means "exactly 100 sampled, no
|
|
41
|
-
* observation was lost", and `key=100+` means "the sample set lost
|
|
42
|
-
* at least one observation after the cap".
|
|
43
|
-
*/
|
|
44
|
-
export interface ParamValueTracker {
|
|
45
|
-
/** Sampled unique values (bounded by {@link MAX_PARAM_VALUE_SAMPLES}). */
|
|
46
|
-
readonly values: Set<string>;
|
|
47
|
-
/** Observations that arrived after the sample set was full and therefore could not enter the set. */
|
|
48
|
-
overflowedCount: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* In-memory aggregation entry for dedupe mode. One per
|
|
52
|
-
* `(canonical, status, contentType)` combination.
|
|
53
|
-
*/
|
|
54
|
-
export interface DedupeEntry {
|
|
55
|
-
/** Canonical URL representing this entry. */
|
|
56
|
-
readonly canonical: string;
|
|
57
|
-
/** HTTP status code shared by all raw resources in this entry. */
|
|
58
|
-
readonly status: number | null;
|
|
59
|
-
/** HTTP status text — first non-null value observed. */
|
|
60
|
-
statusText: string | null;
|
|
61
|
-
/** Content type shared by all raw resources in this entry. */
|
|
62
|
-
readonly contentType: string | null;
|
|
63
|
-
/** Smallest non-null content length observed. */
|
|
64
|
-
contentLengthMin: number | null;
|
|
65
|
-
/** Largest non-null content length observed. */
|
|
66
|
-
contentLengthMax: number | null;
|
|
67
|
-
/** Number of raw resources collapsed into this entry. */
|
|
68
|
-
count: number;
|
|
69
|
-
/** Union of referrer page URLs across all raw resources in this entry. */
|
|
70
|
-
readonly referrers: Set<string>;
|
|
71
|
-
/** Per-query-key value trackers; absent for resources without a query string. */
|
|
72
|
-
readonly paramValues: Map<string, ParamValueTracker>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Builds the Map key for a dedupe entry.
|
|
76
|
-
*
|
|
77
|
-
* Concatenates `status`, `contentType`, and `canonical` with a
|
|
78
|
-
* non-printable separator. A dedicated `null` marker keeps `null`
|
|
79
|
-
* distinct from `''` for `contentType`, and from `0` for `status`,
|
|
80
|
-
* so e.g. `(canonical, 200, null)` and `(canonical, 200, '')` land
|
|
81
|
-
* in different aggregation buckets.
|
|
82
|
-
*
|
|
83
|
-
* String concatenation is used instead of {@link JSON.stringify}
|
|
84
|
-
* because this function is called once per raw resource — on a
|
|
85
|
-
* million-resource archive `JSON.stringify` allocated roughly a
|
|
86
|
-
* million transient `SeqString`s, dominating Phase 3 wall-clock
|
|
87
|
-
* time. Plain concatenation is several times faster and produces
|
|
88
|
-
* the same collision-free key.
|
|
89
|
-
* @param canonical - The canonicalized URL.
|
|
90
|
-
* @param status - HTTP status code (nullable).
|
|
91
|
-
* @param contentType - HTTP content type (nullable).
|
|
92
|
-
*/
|
|
93
|
-
export declare function dedupeKey(canonical: string, status: number | null, contentType: string | null): string;
|
|
94
|
-
/**
|
|
95
|
-
* Joins referrer URLs into a single newline-separated string, truncating
|
|
96
|
-
* at `maxLength` to stay within Google Sheets' note size cap. When
|
|
97
|
-
* truncated, appends a `... and N more` line where `N` counts every URL
|
|
98
|
-
* that did not fit, including the one whose insertion would have
|
|
99
|
-
* crossed the limit.
|
|
100
|
-
* @param referrers - The set of unique referrer page URLs.
|
|
101
|
-
* @param maxLength - Optional override for the character cap (defaults to {@link NOTE_MAX_LENGTH}).
|
|
102
|
-
*/
|
|
103
|
-
export declare function joinReferrersForNote(referrers: ReadonlySet<string>, maxLength?: number): string;
|
|
104
|
-
/**
|
|
105
|
-
* Formats the Query Pattern cell for a dedupe entry. Each tracked key
|
|
106
|
-
* gets a `key=N` token where `N` is the number of distinct values
|
|
107
|
-
* sampled. `+` is appended only when {@link ParamValueTracker.overflowedCount}
|
|
108
|
-
* is non-zero — i.e. when at least one observation arrived after the
|
|
109
|
-
* sample set was already full. Duplicate observations that arrive
|
|
110
|
-
* while the sample set still has capacity do NOT trigger `+`.
|
|
111
|
-
*
|
|
112
|
-
* This gives precise semantics:
|
|
113
|
-
*
|
|
114
|
-
* - `key=1` — exactly one distinct value, seen any number of times
|
|
115
|
-
* - `key=99` — 99 distinct values, sample set still had room
|
|
116
|
-
* - `key=100` — exactly 100 distinct values, no observation lost
|
|
117
|
-
* - `key=100+` — sample set was capped and at least one further
|
|
118
|
-
* observation could not be recorded (real cardinality unknown but
|
|
119
|
-
* at least 100)
|
|
120
|
-
*
|
|
121
|
-
* Keys are sorted alphabetically to match the canonical URL.
|
|
122
|
-
*
|
|
123
|
-
* Returns `null` for entries without any query parameters so the cell
|
|
124
|
-
* appears empty in Google Sheets.
|
|
125
|
-
* @param entry - The dedupe entry to format.
|
|
126
|
-
*/
|
|
127
|
-
export declare function formatQueryPattern(entry: DedupeEntry): string | null;
|
|
128
24
|
/**
|
|
129
25
|
* Formats the Content Length cell value. Returns a single number when
|
|
130
26
|
* every raw resource in the group reported the same size, a `min-max`
|
|
131
27
|
* string when the size varies, or `null` when nothing was recorded.
|
|
132
|
-
* @param
|
|
28
|
+
* @param group - The resource group to format.
|
|
133
29
|
*/
|
|
134
|
-
export declare function formatContentLength(
|
|
30
|
+
export declare function formatContentLength(group: Pick<ResourceGroupStreamRow, 'contentLengthMin' | 'contentLengthMax'>): number | string | null;
|
|
135
31
|
/**
|
|
136
32
|
* Creates the "Resources" sheet configuration factory.
|
|
137
33
|
*
|
|
138
34
|
* Lists all network resources (CSS, JS, images, fonts, tracking pixels,
|
|
139
35
|
* etc.) discovered during crawling. Two modes are supported:
|
|
140
36
|
*
|
|
141
|
-
* - **Raw mode** (
|
|
142
|
-
*
|
|
143
|
-
*
|
|
37
|
+
* - **Raw mode** (`{ dedupe: false }`, the default when `options` is
|
|
38
|
+
* omitted): one row per raw resource URL. Six columns: URL, Status Code,
|
|
39
|
+
* Status Text, Content Type, Content Length, Referrers. Streams
|
|
40
|
+
* `streamAllResourcesRaw` (write-model, `requiresReadModel` unset) and
|
|
41
|
+
* sends a row per chunk item immediately.
|
|
144
42
|
* - **Dedupe mode** (`{ dedupe: true }`): collapses rows that share the
|
|
145
|
-
* same canonical URL (query values stripped, keys sorted) into one
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
43
|
+
* same canonical URL (query values stripped, keys sorted) into one row
|
|
44
|
+
* per `(canonical URL, status, contentType)`. Adds a trailing `Count`
|
|
45
|
+
* column showing how many raw resources each row collapses. Useful when
|
|
46
|
+
* third-party tracking pixels generate millions of per-request unique
|
|
47
|
+
* URLs that would otherwise exceed the Google Sheets 10M-cell document
|
|
48
|
+
* limit.
|
|
49
|
+
*
|
|
50
|
+
* Dedupe mode's aggregation itself does not run here: it's precomputed
|
|
51
|
+
* once, at `viewer-build` time, into `viewer_resource_groups` (see
|
|
52
|
+
* `compute-resource-group-rows.ts`). This sheet only streams the
|
|
53
|
+
* already-grouped, already-sorted rows via `streamResourceGroups`, so
|
|
54
|
+
* `requiresReadModel: true`.
|
|
155
55
|
* @param options - Optional configuration. See {@link CreateResourcesOptions}.
|
|
156
56
|
*/
|
|
157
57
|
export declare function createResources(options?: CreateResourcesOptions): CreateSheet;
|