/** * decide/evaluator -- Prisma-style filter evaluator for decision rules. * * Pure function. Takes a WhereFilter, a value getter, and a redaction checker. * Evaluates each condition, records the result, returns matched/conditions. * * All keys in the filter are ANDed (all must match for the rule to match). * Decoupled from ScopeFacade — receives callbacks, not scope. */ import type { FilterCondition, WhereFilter } from './types.js'; /** * Evaluates a Prisma-style filter against scope values. * * ## Empty filter → NO match (anti-vacuous-truth — inverts Prisma/SQL) * * A filter with no evaluable conditions (`{}`, or only denied/non-object * keys) returns `matched: false`. This deliberately INVERTS the Prisma/SQL * intuition where `where: {}` matches everything: in a decision rule, a rule * that asserts nothing should never win a branch — "all zero conditions * passed" is vacuous truth, and silently routing on it would fabricate * decision evidence. Want a catch-all? Use the explicit `defaultBranch` * argument of `decide()` instead of an empty `when`. * * ## Unknown operators → condition fails (+ dev-mode warning) * * An operator outside the supported set (`eq, ne, gt, gte, lt, lte, in, * notIn`) records a failed condition — the rule can never spuriously match * through a typo (`gte` misspelled `gle`). With dev mode enabled * (`enableDevMode()`), a console warning names the unknown operator and key. * * @param getValueFn - Reads a value from scope by key (raw, for comparison) * @param isRedactedFn - Checks if a key is redacted (for evidence display) * @param filter - The WhereFilter to evaluate * @returns { matched, conditions } — matched = all conditions passed */ export declare function evaluateFilter(getValueFn: (key: string) => unknown, isRedactedFn: (key: string) => boolean, filter: WhereFilter): { matched: boolean; conditions: FilterCondition[]; };