@react-querybuilder/core 8.11.0 → 8.11.2

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.
Files changed (101) hide show
  1. package/dist/basic-BeKPP0_1.d.ts +1257 -0
  2. package/dist/basic-CLG_Bmom.d.mts +1257 -0
  3. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +14 -2
  4. package/dist/cjs/react-querybuilder_core.cjs.development.js +23 -11
  5. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  6. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +14 -2
  7. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  8. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  9. package/dist/{convertQuery-DAqoID3O.js → convertQuery-C7NvB0XA.js} +1 -1
  10. package/dist/{convertQuery-DAqoID3O.js.map → convertQuery-C7NvB0XA.js.map} +1 -1
  11. package/dist/{convertQuery-CqX3rPvj.mjs → convertQuery-Cj4t-LT4.mjs} +2 -2
  12. package/dist/{convertQuery-CqX3rPvj.mjs.map → convertQuery-Cj4t-LT4.mjs.map} +1 -1
  13. package/dist/{export-Dy4FckB-.d.ts → export-B2Yw5gak.d.mts} +2 -3
  14. package/dist/{export-t1V2N8pz.d.mts → export-CQB0nuvW.d.ts} +2 -3
  15. package/dist/formatQuery.d.mts +15 -4
  16. package/dist/formatQuery.d.ts +15 -4
  17. package/dist/formatQuery.js +170 -423
  18. package/dist/formatQuery.js.map +1 -1
  19. package/dist/formatQuery.mjs +4 -257
  20. package/dist/formatQuery.mjs.map +1 -1
  21. package/dist/{import-Cz8canKo.d.mts → import-BtpySRSy.d.mts} +2 -2
  22. package/dist/{import-DtS9Ocx5.d.ts → import-Dvayhrgj.d.ts} +2 -2
  23. package/dist/{isRuleGroup-CYcfPgbg.mjs → isRuleGroup-BcfwGaIN.mjs} +1 -1
  24. package/dist/{isRuleGroup-CYcfPgbg.mjs.map → isRuleGroup-BcfwGaIN.mjs.map} +1 -1
  25. package/dist/parseCEL.d.mts +32 -8
  26. package/dist/parseCEL.d.ts +32 -8
  27. package/dist/parseCEL.js +175 -15
  28. package/dist/parseCEL.js.map +1 -1
  29. package/dist/parseCEL.mjs +163 -8
  30. package/dist/parseCEL.mjs.map +1 -1
  31. package/dist/parseJSONata.d.mts +2 -3
  32. package/dist/parseJSONata.d.ts +2 -3
  33. package/dist/parseJSONata.js +2 -2
  34. package/dist/parseJSONata.mjs +3 -3
  35. package/dist/parseJsonLogic.d.mts +4 -4
  36. package/dist/parseJsonLogic.d.ts +4 -4
  37. package/dist/parseJsonLogic.js +9 -10
  38. package/dist/parseJsonLogic.js.map +1 -1
  39. package/dist/parseJsonLogic.mjs +4 -5
  40. package/dist/parseJsonLogic.mjs.map +1 -1
  41. package/dist/parseMongoDB.d.mts +2 -3
  42. package/dist/parseMongoDB.d.ts +2 -3
  43. package/dist/parseMongoDB.js +19 -20
  44. package/dist/parseMongoDB.js.map +1 -1
  45. package/dist/parseMongoDB.mjs +4 -5
  46. package/dist/parseMongoDB.mjs.map +1 -1
  47. package/dist/parseSQL.d.mts +2 -3
  48. package/dist/parseSQL.d.ts +2 -3
  49. package/dist/parseSQL.js +15 -16
  50. package/dist/parseSQL.js.map +1 -1
  51. package/dist/parseSQL.mjs +3 -5
  52. package/dist/parseSQL.mjs.map +1 -1
  53. package/dist/parseSpEL.d.mts +2 -3
  54. package/dist/parseSpEL.d.ts +2 -3
  55. package/dist/parseSpEL.js +3 -4
  56. package/dist/parseSpEL.js.map +1 -1
  57. package/dist/parseSpEL.mjs +3 -4
  58. package/dist/parseSpEL.mjs.map +1 -1
  59. package/dist/{prepareQueryObjects-DPCC-iHp.mjs → prepareQueryObjects-BfnyRV5t.mjs} +4 -3
  60. package/dist/{prepareQueryObjects-DPCC-iHp.mjs.map → prepareQueryObjects-BfnyRV5t.mjs.map} +1 -1
  61. package/dist/{prepareQueryObjects-BOUWfel5.js → prepareQueryObjects-Cz_28zYz.js} +12 -11
  62. package/dist/prepareQueryObjects-Cz_28zYz.js.map +1 -0
  63. package/dist/react-querybuilder_core.d.mts +14 -2
  64. package/dist/react-querybuilder_core.legacy-esm.d.ts +14 -2
  65. package/dist/react-querybuilder_core.legacy-esm.js +23 -11
  66. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  67. package/dist/react-querybuilder_core.mjs +23 -11
  68. package/dist/react-querybuilder_core.mjs.map +1 -1
  69. package/dist/react-querybuilder_core.production.d.mts +14 -2
  70. package/dist/react-querybuilder_core.production.mjs +1 -1
  71. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  72. package/dist/{transformQuery-CWDPogO5.js → transformQuery-B4SaTTO-.js} +1 -1
  73. package/dist/{transformQuery-CWDPogO5.js.map → transformQuery-B4SaTTO-.js.map} +1 -1
  74. package/dist/{transformQuery-DCCpjtyq.mjs → transformQuery-C85j__7e.mjs} +2 -2
  75. package/dist/{transformQuery-DCCpjtyq.mjs.map → transformQuery-C85j__7e.mjs.map} +1 -1
  76. package/dist/transformQuery.d.mts +1 -1
  77. package/dist/transformQuery.d.ts +1 -1
  78. package/dist/transformQuery.js +1 -1
  79. package/dist/transformQuery.mjs +2 -2
  80. package/dist/utils-Dkz3Xn2D.js +707 -0
  81. package/dist/utils-Dkz3Xn2D.js.map +1 -0
  82. package/dist/utils-DxH23QtE.mjs +514 -0
  83. package/dist/utils-DxH23QtE.mjs.map +1 -0
  84. package/package.json +10 -8
  85. package/dist/arrayUtils-A_OXU9W1.mjs +0 -50
  86. package/dist/arrayUtils-A_OXU9W1.mjs.map +0 -1
  87. package/dist/arrayUtils-QxZOZTf6.js +0 -73
  88. package/dist/arrayUtils-QxZOZTf6.js.map +0 -1
  89. package/dist/basic-DEc65Kng.d.mts +0 -363
  90. package/dist/basic-Dd_M2f3M.d.ts +0 -363
  91. package/dist/lexer-C53tqS2p.js +0 -406
  92. package/dist/lexer-C53tqS2p.js.map +0 -1
  93. package/dist/optGroupUtils-B0hTpodo.js +0 -251
  94. package/dist/optGroupUtils-B0hTpodo.js.map +0 -1
  95. package/dist/optGroupUtils-VeZ3k7-1.mjs +0 -185
  96. package/dist/optGroupUtils-VeZ3k7-1.mjs.map +0 -1
  97. package/dist/parseNumber-CXdMVNFx.mjs +0 -24
  98. package/dist/parseNumber-CXdMVNFx.mjs.map +0 -1
  99. package/dist/parseNumber-D4iQDxK-.js +0 -31
  100. package/dist/parseNumber-D4iQDxK-.js.map +0 -1
  101. 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-DEc65Kng.mjs";
