Skip to content

@nhtio/validation

Namespaces

NamespaceDescription
addressValidate email address and domain. A local version of the @hapi/address package used to ensure matching versions.
formulaMath and string formula parser. A local version of the @hapi/formula package used to ensure matching versions.
guardsType Guards used throughout the package
locationReturn the filename and line number of the calling function. A local version of the @hapi/pinpoint package is used to ensure matching versions.

Interfaces

InterfaceDescription
AddRuleOptions-
AlternativesSchemaSchema type for alternatives validation.
AnySchemaBase schema type for all validation schemas.
ArraySchemaSchema type for array validation.
ArraySortOptions-
ArrayUniqueOptions-
AsyncValidationOptions-
Base64Options-
BaseValidationOptions-
BigIntSchemaSchema type for BigInt validation with comprehensive comparison operations.
BinarySchemaSchema type for binary data validation.
BooleanSchemaSchema type for boolean validation.
Cache-
CacheConfiguration-
CacheProvisionOptions-
CoerceObject-
CoerceResult-
CompileOptions-
Context-
CreateErrorOptions-
CustomHelpers-
DatabaseQueryBuilderContractDatabase query builder exposes the API to construct SQL query using fluent chainable API
DataUriOptions-
DateSchemaSchema type for date validation.
DatetimeSchemaSchema for datetime validation with comprehensive formatting and comparison methods.
DbValidationOptionsOptions for database-backed validation helpers such as uniqueInDb and existsInDb.
DependencyOptions-
Description-
DomainOptions-
EmailOptions-
Err-
ErrorFormattingOptions-
ErrorReport-
ErrorValidationOptions-
Extension-
ExtensionFlag-
ExtensionRule-
ExtensionTerm-
ExtensionTermManifest-
ExternalHelpers-
FunctionSchemaSchema type for function validation.
GetRuleOptions-
GuidOptions-
HexOptions-
HierarchySeparatorOptions-
I18nCallbackCallback function type for internationalization translation.
IpOptions-
IsSchemaOptions-
KnexConnectionConfigurations-
LanguageMessageTemplate-
LinkSchemaSchema type for link validation.
ModifyOptions-
MutateRegisterOptions-
NumberSchemaSchema type for number validation.
ObjectPatternOptions-
ObjectSchemaSchema type for object validation.
PhoneSchemaPhone number validation schema interface extending AnySchema. Provides methods for validating and formatting phone numbers with various constraints.
QueryClientContractShape of the query client, that is used to retrieve instances of query builder
Reference-
ReferenceOptions-
RenameOptions-
Root-
RuleArgs-
RuleOptions-
SchemaInternals-
SetFlagOptions-
SetI18nCallbackCallback function type for setting up internationalization.
State-
StringRegexOptions-
StringSchemaSchema type for string validation.
SwitchCases-
SwitchDefault-
SymbolSchemaSchema type for symbol validation.
TopLevelDomainOptions-
UriOptions-
ValidationContext-
ValidationError-
ValidationErrorItem-
ValidationOptions-
ValidationRootExtended Joi root interface that includes custom schema types for additional validation scenarios.
ValidationWarning-
WhenOptions-
WhenSchemaOptions-

Type Aliases

Type AliasDescription
BasicType-
CoerceFunction-
ComparatorFunction-
CountryRepresents the ISO 3166-1 alpha-2 country codes of all countries recognized by the library.
CountryOrUnknownRepresents either the ISO 3166-1 alpha-2 country codes of all countries recognized by the library or the string 'XX' to represent an unknown country.
CustomValidator-
DefaultableValue-
ExtensionBoundSchema-
ExtensionFactory-
ExternalValidationFunction-
GuidVersions-
IsNonPrimitiveSubsetUnion-
IsPrimitiveSubset-
IsUnion-
KnexConfig-
KnexInstance-
KnexQueryBuilder-
KnexSchemaConnection-
KnexTransaction-
LanguageMessages-
NoNestedArrays-
NullableType-
ObjectPropertiesSchema-
PartialSchemaMap-
PhoneTypesThe PhoneTypes type represents the possible types of a phone number. It can be any of the keys of the PhoneNumberType object in the google-libphonenumber library, or 'INVALID' if the phone number is not valid.
PhoneTypesThe PhoneTypes type represents the possible types of a phone number. It can be any of the keys of the PhoneNumberType object in the google-libphonenumber library, or 'INVALID' if the phone number is not valid.
PresenceMode-
Primitives-
QueryBuilder-
QueryClient-
RuleMethod-
SchemaA union type that includes all schema types.
SchemaFunction-
SchemaLike-
SchemaLikeWithoutArray-
SchemaMap-
StrictSchemaMap-
Types-
UnwrapSchemaLikeWithoutArray-
ValidationErrorFunction-
ValidationResult-

Variables

VariableDescription
tldsTLDS list for domain validation. A local version of the @hapi/tlds package is used to ensure matching versions.
ValidationErrorRepresents a validation error encountered during the validation of a payload. When using syncronous validation, this error is returned along an undefined value. When using asynchronous validation, this error is thrown.
validator-
versionThe current version of the package.

Functions

FunctionDescription
decodeDecodes a base64-encoded schema string back into a usable validation schema.
encodeEncodes a validation schema into a compressed, base64-encoded string for transport between environments.
locationReturn the filename and line number of the calling function. A local version of the @hapi/pinpoint package is used to ensure matching versions.