import { DateTime } from 'luxon'; import type { NodeType, SchemaRef, ParsedRule, NodeSubType, ErrorReporterConstructorContract } from '../types.js'; import { Request } from '@adonisjs/core/http'; /** * Ensure value is not `undefined` */ export declare function existsStrict(value: any): boolean; /** * Ensure that value exists. Empty string, null and undefined * fails the exists check. */ export declare function exists(value: any): boolean; /** * Ensure value is a valid Object. Returns false for `Array` and `null` */ export declare function isObject(value: any): boolean; /** * Enforces the value to be an array */ export declare function enforceArray(value: unknown, message?: string): asserts value is any[]; /** * Enforces the value to be an instance of luxon DateTime object */ export declare function enforceDateTime(value: any, message?: string): asserts value is DateTime; /** * Returns a boolean telling value is a schema ref */ export declare function isRef(value: any): value is SchemaRef; /** * Returns the field value for a given pointer. If pointer starts * with `/`, then it will be searched from the root of the * object, otherwise it's searched from the nearest tip */ export declare function getFieldValue(field: string, root: any, tip: any): any; /** * Resolves the field name in relation to the other field. If field name * starts with `/` it is returned as it is by removing `/`. Otherwise * the other field pointer is used to make the absolute name */ export declare function resolveAbsoluteName(field: string, otherField: string): string; /** * Validates to ensure that arguments passed to validations compile method * is an array */ export declare function ensureValidArgs(ruleName: string, args: any): asserts args is any[]; /** * Wraps the custom compile function to DRY the repetitive code inside every * validation rule. * * - It ensures that options received by the compile methods is a valid array. * - Validates for the restricted subtypes (if defined) * - Prepares a default set of parsedRules properties. * - Invokes the callback (if defined). */ export declare function wrapCompile(name: string, restrictForTypes?: SubType[], customCallback?: (options: any[], type: NodeType, subtype: SubType, rulesTree: any) => Partial>): (type: NodeType, subtype: SubType, options: T, rulesTree: any) => ParsedRule; /** * Returns the error reporter for the current HTTP request */ export declare function getRequestReporter(request: Request): ErrorReporterConstructorContract;