1
+ import { o as ValueSources, t as FullField, x as OptionList } from "./basic-CLG_Bmom.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-Cz8canKo.d.mts.map
28
+ //# sourceMappingURL=import-BtpySRSy.d.mts.map
@@ -1,4 +1,4 @@
1
- import { o as ValueSources, t as FullField, x as OptionList } from "./basic-Dd_M2f3M.js";
1
+ import { o as ValueSources, t as FullField, x as OptionList } from "./basic-BeKPP0_1.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-DtS9Ocx5.d.ts.map
28
+ //# sourceMappingURL=import-Dvayhrgj.d.ts.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-CYcfPgbg.mjs.map
40
+ //# sourceMappingURL=isRuleGroup-BcfwGaIN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRuleGroup-CYcfPgbg.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
+ {"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,9 +1,8 @@
1
- import { _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-DEc65Kng.mjs";
2
- import { t as ParserCommonOptions } from "./import-Cz8canKo.mjs";
3
- import { Except } from "type-fest";
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-CLG_Bmom.mjs";
2
+ import { t as ParserCommonOptions } from "./import-BtpySRSy.mjs";
4
3
 
5
4
  //#region src/utils/parseCEL/types.d.ts
6
- 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";
7
6
  type CELRelop = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
8
7
  interface CELExpression {
9
8
  type: CELExpressionType;
@@ -65,7 +64,7 @@ interface CELNegative extends CELExpression {
65
64
  interface CELMember extends CELExpression {
66
65
  type: "Member";
67
66
  value?: CELPrimary;
68
- left?: CELPrimary | CELMember;
67
+ left?: CELPrimary | CELMember | CELNegation;
69
68
  right?: CELIdentifier;
70
69
  list?: CELExpressionList;
71
70
  }
@@ -195,6 +194,22 @@ interface CELNegatedLikeExpression extends CELExpression {
195
194
  value: [CELStringLiteral | CELIdentifier];
196
195
  };
197
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
+ }
198
213
  type CELNumericLiteral = CELIntegerLiteral | CELUnsignedIntegerLiteral | CELFloatLiteral;
199
214
  type CELLiteral = CELStringLiteral | CELBytesLiteral | CELNumericLiteral | CELBooleanLiteral | CELNullLiteral;
200
215
  type CELPrimary = CELProperty | CELIdentifier | CELExpressionGroup | CELFunctionCall | CELLiteral | CELList | CELMap;
@@ -293,12 +308,20 @@ declare const isCELNullLiteral: (expr: CELExpression) => expr is CELNullLiteral;
293
308
  declare const isCELProperty: (expr: CELExpression) => expr is CELProperty;
294
309
  declare const isCELSubtraction: (expr: CELExpression) => expr is CELSubtraction;
295
310
  declare const isCELUnsignedIntegerLiteral: (expr: CELExpression) => expr is CELUnsignedIntegerLiteral;
296
- declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier;
311
+ declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor;
297
312
  declare const isCELNegatedIdentifier: (expr: CELExpression) => expr is CELMemberNegatedIdentifier;
298
313
  declare const isCELNegatedIdentifierOrChain: (expr: CELExpression) => expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier;
299
314
  declare const isCELLikeExpression: (expr: CELExpression) => expr is CELLikeExpression;
300
315
  declare const isCELNegatedLikeExpression: (expr: CELExpression) => expr is CELNegatedLikeExpression;
301
- declare const getCELIdentifierFromChain: (expr: CELIdentifier | CELMemberIdentifierChain) => string;
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;
302
325
  declare const getCELIdentifierFromNegatedChain: (expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain) => string;
303
326
  declare function evalCELLiteralValue(literal: CELStringLiteral): string;
304
327
  declare function evalCELLiteralValue(literal: CELBooleanLiteral): boolean;
@@ -310,6 +333,7 @@ declare const celNormalizeCombinator: (c: "&&" | "||") => DefaultCombinatorName;
310
333
  declare const celNormalizeOperator: (op: CELRelop, flip?: boolean) => DefaultOperatorName;
311
334
  declare const celGenerateFlatAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression)[];
312
335
  declare const celGenerateMixedAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression | ("and" | CELExpression)[])[];
336
+ declare const transformAliasInExpression: (expr: CELExpression, alias: string | null) => CELExpression;
313
337
  //#endregion
314
- 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 };
315
339
  //# sourceMappingURL=parseCEL.d.mts.map
