@react-querybuilder/core 8.16.2 → 8.18.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 (88) hide show
  1. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +55 -5
  2. package/dist/cjs/react-querybuilder_core.cjs.development.js +14 -9
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  4. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +55 -5
  5. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  6. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  7. package/dist/{convertQuery-Lx2HQa0m.js → convertQuery-BoMPXL7_.js} +2 -2
  8. package/dist/{convertQuery-Lx2HQa0m.js.map → convertQuery-BoMPXL7_.js.map} +1 -1
  9. package/dist/{convertQuery-BeJJH9BI.mjs → convertQuery-CQwOrjQr.mjs} +2 -2
  10. package/dist/{convertQuery-BeJJH9BI.mjs.map → convertQuery-CQwOrjQr.mjs.map} +1 -1
  11. package/dist/formatQuery.d.mts +3 -1
  12. package/dist/formatQuery.d.ts +3 -1
  13. package/dist/formatQuery.js +13 -11
  14. package/dist/formatQuery.js.map +1 -1
  15. package/dist/formatQuery.mjs +13 -11
  16. package/dist/formatQuery.mjs.map +1 -1
  17. package/dist/{import-DqzM2MBd.d.ts → import-Qs1-kgv5.d.ts} +2 -2
  18. package/dist/{import-BXXgiPlr.d.mts → import-ShTj5IdB.d.mts} +2 -2
  19. package/dist/{index-NSVgGj45.d.ts → index-DlVg-QXo.d.mts} +51 -5
  20. package/dist/{index-CR-tk4Ci.d.mts → index-DlVg-QXo.d.ts} +51 -5
  21. package/dist/{objectUtils-D96eEEzL.mjs → objectUtils-D-w8MzpZ.mjs} +1 -1
  22. package/dist/{objectUtils-D96eEEzL.mjs.map → objectUtils-D-w8MzpZ.mjs.map} +1 -1
  23. package/dist/{objectUtils-Bzug_QfX.js → objectUtils-DxVaGCdg.js} +1 -2
  24. package/dist/{objectUtils-Bzug_QfX.js.map → objectUtils-DxVaGCdg.js.map} +1 -1
  25. package/dist/parseCEL.d.mts +7 -7
  26. package/dist/parseCEL.d.ts +7 -7
  27. package/dist/parseCEL.js +6 -7
  28. package/dist/parseCEL.js.map +1 -1
  29. package/dist/parseCEL.mjs +6 -6
  30. package/dist/parseCEL.mjs.map +1 -1
  31. package/dist/parseCypher.d.mts +1 -1
  32. package/dist/parseCypher.d.ts +1 -1
  33. package/dist/parseCypher.js +0 -1
  34. package/dist/parseCypher.js.map +1 -1
  35. package/dist/parseGremlin.d.mts +1 -1
  36. package/dist/parseGremlin.d.ts +1 -1
  37. package/dist/parseJSONata.d.mts +2 -2
  38. package/dist/parseJSONata.d.ts +2 -2
  39. package/dist/parseJSONata.js +2 -3
  40. package/dist/parseJSONata.mjs +2 -2
  41. package/dist/parseJsonLogic.d.mts +2 -2
  42. package/dist/parseJsonLogic.d.ts +2 -2
  43. package/dist/parseJsonLogic.js +11 -11
  44. package/dist/parseJsonLogic.js.map +1 -1
  45. package/dist/parseJsonLogic.mjs +11 -11
  46. package/dist/parseJsonLogic.mjs.map +1 -1
  47. package/dist/parseMongoDB.d.mts +2 -2
  48. package/dist/parseMongoDB.d.ts +2 -2
  49. package/dist/parseMongoDB.js +4 -4
  50. package/dist/parseMongoDB.mjs +4 -4
  51. package/dist/parseSPARQL.d.mts +1 -1
  52. package/dist/parseSPARQL.d.ts +1 -1
  53. package/dist/parseSPARQL.js +0 -1
  54. package/dist/parseSPARQL.js.map +1 -1
  55. package/dist/parseSQL.d.mts +2 -2
  56. package/dist/parseSQL.d.ts +2 -2
  57. package/dist/parseSQL.js +3 -4
  58. package/dist/parseSQL.js.map +1 -1
  59. package/dist/parseSQL.mjs +3 -3
  60. package/dist/parseSpEL.d.mts +2 -2
  61. package/dist/parseSpEL.d.ts +2 -2
  62. package/dist/parseSpEL.js +3 -4
  63. package/dist/parseSpEL.js.map +1 -1
  64. package/dist/parseSpEL.mjs +3 -3
  65. package/dist/{prepareQueryObjects-uA10ZpZX.mjs → prepareQueryObjects-BXf5aV-A.mjs} +3 -3
  66. package/dist/{prepareQueryObjects-uA10ZpZX.mjs.map → prepareQueryObjects-BXf5aV-A.mjs.map} +1 -1
  67. package/dist/{prepareQueryObjects-BoG5Rt8z.js → prepareQueryObjects-gRQqiBPR.js} +3 -3
  68. package/dist/{prepareQueryObjects-BoG5Rt8z.js.map → prepareQueryObjects-gRQqiBPR.js.map} +1 -1
  69. package/dist/react-querybuilder_core.d.mts +55 -5
  70. package/dist/react-querybuilder_core.legacy-esm.d.ts +55 -5
  71. package/dist/react-querybuilder_core.legacy-esm.js +21 -16
  72. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  73. package/dist/react-querybuilder_core.mjs +14 -9
  74. package/dist/react-querybuilder_core.mjs.map +1 -1
  75. package/dist/react-querybuilder_core.production.d.mts +55 -5
  76. package/dist/react-querybuilder_core.production.mjs +1 -1
  77. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  78. package/dist/transformQuery.d.mts +1 -1
  79. package/dist/transformQuery.d.ts +1 -1
  80. package/dist/transformQuery.js +1 -1
  81. package/dist/transformQuery.mjs +1 -1
  82. package/dist/{utils-ChLG90DP.mjs → utils-01WaTGBL.mjs} +2 -2
  83. package/dist/utils-01WaTGBL.mjs.map +1 -0
  84. package/dist/{utils-Qwkq2Q0F.js → utils-ZlKseh1X.js} +2 -3
  85. package/dist/utils-ZlKseh1X.js.map +1 -0
  86. package/package.json +6 -6
  87. package/dist/utils-ChLG90DP.mjs.map +0 -1
  88. package/dist/utils-Qwkq2Q0F.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_objectUtils = require("./objectUtils-Bzug_QfX.js");
