declare type OPERATOR_CODE = 'equal' | 'not_equal' | 'equal_ignore_case' | 'not_equal_ignore_case' | 'greater_than' | 'greater_than_or_equal' | 'less_than' | 'less_than_or_equal' | 'is_filled' | 'is_empty' | 'is_true' | 'is_false' | 'contains' | 'not_contains' | 'contains_ignore_case' | 'not_contains_ignore_case' | 'starts_with' | 'not_starts_with' | 'ends_with' | 'not_ends_with' | 'is_numerical' | 'is_text' | 'selections_include' | 'selections_dont_include'; export declare type FieldValueType = { field_type: 'servar' | 'hidden'; field_id: string; field_key: string; }; export declare type ValueType = string | FieldValueType; export interface ComparisonRule { field_type?: '' | 'servar' | 'hidden'; hidden_field?: string | null; servar?: string | null; comparison?: OPERATOR_CODE; values: ValueType[]; field_id: string | null; field_key?: string; } export interface ResolvedComparisonRule extends ComparisonRule { field_type: 'servar' | 'hidden'; comparison: OPERATOR_CODE; field_key: string; } /** * Evaluates a comparison rule. * @param rule * @param repeatIndex If evaluating for a specific index of a repeat, use the index to * only compare repeating fields (left and right) at THAT index, i.e. only use that indexed * value in the comparison. * @param internalId Needed to get field data and verify if a field is repeating * * Note: The right side field values can be multi-values (array) as well * as the left-side field value (repeating field). * The LEFT side field values may be repeating because the field is in a repeat * or because the field is multi-valued. To complicate further, the multi-valued * field may be in a repeat, resulting in an array of arrays. * Additionally, the RIGHT side field values could also be existing fields which themselves * might be multi-valued (either a multi-valued type or in a repeat or both). * Either way, the logic evaluation is the same: * SOME LEFT SIDE VALUE MUST COMPARE TRUTHY TO AT LEAST ONE (SOME) RIGHT SIDE VALUE * FOR THE OVERALL EXPRESSION TO BE TRUE. * * Note: The [undefined] arrays used when flattening the left and right values below are * to deal with multi-valued repeating fields (e.g. checkbox group) on both the left and right * that have no values (empty array). This logic is flattening the values out to feed to * the "some left value must compare to some right value" comparison logic. * Since [].every() always returns true, we need to have a value of undefined for each empty * field value for it to properly evaluate the empty field case. */ declare const evalComparisonRule: (rule: ResolvedComparisonRule, repeatIndex?: number | undefined, internalId?: string) => boolean; export { evalComparisonRule }; export type { OPERATOR_CODE }; //# sourceMappingURL=logic.d.ts.map