@@ -1,9 +1,8 @@
1
- import { _ as RuleGroupType, d as DefaultRuleGroupTypeIC, g as DefaultRuleGroupType, h as DefaultOperatorName, m as DefaultCombinatorName, p as RuleGroupTypeIC, v as RuleType } from "./basic-Dd_M2f3M.js";
2
- import { t as ParserCommonOptions } from "./import-DtS9Ocx5.js";
3
- import { Except } from "type-fest";
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-BeKPP0_1.js";
2
+ import { t as ParserCommonOptions } from "./import-Dvayhrgj.js";
4
3
 
5
4
  //#region src/utils/parseCEL/types.d.ts
6
- 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";
7
6
  type CELRelop = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
8
7
  interface CELExpression {
9
8
  type: CELExpressionType;
@@ -65,7 +64,7 @@ interface CELNegative extends CELExpression {
65
64
  interface CELMember extends CELExpression {
66
65
  type: "Member";
67
66
  value?: CELPrimary;
68
- left?: CELPrimary | CELMember;
67
+ left?: CELPrimary | CELMember | CELNegation;
69
68
  right?: CELIdentifier;
70
69
  list?: CELExpressionList;
71
70
  }
@@ -195,6 +194,22 @@ interface CELNegatedLikeExpression extends CELExpression {
195
194
  value: [CELStringLiteral | CELIdentifier];
196
195
  };
197
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
+ }
198
213
  type CELNumericLiteral = CELIntegerLiteral | CELUnsignedIntegerLiteral | CELFloatLiteral;
199
214
  type CELLiteral = CELStringLiteral | CELBytesLiteral | CELNumericLiteral | CELBooleanLiteral | CELNullLiteral;
200
215
  type CELPrimary = CELProperty | CELIdentifier | CELExpressionGroup | CELFunctionCall | CELLiteral | CELList | CELMap;
@@ -293,12 +308,20 @@ declare const isCELNullLiteral: (expr: CELExpression) => expr is CELNullLiteral;
293
308
  declare const isCELProperty: (expr: CELExpression) => expr is CELProperty;
294
309
  declare const isCELSubtraction: (expr: CELExpression) => expr is CELSubtraction;
295
310
  declare const isCELUnsignedIntegerLiteral: (expr: CELExpression) => expr is CELUnsignedIntegerLiteral;
296
- declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier;
311
+ declare const isCELIdentifierOrChain: (expr: CELExpression) => expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor;
297
312
  declare const isCELNegatedIdentifier: (expr: CELExpression) => expr is CELMemberNegatedIdentifier;
298
313
  declare const isCELNegatedIdentifierOrChain: (expr: CELExpression) => expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier;
299
314
  declare const isCELLikeExpression: (expr: CELExpression) => expr is CELLikeExpression;
300
315
  declare const isCELNegatedLikeExpression: (expr: CELExpression) => expr is CELNegatedLikeExpression;
301
- declare const getCELIdentifierFromChain: (expr: CELIdentifier | CELMemberIdentifierChain) => string;
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;
302
325
  declare const getCELIdentifierFromNegatedChain: (expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain) => string;
303
326
  declare function evalCELLiteralValue(literal: CELStringLiteral): string;
304
327
  declare function evalCELLiteralValue(literal: CELBooleanLiteral): boolean;
@@ -310,6 +333,7 @@ declare const celNormalizeCombinator: (c: "&&" | "||") => DefaultCombinatorName;
310
333
  declare const celNormalizeOperator: (op: CELRelop, flip?: boolean) => DefaultOperatorName;
311
334
  declare const celGenerateFlatAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression)[];