1
+ const require_objectUtils = require("./objectUtils-DxVaGCdg.js");
2
2
  //#region src/utils/convertQuery.ts
3
3
  const combinatorLevels = [
4
4
  "or",
@@ -91,4 +91,4 @@ Object.defineProperty(exports, "convertToIC", {
91
91
  }
92
92
  });
93
93
 
94
- //# sourceMappingURL=convertQuery-Lx2HQa0m.js.map
94
+ //# sourceMappingURL=convertQuery-BoMPXL7_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertQuery-Lx2HQa0m.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\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 const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.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 newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\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 RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<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 = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\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 ToRuleGroupTypeIC<RG>;\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":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAcA,oBAAAA,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAYA,oBAAAA,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAIC,oBAAAA,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAKC,oBAAAA,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAIC,oBAAAA,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAID,oBAAAA,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
1
+ {"version":3,"file":"convertQuery-BoMPXL7_.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\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 const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.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 newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\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 RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<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 = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\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 ToRuleGroupTypeIC<RG>;\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":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAcA,oBAAAA,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAYA,oBAAAA,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAIC,oBAAAA,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAKC,oBAAAA,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAIC,oBAAAA,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAID,oBAAAA,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
@@ -1,4 +1,4 @@
1
- import { a as isRuleGroupTypeIC, i as isRuleGroupType, r as isRuleGroup, s as lc } from "./objectUtils-D96eEEzL.mjs";
1
+ import { a as isRuleGroupTypeIC, i as isRuleGroupType, r as isRuleGroup, s as lc } from "./objectUtils-D-w8MzpZ.mjs";
2
2
  //#region src/utils/convertQuery.ts
3
3
  const combinatorLevels = [
4
4
  "or",
@@ -80,4 +80,4 @@ const convertToIC = (rg) => {
80
80
  //#endregion
81
81
  export { convertToIC as n, convertFromIC as t };
82
82
 
83
- //# sourceMappingURL=convertQuery-BeJJH9BI.mjs.map
83
+ //# sourceMappingURL=convertQuery-CQwOrjQr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertQuery-BeJJH9BI.mjs","names":[],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\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 const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.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 newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\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 RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<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 = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\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 ToRuleGroupTypeIC<RG>;\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":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAc,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAY,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAI,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAK,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAI,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAI,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
1
+ {"version":3,"file":"convertQuery-CQwOrjQr.mjs","names":[],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\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 const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.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 newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\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 RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<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 = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\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 ToRuleGroupTypeIC<RG>;\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":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAc,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAY,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAI,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAK,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAI,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAI,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
@@ -1,4 +1,4 @@
1
- import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-CR-tk4Ci.mjs";
1
+ import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-DlVg-QXo.mjs";
2
2
  import { Column, Operators, SQL, Table } from "drizzle-orm";
3
3
  import { WhereOptions } from "sequelize";
4
4
  import { eq } from "@tanstack/db";
@@ -761,6 +761,8 @@ declare const bigIntJsonParseReviver: (_key: string, value: unknown) => unknown;
761
761
  /**
762
762
  * Default value processor used by {@link formatQuery} for "sql" format.
763
763
  *
764
+ * @deprecated Prefer {@link defaultValueProcessorByRule}.
765
+ *
764
766
  * @group Export
765
767
  */
766
768
  declare const defaultValueProcessor: ValueProcessorLegacy;
@@ -1,4 +1,4 @@
1
- import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-NSVgGj45.js";
1
+ import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-DlVg-QXo.js";
2
2
  import { Column, Operators, SQL, Table } from "drizzle-orm";
3
3
  import { WhereOptions } from "sequelize";
4
4
  import { eq } from "@tanstack/db";
@@ -761,6 +761,8 @@ declare const bigIntJsonParseReviver: (_key: string, value: unknown) => unknown;
761
761
  /**
762
762
  * Default value processor used by {@link formatQuery} for "sql" format.
763
763
  *
764
+ * @deprecated Prefer {@link defaultValueProcessorByRule}.
765
+ *
764
766
  * @group Export
765
767
  */
766
768
  declare const defaultValueProcessor: ValueProcessorLegacy;
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils = require("./utils-Qwkq2Q0F.js");
3
- const require_objectUtils = require("./objectUtils-Bzug_QfX.js");
2
+ const require_utils = require("./utils-ZlKseh1X.js");
3
+ const require_objectUtils = require("./objectUtils-DxVaGCdg.js");
4
4
  const require_transformQuery = require("./transformQuery.js");
5
- const require_convertQuery = require("./convertQuery-Lx2HQa0m.js");
5
+ const require_convertQuery = require("./convertQuery-BoMPXL7_.js");
6
6
  //#region src/utils/isRuleOrGroupValid.ts
7
7
  /**
8
8
  * Determines if an object is useful as a validation result.
@@ -114,7 +114,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
114
114
  const totalCount = `double(${field}.size())`;
115
115
  const filteredCount = `${field}.filter(${arrayElementAlias}, ${nestedArrayFilter}).size()`;
116
116
  const op = mode === "atleast" ? ">=" : mode === "atmost" ? "<=" : "==";
117
- if (threshold > 0 && threshold < 1) return `${filteredCount} ${op} (${totalCount} * ${threshold})`;
117
+ if (threshold > 0 && threshold < 1) return `double(${filteredCount}) ${op} (${totalCount} * ${threshold})`;
118
118
  return `${filteredCount} ${op} ${threshold}`;
119
119
  }
120
120
  }
@@ -615,7 +615,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
615
615
  if (!columns || !drizzleOperators) return void 0;
616
616
  const { between, eq, gt, gte, inArray, isNotNull, isNull, like, lt, lte, ne, notBetween, notInArray, notLike, sql } = drizzleOperators;
617
617
  const { field, operator, value, valueSource } = rule;
618
- const column = useRawFields && /[a-z][a-z0-9]*/i.test(field) ? sql.raw(field) : columns[field];
618
+ const column = useRawFields && /^[a-z_][a-z0-9_.]*$/i.test(field) ? sql.raw(field) : columns[field];
619
619
  const operatorLC = require_objectUtils.lc(operator);
620
620
  const valueIsField = valueSource === "field";
621
621
  const asFieldOrValue = (v) => valueIsField ? columns[v] : v;
@@ -648,7 +648,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
648
648
  case "atmost":
649
649
  case "exactly": {
650
650
  const op = mode === "atleast" ? ">=" : mode === "atmost" ? "<=" : "=";
651
- return threshold > 0 && threshold < 1 ? sql`(select count(*) / array_length(${column}, 1) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) ${sql.raw(`${op} ${threshold}`)}` : sql`(select count(*) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) ${sql.raw(`${op} ${threshold}`)}`;
651
+ return threshold > 0 && threshold < 1 ? sql`(select count(*)::float / array_length(${column}, 1) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) ${sql.raw(`${op} ${threshold}`)}` : sql`(select count(*) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) ${sql.raw(`${op} ${threshold}`)}`;
652
652
  }
653
653
  }
654
654
  }
@@ -996,7 +996,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
996
996
  const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
997
997
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, translations, validateRule, validationMap } = options;
998
998
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
999
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
999
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
1000
1000
  const rg2 = require_objectUtils.isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && require_objectUtils.lc(r) === "xor") ? require_convertQuery.convertFromIC(rg) : rg;
