@react-querybuilder/core 8.12.0 → 8.14.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.
Files changed (89) hide show
  1. package/dist/{basic-o1-sYjK6.d.ts → basic-Dxm6jWFu.d.ts} +94 -104
  2. package/dist/{basic-DbvrfPNz.d.mts → basic-GFsWfi0Z.d.mts} +94 -104
  3. package/dist/{chunk-BxBTb9qk.js → chunk-U64pC571.js} +13 -11
  4. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +119 -118
  5. package/dist/cjs/react-querybuilder_core.cjs.development.js +39 -10
  6. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  7. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +119 -118
  8. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  9. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  10. package/dist/{convertQuery-Cj4t-LT4.mjs → convertQuery-DAj92cbM.mjs} +3 -3
  11. package/dist/{convertQuery-Cj4t-LT4.mjs.map → convertQuery-DAj92cbM.mjs.map} +1 -1
  12. package/dist/{convertQuery-DuY_BJHy.js → convertQuery-DRldbzhZ.js} +4 -4
  13. package/dist/{convertQuery-DuY_BJHy.js.map → convertQuery-DRldbzhZ.js.map} +1 -1
  14. package/dist/{export-WDHFbiPz.d.ts → export-6VbkhCrf.d.ts} +2 -2
  15. package/dist/{export-CCULKoP4.d.mts → export-_wipiqJZ.d.mts} +2 -2
  16. package/dist/formatQuery.d.mts +2 -2
  17. package/dist/formatQuery.d.ts +2 -2
  18. package/dist/formatQuery.js +43 -14
  19. package/dist/formatQuery.js.map +1 -1
  20. package/dist/formatQuery.mjs +42 -13
  21. package/dist/formatQuery.mjs.map +1 -1
  22. package/dist/{import-BSWb9Vgd.d.ts → import-D8M7awTx.d.ts} +2 -2
  23. package/dist/{import-CLyHpgk8.d.mts → import-DRmutNSr.d.mts} +2 -2
  24. package/dist/{isRuleGroup-Do9KKsmt.js → isRuleGroup-Cjk1Q2mj.js} +2 -2
  25. package/dist/{isRuleGroup-Do9KKsmt.js.map → isRuleGroup-Cjk1Q2mj.js.map} +1 -1
  26. package/dist/{isRuleGroup-BcfwGaIN.mjs → isRuleGroup-DztIOOKa.mjs} +1 -1
  27. package/dist/{isRuleGroup-BcfwGaIN.mjs.map → isRuleGroup-DztIOOKa.mjs.map} +1 -1
  28. package/dist/parseCEL.d.mts +2 -2
  29. package/dist/parseCEL.d.ts +2 -2
  30. package/dist/parseCEL.js +9 -9
  31. package/dist/parseCEL.js.map +1 -1
  32. package/dist/parseCEL.mjs +3 -3
  33. package/dist/parseCEL.mjs.map +1 -1
  34. package/dist/parseJSONata.d.mts +2 -2
  35. package/dist/parseJSONata.d.ts +2 -2
  36. package/dist/parseJSONata.js +13 -7
  37. package/dist/parseJSONata.js.map +1 -1
  38. package/dist/parseJSONata.mjs +2 -3
  39. package/dist/parseJSONata.mjs.map +1 -1
  40. package/dist/parseJsonLogic.d.mts +3 -3
  41. package/dist/parseJsonLogic.d.ts +3 -3
  42. package/dist/parseJsonLogic.js +4 -4
  43. package/dist/parseJsonLogic.mjs +4 -4
  44. package/dist/parseMongoDB.d.mts +2 -2
  45. package/dist/parseMongoDB.d.ts +2 -2
  46. package/dist/parseMongoDB.js +5 -5
  47. package/dist/parseMongoDB.js.map +1 -1
  48. package/dist/parseMongoDB.mjs +5 -5
  49. package/dist/parseMongoDB.mjs.map +1 -1
  50. package/dist/parseSQL.d.mts +2 -2
  51. package/dist/parseSQL.d.ts +2 -2
  52. package/dist/parseSQL.js +9 -9
  53. package/dist/parseSQL.js.map +1 -1
  54. package/dist/parseSQL.mjs +3 -3
  55. package/dist/parseSpEL.d.mts +2 -2
  56. package/dist/parseSpEL.d.ts +2 -2
  57. package/dist/parseSpEL.js +58 -7
  58. package/dist/parseSpEL.js.map +1 -1
  59. package/dist/parseSpEL.mjs +3 -3
  60. package/dist/{prepareQueryObjects-BfnyRV5t.mjs → prepareQueryObjects-BBayjIn2.mjs} +4 -7
  61. package/dist/prepareQueryObjects-BBayjIn2.mjs.map +1 -0
  62. package/dist/{prepareQueryObjects-DCtJJrF5.js → prepareQueryObjects-BxWvIPI4.js} +5 -8
  63. package/dist/prepareQueryObjects-BxWvIPI4.js.map +1 -0
  64. package/dist/react-querybuilder_core.d.mts +119 -118
  65. package/dist/react-querybuilder_core.legacy-esm.d.ts +119 -118
  66. package/dist/react-querybuilder_core.legacy-esm.js +42 -16
  67. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  68. package/dist/react-querybuilder_core.mjs +39 -10
  69. package/dist/react-querybuilder_core.mjs.map +1 -1
  70. package/dist/react-querybuilder_core.production.d.mts +119 -118
  71. package/dist/react-querybuilder_core.production.mjs +1 -1
  72. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  73. package/dist/{transformQuery-DvJTAvkh.js → transformQuery-ClBRfnFg.js} +3 -3
  74. package/dist/{transformQuery-DvJTAvkh.js.map → transformQuery-ClBRfnFg.js.map} +1 -1
  75. package/dist/{transformQuery-Bq4iyYsE.mjs → transformQuery-DUpbpqjX.mjs} +2 -2
  76. package/dist/{transformQuery-Bq4iyYsE.mjs.map → transformQuery-DUpbpqjX.mjs.map} +1 -1
  77. package/dist/transformQuery.d.mts +1 -1
  78. package/dist/transformQuery.d.ts +1 -1
  79. package/dist/transformQuery.js +1 -2
  80. package/dist/transformQuery.mjs +1 -2
  81. package/dist/{utils-CoYbYnVo.js → utils-CR1ToTMW.js} +3 -3
  82. package/dist/{utils-CoYbYnVo.js.map → utils-CR1ToTMW.js.map} +1 -1
  83. package/dist/{utils-DxH23QtE.mjs → utils-nQU7WCM9.mjs} +2 -2
  84. package/dist/{utils-DxH23QtE.mjs.map → utils-nQU7WCM9.mjs.map} +1 -1
  85. package/package.json +14 -13
  86. package/dist/chunk-DrjzjjTJ.mjs +0 -23
  87. package/dist/chunk-Dv2ph0Ay.js +0 -23
  88. package/dist/prepareQueryObjects-BfnyRV5t.mjs.map +0 -1
  89. package/dist/prepareQueryObjects-DCtJJrF5.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as lc, n as isRuleGroupType, r as isRuleGroupTypeIC, t as isRuleGroup } from "./isRuleGroup-BcfwGaIN.mjs";