312
335
  declare const celGenerateMixedAndOrList: (expr: CELConditionalAnd | CELConditionalOr) => (DefaultCombinatorName | CELExpression | ("and" | CELExpression)[])[];
336
+ declare const transformAliasInExpression: (expr: CELExpression, alias: string | null) => CELExpression;
313
337
  //#endregion
314
- 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 };
315
339
  //# sourceMappingURL=parseCEL.d.ts.map
package/dist/parseCEL.js CHANGED
@@ -1,17 +1,17 @@
1
1
  const require_isRuleGroup = require('./isRuleGroup-DqAs2x4E.js');
2
- const require_optGroupUtils = require('./optGroupUtils-B0hTpodo.js');
3
- const require_arrayUtils = require('./arrayUtils-QxZOZTf6.js');
4
- const require_prepareQueryObjects = require('./prepareQueryObjects-BOUWfel5.js');
5
- const require_lexer$1 = require('./lexer-C53tqS2p.js');
2
+ const require_utils = require('./utils-Dkz3Xn2D.js');
3
+ const require_prepareQueryObjects = require('./prepareQueryObjects-Cz_28zYz.js');
4
+ let __ts_jison_parser = require("@ts-jison/parser");
5
+ __ts_jison_parser = require_isRuleGroup.__toESM(__ts_jison_parser);
6
+ let __ts_jison_lexer = require("@ts-jison/lexer");
7
+ __ts_jison_lexer = require_isRuleGroup.__toESM(__ts_jison_lexer);
6
8
 
