Documentation / @facturometro/validator / 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 ​
import type { AtRuleDefinition } from '@facturometro/validator';
const definition: AtRuleDefinition<'legalMonetaryTotal'> = {
at: 'legalMonetaryTotal',
test: (total) => total.payableAmount !== undefined,
};Extends ​
RuleLogic<DocumentPaths[K]>
Type Parameters ​
K ​
K extends keyof DocumentPaths
Properties ​
at ​
readonlyat:K
Defined in: packages/validator/src/engine/rule.ts:159
The aggregate the rule applies to, as a DocumentPaths key.
context? ​
readonlyoptionalcontext?:undefined
Defined in: packages/validator/src/engine/rule.ts:161
Not used with at.
test ​
readonlytest: (node,ctx,hit) =>Verdict
Defined in: packages/validator/src/engine/rule.ts:116
Judges one selected node; see Rule.test.
Parameters ​
node ​
ctx ​
hit ​
Hit<DocumentPaths[K]>
Returns ​
Inherited from ​
RuleLogic.test
when? ​
readonlyoptionalwhen?: (ctx) =>boolean
Defined in: packages/validator/src/engine/rule.ts:118
Document-level gate, evaluated once; see Rule.when.
Parameters ​
ctx ​
Returns ​
boolean
Inherited from ​
RuleLogic.when