12 lines
2.3 KiB
JavaScript
12 lines
2.3 KiB
JavaScript
import { readFile } from 'node:fs/promises'
|
|
import { resolve } from 'node:path'
|
|
const root = resolve(new URL('..', import.meta.url).pathname); const report = JSON.parse(await readFile(resolve(root, 'config/chrome-techdraw-verification.json'), 'utf8'))
|
|
if (report.schemaVersion !== 1 || report.status !== 'pass' || report.browserId !== 'chrome' || !/Chrome/i.test(report.browser?.product || '') || report.crossOriginIsolated !== true) throw new Error('Chrome TechDraw verification is not passing.')
|
|
if (report.page?.views !== 2 || report.page.sections !== 1 || report.page.dimensions !== 1 || report.page.annotations !== 1 || report.page.tolerances !== 1 || report.page.updatedDimension !== 6 || JSON.stringify(report.page.unresolvedRefs) !== JSON.stringify(['Vertex3']) || JSON.stringify(report.page.unresolvedTolerances) !== JSON.stringify(['flatness'])) throw new Error('TechDraw view/section/dimension/GD&T/TopoRef update evidence is incomplete.')
|
|
if (report.svg?.bytes <= 0 || !/^[0-9a-f]{64}$/.test(report.svg.sha256) || report.svg.deterministic !== true || report.svg.lines !== 2 || report.svg.accessible !== true) throw new Error('TechDraw deterministic SVG evidence is incomplete.')
|
|
if (report.pdf?.bytes <= 0 || !/^[0-9a-f]{64}$/.test(report.pdf.sha256) || report.pdf.deterministic !== true || report.pdf.validHeader !== true || report.pdf.validXref !== true) throw new Error('TechDraw deterministic PDF evidence is incomplete.')
|
|
if (!Array.isArray(report.resources) || report.resources.length !== 3 || report.resources.some((resource) => !resource.hash || resource.byteLength <= 0 || resource.roundTrip !== true || resource.released !== true) || !report.resources.some((resource) => resource.mediaType === 'application/pdf')) throw new Error('TechDraw OPFS resource lifecycle evidence is incomplete.')
|
|
if (report.opfs?.markerSuite !== 'TD-ALL' || report.opfs.markerViews !== 2 || report.opfs.markerRemoved !== true) throw new Error('TechDraw OPFS marker was not verified and removed.')
|
|
if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('TechDraw harness leaked ShapeHandles.')
|
|
console.log(JSON.stringify({ status: 'chrome-techdraw-pass', browser: report.browser.product, page: report.page, svg: report.svg, resources: report.resources, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
|