7
9
  //#region src/utils/parseCEL/celParser.ts
8
- var import_parser = /* @__PURE__ */ require_isRuleGroup.__toESM(require_lexer$1.require_parser());
9
- var import_lexer = /* @__PURE__ */ require_isRuleGroup.__toESM(require_lexer$1.require_lexer());
10
10
  /**
11
11
  * parser generated by @ts-jison/parser-generator 0.4.1-alpha.2
12
12
  * @returns Parser implementing JisonParserApi and a Lexer implementing JisonLexerApi.
13
13
  */
14
- var CELParser = class extends import_parser.JisonParser {
14
+ var CELParser = class extends __ts_jison_parser.JisonParser {
15
15
  $;
16
16
  symbols_ = {
17
17
  "error": 2,
@@ -276,7 +276,7 @@ var CELParser = class extends import_parser.JisonParser {
276
276
  62,
277
277
  63
278
278
  ], $Vx = [2, 37], $Vy = [49, 50];
279
- const o = import_parser.JisonParser.expandParseTable;
279
+ const o = __ts_jison_parser.JisonParser.expandParseTable;
280
280
  this.table = [
281
281
  {
282
282
  3: 1,
@@ -1810,7 +1810,7 @@ var CELParser = class extends import_parser.JisonParser {
1810
1810
  }
1811
1811
  }
1812
1812
  };
1813
- var CELLexer = class extends import_lexer.JisonLexer {
1813
+ var CELLexer = class extends __ts_jison_lexer.JisonLexer {
1814
1814
  options = {
1815
1815
  "flex": true,
1816
1816
  "moduleName": "CEL"
@@ -2059,14 +2059,39 @@ const isCELProperty = (expr) => expr.type === "Property";
2059
2059
  // istanbul ignore next
2060
2060
  const isCELSubtraction = (expr) => expr.type === "Subtraction";
2061
2061
  const isCELUnsignedIntegerLiteral = (expr) => expr.type === "UnsignedIntegerLiteral";
2062
- const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
2062
+ const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELDynamicPropertyAccessor(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
2063
2063
  const isCELNegatedIdentifier = (expr) => isCELNegation(expr) && isCELIdentifier(expr.value);
2064
2064
  const isCELNegatedIdentifierOrChain = (expr) => isCELNegatedIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.right) && isCELNegatedIdentifier(expr.left);
2065
2065
  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]));
2066
2066
  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]));
