{"_id":"@berryn/xlsx-inspect","_rev":"3-7fe14ac57304a891be2422861748f530","name":"@berryn/xlsx-inspect","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@berryn/xlsx-inspect","version":"0.1.0","author":"Berryn Core Engineering Team","license":"MIT","_id":"@berryn/xlsx-inspect@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":"c1faafb60407f8fa6c9e7fdfdd150b515aa84ac2","tarball":"https://registry.npmjs.org/@berryn/xlsx-inspect/-/xlsx-inspect-0.1.0.tgz","fileCount":27,"integrity":"sha512-EgBc4Sd5GPvPJ9bWg8/gQ9aIP0cKE0W78TuDKbPKx4o04kiH10xO5QYvr0iulJPwDIpNX+lTOpiBg4qKpGdRcw==","signatures":[{"sig":"MEQCIF99cUE9/AC07xEXP8zuLR2wlFslB95TLj7gL5hDppa4AiA13SNd1tk/vmSza5Y8KrUCDriyc+KbAklcAKdzHq7HBg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36206},"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 Inspection — ZIP container inventory, OPC relationship graph resolver, and feature classification","directories":{},"_nodeVersion":"24.14.0","dependencies":{"fflate":"^0.8.2","@berryn/core":"0.1.0","fast-xml-parser":"^4.5.1","@berryn/security":"0.1.0","@berryn/diagnostics":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xlsx-inspect_0.1.0_1787000880932_0.34355604127685435","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@berryn/xlsx-inspect","version":"0.2.0","author":{"name":"Berryn Core Engineering Team"},"license":"MIT","_id":"@berryn/xlsx-inspect@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":"c64b0db3ed8449c72027651f54e3aa745b764bc3","tarball":"https://registry.npmjs.org/@berryn/xlsx-inspect/-/xlsx-inspect-0.2.0.tgz","fileCount":22,"integrity":"sha512-cIrOrK9E+WbMAp8mSY5tzpbJnQDtl/f+fhVBbMuaql7I0csIA6NLuzY3NXaJEc/HhDlGDbB/w0a+JxbqTCB8sg==","signatures":[{"sig":"MEUCIQCBTOOC0jI5XMt0DKvRG6DJ7qHsjQTsTroi4u/y0iF+rgIgcxZL4Ppn9u4RlSQ2V+2HLStAp9cWejr6BIcwTuls56s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30081},"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 Inspection — ZIP container inventory, OPC relationship graph resolver, and feature classification","directories":{},"_nodeVersion":"24.14.0","dependencies":{"fflate":"^0.8.2","@berryn/core":"workspace:*","fast-xml-parser":"^4.5.1","@berryn/security":"workspace:*","@berryn/diagnostics":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xlsx-inspect_0.2.0_1788160228760_0.6311857090684438","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@berryn/xlsx-inspect","version":"0.2.1","description":"Berryn XLSX Inspection — ZIP container inventory, OPC relationship graph resolver, and feature classification","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/security":"0.2.1","fast-xml-parser":"^4.5.1","fflate":"^0.8.2"},"devDependencies":{},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"gitHead":"576fa2934836ad4f045966f8a86d99490cbea05b","_id":"@berryn/xlsx-inspect@0.2.1","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-ftziedC0pm6VHtZa4BKV9rtrL39KEr1Dzp7jW9tTmg9aW6SQeluBS/qgZNXv+Alp8j09ZCjWqkdR03ABWyywXA==","shasum":"170515690d9ae13a4a078c5bb89d8b801e8783c5","tarball":"https://registry.npmjs.org/@berryn/xlsx-inspect/-/xlsx-inspect-0.2.1.tgz","fileCount":22,"unpackedSize":30063,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC4KEREHYKhz4OeFspsFxcPhPcb3XqXbInrwal6bwEFyAIhAJ4Dq99iUXSD1ELZMRNI8mUTjZEowfySgPxrjricn6Dz"}]},"_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-inspect_0.2.1_1788165798085_0.9118574742607122"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T21:08:00.766Z","modified":"2026-08-31T08:43:18.385Z","0.1.0":"2026-08-17T21:08:01.083Z","0.2.0":"2026-08-31T07:10:28.898Z","0.2.1":"2026-08-31T08:43:18.210Z"},"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 Inspection — ZIP container inventory, OPC relationship graph resolver, and feature classification","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"readme":"# @berryn/xlsx-inspect\n\n> **Bounded XLSX package ZIP archive reader and Open Packaging Conventions (OPC) relationship parser.**\n\n[![npm version](https://img.shields.io/npm/v/@berryn/xlsx-inspect.svg)](https://www.npmjs.com/package/@berryn/xlsx-inspect)\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-inspect` performs deep structural inventory and relationship graph extraction on Open Packaging Conventions (OPC) spreadsheet packages (`.xlsx`, `.xlsm`, `.xltx`).\n\nIt safely reads ZIP container archives using bounded memory constraints, parses `[Content_Types].xml` and `_rels/.rels` graphs, and classifies every package part against Berryn's 5-tier support taxonomy.\n\n---\n\n## Installation\n\n```bash\n# Using pnpm\npnpm add @berryn/xlsx-inspect\n\n# Using npm\nnpm install @berryn/xlsx-inspect\n```\n\n---\n\n## 5-Tier Part Classification Taxonomy\n\nEvery ZIP entry in the OOXML package is evaluated and assigned to a tier:\n\n| Tier | Meaning | Examples |\n|---|---|---|\n| `supported` | Fully modeled and semantically validated by Berryn. | `xl/workbook.xml`, `xl/worksheets/sheet1.xml`, `xl/styles.xml`, `xl/sharedStrings.xml` |\n| `partially-supported` | Modeled with bounded feature coverage. | `xl/tables/table1.xml`, `xl/theme/theme1.xml` |\n| `preserved-not-modeled` | Opaque binary/XML preserved byte-for-byte to prevent silent data loss. | `xl/pivotTables/pivotTable1.xml`, `xl/drawings/drawing1.xml`, `xl/media/image1.png`, `customXml/*` |\n| `unsupported` | Known OOXML feature currently out of scope. Emits audit warning. | `xl/vbaProject.bin`, `xl/activeX/*` |\n| `rejected` | Hazardous, unrecognized, or invalid part violating safety invariants. | Unrecognized executable binaries or corrupted parts |\n\n---\n\n## Usage Examples\n\n### 1. Inspecting an XLSX Workbook Buffer\n\n```typescript\nimport { readFileSync } from 'node:fs';\nimport { inspectXlsx } from '@berryn/xlsx-inspect';\n\nconst buffer = readFileSync('financial_model.xlsx');\nconst { value: report, diagnostics } = inspectXlsx(buffer);\n\nconsole.log(`Total Entries: ${report.containerMeta.totalEntries}`);\nconsole.log(`Uncompressed Size: ${report.containerMeta.totalUncompressedBytes} bytes`);\nconsole.log(`Unsupported Parts: ${report.unsupportedPartCount}`);\n\nfor (const part of report.parts) {\n  console.log(`[${part.classification.toUpperCase()}] ${part.partPath} (${part.contentType})`);\n}\n```\n\n---\n\n### 2. Low-Level Bounded ZIP Container Reading\n\n```typescript\nimport { readZipContainer } from '@berryn/xlsx-inspect';\nimport { DEFAULT_RESOURCE_LIMITS } from '@berryn/core';\n\nconst { container, diagnostics } = readZipContainer(buffer, DEFAULT_RESOURCE_LIMITS);\n\nfor (const meta of container.meta) {\n  console.log(`Path: ${meta.path}, Size: ${meta.uncompressedSize} bytes, CRC32: ${meta.crc32}`);\n}\n```\n\n---\n\n### 3. Parsing OPC Relationships and Content Types\n\n```typescript\nimport { parseContentTypesXml, parseRelsXml } from '@berryn/xlsx-inspect';\n\n// Parse [Content_Types].xml\nconst contentTypesXml = new TextDecoder().decode(container.entries.get('[Content_Types].xml')!);\nconst { contentTypes } = parseContentTypesXml(contentTypesXml);\n\nconsole.log('Overrides:', contentTypes.overrides);\n\n// Parse root _rels/.rels\nconst relsXml = new TextDecoder().decode(container.entries.get('_rels/.rels')!);\nconst { relationships } = parseRelsXml(relsXml);\n\nfor (const rel of relationships) {\n  console.log(`ID: ${rel.id} -> Type: ${rel.type} -> Target: ${rel.target}`);\n}\n```\n\n---\n\n## Exported Symbols\n\n| Symbol | Category | Description |\n|---|---|---|\n| `inspectXlsx` | Function | High-level inspector returning full metadata, part classifications, and OPC relations. |\n| `readZipContainer` | Function | Safe, memory-bounded ZIP decompression and entry extraction (`fflate`). |\n| `parseContentTypesXml` | Function | Extracts `Default` extension mappings and `Override` part content types. |\n| `parseRelsXml` | Function | Parses OOXML relationship XML documents into typed `OpcRelationship[]` records. |\n| `classifyOpcPart` | Function | Maps part path and MIME content-type to one of the 5 classification tiers. |\n| `XlsxInspectionReport` | Interface | Aggregate inspection report containing container metrics, parts, and diagnostics. |\n| `PartClassification` | Interface | Structure describing path, content type, tier, and associated diagnostic notes. |\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"}