react-querybuilder
Version:
React Query Builder component for constructing queries and filters, with utilities for executing them in various database and evaluation contexts
22 lines (21 loc) • 642 B
text/typescript
import type { RuleType } from "./ruleGroups.mjs";
import type { RuleGroupTypeAny } from "./ruleGroupsIC.mjs";
/**
* Object with a `valid` boolean value and optional `reasons`.
*/
export interface ValidationResult {
valid: boolean;
reasons?: any[];
}
/**
* Map of rule/group `id` to its respective {@link ValidationResult}.
*/
export type ValidationMap = Record<string, boolean | ValidationResult>;
/**
* Function that validates a query.
*/
export type QueryValidator = (query: RuleGroupTypeAny) => boolean | ValidationMap;
/**
* Function that validates a rule.
*/
export type RuleValidator = (rule: RuleType) => boolean | ValidationResult;