import { A as DefaultOperatorName, L as Except, O as DefaultCombinatorName, P as ExpressionNode, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-CX9mehdL.js"; import { t as ParserCommonOptions } from "./import-6ExjhifL.js"; //#region src/utils/parseSpEL/types.d.ts type SpELNodeType = "invalid" | SpELOperationType | SpELPrimitiveType | SpELRelOp | SpELIdentifierType | "assign" | "beanref" | "constructorref" | "elvis" | "function" | "identifier" | "indexer" | "list" | "map" | "method" | "between" | "instanceof" | "matches" | "projection" | "qualifiedidentifier" | "selection" | "ternary" | "typeref"; type SpELOperationType = "op-and" | "op-dec" | "op-divide" | "op-eq" | "op-ge" | "op-gt" | "op-inc" | "op-le" | "op-lt" | "op-minus" | "op-modulus" | "op-multiply" | "op-ne" | "op-not" | "op-or" | "op-plus" | "op-power"; type SpELPrimitiveType = "number" | "string" | "boolean" | "null"; type SpELRelOp = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in"; type SpELRelOpType = "op-eq" | "op-ge" | "op-gt" | "op-le" | "op-lt" | "op-ne"; type SpELIdentifierType = "property" | "compound" | "variable"; interface SpELBaseNode { _type: T; getType: () => T; getChildren: () => SpELBaseNode[]; getStartPosition: () => number; getEndPosition: () => number; getValue: () => boolean | number | string | null; toString: () => string; } interface SpELPropertyNode extends SpELBaseNode { getRaw: () => string; getName: () => string; } interface SpELListNode extends SpELBaseNode<"list"> { getRaw: () => SpELPropertyNode[]; } interface SpELCompoundNode extends SpELBaseNode { getChildren: () => SpELPropertyNode[]; } /** * A SpEL method/function invocation node. Note that arguments are _not_ children — they are * exposed as raw (unprocessed) nodes through `getRaw()`. */ interface SpELMethodNode extends SpELBaseNode<"method"> { getRaw: () => { methodName: string; args: SpELExpressionNode[]; }; } /** The dotted segments of a `T(...)` type reference, e.g. `["java", "lang", "Math"]`. */ interface SpELQualifiedIdentifierNode extends SpELBaseNode<"qualifiedidentifier"> { getRaw: () => string[]; } interface SpELExpressionNode extends SpELBaseNode { getChildren: () => SpELExpressionNode[]; } interface SpELProcessedExpression { type: SpELNodeType; children: SpELProcessedExpression[]; value: number | string | boolean | null; startPosition: number; endPosition: number; identifier: string | null; /** Method/function name, present when `type` is `"method"`. */ methodName?: string; /** * The receiver of an instance method call (e.g. `name` in `name.toUpperCase()`), or `null` for * static (`T(...)`) and bare function calls. */ target?: SpELProcessedExpression | null; /** Dotted type name of a `T(...)` static call target, e.g. `"java.lang.Math"`. */ typeRef?: string | null; } /** * A method/function invocation. Arguments are stored as `children`; instance-call receivers are * stored as {@link SpELProcessedExpression.target}, and static-call types as * {@link SpELProcessedExpression.typeRef}. */ interface SpELMethodCall extends SpELProcessedExpression { type: "method"; methodName: string; } interface SpELOpAnd extends SpELProcessedExpression { type: "op-and"; } interface SpELOpOr extends SpELProcessedExpression { type: "op-or"; } interface SpELOpMatches extends SpELProcessedExpression { type: "matches"; children: [SpELIdentifier, SpELStringLiteral] | [SpELStringLiteral, SpELIdentifier] | [SpELIdentifier, SpELIdentifier]; } interface SpELIdentifier extends SpELProcessedExpression { type: "compound" | "property" | "variable"; identifier: string; } interface SpELRelation extends SpELProcessedExpression { type: SpELRelOpType; } interface SpELBetweenValues extends SpELProcessedExpression { type: "between"; children: [SpELIdentifier, SpELListOfValues]; } interface SpELBetweenFields extends SpELProcessedExpression { type: "between"; children: [SpELIdentifier, SpELListOfFields]; } interface SpELListOfValues extends SpELProcessedExpression { type: "list"; children: [SpELPrimitive, SpELPrimitive, ...SpELPrimitive[]]; } interface SpELListOfFields extends SpELProcessedExpression { type: "list"; children: [SpELIdentifier, SpELIdentifier, ...SpELIdentifier[]]; } type SpELPrimitive = SpELBooleanLiteral | SpELNumericLiteral | SpELStringLiteral | SpELNullLiteral; interface SpELStringLiteral extends SpELProcessedExpression { type: "string"; value: string; } interface SpELNumericLiteral extends SpELProcessedExpression { type: "number"; value: number; } interface SpELBooleanLiteral extends SpELProcessedExpression { type: "boolean"; value: boolean; } interface SpELNullLiteral extends SpELProcessedExpression { type: "null"; value: null; } /** * A SpEL operand subtree that {@link parseSpEL!ParseSpELOptions.getExpression} may receive — either * an arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`) or a * method/function invocation ({@link SpELMethodCall}), which covers `T(java.lang.Math).abs/min/max(...)`, * `.toUpperCase()`/`.toLowerCase()`, and custom calls like `myFunc(a, b)`. */ type SpELExpressionOperand = SpELProcessedExpression; /** Context passed to {@link parseSpEL!ParseSpELOptions.getExpression}. */ interface ParseSpELExpressionContext { /** Returns `true` if the field is configured (or if no `fields` were supplied). */ fieldExists: (fieldName: string) => boolean; } //#endregion //#region src/utils/parseSpEL/parseSpEL.d.ts /** * Options object for {@link parseSpEL!parseSpEL}. */ interface ParseSpELOptions extends ParserCommonOptions { /** * Handler that converts a SpEL expression operand subtree into an {@link ExpressionNode}. * Return `null` to reject (the rule is dropped). Supplied by `@react-querybuilder/expr` * (`expressionParserSpEL`). When omitted, expression operands are ignored (rule dropped). * * Arithmetic infix operands and method/function invocations * (`T(java.lang.Math).abs/min/max(...)`, `.toUpperCase()`/`.toLowerCase()`, and custom calls) * are both supported. See {@link SpELExpressionOperand}. */ getExpression?: (node: SpELExpressionOperand, ctx: ParseSpELExpressionContext) => ExpressionNode | null; } /** * Converts a SpEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseSpEL(spel: string): DefaultRuleGroupType; /** * Converts a SpEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseSpEL(spel: string, options: Except & { independentCombinators?: false; }): DefaultRuleGroupType; /** * Converts a SpEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}). */ declare function parseSpEL(spel: string, options: Except & { independentCombinators: true; }): DefaultRuleGroupTypeIC; //#endregion //#region src/utils/parseSpEL/utils.d.ts declare const isSpELPropertyNode: (expr: SpELBaseNode) => expr is SpELPropertyNode; declare const isSpELCompoundNode: (expr: SpELBaseNode) => expr is SpELCompoundNode; declare const isSpELListNode: (expr: SpELBaseNode) => expr is SpELListNode; declare const isSpELOpAnd: (expr: SpELProcessedExpression) => expr is SpELOpAnd; declare const isSpELOpOr: (expr: SpELProcessedExpression) => expr is SpELOpOr; declare const isSpELOpMatches: (expr: SpELProcessedExpression) => expr is SpELOpMatches; declare const isSpELIdentifier: (expr: SpELProcessedExpression) => expr is SpELIdentifier; declare const isSpELStringLiteral: (expr: SpELProcessedExpression) => expr is SpELStringLiteral; declare const isSpELNumericLiteral: (expr: SpELProcessedExpression) => expr is SpELNumericLiteral; declare const isSpELBooleanLiteral: (expr: SpELProcessedExpression) => expr is SpELBooleanLiteral; declare const isSpELNullLiteral: (expr: SpELProcessedExpression) => expr is SpELNullLiteral; declare const isSpELRelationOp: (expr: SpELProcessedExpression) => expr is SpELRelation; declare const isSpELPrimitive: (expr: SpELProcessedExpression) => expr is SpELPrimitive; declare const isSpELBetweenValues: (expr: SpELProcessedExpression) => expr is SpELBetweenValues; declare const isSpELBetweenFields: (expr: SpELProcessedExpression) => expr is SpELBetweenFields; /** A SpEL arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`). */ declare const isSpELMathOperation: (expr: SpELProcessedExpression) => boolean; /** A method/function invocation node (`.toUpperCase()`, `T(java.lang.Math).abs(x)`, `myFunc(a)`). */ declare const isSpELMethodCall: (expr: SpELProcessedExpression) => expr is SpELMethodCall; /** * Whether a relation operand should be routed to `getExpression`: an arithmetic infix node or a * method/function invocation. Bare identifiers, chains, and literals are not expression operands * (they retain their normal handling). */ declare const isSpELExpressionOperand: (expr: SpELProcessedExpression) => boolean; declare const isSpELMethodNode: (expr: SpELBaseNode) => expr is SpELMethodNode; declare const processCompiledExpression: (ce: SpELPropertyNode | SpELExpressionNode) => SpELProcessedExpression; declare const normalizeOperator: (opType: SpELRelOpType, flip?: boolean) => DefaultOperatorName; declare const generateFlatAndOrList: (expr: SpELProcessedExpression) => (DefaultCombinatorName | SpELProcessedExpression)[]; declare const generateMixedAndOrList: (expr: SpELOpAnd | SpELOpOr) => (DefaultCombinatorName | SpELProcessedExpression | ("and" | SpELProcessedExpression)[])[]; //#endregion export { ParseSpELExpressionContext, ParseSpELOptions, SpELBaseNode, SpELBetweenFields, SpELBetweenValues, SpELBooleanLiteral, SpELCompoundNode, SpELExpressionNode, SpELExpressionOperand, SpELIdentifier, SpELIdentifierType, SpELListNode, SpELListOfFields, SpELListOfValues, SpELMethodCall, SpELMethodNode, SpELNodeType, SpELNullLiteral, SpELNumericLiteral, SpELOpAnd, SpELOpMatches, SpELOpOr, SpELPrimitive, SpELPrimitiveType, SpELProcessedExpression, SpELPropertyNode, SpELQualifiedIdentifierNode, SpELRelOp, SpELRelOpType, SpELRelation, SpELStringLiteral, generateFlatAndOrList, generateMixedAndOrList, isSpELBetweenFields, isSpELBetweenValues, isSpELBooleanLiteral, isSpELCompoundNode, isSpELExpressionOperand, isSpELIdentifier, isSpELListNode, isSpELMathOperation, isSpELMethodCall, isSpELMethodNode, isSpELNullLiteral, isSpELNumericLiteral, isSpELOpAnd, isSpELOpMatches, isSpELOpOr, isSpELPrimitive, isSpELPropertyNode, isSpELRelationOp, isSpELStringLiteral, normalizeOperator, parseSpEL, processCompiledExpression }; //# sourceMappingURL=parseSpEL.d.ts.map