2067
+ 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;
2068
+ 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;
2069
+ const extractSubqueryComponents = (expr) => {
2070
+ // istanbul ignore next
2071
+ if (!isCELSubqueryExpression(expr)) return null;
2072
+ const field = getCELIdentifierFromChain(expr.left);
2073
+ const method = expr.right.value;
2074
+ const [aliasExpr, conditionExpr] = expr.list.value;
2075
+ return {
2076
+ field,
2077
+ method,
2078
+ alias: isCELIdentifier(aliasExpr) ? aliasExpr.value : null,
2079
+ condition: conditionExpr
2080
+ };
2081
+ };
2067
2082
  const getCELIdentifierFromChain = (expr) => {
2068
2083
  if (isCELIdentifier(expr)) return expr.value;
2069
- return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
2084
+ if (isCELDynamicPropertyAccessor(expr)) {
2085
+ const leftField = getCELIdentifierFromChain(expr.left);
2086
+ // istanbul ignore else
2087
+ if (isCELStringLiteral(expr.right)) return `${leftField}["${evalCELLiteralValue(expr.right)}"]`;
2088
+ // istanbul ignore next
2089
+ return `${leftField}[${expr.right.type}]`;
2090
+ }
2091
+ // istanbul ignore else
2092
+ if (expr.left && expr.right && isCELIdentifier(expr.right) && (isCELIdentifier(expr.left) || isCELMember(expr.left) || isCELDynamicPropertyAccessor(expr.left))) return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
2093
+ // istanbul ignore next
2094
+ return expr.type;
2070
2095
  };
2071
2096
  const getCELIdentifierFromNegatedChain = (expr) => {
2072
2097
  if (isCELNegatedIdentifier(expr)) return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;
@@ -2129,6 +2154,91 @@ const celGenerateMixedAndOrList = (expr) => {
2129
2154
  if (returnArray.length === 1 && Array.isArray(returnArray[0])) return returnArray[0];
2130
2155
  return returnArray;
2131
2156
  };
2157
+ const isPrimitiveArrayUsage = (expr, alias) => {
2158
+ // istanbul ignore next
2159
+ if (!alias) return false;
2160
+ if (isCELIdentifier(expr) && expr.value === alias) return true;
2161
+ if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) return true;
2162
+ if (isCELRelation(expr) || isCELConditionalAnd(expr) || isCELConditionalOr(expr)) return isPrimitiveArrayUsage(expr.left, alias) || isPrimitiveArrayUsage(expr.right, alias);
2163
+ // istanbul ignore next
2164
+ if (isCELExpressionGroup(expr) || isCELNegation(expr)) return isPrimitiveArrayUsage(expr.value, alias);
2165
+ return false;
2166
+ };
2167
+ const transformAliasInExpressionInternal = (expr, alias, isPrimitive) => {
2168
+ // istanbul ignore next
2169
+ if (!alias) return expr;
2170
+ if (isCELIdentifier(expr) && expr.value === alias) return {
2171
+ type: "Identifier",
2172
+ value: ""
2173
+ };
2174
+ if (isCELMember(expr) && expr.left && isCELIdentifier(expr.left) && expr.left.value === alias) {
2175
+ if (expr.right && isCELIdentifier(expr.right) && !isPrimitive) return expr.right;
2176
+ }
2177
+ if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) return {
2178
+ type: "Member",
2179
+ left: {
2180
+ type: "Identifier",
2181
+ value: ""
2182
+ },
2183
+ right: expr.right,
2184
+ list: expr.list
2185
+ };
2186
+ if (isCELNegatedLikeExpression(expr) && expr.left && isCELNegatedIdentifier(expr.left) && expr.left.value.value === alias) return {
2187
+ type: "Member",
2188
+ left: {
2189
+ type: "Negation",
2190
+ negations: expr.left.negations,
2191
+ value: {
2192
+ type: "Identifier",
2193
+ value: ""
2194
+ }
2195
+ },
2196
+ right: expr.right,
2197
+ list: expr.list
2198
+ };
2199
+ if (isCELMember(expr) && expr.left && expr.right) {
2200
+ const transformedLeft = transformAliasInExpressionInternal(expr.left, alias, isPrimitive);
2201
+ // istanbul ignore else
2202
+ if (transformedLeft !== expr.left) return {
2203
+ type: "Member",
2204
+ left: transformedLeft,
2205
+ right: expr.right,
2206
+ list: expr.list,
2207
+ value: expr.value
2208
+ };
2209
+ }
2210
+ if (isCELRelation(expr)) return {
2211
+ type: "Relation",
2212
+ left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
2213
+ right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive),
2214
+ operator: expr.operator
2215
+ };
2216
+ if (isCELConditionalAnd(expr)) return {
2217
+ type: "ConditionalAnd",
2218
+ left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
2219
+ right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive)
2220
+ };
2221
+ if (isCELConditionalOr(expr)) return {
2222
+ type: "ConditionalOr",
2223
+ left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),
2224
+ right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive)
2225
+ };
2226
+ if (isCELExpressionGroup(expr)) return {
2227
+ type: "ExpressionGroup",
2228
+ value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive)
2229
+ };
2230
+ if (isCELNegation(expr)) return {
2231
+ type: "Negation",
2232
+ negations: expr.negations,
2233
+ value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive)
2234
+ };
2235
+ return expr;
2236
+ };
2237
+ const transformAliasInExpression = (expr, alias) => {
2238
+ // istanbul ignore next
2239
+ if (!alias) return expr;
2240
+ return transformAliasInExpressionInternal(expr, alias, isPrimitiveArrayUsage(expr, alias));
2241
+ };
2132
2242
 
