import type { FilterFieldProps } from '../../FilterField.types.js'; import type { SimpleFilterFieldBooleanNode, SimpleFilterFieldComparisonOperatorNode, SimpleFilterFieldDurationNode, SimpleFilterFieldExistsOperatorNode, SimpleFilterFieldGroupNode, SimpleFilterFieldIPAddressNode, SimpleFilterFieldInclusionOperatorNode, SimpleFilterFieldLeafNode, SimpleFilterFieldNumberNode, SimpleFilterFieldSearchOperatorNode, SimpleFilterFieldSmartscapeIdNode, SimpleFilterFieldStatementNode, SimpleFilterFieldStringNode, SimpleFilterFieldTimestampNode, SimpleFilterFieldUIDNode, SimpleFilterFieldVariableNode } from '../../types/conversion-tree-nodes.js'; import type { FilterFieldPrimitive } from '../../types/validation.js'; /** @internal */ export declare const DURATION_REGEX: RegExp; /** @internal */ export declare const VARIABLE_REGEX: RegExp; /** * The parser config every value operation uses when **scanning** an existing * value, regardless of the caller's own config. * * Scanning has to recognize everything that could already be in the value: * `searchConversion` so `* ~ v` survives as a search statement rather than an * error, and `jsonPathConversion` so a key like `content$.status` is a JSONPath * node instead of an `Error` node that no key match can reach. A caller's config * only governs how *new* nodes are constructed (see `addFilter`). * * Kept in one place because the read and write sides drifting apart is exactly * what makes a removal silently do nothing. * * Every parser-config conversion flag that can introduce a new node or operator * belongs here, set to `true`. When a new conversion flag is added to the parser * config, add it to this object as well — otherwise scanning cannot see the * nodes it produces and value operations silently skip them. See the "Value * operations" section in `dev-decisions/dev-decisions.md`. * @internal */ export declare const SCAN_PARSER_CONFIG: { readonly searchConversion: true; readonly jsonPathConversion: true; readonly matchesWildcardConversion: true; }; /** @internal */ export type NewOperatorNode = SimpleFilterFieldComparisonOperatorNode | SimpleFilterFieldInclusionOperatorNode | SimpleFilterFieldExistsOperatorNode | SimpleFilterFieldSearchOperatorNode; /** @internal */ export type Polarity = 'positive' | 'negative' | 'none'; /** @internal */ export type OperatorDescriptor = { node: NewOperatorNode; polarity: Polarity; }; /** @internal */ export declare const OPERATOR_MAP: Partial>; /** @internal */ export declare function mapInputOperator(operator: string | undefined): OperatorDescriptor; /** @internal */ export declare function statementPolarity(statement: SimpleFilterFieldStatementNode): Polarity; /** * Accepted shape for the value-type hint on `addFilter` / `removeFilter`. * * `'Any'`, `'JSONPath'`, and unrecognized custom type names fall back to the * default inference behavior. * @internal */ export type FilterFieldValueTypeHint = FilterFieldPrimitive | (string & {}); type LeafNode = SimpleFilterFieldStringNode | SimpleFilterFieldNumberNode | SimpleFilterFieldBooleanNode | SimpleFilterFieldDurationNode | SimpleFilterFieldVariableNode | SimpleFilterFieldIPAddressNode | SimpleFilterFieldTimestampNode | SimpleFilterFieldUIDNode | SimpleFilterFieldSmartscapeIdNode; /** * Builds the appropriate leaf node for the given `value`, optionally constrained * by a `valueType` hint. When no hint is given (or the hint is `'Any'` / * `'JSONPath'` / an unrecognized custom name), the type is inferred from the * value's content — matching the historical behavior. * @internal */ export declare function makeLeaf(value: string | number | boolean, parserConfig: FilterFieldProps['parserConfig'], valueType?: FilterFieldValueTypeHint): LeafNode; /** * The scalar a leaf compares by. `Duration` reports its rendered form (`30m`) so * that two Duration leaves compare by value and unit together. * * Also what `getFilters` reports, because its public result carries plain * scalars rather than parsed leaves. Shared so a read and a comparison can * never reduce the same leaf to two different scalars. * @internal */ export declare function leafScalar(leaf: SimpleFilterFieldLeafNode): string | number | boolean | undefined; /** @internal */ export declare function leafEquals(leaf: SimpleFilterFieldLeafNode, value: string | number | boolean, options?: { valueType?: FilterFieldValueTypeHint; parserConfig?: FilterFieldProps['parserConfig']; }): boolean; /** * The scalar a value compares by once it has been lowered into the leaf the * value operations would build for it. * * Callers that hold a raw input value and want to compare it against scalars * read off an existing value (the `values` of a `getFilters` match) use this to * put both sides in the same form, so the comparison is a plain `===` rather * than an ad-hoc coercion that could disagree with `addFilter` / `removeFilter`. * * `FilterCompositionMenuGroup` is the caller: it lowers the value a menu item * would add, and an item whose value is already among the reported scalars * renders disabled because clicking it would not change the filter. * @internal */ export declare function toComparableScalar(value: string | number | boolean, parserConfig?: FilterFieldProps['parserConfig'], valueType?: FilterFieldValueTypeHint): string | number | boolean; /** * Whether a parsed leaf is the leaf the value operations would build for its own * scalar under the given type hint — i.e. whether the leaf really carries a * value of that type. * * `getFilters` uses it to report only the statements the write side would * consider the same type, so a menu built for a `String` key is not disabled by * a stored Boolean that merely looks alike. * @internal */ export declare function leafMatchesValueType(leaf: SimpleFilterFieldLeafNode, options?: { valueType?: FilterFieldValueTypeHint; parserConfig?: FilterFieldProps['parserConfig']; }): boolean; /** @internal */ export declare function findSearchStatement(group: SimpleFilterFieldGroupNode, value: string | number | boolean, options?: { valueType?: FilterFieldValueTypeHint; parserConfig?: FilterFieldProps['parserConfig']; }): SimpleFilterFieldStatementNode | undefined; /** @internal */ export declare function findIdenticalStatement(group: SimpleFilterFieldGroupNode, key: string, operatorNode: NewOperatorNode, value: string | number | boolean | undefined, options?: { valueType?: FilterFieldValueTypeHint; parserConfig?: FilterFieldProps['parserConfig']; }): SimpleFilterFieldStatementNode | undefined; export {}; //# sourceMappingURL=value-operation-utils.d.ts.map