{"_id":"@advance-labs/schema-validator","_rev":"3-f3f1676668d8275fb6e902d3f692a5d7","name":"@advance-labs/schema-validator","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.0":{"name":"@advance-labs/schema-validator","version":"0.2.0","license":"MIT","_id":"@advance-labs/schema-validator@0.2.0","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"homepage":"https://github.com/Advance-Labs/aeo-toolkit#readme","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"dist":{"shasum":"6fb213f635330ee43bb6ee65428bcc3d0ff31e23","tarball":"https://registry.npmjs.org/@advance-labs/schema-validator/-/schema-validator-0.2.0.tgz","fileCount":6,"integrity":"sha512-4lqwa5ABYz6MoCEm3f2fMs1Fm8bocJsjPuGcE5q8w63pq8UUOW1bKPAZhgSgsvQSzoJqUgRs7kHGJ3BO708HIA==","signatures":[{"sig":"MEYCIQDFWVInK3QpP3OZQkOJB1u5WawKiAWiWmgBQ02yQPyQAQIhANxZCTDswkqC/i1U8AHzQkfMDgWdPySUBYbwQ7FblLp2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73776},"main":"./dist/index.js","type":"module","_from":"file:advance-labs-schema-validator-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rimraf dist .turbo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"_resolved":"/private/var/folders/lc/qg6736_d3pxb5ds7q4x5gtf80000gn/T/55b9c0e392b98c5fcae6220562a93bf3/advance-labs-schema-validator-0.2.0.tgz","_integrity":"sha512-4lqwa5ABYz6MoCEm3f2fMs1Fm8bocJsjPuGcE5q8w63pq8UUOW1bKPAZhgSgsvQSzoJqUgRs7kHGJ3BO708HIA==","repository":{"url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","type":"git","directory":"packages/schema-validator"},"_npmVersion":"11.18.0","description":"Detect and validate JSON-LD, Microdata, and RDFa structured data from raw HTML, mapped to schema.org types with AEO-relevant required-property validation.","directories":{},"_nodeVersion":"25.8.1","dependencies":{"cheerio":"^1.0.0","domhandler":"^5.0.3","@advance-labs/types":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","rimraf":"^6.0.1","vitest":"^3.2.6","typescript":"^5.7.2","@advance-labs/config":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/schema-validator_0.2.0_1788059629899_0.13175904746571088","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@advance-labs/schema-validator","version":"0.2.1","keywords":["schema-org","json-ld","microdata","rdfa","structured-data","validator","seo","aeo"],"license":"Apache-2.0","_id":"@advance-labs/schema-validator@0.2.1","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"homepage":"https://github.com/Advance-Labs/aeo-toolkit#readme","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"dist":{"shasum":"be5c1e499657d5ac919d92aca5313f344a2fbb91","tarball":"https://registry.npmjs.org/@advance-labs/schema-validator/-/schema-validator-0.2.1.tgz","fileCount":6,"integrity":"sha512-VCdgE2bh+3JWhVyzctjq2ryuyLF/wUIFSGjKx2CAtIcDHcz7+tz5qgS/QwfwI8N91pROEs+qzdSh7w42mS0GMg==","signatures":[{"sig":"MEQCICkvy5/V1axKJ5iTMhNtTuPa/hLmoO9QZn5Q9C0nUOGEAiAyY/oTM1gpf2U9sn/kWZQO0ff7b0dRDhSvKIf0LlIvuA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":87545},"main":"./dist/index.js","type":"module","_from":"file:advance-labs-schema-validator-0.2.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rimraf dist .turbo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"_resolved":"/tmp/e620b1ed1289e8e7fb4f13b0c18c6994/advance-labs-schema-validator-0.2.1.tgz","_integrity":"sha512-VCdgE2bh+3JWhVyzctjq2ryuyLF/wUIFSGjKx2CAtIcDHcz7+tz5qgS/QwfwI8N91pROEs+qzdSh7w42mS0GMg==","repository":{"url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","type":"git","directory":"packages/schema-validator"},"_npmVersion":"11.19.0","description":"Detect and validate JSON-LD, Microdata, and RDFa structured data from raw HTML, mapped to schema.org types with AEO-relevant required-property validation.","directories":{},"_nodeVersion":"24.20.0","dependencies":{"cheerio":"^1.0.0","domhandler":"^5.0.3","@advance-labs/types":"0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","rimraf":"^6.0.1","vitest":"^3.2.6","typescript":"^5.7.2","@advance-labs/config":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/schema-validator_0.2.1_1789019425729_0.6916050106746572","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@advance-labs/schema-validator","version":"0.2.2","type":"module","description":"Detect and validate JSON-LD, Microdata, and RDFa structured data from raw HTML, mapped to schema.org types with AEO-relevant required-property validation.","keywords":["schema-org","json-ld","microdata","rdfa","structured-data","validator","seo","aeo"],"license":"Apache-2.0","author":{"name":"Lucas Krawczak","email":"lucas@advancelabs.dev","url":"https://advancelabs.dev/lucas"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"cheerio":"^1.0.0","domhandler":"^5.0.3","@advance-labs/types":"0.2.2"},"devDependencies":{"rimraf":"^6.0.1","tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^3.2.6","@advance-labs/config":"0.1.0"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","directory":"packages/schema-validator"},"homepage":"https://docs.advancelabs.dev/aeo-toolkit","scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","lint":"eslint src","test":"vitest run","clean":"rimraf dist .turbo"},"_id":"@advance-labs/schema-validator@0.2.2","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"_integrity":"sha512-1cHxmEYSI/RFcuLX54VtAy2/5vPy7cS5WjC566pW9QbY+BoXP90Do74JWCTrduGiflQexZI2j1X3CGiacljBWA==","_resolved":"/tmp/44207bf38abfe825a860840e695f89f7/advance-labs-schema-validator-0.2.2.tgz","_from":"file:advance-labs-schema-validator-0.2.2.tgz","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-1cHxmEYSI/RFcuLX54VtAy2/5vPy7cS5WjC566pW9QbY+BoXP90Do74JWCTrduGiflQexZI2j1X3CGiacljBWA==","shasum":"c14a877508b6fd0b31ad76ddde1aa56dc6ec1c40","tarball":"https://registry.npmjs.org/@advance-labs/schema-validator/-/schema-validator-0.2.2.tgz","fileCount":6,"unpackedSize":87621,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD6EuZV1KpQDbrA680qvybXgs6pvpHO4HwryodyDUk6WQIhAKIPux6KrbqN0//j1SnvfGjvnoKMeb6IoOf/kDpjWd6K"}]},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"directories":{},"maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/schema-validator_0.2.2_1789020710852_0.48357902047218393"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T03:13:49.720Z","modified":"2026-09-10T06:11:51.156Z","0.2.0":"2026-08-30T03:13:50.039Z","0.2.1":"2026-09-10T05:50:25.867Z","0.2.2":"2026-09-10T06:11:50.988Z"},"bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"license":"Apache-2.0","homepage":"https://docs.advancelabs.dev/aeo-toolkit","keywords":["schema-org","json-ld","microdata","rdfa","structured-data","validator","seo","aeo"],"repository":{"type":"git","url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","directory":"packages/schema-validator"},"description":"Detect and validate JSON-LD, Microdata, and RDFa structured data from raw HTML, mapped to schema.org types with AEO-relevant required-property validation.","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"readme":"# @advance-labs/schema-validator\n\nDetect and validate **all three** structured-data encodings — JSON-LD, Microdata, and RDFa —\nfrom a raw HTML string, then map every item to its schema.org short type and check the required\nproperties that matter for answer-engine optimization (AEO). This is a clean-room TypeScript\nrebuild of the `structured-data-testing-tool` capability. It is pure and network-free: HTML is\nparsed in-process with `cheerio`, so it is fully unit-testable without live HTTP.\n\n## Usage\n\n```ts\nimport { analyzeStructuredData } from '@advance-labs/schema-validator';\n\nconst html = await fetchHtmlSomehow(url); // I/O is the caller's responsibility\nconst report = analyzeStructuredData(html, url);\n\nconsole.log(report.aeoTypesPresent); // e.g. ['FAQPage', 'Organization']\nconsole.log(report.invalidCount);    // items missing required properties\nfor (const item of report.items) {\n  if (!item.valid) console.warn(item.type, 'missing', item.missingRequired);\n}\n```\n\nThe low-level extractors operate on a loaded `cheerio` document if you need finer control:\n\n```ts\nimport * as cheerio from 'cheerio';\nimport { extractJsonLd, extractMicrodata, extractRdfa, validateItem } from '@advance-labs/schema-validator';\n\nconst $ = cheerio.load(html);\nconst items = [...extractJsonLd($), ...extractMicrodata($), ...extractRdfa($)];\nconst result = validateItem('FAQPage', { mainEntity: [/* ... */] });\n```\n\n## Public API\n\n| Export | Signature | Purpose |\n|--------|-----------|---------|\n| `analyzeStructuredData` | `(html: string, url: string) => StructuredDataReport` | Run all extractors and roll up a report with AEO presence flags. |\n| `extractJsonLd` | `($: CheerioAPI) => StructuredDataItem[]` | JSON-LD from `<script type=\"application/ld+json\">`, flattening `@graph` and arrays. |\n| `extractMicrodata` | `($: CheerioAPI) => StructuredDataItem[]` | Microdata via `itemscope` / `itemtype` / `itemprop`, with nested items. |\n| `extractRdfa` | `($: CheerioAPI) => StructuredDataItem[]` | RDFa Lite via `vocab` / `typeof` / `property`, with nested resources. |\n| `validateItem` | `(type: string, properties: Record<string, unknown>) => ValidationResult` | Check required properties for a (possibly multi-) schema.org type. |\n| `toShortType` | `(raw: string) => string` | Collapse any schema.org type reference to its short name. |\n| `normalizeTypes` | `(value: unknown) => string[]` | Normalize a `@type` string/array to ordered, de-duplicated short names. |\n| `isAeoSchemaType` | `(shortType: string) => shortType is AeoSchemaType` | Narrow to the AEO-relevant schema.org type set. |\n\nAll report/item shapes (`StructuredDataReport`, `StructuredDataItem`, `StructuredDataFormat`,\n`AeoSchemaType`) are imported from `@advance-labs/types` and never redefined here.\n\n### Validated types\n\nRequired-property validation is enforced for the key AEO types: **FAQPage** (`mainEntity` with\n`Question` + `acceptedAnswer`), **QAPage**, **HowTo** (`step`), **Article / NewsArticle /\nBlogPosting** (`headline`), **Person** (`name`), **Organization** (`name`), **BreadcrumbList**\n(`itemListElement`), **Product** (`name`), **Review** (`reviewRating`), and **LocalBusiness**\n(`name` + `address`). Unknown types are passed through as `valid: true` (we only assert rules we\nhave defined).\n\n## Status\n\n**Implemented** — all three extractors, schema.org type normalization, AEO required-property\nvalidation, and the aggregate report are fully implemented with no stubs. No live network or\nfilesystem I/O: callers supply the HTML.\n","readmeFilename":"README.md","author":{"name":"Lucas Krawczak","email":"lucas@advancelabs.dev","url":"https://advancelabs.dev/lucas"}}