2133
2243
  //#endregion
2134
2244
  //#region src/utils/parseCEL/parseCEL.ts
@@ -2227,6 +2337,52 @@ function parseCEL(cel, options = {}) {
2227
2337
  operator,
2228
2338
  value
2229
2339
  };
2340
+ } else if (isCELSubqueryExpression(expr)) {
2341
+ const components = extractSubqueryComponents(expr);
2342
+ // istanbul ignore else
2343
+ if (components) {
2344
+ const { field, method, alias, condition } = components;
2345
+ const matchMode = method === "all" ? "all" : "some";
2346
+ const subqueryValue = processCELExpression(transformAliasInExpression(condition, alias));
2347
+ if (subqueryValue && fieldIsValid(field, "=")) {
2348
+ const ruleGroupValue = require_isRuleGroup.isRuleGroup(subqueryValue) ? subqueryValue : ic ? { rules: [subqueryValue] } : {
2349
+ combinator: "and",
2350
+ rules: [subqueryValue]
2351
+ };
2352
+ return {
2353
+ field,
2354
+ operator: "=",
2355
+ match: { mode: matchMode },
2356
+ value: ruleGroupValue
2357
+ };
2358
+ }
2359
+ }
2360
+ } else if (isCELNegatedSubqueryExpression(expr)) {
2361
+ const field = getCELIdentifierFromNegatedChain(expr.left).replace(/^!+/, "");
2362
+ const method = expr.right.value;
2363
+ const [aliasExpr, conditionExpr] = expr.list.value;
2364
+ const subqueryValue = processCELExpression(transformAliasInExpression(conditionExpr, isCELIdentifier(aliasExpr) ? aliasExpr.value : null));
2365
+ // istanbul ignore else
2366
+ if (subqueryValue && fieldIsValid(field, "=")) {
2367
+ const ruleGroupValue = require_isRuleGroup.isRuleGroup(subqueryValue) ? subqueryValue : ic ? { rules: [subqueryValue] } : {
2368
+ combinator: "and",
2369
+ rules: [subqueryValue]
2370
+ };
2371
+ const subqueryRule = {
2372
+ field,
2373
+ operator: "=",
2374
+ match: { mode: method === "all" ? "all" : "some" },
2375
+ value: ruleGroupValue
2376
+ };
2377
+ return ic ? {
2378
+ not: true,
2379
+ rules: [subqueryRule]
2380
+ } : {
2381
+ combinator: "and",
2382
+ not: true,
2383
+ rules: [subqueryRule]
2384
+ };
2385
+ }
2230
2386
  } else if (isCELRelation(expr)) {
2231
2387
  let field = null;
2232
2388
  let value = void 0;
@@ -2245,7 +2401,7 @@ function parseCEL(cel, options = {}) {
2245
2401
  value = evalCELLiteralValue(left);
2246
2402
  }
2247
2403
  let operator = celNormalizeOperator(expr.operator, flip);
2248
- if (forwardedNegation) operator = require_optGroupUtils.defaultOperatorNegationMap[operator];
2404
+ if (forwardedNegation) operator = require_utils.defaultOperatorNegationMap[operator];
2249
2405
  if (value === null && (operator === "=" || operator === "!=")) operator = operator === "=" ? "null" : "notNull";
2250
2406
  else if ((operator === "in" || operator === "notIn") && isCELList(right)) {
2251
2407
  if (right.value.value.every((v) => isCELLiteral(v))) value = right.value.value.map((v) => evalCELLiteralValue(v));
@@ -2253,13 +2409,13 @@ function parseCEL(cel, options = {}) {
2253
2409
  valueSource = "field";
2254
2410
  value = right.value.value.map((id) => getCELIdentifierFromChain(id));
2255
2411
  }
2256
- if (value && !listsAsArrays) value = require_arrayUtils.joinWith(value.map((v) => `${v}`), ",");
2412
+ if (value && !listsAsArrays) value = require_utils.joinWith(value.map((v) => `${v}`), ",");
2257
2413
  } else if ((operator === "in" || operator === "notIn") && isCELMap(right)) {
2258
2414
  const keys = right.value.value.map((v) => v.left);
2259
2415
  if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getCELIdentifierFromChain(k));
2260
- if (value && !listsAsArrays) value = require_arrayUtils.joinWith(value.map((v) => `${v}`), ",");
2416
+ if (value && !listsAsArrays) value = require_utils.joinWith(value.map((v) => `${v}`), ",");
2261
2417
  }