1001
1001
  const processedRules = [];
1002
1002
  let precedingCombinator = "";
@@ -1094,7 +1094,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
1094
1094
  return sql;
1095
1095
  };
1096
1096
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
1097
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
1097
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
1098
1098
  const processedRules = [];
1099
1099
  let precedingCombinator = "";
1100
1100
  let firstRule = true;
@@ -1287,7 +1287,7 @@ const defaultRuleGroupProcessorSPARQL = (ruleGroup, options) => {
1287
1287
  const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
1288
1288
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1289
1289
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
1290
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
1290
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
1291
1291
  const processedRules = [];
1292
1292
  let precedingCombinator = "";
1293
1293
  let firstRule = true;
@@ -2491,7 +2491,7 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
2491
2491
  case "atmost":
2492
2492
  case "exactly": {
2493
2493
  const op = mode === "atleast" ? ">=" : mode === "atmost" ? "<=" : "=";
2494
- return `(select count(*)${threshold > 0 && threshold < 1 ? ` / array_length(${ruleField}, 1)` : ""} from unnest(${ruleField}) as ${wrapFieldName(arrayElementAlias)} where ${nestedArrayFilter}) ${op} ${threshold}`;
2494
+ return `(select count(*)${threshold > 0 && threshold < 1 ? `::float / array_length(${ruleField}, 1)` : ""} from unnest(${ruleField}) as ${wrapFieldName(arrayElementAlias)} where ${nestedArrayFilter}) ${op} ${threshold}`;
2495
2495
  }
2496
2496
  }
