import { A as DefaultOperatorName, D as RuleGroupTypeIC, L as Except, M as RuleGroupType, N as RuleType, O as DefaultCombinatorName, P as ExpressionNode, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-CX9mehdL.mjs"; import { t as ParserCommonOptions } from "./import-DVWI7Fdh.mjs"; //#region src/utils/parseCEL/types.d.ts type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "MessageInit" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression"; type CELRelop = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in"; interface CELExpression { type: CELExpressionType; } interface CELIdentifier extends CELExpression { type: "Identifier"; value: LimitTo; } interface CELStringLiteral extends CELExpression { type: "StringLiteral"; value: `'${string}'` | `"${string}"` | `'''${string}'''` | `"""${string}"""`; } interface CELBytesLiteral extends CELExpression { type: "BytesLiteral"; value: string; } interface CELIntegerLiteral extends CELExpression { type: "IntegerLiteral"; value: number; } interface CELUnsignedIntegerLiteral extends CELExpression { type: "UnsignedIntegerLiteral"; value: number; } interface CELFloatLiteral extends CELExpression { type: "FloatLiteral"; value: number; } interface CELBooleanLiteral extends CELExpression { type: "BooleanLiteral"; value: boolean; } interface CELNullLiteral extends CELExpression { type: "NullLiteral"; value: null; } interface CELRelation extends CELExpression { type: "Relation"; left: CELExpression; operator: CELRelop; right: CELExpression; } interface CELConditionalExpr extends CELExpression { type: "ConditionalExpr"; condition: CELExpression; valueIfTrue: CELExpression; valueIfFalse: CELExpression; } interface CELNegation extends CELExpression { type: "Negation"; negations: number; value: CELPrimary; } interface CELNegative extends CELExpression { type: "Negative"; negatives: number; value: CELMember; } interface CELMember extends CELExpression { type: "Member"; value?: CELPrimary; left?: CELPrimary | CELMember | CELNegation; right?: CELIdentifier; list?: CELExpressionList; } interface CELMemberIdentifierChain extends CELMember { type: "Member"; value: never; left: CELMemberIdentifierChain; right: CELIdentifier; list: never; } interface CELMemberNegatedIdentifier extends CELNegation { value: CELIdentifier; } interface CELMemberNegatedIdentifierChain extends CELExpression { value: never; left: CELMemberIdentifierChain | CELMemberNegatedIdentifier; right: CELIdentifier; list: never; } interface CELDynamicPropertyAccessor extends CELExpression { type: "DynamicPropertyAccessor"; left: CELMember; right: CELExpression; } interface CELProperty extends CELExpression { type: "Property"; value: CELIdentifier; args?: CELExpressionList; trailingComma?: boolean; } interface CELFunctionCall extends CELExpression { type: "FunctionCall"; name: CELIdentifier; args: CELExpressionList; trailingComma?: boolean; } interface CELExpressionGroup extends CELExpression { type: "ExpressionGroup"; value: CELExpression; } interface CELList extends CELExpression { type: "List"; value: CELExpressionList; trailingComma?: boolean; } interface CELMap extends CELExpression { type: "Map"; value: CELMapInits; trailingComma?: boolean; } interface CELAddition extends CELExpression { type: "Addition"; left: CELExpression; right: CELExpression; } interface CELSubtraction extends CELExpression { type: "Subtraction"; left: CELExpression; right: CELExpression; } interface CELMultiplication extends CELExpression { type: "Multiplication"; left: CELExpression; right: CELExpression; } interface CELDivision extends CELExpression { type: "Division"; left: CELExpression; right: CELExpression; } interface CELModulo extends CELExpression { type: "Modulo"; left: CELExpression; right: CELExpression; } interface CELConditionalOr extends CELExpression { type: "ConditionalOr"; left: CELExpression; right: CELExpression; } interface CELConditionalAnd extends CELExpression { type: "ConditionalAnd"; left: CELExpression; right: CELExpression; } interface CELExpressionList extends CELExpression { type: "ExpressionList"; value: CELExpression[]; } interface CELMessageInit extends CELExpression { type: "MessageInit"; left: CELMember; list: CELFieldInits; trailingComma?: boolean; } interface CELFieldInits extends CELExpression { type: "FieldInits"; value: CELFieldInit[]; } interface CELFieldInit extends CELExpression { type: "FieldInit"; left: CELIdentifier; right: CELExpression; } interface CELMapInits extends CELExpression { type: "MapInits"; value: CELMapInit[]; } interface CELMapInit extends CELExpression { type: "MapInit"; left: CELExpression; right: CELExpression; } interface CELLikeExpression extends CELExpression { type: "LikeExpression"; left: CELIdentifier | CELMemberIdentifierChain; right: CELIdentifier<"contains" | "startsWith" | "endsWith">; list: CELExpressionList & { value: [CELStringLiteral | CELIdentifier]; }; } interface CELNegatedLikeExpression extends CELExpression { type: "LikeExpression"; left: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain; right: CELIdentifier<"contains" | "startsWith" | "endsWith">; list: CELExpressionList & { value: [CELStringLiteral | CELIdentifier]; }; } interface CELSubqueryExpression extends CELExpression { type: "Member"; left: CELIdentifier | CELMemberIdentifierChain; right: CELIdentifier<"all" | "exists">; list: CELExpressionList & { value: [CELIdentifier, CELExpression]; }; } interface CELNegatedSubqueryExpression extends CELExpression { type: "Member"; left: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain; right: CELIdentifier<"all" | "exists">; list: CELExpressionList & { value: [CELIdentifier, CELExpression]; }; } type CELNumericLiteral = CELIntegerLiteral | CELUnsignedIntegerLiteral | CELFloatLiteral; type CELLiteral = CELStringLiteral | CELBytesLiteral | CELNumericLiteral | CELBooleanLiteral | CELNullLiteral; type CELPrimary = CELProperty | CELIdentifier | CELExpressionGroup | CELFunctionCall | CELLiteral | CELList | CELMap; type CELMathOperation = CELAddition | CELSubtraction | CELMultiplication | CELDivision | CELModulo; interface ParsedCEL { nodeType: "Main"; value: CELExpression; } /** * A CEL operand subtree that {@link parseCEL!ParseCELOptions.getExpression} may receive — an * arithmetic infix node (`Addition`/`Subtraction`/`Multiplication`/`Division`/`Modulo`, * optionally wrapped in an `ExpressionGroup`), a `FunctionCall`, or a `ConditionalExpr` (the * `min`/`max` emulated template). */ type CELExpressionOperand = CELExpression; /** Context passed to {@link parseCEL!ParseCELOptions.getExpression}. */ interface ParseCELExpressionContext { /** Returns `true` if the field is configured (or if no `fields` were supplied). */ fieldExists: (fieldName: string) => boolean; } //#endregion //#region src/utils/parseCEL/parseCEL.d.ts interface ParseCELOptionsStandard extends Except { independentCombinators?: false; /** * Handler for custom CEL expressions. */ customExpressionHandler?: (expr: CELExpression) => RuleType | RuleGroupType | null; /** * Handler that converts a CEL arithmetic/function operand subtree into an * {@link ExpressionNode}. Return `null` to reject (the rule is dropped). Supplied by * `@react-querybuilder/expr` (`expressionParserCEL`). When omitted, expression operands * are ignored (rule dropped). */ getExpression?: (node: CELExpressionOperand, ctx: ParseCELExpressionContext) => ExpressionNode | null; } interface ParseCELOptionsIC extends Except { independentCombinators: true; /** * Handler for custom CEL expressions. */ customExpressionHandler?: (expr: CELExpression) => RuleType | RuleGroupTypeIC | null; /** * Handler that converts a CEL arithmetic/function operand subtree into an * {@link ExpressionNode}. Return `null` to reject (the rule is dropped). Supplied by * `@react-querybuilder/expr` (`expressionParserCEL`). When omitted, expression operands * are ignored (rule dropped). */ getExpression?: (node: CELExpressionOperand, ctx: ParseCELExpressionContext) => ExpressionNode | null; } /** * Options object for {@link parseCEL}. */ type ParseCELOptions = ParseCELOptionsStandard | ParseCELOptionsIC; /** * Converts a CEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseCEL(cel: string): DefaultRuleGroupType; /** * Converts a CEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!RuleGroupType RuleGroupType}). */ declare function parseCEL(cel: string, options: ParseCELOptionsStandard & { customExpressionHandler: (expr: CELExpression) => RuleType | RuleGroupType | null; }): RuleGroupType; /** * Converts a CEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!RuleGroupTypeIC RuleGroupTypeIC}). */ declare function parseCEL(cel: string, options: ParseCELOptionsIC & { customExpressionHandler: (expr: CELExpression) => RuleType | RuleGroupTypeIC | null; }): RuleGroupTypeIC; /** * Converts a CEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseCEL(cel: string, options?: ParseCELOptionsStandard): DefaultRuleGroupType; /** * Converts a CEL string expression into a query suitable for the * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}). */ declare function parseCEL(cel: string, options: ParseCELOptionsIC): DefaultRuleGroupTypeIC; //#endregion //#region src/utils/parseCEL/utils.d.ts declare const isCELExpressionGroup: (expr: CELExpression) => expr is CELExpressionGroup; declare const isCELConditionalAnd: (expr: CELExpression) => expr is CELConditionalAnd; declare const isCELConditionalOr: (expr: CELExpression) => expr is CELConditionalOr; declare const isCELStringLiteral: (expr: CELExpression) => expr is CELStringLiteral; declare const isCELLiteral: (expr: CELExpression) => expr is CELLiteral; declare const isCELNumericLiteral: (expr: CELExpression) => expr is CELNumericLiteral; declare const isCELRelation: (expr: CELExpression) => expr is CELRelation; declare const isCELList: (expr: CELExpression) => expr is CELList; declare const isCELMap: (expr: CELExpression) => expr is CELMap; declare const isCELIdentifier: (expr: CELExpression) => expr is CELIdentifier; declare const isCELNegation: (expr: CELExpression) => expr is CELNegation; declare const isCELMember: (expr: CELExpression) => expr is CELMember; declare const isCELAddition: (expr: CELExpression) => expr is CELAddition; declare const isCELBooleanLiteral: (expr: CELExpression) => expr is CELBooleanLiteral; declare const isCELBytesLiteral: (expr: CELExpression) => expr is CELBytesLiteral; declare const isCELConditionalExpr: (expr: CELExpression) => expr is CELConditionalExpr; declare const isCELDivision: (expr: CELExpression) => expr is CELDivision; declare const isCELDynamicPropertyAccessor: (expr: CELExpression) => expr is CELDynamicPropertyAccessor; declare const isCELExpressionList: (expr: CELExpression) => expr is CELExpressionList; declare const isCELFieldInit: (expr: CELExpression) => expr is CELFieldInit; declare const isCELFieldInits: (expr: CELExpression) => expr is CELFieldInits; declare const isCELMessageInit: (expr: CELExpression) => expr is CELMessageInit; declare const isCELFloatLiteral: (expr: CELExpression) => expr is CELFloatLiteral; declare const isCELFunctionCall: (expr: CELExpression) => expr is CELFunctionCall; declare const isCELIntegerLiteral: (expr: CELExpression) => expr is CELIntegerLiteral; declare const isCELMapInit: (expr: CELExpression) => expr is CELMapInit; declare const isCELMapInits: (expr: CELExpression) => expr is CELMapInits; declare const isCELModulo: (expr: CELExpression) => expr is CELModulo; declare const isCELMultiplication: (expr: CELExpression) => expr is CELMultiplication; declare const isCELNegative: (expr: CELExpression) => expr is CELNegative; declare const isCELNullLiteral: (expr: CELExpression) => expr is CELNullLiteral; declare const isCELProperty: (expr: CELExpression) => expr is CELProperty; declare const isCELSubtraction: (expr: CELExpression) => expr is CELSubtraction; declare const isCELUnsignedIntegerLiteral: (expr: CELExpression) => expr is CELUnsignedIntegerLiteral; declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor; declare const isCELNegatedIdentifier: (expr: CELExpression) => expr is CELMemberNegatedIdentifier; declare const isCELNegatedIdentifierOrChain: (expr: CELExpression) => expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier; declare const isCELLikeExpression: (expr: CELExpression) => expr is CELLikeExpression; declare const isCELNegatedLikeExpression: (expr: CELExpression) => expr is CELNegatedLikeExpression; declare const isCELSubqueryExpression: (expr: CELExpression) => expr is CELSubqueryExpression; declare const isCELNegatedSubqueryExpression: (expr: CELExpression) => expr is CELNegatedSubqueryExpression; declare const extractSubqueryComponents: (expr: CELMember) => { field: string; method: "all" | "exists"; alias: string | null; condition: CELExpression; } | null; declare const getCELIdentifierFromChain: (expr: CELIdentifier | CELMemberIdentifierChain | CELDynamicPropertyAccessor | CELMember) => string; declare const getCELIdentifierFromNegatedChain: (expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain) => string; declare function evalCELLiteralValue(literal: CELStringLiteral): string; declare function evalCELLiteralValue(literal: CELBooleanLiteral): boolean; declare function evalCELLiteralValue(literal: CELNumericLiteral): number | null; declare function evalCELLiteralValue(literal: CELBytesLiteral): null; declare function evalCELLiteralValue(literal: CELNullLiteral): null; declare function evalCELLiteralValue(literal: CELLiteral): string | boolean | number | null; declare const celNormalizeCombinator: (c: "&&" | "||") => DefaultCombinatorName; declare const celNormalizeOperator: (op: CELRelop, flip?: boolean) => DefaultOperatorName; declare const celGenerateFlatAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression)[]; declare const celGenerateMixedAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression | ("and" | CELExpression)[])[]; declare const transformAliasInExpression: (expr: CELExpression, alias: string | null) => CELExpression; /** A CEL arithmetic infix node (`Addition`/`Subtraction`/`Multiplication`/`Division`/`Modulo`). */ declare const isCELMathOperation: (expr: CELExpression) => boolean; /** * Whether a relation operand should be routed to `getExpression`: an arithmetic infix node, a * `FunctionCall`, or a `ConditionalExpr` (`min`/`max` template) — optionally wrapped in one or * more `ExpressionGroup`s. Bare identifiers, chains, and literals are not expression operands * (they retain their normal handling). */ declare const isCELExpressionOperand: (expr: CELExpression) => boolean; //#endregion export { CELAddition, CELBooleanLiteral, CELBytesLiteral, CELConditionalAnd, CELConditionalExpr, CELConditionalOr, CELDivision, CELDynamicPropertyAccessor, CELExpression, CELExpressionGroup, CELExpressionList, CELExpressionOperand, CELExpressionType, CELFieldInit, CELFieldInits, CELFloatLiteral, CELFunctionCall, CELIdentifier, CELIntegerLiteral, CELLikeExpression, CELList, CELLiteral, CELMap, CELMapInit, CELMapInits, CELMathOperation, CELMember, CELMemberIdentifierChain, CELMemberNegatedIdentifier, CELMemberNegatedIdentifierChain, CELMessageInit, CELModulo, CELMultiplication, CELNegatedLikeExpression, CELNegatedSubqueryExpression, CELNegation, CELNegative, CELNullLiteral, CELNumericLiteral, CELPrimary, CELProperty, CELRelation, CELRelop, CELStringLiteral, CELSubqueryExpression, CELSubtraction, CELUnsignedIntegerLiteral, ParseCELExpressionContext, ParseCELOptions, ParseCELOptionsIC, ParseCELOptionsStandard, ParsedCEL, celGenerateFlatAndOrList, celGenerateMixedAndOrList, celNormalizeCombinator, celNormalizeOperator, evalCELLiteralValue, extractSubqueryComponents, getCELIdentifierFromChain, getCELIdentifierFromNegatedChain, isCELAddition, isCELBooleanLiteral, isCELBytesLiteral, isCELConditionalAnd, isCELConditionalExpr, isCELConditionalOr, isCELDivision, isCELDynamicPropertyAccessor, isCELExpressionGroup, isCELExpressionList, isCELExpressionOperand, isCELFieldInit, isCELFieldInits, isCELFloatLiteral, isCELFunctionCall, isCELIdentifier, isCELIdentifierOrChain, isCELIntegerLiteral, isCELLikeExpression, isCELList, isCELLiteral, isCELMap, isCELMapInit, isCELMapInits, isCELMathOperation, isCELMember, isCELMessageInit, isCELModulo, isCELMultiplication, isCELNegatedIdentifier, isCELNegatedIdentifierOrChain, isCELNegatedLikeExpression, isCELNegatedSubqueryExpression, isCELNegation, isCELNegative, isCELNullLiteral, isCELNumericLiteral, isCELProperty, isCELRelation, isCELStringLiteral, isCELSubqueryExpression, isCELSubtraction, isCELUnsignedIntegerLiteral, parseCEL, transformAliasInExpression }; //# sourceMappingURL=parseCEL.d.mts.map