@pawel-up/jexl
Version:
Javascript Expression Language: Powerful context-based expression parser and evaluator
60 lines • 1.76 kB
TypeScript
import type { Grammar, ASTNode } from './grammar.js';
export declare enum ValidationSeverity {
ERROR = "error",
WARNING = "warning",
INFO = "info"
}
export interface ValidationIssue {
severity: ValidationSeverity;
message: string;
startPosition?: number;
endPosition?: number;
line?: number;
column?: number;
token?: string;
code?: string;
}
export interface ValidationOptions {
allowUndefinedContext?: boolean;
includeInfo?: boolean;
includeWarnings?: boolean;
maxDepth?: number;
maxLength?: number;
customFunctions?: string[];
customTransforms?: string[];
}
export interface ValidationResult {
valid: boolean;
issues: ValidationIssue[];
errors: ValidationIssue[];
warnings: ValidationIssue[];
info: ValidationIssue[];
ast?: ASTNode;
}
export declare class Validator {
private _grammar;
private _lexer;
constructor(grammar: Grammar);
validate(expression: string, context?: Record<string, unknown>, options?: ValidationOptions): ValidationResult;
isValid(expression: string): boolean;
getFirstError(expression: string): ValidationIssue | null;
private _validateLexical;
private _validateSyntax;
private _validateSemantics;
private _validateASTNode;
private _validateFunction;
private _validateBinaryExpression;
private _validateUnaryExpression;
private _validateContext;
private _validateContextPath;
private _performWarningAnalysis;
private _performInfoAnalysis;
private _getDefaultOptions;
private _createResult;
private _hasErrors;
private _findTokenPosition;
private _getLineColumn;
private _countNodes;
}
export default Validator;
//# sourceMappingURL=Validator.d.ts.map