import type { Row } from '../types.ts'; export type Predicate = (record: Row) => boolean; export { CriteriaSyntaxError, type CriteriaToken, parseGenesisDateTime, tokenizeCriteria, UnsupportedCriteriaError, } from './criteriaTokens.ts'; /** * How {@link compileCriteria} and {@link filterByCriteria} read a criteria. * Without options they evaluate it as GSF 8.15 does, each field read by its * value. * @public */ export interface CriteriaOptions { /** * Each field's Genesis type (`STRING`, `DATETIME`, ...), where it is * declared: GSF compiles a criteria against these, which picks each * function's overload (a `DATETIME` is a Joda DateTime, a `STRING` a * String). */ types?: ReadonlyMap; /** * `fidelity: 'legacy'`: evaluate the criteria as this engine did up to * 15.47 — its comparisons, its function semantics (inclusive * `dateTimeIsAfter`, `false` instead of an exception, dates read by * `Date.parse` too), its `AND`/`OR`/`NOT` dialect — plus the GSF functions * it didn't have. `types` is ignored. */ lenient?: boolean; } export interface ParsedCriteria { predicate: Predicate; fields: string[]; } export declare function parseCriteria(criteria?: string | null, options?: CriteriaOptions): ParsedCriteria; /** Compiles a CRITERIA_MATCH string into a predicate function(record) => boolean. */ export declare function compileCriteria(criteria?: string | null, options?: CriteriaOptions): Predicate; export declare function criteriaFields(criteria?: string | null): string[] | undefined; export declare function filterByCriteria(rows: Row[], criteria?: string | null, options?: CriteriaOptions): Row[]; export declare function compileFailureText(criteria: string, fields: Iterable, types?: ReadonlyMap): string; export declare function criteriaCompileRefusal(criteria: string, types?: ReadonlyMap): string | undefined;