@accounter/shaam6111-generator
Version:
Fully typed application that generates, parses, and validates SHAAM 6111 tax reports.
156 lines (111 loc) โข 3.87 kB
Markdown
# โ
SHAAM 6111 Package โ Development Checklist
A structured, test-driven checklist for building a Node.js/TypeScript package to generate, parse,
and validate Israeli SHAAM 6111 tax reports.
---
## ๐ Phase 1: Project Setup & Types
- [x] Initialize TypeScript project with `tsconfig.json` and `package.json`
- [x] Add and configure Vitest for testing
- [x] Set up folder structure:
- `src/`
- `src/types/`
- `src/schemas/`
- `src/generators/`
- `src/parsers/`
- `src/utils/`
- `tests/fixtures/`
### ๐งพ Define Types
- [x] Define `ReportData` structure (with clear field names)
- [x] Define `HeaderRecord`, `SupplierRecord`, etc.
- [x] Define `ValidationError` interface
- [x] Define `ValidationResult` structure
- [x] Define custom error classes:
- [x] `ValidationError`
- [x] `ParsingError`
---
## ๐ Phase 2: Validation (Zod First)
### ๐งช Header Schema
- [x] Implement `headerSchema` using Zod
- [x] Add field-level validation (e.g., length, number format)
- [x] Write unit tests for `headerSchema`
- [x] Valid inputs
- [x] Invalid inputs
### โ
Data Validator
- [x] Implement `validateData()` using Zod schemas
- [x] Aggregate validation errors by field and record
- [x] Return `ValidationResult` object
- [x] Write unit and integration tests:
- [x] Single record validation
- [x] Multi-record validation
---
## ๐ค Phase 3: Encoding Utilities
- [x] Implement `toWindows1255(input: string): Buffer`
- [x] Implement `fromWindows1255(buffer: Buffer): string`
- [x] Use `iconv-lite` for encoding/decoding
- [x] Write unit tests:
- [x] Hebrew โ Windows-1255 โ Hebrew
- [x] English support
- [x] Special characters and edge cases
---
## ๐๏ธ Phase 4: Report Generation
### ๐งฑ Record Generators
- [x] Implement `generateHeaderRecord()`
- [x] Fixed-width formatting
- [x] Padding/truncating logic
- [x] Tests for output length and format
- [x] Implement generators for all other record types
- [x] Write tests for each record generator
### ๐งพ Full Report Generator
- [x] Implement `generateReport(data: ReportData): string`
- [x] Validate before generating
- [x] Assemble full file section-by-section
- [x] Write integration test for `generateReport()`
---
## ๐ Phase 5: Report Parsing
### ๐งฉ Record Parsers
- [x] Implement `parseHeaderRecord(line: string): HeaderRecord`
- [x] Fixed-width slicing and conversion
- [ ] Throw `ParsingError` on malformed input
- [x] Unit tests
- [x] Implement parsers for all other record types
- [x] Write unit tests for each parser
### ๐งพ Full Report Parser
- [x] Implement `parseReport(content: string): ReportData`
- [x] Detect and dispatch per-record type
- [x] Validate line counts and formats
- [x] Write integration tests:
- [x] Full string โ object
---
## ๐งช Phase 6: Report Validation
- [x] Implement `validateReport(content: string): ValidationResult`
- [x] Parse report
- [x] Validate parsed data
- [x] Aggregate and return results
- [x] Write tests for:
- [x] Valid file
- [x] Malformed file
- [x] Missing/extra fields
---
## ๐งท Phase 7: Fixtures and Roundtrip Testing
### ๐ Fixtures
- [x] Create fixture: `tests/fixtures/validReports/sample1.txt`
- [x] Create fixture: `tests/fixtures/invalidReports/sample1.txt`
### ๐ Roundtrip Tests
- [x] Write test:
- [x] Input โ generate โ parse โ expect deep equality
- [ ] Add encoding edge cases
- [ ] Add tests for:
- [ ] Extra/missing lines
- [ ] Field length overflows
- [ ] Invalid encodings
---
## ๐ฆ Finalization
- [x] Add README with usage examples
- [x] Add CLI or Node API interface (optional)
- [x] Lint and format code
- [x] Ensure 100% test coverage
- [x] Add GitHub Actions or CI pipeline
---
## ๐งน Polish and Publish
- [x] Run type checks and linter
- [ ] Tag initial release
- [ ] Publish to NPM