Skip to content

Documentation / @facturometro/einvoice / registerRuleset

Function: registerRuleset() ​

registerRuleset(registration): void

Defined in: packages/validator/src/rulesets/registry.ts:72

Registers a composition for a customization id, so that documents carrying it resolve to it.

The composition is compiled on registration, so a broken one fails here rather than on the first document.

Parameters ​

registration ​

RulesetRegistration

The customization id, the composition and whether to match by prefix.

Returns ​

void

Throws ​

When the customization id is already registered, or when the composition does not compile.

Example ​

ts
import { en16931Ruleset, peppolRuleset, registerRuleset } from '@facturometro/validator';

registerRuleset({
  customizationId: 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0#acme',
  ruleset: [en16931Ruleset, peppolRuleset, acme],
});

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.