diff --git a/MIGRATION.md b/MIGRATION.md deleted file mode 100644 index 0e0761b..0000000 --- a/MIGRATION.md +++ /dev/null @@ -1,243 +0,0 @@ -# Migration Guide: XInvoice to EInvoice (v4.x to v5.x) - -This guide helps you migrate from `@fin.cx/xinvoice` v4.x to `@fin.cx/einvoice` v5.x. - -## Overview - -Version 5.0.0 introduces a complete rebranding from XInvoice to EInvoice. The name change better reflects the library's purpose as a comprehensive electronic invoice (e-invoice) processing solution that supports multiple international standards. - -## Breaking Changes - -### 1. Package Name Change - -**Old:** -```json -"dependencies": { - "@fin.cx/xinvoice": "^4.3.0" -} -``` - -**New:** -```json -"dependencies": { - "@fin.cx/einvoice": "^5.0.0" -} -``` - -### 2. Import Changes - -**Old:** -```typescript -import { XInvoice } from '@fin.cx/xinvoice'; -import type { XInvoiceOptions } from '@fin.cx/xinvoice'; -``` - -**New:** -```typescript -import { EInvoice } from '@fin.cx/einvoice'; -import type { EInvoiceOptions } from '@fin.cx/einvoice'; -``` - -### 3. Class Name Changes - -**Old:** -```typescript -const invoice = new XInvoice(); -const invoiceFromXml = await XInvoice.fromXml(xmlString); -const invoiceFromPdf = await XInvoice.fromPdf(pdfBuffer); -``` - -**New:** -```typescript -const invoice = new EInvoice(); -const invoiceFromXml = await EInvoice.fromXml(xmlString); -const invoiceFromPdf = await EInvoice.fromPdf(pdfBuffer); -``` - -### 4. Type/Interface Changes - -**Old:** -```typescript -const options: XInvoiceOptions = { - validateOnLoad: true, - validationLevel: ValidationLevel.BUSINESS -}; -``` - -**New:** -```typescript -const options: EInvoiceOptions = { - validateOnLoad: true, - validationLevel: ValidationLevel.BUSINESS -}; -``` - -## New Features in v5.x - -### Enhanced Error Handling - -Version 5.0.0 introduces specialized error classes for better error handling: - -```typescript -import { - EInvoiceError, - EInvoiceParsingError, - EInvoiceValidationError, - EInvoicePDFError, - EInvoiceFormatError -} from '@fin.cx/einvoice'; - -try { - const invoice = await EInvoice.fromXml(xmlString); -} catch (error) { - if (error instanceof EInvoiceParsingError) { - console.error('Parsing failed:', error.getLocationMessage()); - console.error('Suggestions:', error.getDetailedMessage()); - } else if (error instanceof EInvoiceValidationError) { - console.error('Validation report:', error.getValidationReport()); - } else if (error instanceof EInvoicePDFError) { - console.error('PDF operation failed:', error.message); - console.error('Recovery suggestions:', error.getRecoverySuggestions()); - } -} -``` - -### Error Recovery - -The new version includes error recovery capabilities: - -```typescript -import { ErrorRecovery } from '@fin.cx/einvoice'; - -// Attempt to recover from XML parsing errors -const recovery = await ErrorRecovery.attemptXMLRecovery(xmlString, parsingError); -if (recovery.success && recovery.cleanedXml) { - const invoice = await EInvoice.fromXml(recovery.cleanedXml); -} -``` - -## Step-by-Step Migration - -### 1. Update your package.json - -```bash -# Remove old package -pnpm remove @fin.cx/xinvoice - -# Install new package -pnpm add @fin.cx/einvoice -``` - -### 2. Update imports using find and replace - -Find all occurrences of: -- `@fin.cx/xinvoice` → `@fin.cx/einvoice` -- `XInvoice` → `EInvoice` -- `XInvoiceOptions` → `EInvoiceOptions` - -### 3. Update your code - -Example migration: - -**Before:** -```typescript -import { XInvoice, ValidationLevel } from '@fin.cx/xinvoice'; - -async function processInvoice(xmlData: string) { - try { - const xinvoice = await XInvoice.fromXml(xmlData); - const validation = await xinvoice.validate(ValidationLevel.BUSINESS); - - if (!validation.valid) { - throw new Error('Validation failed'); - } - - return xinvoice; - } catch (error) { - console.error('Error:', error); - throw error; - } -} -``` - -**After:** -```typescript -import { EInvoice, ValidationLevel, EInvoiceValidationError } from '@fin.cx/einvoice'; - -async function processInvoice(xmlData: string) { - try { - const einvoice = await EInvoice.fromXml(xmlData); - const validation = await einvoice.validate(ValidationLevel.BUSINESS); - - if (!validation.valid) { - throw new EInvoiceValidationError( - 'Invoice validation failed', - validation.errors - ); - } - - return einvoice; - } catch (error) { - if (error instanceof EInvoiceValidationError) { - console.error('Validation Report:', error.getValidationReport()); - } - throw error; - } -} -``` - -### 4. Update your tests - -Update test imports and class names: - -**Before:** -```typescript -import { XInvoice } from '@fin.cx/xinvoice'; -import { expect } from '@push.rocks/tapbundle'; - -test('should create invoice', async () => { - const invoice = new XInvoice(); - expect(invoice).toBeInstanceOf(XInvoice); -}); -``` - -**After:** -```typescript -import { EInvoice } from '@fin.cx/einvoice'; -import { expect } from '@push.rocks/tapbundle'; - -test('should create invoice', async () => { - const invoice = new EInvoice(); - expect(invoice).toBeInstanceOf(EInvoice); -}); -``` - -## Compatibility - -### Unchanged APIs - -The following APIs remain unchanged: -- All method signatures on the main class -- All validation levels and invoice formats -- All export formats -- The structure of validation results -- PDF handling capabilities - -### Deprecated Features - -None. This is a pure rebranding release with enhanced error handling. - -## Need Help? - -If you encounter any issues during migration: - -1. Check the [changelog](./changelog.md) for detailed changes -2. Review the updated [documentation](./readme.md) -3. Report issues at [GitHub Issues](https://github.com/fin-cx/einvoice/issues) - -## Why the Name Change? - -- **EInvoice** (electronic invoice) is more universally recognized -- Better represents support for multiple international standards -- Aligns with industry terminology (e-invoicing, e-invoice) -- More intuitive for new users discovering the library \ No newline at end of file diff --git a/changelog.md b/changelog.md index ee439a2..78c0f94 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Changelog +## 2025-08-11 - 5.1.1 - fix(build/publishing) +Remove migration guide and update publishing and schematron download configurations + +- Deleted MIGRATION.md as migration instructions are no longer needed in v5.x +- Updated .claude/settings.local.json to include new permission settings +- Changed import in ts_install/download-schematron.ts to use 'dist_ts' instead of 'ts' +- Added tspublish.json files in both ts and ts_install with an explicit order configuration +- Refined publishing configuration (ts/tspublish.json) to align with new build process + ## 2025-01-11 - 5.1.0 - feat(compliance) Achieve 100% EN16931 compliance with comprehensive validation support diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index bb744cd..63f5587 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@fin.cx/einvoice', - version: '5.0.0', + version: '5.1.1', description: 'A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.' } diff --git a/ts/tspublish.json b/ts/tspublish.json new file mode 100644 index 0000000..5a46852 --- /dev/null +++ b/ts/tspublish.json @@ -0,0 +1,3 @@ +{ + "order": 1 +} \ No newline at end of file diff --git a/ts_install/download-schematron.ts b/ts_install/download-schematron.ts index dd821f4..a44cf38 100644 --- a/ts_install/download-schematron.ts +++ b/ts_install/download-schematron.ts @@ -4,7 +4,7 @@ * Script to download official Schematron files for e-invoice validation */ -import { SchematronDownloader } from '../ts/formats/validation/schematron.downloader.js'; +import { SchematronDownloader } from '../dist_ts/formats/validation/schematron.downloader.js'; async function main() { console.log('📥 Starting Schematron download...\n'); diff --git a/ts_install/tspublish.json b/ts_install/tspublish.json new file mode 100644 index 0000000..5a46852 --- /dev/null +++ b/ts_install/tspublish.json @@ -0,0 +1,3 @@ +{ + "order": 1 +} \ No newline at end of file