@react-querybuilder/core 8.9.2 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-C9sO4qLO.mjs} +3 -75
- package/dist/arrayUtils-C9sO4qLO.mjs.map +1 -0
- package/dist/arrayUtils-QxZOZTf6.js +73 -0
- package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
- package/dist/basic-BmpEwexQ.d.mts +363 -0
- package/dist/basic-CDDA-KZa.d.ts +363 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +553 -1247
- package/dist/cjs/react-querybuilder_core.cjs.development.js +408 -121
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +553 -1247
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-BUgyz1GA.mjs} +2 -2
- package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-BUgyz1GA.mjs.map} +1 -1
- package/dist/{export-r-V7bU31.d.mts → export-Ccjfea21.d.mts} +3 -2
- package/dist/{export-DyrnTh6K.d.ts → export-GUuxJ7zR.d.ts} +3 -2
- package/dist/formatQuery.d.mts +3 -2
- package/dist/formatQuery.d.ts +3 -2
- package/dist/formatQuery.js +217 -87
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +217 -87
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Cksobmln.d.ts → import-D-hm1phN.d.ts} +2 -2
- package/dist/{import-BwbbP4oU.d.mts → import-Dxevzw_-.d.mts} +2 -2
- package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CGe_rb2w.mjs} +1 -1
- package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CGe_rb2w.mjs.map} +1 -1
- package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
- package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
- package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-DrubUpx0.mjs} +86 -3
- package/dist/optGroupUtils-DrubUpx0.mjs.map +1 -0
- package/dist/parseCEL.d.mts +292 -11
- package/dist/parseCEL.d.ts +292 -11
- package/dist/parseCEL.js +114 -30
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +69 -31
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +3 -2
- package/dist/parseJSONata.d.ts +3 -2
- package/dist/parseJSONata.js +49 -77
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +4 -5
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +4 -3
- package/dist/parseJsonLogic.d.ts +4 -3
- package/dist/parseJsonLogic.js +5 -6
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -6
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +3 -2
- package/dist/parseMongoDB.d.ts +3 -2
- package/dist/parseMongoDB.js +15 -16
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +5 -6
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-B_-sR6d5.mjs} +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-B_-sR6d5.mjs.map} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
- package/dist/parseSQL.d.mts +3 -2
- package/dist/parseSQL.d.ts +3 -2
- package/dist/parseSQL.js +11 -15
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +12 -16
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +3 -2
- package/dist/parseSpEL.d.ts +3 -2
- package/dist/parseSpEL.js +7 -9
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +5 -6
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
- package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
- package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-CJNpnGcJ.mjs} +5 -6
- package/dist/prepareQueryObjects-CJNpnGcJ.mjs.map +1 -0
- package/dist/query-builder-layout.css +1 -1
- package/dist/query-builder-layout.css.map +1 -1
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +553 -1247
- package/dist/react-querybuilder_core.legacy-esm.d.ts +553 -1247
- package/dist/react-querybuilder_core.legacy-esm.js +412 -119
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +405 -122
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +553 -1247
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_layout.scss +61 -17
- package/dist/styles/_main.scss +17 -4
- package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
- package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
- package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DHvtgDgZ.mjs} +2 -2
- package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DHvtgDgZ.mjs.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +2 -2
- package/package.json +14 -12
- package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
- package/dist/arrayUtils-D5EoIsKP.js +0 -164
- package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
- package/dist/basic-BfD-7CN3.d.mts +0 -1235
- package/dist/basic-C8xXKHIA.d.ts +0 -1235
- package/dist/objectUtils-BBZSfZJz.js +0 -17
- package/dist/objectUtils-BBZSfZJz.js.map +0 -1
- package/dist/objectUtils-BtWdcZVG.mjs +0 -11
- package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
- package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
- package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
package/dist/parseCEL.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defaultOperatorNegationMap
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import { fieldIsValidUtil, getFieldsArray, prepareRuleGroup } from "./prepareQueryObjects-
|
|
1
|
+
import { defaultOperatorNegationMap } from "./optGroupUtils-DrubUpx0.mjs";
|
|
2
|
+
import { joinWith } from "./arrayUtils-C9sO4qLO.mjs";
|
|
3
|
+
import { isRuleGroup } from "./isRuleGroup-CGe_rb2w.mjs";
|
|
4
|
+
import { fieldIsValidUtil, getFieldsArray, prepareRuleGroup } from "./prepareQueryObjects-CJNpnGcJ.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/parseCEL/celParser.js
|
|
7
7
|
var celParser = (function() {
|
|
@@ -2349,26 +2349,64 @@ const isCELExpressionGroup = (expr) => expr.type === "ExpressionGroup";
|
|
|
2349
2349
|
const isCELConditionalAnd = (expr) => expr.type === "ConditionalAnd";
|
|
2350
2350
|
const isCELConditionalOr = (expr) => expr.type === "ConditionalOr";
|
|
2351
2351
|
const isCELStringLiteral = (expr) => expr.type === "StringLiteral";
|
|
2352
|
-
const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || expr
|
|
2353
|
-
const isCELNumericLiteral = (expr) => expr
|
|
2352
|
+
const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || isCELBooleanLiteral(expr) || isCELNullLiteral(expr) || isCELBytesLiteral(expr);
|
|
2353
|
+
const isCELNumericLiteral = (expr) => isCELFloatLiteral(expr) || isCELIntegerLiteral(expr) || isCELUnsignedIntegerLiteral(expr);
|
|
2354
2354
|
const isCELRelation = (expr) => expr.type === "Relation";
|
|
2355
2355
|
const isCELList = (expr) => expr.type === "List";
|
|
2356
2356
|
const isCELMap = (expr) => expr.type === "Map";
|
|
2357
2357
|
const isCELIdentifier = (expr) => expr.type === "Identifier";
|
|
2358
2358
|
const isCELNegation = (expr) => expr.type === "Negation";
|
|
2359
2359
|
const isCELMember = (expr) => expr.type === "Member";
|
|
2360
|
+
// istanbul ignore next
|
|
2361
|
+
const isCELAddition = (expr) => expr.type === "Addition";
|
|
2362
|
+
const isCELBooleanLiteral = (expr) => expr.type === "BooleanLiteral";
|
|
2363
|
+
const isCELBytesLiteral = (expr) => expr.type === "BytesLiteral";
|
|
2364
|
+
// istanbul ignore next
|
|
2365
|
+
const isCELConditionalExpr = (expr) => expr.type === "ConditionalExpr";
|
|
2366
|
+
// istanbul ignore next
|
|
2367
|
+
const isCELDivision = (expr) => expr.type === "Division";
|
|
2368
|
+
// istanbul ignore next
|
|
2369
|
+
const isCELDynamicPropertyAccessor = (expr) => expr.type === "DynamicPropertyAccessor";
|
|
2370
|
+
// istanbul ignore next
|
|
2371
|
+
const isCELExpressionList = (expr) => expr.type === "ExpressionList";
|
|
2372
|
+
// istanbul ignore next
|
|
2373
|
+
const isCELFieldInit = (expr) => expr.type === "FieldInit";
|
|
2374
|
+
// istanbul ignore next
|
|
2375
|
+
const isCELFieldInits = (expr) => expr.type === "FieldInits";
|
|
2376
|
+
// istanbul ignore next
|
|
2377
|
+
const isCELFieldsObject = (expr) => expr.type === "FieldsObject";
|
|
2378
|
+
const isCELFloatLiteral = (expr) => expr.type === "FloatLiteral";
|
|
2379
|
+
// istanbul ignore next
|
|
2380
|
+
const isCELFunctionCall = (expr) => expr.type === "FunctionCall";
|
|
2381
|
+
const isCELIntegerLiteral = (expr) => expr.type === "IntegerLiteral";
|
|
2382
|
+
// istanbul ignore next
|
|
2383
|
+
const isCELMapInit = (expr) => expr.type === "MapInit";
|
|
2384
|
+
// istanbul ignore next
|
|
2385
|
+
const isCELMapInits = (expr) => expr.type === "MapInits";
|
|
2386
|
+
// istanbul ignore next
|
|
2387
|
+
const isCELModulo = (expr) => expr.type === "Modulo";
|
|
2388
|
+
// istanbul ignore next
|
|
2389
|
+
const isCELMultiplication = (expr) => expr.type === "Multiplication";
|
|
2390
|
+
// istanbul ignore next
|
|
2391
|
+
const isCELNegative = (expr) => expr.type === "Negative";
|
|
2392
|
+
const isCELNullLiteral = (expr) => expr.type === "NullLiteral";
|
|
2393
|
+
// istanbul ignore next
|
|
2394
|
+
const isCELProperty = (expr) => expr.type === "Property";
|
|
2395
|
+
// istanbul ignore next
|
|
2396
|
+
const isCELSubtraction = (expr) => expr.type === "Subtraction";
|
|
2397
|
+
const isCELUnsignedIntegerLiteral = (expr) => expr.type === "UnsignedIntegerLiteral";
|
|
2360
2398
|
const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
|
|
2361
2399
|
const isCELNegatedIdentifier = (expr) => isCELNegation(expr) && isCELIdentifier(expr.value);
|
|
2362
2400
|
const isCELNegatedIdentifierOrChain = (expr) => isCELNegatedIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.right) && isCELNegatedIdentifier(expr.left);
|
|
2363
2401
|
const isCELLikeExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "contains" || expr.right.value === "startsWith" || expr.right.value === "endsWith") && expr.list.value.length === 1 && (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));
|
|
2364
2402
|
const isCELNegatedLikeExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELNegatedIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "contains" || expr.right.value === "startsWith" || expr.right.value === "endsWith") && expr.list.value.length === 1 && (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));
|
|
2365
|
-
const
|
|
2403
|
+
const getCELIdentifierFromChain = (expr) => {
|
|
2366
2404
|
if (isCELIdentifier(expr)) return expr.value;
|
|
2367
|
-
return `${
|
|
2405
|
+
return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
|
|
2368
2406
|
};
|
|
2369
|
-
const
|
|
2407
|
+
const getCELIdentifierFromNegatedChain = (expr) => {
|
|
2370
2408
|
if (isCELNegatedIdentifier(expr)) return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;
|
|
2371
|
-
return `${
|
|
2409
|
+
return `${getCELIdentifierFromNegatedChain(expr.left)}.${expr.right.value}`;
|
|
2372
2410
|
};
|
|
2373
2411
|
function evalCELLiteralValue(literal) {
|
|
2374
2412
|
switch (literal.type) {
|
|
@@ -2379,8 +2417,8 @@ function evalCELLiteralValue(literal) {
|
|
|
2379
2417
|
default: return literal.value;
|
|
2380
2418
|
}
|
|
2381
2419
|
}
|
|
2382
|
-
const
|
|
2383
|
-
const
|
|
2420
|
+
const celNormalizeCombinator = (c) => c === "||" ? "or" : "and";
|
|
2421
|
+
const celNormalizeOperator = (op, flip) => {
|
|
2384
2422
|
if (flip) {
|
|
2385
2423
|
if (op === "<") return ">";
|
|
2386
2424
|
if (op === "<=") return ">=";
|
|
@@ -2390,11 +2428,11 @@ const normalizeOperator = (op, flip) => {
|
|
|
2390
2428
|
if (op === "==") return "=";
|
|
2391
2429
|
return op;
|
|
2392
2430
|
};
|
|
2393
|
-
const
|
|
2394
|
-
const combinator =
|
|
2431
|
+
const celGenerateFlatAndOrList = (expr) => {
|
|
2432
|
+
const combinator = celNormalizeCombinator(expr.type === "ConditionalAnd" ? "&&" : "||");
|
|
2395
2433
|
const { left, right } = expr;
|
|
2396
2434
|
if (isCELConditionalAnd(left) || isCELConditionalOr(left)) return [
|
|
2397
|
-
...
|
|
2435
|
+
...celGenerateFlatAndOrList(left),
|
|
2398
2436
|
combinator,
|
|
2399
2437
|
right
|
|
2400
2438
|
];
|
|
@@ -2404,8 +2442,8 @@ const generateFlatAndOrList = (expr) => {
|
|
|
2404
2442
|
right
|
|
2405
2443
|
];
|
|
2406
2444
|
};
|
|
2407
|
-
const
|
|
2408
|
-
const arr =
|
|
2445
|
+
const celGenerateMixedAndOrList = (expr) => {
|
|
2446
|
+
const arr = celGenerateFlatAndOrList(expr);
|
|
2409
2447
|
const returnArray = [];
|
|
2410
2448
|
let startIndex = 0;
|
|
2411
2449
|
for (let i = 0; i < arr.length; i += 2) if (arr[i + 1] === "and") {
|
|
@@ -2431,7 +2469,7 @@ const generateMixedAndOrList = (expr) => {
|
|
|
2431
2469
|
//#endregion
|
|
2432
2470
|
//#region src/utils/parseCEL/parseCEL.ts
|
|
2433
2471
|
function parseCEL(cel, options = {}) {
|
|
2434
|
-
const { fields, independentCombinators, listsAsArrays } = options;
|
|
2472
|
+
const { fields, independentCombinators, listsAsArrays, customExpressionHandler } = options;
|
|
2435
2473
|
const ic = !!independentCombinators;
|
|
2436
2474
|
const fieldsFlat = getFieldsArray(fields);
|
|
2437
2475
|
const fieldIsValid = (fieldName, operator, subordinateFieldName) => fieldIsValidUtil({
|
|
@@ -2449,12 +2487,12 @@ function parseCEL(cel, options = {}) {
|
|
|
2449
2487
|
const { forwardNegation: forwardedNegation, groupOnlyIfNecessary } = processOpts;
|
|
2450
2488
|
/* istanbul ignore if */
|
|
2451
2489
|
if (isCELNegation(expr) || isCELNegatedLikeExpression(expr)) {
|
|
2452
|
-
const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (
|
|
2490
|
+
const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (getCELIdentifierFromNegatedChain(expr.left).match(/^!+/)?.[0].length ?? 0) % 2 === 1;
|
|
2453
2491
|
const negatedExpr = isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELLikeExpression(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : isCELNegatedLikeExpression(expr) ? processCELExpression({
|
|
2454
2492
|
...expr,
|
|
2455
2493
|
left: {
|
|
2456
2494
|
type: "Identifier",
|
|
2457
|
-
value:
|
|
2495
|
+
value: getCELIdentifierFromNegatedChain(expr.left).replace(/^!+/, "")
|
|
2458
2496
|
}
|
|
2459
2497
|
}, { forwardNegation: negate }) : isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELRelation(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : processCELExpression(expr.value, {
|
|
2460
2498
|
groupOnlyIfNecessary: true,
|
|
@@ -2486,14 +2524,14 @@ function parseCEL(cel, options = {}) {
|
|
|
2486
2524
|
}
|
|
2487
2525
|
} else if (isCELConditionalAnd(expr) || isCELConditionalOr(expr)) {
|
|
2488
2526
|
if (ic) {
|
|
2489
|
-
const rules$1 =
|
|
2527
|
+
const rules$1 = celGenerateFlatAndOrList(expr).map((v) => {
|
|
2490
2528
|
if (typeof v === "string") return v;
|
|
2491
2529
|
return processCELExpression(v);
|
|
2492
2530
|
});
|
|
2493
2531
|
if (!rules$1.every(Boolean)) return null;
|
|
2494
2532
|
return { rules: rules$1 };
|
|
2495
2533
|
}
|
|
2496
|
-
const andOrList =
|
|
2534
|
+
const andOrList = celGenerateMixedAndOrList(expr);
|
|
2497
2535
|
const combinator = andOrList[1];
|
|
2498
2536
|
const rules = andOrList.filter((v) => Array.isArray(v) || !!v && typeof v !== "string" && "type" in v).map((v) => Array.isArray(v) ? v.filter((vf) => !!v && typeof vf !== "string" && "type" in vf) : v).map((exp) => {
|
|
2499
2537
|
if (Array.isArray(exp)) return {
|
|
@@ -2508,7 +2546,7 @@ function parseCEL(cel, options = {}) {
|
|
|
2508
2546
|
rules
|
|
2509
2547
|
};
|
|
2510
2548
|
} else if (isCELLikeExpression(expr)) {
|
|
2511
|
-
const field =
|
|
2549
|
+
const field = getCELIdentifierFromChain(expr.left);
|
|
2512
2550
|
const func = expr.right.value;
|
|
2513
2551
|
const operatorPre = func === "startsWith" ? "beginsWith" : func;
|
|
2514
2552
|
const operator = forwardedNegation ? `doesNot${operatorPre[0].toUpperCase()}${operatorPre.slice(1).replace("s", "")}` : operatorPre;
|
|
@@ -2532,29 +2570,29 @@ function parseCEL(cel, options = {}) {
|
|
|
2532
2570
|
let flip = false;
|
|
2533
2571
|
const { left, right } = expr;
|
|
2534
2572
|
if (isCELIdentifierOrChain(left)) {
|
|
2535
|
-
field =
|
|
2573
|
+
field = getCELIdentifierFromChain(left);
|
|
2536
2574
|
if (isCELIdentifierOrChain(right)) {
|
|
2537
|
-
value =
|
|
2575
|
+
value = getCELIdentifierFromChain(right);
|
|
2538
2576
|
valueSource = "field";
|
|
2539
2577
|
} else if (isCELLiteral(right)) value = evalCELLiteralValue(right);
|
|
2540
2578
|
} else if (isCELIdentifierOrChain(right) && isCELLiteral(left) && expr.operator !== "in") {
|
|
2541
2579
|
flip = true;
|
|
2542
|
-
field =
|
|
2580
|
+
field = getCELIdentifierFromChain(right);
|
|
2543
2581
|
value = evalCELLiteralValue(left);
|
|
2544
2582
|
}
|
|
2545
|
-
let operator =
|
|
2583
|
+
let operator = celNormalizeOperator(expr.operator, flip);
|
|
2546
2584
|
if (forwardedNegation) operator = defaultOperatorNegationMap[operator];
|
|
2547
2585
|
if (value === null && (operator === "=" || operator === "!=")) operator = operator === "=" ? "null" : "notNull";
|
|
2548
2586
|
else if ((operator === "in" || operator === "notIn") && isCELList(right)) {
|
|
2549
2587
|
if (right.value.value.every((v) => isCELLiteral(v))) value = right.value.value.map((v) => evalCELLiteralValue(v));
|
|
2550
2588
|
else if (right.value.value.every((v) => isCELIdentifierOrChain(v))) {
|
|
2551
2589
|
valueSource = "field";
|
|
2552
|
-
value = right.value.value.map((id) =>
|
|
2590
|
+
value = right.value.value.map((id) => getCELIdentifierFromChain(id));
|
|
2553
2591
|
}
|
|
2554
2592
|
if (value && !listsAsArrays) value = joinWith(value.map((v) => `${v}`), ",");
|
|
2555
2593
|
} else if ((operator === "in" || operator === "notIn") && isCELMap(right)) {
|
|
2556
2594
|
const keys = right.value.value.map((v) => v.left);
|
|
2557
|
-
if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) :
|
|
2595
|
+
if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getCELIdentifierFromChain(k));
|
|
2558
2596
|
if (value && !listsAsArrays) value = joinWith(value.map((v) => `${v}`), ",");
|
|
2559
2597
|
}
|
|
2560
2598
|
if (field && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
|
|
@@ -2567,7 +2605,7 @@ function parseCEL(cel, options = {}) {
|
|
|
2567
2605
|
operator,
|
|
2568
2606
|
value
|
|
2569
2607
|
};
|
|
2570
|
-
}
|
|
2608
|
+
} else if (customExpressionHandler) return customExpressionHandler(expr);
|
|
2571
2609
|
return null;
|
|
2572
2610
|
};
|
|
2573
2611
|
const prepare = options.generateIDs ? prepareRuleGroup : (g) => g;
|
|
@@ -2589,5 +2627,5 @@ function parseCEL(cel, options = {}) {
|
|
|
2589
2627
|
}
|
|
2590
2628
|
|
|
2591
2629
|
//#endregion
|
|
2592
|
-
export { parseCEL };
|
|
2630
|
+
export { celGenerateFlatAndOrList, celGenerateMixedAndOrList, celNormalizeCombinator, celNormalizeOperator, evalCELLiteralValue, getCELIdentifierFromChain, getCELIdentifierFromNegatedChain, isCELAddition, isCELBooleanLiteral, isCELBytesLiteral, isCELConditionalAnd, isCELConditionalExpr, isCELConditionalOr, isCELDivision, isCELDynamicPropertyAccessor, isCELExpressionGroup, isCELExpressionList, isCELFieldInit, isCELFieldInits, isCELFieldsObject, isCELFloatLiteral, isCELFunctionCall, isCELIdentifier, isCELIdentifierOrChain, isCELIntegerLiteral, isCELLikeExpression, isCELList, isCELLiteral, isCELMap, isCELMapInit, isCELMapInits, isCELMember, isCELModulo, isCELMultiplication, isCELNegatedIdentifier, isCELNegatedIdentifierOrChain, isCELNegatedLikeExpression, isCELNegation, isCELNegative, isCELNullLiteral, isCELNumericLiteral, isCELProperty, isCELRelation, isCELStringLiteral, isCELSubtraction, isCELUnsignedIntegerLiteral, parseCEL };
|
|
2593
2631
|
//# sourceMappingURL=parseCEL.mjs.map
|