2497
2497
  }
@@ -2558,7 +2558,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
2558
2558
  case "atmost":
2559
2559
  case "exactly": {
2560
2560
  const op = mode === "atleast" ? ">=" : mode === "atmost" ? "<=" : "=";
2561
- return finalize(`(select count(*)${threshold > 0 && threshold < 1 ? ` / array_length(${ruleField}, 1)` : ""} from unnest(${ruleField}) as ${wrapFieldName(arrayElementAlias)} where ${nestedSQL}) ${op} ${threshold}`);
2561
+ return finalize(`(select count(*)${threshold > 0 && threshold < 1 ? `::float / array_length(${ruleField}, 1)` : ""} from unnest(${ruleField}) as ${wrapFieldName(arrayElementAlias)} where ${nestedSQL}) ${op} ${threshold}`);
2562
2562
  }
2563
2563
  }
2564
2564
  }
@@ -3060,6 +3060,8 @@ const generateValueProcessor = (vpbr) => (field, operator, value, valueSource) =
3060
3060
  /**
3061
3061
  * Default value processor used by {@link formatQuery} for "sql" format.
3062
3062
  *
3063
+ * @deprecated Prefer {@link defaultValueProcessorByRule}.
3064
+ *
3063
3065
  * @group Export
3064
3066
  */
3065
3067
  const defaultValueProcessor = generateValueProcessor(defaultValueProcessorByRule);