feat(core): improve in-memory validation, FatturaPA detection coverage, and published type compatibility

This commit is contained in:
2026-04-16 20:30:56 +00:00
parent 55bee02a2e
commit 3f37f6538c
60 changed files with 5723 additions and 6678 deletions
+24 -8
View File
@@ -1,11 +1,11 @@
For testing use
```typescript
import {tap, expect} @push.rocks/tapbundle
import { tap, expect } from '@git.zone/tstest/tapbundle';
```
tapbundle exports expect from @push.rocks/smartexpect
You can find the readme here: https://code.foss.global/push.rocks/smartexpect/src/branch/master/readme.md
tapbundle is provided by `@git.zone/tstest`.
You can find the readme here: https://code.foss.global/git.zone/tstest
This module also uses @tsclass/tsclass: You can find the TInvoice type here: https://code.foss.global/tsclass/tsclass/src/branch/master/ts/finance/invoice.ts
@@ -15,6 +15,22 @@ It is ok to ask questions, if you are unsure about something.
---
# Upgrade Notes (2026-04-16)
- Command: `/c-upgrade`
- Files modified: 2
- Dependency status: `pnpm outdated --format json` returned `{}`, so no package version bumps were needed.
- Decorators: no decorator usage was found in `*.ts`, so TC39 decorator migration was not required.
- Pattern changes:
- Removed obsolete `experimentalDecorators` and `useDefineForClassFields` compiler options from `tsconfig.json`.
- Updated the stale test import hint from `@push.rocks/tapbundle` to `@git.zone/tstest/tapbundle`.
- Verification:
- `pnpm run build`: passed
- `pnpm test`: failed due to pre-existing test issues in `test/test.conformance-harness.ts` (no tests defined) and `test/suite/einvoice_security/test.sec-06.memory-dos.ts` (assertion failure at line 142)
- Issues encountered: full test suite is not green before or after this minimal upgrade because of the pre-existing failures above.
---
# Architecture Analysis (2025-01-31)
## Overall Architecture
@@ -490,7 +506,7 @@ countryCode: country
### **MILESTONE REACHED: The module now achieves 100% data preservation in round-trip conversions!**
This makes the module fully spec-compliant and suitable as the default open-source e-invoicing solution.
This materially improved round-trip data preservation, but it did not by itself prove full standards compliance across every supported format and profile.
### Data Preservation Improvements:
- Initial preservation score: 51%
@@ -800,7 +816,7 @@ Successfully fixed all remaining test failures to achieve 100% test pass rate:
- Format detection: <5ms average for most formats
- PDF extraction: Successfully extracts from ZUGFeRD v1/v2 and Factur-X PDFs
All tests are now passing, making the library fully spec-compliant and production-ready.
The targeted test suites available at that point were passing, but that still did not establish full standards compliance or production readiness across every supported format/profile.
---
@@ -855,10 +871,10 @@ for (const idNode of partyIdNodes) {
```
### FatturaPA (Italian Standard)
While not fully implemented as decoder/encoder, the library detects FatturaPA format:
FatturaPA currently has format detection, but not full decoder/encoder support:
- Detects root element `<FatturaElettronica>`
- Recognizes namespace `fatturapa.gov.it`
- Supports mixed UBL+FatturaPA documents
- May classify mixed UBL+FatturaPA documents as FatturaPA during detection
## 3. Advanced Validation Architecture
@@ -1104,4 +1120,4 @@ Each format has its own implementation strategy while maintaining common interfa
5. **Extensible Design**: New formats can be added without core changes
6. **Production Ready**: Handles edge cases, malformed input, and large files
The library represents a mature, well-architected solution for European e-invoicing with careful attention to both standards compliance and practical usage scenarios.
The library represents a mature, well-architected solution for European e-invoicing with careful attention to both standards compliance and practical usage scenarios.