1
+ import { a as lc, n as isRuleGroupType, r as isRuleGroupTypeIC, t as isRuleGroup } from "./isRuleGroup-DztIOOKa.mjs";
2
2
  import { produce } from "immer";
3
3
 
4
4
  //#region src/utils/convertQuery.ts
@@ -56,7 +56,7 @@ const convertFromIC = (rg) => {
56
56
  */
57
57
  const convertToIC = (rg) => {
58
58
  if (isRuleGroupTypeIC(rg)) return rg;
59
- const { combinator,...queryWithoutCombinator } = rg;
59
+ const { combinator, ...queryWithoutCombinator } = rg;
60
60
  const rules = [];
61
61
  const { length } = rg.rules;
62
62
  for (const [idx, r] of rg.rules.entries()) {
@@ -72,4 +72,4 @@ const convertToIC = (rg) => {
72
72
 
73
73
  //#endregion
74
74
  export { convertToIC as n, convertFromIC as t };
75
- //# sourceMappingURL=convertQuery-Cj4t-LT4.mjs.map
75
+ //# sourceMappingURL=convertQuery-DAj92cbM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertQuery-Cj4t-LT4.mjs","names":["rules: (RuleGroupTypeIC | RuleType | string)[]"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import { produce } from 'immer';\nimport type {\n RuleGroupArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n return produce(rg, draft => {\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < draft.rules.length - 2) {\n if (isSameString(draft.rules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n const nextBaseCombinatorIndex = draft.rules.findIndex(\n (r, i) => i > cursor && typeof r === 'string' && lc(r) === baseCombinator\n );\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n draft.rules.splice(\n cursor,\n draft.rules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n draft.rules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n });\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupType = RuleGroupType>(\n rg: RuleGroupTypeAny\n): RG => {\n if (isRuleGroupType(rg)) {\n return rg as RG;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rulesAsMixedList = processedRG.rules.map(r =>\n typeof r === 'string' || !isRuleGroup(r) ? r : convertFromIC(r)\n );\n const combinator = rulesAsMixedList.length < 2 ? 'and' : (rulesAsMixedList[1] as string);\n const rules = rulesAsMixedList.filter(r => typeof r !== 'string') as RuleGroupArray;\n return { ...processedRG, combinator, rules } as RG;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RGIC extends RuleGroupTypeIC = RuleGroupTypeIC>(\n rg: RuleGroupTypeAny\n): RGIC => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as RGIC;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (const [idx, r] of rg.rules.entries()) {\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as RGIC;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;;;AAWA,MAAM,mBAAmB;CAAC;CAAM;CAAO;CAAM;AAE7C,MAAM,gBAAgB,GAAY,MAAc,GAAG,EAAE,KAAK;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;AAGxC,KAAI,CAAC,GAAG,MAAM,SAAS,eAAsB,CAG3C,QAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,EAAE,GACzE;AAGN,QAAO,QAAQ,KAAI,UAAS;EAC1B,IAAI,SAAS;AAGb,SAAO,SAAS,MAAM,MAAM,SAAS,GAAG;AACtC,OAAI,aAAa,MAAM,MAAM,SAAS,IAAI,eAAe,EAAE;AACzD,cAAU;AACV;;GAGF,MAAM,0BAA0B,MAAM,MAAM,WACzC,GAAG,MAAM,IAAI,UAAU,OAAO,MAAM,YAAY,GAAG,EAAE,KAAK,eAC5D;AAED,OAAI,4BAA4B,IAAI;AAElC,UAAM,MAAM,OACV,QACA,MAAM,MAAM,QACZ,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,OAAO,EAAS,EAC3C,sBAAsB,EACvB,CACF;AACD;SAGA,OAAM,MAAM,OACV,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,QAAQ,wBAAwB,EAAS,EACpE,sBAAsB,EACvB,CACF;;GAGL;;;;;;;;;;AAWJ,MAAa,iBACX,OACO;AACP,KAAI,gBAAgB,GAAG,CACrB,QAAO;CAET,MAAM,cAAc,6CAA6C,GAAG;CACpE,MAAM,mBAAmB,YAAY,MAAM,KAAI,MAC7C,OAAO,MAAM,YAAY,CAAC,YAAY,EAAE,GAAG,IAAI,cAAc,EAAE,CAChE;CACD,MAAM,aAAa,iBAAiB,SAAS,IAAI,QAAS,iBAAiB;CAC3E,MAAM,QAAQ,iBAAiB,QAAO,MAAK,OAAO,MAAM,SAAS;AACjE,QAAO;EAAE,GAAG;EAAa;EAAY;EAAO;;;;;;;;;;AAW9C,MAAa,eACX,OACS;AACT,KAAI,kBAAkB,GAAG,CACvB,QAAO;CAET,MAAM,EAAE,WAAY,GAAG,2BAA2B;CAClD,MAAMA,QAAiD,EAAE;CACzD,MAAM,EAAE,WAAW,GAAG;AACtB,MAAK,MAAM,CAAC,KAAK,MAAM,GAAG,MAAM,SAAS,EAAE;AACzC,MAAI,YAAY,EAAE,CAChB,OAAM,KAAK,YAAY,EAAE,CAAC;MAE1B,OAAM,KAAK,EAAE;AAEf,MAAI,cAAc,MAAM,SAAS,EAC/B,OAAM,KAAK,WAAW;;AAG1B,QAAO;EAAE,GAAG;EAAwB;EAAO"}
1
+ {"version":3,"file":"convertQuery-DAj92cbM.mjs","names":["rules: (RuleGroupTypeIC | RuleType | string)[]"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import { produce } from 'immer';\nimport type {\n RuleGroupArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n return produce(rg, draft => {\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < draft.rules.length - 2) {\n if (isSameString(draft.rules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n const nextBaseCombinatorIndex = draft.rules.findIndex(\n (r, i) => i > cursor && typeof r === 'string' && lc(r) === baseCombinator\n );\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n draft.rules.splice(\n cursor,\n draft.rules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n draft.rules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n });\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupType = RuleGroupType>(\n rg: RuleGroupTypeAny\n): RG => {\n if (isRuleGroupType(rg)) {\n return rg as RG;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rulesAsMixedList = processedRG.rules.map(r =>\n typeof r === 'string' || !isRuleGroup(r) ? r : convertFromIC(r)\n );\n const combinator = rulesAsMixedList.length < 2 ? 'and' : (rulesAsMixedList[1] as string);\n const rules = rulesAsMixedList.filter(r => typeof r !== 'string') as RuleGroupArray;\n return { ...processedRG, combinator, rules } as RG;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RGIC extends RuleGroupTypeIC = RuleGroupTypeIC>(\n rg: RuleGroupTypeAny\n): RGIC => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as RGIC;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (const [idx, r] of rg.rules.entries()) {\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as RGIC;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;;;AAWA,MAAM,mBAAmB;CAAC;CAAM;CAAO;CAAM;AAE7C,MAAM,gBAAgB,GAAY,MAAc,GAAG,EAAE,KAAK;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;AAGxC,KAAI,CAAC,GAAG,MAAM,SAAS,eAAsB,CAG3C,QAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,EAAE,GACzE;AAGN,QAAO,QAAQ,KAAI,UAAS;EAC1B,IAAI,SAAS;AAGb,SAAO,SAAS,MAAM,MAAM,SAAS,GAAG;AACtC,OAAI,aAAa,MAAM,MAAM,SAAS,IAAI,eAAe,EAAE;AACzD,cAAU;AACV;;GAGF,MAAM,0BAA0B,MAAM,MAAM,WACzC,GAAG,MAAM,IAAI,UAAU,OAAO,MAAM,YAAY,GAAG,EAAE,KAAK,eAC5D;AAED,OAAI,4BAA4B,IAAI;AAElC,UAAM,MAAM,OACV,QACA,MAAM,MAAM,QACZ,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,OAAO,EAAS,EAC3C,sBAAsB,EACvB,CACF;AACD;SAGA,OAAM,MAAM,OACV,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,QAAQ,wBAAwB,EAAS,EACpE,sBAAsB,EACvB,CACF;;GAGL;;;;;;;;;;AAWJ,MAAa,iBACX,OACO;AACP,KAAI,gBAAgB,GAAG,CACrB,QAAO;CAET,MAAM,cAAc,6CAA6C,GAAG;CACpE,MAAM,mBAAmB,YAAY,MAAM,KAAI,MAC7C,OAAO,MAAM,YAAY,CAAC,YAAY,EAAE,GAAG,IAAI,cAAc,EAAE,CAChE;CACD,MAAM,aAAa,iBAAiB,SAAS,IAAI,QAAS,iBAAiB;CAC3E,MAAM,QAAQ,iBAAiB,QAAO,MAAK,OAAO,MAAM,SAAS;AACjE,QAAO;EAAE,GAAG;EAAa;EAAY;EAAO;;;;;;;;;;AAW9C,MAAa,eACX,OACS;AACT,KAAI,kBAAkB,GAAG,CACvB,QAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAMA,QAAiD,EAAE;CACzD,MAAM,EAAE,WAAW,GAAG;AACtB,MAAK,MAAM,CAAC,KAAK,MAAM,GAAG,MAAM,SAAS,EAAE;AACzC,MAAI,YAAY,EAAE,CAChB,OAAM,KAAK,YAAY,EAAE,CAAC;MAE1B,OAAM,KAAK,EAAE;AAEf,MAAI,cAAc,MAAM,SAAS,EAC/B,OAAM,KAAK,WAAW;;AAG1B,QAAO;EAAE,GAAG;EAAwB;EAAO"}
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-BxBTb9qk.js');
2
- const require_isRuleGroup = require('./isRuleGroup-Do9KKsmt.js');
1
+ const require_chunk = require('./chunk-U64pC571.js');
2
+ const require_isRuleGroup = require('./isRuleGroup-Cjk1Q2mj.js');
3
3
  let immer = require("immer");
4
4
 
5
5
  //#region src/utils/convertQuery.ts
@@ -57,7 +57,7 @@ const convertFromIC = (rg) => {
57
57
  */
58
58
  const convertToIC = (rg) => {
59
59
  if (require_isRuleGroup.isRuleGroupTypeIC(rg)) return rg;
60
- const { combinator,...queryWithoutCombinator } = rg;
60
+ const { combinator, ...queryWithoutCombinator } = rg;
61
61
  const rules = [];
62
62
  const { length } = rg.rules;
63
63
  for (const [idx, r] of rg.rules.entries()) {
@@ -84,4 +84,4 @@ Object.defineProperty(exports, 'convertToIC', {
84
84
  return convertToIC;
85
85
  }
86
86
  });
87
- //# sourceMappingURL=convertQuery-DuY_BJHy.js.map
87
+ //# sourceMappingURL=convertQuery-DRldbzhZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertQuery-DuY_BJHy.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC","rules: (RuleGroupTypeIC | RuleType | string)[]"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import { produce } from 'immer';\nimport type {\n RuleGroupArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n return produce(rg, draft => {\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < draft.rules.length - 2) {\n if (isSameString(draft.rules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n const nextBaseCombinatorIndex = draft.rules.findIndex(\n (r, i) => i > cursor && typeof r === 'string' && lc(r) === baseCombinator\n );\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n draft.rules.splice(\n cursor,\n draft.rules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n draft.rules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n });\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupType = RuleGroupType>(\n rg: RuleGroupTypeAny\n): RG => {\n if (isRuleGroupType(rg)) {\n return rg as RG;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rulesAsMixedList = processedRG.rules.map(r =>\n typeof r === 'string' || !isRuleGroup(r) ? r : convertFromIC(r)\n );\n const combinator = rulesAsMixedList.length < 2 ? 'and' : (rulesAsMixedList[1] as string);\n const rules = rulesAsMixedList.filter(r => typeof r !== 'string') as RuleGroupArray;\n return { ...processedRG, combinator, rules } as RG;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RGIC extends RuleGroupTypeIC = RuleGroupTypeIC>(\n rg: RuleGroupTypeAny\n): RGIC => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as RGIC;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (const [idx, r] of rg.rules.entries()) {\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as RGIC;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;;;;AAWA,MAAM,mBAAmB;CAAC;CAAM;CAAO;CAAM;AAE7C,MAAM,gBAAgB,GAAY,MAAcA,uBAAG,EAAE,KAAK;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;AAGxC,KAAI,CAAC,GAAG,MAAM,SAAS,eAAsB,CAG3C,QAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,EAAE,GACzE;AAGN,2BAAe,KAAI,UAAS;EAC1B,IAAI,SAAS;AAGb,SAAO,SAAS,MAAM,MAAM,SAAS,GAAG;AACtC,OAAI,aAAa,MAAM,MAAM,SAAS,IAAI,eAAe,EAAE;AACzD,cAAU;AACV;;GAGF,MAAM,0BAA0B,MAAM,MAAM,WACzC,GAAG,MAAM,IAAI,UAAU,OAAO,MAAM,YAAYA,uBAAG,EAAE,KAAK,eAC5D;AAED,OAAI,4BAA4B,IAAI;AAElC,UAAM,MAAM,OACV,QACA,MAAM,MAAM,QACZ,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,OAAO,EAAS,EAC3C,sBAAsB,EACvB,CACF;AACD;SAGA,OAAM,MAAM,OACV,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,QAAQ,wBAAwB,EAAS,EACpE,sBAAsB,EACvB,CACF;;GAGL;;;;;;;;;;AAWJ,MAAa,iBACX,OACO;AACP,KAAIC,oCAAgB,GAAG,CACrB,QAAO;CAET,MAAM,cAAc,6CAA6C,GAAG;CACpE,MAAM,mBAAmB,YAAY,MAAM,KAAI,MAC7C,OAAO,MAAM,YAAY,CAACC,gCAAY,EAAE,GAAG,IAAI,cAAc,EAAE,CAChE;CACD,MAAM,aAAa,iBAAiB,SAAS,IAAI,QAAS,iBAAiB;CAC3E,MAAM,QAAQ,iBAAiB,QAAO,MAAK,OAAO,MAAM,SAAS;AACjE,QAAO;EAAE,GAAG;EAAa;EAAY;EAAO;;;;;;;;;;AAW9C,MAAa,eACX,OACS;AACT,KAAIC,sCAAkB,GAAG,CACvB,QAAO;CAET,MAAM,EAAE,WAAY,GAAG,2BAA2B;CAClD,MAAMC,QAAiD,EAAE;CACzD,MAAM,EAAE,WAAW,GAAG;AACtB,MAAK,MAAM,CAAC,KAAK,MAAM,GAAG,MAAM,SAAS,EAAE;AACzC,MAAIF,gCAAY,EAAE,CAChB,OAAM,KAAK,YAAY,EAAE,CAAC;MAE1B,OAAM,KAAK,EAAE;AAEf,MAAI,cAAc,MAAM,SAAS,EAC/B,OAAM,KAAK,WAAW;;AAG1B,QAAO;EAAE,GAAG;EAAwB;EAAO"}
1
+ {"version":3,"file":"convertQuery-DRldbzhZ.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC","rules: (RuleGroupTypeIC | RuleType | string)[]"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import { produce } from 'immer';\nimport type {\n RuleGroupArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n return produce(rg, draft => {\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < draft.rules.length - 2) {\n if (isSameString(draft.rules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n const nextBaseCombinatorIndex = draft.rules.findIndex(\n (r, i) => i > cursor && typeof r === 'string' && lc(r) === baseCombinator\n );\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n draft.rules.splice(\n cursor,\n draft.rules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n draft.rules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: draft.rules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n });\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupType = RuleGroupType>(\n rg: RuleGroupTypeAny\n): RG => {\n if (isRuleGroupType(rg)) {\n return rg as RG;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rulesAsMixedList = processedRG.rules.map(r =>\n typeof r === 'string' || !isRuleGroup(r) ? r : convertFromIC(r)\n );\n const combinator = rulesAsMixedList.length < 2 ? 'and' : (rulesAsMixedList[1] as string);\n const rules = rulesAsMixedList.filter(r => typeof r !== 'string') as RuleGroupArray;\n return { ...processedRG, combinator, rules } as RG;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RGIC extends RuleGroupTypeIC = RuleGroupTypeIC>(\n rg: RuleGroupTypeAny\n): RGIC => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as RGIC;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (const [idx, r] of rg.rules.entries()) {\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as RGIC;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;;;;AAWA,MAAM,mBAAmB;CAAC;CAAM;CAAO;CAAM;AAE7C,MAAM,gBAAgB,GAAY,MAAcA,uBAAG,EAAE,KAAK;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;AAGxC,KAAI,CAAC,GAAG,MAAM,SAAS,eAAsB,CAG3C,QAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,EAAE,GACzE;AAGN,2BAAe,KAAI,UAAS;EAC1B,IAAI,SAAS;AAGb,SAAO,SAAS,MAAM,MAAM,SAAS,GAAG;AACtC,OAAI,aAAa,MAAM,MAAM,SAAS,IAAI,eAAe,EAAE;AACzD,cAAU;AACV;;GAGF,MAAM,0BAA0B,MAAM,MAAM,WACzC,GAAG,MAAM,IAAI,UAAU,OAAO,MAAM,YAAYA,uBAAG,EAAE,KAAK,eAC5D;AAED,OAAI,4BAA4B,IAAI;AAElC,UAAM,MAAM,OACV,QACA,MAAM,MAAM,QACZ,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,OAAO,EAAS,EAC3C,sBAAsB,EACvB,CACF;AACD;SAGA,OAAM,MAAM,OACV,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,MAAM,MAAM,MAAM,QAAQ,wBAAwB,EAAS,EACpE,sBAAsB,EACvB,CACF;;GAGL;;;;;;;;;;AAWJ,MAAa,iBACX,OACO;AACP,KAAIC,oCAAgB,GAAG,CACrB,QAAO;CAET,MAAM,cAAc,6CAA6C,GAAG;CACpE,MAAM,mBAAmB,YAAY,MAAM,KAAI,MAC7C,OAAO,MAAM,YAAY,CAACC,gCAAY,EAAE,GAAG,IAAI,cAAc,EAAE,CAChE;CACD,MAAM,aAAa,iBAAiB,SAAS,IAAI,QAAS,iBAAiB;CAC3E,MAAM,QAAQ,iBAAiB,QAAO,MAAK,OAAO,MAAM,SAAS;AACjE,QAAO;EAAE,GAAG;EAAa;EAAY;EAAO;;;;;;;;;;AAW9C,MAAa,eACX,OACS;AACT,KAAIC,sCAAkB,GAAG,CACvB,QAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAMC,QAAiD,EAAE;CACzD,MAAM,EAAE,WAAW,GAAG;AACtB,MAAK,MAAM,CAAC,KAAK,MAAM,GAAG,MAAM,SAAS,EAAE;AACzC,MAAIF,gCAAY,EAAE,CAChB,OAAM,KAAK,YAAY,EAAE,CAAC;MAE1B,OAAM,KAAK,EAAE;AAEf,MAAI,cAAc,MAAM,SAAS,EAC/B,OAAM,KAAK,WAAW;;AAG1B,QAAO;EAAE,GAAG;EAAwB;EAAO"}
@@ -1,4 +1,4 @@
1
- import { C as Except, a as ValueSource, b as FullOptionList, c as RuleValidator, f as RuleGroupTypeAny, h as DefaultOperatorName, i as ParseNumbersPropConfig, l as ValidationMap, n as FullOperator, r as InputType, s as QueryValidator, t as FullField, u as ValidationResult, v as RuleType, y as FlexibleOptionList } from "./basic-o1-sYjK6.js";
1
+ import { C as Except, a as ValueSource, b as FullOptionList, c as RuleValidator, f as RuleGroupTypeAny, h as DefaultOperatorName, i as ParseNumbersPropConfig, l as ValidationMap, n as FullOperator, r as InputType, s as QueryValidator, t as FullField, u as ValidationResult, v as RuleType, y as FlexibleOptionList } from "./basic-Dxm6jWFu.js";
2
2
  import { RulesLogic } from "json-logic-js";
3
3
 
4
4
  //#region src/types/export.d.ts
@@ -449,4 +449,4 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
449
449
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
450
450
  //#endregion
451
451
  export { ValueProcessorOptions as _, FormatQueryOptions as a, NLTranslations as c, RQBJsonLogic as d, RuleGroupProcessor as f, ValueProcessorLegacy as g, ValueProcessorByRule as h, ExportOperatorMap as i, ParameterizedNamedSQL as l, SQLPreset as m, ExportFormat as n, GroupVariantCondition as o, RuleProcessor as p, ExportObjectFormats as r, NLTranslationKey as s, ConstituentWordOrder as t, ParameterizedSQL as u };
452
- //# sourceMappingURL=export-WDHFbiPz.d.ts.map
452
+ //# sourceMappingURL=export-6VbkhCrf.d.ts.map
@@ -1,4 +1,4 @@
1
- import { C as Except, a as ValueSource, b as FullOptionList, c as RuleValidator, f as RuleGroupTypeAny, h as DefaultOperatorName, i as ParseNumbersPropConfig, l as ValidationMap, n as FullOperator, r as InputType, s as QueryValidator, t as FullField, u as ValidationResult, v as RuleType, y as FlexibleOptionList } from "./basic-DbvrfPNz.mjs";
1
+ import { C as Except, a as ValueSource, b as FullOptionList, c as RuleValidator, f as RuleGroupTypeAny, h as DefaultOperatorName, i as ParseNumbersPropConfig, l as ValidationMap, n as FullOperator, r as InputType, s as QueryValidator, t as FullField, u as ValidationResult, v as RuleType, y as FlexibleOptionList } from "./basic-GFsWfi0Z.mjs";
2
2
  import { RulesLogic } from "json-logic-js";
3
3
 
4
4
  //#region src/types/export.d.ts
@@ -449,4 +449,4 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
449
449
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
450
450
  //#endregion
451
451
  export { ValueProcessorOptions as _, FormatQueryOptions as a, NLTranslations as c, RQBJsonLogic as d, RuleGroupProcessor as f, ValueProcessorLegacy as g, ValueProcessorByRule as h, ExportOperatorMap as i, ParameterizedNamedSQL as l, SQLPreset as m, ExportFormat as n, GroupVariantCondition as o, RuleProcessor as p, ExportObjectFormats as r, NLTranslationKey as s, ConstituentWordOrder as t, ParameterizedSQL as u };
452
- //# sourceMappingURL=export-CCULKoP4.d.mts.map
452
+ //# sourceMappingURL=export-_wipiqJZ.d.mts.map
@@ -1,5 +1,5 @@
1
- import { S as SetRequired, f as RuleGroupTypeAny, v as RuleType } from "./basic-DbvrfPNz.mjs";
2
- import { _ as ValueProcessorOptions, a as FormatQueryOptions, c as NLTranslations, d as RQBJsonLogic, f as RuleGroupProcessor, g as ValueProcessorLegacy, h as ValueProcessorByRule, i as ExportOperatorMap, l as ParameterizedNamedSQL, m as SQLPreset, n as ExportFormat, o as GroupVariantCondition, p as RuleProcessor, r as ExportObjectFormats, s as NLTranslationKey, t as ConstituentWordOrder, u as ParameterizedSQL } from "./export-CCULKoP4.mjs";
1
+ import { S as SetRequired, f as RuleGroupTypeAny, v as RuleType } from "./basic-GFsWfi0Z.mjs";
2
+ import { _ as ValueProcessorOptions, a as FormatQueryOptions, c as NLTranslations, d as RQBJsonLogic, f as RuleGroupProcessor, g as ValueProcessorLegacy, h as ValueProcessorByRule, i as ExportOperatorMap, l as ParameterizedNamedSQL, m as SQLPreset, n as ExportFormat, o as GroupVariantCondition, p as RuleProcessor, r as ExportObjectFormats, s as NLTranslationKey, t as ConstituentWordOrder, u as ParameterizedSQL } from "./export-_wipiqJZ.mjs";
3
3
  import { Column, Operators, SQL, Table } from "drizzle-orm";
4
4
  import { WhereOptions } from "sequelize";
5
5
 
@@ -1,5 +1,5 @@
1
- import { S as SetRequired, f as RuleGroupTypeAny, v as RuleType } from "./basic-o1-sYjK6.js";
2
- import { _ as ValueProcessorOptions, a as FormatQueryOptions, c as NLTranslations, d as RQBJsonLogic, f as RuleGroupProcessor, g as ValueProcessorLegacy, h as ValueProcessorByRule, i as ExportOperatorMap, l as ParameterizedNamedSQL, m as SQLPreset, n as ExportFormat, o as GroupVariantCondition, p as RuleProcessor, r as ExportObjectFormats, s as NLTranslationKey, t as ConstituentWordOrder, u as ParameterizedSQL } from "./export-WDHFbiPz.js";
1
+ import { S as SetRequired, f as RuleGroupTypeAny, v as RuleType } from "./basic-Dxm6jWFu.js";
2
+ import { _ as ValueProcessorOptions, a as FormatQueryOptions, c as NLTranslations, d as RQBJsonLogic, f as RuleGroupProcessor, g as ValueProcessorLegacy, h as ValueProcessorByRule, i as ExportOperatorMap, l as ParameterizedNamedSQL, m as SQLPreset, n as ExportFormat, o as GroupVariantCondition, p as RuleProcessor, r as ExportObjectFormats, s as NLTranslationKey, t as ConstituentWordOrder, u as ParameterizedSQL } from "./export-6VbkhCrf.js";
3
3
  import { Column, Operators, SQL, Table } from "drizzle-orm";
4
4
  import { WhereOptions } from "sequelize";
5
5
 
@@ -1,8 +1,8 @@
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_transformQuery = require('./transformQuery-DvJTAvkh.js');
5
- const require_convertQuery = require('./convertQuery-DuY_BJHy.js');
1
+ const require_chunk = require('./chunk-U64pC571.js');
2
+ const require_utils = require('./utils-CR1ToTMW.js');
3
+ const require_isRuleGroup = require('./isRuleGroup-Cjk1Q2mj.js');
4
+ const require_transformQuery = require('./transformQuery-ClBRfnFg.js');
5
+ const require_convertQuery = require('./convertQuery-DRldbzhZ.js');
6
6
  let immer = require("immer");
7
7
 
8
8
  //#region src/utils/isRuleOrGroupValid.ts
@@ -1196,7 +1196,30 @@ const defaultRuleProcessorElasticSearch = (rule, options = {}) => {
1196
1196
  const { field, operator, value, valueSource } = rule;
1197
1197
  const { parseNumbers, preserveValueOrder } = options;
1198
1198
  const operatorLC = require_isRuleGroup.lc(operator);
1199
- if (require_utils.processMatchMode(rule)) return false;
1199
+ const matchEval = require_utils.processMatchMode(rule);
1200
+ if (matchEval === false) return false;
1201
+ else if (matchEval) {
1202
+ const { mode } = matchEval;
1203
+ const subQuery = defaultRuleGroupProcessorElasticSearch(require_transformQuery.transformQuery(rule.value, { ruleProcessor: (r) => ({
1204
+ ...r,
1205
+ field: r.field ? `${field}.${r.field}` : field
1206
+ }) }), options);
1207
+ if (Object.keys(subQuery).length === 0) return false;
1208
+ switch (mode) {
1209
+ case "some": return { nested: {
1210
+ path: field,
1211
+ query: subQuery
1212
+ } };
1213
+ case "none": return { bool: { must_not: { nested: {
1214
+ path: field,
1215
+ query: subQuery
1216
+ } } } };
1217
+ case "all":
1218
+ case "atleast":
1219
+ case "atmost":
1220
+ case "exactly": return false;
1221
+ }
1222
+ }
1200
1223
  if (valueSource === "field") {
1201
1224
  if (require_utils.toArray(value).some((v) => typeof v !== "string")) return false;
1202
1225
  const fieldForScript = escapeSQ(field);
@@ -1570,7 +1593,8 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
1570
1593
  const valueAsArray = require_utils.toArray(rule.value);
1571
1594
  if (valueAsArray.length === 0) return "";
1572
1595
  const valStringArray = valueAsArray.map((v) => valueIsField ? wrapFieldName(require_utils.getOption(fields ?? [], v)?.label ?? v) : require_utils.shouldRenderAsNumber(v, parseNumbers) ? `${require_utils.trimIfString(v)}` : `${wrapAndEscape(v)}`);
1573
- return `${valStringArray.slice(0, -1).join(", ")}${valStringArray.length > 2 ? "," : ""} ${orTL} ${valStringArray.at(-1)}`;
1596
+ if (valStringArray.length === 1) return valStringArray[0];
1597
+ return `(${`${valStringArray.slice(0, -1).join(", ")}${valStringArray.length > 2 ? "," : ""} ${orTL} ${valStringArray.at(-1)}`})`;
1574
1598
  }
1575
1599
  }
1576
1600
  if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
@@ -1615,17 +1639,22 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
1615
1639
  const { field, operator, valueSource = "value" } = rule;
1616
1640
  // istanbul ignore next
1617
1641
  const { getOperators = defaultGetOperators, operatorMap: operatorMapParam = defaultExportOperatorMap } = opts;
1618
- const mapOperatorMap = new Map(Object.entries(defaultExportOperatorMap));
1619
- for (const [key, value] of Object.entries(operatorMapParam)) mapOperatorMap.set(require_isRuleGroup.lc(key), value);
1620
- const operatorMap = Object.fromEntries(mapOperatorMap);
1642
+ const mergedOperatorMap = new Map(Object.entries(defaultExportOperatorMap));
1643
+ for (const [key, value] of Object.entries(operatorMapParam)) mergedOperatorMap.set(require_isRuleGroup.lc(key), value);
1644
+ const operatorMap = Object.fromEntries(mergedOperatorMap);
1645
+ const operatorLC = require_isRuleGroup.lc(operator);
1646
+ var normalizedOperator = operator;
1647
+ const hasSingleValue = require_utils.toArray(rule.value).length === 1;
1648
+ if (operatorLC === "in" && hasSingleValue) normalizedOperator = "=";
1649
+ else if (operatorLC === "notin" && hasSingleValue) normalizedOperator = "!=";
1621
1650
  const { value: operatorNL, label } = require_utils.getOption(require_utils.toFullOptionList(getOperators(field, { fieldData: opts.fieldData ?? {
1622
1651
  name: field,
1623
1652
  value: field,
1624
1653
  label: field
1625
- } }) ?? []), operator) ?? {
1626
- name: operator,
1627
- value: operator,
1628
- label: operator
1654
+ } }) ?? []), normalizedOperator) ?? {
1655
+ name: normalizedOperator,
1656
+ value: normalizedOperator,
1657
+ label: normalizedOperator
1629
1658
  };
1630
1659
  const operatorTL = operatorMap[operatorNL] ?? operatorMap[require_isRuleGroup.lc(operatorNL)] ?? [label, label];
1631
1660
  return typeof operatorTL === "string" ? operatorTL : operatorTL[valueSource === "field" ? 1 : 0];