@gscdump/sdk 7.13.0 → 7.13.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.
@@ -183,7 +183,9 @@ function buildIndexCohortDiagnosis(input) {
183
183
  const complementRate = complementTotal > 0 ? complementNotIndexed / complementTotal : 0;
184
184
  const { lower, upper } = wilsonInterval(cell.notIndexed, cell.total, z);
185
185
  if (complementTotal < 12) continue;
186
- if (lower <= complementRate) continue;
186
+ const complement = wilsonInterval(complementNotIndexed, complementTotal, z);
187
+ const rate = cell.notIndexed / cell.total;
188
+ if (rate - complementRate - Math.hypot(rate - lower, complement.upper - complementRate) <= 0) continue;
187
189
  survivors.push({
188
190
  notIndexedPaths: cell.notIndexedPaths,
189
191
  cell: {
@@ -193,7 +195,7 @@ function buildIndexCohortDiagnosis(input) {
193
195
  pathPrefix: dimension === "section" ? key : null,
194
196
  total: cell.total,
195
197
  notIndexed: cell.notIndexed,
196
- rate: cell.notIndexed / cell.total,
198
+ rate,
197
199
  complementRate,
198
200
  complementTotal,
199
201
  ciLower: lower,
@@ -238,8 +240,12 @@ function rankIndexCohortSections(pages, established = []) {
238
240
  belowMinimumSample: cell.total < 12
239
241
  })).sort((left, right) => right.rate - left.rate || right.notIndexed - left.notIndexed || left.key.localeCompare(right.key));
240
242
  }
243
+ const LIFECYCLE_SUBJECT = {
244
+ versioned: "version-pinned pages",
245
+ evergreen: "unversioned pages"
246
+ };
241
247
  function cohortSubject(cell) {
242
- return cell.dimension === "section" ? `pages under ${cell.key}` : "version-pinned pages";
248
+ return cell.dimension === "section" ? `pages under ${cell.key}` : LIFECYCLE_SUBJECT[cell.key] ?? cell.label.toLowerCase();
243
249
  }
244
250
  function asPercent(value) {
245
251
  return `${Math.round(value * 100)}%`;
@@ -293,18 +299,26 @@ function parseRow(row, siteUrl) {
293
299
  }
294
300
  };
295
301
  }
302
+ function uniqueRows(urls, siteUrl) {
303
+ const seen = /* @__PURE__ */ new Set();
304
+ return urls.flatMap((row) => {
305
+ const parsed = parseRow(row, siteUrl);
306
+ if (parsed._tag === "page") {
307
+ if (seen.has(parsed.href)) return [];
308
+ seen.add(parsed.href);
309
+ }
310
+ return [{
311
+ row,
312
+ parsed
313
+ }];
314
+ });
315
+ }
296
316
  function buildIndexCohortsFromIndexingUrls(source, asOf = null) {
297
317
  const pages = [];
298
- const notIndexedUrls = /* @__PURE__ */ new Set();
299
318
  let excludedFragments = 0;
300
- for (const row of source.urls) {
301
- const parsed = parseRow(row, source.siteUrl);
302
- if (parsed._tag === "page") {
303
- pages.push(parsed.page);
304
- if (!parsed.page.indexed) notIndexedUrls.add(parsed.href);
305
- } else if (parsed._tag === "fragment") excludedFragments += 1;
306
- }
307
- const enumerated = notIndexedUrls.size;
319
+ for (const { parsed } of uniqueRows(source.urls, source.siteUrl)) if (parsed._tag === "page") pages.push(parsed.page);
320
+ else if (parsed._tag === "fragment") excludedFragments += 1;
321
+ const enumerated = pages.reduce((sum, page) => sum + (page.indexed ? 0 : 1), 0);
308
322
  const reported = source.reportedNotIndexed;
309
323
  if (reported > 0 && enumerated / reported < .9) return {
310
324
  _tag: "no-evidence",
@@ -335,9 +349,6 @@ function buildIndexCohortsFromIndexingUrls(source, asOf = null) {
335
349
  };
336
350
  }
337
351
  function selectIndexCohortUrls(urls, filter, siteUrl) {
338
- return urls.filter((row) => {
339
- const parsed = parseRow(row, siteUrl);
340
- return parsed._tag === "page" && !parsed.page.indexed && belongsToIndexCohort(parsed.page.path, filter);
341
- });
352
+ return uniqueRows(urls, siteUrl).filter(({ parsed }) => parsed._tag === "page" && !parsed.page.indexed && belongsToIndexCohort(parsed.page.path, filter)).map(({ row }) => row);
342
353
  }
343
354
  export { COHORT_MIN_CELL_SIZE, COHORT_MIN_ENUMERATED_SHARE, SITE_WIDE_NOT_INDEXED_RATE, belongsToIndexCohort, buildIndexCohortDiagnosis, buildIndexCohortsFromIndexingUrls, indexCohortFilterValue, parseIndexCohortFilter, rankIndexCohortSections, sampledIndexStateMessage, selectIndexCohortLead, selectIndexCohortUrls, wilsonInterval };
@@ -20,7 +20,9 @@ export interface IndexingMarkdownSite {
20
20
  indexed: number | null;
21
21
  totalUrls: number | null;
22
22
  indexedPercent: number | null;
23
+ /** Indexed share change over 7 days, in percentage points. */
23
24
  change7d: number | null;
25
+ /** Indexed share change over 28 days, in percentage points. */
24
26
  change28d: number | null;
25
27
  /** The window's daily series. */
26
28
  trend: IndexingMarkdownTrendPoint[] | null;
@@ -79,8 +79,8 @@ function siteSummary(site) {
79
79
  lines.push(`Indexed: ${formatCount(site.indexed)} / ${formatCount(site.totalUrls)}${percent}`);
80
80
  }
81
81
  const deltas = [];
82
- if (site.change7d != null) deltas.push(`Δ 7d ${signed(site.change7d, 1, "%")}`);
83
- if (site.change28d != null) deltas.push(`Δ 28d ${signed(site.change28d, 1, "%")}`);
82
+ if (site.change7d != null) deltas.push(`Δ 7d ${signed(site.change7d, 1, " points")}`);
83
+ if (site.change28d != null) deltas.push(`Δ 28d ${signed(site.change28d, 1, " points")}`);
84
84
  if (deltas.length) lines.push(deltas.join(" "));
85
85
  lines.push(`Errors: ${issuesLabel(site.latestIssues)}`);
86
86
  return lines.join("\n");
package/dist/package.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var version = "7.13.0";
1
+ var version = "7.13.1";
2
2
  export { version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/sdk",
3
3
  "type": "module",
4
- "version": "7.13.0",
4
+ "version": "7.13.1",
5
5
  "description": "Consumer SDK for hosted gscdump.com integrations.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -149,9 +149,9 @@
149
149
  "node": ">=22.13.0"
150
150
  },
151
151
  "dependencies": {
152
- "@gscdump/analysis": "^7.13.0",
153
- "@gscdump/contracts": "^7.13.0",
154
- "gscdump": "^7.13.0",
152
+ "@gscdump/analysis": "^7.13.1",
153
+ "@gscdump/contracts": "^7.13.1",
154
+ "gscdump": "^7.13.1",
155
155
  "ofetch": "^1.5.1",
156
156
  "zod": "^4.6.5"
157
157
  },