Minor release across all packages — observability, error-guard robustness, and a higher-fidelity test double. No breaking changes.
Highlights
- Opt-in request tracing. Set
debugon any provider config to receive metadata-only trace events (provider/method/url/status/durationMs/error) for each HTTP call. Every adapter routes its fetch through the new coretracedFetch— a zero-overhead passthrough whendebugis unset. Request/response bodies are never logged (encrypted on the wire for ezPay/ECPay, potentially PII for the others; wrap thefetchoverride to capture those). isInvoiceErroris now brand-based. It checks a globally-registeredSymbol.forbrand instead ofinstanceof, so it still narrows correctly when two copies of the package are loaded (dual ESM/CJS, transitive version skew).- Higher-fidelity
MockProvider. Configurablecapabilities(a non-TWDcurrencyis rejected withUNSUPPORTEDwhenFOREIGN_CURRENCYis omitted, matching a real domestic adapter), a tighter state machine (allowanceon a voided invoice →CONFLICT;voidAllowancechecks the allowance exists →NOT_FOUND), validation through the sharedparseInput, andfailNext(error)to inject a one-shot failure for exercising error paths.
New exports (@paid-tw/einvoice)
tracedFetch, InvoiceDebugEvent, InvoiceDebugLogger; MockProviderOptions.capabilities and MockProvider#failNext; debug on BaseProviderConfig.
Versions
| Package | Version |
|---|---|
@paid-tw/einvoice |
0.4.0 |
@paid-tw/einvoice-amego |
0.4.0 |
@paid-tw/einvoice-ecpay |
0.4.0 |
@paid-tw/einvoice-ezpay |
0.4.0 |
@paid-tw/einvoice-ezpay-crossborder |
0.2.0 |
@paid-tw/einvoice-ezreceipt |
0.2.0 |