Skip to content

Documentation / @facturometro/einvoice / AtRuleDefinition

Interface: AtRuleDefinition<K> ​

Defined in: packages/validator/src/engine/rule.ts:155

A rule definition anchored at a DocumentPaths key: the common case of a Schematron context that is a plain element path. The node type follows from the key.

Example ​

ts
import type { AtRuleDefinition } from '@facturometro/validator';

const definition: AtRuleDefinition<'legalMonetaryTotal'> = {
  at: 'legalMonetaryTotal',
  test: (total) => total.payableAmount !== undefined,
};

Extends ​

Type Parameters ​

K ​

K extends keyof DocumentPaths

Properties ​

at ​

readonly at: K

Defined in: packages/validator/src/engine/rule.ts:159

The aggregate the rule applies to, as a DocumentPaths key.


context? ​

readonly optional context?: undefined

Defined in: packages/validator/src/engine/rule.ts:161

Not used with at.


test ​

readonly test: (node, ctx, hit) => Verdict

Defined in: packages/validator/src/engine/rule.ts:116

Judges one selected node; see Rule.test.

Parameters ​

node ​

DocumentPaths[K]

ctx ​

RuleContext

hit ​

Hit<DocumentPaths[K]>

Returns ​

Verdict

Inherited from ​

RuleLogic.test


when? ​

readonly optional when?: (ctx) => boolean

Defined in: packages/validator/src/engine/rule.ts:118

Document-level gate, evaluated once; see Rule.when.

Parameters ​

ctx ​

RuleContext

Returns ​

boolean

Inherited from ​

RuleLogic.when

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