Interfaces
@system-inc/base-foundation · 515c140 · 6 symbols
IsPhoneNumberOptions
Members
allowExtensions?:booleanAllow trailing extensions like
x123,ext. 123,#123. Default:true.region?:PhoneRegion | PhoneRegion[]Which formats to accept. Default:
['e164', 'nanp'].
OptionsRuleDecorator
A decorator factory for an options-bearing validation rule.
.check(value, options) runs the same predicate the decorator
would apply, for direct use outside of a class field.
Members
check(value:unknown,options:TOptions):boolean
PublicRuleMetadata
Public view of a single registered rule. Deliberately omits the
raw check and message functions — those are framework
internals. Consumers (e.g. CLI schema metadata emission) only need
the rule name, property, options, and shape.
Members
operatesOn:"array" | "value"options:unknownpropertyName:stringruleName:string
RuleDefinition
Definition a rule author provides to registerRule.
Members
check:(value: unknown, options: TOptions, context: ValidationContext<TOptions>) => RuleCheckResultThe validation predicate. Return
trueto pass,falseto fail with the default message, or astringto fail with a custom message.defaultMessage:string | (context: ValidationContext<TOptions>) => stringDefault human-readable message. Can be a literal string (use
$propertyto interpolate the property name) or a function receiving the validation context.name:stringRule name surfaced in
ValidationError.constraints(e.g."IsString","MaxLength"). Conventionally matches the decorator's function name minus theVerifyprefix.operatesOn?:"array" | "value"How the rule handles arrays.
-
"value"(default) — value-level rule. When the decorated property holds an array, the engine appliescheckto each element. Error paths include the index (items[2]). Use this for rules likeIsString,IsEmail,MaxLength. -
"array"— array-level rule. The engine passes the array through tocheckwithout iterating. Use this for rules that describe the array itself, e.g.IsArray,ArrayMinSize,ArrayNotEmpty.
-
ValidationError
A single validation failure at a specific location within the validated value.
Errors are flat — each entry identifies the exact path (property or
array index chain) where one or more rules rejected the value.
Multiple failed rules on the same path are merged into constraints
under their rule names.
Members
constraints:Readonly<Record<string, string>>Map of failed rule name → human-readable message.
Multiple entries mean multiple rules on the same property failed.
path:stringDotted / bracketed path to the failing value from the root.
Examples:
"email"— top-level property"address.postalCode"— nested property"items[2].sku"— array element, nested property
value:unknownThe value that failed validation. Kept for error rendering; may be
undefinedif the property was missing.
VoidRuleDecorator
A decorator factory for a no-options validation rule. Callable to
attach the rule; exposes a .check(value) predicate for ad-hoc
use outside of a decorator context (services, VerifyIf conditions,
unit tests).
Members
check(value:unknown):boolean