mcp-web-validator 1.3.57 → 1.3.58
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/CHANGELOG.md +13 -0
- package/README.md +18 -0
- package/SECURITY.md +10 -0
- package/dist/audit-history.js +2 -0
- package/dist/audit-history.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/language-subtags.js +2 -0
- package/dist/language-subtags.js.map +1 -1
- package/dist/mcp-bounds.js.map +1 -1
- package/dist/modules/browser-ux/axe-review.js +2 -0
- package/dist/modules/browser-ux/axe-review.js.map +1 -1
- package/dist/modules/browser-ux/lighthouse-lab-probe.js +2 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.js.map +1 -1
- package/dist/modules/browser-ux/lighthouse-lab.js +2 -0
- package/dist/modules/browser-ux/lighthouse-lab.js.map +1 -1
- package/dist/modules/browser-ux/media-diagnostics.js +2 -0
- package/dist/modules/browser-ux/media-diagnostics.js.map +1 -1
- package/dist/modules/browser-ux/raw-rendered-diff.js +90 -40
- package/dist/modules/browser-ux/raw-rendered-diff.js.map +1 -1
- package/dist/modules/browser-ux/raw-rendered-probe.js +18 -0
- package/dist/modules/browser-ux/raw-rendered-probe.js.map +1 -1
- package/dist/modules/browser-ux/resource-failures-probe.js +2 -0
- package/dist/modules/browser-ux/resource-failures-probe.js.map +1 -1
- package/dist/modules/browser-ux/resource-failures.js +2 -0
- package/dist/modules/browser-ux/resource-failures.js.map +1 -1
- package/dist/modules/browser-ux/viewport-parity-probe.js +2 -0
- package/dist/modules/browser-ux/viewport-parity-probe.js.map +1 -1
- package/dist/modules/browser-ux/viewport-parity.js +2 -0
- package/dist/modules/browser-ux/viewport-parity.js.map +1 -1
- package/dist/modules/browser-ux/wcag-interactions.js +2 -0
- package/dist/modules/browser-ux/wcag-interactions.js.map +1 -1
- package/dist/modules/change-regression/availability-history-store.js +2 -0
- package/dist/modules/change-regression/availability-history-store.js.map +1 -1
- package/dist/modules/change-regression/crawler-log-correlation.js +2 -0
- package/dist/modules/change-regression/crawler-log-correlation.js.map +1 -1
- package/dist/modules/change-regression/google-common-crawler-ip.js +2 -0
- package/dist/modules/change-regression/google-common-crawler-ip.js.map +1 -1
- package/dist/modules/change-regression/historical-comparisons.js +2 -0
- package/dist/modules/change-regression/historical-comparisons.js.map +1 -1
- package/dist/modules/change-regression/production-change-comparison.js +2 -0
- package/dist/modules/change-regression/production-change-comparison.js.map +1 -1
- package/dist/modules/change-regression/regression-alerts.js.map +1 -1
- package/dist/modules/change-regression/strict-observation-time.js +2 -0
- package/dist/modules/change-regression/strict-observation-time.js.map +1 -1
- package/dist/modules/content-schema/citation-methodology-consistency.js +2 -0
- package/dist/modules/content-schema/citation-methodology-consistency.js.map +1 -1
- package/dist/modules/content-schema/competitor-intent-comparison.js.map +1 -1
- package/dist/modules/content-schema/empty-boilerplate-content.js +2 -0
- package/dist/modules/content-schema/empty-boilerplate-content.js.map +1 -1
- package/dist/modules/content-schema/extract-citation-methodology.js +2 -0
- package/dist/modules/content-schema/extract-citation-methodology.js.map +1 -1
- package/dist/modules/content-schema/extract-competitor-intent.js +2 -0
- package/dist/modules/content-schema/extract-competitor-intent.js.map +1 -1
- package/dist/modules/content-schema/extract-main-content.js +2 -0
- package/dist/modules/content-schema/extract-main-content.js.map +1 -1
- package/dist/modules/content-schema/extract-metadata-consistency.js +2 -0
- package/dist/modules/content-schema/extract-metadata-consistency.js.map +1 -1
- package/dist/modules/content-schema/extract-product-claims.js +4 -1
- package/dist/modules/content-schema/extract-product-claims.js.map +1 -1
- package/dist/modules/content-schema/extract-structured-data.js +2 -0
- package/dist/modules/content-schema/extract-structured-data.js.map +1 -1
- package/dist/modules/content-schema/metadata-consistency.js +2 -0
- package/dist/modules/content-schema/metadata-consistency.js.map +1 -1
- package/dist/modules/content-schema/product-claims.js.map +1 -1
- package/dist/modules/content-schema/same-language-duplicates.js.map +1 -1
- package/dist/modules/content-schema/structured-data-validation.js +2 -0
- package/dist/modules/content-schema/structured-data-validation.js.map +1 -1
- package/dist/modules/external-metrics/crux-field-probe.js +2 -0
- package/dist/modules/external-metrics/crux-field-probe.js.map +1 -1
- package/dist/modules/external-metrics/crux-field.js +2 -0
- package/dist/modules/external-metrics/crux-field.js.map +1 -1
- package/dist/modules/http-crawl/availability-observations.d.ts +0 -5
- package/dist/modules/http-crawl/availability-observations.js +8 -17
- package/dist/modules/http-crawl/availability-observations.js.map +1 -1
- package/dist/modules/http-crawl/availability-probe.js.map +1 -1
- package/dist/modules/http-crawl/crawler-access-probe.js +2 -0
- package/dist/modules/http-crawl/crawler-access-probe.js.map +1 -1
- package/dist/modules/http-crawl/crawler-access.js +2 -0
- package/dist/modules/http-crawl/crawler-access.js.map +1 -1
- package/dist/modules/http-crawl/http-delivery-probe.js +2 -0
- package/dist/modules/http-crawl/http-delivery-probe.js.map +1 -1
- package/dist/modules/http-crawl/http-delivery.js +4 -1
- package/dist/modules/http-crawl/http-delivery.js.map +1 -1
- package/dist/modules/http-crawl/https-security.js +2 -0
- package/dist/modules/http-crawl/https-security.js.map +1 -1
- package/dist/modules/http-crawl/non-html-directives.js +44 -14
- package/dist/modules/http-crawl/non-html-directives.js.map +1 -1
- package/dist/modules/http-crawl/redirect-canonical-chains.js +2 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.js.map +1 -1
- package/dist/modules/http-crawl/redirect-canonical-probe.js +2 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.js.map +1 -1
- package/dist/modules/http-crawl/sitemap-inventory-probe.js +2 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.js.map +1 -1
- package/dist/modules/http-crawl/sitemap-inventory.js +21 -2
- package/dist/modules/http-crawl/sitemap-inventory.js.map +1 -1
- package/dist/modules/http-crawl/url-variants.js +2 -0
- package/dist/modules/http-crawl/url-variants.js.map +1 -1
- package/dist/modules/site-architecture/extract-internal-links.js +38 -4
- package/dist/modules/site-architecture/extract-internal-links.js.map +1 -1
- package/dist/modules/site-architecture/extract-multilingual-page.js +2 -0
- package/dist/modules/site-architecture/extract-multilingual-page.js.map +1 -1
- package/dist/modules/site-architecture/internal-link-graph-probe.js +2 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.js.map +1 -1
- package/dist/modules/site-architecture/internal-link-graph.js +2 -0
- package/dist/modules/site-architecture/internal-link-graph.js.map +1 -1
- package/dist/modules/site-architecture/internal-link-quality.js +2 -0
- package/dist/modules/site-architecture/internal-link-quality.js.map +1 -1
- package/dist/modules/site-architecture/multilingual-clusters.js +2 -0
- package/dist/modules/site-architecture/multilingual-clusters.js.map +1 -1
- package/dist/network-protocol.d.ts +3 -0
- package/dist/network-protocol.js +9 -0
- package/dist/network-protocol.js.map +1 -0
- package/dist/network.js +12 -0
- package/dist/network.js.map +1 -1
- package/dist/nu-ephemeral.js +2 -0
- package/dist/nu-ephemeral.js.map +1 -1
- package/dist/presentation.js +3 -1
- package/dist/presentation.js.map +1 -1
- package/dist/report.js +4 -2
- package/dist/report.js.map +1 -1
- package/dist/screenshot-proxy.js +2 -0
- package/dist/screenshot-proxy.js.map +1 -1
- package/dist/screenshot.d.ts +1 -1
- package/dist/screenshot.js +3 -1
- package/dist/screenshot.js.map +1 -1
- package/dist/seo-auditor.js +20 -10
- package/dist/seo-auditor.js.map +1 -1
- package/dist/stylelint-validator.js +2 -0
- package/dist/stylelint-validator.js.map +1 -1
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -1
- package/dist/visual-diff.js +9 -1
- package/dist/visual-diff.js.map +1 -1
- package/dist/w3c-validator.js +2 -0
- package/dist/w3c-validator.js.map +1 -1
- package/package.json +4 -3
- package/scripts/deep-audit-optional.mjs +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-data-validation.js","sourceRoot":"","sources":["../../../src/modules/content-schema/structured-data-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,M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AC,MAAM;QAC9B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,6BAA6B,CAAC;QACzD,kBAAkB,EAAE,OAAO,CAAC,MAAM,GAAG,6BAA6B;KACnE,CAAC;AACJ,CAAC","sourcesContent":["/**\n * P1-07: conservative, bounded JSON-LD structural review profiles.\n *\n * Intentionally NOT a full JSON-LD processor, Schema.org ontology validator,\n * Google Rich Results Test, or eligibility/ranking prediction.\n * No remote contexts, URLs or schema documents are resolved.\n */\nimport { normalizedEvidenceDate } from \"./citation-methodology-consistency.js\";\n\nexport const MAX_SUPPORTED_SCHEMA_HTML_BYTES = 250_000;\nexport const MAX_SUPPORTED_SCHEMA_SCRIPTS = 12;\nexport const MAX_SUPPORTED_SCHEMA_SCRIPT_BYTES = 64_000;\nexport const MAX_SUPPORTED_SCHEMA_NODES = 64;\nexport const MAX_SUPPORTED_SCHEMA_FINDINGS = 12;\n\nexport const SUPPORTED_SCHEMA_TYPES = [\n \"Article\", \"NewsArticle\", \"BlogPosting\", \"Product\",\n \"BreadcrumbList\", \"FAQPage\", \"Organization\", \"WebSite\",\n] as const;\nexport type SupportedSchemaType = typeof SUPPORTED_SCHEMA_TYPES[number];\nexport type SchemaFindingCode =\n | \"empty_block\" | \"invalid_json\" | \"invalid_document\" | \"invalid_graph\"\n | \"large_block_skipped\" | \"context_unverified\" | \"type_unverified\"\n | \"unsupported_type\" | \"missing_profile_field\" | \"invalid_field_type\"\n | \"invalid_date\" | \"product_evidence_missing\" | \"invalid_offer\"\n | \"invalid_price\" | \"invalid_currency\" | \"breadcrumb_too_short\"\n | \"breadcrumb_invalid_position\" | \"breadcrumb_duplicate_position\"\n | \"breadcrumb_gap\" | \"breadcrumb_item_missing\"\n | \"faq_question_incomplete\" | \"reference_unresolved\";\n\nexport interface StructuredSchemaFinding {\n code: SchemaFindingCode;\n severity: \"error\" | \"warning\" | \"info\";\n block: number;\n node: number;\n type?: SupportedSchemaType;\n property?: string;\n message: string;\n}\n\nexport interface SupportedSchemaReview {\n scope: \"bounded_jsonld_structural_profiles\";\n blocks_seen: number;\n blocks_checked: number;\n blocks_skipped: number;\n nodes_examined: number;\n supported_nodes: number;\n unsupported_nodes: number;\n context_unverified_nodes: number;\n types_checked: SupportedSchemaType[];\n errors: number;\n warnings: number;\n unverified: number;\n coverage_limited: boolean;\n limitations: string[];\n total_findings: number;\n findings: StructuredSchemaFinding[];\n findings_truncated: boolean;\n}\n\ntype JsonRecord = Record<string, unknown>;\ntype Context = { vocab: boolean; prefixes: ReadonlySet<string> };\nconst EMPTY_CONTEXT: Context = { vocab: false, prefixes: new Set<string>() };\nconst schemaRoot = /^https?:\\/\\/schema\\.org\\/?$/i;\nconst validType = new Set<string>(SUPPORTED_SCHEMA_TYPES);\nconst severityOrder = { error: 0, warning: 1, info: 2 } as const;\nconst safeProperties = new Set([\n \"@context\", \"@type\", \"@graph\", \"headline\", \"author\", \"datePublished\", \"dateModified\",\n \"name\", \"image\", \"offers\", \"review\", \"aggregateRating\", \"price\", \"priceSpecification\",\n \"lowPrice\", \"priceCurrency\", \"itemListElement\", \"item\", \"position\", \"mainEntity\",\n \"acceptedAnswer\", \"text\", \"url\",\n]);\n\nfunction obj(value: unknown): value is JsonRecord {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction values(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [value];\n}\nfunction text(value: unknown): boolean {\n return typeof value === \"string\" && value.trim().length > 0;\n}\nfunction absoluteHttp(value: unknown): boolean {\n if (typeof value !== \"string\" || value.length > 1024) return false;\n try {\n const parsed = new URL(value);\n return [\"https:\", \"http:\"].includes(parsed.protocol) &&\n !!parsed.hostname && !parsed.username && !parsed.password;\n } catch {\n return false;\n }\n}\nfunction schemaContext(value: unknown, parent: Context): Context {\n if (value === undefined) return parent;\n const contexts = Array.isArray(value) ? value.slice(0, 8) : [value];\n let vocab = false;\n const prefixes = new Set<string>();\n for (const entry of contexts) {\n if (typeof entry === \"string\" && schemaRoot.test(entry)) vocab = true;\n if (obj(entry)) {\n if (typeof entry[\"@vocab\"] === \"string\" && schemaRoot.test(entry[\"@vocab\"])) vocab = true;\n for (const [key, prefix] of Object.entries(entry).slice(0, 32)) {\n if (/^[a-z][a-z0-9_-]{0,24}$/i.test(key) && typeof prefix === \"string\" &&\n schemaRoot.test(prefix)) prefixes.add(key);\n }\n }\n }\n return { vocab, prefixes };\n}\nfunction normalizedType(value: string, context: Context): SupportedSchemaType | undefined {\n const direct = /^https?:\\/\\/schema\\.org\\/([a-zA-Z]+)$/i.exec(value)?.[1];\n const prefixed = /^([a-z][a-z0-9_-]{0,24}):([a-zA-Z]+)$/i.exec(value);\n const candidate = direct ?? (prefixed && context.prefixes.has(prefixed[1])\n ? prefixed[2] : context.vocab ? value : undefined);\n return candidate && validType.has(candidate) ? candidate as SupportedSchemaType : undefined;\n}\nfunction validPrice(value: unknown): boolean {\n if (typeof value === \"number\") return Number.isFinite(value) && value >= 0;\n return typeof value === \"string\" && /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/.test(value.trim());\n}\n\nexport function reviewSupportedJsonLd(scriptTexts: readonly string[], blocksSeen = scriptTexts.length): SupportedSchemaReview {\n if (!Number.isSafeInteger(blocksSeen) || blocksSeen < scriptTexts.length ||\n scriptTexts.length > MAX_SUPPORTED_SCHEMA_SCRIPTS) {\n throw new Error(\"JSON-LD script sample is outside the 12-block limit.\");\n }\n const findings: StructuredSchemaFinding[] = [];\n const types = new Set<SupportedSchemaType>();\n let checked = 0;\n let skipped = blocksSeen - scriptTexts.length;\n let nodesExamined = 0;\n let supported = 0;\n let unsupported = 0;\n let unknownContext = 0;\n let hitNodeLimit = false;\n\n function issue(code: SchemaFindingCode, severity: StructuredSchemaFinding[\"severity\"],\n block: number, node: number, message: string, type?: SupportedSchemaType, property?: string) {\n findings.push({\n code, severity, block, node,\n ...(type ? { type } : {}),\n ...(property && safeProperties.has(property) ? { property } : {}),\n message,\n });\n }\n function field(record: JsonRecord, property: string, type: SupportedSchemaType,\n block: number, node: number, requiredProfile = false) {\n const value = record[property];\n if (value === undefined || value === null || value === \"\") {\n if (requiredProfile) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"This property is expected by the selected limited review profile; absence is not proof of invalid Schema.org markup.\", type, property);\n }\n return false;\n }\n if (!text(value)) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"The explicit property is not a nonempty text value in the selected review profile.\", type, property);\n return false;\n }\n return true;\n }\n function dateField(record: JsonRecord, property: \"datePublished\" | \"dateModified\",\n type: SupportedSchemaType, block: number, node: number) {\n if (record[property] === undefined) return;\n if (typeof record[property] !== \"string\" || !normalizedEvidenceDate(record[property])) {\n issue(\"invalid_date\", \"warning\", block, node,\n \"An explicit article date is not a calendar-valid ISO date or timezone-qualified timestamp.\", type, property);\n }\n }\n function checkProduct(record: JsonRecord, block: number, node: number) {\n const type = \"Product\" as const;\n field(record, \"name\", type, block, node, true);\n if (record.offers === undefined && record.review === undefined && record.aggregateRating === undefined) {\n issue(\"product_evidence_missing\", \"warning\", block, node,\n \"The limited Product snippet review profile expects offers, review or aggregateRating; no rich-result eligibility is asserted.\", type);\n }\n if (record.offers === undefined) return;\n const offers = values(record.offers).slice(0, 8);\n if (Array.isArray(record.offers) && record.offers.length > 8) hitNodeLimit = true;\n for (const offer of offers) {\n if (!obj(offer)) {\n issue(\"invalid_offer\", \"warning\", block, node,\n \"An offers entry must be a structured object for this review profile.\", type, \"offers\");\n continue;\n }\n if (text(offer[\"@id\"]) && Object.keys(offer).length === 1) {\n issue(\"reference_unresolved\", \"info\", block, node,\n \"The offer is a reference only; this offline review does not resolve linked graph objects.\", type, \"offers\");\n continue;\n }\n const offerType = typeof offer[\"@type\"] === \"string\" ? offer[\"@type\"].split(\"/\").at(-1) : undefined;\n const priceProperty = offerType === \"AggregateOffer\" ? \"lowPrice\" : \"price\";\n let candidate: unknown = offer[priceProperty];\n if (candidate === undefined && obj(offer.priceSpecification)) {\n candidate = offer.priceSpecification.price;\n }\n if (candidate === undefined) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"The nested offer has no observed price/lowPrice or priceSpecification.price for this review profile.\", type, priceProperty);\n } else if (!validPrice(candidate)) {\n issue(\"invalid_price\", \"warning\", block, node,\n \"The nested offer price is not a nonnegative numeric value.\", type, priceProperty);\n }\n const currency = offer.priceCurrency ??\n (obj(offer.priceSpecification) ? offer.priceSpecification.priceCurrency : undefined);\n if (currency !== undefined && (typeof currency !== \"string\" || !/^[A-Z]{3}$/.test(currency))) {\n issue(\"invalid_currency\", \"warning\", block, node,\n \"The explicit offer currency does not have a three-letter uppercase ISO-style code.\", type, \"priceCurrency\");\n }\n }\n }\n function checkBreadcrumbs(record: JsonRecord, block: number, node: number) {\n const type = \"BreadcrumbList\" as const;\n const entries = record.itemListElement === undefined ? [] : values(record.itemListElement);\n if (entries.length < 2) {\n issue(\"breadcrumb_too_short\", \"warning\", block, node,\n \"The limited breadcrumb display profile expects at least two ListItem entries.\", type, \"itemListElement\");\n }\n if (entries.length > 16) hitNodeLimit = true;\n const positions: number[] = [];\n for (const [index, entry] of entries.slice(0, 16).entries()) {\n if (!obj(entry)) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"An itemListElement entry is not a structured ListItem object.\", type, \"itemListElement\");\n continue;\n }\n const position = entry.position;\n if (!Number.isInteger(position) || typeof position !== \"number\" || position <= 0 || position > 10000) {\n issue(\"breadcrumb_invalid_position\", \"warning\", block, node,\n \"A breadcrumb ListItem has no positive integer position.\", type, \"position\");\n } else if (positions.includes(position)) {\n issue(\"breadcrumb_duplicate_position\", \"warning\", block, node,\n \"Two breadcrumb ListItems share an explicit position.\", type, \"position\");\n } else {\n positions.push(position);\n }\n const childName = obj(entry.item) ? entry.item.name : undefined;\n if (!text(entry.name) && !text(childName)) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"A breadcrumb ListItem lacks a name in either the item or the item itself.\", type, \"name\");\n }\n if (index < entries.length - 1 && entry.item === undefined) {\n issue(\"breadcrumb_item_missing\", \"warning\", block, node,\n \"A nonfinal breadcrumb ListItem lacks an explicit item target.\", type, \"item\");\n }\n if (entry.item !== undefined && !(absoluteHttp(entry.item) ||\n (obj(entry.item) && (text(entry.item[\"@id\"]) || text(entry.item.name))))) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"A breadcrumb item target is not a supported absolute URL or Thing object.\", type, \"item\");\n }\n }\n if (positions.length >= 2 && positions.length === Math.min(entries.length, 16)) {\n const sorted = [...positions].sort((a, b) => a - b);\n if (sorted.some((p, i) => p !== i + 1)) {\n issue(\"breadcrumb_gap\", \"warning\", block, node,\n \"Breadcrumb positions do not form a contiguous one-based sequence.\", type, \"position\");\n }\n }\n }\n function checkFAQ(record: JsonRecord, block: number, node: number) {\n const type = \"FAQPage\" as const;\n if (record.mainEntity === undefined) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"The limited FAQ review profile expects a mainEntity Question.\", type, \"mainEntity\");\n return;\n }\n const questions = values(record.mainEntity);\n if (questions.length > 16) hitNodeLimit = true;\n for (const question of questions.slice(0, 16)) {\n if (!obj(question)) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"A mainEntity entry is not a structured Question object.\", type, \"mainEntity\");\n continue;\n }\n if (text(question[\"@id\"]) && Object.keys(question).length === 1) {\n issue(\"reference_unresolved\", \"info\", block, node,\n \"A Question reference is not resolved in this limited offline review.\", type, \"mainEntity\");\n continue;\n }\n if (!text(question.name)) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"The FAQ Question lacks a nonempty text name.\", type, \"name\");\n }\n const answers = question.acceptedAnswer === undefined ? [] : values(question.acceptedAnswer);\n if (answers.length === 0 || !answers.some((answer) => obj(answer) &&\n text(answer.text))) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"The FAQ Question lacks an acceptedAnswer with a nonempty text property.\", type, \"acceptedAnswer\");\n }\n }\n }\n function checkNode(record: JsonRecord, type: SupportedSchemaType, block: number, node: number) {\n switch (type) {\n case \"Article\":\n case \"NewsArticle\":\n case \"BlogPosting\":\n field(record, \"headline\", type, block, node, true); // Google recommends but does not require it.\n if (record.author === undefined) {\n issue(\"missing_profile_field\", \"info\", block, node,\n \"Author is a recommended Article property, not a required one.\", type, \"author\");\n } else if (!(obj(record.author) || Array.isArray(record.author))) {\n issue(\"invalid_field_type\", \"info\", block, node,\n \"An author is best described by a Person or Organization object for the selected review profile.\", type, \"author\");\n }\n dateField(record, \"datePublished\", type, block, node);\n dateField(record, \"dateModified\", type, block, node);\n break;\n case \"Product\":\n checkProduct(record, block, node);\n break;\n case \"BreadcrumbList\":\n checkBreadcrumbs(record, block, node);\n break;\n case \"FAQPage\":\n checkFAQ(record, block, node);\n break;\n case \"Organization\":\n case \"WebSite\":\n field(record, \"name\", type, block, node, true);\n if (record.url !== undefined && !absoluteHttp(record.url)) {\n issue(\"invalid_field_type\", \"info\", block, node,\n \"The supplied URL cannot be confirmed as an absolute HTTP(S) URL in this limited profile.\", type, \"url\");\n }\n break;\n }\n }\n for (const [index, source] of scriptTexts.entries()) {\n const block = index + 1;\n const size = new TextEncoder().encode(source).byteLength;\n if (size > MAX_SUPPORTED_SCHEMA_SCRIPT_BYTES) {\n skipped += 1;\n issue(\"large_block_skipped\", \"info\", block, 0,\n \"This JSON-LD block exceeds the per-block parsing cap and was not inspected.\");\n continue;\n }\n if (!source.trim()) {\n checked += 1;\n issue(\"empty_block\", \"warning\", block, 0,\n \"An explicit JSON-LD block is empty.\");\n continue;\n }\n let document: unknown;\n try {\n document = JSON.parse(source.replace(/^\\uFEFF/, \"\"));\n } catch {\n checked += 1;\n issue(\"invalid_json\", \"error\", block, 0,\n \"The JSON-LD block contains invalid JSON syntax; use the existing syntax checker for detailed diagnostics.\");\n continue;\n }\n checked += 1;\n const roots = Array.isArray(document) ? document : [document];\n if (roots.length === 0 || roots.some((value) => !obj(value))) {\n issue(\"invalid_document\", \"error\", block, 0,\n \"The JSON-LD document root must be a nonempty object or array of objects.\");\n continue;\n }\n const work: Array<{ value: JsonRecord; context: Context }> =\n roots.map((value) => ({ value: value as JsonRecord, context: EMPTY_CONTEXT }));\n while (work.length > 0) {\n if (nodesExamined >= MAX_SUPPORTED_SCHEMA_NODES) {\n hitNodeLimit = true;\n break;\n }\n const next = work.shift()!;\n const node = ++nodesExamined;\n const ctx = schemaContext(next.value[\"@context\"], next.context);\n const graph = next.value[\"@graph\"];\n if (graph !== undefined) {\n const graphNodes = Array.isArray(graph) ? graph : [graph];\n if (graphNodes.some((value) => !obj(value))) {\n issue(\"invalid_graph\", \"warning\", block, node,\n \"The explicit @graph contains a nonobject entry; this limited reviewer did not interpret it.\");\n }\n // Cap queued work before loading any unbounded nested graph.\n for (const item of graphNodes) {\n if (obj(item) && work.length < MAX_SUPPORTED_SCHEMA_NODES) work.push({ value: item, context: ctx });\n else if (obj(item)) hitNodeLimit = true;\n }\n }\n const typeValue = next.value[\"@type\"];\n if (typeValue === undefined) {\n if (graph === undefined && Object.keys(next.value).some((key) => !key.startsWith(\"@\"))) {\n unknownContext += 1;\n issue(\"type_unverified\", \"info\", block, node,\n \"This JSON-LD node has no explicit @type for the supported review profiles.\");\n }\n continue;\n }\n const typeNames = values(typeValue);\n if (typeNames.length === 0 || typeNames.some((value) => typeof value !== \"string\")) {\n unknownContext += 1;\n issue(\"type_unverified\", \"info\", block, node,\n \"The JSON-LD @type is not a comparable string or array of strings.\");\n continue;\n }\n const known = new Set<SupportedSchemaType>();\n for (const name of typeNames.slice(0, 8)) {\n const normalized = normalizedType(name as string, ctx);\n if (normalized) known.add(normalized);\n else if (typeof name === \"string\" && validType.has(name)) {\n unknownContext += 1;\n issue(\"context_unverified\", \"info\", block, node,\n \"This known type has no supported Schema.org context, so profile checks were skipped.\");\n } else {\n unsupported += 1;\n issue(\"unsupported_type\", \"info\", block, node,\n \"A declared JSON-LD type falls outside this explicit small set of structural profiles.\");\n }\n }\n if (typeNames.length > 8) hitNodeLimit = true;\n for (const kind of known) {\n supported += 1;\n types.add(kind);\n checkNode(next.value, kind, block, node);\n }\n }\n }\n const ordered = findings.sort((a, b) =>\n severityOrder[a.severity] - severityOrder[b.severity] ||\n a.block - b.block || a.node - b.node || a.code.localeCompare(b.code));\n const errors = ordered.filter((f) => f.severity === \"error\").length;\n const warnings = ordered.filter((f) => f.severity === \"warning\").length;\n return {\n scope: \"bounded_jsonld_structural_profiles\",\n blocks_seen: blocksSeen,\n blocks_checked: checked,\n blocks_skipped: skipped,\n nodes_examined: nodesExamined,\n supported_nodes: supported,\n unsupported_nodes: unsupported,\n context_unverified_nodes: unknownContext,\n types_checked: SUPPORTED_SCHEMA_TYPES.filter((type) => types.has(type)),\n errors, warnings, unverified: ordered.filter((f) => f.severity === \"info\").length,\n coverage_limited: true,\n limitations: [\n \"Only explicit sampled JSON-LD and a fixed small set of structural review profiles are inspected; no full JSON-LD expansion, alias resolution, external context fetching, microdata or RDFa.\",\n \"Profile warnings do not prove invalid Schema.org markup; passing checks do not establish content truth, Google eligibility, rich-result display, crawlability or ranking.\",\n ...(skipped || hitNodeLimit || blocksSeen > scriptTexts.length\n ? [\"A parsing or sampling cap was reached; excluded declarations remain unverified.\"] : []),\n ...(unsupported || unknownContext\n ? [\"Unknown types or contexts are not evaluated; use a complete standards-aware validator for those types.\"] : []),\n ],\n total_findings: ordered.length,\n findings: ordered.slice(0, MAX_SUPPORTED_SCHEMA_FINDINGS),\n findings_truncated: ordered.length > MAX_SUPPORTED_SCHEMA_FINDINGS,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"structured-data-validation.js","sourceRoot":"","sources":["../../../src/modules/content-schema/structured-data-validation.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,MAAM,CAAC,MAAM,+BAA+B,GAAG,OAAO,CAAC;AACvD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,iCA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G,6BAA6B;KACnE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * P1-07: conservative, bounded JSON-LD structural review profiles.\n *\n * Intentionally NOT a full JSON-LD processor, Schema.org ontology validator,\n * Google Rich Results Test, or eligibility/ranking prediction.\n * No remote contexts, URLs or schema documents are resolved.\n */\nimport { normalizedEvidenceDate } from \"./citation-methodology-consistency.js\";\n\nexport const MAX_SUPPORTED_SCHEMA_HTML_BYTES = 250_000;\nexport const MAX_SUPPORTED_SCHEMA_SCRIPTS = 12;\nexport const MAX_SUPPORTED_SCHEMA_SCRIPT_BYTES = 64_000;\nexport const MAX_SUPPORTED_SCHEMA_NODES = 64;\nexport const MAX_SUPPORTED_SCHEMA_FINDINGS = 12;\n\nexport const SUPPORTED_SCHEMA_TYPES = [\n \"Article\", \"NewsArticle\", \"BlogPosting\", \"Product\",\n \"BreadcrumbList\", \"FAQPage\", \"Organization\", \"WebSite\",\n] as const;\nexport type SupportedSchemaType = typeof SUPPORTED_SCHEMA_TYPES[number];\nexport type SchemaFindingCode =\n | \"empty_block\" | \"invalid_json\" | \"invalid_document\" | \"invalid_graph\"\n | \"large_block_skipped\" | \"context_unverified\" | \"type_unverified\"\n | \"unsupported_type\" | \"missing_profile_field\" | \"invalid_field_type\"\n | \"invalid_date\" | \"product_evidence_missing\" | \"invalid_offer\"\n | \"invalid_price\" | \"invalid_currency\" | \"breadcrumb_too_short\"\n | \"breadcrumb_invalid_position\" | \"breadcrumb_duplicate_position\"\n | \"breadcrumb_gap\" | \"breadcrumb_item_missing\"\n | \"faq_question_incomplete\" | \"reference_unresolved\";\n\nexport interface StructuredSchemaFinding {\n code: SchemaFindingCode;\n severity: \"error\" | \"warning\" | \"info\";\n block: number;\n node: number;\n type?: SupportedSchemaType;\n property?: string;\n message: string;\n}\n\nexport interface SupportedSchemaReview {\n scope: \"bounded_jsonld_structural_profiles\";\n blocks_seen: number;\n blocks_checked: number;\n blocks_skipped: number;\n nodes_examined: number;\n supported_nodes: number;\n unsupported_nodes: number;\n context_unverified_nodes: number;\n types_checked: SupportedSchemaType[];\n errors: number;\n warnings: number;\n unverified: number;\n coverage_limited: boolean;\n limitations: string[];\n total_findings: number;\n findings: StructuredSchemaFinding[];\n findings_truncated: boolean;\n}\n\ntype JsonRecord = Record<string, unknown>;\ntype Context = { vocab: boolean; prefixes: ReadonlySet<string> };\nconst EMPTY_CONTEXT: Context = { vocab: false, prefixes: new Set<string>() };\nconst schemaRoot = /^https?:\\/\\/schema\\.org\\/?$/i;\nconst validType = new Set<string>(SUPPORTED_SCHEMA_TYPES);\nconst severityOrder = { error: 0, warning: 1, info: 2 } as const;\nconst safeProperties = new Set([\n \"@context\", \"@type\", \"@graph\", \"headline\", \"author\", \"datePublished\", \"dateModified\",\n \"name\", \"image\", \"offers\", \"review\", \"aggregateRating\", \"price\", \"priceSpecification\",\n \"lowPrice\", \"priceCurrency\", \"itemListElement\", \"item\", \"position\", \"mainEntity\",\n \"acceptedAnswer\", \"text\", \"url\",\n]);\n\nfunction obj(value: unknown): value is JsonRecord {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction values(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [value];\n}\nfunction text(value: unknown): boolean {\n return typeof value === \"string\" && value.trim().length > 0;\n}\nfunction absoluteHttp(value: unknown): boolean {\n if (typeof value !== \"string\" || value.length > 1024) return false;\n try {\n const parsed = new URL(value);\n return [\"https:\", \"http:\"].includes(parsed.protocol) &&\n !!parsed.hostname && !parsed.username && !parsed.password;\n } catch {\n return false;\n }\n}\nfunction schemaContext(value: unknown, parent: Context): Context {\n if (value === undefined) return parent;\n const contexts = Array.isArray(value) ? value.slice(0, 8) : [value];\n let vocab = false;\n const prefixes = new Set<string>();\n for (const entry of contexts) {\n if (typeof entry === \"string\" && schemaRoot.test(entry)) vocab = true;\n if (obj(entry)) {\n if (typeof entry[\"@vocab\"] === \"string\" && schemaRoot.test(entry[\"@vocab\"])) vocab = true;\n for (const [key, prefix] of Object.entries(entry).slice(0, 32)) {\n if (/^[a-z][a-z0-9_-]{0,24}$/i.test(key) && typeof prefix === \"string\" &&\n schemaRoot.test(prefix)) prefixes.add(key);\n }\n }\n }\n return { vocab, prefixes };\n}\nfunction normalizedType(value: string, context: Context): SupportedSchemaType | undefined {\n const direct = /^https?:\\/\\/schema\\.org\\/([a-zA-Z]+)$/i.exec(value)?.[1];\n const prefixed = /^([a-z][a-z0-9_-]{0,24}):([a-zA-Z]+)$/i.exec(value);\n const candidate = direct ?? (prefixed && context.prefixes.has(prefixed[1])\n ? prefixed[2] : context.vocab ? value : undefined);\n return candidate && validType.has(candidate) ? candidate as SupportedSchemaType : undefined;\n}\nfunction validPrice(value: unknown): boolean {\n if (typeof value === \"number\") return Number.isFinite(value) && value >= 0;\n return typeof value === \"string\" && /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/.test(value.trim());\n}\n\nexport function reviewSupportedJsonLd(scriptTexts: readonly string[], blocksSeen = scriptTexts.length): SupportedSchemaReview {\n if (!Number.isSafeInteger(blocksSeen) || blocksSeen < scriptTexts.length ||\n scriptTexts.length > MAX_SUPPORTED_SCHEMA_SCRIPTS) {\n throw new Error(\"JSON-LD script sample is outside the 12-block limit.\");\n }\n const findings: StructuredSchemaFinding[] = [];\n const types = new Set<SupportedSchemaType>();\n let checked = 0;\n let skipped = blocksSeen - scriptTexts.length;\n let nodesExamined = 0;\n let supported = 0;\n let unsupported = 0;\n let unknownContext = 0;\n let hitNodeLimit = false;\n\n function issue(code: SchemaFindingCode, severity: StructuredSchemaFinding[\"severity\"],\n block: number, node: number, message: string, type?: SupportedSchemaType, property?: string) {\n findings.push({\n code, severity, block, node,\n ...(type ? { type } : {}),\n ...(property && safeProperties.has(property) ? { property } : {}),\n message,\n });\n }\n function field(record: JsonRecord, property: string, type: SupportedSchemaType,\n block: number, node: number, requiredProfile = false) {\n const value = record[property];\n if (value === undefined || value === null || value === \"\") {\n if (requiredProfile) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"This property is expected by the selected limited review profile; absence is not proof of invalid Schema.org markup.\", type, property);\n }\n return false;\n }\n if (!text(value)) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"The explicit property is not a nonempty text value in the selected review profile.\", type, property);\n return false;\n }\n return true;\n }\n function dateField(record: JsonRecord, property: \"datePublished\" | \"dateModified\",\n type: SupportedSchemaType, block: number, node: number) {\n if (record[property] === undefined) return;\n if (typeof record[property] !== \"string\" || !normalizedEvidenceDate(record[property])) {\n issue(\"invalid_date\", \"warning\", block, node,\n \"An explicit article date is not a calendar-valid ISO date or timezone-qualified timestamp.\", type, property);\n }\n }\n function checkProduct(record: JsonRecord, block: number, node: number) {\n const type = \"Product\" as const;\n field(record, \"name\", type, block, node, true);\n if (record.offers === undefined && record.review === undefined && record.aggregateRating === undefined) {\n issue(\"product_evidence_missing\", \"warning\", block, node,\n \"The limited Product snippet review profile expects offers, review or aggregateRating; no rich-result eligibility is asserted.\", type);\n }\n if (record.offers === undefined) return;\n const offers = values(record.offers).slice(0, 8);\n if (Array.isArray(record.offers) && record.offers.length > 8) hitNodeLimit = true;\n for (const offer of offers) {\n if (!obj(offer)) {\n issue(\"invalid_offer\", \"warning\", block, node,\n \"An offers entry must be a structured object for this review profile.\", type, \"offers\");\n continue;\n }\n if (text(offer[\"@id\"]) && Object.keys(offer).length === 1) {\n issue(\"reference_unresolved\", \"info\", block, node,\n \"The offer is a reference only; this offline review does not resolve linked graph objects.\", type, \"offers\");\n continue;\n }\n const offerType = typeof offer[\"@type\"] === \"string\" ? offer[\"@type\"].split(\"/\").at(-1) : undefined;\n const priceProperty = offerType === \"AggregateOffer\" ? \"lowPrice\" : \"price\";\n let candidate: unknown = offer[priceProperty];\n if (candidate === undefined && obj(offer.priceSpecification)) {\n candidate = offer.priceSpecification.price;\n }\n if (candidate === undefined) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"The nested offer has no observed price/lowPrice or priceSpecification.price for this review profile.\", type, priceProperty);\n } else if (!validPrice(candidate)) {\n issue(\"invalid_price\", \"warning\", block, node,\n \"The nested offer price is not a nonnegative numeric value.\", type, priceProperty);\n }\n const currency = offer.priceCurrency ??\n (obj(offer.priceSpecification) ? offer.priceSpecification.priceCurrency : undefined);\n if (currency !== undefined && (typeof currency !== \"string\" || !/^[A-Z]{3}$/.test(currency))) {\n issue(\"invalid_currency\", \"warning\", block, node,\n \"The explicit offer currency does not have a three-letter uppercase ISO-style code.\", type, \"priceCurrency\");\n }\n }\n }\n function checkBreadcrumbs(record: JsonRecord, block: number, node: number) {\n const type = \"BreadcrumbList\" as const;\n const entries = record.itemListElement === undefined ? [] : values(record.itemListElement);\n if (entries.length < 2) {\n issue(\"breadcrumb_too_short\", \"warning\", block, node,\n \"The limited breadcrumb display profile expects at least two ListItem entries.\", type, \"itemListElement\");\n }\n if (entries.length > 16) hitNodeLimit = true;\n const positions: number[] = [];\n for (const [index, entry] of entries.slice(0, 16).entries()) {\n if (!obj(entry)) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"An itemListElement entry is not a structured ListItem object.\", type, \"itemListElement\");\n continue;\n }\n const position = entry.position;\n if (!Number.isInteger(position) || typeof position !== \"number\" || position <= 0 || position > 10000) {\n issue(\"breadcrumb_invalid_position\", \"warning\", block, node,\n \"A breadcrumb ListItem has no positive integer position.\", type, \"position\");\n } else if (positions.includes(position)) {\n issue(\"breadcrumb_duplicate_position\", \"warning\", block, node,\n \"Two breadcrumb ListItems share an explicit position.\", type, \"position\");\n } else {\n positions.push(position);\n }\n const childName = obj(entry.item) ? entry.item.name : undefined;\n if (!text(entry.name) && !text(childName)) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"A breadcrumb ListItem lacks a name in either the item or the item itself.\", type, \"name\");\n }\n if (index < entries.length - 1 && entry.item === undefined) {\n issue(\"breadcrumb_item_missing\", \"warning\", block, node,\n \"A nonfinal breadcrumb ListItem lacks an explicit item target.\", type, \"item\");\n }\n if (entry.item !== undefined && !(absoluteHttp(entry.item) ||\n (obj(entry.item) && (text(entry.item[\"@id\"]) || text(entry.item.name))))) {\n issue(\"invalid_field_type\", \"warning\", block, node,\n \"A breadcrumb item target is not a supported absolute URL or Thing object.\", type, \"item\");\n }\n }\n if (positions.length >= 2 && positions.length === Math.min(entries.length, 16)) {\n const sorted = [...positions].sort((a, b) => a - b);\n if (sorted.some((p, i) => p !== i + 1)) {\n issue(\"breadcrumb_gap\", \"warning\", block, node,\n \"Breadcrumb positions do not form a contiguous one-based sequence.\", type, \"position\");\n }\n }\n }\n function checkFAQ(record: JsonRecord, block: number, node: number) {\n const type = \"FAQPage\" as const;\n if (record.mainEntity === undefined) {\n issue(\"missing_profile_field\", \"warning\", block, node,\n \"The limited FAQ review profile expects a mainEntity Question.\", type, \"mainEntity\");\n return;\n }\n const questions = values(record.mainEntity);\n if (questions.length > 16) hitNodeLimit = true;\n for (const question of questions.slice(0, 16)) {\n if (!obj(question)) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"A mainEntity entry is not a structured Question object.\", type, \"mainEntity\");\n continue;\n }\n if (text(question[\"@id\"]) && Object.keys(question).length === 1) {\n issue(\"reference_unresolved\", \"info\", block, node,\n \"A Question reference is not resolved in this limited offline review.\", type, \"mainEntity\");\n continue;\n }\n if (!text(question.name)) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"The FAQ Question lacks a nonempty text name.\", type, \"name\");\n }\n const answers = question.acceptedAnswer === undefined ? [] : values(question.acceptedAnswer);\n if (answers.length === 0 || !answers.some((answer) => obj(answer) &&\n text(answer.text))) {\n issue(\"faq_question_incomplete\", \"warning\", block, node,\n \"The FAQ Question lacks an acceptedAnswer with a nonempty text property.\", type, \"acceptedAnswer\");\n }\n }\n }\n function checkNode(record: JsonRecord, type: SupportedSchemaType, block: number, node: number) {\n switch (type) {\n case \"Article\":\n case \"NewsArticle\":\n case \"BlogPosting\":\n field(record, \"headline\", type, block, node, true); // Google recommends but does not require it.\n if (record.author === undefined) {\n issue(\"missing_profile_field\", \"info\", block, node,\n \"Author is a recommended Article property, not a required one.\", type, \"author\");\n } else if (!(obj(record.author) || Array.isArray(record.author))) {\n issue(\"invalid_field_type\", \"info\", block, node,\n \"An author is best described by a Person or Organization object for the selected review profile.\", type, \"author\");\n }\n dateField(record, \"datePublished\", type, block, node);\n dateField(record, \"dateModified\", type, block, node);\n break;\n case \"Product\":\n checkProduct(record, block, node);\n break;\n case \"BreadcrumbList\":\n checkBreadcrumbs(record, block, node);\n break;\n case \"FAQPage\":\n checkFAQ(record, block, node);\n break;\n case \"Organization\":\n case \"WebSite\":\n field(record, \"name\", type, block, node, true);\n if (record.url !== undefined && !absoluteHttp(record.url)) {\n issue(\"invalid_field_type\", \"info\", block, node,\n \"The supplied URL cannot be confirmed as an absolute HTTP(S) URL in this limited profile.\", type, \"url\");\n }\n break;\n }\n }\n for (const [index, source] of scriptTexts.entries()) {\n const block = index + 1;\n const size = new TextEncoder().encode(source).byteLength;\n if (size > MAX_SUPPORTED_SCHEMA_SCRIPT_BYTES) {\n skipped += 1;\n issue(\"large_block_skipped\", \"info\", block, 0,\n \"This JSON-LD block exceeds the per-block parsing cap and was not inspected.\");\n continue;\n }\n if (!source.trim()) {\n checked += 1;\n issue(\"empty_block\", \"warning\", block, 0,\n \"An explicit JSON-LD block is empty.\");\n continue;\n }\n let document: unknown;\n try {\n document = JSON.parse(source.replace(/^\\uFEFF/, \"\"));\n } catch {\n checked += 1;\n issue(\"invalid_json\", \"error\", block, 0,\n \"The JSON-LD block contains invalid JSON syntax; use the existing syntax checker for detailed diagnostics.\");\n continue;\n }\n checked += 1;\n const roots = Array.isArray(document) ? document : [document];\n if (roots.length === 0 || roots.some((value) => !obj(value))) {\n issue(\"invalid_document\", \"error\", block, 0,\n \"The JSON-LD document root must be a nonempty object or array of objects.\");\n continue;\n }\n const work: Array<{ value: JsonRecord; context: Context }> =\n roots.map((value) => ({ value: value as JsonRecord, context: EMPTY_CONTEXT }));\n while (work.length > 0) {\n if (nodesExamined >= MAX_SUPPORTED_SCHEMA_NODES) {\n hitNodeLimit = true;\n break;\n }\n const next = work.shift()!;\n const node = ++nodesExamined;\n const ctx = schemaContext(next.value[\"@context\"], next.context);\n const graph = next.value[\"@graph\"];\n if (graph !== undefined) {\n const graphNodes = Array.isArray(graph) ? graph : [graph];\n if (graphNodes.some((value) => !obj(value))) {\n issue(\"invalid_graph\", \"warning\", block, node,\n \"The explicit @graph contains a nonobject entry; this limited reviewer did not interpret it.\");\n }\n // Cap queued work before loading any unbounded nested graph.\n for (const item of graphNodes) {\n if (obj(item) && work.length < MAX_SUPPORTED_SCHEMA_NODES) work.push({ value: item, context: ctx });\n else if (obj(item)) hitNodeLimit = true;\n }\n }\n const typeValue = next.value[\"@type\"];\n if (typeValue === undefined) {\n if (graph === undefined && Object.keys(next.value).some((key) => !key.startsWith(\"@\"))) {\n unknownContext += 1;\n issue(\"type_unverified\", \"info\", block, node,\n \"This JSON-LD node has no explicit @type for the supported review profiles.\");\n }\n continue;\n }\n const typeNames = values(typeValue);\n if (typeNames.length === 0 || typeNames.some((value) => typeof value !== \"string\")) {\n unknownContext += 1;\n issue(\"type_unverified\", \"info\", block, node,\n \"The JSON-LD @type is not a comparable string or array of strings.\");\n continue;\n }\n const known = new Set<SupportedSchemaType>();\n for (const name of typeNames.slice(0, 8)) {\n const normalized = normalizedType(name as string, ctx);\n if (normalized) known.add(normalized);\n else if (typeof name === \"string\" && validType.has(name)) {\n unknownContext += 1;\n issue(\"context_unverified\", \"info\", block, node,\n \"This known type has no supported Schema.org context, so profile checks were skipped.\");\n } else {\n unsupported += 1;\n issue(\"unsupported_type\", \"info\", block, node,\n \"A declared JSON-LD type falls outside this explicit small set of structural profiles.\");\n }\n }\n if (typeNames.length > 8) hitNodeLimit = true;\n for (const kind of known) {\n supported += 1;\n types.add(kind);\n checkNode(next.value, kind, block, node);\n }\n }\n }\n const ordered = findings.sort((a, b) =>\n severityOrder[a.severity] - severityOrder[b.severity] ||\n a.block - b.block || a.node - b.node || a.code.localeCompare(b.code));\n const errors = ordered.filter((f) => f.severity === \"error\").length;\n const warnings = ordered.filter((f) => f.severity === \"warning\").length;\n return {\n scope: \"bounded_jsonld_structural_profiles\",\n blocks_seen: blocksSeen,\n blocks_checked: checked,\n blocks_skipped: skipped,\n nodes_examined: nodesExamined,\n supported_nodes: supported,\n unsupported_nodes: unsupported,\n context_unverified_nodes: unknownContext,\n types_checked: SUPPORTED_SCHEMA_TYPES.filter((type) => types.has(type)),\n errors, warnings, unverified: ordered.filter((f) => f.severity === \"info\").length,\n coverage_limited: true,\n limitations: [\n \"Only explicit sampled JSON-LD and a fixed small set of structural review profiles are inspected; no full JSON-LD expansion, alias resolution, external context fetching, microdata or RDFa.\",\n \"Profile warnings do not prove invalid Schema.org markup; passing checks do not establish content truth, Google eligibility, rich-result display, crawlability or ranking.\",\n ...(skipped || hitNodeLimit || blocksSeen > scriptTexts.length\n ? [\"A parsing or sampling cap was reached; excluded declarations remain unverified.\"] : []),\n ...(unsupported || unknownContext\n ? [\"Unknown types or contexts are not evaluated; use a complete standards-aware validator for those types.\"] : []),\n ],\n total_findings: ordered.length,\n findings: ordered.slice(0, MAX_SUPPORTED_SCHEMA_FINDINGS),\n findings_truncated: ordered.length > MAX_SUPPORTED_SCHEMA_FINDINGS,\n };\n}\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright (c) 2026 AKzar1el and Web Validator contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/** V11-FIELD: opt-in fixed Google CrUX API client; no target-URL fetch. */
|
|
2
4
|
import { analyzeCruxField, emptyCruxFieldReview, validateCruxQuery, MAX_CRUX_RESPONSE_BYTES, CRUX_METRICS, } from "./crux-field.js";
|
|
3
5
|
const ENDPOINT = "https://chromeuxreport.googleapis.com/v1/records:";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crux-field-probe.js","sourceRoot":"","sources":["../../../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CAAC,kBAAkB,CAAC,CAAC;IAAA,CAAC;AACxD,CAAC","sourcesContent":["/** V11-FIELD: opt-in fixed Google CrUX API client; no target-URL fetch. */\nimport {\n analyzeCruxField, emptyCruxFieldReview, validateCruxQuery,\n MAX_CRUX_RESPONSE_BYTES, CRUX_METRICS, type CruxFieldReview, type CruxQuery,\n} from \"./crux-field.js\";\nconst ENDPOINT = \"https://chromeuxreport.googleapis.com/v1/records:\";\nexport const CRUX_TIMEOUT_MS = 12_000;\nexport class CruxRequestError extends Error {\n constructor(readonly code:\"missing_key\"|\"rate_limited\"|\"access_denied\"|\"api_unavailable\"|\"invalid_response\") {\n super(\"CrUX request unavailable: \"+code);\n this.name=\"CruxRequestError\";\n }\n}\nasync function jsonBounded(response:Response):Promise<unknown> {\n const type=response.headers.get(\"content-type\")?.split(\";\",1)[0].trim().toLowerCase();\n if(type!==\"application/json\")throw new CruxRequestError(\"invalid_response\");\n const declared=Number(response.headers.get(\"content-length\"));\n if(Number.isFinite(declared)&&declared>MAX_CRUX_RESPONSE_BYTES)\n throw new CruxRequestError(\"invalid_response\");\n if(!response.body)throw new CruxRequestError(\"invalid_response\");\n const reader=response.body.getReader();\n const chunks:Uint8Array[]=[];\n let total=0;\n try{\n while(true){\n const {done,value}=await reader.read();\n if(done)break;\n total+=value.byteLength;\n if(total>MAX_CRUX_RESPONSE_BYTES)throw new CruxRequestError(\"invalid_response\");\n chunks.push(value);\n }\n }finally{try{await reader.cancel();}catch{/* Reader already closed. */}reader.releaseLock();}\n const merged=new Uint8Array(total);\n let offset=0;\n for(const chunk of chunks){merged.set(chunk,offset);offset+=chunk.byteLength;}\n try{return JSON.parse(new TextDecoder(\"utf-8\",{fatal:true}).decode(merged));}\n catch{throw new CruxRequestError(\"invalid_response\");}\n}\ntype FetchFunction=(url:string,options:RequestInit)=>Promise<Response>;\nexport async function queryCruxField(\n query:CruxQuery,\n fetchFn:FetchFunction=(url,opts)=>fetch(url,opts),\n apiKey:string|undefined=process.env.CRUX_API_KEY,\n):Promise<CruxFieldReview>{\n const q=validateCruxQuery(query);\n if(!apiKey||!/^[-_A-Za-z0-9]{15,150}$/u.test(apiKey))\n throw new CruxRequestError(\"missing_key\");\n const endpoint=ENDPOINT+(q.mode===\"daily\"?\"queryRecord\":\"queryHistoryRecord\");\n const url=endpoint+\"?\"+new URLSearchParams({key:apiKey}).toString();\n const body:Record<string,unknown>={\n [q.granularity]:q.target,\n metrics:[...CRUX_METRICS],\n };\n if(q.form_factor!==\"ALL\")body.formFactor=q.form_factor;\n if(q.mode===\"history\")body.collectionPeriodCount=40;\n let response:Response;\n try{\n response=await fetchFn(url,{\n method:\"POST\",\n headers:{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"},\n body:JSON.stringify(body),\n signal:AbortSignal.timeout(CRUX_TIMEOUT_MS),\n redirect:\"error\",credentials:\"omit\",cache:\"no-store\",\n });\n }catch{throw new CruxRequestError(\"api_unavailable\");}\n if(response.redirected)throw new CruxRequestError(\"api_unavailable\");\n if(response.status===404) {\n try{await response.body?.cancel();}catch{/* no body */ }\n const empty=emptyCruxFieldReview(q.mode,\"verified_crux_api\",q.granularity,q.form_factor);\n empty.error=\"No eligible CrUX field data is available for this requested population.\";\n return empty;\n }\n if(response.status!==200||!response.ok){\n try{await response.body?.cancel();}catch{/* Remote body not needed. */}\n if(response.status===429)throw new CruxRequestError(\"rate_limited\");\n if(response.status===401||response.status===403)throw new CruxRequestError(\"access_denied\");\n throw new CruxRequestError(\"api_unavailable\");\n }\n const parsed=await jsonBounded(response);\n try{return analyzeCruxField(parsed,q,\"verified_crux_api\");}\n catch{throw new CruxRequestError(\"invalid_response\");}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"crux-field-probe.js","sourceRoot":"","sources":["../../../src/modules/external-metrics/crux-field-probe.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B,2EAA2E;AAC3E,OAAO,EACL,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EACzD,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/** V11-FIELD: opt-in fixed Google CrUX API client; no target-URL fetch. */\nimport {\n analyzeCruxField, emptyCruxFieldReview, validateCruxQuery,\n MAX_CRUX_RESPONSE_BYTES, CRUX_METRICS, type CruxFieldReview, type CruxQuery,\n} from \"./crux-field.js\";\nconst ENDPOINT = \"https://chromeuxreport.googleapis.com/v1/records:\";\nexport const CRUX_TIMEOUT_MS = 12_000;\nexport class CruxRequestError extends Error {\n constructor(readonly code:\"missing_key\"|\"rate_limited\"|\"access_denied\"|\"api_unavailable\"|\"invalid_response\") {\n super(\"CrUX request unavailable: \"+code);\n this.name=\"CruxRequestError\";\n }\n}\nasync function jsonBounded(response:Response):Promise<unknown> {\n const type=response.headers.get(\"content-type\")?.split(\";\",1)[0].trim().toLowerCase();\n if(type!==\"application/json\")throw new CruxRequestError(\"invalid_response\");\n const declared=Number(response.headers.get(\"content-length\"));\n if(Number.isFinite(declared)&&declared>MAX_CRUX_RESPONSE_BYTES)\n throw new CruxRequestError(\"invalid_response\");\n if(!response.body)throw new CruxRequestError(\"invalid_response\");\n const reader=response.body.getReader();\n const chunks:Uint8Array[]=[];\n let total=0;\n try{\n while(true){\n const {done,value}=await reader.read();\n if(done)break;\n total+=value.byteLength;\n if(total>MAX_CRUX_RESPONSE_BYTES)throw new CruxRequestError(\"invalid_response\");\n chunks.push(value);\n }\n }finally{try{await reader.cancel();}catch{/* Reader already closed. */}reader.releaseLock();}\n const merged=new Uint8Array(total);\n let offset=0;\n for(const chunk of chunks){merged.set(chunk,offset);offset+=chunk.byteLength;}\n try{return JSON.parse(new TextDecoder(\"utf-8\",{fatal:true}).decode(merged));}\n catch{throw new CruxRequestError(\"invalid_response\");}\n}\ntype FetchFunction=(url:string,options:RequestInit)=>Promise<Response>;\nexport async function queryCruxField(\n query:CruxQuery,\n fetchFn:FetchFunction=(url,opts)=>fetch(url,opts),\n apiKey:string|undefined=process.env.CRUX_API_KEY,\n):Promise<CruxFieldReview>{\n const q=validateCruxQuery(query);\n if(!apiKey||!/^[-_A-Za-z0-9]{15,150}$/u.test(apiKey))\n throw new CruxRequestError(\"missing_key\");\n const endpoint=ENDPOINT+(q.mode===\"daily\"?\"queryRecord\":\"queryHistoryRecord\");\n const url=endpoint+\"?\"+new URLSearchParams({key:apiKey}).toString();\n const body:Record<string,unknown>={\n [q.granularity]:q.target,\n metrics:[...CRUX_METRICS],\n };\n if(q.form_factor!==\"ALL\")body.formFactor=q.form_factor;\n if(q.mode===\"history\")body.collectionPeriodCount=40;\n let response:Response;\n try{\n response=await fetchFn(url,{\n method:\"POST\",\n headers:{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"},\n body:JSON.stringify(body),\n signal:AbortSignal.timeout(CRUX_TIMEOUT_MS),\n redirect:\"error\",credentials:\"omit\",cache:\"no-store\",\n });\n }catch{throw new CruxRequestError(\"api_unavailable\");}\n if(response.redirected)throw new CruxRequestError(\"api_unavailable\");\n if(response.status===404) {\n try{await response.body?.cancel();}catch{/* no body */ }\n const empty=emptyCruxFieldReview(q.mode,\"verified_crux_api\",q.granularity,q.form_factor);\n empty.error=\"No eligible CrUX field data is available for this requested population.\";\n return empty;\n }\n if(response.status!==200||!response.ok){\n try{await response.body?.cancel();}catch{/* Remote body not needed. */}\n if(response.status===429)throw new CruxRequestError(\"rate_limited\");\n if(response.status===401||response.status===403)throw new CruxRequestError(\"access_denied\");\n throw new CruxRequestError(\"api_unavailable\");\n }\n const parsed=await jsonBounded(response);\n try{return analyzeCruxField(parsed,q,\"verified_crux_api\");}\n catch{throw new CruxRequestError(\"invalid_response\");}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crux-field.js","sourceRoot":"","sources":["../../../src/modules/external-metrics/crux-field.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,0BAA0B,EAAE,2BAA2B;IACvD,yBAAyB,EAAE,wBAAwB;IACnD,iCAAiC;CACzB,CAAC;AACX,MAAM,CAAC,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CAAC;IAC3D,MAAM,CAAC,MAAM,GAAC,OAAO,CAAC,MAAM,KAAG,CAAC,CAAA,CAAC,CAAA,UAAU,CAAA,CAAC,CAAA,OAAO,CAAC,MAAM,KAAG,YAAY,CAAC,MAAM,CAAA,CAAC,CAAA,aAAa,CAAA,CAAC,CAAA,SAAS,CAAC;IACzG,IAAG,OAAO,CAAC,MAAM,GAAC,CAAC;QAAC,UAAU,CAAC,MAAM,EAAC,gBAAgB,EAAC,MAAM,EAC3D,wFAAwF,CAAC,CAAC;IAC5F,IAAG,MAAM,CAAC,eAAe,KAAG,MAAM;QAAC,UAAU,CAAC,MAAM,EAAC,sBAAsB,EAAC,MAAM,EAChF,+FAA+F,CAAC,CAAC;SAC9F,IAAG,MAAM,CAAC,eAAe,KAAG,MAAM;QAAC,UAAU,CAAC,MAAM,EAAC,sBAAsB,EAAC,SAAS,EACxF,oGAAoG,CAAC,CAAC;SACnG,IAAG,MAAM,CAAC,eAAe,KAAG,mBAAmB;QAAC,UAAU,CAAC,MAAM,EAAC,mCAAmC,EAAC,SAAS,EAClH,qEAAqE,CAAC,CAAC;;QACpE,UAAU,CAAC,MAAM,EAAC,8BAA8B,EAAC,MAAM,EAC1D,sGAAsG,CAAC,CAAC;IAC1G,UAAU,CAAC,MAAM,EAAC,mBAAmB,EAAC,MAAM,EAC1C,yHAAyH,CAAC,CAAC;IAC7H,MAAM,CAAC,kBAAkB,GAAC,MAAM,CAAC,cAAc,GAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/** V11-FIELD: bounded, evidence-only Chrome UX Report p75 field diagnostics. */\nexport const CRUX_METRICS = [\n \"largest_contentful_paint\", \"interaction_to_next_paint\",\n \"cumulative_layout_shift\", \"first_contentful_paint\",\n \"experimental_time_to_first_byte\",\n] as const;\nexport const CRUX_FORMS = [\"ALL\", \"PHONE\", \"DESKTOP\", \"TABLET\"] as const;\nexport const CRUX_MODES = [\"daily\", \"history\"] as const;\nexport const CRUX_SOURCES = [\"caller_supplied\", \"verified_crux_api\"] as const;\nexport const MAX_CRUX_RESPONSE_BYTES = 300_000;\nexport const MAX_CRUX_HISTORY_PERIODS = 40;\nexport const MAX_CRUX_RETURNED_PERIODS = 8;\nexport const MAX_CRUX_FINDINGS = 12;\nexport const CRUX_FINDING_CODES = [\n \"metric_missing\", \"core_web_vitals_good\", \"core_web_vitals_poor\",\n \"core_web_vitals_needs_improvement\", \"insufficient_core_web_vitals\",\n \"historical_gaps\", \"historical_change\", \"field_sample_only\",\n] as const;\nexport type CruxMode = typeof CRUX_MODES[number];\nexport type CruxForm = typeof CRUX_FORMS[number];\nexport type CruxSource = typeof CRUX_SOURCES[number];\nexport type CruxMetric = typeof CRUX_METRICS[number];\nexport type CruxCode = typeof CRUX_FINDING_CODES[number];\nexport type CruxVerdict = \"good\" | \"needs_improvement\" | \"poor\" | \"unavailable\";\ntype CruxMetrics = Record<CruxMetric, number | null>;\nexport interface CruxFinding { code: CruxCode; severity: \"warning\" | \"info\"; message: string }\nexport interface CruxHistoryPoint {\n period: number;\n period_end: string;\n p75: CruxMetrics;\n core_web_vitals: \"good\" | \"needs_improvement\" | \"poor\" | \"insufficient_data\";\n}\nexport interface CruxFieldReview {\n scope: \"crux_real_user_field_p75\";\n mode: CruxMode;\n source: CruxSource;\n granularity: \"origin\" | \"url\";\n form_factor: CruxForm;\n status: \"complete\" | \"partial\" | \"unavailable\";\n period_end: string | null;\n p75: CruxMetrics;\n metric_verdicts: Record<CruxMetric, CruxVerdict>;\n core_web_vitals: \"good\" | \"needs_improvement\" | \"poor\" | \"insufficient_data\";\n periods_available: number;\n periods_returned: number;\n history_points: CruxHistoryPoint[];\n first_last_delta: CruxMetrics;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: CruxFinding[];\n findings_truncated: boolean;\n error?: string;\n}\nconst thresholds: Record<CruxMetric, [number,number]> = {\n largest_contentful_paint: [2500, 4000],\n interaction_to_next_paint: [200,500],\n cumulative_layout_shift: [0.1,0.25],\n first_contentful_paint: [1800,3000],\n experimental_time_to_first_byte: [800,1800],\n};\nconst limitations = [\n \"CrUX percentiles represent aggregated eligible Chrome real-user experiences over rolling 28-day windows, not a current page fetch or an exhaustive sample of every visitor.\",\n \"URL-level and origin-level records cover different populations; returned p75 values cannot be combined across them or interpreted as a Lighthouse laboratory score.\",\n \"History entries are overlapping weekly 28-day windows, not independent weekly samples. Missing eligible data stays null; no causality, traffic, Google ranking or indexing conclusion.\",\n \"Caller-supplied JSON is not authenticated CrUX evidence; live source requires an explicit opt-in and a local CRUX_API_KEY environment variable.\",\n];\nconst emptyMetrics = (): CruxMetrics => Object.fromEntries(CRUX_METRICS.map(k=>[k,null])) as CruxMetrics;\nconst emptyVerdicts = (): Record<CruxMetric,CruxVerdict> =>\n Object.fromEntries(CRUX_METRICS.map(k=>[k,\"unavailable\"])) as Record<CruxMetric,CruxVerdict>;\nexport function emptyCruxFieldReview(\n mode: CruxMode=\"daily\", source: CruxSource=\"caller_supplied\",\n granularity:\"origin\"|\"url\"=\"origin\", form:CruxForm=\"ALL\",\n): CruxFieldReview {\n return {\n scope:\"crux_real_user_field_p75\", mode, source, granularity,\n form_factor: form, status:\"unavailable\", period_end:null,\n p75:emptyMetrics(),metric_verdicts:emptyVerdicts(),core_web_vitals:\"insufficient_data\",\n periods_available:0, periods_returned:0, history_points:[],\n first_last_delta:emptyMetrics(),coverage_limited:true,limitations,\n total_findings:0,findings:[],findings_truncated:false,\n };\n}\nfunction recordObject(value:unknown):Record<string,unknown>|undefined {\n return value !== null && typeof value===\"object\" && !Array.isArray(value)\n ? value as Record<string,unknown> : undefined;\n}\nfunction dateValue(value:unknown):string {\n const d=recordObject(value);\n if (!d||!Number.isInteger(d.year)||!Number.isInteger(d.month)||!Number.isInteger(d.day))\n throw new Error(\"Invalid CrUX collection date\");\n const year=d.year as number, month=d.month as number, day=d.day as number;\n if(year<2000||year>2100||month<1||month>12||day<1||day>31)\n throw new Error(\"Invalid CrUX collection date\");\n const timestamp=Date.UTC(year,month-1,day);\n const parsed=new Date(timestamp);\n if (parsed.getUTCFullYear()!==year||parsed.getUTCMonth()!==month-1||parsed.getUTCDate()!==day)\n throw new Error(\"Invalid CrUX collection date\");\n return parsed.toISOString().slice(0,10);\n}\nfunction periodEnd(period:unknown):string {\n const p=recordObject(period);\n if(!p) throw new Error(\"Missing CrUX collection period\");\n const start=dateValue(p.firstDate), end=dateValue(p.lastDate);\n const days=(Date.parse(end)-Date.parse(start))/86400000;\n if(days!==27) throw new Error(\"Unexpected CrUX collection window\");\n return end;\n}\nfunction percentile(raw:unknown,metric:CruxMetric):number|null {\n if(raw===null||raw===undefined||raw===\"NaN\") return null;\n const value=typeof raw===\"number\"?raw:\n metric===\"cumulative_layout_shift\"&&typeof raw===\"string\"&&/^\\d+(?:\\.\\d{1,5})?$/u.test(raw)\n ?Number(raw):Number.NaN;\n if(!Number.isFinite(value)||value<0||value>(metric===\"cumulative_layout_shift\"?100:600000)) return null;\n return metric===\"cumulative_layout_shift\"?Math.round(value*1000)/1000:Math.round(value);\n}\nfunction verdict(value:number|null,metric:CruxMetric):CruxVerdict {\n if (value===null) return \"unavailable\";\n const [good,poor]=thresholds[metric];\n return value<=good?\"good\":value<=poor?\"needs_improvement\":\"poor\";\n}\nfunction coreVerdict(metrics:CruxMetrics):CruxFieldReview[\"core_web_vitals\"] {\n const values=[\n verdict(metrics.largest_contentful_paint,\"largest_contentful_paint\"),\n verdict(metrics.interaction_to_next_paint,\"interaction_to_next_paint\"),\n verdict(metrics.cumulative_layout_shift,\"cumulative_layout_shift\"),\n ];\n if(values.includes(\"unavailable\"))return \"insufficient_data\";\n if(values.includes(\"poor\"))return \"poor\";\n if(values.includes(\"needs_improvement\"))return \"needs_improvement\";\n return \"good\";\n}\nfunction metricsFrom(record:Record<string,unknown>,index?:number,total?:number):CruxMetrics {\n const out=emptyMetrics();\n const metrics=recordObject(record.metrics)??{};\n for(const metric of CRUX_METRICS) {\n const entry=recordObject(metrics[metric]);\n if(!entry)continue;\n if (index===undefined) {\n const fields=recordObject(entry.percentiles);\n out[metric]=percentile(fields?.p75,metric);\n } else {\n const fields=recordObject(entry.percentilesTimeseries);\n const values=fields?.p75s;\n if(!Array.isArray(values)||values.length!==total) throw new Error(\"Malformed CrUX historical percentile series\");\n out[metric]=percentile(values[index],metric);\n }\n }\n return out;\n}\nfunction addFinding(report:CruxFieldReview,code:CruxCode,severity:CruxFinding[\"severity\"],message:string):void{\n report.total_findings++;\n if(report.findings.length<MAX_CRUX_FINDINGS)report.findings.push({code,severity,message});\n}\nexport interface CruxQuery {\n granularity:\"origin\"|\"url\";\n target:string;\n form_factor:CruxForm;\n mode:CruxMode;\n}\nexport function safeCruxTarget(target:unknown,granularity:\"origin\"|\"url\"):string|undefined {\n if(typeof target!==\"string\"||target.length>512||/[\\u0000-\\u001f\\u007f\\u202a-\\u202e\\\\]/u.test(target))return;\n try{\n const url=new URL(target);\n if(url.protocol!==\"https:\"||url.username||url.password||url.port||url.search||url.hash||\n !url.hostname.includes(\".\")||/(?:^|\\.)(?:localhost|local|internal|invalid|test)$/iu.test(url.hostname)||\n /^\\d+\\.\\d+\\.\\d+\\.\\d+$/u.test(url.hostname)||url.hostname.includes(\":\")) return;\n if(granularity===\"origin\") {\n if(target!==url.origin && target!==url.origin+\"/\")return;\n return url.origin;\n }\n return url.href;\n }catch{return;}\n}\nexport function validateCruxQuery(query:CruxQuery):CruxQuery{\n if(!query||!CRUX_MODES.includes(query.mode)||!CRUX_FORMS.includes(query.form_factor)||\n (query.granularity!==\"origin\"&&query.granularity!==\"url\"))throw new Error(\"Unsupported CrUX query\");\n const target=safeCruxTarget(query.target,query.granularity);\n if(!target)throw new Error(\"Unsafe CrUX target identifier\");\n return {...query,target};\n}\nexport function analyzeCruxField(\n supplied:unknown, query:CruxQuery, source:CruxSource=\"caller_supplied\",\n):CruxFieldReview {\n const q=validateCruxQuery(query);\n if(!CRUX_SOURCES.includes(source))throw new Error(\"Invalid CrUX evidence source\");\n if(typeof supplied!==\"object\"||supplied===null)throw new Error(\"CrUX response is not an object\");\n const root=recordObject(supplied);\n const record=recordObject(root?.record);\n const key=recordObject(record?.key);\n if(!record||!key)throw new Error(\"CrUX response is missing record identity\");\n const returned=key[q.granularity];\n if(typeof returned!==\"string\"||\n safeCruxTarget(returned,q.granularity)!==q.target||\n (q.form_factor===\"ALL\" ? key.formFactor!==undefined :\n key.formFactor!==q.form_factor) ||\n (q.granularity===\"url\"&&key.origin!==undefined) ||\n (q.granularity===\"origin\"&&key.url!==undefined)) {\n throw new Error(\"CrUX response identity or device class does not match the requested record\");\n }\n const review=emptyCruxFieldReview(q.mode,source,q.granularity,q.form_factor);\n if(q.mode===\"daily\"){\n review.period_end=periodEnd(record.collectionPeriod);\n review.p75=metricsFrom(record);\n review.periods_available=1;\n }else{\n const periods=record.collectionPeriods;\n if(!Array.isArray(periods)||periods.length<1||periods.length>MAX_CRUX_HISTORY_PERIODS)\n throw new Error(\"Invalid CrUX history period count\");\n let previous=\"\";\n const all:CruxHistoryPoint[]=[];\n for(let i=0;i<periods.length;i++) {\n const end=periodEnd(periods[i]);\n if(end<=previous)throw new Error(\"CrUX history periods are not strictly ascending\");\n previous=end;\n const p75=metricsFrom(record,i,periods.length);\n all.push({period:i+1,period_end:end,p75,core_web_vitals:coreVerdict(p75)});\n }\n review.periods_available=periods.length;\n review.history_points=all.slice(-MAX_CRUX_RETURNED_PERIODS);\n review.periods_returned=review.history_points.length;\n review.period_end=all[all.length-1].period_end;\n review.p75=all[all.length-1].p75;\n for(const metric of CRUX_METRICS){\n const first=all[0].p75[metric],last=review.p75[metric];\n review.first_last_delta[metric]=first===null||last===null?null:\n Math.round((last-first)*1000)/1000;\n }\n if (all.some(x=>x.core_web_vitals===\"insufficient_data\"))\n addFinding(review,\"historical_gaps\",\"info\",\n \"Some historical windows do not have all eligible Core Web Vitals; missing periods were not interpolated.\");\n if(CRUX_METRICS.some(m=>review.first_last_delta[m]!==null&&review.first_last_delta[m]!==0))\n addFinding(review,\"historical_change\",\"info\",\n \"First-versus-last field percentiles differ; overlapping 28-day windows cannot identify a specific deployment cause.\");\n }\n review.core_web_vitals=coreVerdict(review.p75);\n for(const metric of CRUX_METRICS) {\n review.metric_verdicts[metric]=verdict(review.p75[metric],metric);\n }\n const missing=CRUX_METRICS.filter(m=>review.p75[m]===null);\n review.status=missing.length===0?\"complete\":missing.length===CRUX_METRICS.length?\"unavailable\":\"partial\";\n if(missing.length>0)addFinding(review,\"metric_missing\",\"info\",\n \"Some requested CrUX field percentile data are unavailable for the eligible population.\");\n if(review.core_web_vitals===\"good\")addFinding(review,\"core_web_vitals_good\",\"info\",\n \"All three available real-user CWV p75 values fall in good ranges for this sampled population.\");\n else if(review.core_web_vitals===\"poor\")addFinding(review,\"core_web_vitals_poor\",\"warning\",\n \"At least one real-user Core Web Vitals p75 value is poor; evaluate the reported device/population.\");\n else if(review.core_web_vitals===\"needs_improvement\")addFinding(review,\"core_web_vitals_needs_improvement\",\"warning\",\n \"At least one real-user Core Web Vitals p75 value needs improvement.\");\n else addFinding(review,\"insufficient_core_web_vitals\",\"info\",\n \"One or more LCP, INP or CLS percentiles are missing; do not declare the population passed or failed.\");\n addFinding(review,\"field_sample_only\",\"info\",\n \"Field data are aggregated Chrome experience for an origin or exact page, not all traffic or a current deployment audit.\");\n review.findings_truncated=review.total_findings>review.findings.length;\n return review;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"crux-field.js","sourceRoot":"","sources":["../../../src/modules/external-metrics/crux-field.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,0BAA0B,EAAE,2BAA2B;IACvD,yBAAyB,EAAE,wBAAwB;IACnD,iCAAiC;CACzB,CAAC;AACX,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAU,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CAAC,CAAA,UAAU,CAAA,CAAC,CAAA,OAAO,CAAC,MAAM,KAAG,YAAY,CAAC,MAAM,CAAA,CAAC,CAAA,aAAa,CAAA,CAAC,CAAA,SAAS,CAAC;IACzG,IAAG,OAAO,CAAC,MAAM,GAAC,CAAC;QAAC,UAAU,CAAC,MAAM,EAAC,gBAAgB,EAAC,MAAM,EAC3D,wFAAwF,CAAC,CAAC;IAC5F,IAAG,MAAM,CAAC,eAAe,KAAG,MAAM;QAAC,UAAU,CAAC,MAAM,EAAC,sBAAsB,EAAC,MAAM,EAChF,+FAA+F,CAAC,CAAC;SAC9F,IAAG,MAAM,CAAC,eAAe,KAAG,MAAM;QAAC,UAAU,CAAC,MAAM,EAAC,sBAAsB,EAAC,SAAS,EACxF,oGAAoG,CAAC,CAAC;SACnG,IAAG,MAAM,CAAC,eAAe,KAAG,mBAAmB;QAAC,UAAU,CAAC,MAAM,EAAC,mCAAmC,EAAC,SAAS,EAClH,qEAAqE,CAAC,CAAC;;QACpE,UAAU,CAAC,MAAM,EAAC,8BAA8B,EAAC,MAAM,EAC1D,sGAAsG,CAAC,CAAC;IAC1G,UAAU,CAAC,MAAM,EAAC,mBAAmB,EAAC,MAAM,EAC1C,yHAAyH,CAAC,CAAC;IAC7H,MAAM,CAAC,kBAAkB,GAAC,MAAM,CAAC,cAAc,GAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/** V11-FIELD: bounded, evidence-only Chrome UX Report p75 field diagnostics. */\nexport const CRUX_METRICS = [\n \"largest_contentful_paint\", \"interaction_to_next_paint\",\n \"cumulative_layout_shift\", \"first_contentful_paint\",\n \"experimental_time_to_first_byte\",\n] as const;\nexport const CRUX_FORMS = [\"ALL\", \"PHONE\", \"DESKTOP\", \"TABLET\"] as const;\nexport const CRUX_MODES = [\"daily\", \"history\"] as const;\nexport const CRUX_SOURCES = [\"caller_supplied\", \"verified_crux_api\"] as const;\nexport const MAX_CRUX_RESPONSE_BYTES = 300_000;\nexport const MAX_CRUX_HISTORY_PERIODS = 40;\nexport const MAX_CRUX_RETURNED_PERIODS = 8;\nexport const MAX_CRUX_FINDINGS = 12;\nexport const CRUX_FINDING_CODES = [\n \"metric_missing\", \"core_web_vitals_good\", \"core_web_vitals_poor\",\n \"core_web_vitals_needs_improvement\", \"insufficient_core_web_vitals\",\n \"historical_gaps\", \"historical_change\", \"field_sample_only\",\n] as const;\nexport type CruxMode = typeof CRUX_MODES[number];\nexport type CruxForm = typeof CRUX_FORMS[number];\nexport type CruxSource = typeof CRUX_SOURCES[number];\nexport type CruxMetric = typeof CRUX_METRICS[number];\nexport type CruxCode = typeof CRUX_FINDING_CODES[number];\nexport type CruxVerdict = \"good\" | \"needs_improvement\" | \"poor\" | \"unavailable\";\ntype CruxMetrics = Record<CruxMetric, number | null>;\nexport interface CruxFinding { code: CruxCode; severity: \"warning\" | \"info\"; message: string }\nexport interface CruxHistoryPoint {\n period: number;\n period_end: string;\n p75: CruxMetrics;\n core_web_vitals: \"good\" | \"needs_improvement\" | \"poor\" | \"insufficient_data\";\n}\nexport interface CruxFieldReview {\n scope: \"crux_real_user_field_p75\";\n mode: CruxMode;\n source: CruxSource;\n granularity: \"origin\" | \"url\";\n form_factor: CruxForm;\n status: \"complete\" | \"partial\" | \"unavailable\";\n period_end: string | null;\n p75: CruxMetrics;\n metric_verdicts: Record<CruxMetric, CruxVerdict>;\n core_web_vitals: \"good\" | \"needs_improvement\" | \"poor\" | \"insufficient_data\";\n periods_available: number;\n periods_returned: number;\n history_points: CruxHistoryPoint[];\n first_last_delta: CruxMetrics;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: CruxFinding[];\n findings_truncated: boolean;\n error?: string;\n}\nconst thresholds: Record<CruxMetric, [number,number]> = {\n largest_contentful_paint: [2500, 4000],\n interaction_to_next_paint: [200,500],\n cumulative_layout_shift: [0.1,0.25],\n first_contentful_paint: [1800,3000],\n experimental_time_to_first_byte: [800,1800],\n};\nconst limitations = [\n \"CrUX percentiles represent aggregated eligible Chrome real-user experiences over rolling 28-day windows, not a current page fetch or an exhaustive sample of every visitor.\",\n \"URL-level and origin-level records cover different populations; returned p75 values cannot be combined across them or interpreted as a Lighthouse laboratory score.\",\n \"History entries are overlapping weekly 28-day windows, not independent weekly samples. Missing eligible data stays null; no causality, traffic, Google ranking or indexing conclusion.\",\n \"Caller-supplied JSON is not authenticated CrUX evidence; live source requires an explicit opt-in and a local CRUX_API_KEY environment variable.\",\n];\nconst emptyMetrics = (): CruxMetrics => Object.fromEntries(CRUX_METRICS.map(k=>[k,null])) as CruxMetrics;\nconst emptyVerdicts = (): Record<CruxMetric,CruxVerdict> =>\n Object.fromEntries(CRUX_METRICS.map(k=>[k,\"unavailable\"])) as Record<CruxMetric,CruxVerdict>;\nexport function emptyCruxFieldReview(\n mode: CruxMode=\"daily\", source: CruxSource=\"caller_supplied\",\n granularity:\"origin\"|\"url\"=\"origin\", form:CruxForm=\"ALL\",\n): CruxFieldReview {\n return {\n scope:\"crux_real_user_field_p75\", mode, source, granularity,\n form_factor: form, status:\"unavailable\", period_end:null,\n p75:emptyMetrics(),metric_verdicts:emptyVerdicts(),core_web_vitals:\"insufficient_data\",\n periods_available:0, periods_returned:0, history_points:[],\n first_last_delta:emptyMetrics(),coverage_limited:true,limitations,\n total_findings:0,findings:[],findings_truncated:false,\n };\n}\nfunction recordObject(value:unknown):Record<string,unknown>|undefined {\n return value !== null && typeof value===\"object\" && !Array.isArray(value)\n ? value as Record<string,unknown> : undefined;\n}\nfunction dateValue(value:unknown):string {\n const d=recordObject(value);\n if (!d||!Number.isInteger(d.year)||!Number.isInteger(d.month)||!Number.isInteger(d.day))\n throw new Error(\"Invalid CrUX collection date\");\n const year=d.year as number, month=d.month as number, day=d.day as number;\n if(year<2000||year>2100||month<1||month>12||day<1||day>31)\n throw new Error(\"Invalid CrUX collection date\");\n const timestamp=Date.UTC(year,month-1,day);\n const parsed=new Date(timestamp);\n if (parsed.getUTCFullYear()!==year||parsed.getUTCMonth()!==month-1||parsed.getUTCDate()!==day)\n throw new Error(\"Invalid CrUX collection date\");\n return parsed.toISOString().slice(0,10);\n}\nfunction periodEnd(period:unknown):string {\n const p=recordObject(period);\n if(!p) throw new Error(\"Missing CrUX collection period\");\n const start=dateValue(p.firstDate), end=dateValue(p.lastDate);\n const days=(Date.parse(end)-Date.parse(start))/86400000;\n if(days!==27) throw new Error(\"Unexpected CrUX collection window\");\n return end;\n}\nfunction percentile(raw:unknown,metric:CruxMetric):number|null {\n if(raw===null||raw===undefined||raw===\"NaN\") return null;\n const value=typeof raw===\"number\"?raw:\n metric===\"cumulative_layout_shift\"&&typeof raw===\"string\"&&/^\\d+(?:\\.\\d{1,5})?$/u.test(raw)\n ?Number(raw):Number.NaN;\n if(!Number.isFinite(value)||value<0||value>(metric===\"cumulative_layout_shift\"?100:600000)) return null;\n return metric===\"cumulative_layout_shift\"?Math.round(value*1000)/1000:Math.round(value);\n}\nfunction verdict(value:number|null,metric:CruxMetric):CruxVerdict {\n if (value===null) return \"unavailable\";\n const [good,poor]=thresholds[metric];\n return value<=good?\"good\":value<=poor?\"needs_improvement\":\"poor\";\n}\nfunction coreVerdict(metrics:CruxMetrics):CruxFieldReview[\"core_web_vitals\"] {\n const values=[\n verdict(metrics.largest_contentful_paint,\"largest_contentful_paint\"),\n verdict(metrics.interaction_to_next_paint,\"interaction_to_next_paint\"),\n verdict(metrics.cumulative_layout_shift,\"cumulative_layout_shift\"),\n ];\n if(values.includes(\"unavailable\"))return \"insufficient_data\";\n if(values.includes(\"poor\"))return \"poor\";\n if(values.includes(\"needs_improvement\"))return \"needs_improvement\";\n return \"good\";\n}\nfunction metricsFrom(record:Record<string,unknown>,index?:number,total?:number):CruxMetrics {\n const out=emptyMetrics();\n const metrics=recordObject(record.metrics)??{};\n for(const metric of CRUX_METRICS) {\n const entry=recordObject(metrics[metric]);\n if(!entry)continue;\n if (index===undefined) {\n const fields=recordObject(entry.percentiles);\n out[metric]=percentile(fields?.p75,metric);\n } else {\n const fields=recordObject(entry.percentilesTimeseries);\n const values=fields?.p75s;\n if(!Array.isArray(values)||values.length!==total) throw new Error(\"Malformed CrUX historical percentile series\");\n out[metric]=percentile(values[index],metric);\n }\n }\n return out;\n}\nfunction addFinding(report:CruxFieldReview,code:CruxCode,severity:CruxFinding[\"severity\"],message:string):void{\n report.total_findings++;\n if(report.findings.length<MAX_CRUX_FINDINGS)report.findings.push({code,severity,message});\n}\nexport interface CruxQuery {\n granularity:\"origin\"|\"url\";\n target:string;\n form_factor:CruxForm;\n mode:CruxMode;\n}\nexport function safeCruxTarget(target:unknown,granularity:\"origin\"|\"url\"):string|undefined {\n if(typeof target!==\"string\"||target.length>512||/[\\u0000-\\u001f\\u007f\\u202a-\\u202e\\\\]/u.test(target))return;\n try{\n const url=new URL(target);\n if(url.protocol!==\"https:\"||url.username||url.password||url.port||url.search||url.hash||\n !url.hostname.includes(\".\")||/(?:^|\\.)(?:localhost|local|internal|invalid|test)$/iu.test(url.hostname)||\n /^\\d+\\.\\d+\\.\\d+\\.\\d+$/u.test(url.hostname)||url.hostname.includes(\":\")) return;\n if(granularity===\"origin\") {\n if(target!==url.origin && target!==url.origin+\"/\")return;\n return url.origin;\n }\n return url.href;\n }catch{return;}\n}\nexport function validateCruxQuery(query:CruxQuery):CruxQuery{\n if(!query||!CRUX_MODES.includes(query.mode)||!CRUX_FORMS.includes(query.form_factor)||\n (query.granularity!==\"origin\"&&query.granularity!==\"url\"))throw new Error(\"Unsupported CrUX query\");\n const target=safeCruxTarget(query.target,query.granularity);\n if(!target)throw new Error(\"Unsafe CrUX target identifier\");\n return {...query,target};\n}\nexport function analyzeCruxField(\n supplied:unknown, query:CruxQuery, source:CruxSource=\"caller_supplied\",\n):CruxFieldReview {\n const q=validateCruxQuery(query);\n if(!CRUX_SOURCES.includes(source))throw new Error(\"Invalid CrUX evidence source\");\n if(typeof supplied!==\"object\"||supplied===null)throw new Error(\"CrUX response is not an object\");\n const root=recordObject(supplied);\n const record=recordObject(root?.record);\n const key=recordObject(record?.key);\n if(!record||!key)throw new Error(\"CrUX response is missing record identity\");\n const returned=key[q.granularity];\n if(typeof returned!==\"string\"||\n safeCruxTarget(returned,q.granularity)!==q.target||\n (q.form_factor===\"ALL\" ? key.formFactor!==undefined :\n key.formFactor!==q.form_factor) ||\n (q.granularity===\"url\"&&key.origin!==undefined) ||\n (q.granularity===\"origin\"&&key.url!==undefined)) {\n throw new Error(\"CrUX response identity or device class does not match the requested record\");\n }\n const review=emptyCruxFieldReview(q.mode,source,q.granularity,q.form_factor);\n if(q.mode===\"daily\"){\n review.period_end=periodEnd(record.collectionPeriod);\n review.p75=metricsFrom(record);\n review.periods_available=1;\n }else{\n const periods=record.collectionPeriods;\n if(!Array.isArray(periods)||periods.length<1||periods.length>MAX_CRUX_HISTORY_PERIODS)\n throw new Error(\"Invalid CrUX history period count\");\n let previous=\"\";\n const all:CruxHistoryPoint[]=[];\n for(let i=0;i<periods.length;i++) {\n const end=periodEnd(periods[i]);\n if(end<=previous)throw new Error(\"CrUX history periods are not strictly ascending\");\n previous=end;\n const p75=metricsFrom(record,i,periods.length);\n all.push({period:i+1,period_end:end,p75,core_web_vitals:coreVerdict(p75)});\n }\n review.periods_available=periods.length;\n review.history_points=all.slice(-MAX_CRUX_RETURNED_PERIODS);\n review.periods_returned=review.history_points.length;\n review.period_end=all[all.length-1].period_end;\n review.p75=all[all.length-1].p75;\n for(const metric of CRUX_METRICS){\n const first=all[0].p75[metric],last=review.p75[metric];\n review.first_last_delta[metric]=first===null||last===null?null:\n Math.round((last-first)*1000)/1000;\n }\n if (all.some(x=>x.core_web_vitals===\"insufficient_data\"))\n addFinding(review,\"historical_gaps\",\"info\",\n \"Some historical windows do not have all eligible Core Web Vitals; missing periods were not interpolated.\");\n if(CRUX_METRICS.some(m=>review.first_last_delta[m]!==null&&review.first_last_delta[m]!==0))\n addFinding(review,\"historical_change\",\"info\",\n \"First-versus-last field percentiles differ; overlapping 28-day windows cannot identify a specific deployment cause.\");\n }\n review.core_web_vitals=coreVerdict(review.p75);\n for(const metric of CRUX_METRICS) {\n review.metric_verdicts[metric]=verdict(review.p75[metric],metric);\n }\n const missing=CRUX_METRICS.filter(m=>review.p75[m]===null);\n review.status=missing.length===0?\"complete\":missing.length===CRUX_METRICS.length?\"unavailable\":\"partial\";\n if(missing.length>0)addFinding(review,\"metric_missing\",\"info\",\n \"Some requested CrUX field percentile data are unavailable for the eligible population.\");\n if(review.core_web_vitals===\"good\")addFinding(review,\"core_web_vitals_good\",\"info\",\n \"All three available real-user CWV p75 values fall in good ranges for this sampled population.\");\n else if(review.core_web_vitals===\"poor\")addFinding(review,\"core_web_vitals_poor\",\"warning\",\n \"At least one real-user Core Web Vitals p75 value is poor; evaluate the reported device/population.\");\n else if(review.core_web_vitals===\"needs_improvement\")addFinding(review,\"core_web_vitals_needs_improvement\",\"warning\",\n \"At least one real-user Core Web Vitals p75 value needs improvement.\");\n else addFinding(review,\"insufficient_core_web_vitals\",\"info\",\n \"One or more LCP, INP or CLS percentiles are missing; do not declare the population passed or failed.\");\n addFinding(review,\"field_sample_only\",\"info\",\n \"Field data are aggregated Chrome experience for an origin or exact page, not all traffic or a current deployment audit.\");\n review.findings_truncated=review.total_findings>review.findings.length;\n return review;\n}\n"]}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V02: bounded point-in-time availability-history observations.
|
|
3
|
-
* This is an analyzer of observed outcomes, NOT an uptime monitor, a scheduler,
|
|
4
|
-
* a Googlebot verification tool, or evidence of continuous availability.
|
|
5
|
-
*/
|
|
6
1
|
export declare const MAX_AVAILABILITY_OBSERVATIONS = 48;
|
|
7
2
|
export declare const MAX_AVAILABILITY_FINDINGS = 12;
|
|
8
3
|
export declare const AVAILABILITY_FAILURE_CODES: readonly ["timeout", "dns_error", "network_error", "fetch_error", "policy_blocked"];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
// Copyright (c) 2026 AKzar1el and Web Validator contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/**
|
|
2
4
|
* V02: bounded point-in-time availability-history observations.
|
|
3
5
|
* This is an analyzer of observed outcomes, NOT an uptime monitor, a scheduler,
|
|
4
6
|
* a Googlebot verification tool, or evidence of continuous availability.
|
|
5
7
|
*/
|
|
8
|
+
import { strictObservationTime } from "../change-regression/strict-observation-time.js";
|
|
6
9
|
export const MAX_AVAILABILITY_OBSERVATIONS = 48;
|
|
7
10
|
export const MAX_AVAILABILITY_FINDINGS = 12;
|
|
8
11
|
export const AVAILABILITY_FAILURE_CODES = [
|
|
@@ -34,25 +37,13 @@ export function emptyAvailabilityReview(scope = "caller_supplied_history") {
|
|
|
34
37
|
findings: [], findings_truncated: false,
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
|
-
const timestampPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/u;
|
|
38
40
|
const failures = new Set(AVAILABILITY_FAILURE_CODES);
|
|
39
41
|
export function validateAvailabilityObservation(value) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
throw new Error("Each availability sample requires
|
|
42
|
+
const timestamp = value && typeof value === "object"
|
|
43
|
+
? strictObservationTime(value.observed_at) : undefined;
|
|
44
|
+
if (timestamp === undefined) {
|
|
45
|
+
throw new Error("Each availability sample requires a real ISO timestamp with an explicit UTC offset and valid calendar date and clock.");
|
|
44
46
|
}
|
|
45
|
-
const year = Number(value.observed_at.slice(0, 4));
|
|
46
|
-
const month = Number(value.observed_at.slice(5, 7));
|
|
47
|
-
const day = Number(value.observed_at.slice(8, 10));
|
|
48
|
-
const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
49
|
-
const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
50
|
-
if (month < 1 || month > 12 || day < 1 || day > daysInMonth[month - 1]) {
|
|
51
|
-
throw new Error("Availability observation must have a real calendar day.");
|
|
52
|
-
}
|
|
53
|
-
const timestamp = Date.parse(value.observed_at);
|
|
54
|
-
if (!Number.isFinite(timestamp))
|
|
55
|
-
throw new Error("The availability timestamp must be a real date.");
|
|
56
47
|
const hasStatus = value.status_code !== undefined;
|
|
57
48
|
const hasFailure = value.failure !== undefined;
|
|
58
49
|
if (hasStatus === hasFailure) {
|
|
@@ -199,7 +190,7 @@ export function analyzeAvailabilityHistory(observations, scope = "caller_supplie
|
|
|
199
190
|
add("status_transitions", "info", "HTTP status codes changed between adjacent response observations.");
|
|
200
191
|
if (observations.length < 3)
|
|
201
192
|
add("sparse_samples", "info", "Only two samples were supplied; more observations improve interpretation.");
|
|
202
|
-
if (
|
|
193
|
+
if (maxGap >= 60 * 60 * 1_000)
|
|
203
194
|
add("large_sampling_gap", "info", "Samples include at least one gap of an hour or more; no continuity is established during gaps.");
|
|
204
195
|
return r;
|
|
205
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"availability-observations.js","sourceRoot":"","sources":["../../../src/modules/http-crawl/availability-observations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB;CAChE,CAAC;AACX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc;IAC/E,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,OAAO;CAC/D,CAAC;AACX,MAAM,CAAC,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OT an uptime monitor, a scheduler,\n * a Googlebot verification tool, or evidence of continuous availability.\n */\nexport const MAX_AVAILABILITY_OBSERVATIONS = 48;\nexport const MAX_AVAILABILITY_FINDINGS = 12;\nexport const AVAILABILITY_FAILURE_CODES = [\n \"timeout\", \"dns_error\", \"network_error\", \"fetch_error\", \"policy_blocked\",\n] as const;\nexport const AVAILABILITY_STATES = [\n \"success\", \"challenge\", \"redirect\", \"forbidden\", \"rate_limited\", \"client_error\",\n \"server_error\", \"timeout\", \"transport_error\", \"policy_blocked\", \"other\",\n] as const;\nexport const AVAILABILITY_FINDING_CODES = [\n \"intermittent_non_success\", \"latest_non_success\", \"rate_limiting\",\n \"server_failures\", \"transport_failures\", \"challenge_observed\",\n \"status_transitions\", \"sparse_samples\", \"large_sampling_gap\",\n] as const;\n\nexport type AvailabilityFailureCode = typeof AVAILABILITY_FAILURE_CODES[number];\nexport type AvailabilityState = typeof AVAILABILITY_STATES[number];\nexport type AvailabilityFindingCode = typeof AVAILABILITY_FINDING_CODES[number];\n\nexport interface AvailabilityObservation {\n observed_at: string;\n status_code?: number;\n failure?: AvailabilityFailureCode;\n cf_challenge?: boolean;\n elapsed_ms?: number;\n}\n\nexport interface AvailabilitySample {\n observation: number;\n observed_at: string;\n status_code?: number;\n state: AvailabilityState;\n cf_challenge: boolean;\n elapsed_ms?: number;\n}\n\nexport interface AvailabilityFinding {\n code: AvailabilityFindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\n\nexport interface AvailabilityReview {\n scope: \"caller_supplied_history\" | \"live_bounded_burst\" | \"local_saved_history\";\n observations_count: number;\n first_observed_at?: string;\n last_observed_at?: string;\n sampled_window_minutes: number;\n max_observation_gap_minutes: number;\n observed_successes: number;\n observed_redirects: number;\n observed_http_4xx: number;\n observed_http_5xx: number;\n observed_timeouts: number;\n observed_transport_failures: number;\n observed_rate_limits: number;\n observed_challenges: number;\n observed_success_percent: number;\n http_status_changes: number;\n outcome_changes: number;\n intermittent_non_success: boolean;\n longest_non_success_streak: number;\n current_non_success_streak: number;\n latest_observed_state?: AvailabilityState;\n latest_http_status?: number;\n coverage_limited: true;\n limitations: string[];\n samples: AvailabilitySample[];\n total_findings: number;\n findings: AvailabilityFinding[];\n findings_truncated: boolean;\n error?: string;\n}\n\nconst limitations = [\n \"Sampled response outcomes cannot establish continuous uptime, actual outage duration, or unobserved intervals.\",\n \"The timestamps and HTTP outcomes are supplied or observed by this caller, not verified crawler-log evidence.\",\n \"A short live burst tests only a brief window; repeat checks and retain snapshots for historical trend evidence.\",\n];\n\nexport function emptyAvailabilityReview(\n scope: AvailabilityReview[\"scope\"] = \"caller_supplied_history\",\n): AvailabilityReview {\n return {\n scope, observations_count: 0, sampled_window_minutes: 0, max_observation_gap_minutes: 0,\n observed_successes: 0, observed_redirects: 0, observed_http_4xx: 0,\n observed_http_5xx: 0, observed_timeouts: 0, observed_transport_failures: 0,\n observed_rate_limits: 0, observed_challenges: 0, observed_success_percent: 0,\n http_status_changes: 0, outcome_changes: 0, intermittent_non_success: false,\n longest_non_success_streak: 0, current_non_success_streak: 0,\n coverage_limited: true, limitations, samples: [], total_findings: 0,\n findings: [], findings_truncated: false,\n };\n}\n\nconst timestampPattern = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?(?:Z|[+-]\\d{2}:\\d{2})$/u;\nconst failures = new Set<string>(AVAILABILITY_FAILURE_CODES);\n\nexport function validateAvailabilityObservation(value: AvailabilityObservation): number {\n if (!value || typeof value !== \"object\" ||\n typeof value.observed_at !== \"string\" || value.observed_at.length > 40 ||\n !timestampPattern.test(value.observed_at)) {\n throw new Error(\"Each availability sample requires an ISO timestamp with an explicit UTC offset.\");\n }\n const year = Number(value.observed_at.slice(0, 4));\n const month = Number(value.observed_at.slice(5, 7));\n const day = Number(value.observed_at.slice(8, 10));\n const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month < 1 || month > 12 || day < 1 || day > daysInMonth[month - 1]) {\n throw new Error(\"Availability observation must have a real calendar day.\");\n }\n const timestamp = Date.parse(value.observed_at);\n if (!Number.isFinite(timestamp)) throw new Error(\"The availability timestamp must be a real date.\");\n const hasStatus = value.status_code !== undefined;\n const hasFailure = value.failure !== undefined;\n if (hasStatus === hasFailure) {\n throw new Error(\"Exactly one of status_code or failure is required per observation.\");\n }\n if (hasStatus && (!Number.isInteger(value.status_code) ||\n value.status_code! < 100 || value.status_code! > 599)) {\n throw new Error(\"HTTP status must be an observed integer between 100 and 599.\");\n }\n if (hasFailure && !failures.has(value.failure!)) {\n throw new Error(\"Unrecognized availability failure code.\");\n }\n if (value.cf_challenge !== undefined &&\n (typeof value.cf_challenge !== \"boolean\" || (!hasStatus && value.cf_challenge))) {\n throw new Error(\"A challenge flag requires an actual HTTP response.\");\n }\n if (value.elapsed_ms !== undefined &&\n (!Number.isInteger(value.elapsed_ms) || value.elapsed_ms < 0 || value.elapsed_ms > 120_000)) {\n throw new Error(\"Response elapsed_ms must be a nonnegative integer at most 120,000.\");\n }\n return timestamp;\n}\n\nexport function availabilityState(value: AvailabilityObservation): AvailabilityState {\n if (value.failure === \"timeout\") return \"timeout\";\n if (value.failure === \"policy_blocked\") return \"policy_blocked\";\n if (value.failure !== undefined) return \"transport_error\";\n const code = value.status_code!;\n // Cloudflare challenges sometimes use HTTP 200; this is not proof that the\n // protected page was delivered. Keep 403/429 error classes distinct.\n if (value.cf_challenge === true && code >= 200 && code < 300) return \"challenge\";\n if (code === 403) return \"forbidden\";\n if (code === 429) return \"rate_limited\";\n if (code >= 500) return \"server_error\";\n if (code >= 400) return \"client_error\";\n if (code >= 300 && code < 400) return \"redirect\";\n if (code >= 200 && code < 300) return \"success\";\n return \"other\";\n}\n\nexport function analyzeAvailabilityHistory(\n observations: AvailabilityObservation[],\n scope: AvailabilityReview[\"scope\"] = \"caller_supplied_history\",\n): AvailabilityReview {\n if (!Array.isArray(observations) || observations.length < 2 ||\n observations.length > MAX_AVAILABILITY_OBSERVATIONS) {\n throw new Error(\"Supply two to 48 ordered availability observations.\");\n }\n const times = observations.map(validateAvailabilityObservation);\n for (let i = 1; i < times.length; i += 1) {\n if (times[i] <= times[i - 1]) {\n throw new Error(\"Availability timestamps must be unique and strictly chronological.\");\n }\n }\n const r = emptyAvailabilityReview(scope);\n r.observations_count = observations.length;\n r.first_observed_at = new Date(times[0]).toISOString();\n r.last_observed_at = new Date(times[times.length - 1]).toISOString();\n r.sampled_window_minutes = Math.round((times[times.length - 1] - times[0]) / 600) / 100;\n let maxGap = 0;\n let streak = 0;\n let hasNonSuccess = false;\n let previousState: AvailabilityState | undefined;\n let previousHttpStatus: number | undefined;\n for (let i = 0; i < observations.length; i += 1) {\n const value = observations[i];\n const state = availabilityState(value);\n const success = state === \"success\";\n const challenge = value.cf_challenge === true;\n r.samples.push({\n observation: i + 1,\n observed_at: new Date(times[i]).toISOString(),\n ...(value.status_code === undefined ? {} : { status_code: value.status_code }),\n state, cf_challenge: challenge,\n ...(value.elapsed_ms === undefined ? {} : { elapsed_ms: value.elapsed_ms }),\n });\n if (success) r.observed_successes++;\n else {\n hasNonSuccess = true;\n streak += 1;\n r.longest_non_success_streak = Math.max(r.longest_non_success_streak, streak);\n }\n if (success) streak = 0;\n if (state === \"redirect\") r.observed_redirects++;\n if (value.status_code !== undefined) {\n if (value.status_code >= 400 && value.status_code < 500) r.observed_http_4xx++;\n if (value.status_code >= 500) r.observed_http_5xx++;\n if (value.status_code === 429) r.observed_rate_limits++;\n if (previousHttpStatus !== undefined && previousHttpStatus !== value.status_code) {\n r.http_status_changes += 1;\n }\n }\n if (state === \"timeout\") r.observed_timeouts++;\n if (value.failure !== undefined) r.observed_transport_failures++;\n if (challenge) r.observed_challenges++;\n if (previousState !== undefined && previousState !== state) r.outcome_changes += 1;\n if (i > 0) maxGap = Math.max(maxGap, times[i] - times[i - 1]);\n previousState = state;\n previousHttpStatus = value.status_code;\n r.latest_observed_state = state;\n r.latest_http_status = value.status_code;\n }\n r.current_non_success_streak = streak;\n r.max_observation_gap_minutes = Math.round(maxGap / 600) / 100;\n r.observed_success_percent = Math.round(r.observed_successes * 100 / observations.length);\n r.intermittent_non_success = hasNonSuccess && r.observed_successes > 0;\n\n const add = (code: AvailabilityFindingCode, severity: \"warning\" | \"info\", message: string) => {\n r.total_findings++;\n if (r.findings.length < MAX_AVAILABILITY_FINDINGS) {\n r.findings.push({ code, severity, message });\n } else r.findings_truncated = true;\n };\n if (r.intermittent_non_success) add(\"intermittent_non_success\", \"warning\",\n \"Both successful and non-successful HTTP/transport outcomes occurred in these discrete samples.\");\n if (r.latest_observed_state !== \"success\") add(\"latest_non_success\", \"warning\",\n \"The last sampled response was not a completed HTTP 2xx; verify whether the condition remains.\");\n if (r.observed_rate_limits > 0) add(\"rate_limiting\", \"warning\",\n \"At least one sampled response reported HTTP 429 rate limiting.\");\n if (r.observed_http_5xx > 0) add(\"server_failures\", \"warning\",\n \"One or more sampled HTTP 5xx responses were observed.\");\n if (r.observed_transport_failures > 0) add(\"transport_failures\", \"warning\",\n \"One or more sampled requests returned no HTTP response.\");\n if (r.observed_challenges > 0) add(\"challenge_observed\", \"warning\",\n \"One or more samples carried an explicit Cloudflare challenge flag.\");\n if (r.http_status_changes > 0) add(\"status_transitions\", \"info\",\n \"HTTP status codes changed between adjacent response observations.\");\n if (observations.length < 3) add(\"sparse_samples\", \"info\",\n \"Only two samples were supplied; more observations improve interpretation.\");\n if (r.max_observation_gap_minutes >= 60) add(\"large_sampling_gap\", \"info\",\n \"Samples include at least one gap of an hour or more; no continuity is established during gaps.\");\n\n return r;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"availability-observations.js","sourceRoot":"","sources":["../../../src/modules/http-crawl/availability-observations.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD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,CAAC;QAAE,GAAG,CAAC,oBAAoB,EAAE,SAAS,EAChE,oEAAoE,CAAC,CAAC;IACxE,IAAI,CAAC,CAAC,mBAAmB,GAAG,CAAC;QAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAC7D,mEAAmE,CAAC,CAAC;IACvE,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EACvD,2EAA2E,CAAC,CAAC;IAC/E,IAAI,MAAM,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK;QAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAC7D,gGAAgG,CAAC,CAAC;IAEpG,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * V02: bounded point-in-time availability-history observations.\n * This is an analyzer of observed outcomes, NOT an uptime monitor, a scheduler,\n * a Googlebot verification tool, or evidence of continuous availability.\n */\nimport { strictObservationTime } from \"../change-regression/strict-observation-time.js\";\n\nexport const MAX_AVAILABILITY_OBSERVATIONS = 48;\nexport const MAX_AVAILABILITY_FINDINGS = 12;\nexport const AVAILABILITY_FAILURE_CODES = [\n \"timeout\", \"dns_error\", \"network_error\", \"fetch_error\", \"policy_blocked\",\n] as const;\nexport const AVAILABILITY_STATES = [\n \"success\", \"challenge\", \"redirect\", \"forbidden\", \"rate_limited\", \"client_error\",\n \"server_error\", \"timeout\", \"transport_error\", \"policy_blocked\", \"other\",\n] as const;\nexport const AVAILABILITY_FINDING_CODES = [\n \"intermittent_non_success\", \"latest_non_success\", \"rate_limiting\",\n \"server_failures\", \"transport_failures\", \"challenge_observed\",\n \"status_transitions\", \"sparse_samples\", \"large_sampling_gap\",\n] as const;\n\nexport type AvailabilityFailureCode = typeof AVAILABILITY_FAILURE_CODES[number];\nexport type AvailabilityState = typeof AVAILABILITY_STATES[number];\nexport type AvailabilityFindingCode = typeof AVAILABILITY_FINDING_CODES[number];\n\nexport interface AvailabilityObservation {\n observed_at: string;\n status_code?: number;\n failure?: AvailabilityFailureCode;\n cf_challenge?: boolean;\n elapsed_ms?: number;\n}\n\nexport interface AvailabilitySample {\n observation: number;\n observed_at: string;\n status_code?: number;\n state: AvailabilityState;\n cf_challenge: boolean;\n elapsed_ms?: number;\n}\n\nexport interface AvailabilityFinding {\n code: AvailabilityFindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\n\nexport interface AvailabilityReview {\n scope: \"caller_supplied_history\" | \"live_bounded_burst\" | \"local_saved_history\";\n observations_count: number;\n first_observed_at?: string;\n last_observed_at?: string;\n sampled_window_minutes: number;\n max_observation_gap_minutes: number;\n observed_successes: number;\n observed_redirects: number;\n observed_http_4xx: number;\n observed_http_5xx: number;\n observed_timeouts: number;\n observed_transport_failures: number;\n observed_rate_limits: number;\n observed_challenges: number;\n observed_success_percent: number;\n http_status_changes: number;\n outcome_changes: number;\n intermittent_non_success: boolean;\n longest_non_success_streak: number;\n current_non_success_streak: number;\n latest_observed_state?: AvailabilityState;\n latest_http_status?: number;\n coverage_limited: true;\n limitations: string[];\n samples: AvailabilitySample[];\n total_findings: number;\n findings: AvailabilityFinding[];\n findings_truncated: boolean;\n error?: string;\n}\n\nconst limitations = [\n \"Sampled response outcomes cannot establish continuous uptime, actual outage duration, or unobserved intervals.\",\n \"The timestamps and HTTP outcomes are supplied or observed by this caller, not verified crawler-log evidence.\",\n \"A short live burst tests only a brief window; repeat checks and retain snapshots for historical trend evidence.\",\n];\n\nexport function emptyAvailabilityReview(\n scope: AvailabilityReview[\"scope\"] = \"caller_supplied_history\",\n): AvailabilityReview {\n return {\n scope, observations_count: 0, sampled_window_minutes: 0, max_observation_gap_minutes: 0,\n observed_successes: 0, observed_redirects: 0, observed_http_4xx: 0,\n observed_http_5xx: 0, observed_timeouts: 0, observed_transport_failures: 0,\n observed_rate_limits: 0, observed_challenges: 0, observed_success_percent: 0,\n http_status_changes: 0, outcome_changes: 0, intermittent_non_success: false,\n longest_non_success_streak: 0, current_non_success_streak: 0,\n coverage_limited: true, limitations, samples: [], total_findings: 0,\n findings: [], findings_truncated: false,\n };\n}\n\nconst failures = new Set<string>(AVAILABILITY_FAILURE_CODES);\n\nexport function validateAvailabilityObservation(value: AvailabilityObservation): number {\n const timestamp = value && typeof value === \"object\"\n ? strictObservationTime(value.observed_at) : undefined;\n if (timestamp === undefined) {\n throw new Error(\"Each availability sample requires a real ISO timestamp with an explicit UTC offset and valid calendar date and clock.\");\n }\n const hasStatus = value.status_code !== undefined;\n const hasFailure = value.failure !== undefined;\n if (hasStatus === hasFailure) {\n throw new Error(\"Exactly one of status_code or failure is required per observation.\");\n }\n if (hasStatus && (!Number.isInteger(value.status_code) ||\n value.status_code! < 100 || value.status_code! > 599)) {\n throw new Error(\"HTTP status must be an observed integer between 100 and 599.\");\n }\n if (hasFailure && !failures.has(value.failure!)) {\n throw new Error(\"Unrecognized availability failure code.\");\n }\n if (value.cf_challenge !== undefined &&\n (typeof value.cf_challenge !== \"boolean\" || (!hasStatus && value.cf_challenge))) {\n throw new Error(\"A challenge flag requires an actual HTTP response.\");\n }\n if (value.elapsed_ms !== undefined &&\n (!Number.isInteger(value.elapsed_ms) || value.elapsed_ms < 0 || value.elapsed_ms > 120_000)) {\n throw new Error(\"Response elapsed_ms must be a nonnegative integer at most 120,000.\");\n }\n return timestamp;\n}\n\nexport function availabilityState(value: AvailabilityObservation): AvailabilityState {\n if (value.failure === \"timeout\") return \"timeout\";\n if (value.failure === \"policy_blocked\") return \"policy_blocked\";\n if (value.failure !== undefined) return \"transport_error\";\n const code = value.status_code!;\n // Cloudflare challenges sometimes use HTTP 200; this is not proof that the\n // protected page was delivered. Keep 403/429 error classes distinct.\n if (value.cf_challenge === true && code >= 200 && code < 300) return \"challenge\";\n if (code === 403) return \"forbidden\";\n if (code === 429) return \"rate_limited\";\n if (code >= 500) return \"server_error\";\n if (code >= 400) return \"client_error\";\n if (code >= 300 && code < 400) return \"redirect\";\n if (code >= 200 && code < 300) return \"success\";\n return \"other\";\n}\n\nexport function analyzeAvailabilityHistory(\n observations: AvailabilityObservation[],\n scope: AvailabilityReview[\"scope\"] = \"caller_supplied_history\",\n): AvailabilityReview {\n if (!Array.isArray(observations) || observations.length < 2 ||\n observations.length > MAX_AVAILABILITY_OBSERVATIONS) {\n throw new Error(\"Supply two to 48 ordered availability observations.\");\n }\n const times = observations.map(validateAvailabilityObservation);\n for (let i = 1; i < times.length; i += 1) {\n if (times[i] <= times[i - 1]) {\n throw new Error(\"Availability timestamps must be unique and strictly chronological.\");\n }\n }\n const r = emptyAvailabilityReview(scope);\n r.observations_count = observations.length;\n r.first_observed_at = new Date(times[0]).toISOString();\n r.last_observed_at = new Date(times[times.length - 1]).toISOString();\n r.sampled_window_minutes = Math.round((times[times.length - 1] - times[0]) / 600) / 100;\n let maxGap = 0;\n let streak = 0;\n let hasNonSuccess = false;\n let previousState: AvailabilityState | undefined;\n let previousHttpStatus: number | undefined;\n for (let i = 0; i < observations.length; i += 1) {\n const value = observations[i];\n const state = availabilityState(value);\n const success = state === \"success\";\n const challenge = value.cf_challenge === true;\n r.samples.push({\n observation: i + 1,\n observed_at: new Date(times[i]).toISOString(),\n ...(value.status_code === undefined ? {} : { status_code: value.status_code }),\n state, cf_challenge: challenge,\n ...(value.elapsed_ms === undefined ? {} : { elapsed_ms: value.elapsed_ms }),\n });\n if (success) r.observed_successes++;\n else {\n hasNonSuccess = true;\n streak += 1;\n r.longest_non_success_streak = Math.max(r.longest_non_success_streak, streak);\n }\n if (success) streak = 0;\n if (state === \"redirect\") r.observed_redirects++;\n if (value.status_code !== undefined) {\n if (value.status_code >= 400 && value.status_code < 500) r.observed_http_4xx++;\n if (value.status_code >= 500) r.observed_http_5xx++;\n if (value.status_code === 429) r.observed_rate_limits++;\n if (previousHttpStatus !== undefined && previousHttpStatus !== value.status_code) {\n r.http_status_changes += 1;\n }\n }\n if (state === \"timeout\") r.observed_timeouts++;\n if (value.failure !== undefined) r.observed_transport_failures++;\n if (challenge) r.observed_challenges++;\n if (previousState !== undefined && previousState !== state) r.outcome_changes += 1;\n if (i > 0) maxGap = Math.max(maxGap, times[i] - times[i - 1]);\n previousState = state;\n previousHttpStatus = value.status_code;\n r.latest_observed_state = state;\n r.latest_http_status = value.status_code;\n }\n r.current_non_success_streak = streak;\n r.max_observation_gap_minutes = Math.round(maxGap / 600) / 100;\n r.observed_success_percent = Math.round(r.observed_successes * 100 / observations.length);\n r.intermittent_non_success = hasNonSuccess && r.observed_successes > 0;\n\n const add = (code: AvailabilityFindingCode, severity: \"warning\" | \"info\", message: string) => {\n r.total_findings++;\n if (r.findings.length < MAX_AVAILABILITY_FINDINGS) {\n r.findings.push({ code, severity, message });\n } else r.findings_truncated = true;\n };\n if (r.intermittent_non_success) add(\"intermittent_non_success\", \"warning\",\n \"Both successful and non-successful HTTP/transport outcomes occurred in these discrete samples.\");\n if (r.latest_observed_state !== \"success\") add(\"latest_non_success\", \"warning\",\n \"The last sampled response was not a completed HTTP 2xx; verify whether the condition remains.\");\n if (r.observed_rate_limits > 0) add(\"rate_limiting\", \"warning\",\n \"At least one sampled response reported HTTP 429 rate limiting.\");\n if (r.observed_http_5xx > 0) add(\"server_failures\", \"warning\",\n \"One or more sampled HTTP 5xx responses were observed.\");\n if (r.observed_transport_failures > 0) add(\"transport_failures\", \"warning\",\n \"One or more sampled requests returned no HTTP response.\");\n if (r.observed_challenges > 0) add(\"challenge_observed\", \"warning\",\n \"One or more samples carried an explicit Cloudflare challenge flag.\");\n if (r.http_status_changes > 0) add(\"status_transitions\", \"info\",\n \"HTTP status codes changed between adjacent response observations.\");\n if (observations.length < 3) add(\"sparse_samples\", \"info\",\n \"Only two samples were supplied; more observations improve interpretation.\");\n if (maxGap >= 60 * 60 * 1_000) add(\"large_sampling_gap\", \"info\",\n \"Samples include at least one gap of an hour or more; no continuity is established during gaps.\");\n\n return r;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"availability-probe.js","sourceRoot":"","sources":["../../../src/modules/http-crawl/availability-probe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"availability-probe.js","sourceRoot":"","sources":["../../../src/modules/http-crawl/availability-probe.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,GAAW,EAAE,MAAM,GAAG,CAAC;IAEvB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC5F,8EAA8E;IAC9E,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,KAAK,GAA8B,EAAE,CAAC;IAC5C,IAAI,iBAAiB,GAAG,CAAC,CAAC,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,OAAkF,CAAC;QACvF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;YAC5C,OAAO,GAAG,MAAM,CAAC,iBAAiB,KAAK,SAAS;gBAC9C,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE;gBAC5B,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,iBAAiB;oBACvC,YAAY,EAAE,MAAM,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;QACvC,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,GAAG,CAAC,CAAC,CAAC;QACrD,iBAAiB,GAAG,KAAK,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC;YACT,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE;YAC1C,GAAG,OAAO;YACV,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;SAC5D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\nimport {\n type AvailabilityObservation,\n} from \"./availability-observations.js\";\nimport { probeHttpDelivery } from \"./http-delivery-probe.js\";\nimport { safeHttpResourceUrl } from \"./non-html-directives.js\";\nimport { resolvePublicHttpUrl } from \"../../network.js\";\n\n/**\n * V02: a tiny sequential, read-only GET burst. It deliberately does not store\n * observations or sleep in the background. Callers may separately save\n * individual results using the local availability history MCP. That tool\n * requests a single probe per opt-in capture.\n */\nexport async function collectPublicAvailability(\n url: string, checks = 3,\n): Promise<AvailabilityObservation[]> {\n if (!safeHttpResourceUrl(url)) throw new Error(\"A safe query-free public URL is required.\");\n // Do not silently record three synthetic failures for a private/reserved URL.\n await resolvePublicHttpUrl(url);\n if (!Number.isInteger(checks) || checks < 1 || checks > 3) {\n throw new Error(\"A live availability capture permits one to three checks.\");\n }\n const items: AvailabilityObservation[] = [];\n let previousTimestamp = -1;\n for (let index = 0; index < checks; index++) {\n const started = Date.now();\n let outcome: Pick<AvailabilityObservation, \"status_code\" | \"failure\" | \"cf_challenge\">;\n try {\n const result = await probeHttpDelivery(url);\n outcome = result.final_http_status === undefined\n ? { failure: \"fetch_error\" }\n : { status_code: result.final_http_status,\n cf_challenge: result.challenges_observed > 0 };\n } catch {\n outcome = { failure: \"fetch_error\" };\n }\n const ended = Date.now();\n // Millisecond timestamps are rounded; monotonic tie-breaks preserve sample\n // ordering when two fast responses complete within the same clock tick.\n const stamp = Math.max(ended, previousTimestamp + 1);\n previousTimestamp = stamp;\n items.push({\n observed_at: new Date(stamp).toISOString(),\n ...outcome,\n elapsed_ms: Math.min(120_000, Math.max(0, ended - started)),\n });\n }\n return items;\n}\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright (c) 2026 AKzar1el and Web Validator contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { fetchPublicHttp, readResponseText, resolvePublicHttpUrl } from "../../network.js";
|
|
2
4
|
import { analyzeCrawlerAccess, isAllowedForFetcher, MAX_CRAWLER_HTML_BYTES, MAX_CRAWLER_ROBOTS_BYTES, } from "./crawler-access.js";
|
|
3
5
|
import { safeHttpResourceUrl } from "./non-html-directives.js";
|