2262
- if (field && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
2418
+ if (field !== null && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
2263
2419
  field,
2264
2420
  operator,
2265
2421
  value,
@@ -2297,6 +2453,7 @@ exports.celGenerateMixedAndOrList = celGenerateMixedAndOrList;
2297
2453
  exports.celNormalizeCombinator = celNormalizeCombinator;
2298
2454
  exports.celNormalizeOperator = celNormalizeOperator;
2299
2455
  exports.evalCELLiteralValue = evalCELLiteralValue;
2456
+ exports.extractSubqueryComponents = extractSubqueryComponents;
2300
2457
  exports.getCELIdentifierFromChain = getCELIdentifierFromChain;
2301
2458
  exports.getCELIdentifierFromNegatedChain = getCELIdentifierFromNegatedChain;
2302
2459
  exports.isCELAddition = isCELAddition;
@@ -2329,6 +2486,7 @@ exports.isCELMultiplication = isCELMultiplication;
2329
2486
  exports.isCELNegatedIdentifier = isCELNegatedIdentifier;
2330
2487
  exports.isCELNegatedIdentifierOrChain = isCELNegatedIdentifierOrChain;
2331
2488
  exports.isCELNegatedLikeExpression = isCELNegatedLikeExpression;
2489
+ exports.isCELNegatedSubqueryExpression = isCELNegatedSubqueryExpression;
2332
2490
  exports.isCELNegation = isCELNegation;
2333
2491
  exports.isCELNegative = isCELNegative;
2334
2492
  exports.isCELNullLiteral = isCELNullLiteral;
@@ -2336,7 +2494,9 @@ exports.isCELNumericLiteral = isCELNumericLiteral;
2336
2494
  exports.isCELProperty = isCELProperty;
2337
2495
  exports.isCELRelation = isCELRelation;
2338
2496
  exports.isCELStringLiteral = isCELStringLiteral;
2497
+ exports.isCELSubqueryExpression = isCELSubqueryExpression;
2339
2498
  exports.isCELSubtraction = isCELSubtraction;
2340
2499
  exports.isCELUnsignedIntegerLiteral = isCELUnsignedIntegerLiteral;
2341
2500
  exports.parseCEL = parseCEL;
2501
+ exports.transformAliasInExpression = transformAliasInExpression;
2342
2502
  //# sourceMappingURL=parseCEL.js.map