@nhtio/lucid-resourceful/joi
A modified version of the joi validation library which adds support for new custom schemas
Re-exports @nhtio/validation, including its encode()/decode() schema codec. Since validation 2.20261116.0, decode() throws on schemas that contain disallowed functions (.custom() rules, database rules) instead of silently replacing them with no-ops. Opt in with { allowSchemaFunctions: true } (or { allowFunctions: true }) only for schemas from your own authenticated Lucid Resourceful routes, such as a $meta.create/$meta.updatejoiSchema your own server just encoded. Rehydrated functions are rebuilt from the payload text with the Function constructor, so never opt in for user-controlled input. { onDisallowedFunction: 'silent' } restores the old replacement behaviour and changes validation results.
Namespaces
| Namespace | Description |
|---|---|
| address | - |
| formula | - |
| guards | - |
| location | - |
Interfaces
| Interface | Description |
|---|---|
| AddRuleOptions | - |
| AlternativesSchema | Schema type for alternatives validation. |
| AnySchema | Base schema type for all validation schemas. |
| ArraySchema | Schema type for array validation. |
| ArraySortOptions | - |
| ArrayUniqueOptions | - |
| AsyncValidationOptions | - |
| Base64Options | - |
| BaseValidationOptions | - |
| BigIntSchema | Schema type for BigInt validation with comprehensive comparison operations. |
| BinarySchema | Schema type for binary data validation. |
| BooleanSchema | Schema type for boolean validation. |
| Cache | - |
| CacheConfiguration | - |
| CacheProvisionOptions | - |
| CoerceObject | - |
| CoerceResult | - |
| CompileOptions | - |
| Context | - |
| CreateErrorOptions | - |
| CustomHelpers | - |
| DatabaseQueryBuilderContract | Database query builder exposes the API to construct SQL query using fluent chainable API |
| DataUriOptions | - |
| DateSchema | Schema type for date validation. |
| DatetimeSchema | Schema for datetime validation with comprehensive formatting and comparison methods. |
| DbValidationOptions | Options for database-backed validation helpers such as uniqueInDb and existsInDb. |
| DecodeBudget | An opaque, shared inflation budget created by createDecodeBudget(). Limits and byte usage are read-only; depth remains per decode() call and array-length limits remain per value. |
| DecodeLimits | Resource limits for decoding. Positive numbers or Infinity (explicit opt-out). |
| DependencyOptions | - |
| Description | - |
| DomainOptions | - |
| EmailOptions | - |
| Err | - |
| ErrorFormattingOptions | - |
| ErrorReport | - |
| ErrorValidationOptions | - |
| Extension | - |
| ExtensionFlag | - |
| ExtensionRule | - |
| ExtensionTerm | - |
| ExtensionTermManifest | - |
| ExternalHelpers | - |
| FunctionSchema | Schema type for function validation. |
| GetRuleOptions | - |
| GuidOptions | - |
| HexOptions | - |
| HierarchySeparatorOptions | - |
| I18nCallback | Callback function type for internationalization translation. |
| IpOptions | - |
| IsSchemaOptions | - |
| KnexConnectionConfigurations | - |
| LanguageMessageTemplate | - |
| LinkSchema | Schema type for link validation. |
| ModifyOptions | - |
| MutateRegisterOptions | - |
| NumberSchema | Schema type for number validation. |
| ObjectPatternOptions | - |
| ObjectSchema | Schema type for object validation. |
| PhoneSchema | Phone number validation schema interface extending AnySchema. Provides methods for validating and formatting phone numbers with various constraints. |
| QueryClientContract | Shape of the query client, that is used to retrieve instances of query builder |
| Reference | - |
| ReferenceOptions | - |
| RenameOptions | - |
| Root | - |
| RuleArgs | - |
| RuleOptions | - |
| SchemaInternals | - |
| SetFlagOptions | - |
| SetI18nCallback | Callback function type for setting up internationalization. |
| State | - |
| StringRegexOptions | - |
| StringSchema | Schema type for string validation. |
| SwitchCases | - |
| SwitchDefault | - |
| SymbolSchema | Schema type for symbol validation. |
| TopLevelDomainOptions | - |
| UriOptions | - |
| ValidationContext | - |
| ValidationError | - |
| ValidationErrorItem | - |
| ValidationOptions | - |
| ValidationRoot | Extended Joi root interface that includes custom schema types for additional validation scenarios. |
| ValidationWarning | - |
| WhenOptions | - |
| WhenSchemaOptions | - |
Type Aliases
Variables
| Variable | Description |
|---|---|
| createDecodeBudget | Creates an opaque budget sharing total inflated bytes across decode() calls. Limits are merged with DEFAULT_DECODE_LIMITS and must be positive finite numbers or Infinity; invalid values throw TypeError. Depth remains per call and array-length caps remain per value. Diagnostics are read-only. |
| decode | Decodes a base64-encoded schema string back into a usable validation schema. |
| DEFAULT_DECODE_LIMITS | Safe defaults for decoding untrusted input. |
| encode | Encodes a validation schema into a compressed, base64-encoded string for transport between environments. |
| PhoneTypes | The 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. |
| tlds | - |
| ValidationError | Represents 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 | - |
| version | The current version of the package. |
Functions
| Function | Description |
|---|---|
| location | Returns the filename and line number of the caller in the call stack |
References
joi
Renames and re-exports validator