Skip to content

Documentation / @einvoice-ts/validator / resolveRuleset

Function: resolveRuleset() ​

resolveRuleset(options): RulesetComposition

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

Resolves the composition for a document: explicit option, exact customization id, longest registered prefix with matchPrefix, else [en16931Ruleset].

Parameters ​

options ​

The explicit composition and/or the document's normalized customization id.

customizationId? ​

string

normalize-space(cbc:CustomizationID), when present.

ruleset? ​

RulesetComposition

A composition chosen by the caller; always wins.

Returns ​

RulesetComposition

The composition to run.

Example ​

ts
import { CIUS_ES_FACE_CUSTOMIZATION_ID, PEPPOL_BIS_BILLING_3_CUSTOMIZATION_ID } from '@einvoice-ts/core';
import { resolveRuleset } from '@einvoice-ts/validator';

resolveRuleset({ customizationId: PEPPOL_BIS_BILLING_3_CUSTOMIZATION_ID }).map((ruleset) => ruleset.id); // ['en16931', 'peppol']
resolveRuleset({ customizationId: CIUS_ES_FACE_CUSTOMIZATION_ID }).map((ruleset) => ruleset.id); // ['en16931', 'es-face']
resolveRuleset({ customizationId: 'urn:cen.eu:en16931:2017' }).map((ruleset) => ruleset.id); // ['en16931']
resolveRuleset({}).map((ruleset) => ruleset.id); // ['en16931']

MIT licensed. Specification material belongs to OpenPeppol, CEN and OASIS (see NOTICE). Peppol is a trademark of OpenPeppol AISBL; this project is not affiliated with it.