@react-querybuilder/core 8.17.0 → 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 (56) hide show
  1. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +36 -3
  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 +36 -3
  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/formatQuery.d.mts +3 -1
  8. package/dist/formatQuery.d.ts +3 -1
  9. package/dist/formatQuery.js +10 -8
  10. package/dist/formatQuery.js.map +1 -1
  11. package/dist/formatQuery.mjs +10 -8
  12. package/dist/formatQuery.mjs.map +1 -1
  13. package/dist/{import-CSHMjlid.d.ts → import-Qs1-kgv5.d.ts} +2 -2
  14. package/dist/{import-BQ5xaW6i.d.mts → import-ShTj5IdB.d.mts} +2 -2
  15. package/dist/{index-CREDWM32.d.ts → index-DlVg-QXo.d.mts} +32 -3
  16. package/dist/{index-CREDWM32.d.mts → index-DlVg-QXo.d.ts} +32 -3
  17. package/dist/parseCEL.d.mts +7 -7
  18. package/dist/parseCEL.d.ts +7 -7
  19. package/dist/parseCEL.js +3 -3
  20. package/dist/parseCEL.js.map +1 -1
  21. package/dist/parseCEL.mjs +3 -3
  22. package/dist/parseCEL.mjs.map +1 -1
  23. package/dist/parseCypher.d.mts +1 -1
  24. package/dist/parseCypher.d.ts +1 -1
  25. package/dist/parseGremlin.d.mts +1 -1
  26. package/dist/parseGremlin.d.ts +1 -1
  27. package/dist/parseJSONata.d.mts +2 -2
  28. package/dist/parseJSONata.d.ts +2 -2
  29. package/dist/parseJsonLogic.d.mts +2 -2
  30. package/dist/parseJsonLogic.d.ts +2 -2
  31. package/dist/parseJsonLogic.js +7 -7
  32. package/dist/parseJsonLogic.js.map +1 -1
  33. package/dist/parseJsonLogic.mjs +7 -7
  34. package/dist/parseJsonLogic.mjs.map +1 -1
  35. package/dist/parseMongoDB.d.mts +2 -2
  36. package/dist/parseMongoDB.d.ts +2 -2
  37. package/dist/parseSPARQL.d.mts +1 -1
  38. package/dist/parseSPARQL.d.ts +1 -1
  39. package/dist/parseSQL.d.mts +2 -2
  40. package/dist/parseSQL.d.ts +2 -2
  41. package/dist/parseSpEL.d.mts +2 -2
  42. package/dist/parseSpEL.d.ts +2 -2
  43. package/dist/react-querybuilder_core.d.mts +36 -3
  44. package/dist/react-querybuilder_core.legacy-esm.d.ts +36 -3
  45. package/dist/react-querybuilder_core.legacy-esm.js +14 -9
  46. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  47. package/dist/react-querybuilder_core.mjs +14 -9
  48. package/dist/react-querybuilder_core.mjs.map +1 -1
  49. package/dist/react-querybuilder_core.production.d.mts +36 -3
  50. package/dist/react-querybuilder_core.production.mjs +1 -1
  51. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  52. package/dist/transformQuery.d.mts +1 -1
  53. package/dist/transformQuery.d.ts +1 -1
  54. package/dist/utils-01WaTGBL.mjs.map +1 -1
  55. package/dist/utils-ZlKseh1X.js.map +1 -1
  56. package/package.json +6 -6
@@ -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-CREDWM32.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-CREDWM32.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;
@@ -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);