@react-querybuilder/core 8.11.1 → 8.12.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/{basic-BeKPP0_1.d.ts → basic-DbvrfPNz.d.mts} +39 -4
- package/dist/{basic-B4vXboTG.d.mts → basic-o1-sYjK6.d.ts} +39 -4
- package/dist/chunk-BxBTb9qk.js +39 -0
- package/dist/chunk-DrjzjjTJ.mjs +23 -0
- package/dist/chunk-Dv2ph0Ay.js +23 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +131 -53
- package/dist/cjs/react-querybuilder_core.cjs.development.js +36 -39
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +131 -53
- 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-CqX3rPvj.mjs → convertQuery-Cj4t-LT4.mjs} +2 -2
- package/dist/{convertQuery-CqX3rPvj.mjs.map → convertQuery-Cj4t-LT4.mjs.map} +1 -1
- package/dist/{convertQuery-DAqoID3O.js → convertQuery-DuY_BJHy.js} +3 -3
- package/dist/{convertQuery-DAqoID3O.js.map → convertQuery-DuY_BJHy.js.map} +1 -1
- package/dist/{export-BjRt-qrK.d.mts → export-CCULKoP4.d.mts} +2 -2
- package/dist/{export-CQB0nuvW.d.ts → export-WDHFbiPz.d.ts} +2 -2
- package/dist/formatQuery.d.mts +15 -3
- package/dist/formatQuery.d.ts +15 -3
- package/dist/formatQuery.js +172 -425
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +4 -257
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Dvayhrgj.d.ts → import-BSWb9Vgd.d.ts} +2 -2
- package/dist/{import-Bc_p8ls9.d.mts → import-CLyHpgk8.d.mts} +2 -2
- package/dist/{isRuleGroup-CYcfPgbg.mjs → isRuleGroup-BcfwGaIN.mjs} +1 -1
- package/dist/{isRuleGroup-CYcfPgbg.mjs.map → isRuleGroup-BcfwGaIN.mjs.map} +1 -1
- package/dist/{isRuleGroup-DqAs2x4E.js → isRuleGroup-Do9KKsmt.js} +2 -40
- package/dist/{isRuleGroup-DqAs2x4E.js.map → isRuleGroup-Do9KKsmt.js.map} +1 -1
- package/dist/parseCEL.d.mts +32 -7
- package/dist/parseCEL.d.ts +32 -7
- package/dist/parseCEL.js +181 -12
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +174 -8
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +6 -5
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +3 -3
- package/dist/parseJsonLogic.d.mts +3 -3
- package/dist/parseJsonLogic.d.ts +3 -3
- package/dist/parseJsonLogic.js +10 -11
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +4 -5
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js +20 -21
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +4 -5
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js +10 -13
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +3 -5
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js +7 -7
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +3 -4
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs → prepareQueryObjects-BfnyRV5t.mjs} +4 -3
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs.map → prepareQueryObjects-BfnyRV5t.mjs.map} +1 -1
- package/dist/{prepareQueryObjects-BOUWfel5.js → prepareQueryObjects-DCtJJrF5.js} +14 -13
- package/dist/prepareQueryObjects-DCtJJrF5.js.map +1 -0
- package/dist/react-querybuilder_core.d.mts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.d.ts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.js +43 -21
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +36 -14
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +131 -53
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{transformQuery-DCCpjtyq.mjs → transformQuery-Bq4iyYsE.mjs} +9 -2
- package/dist/{transformQuery-DCCpjtyq.mjs.map → transformQuery-Bq4iyYsE.mjs.map} +1 -1
- package/dist/{transformQuery-CWDPogO5.js → transformQuery-DvJTAvkh.js} +10 -3
- package/dist/{transformQuery-CWDPogO5.js.map → transformQuery-DvJTAvkh.js.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +2 -2
- package/dist/transformQuery.mjs +2 -2
- package/dist/utils-CoYbYnVo.js +706 -0
- package/dist/utils-CoYbYnVo.js.map +1 -0
- package/dist/utils-DxH23QtE.mjs +514 -0
- package/dist/utils-DxH23QtE.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/arrayUtils-A_OXU9W1.mjs +0 -50
- package/dist/arrayUtils-A_OXU9W1.mjs.map +0 -1
- package/dist/arrayUtils-QxZOZTf6.js +0 -73
- package/dist/arrayUtils-QxZOZTf6.js.map +0 -1
- package/dist/optGroupUtils-B0hTpodo.js +0 -251
- package/dist/optGroupUtils-B0hTpodo.js.map +0 -1
- package/dist/optGroupUtils-VeZ3k7-1.mjs +0 -185
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +0 -1
- package/dist/parseNumber-CXdMVNFx.mjs +0 -24
- package/dist/parseNumber-CXdMVNFx.mjs.map +0 -1
- package/dist/parseNumber-D4iQDxK-.js +0 -31
- package/dist/parseNumber-D4iQDxK-.js.map +0 -1
- package/dist/prepareQueryObjects-BOUWfel5.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ValueSources, t as FullField, x as OptionList } from "./basic-
|
|
1
|
+
import { o as ValueSources, t as FullField, x as OptionList } from "./basic-o1-sYjK6.js";
|
|
2
2
|
|
|
3
3
|
//#region src/types/import.d.ts
|
|
4
4
|
|
|
@@ -25,4 +25,4 @@ interface ParserCommonOptions {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
export { ParserCommonOptions as t };
|
|
28
|
-
//# sourceMappingURL=import-
|
|
28
|
+
//# sourceMappingURL=import-BSWb9Vgd.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ValueSources, t as FullField, x as OptionList } from "./basic-
|
|
1
|
+
import { o as ValueSources, t as FullField, x as OptionList } from "./basic-DbvrfPNz.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/types/import.d.ts
|
|
4
4
|
|
|
@@ -25,4 +25,4 @@ interface ParserCommonOptions {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
export { ParserCommonOptions as t };
|
|
28
|
-
//# sourceMappingURL=import-
|
|
28
|
+
//# sourceMappingURL=import-CLyHpgk8.d.mts.map
|
|
@@ -37,4 +37,4 @@ const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
39
|
export { lc as a, isPojo as i, isRuleGroupType as n, nullOrUndefinedOrEmpty as o, isRuleGroupTypeIC as r, numericRegex$1 as s, isRuleGroup as t };
|
|
40
|
-
//# sourceMappingURL=isRuleGroup-
|
|
40
|
+
//# sourceMappingURL=isRuleGroup-BcfwGaIN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRuleGroup-
|
|
1
|
+
{"version":3,"file":"isRuleGroup-BcfwGaIN.mjs","names":["numericRegex: RegExp","numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// istanbul ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n"],"mappings":";;;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAaA,iBAAuB,IAAI,OACtCC,aAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,UAAa,UAAU;;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe"}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
-
key = keys[i];
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
1
|
+
const require_chunk = require('./chunk-BxBTb9qk.js');
|
|
27
2
|
let numeric_quantity = require("numeric-quantity");
|
|
28
|
-
numeric_quantity = __toESM(numeric_quantity);
|
|
29
3
|
|
|
30
4
|
//#region src/utils/misc.ts
|
|
31
5
|
/**
|
|
@@ -63,18 +37,6 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
|
|
|
63
37
|
const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
64
38
|
|
|
65
39
|
//#endregion
|
|
66
|
-
Object.defineProperty(exports, '__commonJS', {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return __commonJS;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, '__toESM', {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return __toESM;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
40
|
Object.defineProperty(exports, 'isPojo', {
|
|
79
41
|
enumerable: true,
|
|
80
42
|
get: function () {
|
|
@@ -117,4 +79,4 @@ Object.defineProperty(exports, 'numericRegex', {
|
|
|
117
79
|
return numericRegex;
|
|
118
80
|
}
|
|
119
81
|
});
|
|
120
|
-
//# sourceMappingURL=isRuleGroup-
|
|
82
|
+
//# sourceMappingURL=isRuleGroup-Do9KKsmt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRuleGroup-
|
|
1
|
+
{"version":3,"file":"isRuleGroup-Do9KKsmt.js","names":["numericRegex: RegExp","numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// istanbul ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n"],"mappings":";;;;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAaA,eAAuB,IAAI,OACtCC,8BAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,UAAa,UAAU;;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe"}
|
package/dist/parseCEL.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Except, _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { C as Except, _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-DbvrfPNz.mjs";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-CLyHpgk8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/parseCEL/types.d.ts
|
|
5
|
-
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression";
|
|
5
|
+
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";
|
|
6
6
|
type CELRelop = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
|
|
7
7
|
interface CELExpression {
|
|
8
8
|
type: CELExpressionType;
|
|
@@ -64,7 +64,7 @@ interface CELNegative extends CELExpression {
|
|
|
64
64
|
interface CELMember extends CELExpression {
|
|
65
65
|
type: "Member";
|
|
66
66
|
value?: CELPrimary;
|
|
67
|
-
left?: CELPrimary | CELMember;
|
|
67
|
+
left?: CELPrimary | CELMember | CELNegation;
|
|
68
68
|
right?: CELIdentifier;
|
|
69
69
|
list?: CELExpressionList;
|
|
70
70
|
}
|
|
@@ -194,6 +194,22 @@ interface CELNegatedLikeExpression extends CELExpression {
|
|
|
194
194
|
value: [CELStringLiteral | CELIdentifier];
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
+
interface CELSubqueryExpression extends CELExpression {
|
|
198
|
+
type: "Member";
|
|
199
|
+
left: CELIdentifier | CELMemberIdentifierChain;
|
|
200
|
+
right: CELIdentifier<"all" | "exists">;
|
|
201
|
+
list: CELExpressionList & {
|
|
202
|
+
value: [CELIdentifier, CELExpression];
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
interface CELNegatedSubqueryExpression extends CELExpression {
|
|
206
|
+
type: "Member";
|
|
207
|
+
left: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain;
|
|
208
|
+
right: CELIdentifier<"all" | "exists">;
|
|
209
|
+
list: CELExpressionList & {
|
|
210
|
+
value: [CELIdentifier, CELExpression];
|
|
211
|
+
};
|
|
212
|
+
}
|
|
197
213
|
type CELNumericLiteral = CELIntegerLiteral | CELUnsignedIntegerLiteral | CELFloatLiteral;
|
|
198
214
|
type CELLiteral = CELStringLiteral | CELBytesLiteral | CELNumericLiteral | CELBooleanLiteral | CELNullLiteral;
|
|
199
215
|
type CELPrimary = CELProperty | CELIdentifier | CELExpressionGroup | CELFunctionCall | CELLiteral | CELList | CELMap;
|
|
@@ -292,12 +308,20 @@ declare const isCELNullLiteral: (expr: CELExpression) => expr is CELNullLiteral;
|
|
|
292
308
|
declare const isCELProperty: (expr: CELExpression) => expr is CELProperty;
|
|
293
309
|
declare const isCELSubtraction: (expr: CELExpression) => expr is CELSubtraction;
|
|
294
310
|
declare const isCELUnsignedIntegerLiteral: (expr: CELExpression) => expr is CELUnsignedIntegerLiteral;
|
|
295
|
-
declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier;
|
|
311
|
+
declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor;
|
|
296
312
|
declare const isCELNegatedIdentifier: (expr: CELExpression) => expr is CELMemberNegatedIdentifier;
|
|
297
313
|
declare const isCELNegatedIdentifierOrChain: (expr: CELExpression) => expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier;
|
|
298
314
|
declare const isCELLikeExpression: (expr: CELExpression) => expr is CELLikeExpression;
|
|
299
315
|
declare const isCELNegatedLikeExpression: (expr: CELExpression) => expr is CELNegatedLikeExpression;
|
|
300
|
-
declare const
|
|
316
|
+
declare const isCELSubqueryExpression: (expr: CELExpression) => expr is CELSubqueryExpression;
|
|
317
|
+
declare const isCELNegatedSubqueryExpression: (expr: CELExpression) => expr is CELNegatedSubqueryExpression;
|
|
318
|
+
declare const extractSubqueryComponents: (expr: CELMember) => {
|
|
319
|
+
field: string;
|
|
320
|
+
method: "all" | "exists";
|
|
321
|
+
alias: string | null;
|
|
322
|
+
condition: CELExpression;
|
|
323
|
+
} | null;
|
|
324
|
+
declare const getCELIdentifierFromChain: (expr: CELIdentifier | CELMemberIdentifierChain | CELDynamicPropertyAccessor | CELMember) => string;
|
|
301
325
|
declare const getCELIdentifierFromNegatedChain: (expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain) => string;
|
|
302
326
|
declare function evalCELLiteralValue(literal: CELStringLiteral): string;
|
|
303
327
|
declare function evalCELLiteralValue(literal: CELBooleanLiteral): boolean;
|
|
@@ -309,6 +333,7 @@ declare const celNormalizeCombinator: (c: "&&" | "||") => DefaultCombinatorName;
|
|
|
309
333
|
declare const celNormalizeOperator: (op: CELRelop, flip?: boolean) => DefaultOperatorName;
|
|
310
334
|
declare const celGenerateFlatAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression)[];
|
|
311
335
|
declare const celGenerateMixedAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression | ("and" | CELExpression)[])[];
|
|
336
|
+
declare const transformAliasInExpression: (expr: CELExpression, alias: string | null) => CELExpression;
|
|
312
337
|
//#endregion
|
|
313
|
-
export { CELAddition, CELBooleanLiteral, CELBytesLiteral, CELConditionalAnd, CELConditionalExpr, CELConditionalOr, CELDivision, CELDynamicPropertyAccessor, CELExpression, CELExpressionGroup, CELExpressionList, CELExpressionType, CELFieldInit, CELFieldInits, CELFieldsObject, CELFloatLiteral, CELFunctionCall, CELIdentifier, CELIntegerLiteral, CELLikeExpression, CELList, CELLiteral, CELMap, CELMapInit, CELMapInits, CELMathOperation, CELMember, CELMemberIdentifierChain, CELMemberNegatedIdentifier, CELMemberNegatedIdentifierChain, CELModulo, CELMultiplication, CELNegatedLikeExpression, CELNegation, CELNegative, CELNullLiteral, CELNumericLiteral, CELPrimary, CELProperty, CELRelation, CELRelop, CELStringLiteral, CELSubtraction, CELUnsignedIntegerLiteral, ParseCELOptions, ParseCELOptionsIC, ParseCELOptionsStandard, ParsedCEL, 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 };
|
|
338
|
+
export { CELAddition, CELBooleanLiteral, CELBytesLiteral, CELConditionalAnd, CELConditionalExpr, CELConditionalOr, CELDivision, CELDynamicPropertyAccessor, CELExpression, CELExpressionGroup, CELExpressionList, CELExpressionType, CELFieldInit, CELFieldInits, CELFieldsObject, CELFloatLiteral, CELFunctionCall, CELIdentifier, CELIntegerLiteral, CELLikeExpression, CELList, CELLiteral, CELMap, CELMapInit, CELMapInits, CELMathOperation, CELMember, CELMemberIdentifierChain, CELMemberNegatedIdentifier, CELMemberNegatedIdentifierChain, CELModulo, CELMultiplication, CELNegatedLikeExpression, CELNegatedSubqueryExpression, CELNegation, CELNegative, CELNullLiteral, CELNumericLiteral, CELPrimary, CELProperty, CELRelation, CELRelop, CELStringLiteral, CELSubqueryExpression, CELSubtraction, CELUnsignedIntegerLiteral, ParseCELOptions, ParseCELOptionsIC, ParseCELOptionsStandard, ParsedCEL, celGenerateFlatAndOrList, celGenerateMixedAndOrList, celNormalizeCombinator, celNormalizeOperator, evalCELLiteralValue, extractSubqueryComponents, 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, isCELNegatedSubqueryExpression, isCELNegation, isCELNegative, isCELNullLiteral, isCELNumericLiteral, isCELProperty, isCELRelation, isCELStringLiteral, isCELSubqueryExpression, isCELSubtraction, isCELUnsignedIntegerLiteral, parseCEL, transformAliasInExpression };
|
|
314
339
|
//# sourceMappingURL=parseCEL.d.mts.map
|
package/dist/parseCEL.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Except, _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { C as Except, _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-o1-sYjK6.js";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-BSWb9Vgd.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/parseCEL/types.d.ts
|
|
5
|
-
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression";
|
|
5
|
+
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";
|
|
6
6
|
type CELRelop = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
|
|
7
7
|
interface CELExpression {
|
|
8
8
|
type: CELExpressionType;
|
|
@@ -64,7 +64,7 @@ interface CELNegative extends CELExpression {
|
|
|
64
64
|
interface CELMember extends CELExpression {
|
|
65
65
|
type: "Member";
|
|
66
66
|
value?: CELPrimary;
|
|
67
|
-
left?: CELPrimary | CELMember;
|
|
67
|
+
left?: CELPrimary | CELMember | CELNegation;
|
|
68
68
|
right?: CELIdentifier;
|
|
69
69
|
list?: CELExpressionList;
|
|
70
70
|
}
|
|
@@ -194,6 +194,22 @@ interface CELNegatedLikeExpression extends CELExpression {
|
|
|
194
194
|
value: [CELStringLiteral | CELIdentifier];
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
+
interface CELSubqueryExpression extends CELExpression {
|
|
198
|
+
type: "Member";
|
|
199
|
+
left: CELIdentifier | CELMemberIdentifierChain;
|
|
200
|
+
right: CELIdentifier<"all" | "exists">;
|
|
201
|
+
list: CELExpressionList & {
|
|
202
|
+
value: [CELIdentifier, CELExpression];
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
interface CELNegatedSubqueryExpression extends CELExpression {
|
|
206
|
+
type: "Member";
|
|
207
|
+
left: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain;
|
|
208
|
+
right: CELIdentifier<"all" | "exists">;
|
|
209
|
+
list: CELExpressionList & {
|
|
210
|
+
value: [CELIdentifier, CELExpression];
|
|
211
|
+
};
|
|
212
|
+
}
|
|
197
213
|
type CELNumericLiteral = CELIntegerLiteral | CELUnsignedIntegerLiteral | CELFloatLiteral;
|
|
198
214
|
type CELLiteral = CELStringLiteral | CELBytesLiteral | CELNumericLiteral | CELBooleanLiteral | CELNullLiteral;
|
|
199
215
|
type CELPrimary = CELProperty | CELIdentifier | CELExpressionGroup | CELFunctionCall | CELLiteral | CELList | CELMap;
|
|
@@ -292,12 +308,20 @@ declare const isCELNullLiteral: (expr: CELExpression) => expr is CELNullLiteral;
|
|
|
292
308
|
declare const isCELProperty: (expr: CELExpression) => expr is CELProperty;
|
|
293
309
|
declare const isCELSubtraction: (expr: CELExpression) => expr is CELSubtraction;
|
|
294
310
|
declare const isCELUnsignedIntegerLiteral: (expr: CELExpression) => expr is CELUnsignedIntegerLiteral;
|
|
295
|
-
declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier;
|
|
311
|
+
declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor;
|
|
296
312
|
declare const isCELNegatedIdentifier: (expr: CELExpression) => expr is CELMemberNegatedIdentifier;
|
|
297
313
|
declare const isCELNegatedIdentifierOrChain: (expr: CELExpression) => expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier;
|
|
298
314
|
declare const isCELLikeExpression: (expr: CELExpression) => expr is CELLikeExpression;
|
|
299
315
|
declare const isCELNegatedLikeExpression: (expr: CELExpression) => expr is CELNegatedLikeExpression;
|
|
300
|
-
declare const
|
|
316
|
+
declare const isCELSubqueryExpression: (expr: CELExpression) => expr is CELSubqueryExpression;
|
|
317
|
+
declare const isCELNegatedSubqueryExpression: (expr: CELExpression) => expr is CELNegatedSubqueryExpression;
|
|
318
|
+
declare const extractSubqueryComponents: (expr: CELMember) => {
|
|
319
|
+
field: string;
|
|
320
|
+
method: "all" | "exists";
|
|
321
|
+
alias: string | null;
|
|
322
|
+
condition: CELExpression;
|
|
323
|
+
} | null;
|
|
324
|
+
declare const getCELIdentifierFromChain: (expr: CELIdentifier | CELMemberIdentifierChain | CELDynamicPropertyAccessor | CELMember) => string;
|
|
301
325
|
declare const getCELIdentifierFromNegatedChain: (expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain) => string;
|
|
302
326
|
declare function evalCELLiteralValue(literal: CELStringLiteral): string;
|
|
303
327
|
declare function evalCELLiteralValue(literal: CELBooleanLiteral): boolean;
|
|
@@ -309,6 +333,7 @@ declare const celNormalizeCombinator: (c: "&&" | "||") => DefaultCombinatorName;
|
|
|
309
333
|
declare const celNormalizeOperator: (op: CELRelop, flip?: boolean) => DefaultOperatorName;
|
|
310
334
|
declare const celGenerateFlatAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression)[];
|
|
311
335
|
declare const celGenerateMixedAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression | ("and" | CELExpression)[])[];
|
|
336
|
+
declare const transformAliasInExpression: (expr: CELExpression, alias: string | null) => CELExpression;
|
|
312
337
|
//#endregion
|
|
313
|
-
export { CELAddition, CELBooleanLiteral, CELBytesLiteral, CELConditionalAnd, CELConditionalExpr, CELConditionalOr, CELDivision, CELDynamicPropertyAccessor, CELExpression, CELExpressionGroup, CELExpressionList, CELExpressionType, CELFieldInit, CELFieldInits, CELFieldsObject, CELFloatLiteral, CELFunctionCall, CELIdentifier, CELIntegerLiteral, CELLikeExpression, CELList, CELLiteral, CELMap, CELMapInit, CELMapInits, CELMathOperation, CELMember, CELMemberIdentifierChain, CELMemberNegatedIdentifier, CELMemberNegatedIdentifierChain, CELModulo, CELMultiplication, CELNegatedLikeExpression, CELNegation, CELNegative, CELNullLiteral, CELNumericLiteral, CELPrimary, CELProperty, CELRelation, CELRelop, CELStringLiteral, CELSubtraction, CELUnsignedIntegerLiteral, ParseCELOptions, ParseCELOptionsIC, ParseCELOptionsStandard, ParsedCEL, 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 };
|
|
338
|
+
export { CELAddition, CELBooleanLiteral, CELBytesLiteral, CELConditionalAnd, CELConditionalExpr, CELConditionalOr, CELDivision, CELDynamicPropertyAccessor, CELExpression, CELExpressionGroup, CELExpressionList, CELExpressionType, CELFieldInit, CELFieldInits, CELFieldsObject, CELFloatLiteral, CELFunctionCall, CELIdentifier, CELIntegerLiteral, CELLikeExpression, CELList, CELLiteral, CELMap, CELMapInit, CELMapInits, CELMathOperation, CELMember, CELMemberIdentifierChain, CELMemberNegatedIdentifier, CELMemberNegatedIdentifierChain, CELModulo, CELMultiplication, CELNegatedLikeExpression, CELNegatedSubqueryExpression, CELNegation, CELNegative, CELNullLiteral, CELNumericLiteral, CELPrimary, CELProperty, CELRelation, CELRelop, CELStringLiteral, CELSubqueryExpression, CELSubtraction, CELUnsignedIntegerLiteral, ParseCELOptions, ParseCELOptionsIC, ParseCELOptionsStandard, ParsedCEL, celGenerateFlatAndOrList, celGenerateMixedAndOrList, celNormalizeCombinator, celNormalizeOperator, evalCELLiteralValue, extractSubqueryComponents, 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, isCELNegatedSubqueryExpression, isCELNegation, isCELNegative, isCELNullLiteral, isCELNumericLiteral, isCELProperty, isCELRelation, isCELStringLiteral, isCELSubqueryExpression, isCELSubtraction, isCELUnsignedIntegerLiteral, parseCEL, transformAliasInExpression };
|
|
314
339
|
//# sourceMappingURL=parseCEL.d.ts.map
|
package/dist/parseCEL.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_prepareQueryObjects = require('./prepareQueryObjects-
|
|
1
|
+
const require_chunk = require('./chunk-BxBTb9qk.js');
|
|
2
|
+
const require_utils = require('./utils-CoYbYnVo.js');
|
|
3
|
+
const require_isRuleGroup = require('./isRuleGroup-Do9KKsmt.js');
|
|
4
|
+
const require_prepareQueryObjects = require('./prepareQueryObjects-DCtJJrF5.js');
|
|
5
5
|
let __ts_jison_parser = require("@ts-jison/parser");
|
|
6
|
-
__ts_jison_parser = require_isRuleGroup.__toESM(__ts_jison_parser);
|
|
7
6
|
let __ts_jison_lexer = require("@ts-jison/lexer");
|
|
8
|
-
__ts_jison_lexer = require_isRuleGroup.__toESM(__ts_jison_lexer);
|
|
9
7
|
|
|
10
8
|
//#region src/utils/parseCEL/celParser.ts
|
|
11
9
|
/**
|
|
@@ -2060,14 +2058,39 @@ const isCELProperty = (expr) => expr.type === "Property";
|
|
|
2060
2058
|
// istanbul ignore next
|
|
2061
2059
|
const isCELSubtraction = (expr) => expr.type === "Subtraction";
|
|
2062
2060
|
const isCELUnsignedIntegerLiteral = (expr) => expr.type === "UnsignedIntegerLiteral";
|
|
2063
|
-
const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
|
|
2061
|
+
const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELDynamicPropertyAccessor(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
|
|
2064
2062
|
const isCELNegatedIdentifier = (expr) => isCELNegation(expr) && isCELIdentifier(expr.value);
|
|
2065
2063
|
const isCELNegatedIdentifierOrChain = (expr) => isCELNegatedIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.right) && isCELNegatedIdentifier(expr.left);
|
|
2066
2064
|
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]));
|
|
2067
2065
|
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]));
|
|
2066
|
+
const isCELSubqueryExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "all" || expr.right.value === "exists") && expr.list.value.length >= 2;
|
|
2067
|
+
const isCELNegatedSubqueryExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELNegatedIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "all" || expr.right.value === "exists") && expr.list.value.length >= 2;
|
|
2068
|
+
const extractSubqueryComponents = (expr) => {
|
|
2069
|
+
// istanbul ignore next
|
|
2070
|
+
if (!isCELSubqueryExpression(expr)) return null;
|
|
2071
|
+
const field = getCELIdentifierFromChain(expr.left);
|
|
2072
|
+
const method = expr.right.value;
|
|
2073
|
+
const [aliasExpr, conditionExpr] = expr.list.value;
|
|
2074
|
+
return {
|
|
2075
|
+
field,
|
|
2076
|
+
method,
|
|
2077
|
+
alias: isCELIdentifier(aliasExpr) ? aliasExpr.value : null,
|
|
2078
|
+
condition: conditionExpr
|
|
2079
|
+
};
|
|
2080
|
+
};
|
|
2068
2081
|
const getCELIdentifierFromChain = (expr) => {
|
|
2069
2082
|
if (isCELIdentifier(expr)) return expr.value;
|
|
2070
|
-
|
|
2083
|
+
if (isCELDynamicPropertyAccessor(expr)) {
|
|
2084
|
+
const leftField = getCELIdentifierFromChain(expr.left);
|
|
2085
|
+
// istanbul ignore else
|
|
2086
|
+
if (isCELStringLiteral(expr.right)) return `${leftField}["${evalCELLiteralValue(expr.right)}"]`;
|
|
2087
|
+
// istanbul ignore next
|
|
2088
|
+
return `${leftField}[${expr.right.type}]`;
|
|
2089
|
+
}
|
|
2090
|
+
// istanbul ignore else
|
|
2091
|
+
if (expr.left && expr.right && isCELIdentifier(expr.right) && (isCELIdentifier(expr.left) || isCELMember(expr.left) || isCELDynamicPropertyAccessor(expr.left))) return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
|
|
2092
|
+
// istanbul ignore next
|
|
2093
|
+
return expr.type;
|
|
2071
2094
|
};
|
|
2072
2095
|
const getCELIdentifierFromNegatedChain = (expr) => {
|
|
2073
2096
|
if (isCELNegatedIdentifier(expr)) return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;
|
|
@@ -2130,6 +2153,102 @@ const celGenerateMixedAndOrList = (expr) => {
|
|
|
2130
2153
|
if (returnArray.length === 1 && Array.isArray(returnArray[0])) return returnArray[0];
|
|
2131
2154
|
return returnArray;
|
|
2132
2155
|
};
|
|
2156
|
+
const isPrimitiveArrayUsage = (expr, alias) => {
|
|
2157
|
+
// istanbul ignore next
|
|
2158
|
+
if (!alias) return false;
|
|
2159
|
+
if (isCELIdentifier(expr) && expr.value === alias) return true;
|
|
2160
|
+
if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) return true;
|
|
2161
|
+
if (isCELRelation(expr) || isCELConditionalAnd(expr) || isCELConditionalOr(expr)) return isPrimitiveArrayUsage(expr.left, alias) || isPrimitiveArrayUsage(expr.right, alias);
|
|
2162
|
+
// istanbul ignore next
|
|
2163
|
+
if (isCELExpressionGroup(expr) || isCELNegation(expr)) return isPrimitiveArrayUsage(expr.value, alias);
|
|
2164
|
+
return false;
|
|
2165
|
+
};
|
|
2166
|
+
const transformAliasInExpressionInternal = (expr, alias, isPrimitive) => {
|
|
2167
|
+
// istanbul ignore next
|
|
2168
|
+
if (!alias) return expr;
|
|
2169
|
+
if (isCELIdentifier(expr) && expr.value === alias) return {
|
|
2170
|
+
type: "Identifier",
|
|
2171
|
+
value: ""
|
|
2172
|
+
};
|
|
2173
|
+
if (isCELMember(expr) && expr.left && isCELIdentifier(expr.left) && expr.left.value === alias) {
|
|
2174
|
+
if (expr.right && isCELIdentifier(expr.right) && !isPrimitive) {
|
|
2175
|
+
if (expr.list) return {
|
|
2176
|
+
type: "Member",
|
|
2177
|
+
left: {
|
|
2178
|
+
type: "Identifier",
|
|
2179
|
+
value: ""
|
|
2180
|
+
},
|
|
2181
|
+
right: expr.right,
|
|
2182
|
+
list: expr.list
|
|
2183
|
+
};
|
|
2184
|
+
return expr.right;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) return {
|
|
2188
|
+
type: "Member",
|
|
2189
|
+
left: {
|
|
2190
|
+
type: "Identifier",
|
|
2191
|
+
value: ""
|
|
2192
|
+
},
|
|
2193
|
+
right: expr.right,
|
|
2194
|
+
list: expr.list
|
|
2195
|
+
};
|
|
2196
|
+
if (isCELNegatedLikeExpression(expr) && expr.left && isCELNegatedIdentifier(expr.left) && expr.left.value.value === alias) return {
|
|
2197
|
+
type: "Member",
|
|
2198
|
+
left: {
|
|
2199
|
+
type: "Negation",
|
|
2200
|
+
negations: expr.left.negations,
|
|
2201
|
+
value: {
|
|
2202
|
+
type: "Identifier",
|
|
2203
|
+
value: ""
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
right: expr.right,
|
|
2207
|
+
list: expr.list
|
|
2208
|
+
};
|
|
2209
|
+
if (isCELMember(expr) && expr.left && expr.right) {
|
|
2210
|
+
const transformedLeft = transformAliasInExpressionInternal(expr.left, alias, isPrimitive);
|
|
2211
|
+
// istanbul ignore else
|
|
2212
|
+
if (transformedLeft !== expr.left) return {
|
|
2213
|
+
type: "Member",
|
|
2214
|
+
left: transformedLeft,
|
|
2215
|
+
right: expr.right,
|
|
2216
|
+
list: expr.list,
|
|
2217
|
+
value: expr.value
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
if (isCELRelation(expr)) return {
|
|
2221
|
+
type: "Relation",
|
|
2222
|
+
left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
|
|
2223
|
+
right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive),
|
|
2224
|
+
operator: expr.operator
|
|
2225
|
+
};
|
|
2226
|
+
if (isCELConditionalAnd(expr)) return {
|
|
2227
|
+
type: "ConditionalAnd",
|
|
2228
|
+
left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
|
|
2229
|
+
right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive)
|
|
2230
|
+
};
|
|
2231
|
+
if (isCELConditionalOr(expr)) return {
|
|
2232
|
+
type: "ConditionalOr",
|
|
2233
|
+
left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
|
|
2234
|
+
right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive)
|
|
2235
|
+
};
|
|
2236
|
+
if (isCELExpressionGroup(expr)) return {
|
|
2237
|
+
type: "ExpressionGroup",
|
|
2238
|
+
value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive)
|
|
2239
|
+
};
|
|
2240
|
+
if (isCELNegation(expr)) return {
|
|
2241
|
+
type: "Negation",
|
|
2242
|
+
negations: expr.negations,
|
|
2243
|
+
value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive)
|
|
2244
|
+
};
|
|
2245
|
+
return expr;
|
|
2246
|
+
};
|
|
2247
|
+
const transformAliasInExpression = (expr, alias) => {
|
|
2248
|
+
// istanbul ignore next
|
|
2249
|
+
if (!alias) return expr;
|
|
2250
|
+
return transformAliasInExpressionInternal(expr, alias, isPrimitiveArrayUsage(expr, alias));
|
|
2251
|
+
};
|
|
2133
2252
|
|
|
2134
2253
|
//#endregion
|
|
2135
2254
|
//#region src/utils/parseCEL/parseCEL.ts
|
|
@@ -2228,6 +2347,52 @@ function parseCEL(cel, options = {}) {
|
|
|
2228
2347
|
operator,
|
|
2229
2348
|
value
|
|
2230
2349
|
};
|
|
2350
|
+
} else if (isCELSubqueryExpression(expr)) {
|
|
2351
|
+
const components = extractSubqueryComponents(expr);
|
|
2352
|
+
// istanbul ignore else
|
|
2353
|
+
if (components) {
|
|
2354
|
+
const { field, method, alias, condition } = components;
|
|
2355
|
+
const matchMode = method === "all" ? "all" : "some";
|
|
2356
|
+
const subqueryValue = processCELExpression(transformAliasInExpression(condition, alias));
|
|
2357
|
+
if (subqueryValue && fieldIsValid(field, "=")) {
|
|
2358
|
+
const ruleGroupValue = require_isRuleGroup.isRuleGroup(subqueryValue) ? subqueryValue : ic ? { rules: [subqueryValue] } : {
|
|
2359
|
+
combinator: "and",
|
|
2360
|
+
rules: [subqueryValue]
|
|
2361
|
+
};
|
|
2362
|
+
return {
|
|
2363
|
+
field,
|
|
2364
|
+
operator: "=",
|
|
2365
|
+
match: { mode: matchMode },
|
|
2366
|
+
value: ruleGroupValue
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
} else if (isCELNegatedSubqueryExpression(expr)) {
|
|
2371
|
+
const field = getCELIdentifierFromNegatedChain(expr.left).replace(/^!+/, "");
|
|
2372
|
+
const method = expr.right.value;
|
|
2373
|
+
const [aliasExpr, conditionExpr] = expr.list.value;
|
|
2374
|
+
const subqueryValue = processCELExpression(transformAliasInExpression(conditionExpr, isCELIdentifier(aliasExpr) ? aliasExpr.value : null));
|
|
2375
|
+
// istanbul ignore else
|
|
2376
|
+
if (subqueryValue && fieldIsValid(field, "=")) {
|
|
2377
|
+
const ruleGroupValue = require_isRuleGroup.isRuleGroup(subqueryValue) ? subqueryValue : ic ? { rules: [subqueryValue] } : {
|
|
2378
|
+
combinator: "and",
|
|
2379
|
+
rules: [subqueryValue]
|
|
2380
|
+
};
|
|
2381
|
+
const subqueryRule = {
|
|
2382
|
+
field,
|
|
2383
|
+
operator: "=",
|
|
2384
|
+
match: { mode: method === "all" ? "all" : "some" },
|
|
2385
|
+
value: ruleGroupValue
|
|
2386
|
+
};
|
|
2387
|
+
return ic ? {
|
|
2388
|
+
not: true,
|
|
2389
|
+
rules: [subqueryRule]
|
|
2390
|
+
} : {
|
|
2391
|
+
combinator: "and",
|
|
2392
|
+
not: true,
|
|
2393
|
+
rules: [subqueryRule]
|
|
2394
|
+
};
|
|
2395
|
+
}
|
|
2231
2396
|
} else if (isCELRelation(expr)) {
|
|
2232
2397
|
let field = null;
|
|
2233
2398
|
let value = void 0;
|
|
@@ -2246,7 +2411,7 @@ function parseCEL(cel, options = {}) {
|
|
|
2246
2411
|
value = evalCELLiteralValue(left);
|
|
2247
2412
|
}
|
|
2248
2413
|
let operator = celNormalizeOperator(expr.operator, flip);
|
|
2249
|
-
if (forwardedNegation) operator =
|
|
2414
|
+
if (forwardedNegation) operator = require_utils.defaultOperatorNegationMap[operator];
|
|
2250
2415
|
if (value === null && (operator === "=" || operator === "!=")) operator = operator === "=" ? "null" : "notNull";
|
|
2251
2416
|
else if ((operator === "in" || operator === "notIn") && isCELList(right)) {
|
|
2252
2417
|
if (right.value.value.every((v) => isCELLiteral(v))) value = right.value.value.map((v) => evalCELLiteralValue(v));
|
|
@@ -2254,13 +2419,13 @@ function parseCEL(cel, options = {}) {
|
|
|
2254
2419
|
valueSource = "field";
|
|
2255
2420
|
value = right.value.value.map((id) => getCELIdentifierFromChain(id));
|
|
2256
2421
|
}
|
|
2257
|
-
if (value && !listsAsArrays) value =
|
|
2422
|
+
if (value && !listsAsArrays) value = require_utils.joinWith(value.map((v) => `${v}`), ",");
|
|
2258
2423
|
} else if ((operator === "in" || operator === "notIn") && isCELMap(right)) {
|
|
2259
2424
|
const keys = right.value.value.map((v) => v.left);
|
|
2260
2425
|
if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getCELIdentifierFromChain(k));
|
|
2261
|
-
if (value && !listsAsArrays) value =
|
|
2426
|
+
if (value && !listsAsArrays) value = require_utils.joinWith(value.map((v) => `${v}`), ",");
|
|
2262
2427
|
}
|
|
2263
|
-
if (field && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
|
|
2428
|
+
if (field !== null && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
|
|
2264
2429
|
field,
|
|
2265
2430
|
operator,
|
|
2266
2431
|
value,
|
|
@@ -2298,6 +2463,7 @@ exports.celGenerateMixedAndOrList = celGenerateMixedAndOrList;
|
|
|
2298
2463
|
exports.celNormalizeCombinator = celNormalizeCombinator;
|
|
2299
2464
|
exports.celNormalizeOperator = celNormalizeOperator;
|
|
2300
2465
|
exports.evalCELLiteralValue = evalCELLiteralValue;
|
|
2466
|
+
exports.extractSubqueryComponents = extractSubqueryComponents;
|
|
2301
2467
|
exports.getCELIdentifierFromChain = getCELIdentifierFromChain;
|
|
2302
2468
|
exports.getCELIdentifierFromNegatedChain = getCELIdentifierFromNegatedChain;
|
|
2303
2469
|
exports.isCELAddition = isCELAddition;
|
|
@@ -2330,6 +2496,7 @@ exports.isCELMultiplication = isCELMultiplication;
|
|
|
2330
2496
|
exports.isCELNegatedIdentifier = isCELNegatedIdentifier;
|
|
2331
2497
|
exports.isCELNegatedIdentifierOrChain = isCELNegatedIdentifierOrChain;
|
|
2332
2498
|
exports.isCELNegatedLikeExpression = isCELNegatedLikeExpression;
|
|
2499
|
+
exports.isCELNegatedSubqueryExpression = isCELNegatedSubqueryExpression;
|
|
2333
2500
|
exports.isCELNegation = isCELNegation;
|
|
2334
2501
|
exports.isCELNegative = isCELNegative;
|
|
2335
2502
|
exports.isCELNullLiteral = isCELNullLiteral;
|
|
@@ -2337,7 +2504,9 @@ exports.isCELNumericLiteral = isCELNumericLiteral;
|
|
|
2337
2504
|
exports.isCELProperty = isCELProperty;
|
|
2338
2505
|
exports.isCELRelation = isCELRelation;
|
|
2339
2506
|
exports.isCELStringLiteral = isCELStringLiteral;
|
|
2507
|
+
exports.isCELSubqueryExpression = isCELSubqueryExpression;
|
|
2340
2508
|
exports.isCELSubtraction = isCELSubtraction;
|
|
2341
2509
|
exports.isCELUnsignedIntegerLiteral = isCELUnsignedIntegerLiteral;
|
|
2342
2510
|
exports.parseCEL = parseCEL;
|
|
2511
|
+
exports.transformAliasInExpression = transformAliasInExpression;
|
|
2343
2512
|
//# sourceMappingURL=parseCEL.js.map
|