Initial Commit
This commit is contained in:
59
openspec/archive/2026-04-19-enterprise-barcode/proposal.md
Normal file
59
openspec/archive/2026-04-19-enterprise-barcode/proposal.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# OpenSpec Change: enterprise-barcode
|
||||
|
||||
- **Change ID**: enterprise-barcode
|
||||
- **Package**: `@suaveplan/barcode`
|
||||
- **Category**: universal
|
||||
- **Target path**: `universal/media/barcode`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-19
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/barcode.md`
|
||||
|
||||
## Summary
|
||||
|
||||
Greenfield rebuild of `@suaveplan/barcode` — dependency-free barcode generator and reader with support for Code 39, Code 93, Code 128, ITF, EAN-13, UPC-A, Data Matrix, PDF417. Pure-TS encoders/decoders; no native bindings. Ships a `BarcodeGenerator`, `readBarcode`, and `generateBatch`.
|
||||
|
||||
## Current-state audit (genesis)
|
||||
|
||||
Package does not exist yet — fresh build.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Workspace: `@suaveplan/error`, `@suaveplan/types`
|
||||
- External (via catalog): `zod`, `tslib`, `@opentelemetry/api`
|
||||
- Dev (via catalog): `vitest`, `@vitest/coverage-istanbul`, `fast-check`, `mitata`
|
||||
|
||||
## Preserved public surface
|
||||
|
||||
### Generator / reader
|
||||
|
||||
- `BarcodeGenerator`, `calculateEan13CheckDigit`, `calculateUpcaCheckDigit`
|
||||
- `readBarcode`, `ReadResult`
|
||||
- `generateBatch`, `BatchItem`, `BatchItemResult`, `BatchOptions`, `BatchResult`
|
||||
|
||||
### Formats
|
||||
|
||||
- Code 93: `encodeCode93`, `validateCode93`
|
||||
- Data Matrix: `encodeDataMatrix`, `validateDataMatrix`, `DataMatrixOptions`, `DataMatrixResult`
|
||||
- ITF: `calculateItfCheckDigit`, `encodeItf`, `validateItf`
|
||||
- PDF417: `encodePdf417`, `validatePdf417`, `Pdf417Options`, `Pdf417Result`
|
||||
|
||||
### Errors
|
||||
|
||||
- `BarcodeError`, `BarcodeErrorCode`, `BarcodeErrorContext`, `BARCODE_ERROR_METADATA`, `registerBarcodeErrorCodes`
|
||||
- `checksumFailed`, `decodeFailed`, `encodeFailed`, `imageInvalid`, `invalidData`, `invalidFormat`, `unsupportedCharacter`
|
||||
|
||||
### Types / constants
|
||||
|
||||
`BarcodeFormat`, `BarcodeOptions`, `BarcodeResult`, `CODE39_CHARS`, `DEFAULT_BARCODE_OPTIONS`, `VALID_FORMATS`.
|
||||
|
||||
## New genesis additions
|
||||
|
||||
- Extend code registry with `BARCODE.BATCH_PARTIAL` for partial batch failures.
|
||||
- Zod schemas for every option type.
|
||||
- OTel counter `barcode.encode.total{format, outcome}`, `barcode.decode.total{format, outcome}`; histograms for durations.
|
||||
- Property tests: `readBarcode(BarcodeGenerator.generate(x)) === x` for every format on valid payloads.
|
||||
|
||||
## Impact
|
||||
|
||||
- Adds one new package: `universal/media/barcode`
|
||||
- Adds one new spec capability: `barcode`
|
||||
Reference in New Issue
Block a user