import type { Condition, SimpleCondition } from '../../../zero-protocol/src/ast.ts'; import type { Row, Value } from '../../../zero-protocol/src/data.ts'; import type { PrimaryKey } from '../../../zero-protocol/src/primary-key.ts'; export type Constraint = { readonly [key: string]: Value; }; export declare function constraintMatchesRow(constraint: Constraint, row: Row): boolean; /** * Constraints are compatible if: * 1. They do not have any keys in common * 2. They have keys in common, but the values for those keys are equal */ export declare function constraintsAreCompatible(left: Constraint, right: Constraint): boolean; export declare function constraintMatchesPrimaryKey(constraint: Constraint, primary: PrimaryKey): boolean; /** * Pulls top level `and` components out of a condition tree. * The resulting array of simple conditions would match a superset of * values that the original condition would match. * * Examples: * a AND b OR c * * In this case we cannot pull anything because the `or` is at the top level. * * a AND b AND c * We can pull all three. * * a AND (b OR c) * We can only pull `a`. */ export declare function pullSimpleAndComponents(condition: Condition): SimpleCondition[]; /** * Checks if the supplied filters constitute a primary key lookup. * If so, returns the constraint that would be used to look up the primary key. * If not, returns undefined. */ export declare function primaryKeyConstraintFromFilters(condition: Condition | undefined, primary: PrimaryKey): Constraint | undefined; export declare class SetOfConstraint { #private; constructor(); has(value: Constraint): boolean; add(value: Constraint): this; } //# sourceMappingURL=constraint.d.ts.map