Improve PDF XML extraction, embedding, and format detection; update loadPdf/exportPdf error handling; add new validator implementations and enhance IPdf metadata.
- Update loadPdf to capture extraction result details including detected format and improve error messaging
- Enhance TextXMLExtractor with a chunked approach using both UTF-8 and Latin-1 decoding for reliable text extraction
- Refactor PDFEmbedder to return a structured PDFEmbedResult with proper filename normalization and robust error handling
- Extend format detection logic by adding quickFormatCheck, isUBLFormat, isXRechnungFormat, isCIIFormat, isZUGFERDV1Format, and FatturaPA checks
- Introduce new validator classes (UBLValidator, XRechnungValidator, FatturaPAValidator) and a generic fallback validator in ValidatorFactory
- Update IPdf interface to include embedded XML metadata (format, filename, description) for better traceability
Refactor module imports to use the centralized plugins module and update relative paths across the codebase. Also remove the obsolete test file (test/test.other-formats-corpus.ts) and update file metadata in test outputs.
- Updated import statements in modules (e.g., ts/classes.xinvoice.ts, ts/formats/*, and ts/interfaces/common.ts) to import DOMParser, xpath, and other dependencies from './plugins.js' instead of directly from 'xmldom' and 'xpath'.
- Adjusted import paths in test asset files such as test/assets/letter/letter1.ts.
- Removed the obsolete test file test/test.other-formats-corpus.ts.
- Test output files now show updated CreationDate/ModDate metadata.
Refactor Zugferd decoders to properly extract house numbers from street names and remove unused imports; update readme hints with additional TInvoice reference and refresh PDF metadata timestamps.
- Use regex in zugferd.decoder.ts and zugferd.v1.decoder.ts to split the street name and extract the house number.
- Remove the unnecessary 'general' import from '@tsclass/tsclass' in zugferd decoder files.
- Update readme.hints.md with a reference to the TInvoice type from @tsclass/tsclass.
- Update the CreationDate and ModDate in the embedded PDF asset to new timestamps.
Refactor XInvoice API for XML handling and PDF export by replacing deprecated methods (addXmlString and getParsedXmlData) with fromXml and loadXml, and by introducing a new ExportFormat type for type-safe export. Update tests accordingly.
- Removed usage of addXmlString and getParsedXmlData in favor of XInvoice.fromXml and loadXml for XML processing.
- Added ExportFormat type and enforced type-safety in exportXml and exportPdf methods.
- Updated test files to adapt to the new API, ensuring proper error handling and API consistency.
- Revised expectations in tests to check for new methods (loadXml, validate, exportXml, exportPdf) and properties.
Refactor contact and PDF handling across the library by replacing IContact with TContact and updating PDF processing to use a structured IPdf object. These changes ensure that empty contact objects include registration details, founded/closed dates, and status, and that PDF loading/exporting uniformly wraps buffers in a proper object.
- Updated createEmptyContact (renamed in documentation to reflect TContact) to return a complete TContact object with registrationDetails, foundedDate, closedDate, and status.
- Modified loadPdf and exportPdf in XInvoice to wrap PDF buffers in an IPdf object with name, id, and metadata instead of using a raw Uint8Array.
- Replaced IContact with TContact in FacturXEncoder, FacturXDecoder, and XInvoiceDecoder to standardize contact structure.
- Aligned address and contact data across decoders and encoders for consistency.
Update readme to enhance installation instructions and expand feature documentation for Factur-X/ZUGFeRD, UBL, and FatturaPA support, including details on circular encoding/decoding.
- Added pnpm installation instructions
- Expanded description of supported European e-invoicing standards
- Clarified usage of FacturXEncoder and ZUGFeRDXmlDecoder for XML encoding/decoding
- Included detailed feature summary for PDF integration, encoding/decoding, and format detection
Rename encoder class from ZugferdXmlEncoder to FacturXEncoder to better reflect Factur-X compliance. All related imports, exports, and tests have been updated while maintaining backward compatibility.
- Renamed the encoder class to FacturXEncoder and added an alias for backward compatibility (FacturXEncoder as ZugferdXmlEncoder)
- Updated test files and TS index exports to reference the new class name
- Improved XML creation formatting and documentation within the encoder module