Scan your whole stack
From OX Research Newsroom
Are you using @einvoice-ts/validator?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.5.1
@einvoice-ts/validator was last scanned on 29 Nov 2026 at version 0.5.1. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.5.1 LATEST | 29 Nov 2026 | No rules fired |
| 0.5.0 | 29 Nov 2026 | No rules fired |
| 0.4.1 | 29 Nov 2026 | No rules fired |
| 0.4.0 | 29 Nov 2026 | Not shown |
| 0.0.0-stage | 29 Nov 2026 | Not shown |
Findings for v0.5.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.5.1; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Rule engine, rule() / defineRuleset() extension API and the en16931Ruleset,
peppolRuleset, dkRuleset, esFaceRuleset and esFaceLenientRuleset constants (EN 16931,
Peppol BIS Billing 3.0, the Danish national rules and CIUS-ES-FACE 1.0.0), composed as a list, for
validating invoices and credit notes. Depends only on
@einvoice-ts/core; validating an in-memory model never pulls in an XML parser.
Every active rule of the EN 16931 and Peppol BIS Billing 3.0.22 Schematron files is implemented,
here or in the parser's structural tables, and so are the Danish national rules. The German, Greek,
Icelandic, Italian, Dutch, Norwegian and Swedish national rules of the release are not implemented
yet; test/coverage-gate.test.ts reports them. CIUS-ES-FACE 1.0.0, the CIUS for invoices sent to
Spanish public administrations through FACe, has no Schematron: its ES-FACE-R* rules are written
from the CIUS document.
Part of einvoice-ts. Guide: rulesets and extensions.
pnpm add @einvoice-ts/validator
import {
assertValid,
dkRuleset,
en16931Ruleset,
esFaceLenientRuleset,
esFaceRuleset,
peppolRuleset,
validate,
} from '@einvoice-ts/validator';
const result = validate(parsed.document); // resolves the composition from cbc:CustomizationID
if (result.ok) {
result.document; // Invoice | CreditNote, narrowed by what you passed in
} else {
result.fatal.map((issue) => `${issue.id} at ${issue.xpath}: ${issue.message}`);
}
validate(parsed.document, { ruleset: [en16931Ruleset, peppolRuleset] }); // EN 16931 + Peppol
validate(parsed.document, { ruleset: [en16931Ruleset, peppolRuleset, dkRuleset] }); // + Danish rules
validate(parsed.document, { ruleset: [en16931Ruleset, esFaceRuleset, esFaceLenientRuleset] }); // FACe, lenient BT-10
const invoice = assertValid(parsed.document); // throws ValidationError instead
Every issue carries the rule id, its verbatim specification message, severity, business terms,
documentation URL, family, the refined model path and XPath, the Schematron context path and
XPath, and which ruleset constant defined the rule (definedBy). result.ruleset names the
composition that ran (ids and versions, in list order). A rule that throws is reported as one fatal
EINV-RULE-ERROR issue; a run always completes.
A ruleset is an exported constant; callers compose constants explicitly, as an ordered list
of layers: later entries modify earlier ones, as in an ESLint flat config or Object.assign.
There is no inheritance: a constant that builds on another declares it in requires, which
means "must appear earlier in the list". A composition missing a requirement, or listing it
after the constant that needs it ([peppolRuleset, en16931Ruleset]), throws a RulesetError.
| Constant | Id | Requires | Contents |
|---|---|---|---|
en16931Ruleset |
en16931 |
- | BR-* and the bespoke UBL-SR/UBL-DT/UBL-CR rules |
peppolRuleset |
peppol |
en16931Ruleset |
PEPPOL-EN16931-R/CL/P/F, R008 and PEPPOL-COMMON |
dkRuleset |
dk |
peppolRuleset |
DK-R-*, gated on a Danish supplier address ($DKSupplierCountry = 'DK') |
esFaceRuleset |
es-face |
en16931Ruleset |
ES-FACE-R*: type codes, attachments, DIR3 units in BT-10, FacturaE lengths and decimals |
esFaceLenientRuleset |
es-face-lenient |
esFaceRuleset |
disables ES-FACE-R007, the closing \| of the last DIR3 unit |
All carry spec: { cen: '1.3.16', cenTests: '1.3.16', peppol: '3.0.22', release: '2026-10' }
(esFaceRuleset adds ciusEsFace: '1.0.0'):
the rules come from the EN 16931 Schematron embedded in the pinned Peppol 3.0.22 release (which
declares itself 1.3.16 and is what Peppol validators run); the CEN repository tag
validation-1.3.16 supplies the unit-test corpus only. The table-driven UBL-CR/UBL-SR/UBL-DT
rules are reported by @einvoice-ts/parser from its structural tables, not by this package.
Defaults. Without a ruleset option, validate() resolves the composition from the
document's cbc:CustomizationID:
cbc:CustomizationID |
Composition |
|---|---|
urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0, or an id starting with it (a suffixed Peppol CIUS) |
[en16931Ruleset, peppolRuleset] |
urn:cen.eu:en16931:2017#compliant#urn:face.gob.es:CIUS-ES-FACE:1.0.0 (CIUS_ES_FACE_CUSTOMIZATION_ID), exactly |
[en16931Ruleset, esFaceRuleset] |
anything else: missing, unknown, the plain urn:cen.eu:en16931:2017, another CIUS (urn:cen.eu:en16931:2017#compliant#urn:xoev-de:...) |
[en16931Ruleset] |
Peppol rules run only when a document declares Peppol, so a non-Peppol EN 16931 invoice gets no
PEPPOL-EN16931-R004 noise; a missing id still gets its BR-01. Only the Peppol and
CIUS-ES-FACE registrations are built in; registerRuleset() maps any other customization id, the CEN one included, to a
composition of your choice; resolveDocumentRuleset(document, { ruleset }) returns the
composition validate() runs for a document. A composition is compiled left to right, cached per list (by member
identity) and frozen; rules evaluate in list order, then rule order within each constant, so
result.issues follows the list too.
National rules are opt-in. The official Peppol validator applies the national rules
automatically, by supplier country. This package never puts a national ruleset in a default
composition: without dkRuleset in the list, validate() can accept an invoice from a Danish
supplier that official Peppol validation rejects. Add dkRuleset to match it.
A company's rules are another constant, composed the same way:
import {
defineRuleset,
en16931Ruleset,
peppolRuleset,
registerRuleset,
rule,
validate,
} from '@einvoice-ts/validator';
const acme = defineRuleset({
id: 'acme',
version: '1.0.0',
requires: [peppolRuleset],
rules: [
rule.custom('ACME-R-001', {
at: 'document',
message: 'A purchase order reference is required.',
severity: 'fatal',
test: (document) => document.orderReference?.id !== undefined,
}),
],
disable: ['PEPPOL-EN16931-R003'],
override: { 'BR-52': { severity: 'warning' } },
normalize: (document) => ({ ...document, profileId: document.profileId ?? '...' }),
});
validate(invoice, { ruleset: [en16931Ruleset, peppolRuleset, acme] });
// Or make documents with a suffixed customization id resolve to it:
registerRuleset({
customizationId:
'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0#acme',
ruleset: [en16931Ruleset, peppolRuleset, acme],
});
Each layer is applied in turn: its rules are added (a constant's when gate is AND-ed into
each of them), then its disable removes rules defined earlier in the list, then its
override patches rules defined earlier. The rules of later entries are not there yet, so a
disable or override that matches nothing earlier throws; so does an empty list, or the same
constant listed twice. A rule id already defined earlier is a RulesetError unless the constant
lists it in override, in which case its own rule replaces the earlier one in the earlier
one's position, gated by the earlier gate AND its own when. When two constants patch the same
field of a rule, the later one wins. A disable cannot be undone later in the list: a later
override of a disabled rule throws as naming nothing, and a later constant defining the same
rule id again throws too (to replace a rule, list it in override instead of disabling it).
Structural ids. Every composition sits on a base layer: the structural rules of the UBL
syntax binding (UBL-CR-*, UBL-SR-*, UBL-DT-*), most of which @einvoice-ts/parser reports.
disable matches their ids as it matches earlier rules (disable: ['UBL-CR-*'] compiles, and a
typo such as UBL-CR-9999 still throws), and override may change their severity and
message; test, when or context on a structural rule the parser checks throws. The
resolved configuration is compileRulesets(list).applyStructural(issue), which the umbrella's
validateXml() applies to the parser diagnostics it merges; validate() reports none. The
library's own EINV- ids (EINV-XML-*, EINV-XSD-LEXICAL, EINV-RULE-ERROR) report data it
could not read or check: a disable or override entry that can match one, 'EINV-*' and
'*' included, throws.
Patches apply unconditionally, whatever
the patching constant's when, and never remove a gate: override.when replaces only the
rule's own when, never the gate of the constant that defined it, so overriding DK-R-002 with
{ when: () => true }, or replacing it with a rule of your own, still reports it for Danish
suppliers only.
rule(id, definition) builds a specification rule: severity, message, family, business terms and
documentation URL come verbatim from the generated spec table, and an unknown id throws when the
module loads. rule.custom(id, definition) takes the metadata inline and refuses specification
ids and ids starting with EINV-, which the library reserves. A definition is anchored at a
DocumentPaths key (at) or selects its nodes through a DocumentView (context); its test
receives the node, the RuleContext (decimal helpers, $profile, every country variant of the
Schematron, code lists, identifier checks) and the hit.
MIT. Some generated files reproduce specification text from OpenPeppol, CEN (EUPL-1.2) and OASIS; see NOTICE.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.