Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@einvoice-ts/validator

Latest version: v0.5.1

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: albertfdp
0 Stars
0 Forks
5 Versions
TypeScript Repo language

Scan summary

@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.

  • Releases: 5 versions, all published on 29 Nov 2026.
  • Findings: No rules fired in version 0.5.1.

Versions

5 versions published
Versions and the rules that fired in each
VersionPublishedStatus
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

No rules fired in 0.5.1

Findings

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.

README

The publisher’s own README, as collected from the registry.

@einvoice-ts/validator

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.

Install

pnpm add @einvoice-ts/validator

Usage

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.

Rulesets

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.

Extending

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.

License

MIT. Some generated files reproduce specification text from OpenPeppol, CEN (EUPL-1.2) and OASIS; see NOTICE.

OX Radar and Response Center

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.

Where it’s listed

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).

  • npm @einvoice-ts/validator

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229