{"_id":"@berryn/xlsx-validate","_rev":"3-e52dffbda2045ab6e9be7491e2bb02fc","name":"@berryn/xlsx-validate","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@berryn/xlsx-validate","version":"0.1.0","author":"Berryn Core Engineering Team","license":"MIT","_id":"@berryn/xlsx-validate@0.1.0","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"homepage":"https://github.com/Grevix/berryn","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"dist":{"shasum":"e5ff32b2774b8a4eb18427a5104eb3b80487f3c7","tarball":"https://registry.npmjs.org/@berryn/xlsx-validate/-/xlsx-validate-0.1.0.tgz","fileCount":27,"integrity":"sha512-UrqsUlsLLXU8K0y/vDnbVGrLegrMJ4wM6HyTAKHyT4RUoBS8yasmzDYtfjhrogljkLGfv1lcEeIJ+0grejgmDg==","signatures":[{"sig":"MEQCIDNfbuYy5ZagCWzHLiQrY4sy9+Ci1pzbSfZAdmshiqahAiAqOfdHmiWl09OKy49Ip860A6UoJdg3z25biHluIPc6QQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15733},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"build":"tsc --build","clean":"rimraf dist"},"_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"repository":{"url":"https://github.com/Grevix/berryn.git","type":"git"},"description":"Berryn XLSX Validation Engine — Structural, OPC relationship, semantic XML, and headless consumer checks","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@berryn/core":"0.1.0","@berryn/diagnostics":"0.1.0","@berryn/xlsx-inspect":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xlsx-validate_0.1.0_1787001019834_0.8787063921624598","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@berryn/xlsx-validate","version":"0.2.0","author":{"name":"Berryn Core Engineering Team"},"license":"MIT","_id":"@berryn/xlsx-validate@0.2.0","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"homepage":"https://github.com/Grevix/berryn#readme","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"dist":{"shasum":"ceee089b48bbadff0a3b522332f8e39ce58b1fa9","tarball":"https://registry.npmjs.org/@berryn/xlsx-validate/-/xlsx-validate-0.2.0.tgz","fileCount":22,"integrity":"sha512-ZITMEqL3cZhQv7Kx47vlGnq/3t4Dc4CicHHVG/KbKPY1k4p39uAFgABFp4URmk10/FTzL5tO4hP4gWhSCwJElw==","signatures":[{"sig":"MEUCIQDrBreuG7iEoP2psVZ/crw/sLwR13v5K/oW0kctldB7cAIgLuBAzGmx7QQg6doXqtUH3lLUnc6FC0ZHWt+EeJmEWhI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18868},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"fc466500ff83c2753bb41429713719eacd7895d4","scripts":{"build":"tsc --build","clean":"rimraf dist"},"_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"repository":{"url":"git+https://github.com/Grevix/berryn.git","type":"git"},"_npmVersion":"11.9.0","description":"Berryn XLSX Validation Engine — Structural, OPC relationship, semantic XML, and headless consumer checks","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@berryn/core":"workspace:*","@berryn/diagnostics":"workspace:*","@berryn/xlsx-inspect":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xlsx-validate_0.2.0_1788160236743_0.9317370312016138","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@berryn/xlsx-validate","version":"0.2.1","description":"Berryn XLSX Validation Engine — Structural, OPC relationship, semantic XML, and headless consumer checks","repository":{"type":"git","url":"git+https://github.com/Grevix/berryn.git"},"homepage":"https://github.com/Grevix/berryn#readme","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"license":"MIT","author":{"name":"Berryn Core Engineering Team"},"engines":{"node":">=22.0.0"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"type":"module","scripts":{"build":"tsc --build","clean":"rimraf dist"},"dependencies":{"@berryn/core":"0.2.1","@berryn/diagnostics":"0.2.1","@berryn/xlsx-inspect":"0.2.1"},"devDependencies":{},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"gitHead":"576fa2934836ad4f045966f8a86d99490cbea05b","_id":"@berryn/xlsx-validate@0.2.1","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-rIrfM1V2uTd+YSxpiXtLEn9bRZTSF0c7NDPeTd7JLqz9cj8Q8zxCoJWTSjibPkV90RCYpGKw68QIu4fCfW0J6A==","shasum":"bfd79f496bab5d45cf6c5cd1d7026e689100cb09","tarball":"https://registry.npmjs.org/@berryn/xlsx-validate/-/xlsx-validate-0.2.1.tgz","fileCount":22,"unpackedSize":18850,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCH26trVuPTq4oQ4CUFARqYM+cj/eGelTAxutRn22M19UCIQCaYQ2gRqVgnfEm69py12diOgqtp7lGaTneX9sFyxM2fg=="}]},"_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"directories":{},"maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/xlsx-validate_0.2.1_1788165819748_0.7126101807683798"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T21:10:19.729Z","modified":"2026-08-31T08:43:40.068Z","0.1.0":"2026-08-17T21:10:19.978Z","0.2.0":"2026-08-31T07:10:36.869Z","0.2.1":"2026-08-31T08:43:39.877Z"},"bugs":{"url":"https://github.com/Grevix/berryn/issues"},"author":{"name":"Berryn Core Engineering Team"},"license":"MIT","homepage":"https://github.com/Grevix/berryn#readme","repository":{"type":"git","url":"git+https://github.com/Grevix/berryn.git"},"description":"Berryn XLSX Validation Engine — Structural, OPC relationship, semantic XML, and headless consumer checks","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"readme":"# @berryn/xlsx-validate\n\n> **Multi-layer validation harness: Structural, OPC Relationship, Semantic XML, and Consumer Smoke tests.**\n\n[![npm version](https://img.shields.io/npm/v/@berryn/xlsx-validate.svg)](https://www.npmjs.com/package/@berryn/xlsx-validate)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7%2B-blue.svg)](https://www.typescriptlang.org/)\n\n---\n\n## Overview\n\n`@berryn/xlsx-validate` executes rigorous, multi-stage verification against generated or migrated XLSX spreadsheet workbooks. It catches corrupt files, broken Open Packaging Conventions (OPC) relationship references, invalid XML payloads, and headless consumer repair prompts before artifacts reach production.\n\n---\n\n## Installation\n\n```bash\n# Using pnpm\npnpm add @berryn/xlsx-validate\n\n# Using npm\nnpm install @berryn/xlsx-validate\n```\n\n---\n\n## The 4 Validation Layers\n\n```mermaid\nflowchart TD\n    A[XLSX Container Buffer] --> Stage1[1. Structural Validation]\n    Stage1 -->|Valid ZIP & Limits| Stage2[2. OPC Relationship Validation]\n    Stage2 -->|Rels Graph Intact| Stage3[3. Semantic XML Validation]\n    Stage3 -->|Schemas Valid| Stage4[4. Headless Consumer Smoke Test]\n    Stage4 --> Passed[Validation Succeeded]\n```\n\n1. **Stage 1: Structural Integrity (`validateStructuralIntegrity`)**:\n   - Decompresses archive under strict resource limit checks.\n   - Asserts valid ZIP headers, non-zero file contents, and safe compression ratios (`BRN-VAL-001`).\n\n2. **Stage 2: OPC Relationship Integrity (`validateRelationshipIntegrity`)**:\n   - Parses `_rels/.rels` and part-specific `.rels` files.\n   - Asserts all declared internal Relationship `Target` URIs exist physically within the container (`BRN-VAL-002`).\n\n3. **Stage 3: Semantic XML Validation (`validateSemanticContents`)**:\n   - Ensures core XML parts (`xl/workbook.xml`, `xl/styles.xml`, `xl/worksheets/sheet*.xml`) conform to OOXML expectations.\n\n4. **Stage 4: Headless Consumer Smoke Test (`runConsumerSmokeTest`)**:\n   - Optionally runs headless LibreOffice conversion in an isolated sandbox to detect real-world repair alerts (`BRN-VAL-003`).\n\n---\n\n## Usage Examples\n\n### 1. Structural Validation\n\n```typescript\nimport { readFileSync } from 'node:fs';\nimport { validateStructuralIntegrity } from '@berryn/xlsx-validate';\n\nconst buffer = readFileSync('workbook.xlsx');\nconst result = validateStructuralIntegrity(buffer);\n\nconsole.log(`Passed: ${result.passed}`);\nfor (const diag of result.diagnostics) {\n  console.log(`[${diag.severity}] ${diag.code}: ${diag.message}`);\n}\n```\n\n---\n\n### 2. OPC Relationship Validation\n\n```typescript\nimport { validateRelationshipIntegrity } from '@berryn/xlsx-validate';\n\nconst relsResult = validateRelationshipIntegrity(buffer);\n\nif (!relsResult.passed) {\n  console.error('Workbook contains dangling or broken OPC relationships:');\n  for (const diag of relsResult.diagnostics) {\n    console.error(`- ${diag.message}`);\n  }\n}\n```\n\n---\n\n### 3. Headless Consumer Smoke Test\n\n```typescript\nimport { runConsumerSmokeTest } from '@berryn/xlsx-validate';\n\nconst smokeResult = runConsumerSmokeTest('/path/to/workbook.xlsx');\nconsole.log(`Consumer Smoke Status: ${smokeResult.passed ? 'PASSED' : 'REPAIR_TRIGGERED'}`);\n```\n\n---\n\n## Exported Symbols\n\n| Symbol | Type | Description |\n|---|---|---|\n| `validateStructuralIntegrity` | Function | Verifies container decompression, entry existence, and safety limits. |\n| `validateRelationshipIntegrity` | Function | Ensures all internal OPC relationship references resolve to actual container parts. |\n| `validateSemanticContents` | Function | Checks XML payload integrity and workbook structure. |\n| `runConsumerSmokeTest` | Function | Executes headless LibreOffice conversion to verify client compatibility. |\n| `ValidationStageResult` | Interface | Result schema containing `passed`, `stageName`, and `diagnostics`. |\n\n---\n\n## Links\n\n- **Repository**: [https://github.com/Grevix/berryn](https://github.com/Grevix/berryn)\n- **License**: [MIT](https://opensource.org/licenses/MIT) © 2026 Berryn Core Engineering Team\n","readmeFilename":"README.md"}