Interfaces

@system-inc/base-foundation · 515c140 · 6 symbols

Members

  • allowExtensions?: boolean

    Allow trailing extensions like x123, ext. 123, #123. Default: true.

  • region?: PhoneRegion | PhoneRegion[]

    Which formats to accept. Default: ['e164', 'nanp'].

View source ↗

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

View source ↗

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: unknown

  • propertyName: string

  • ruleName: string

View source ↗

Definition a rule author provides to registerRule.

Members

  • check: (value: unknown, options: TOptions, context: ValidationContext<TOptions>) => RuleCheckResult

    The validation predicate. Return true to pass, false to fail with the default message, or a string to fail with a custom message.

  • defaultMessage: string | (context: ValidationContext<TOptions>) => string

    Default human-readable message. Can be a literal string (use $property to interpolate the property name) or a function receiving the validation context.

  • name: string

    Rule name surfaced in ValidationError.constraints (e.g. "IsString", "MaxLength"). Conventionally matches the decorator's function name minus the Verify prefix.

  • operatesOn?: "array" | "value"

    How the rule handles arrays.

    • "value" (default) — value-level rule. When the decorated property holds an array, the engine applies check to each element. Error paths include the index (items[2]). Use this for rules like IsString, IsEmail, MaxLength.

    • "array" — array-level rule. The engine passes the array through to check without iterating. Use this for rules that describe the array itself, e.g. IsArray, ArrayMinSize, ArrayNotEmpty.

View source ↗

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: string

    Dotted / 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: unknown

    The value that failed validation. Kept for error rendering; may be undefined if the property was missing.

View source ↗

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

View source ↗

Interfaces • Documentation • Base