@react-querybuilder/core 8.14.4 → 8.15.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 (93) hide show
  1. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +201 -8
  2. package/dist/cjs/react-querybuilder_core.cjs.development.js +394 -58
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  4. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +201 -8
  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-CeJSNn37.mjs → convertQuery-BeJJH9BI.mjs} +2 -2
  8. package/dist/convertQuery-BeJJH9BI.mjs.map +1 -0
  9. package/dist/{convertQuery-J8LpTG-7.js → convertQuery-Lx2HQa0m.js} +2 -2
  10. package/dist/convertQuery-Lx2HQa0m.js.map +1 -0
  11. package/dist/formatQuery.d.mts +24 -2
  12. package/dist/formatQuery.d.ts +24 -2
  13. package/dist/formatQuery.js +373 -47
  14. package/dist/formatQuery.js.map +1 -1
  15. package/dist/formatQuery.mjs +373 -48
  16. package/dist/formatQuery.mjs.map +1 -1
  17. package/dist/{import-BwQqExpO.d.mts → import-0wp72lLT.d.mts} +2 -2
  18. package/dist/{import-CrJf23Nf.d.ts → import-yRVJh7E1.d.ts} +2 -2
  19. package/dist/{index-CYT4Saz-.d.mts → index-D5TXNIzF.d.ts} +149 -5
  20. package/dist/{index-DBlQeLax.d.ts → index-Lht_Wq3V.d.mts} +149 -5
  21. package/dist/{objectUtils-ButT0Mng.js → objectUtils-Bzug_QfX.js} +2 -2
  22. package/dist/objectUtils-Bzug_QfX.js.map +1 -0
  23. package/dist/{objectUtils-C0WB-8ex.mjs → objectUtils-D96eEEzL.mjs} +2 -2
  24. package/dist/objectUtils-D96eEEzL.mjs.map +1 -0
  25. package/dist/parseCEL.d.mts +2 -2
  26. package/dist/parseCEL.d.ts +2 -2
  27. package/dist/parseCEL.js +35 -35
  28. package/dist/parseCEL.js.map +1 -1
  29. package/dist/parseCEL.mjs +35 -35
  30. package/dist/parseCEL.mjs.map +1 -1
  31. package/dist/parseJSONata.d.mts +2 -2
  32. package/dist/parseJSONata.d.ts +2 -2
  33. package/dist/parseJSONata.js +11 -11
  34. package/dist/parseJSONata.js.map +1 -1
  35. package/dist/parseJSONata.mjs +11 -11
  36. package/dist/parseJSONata.mjs.map +1 -1
  37. package/dist/parseJsonLogic.d.mts +2 -2
  38. package/dist/parseJsonLogic.d.ts +2 -2
  39. package/dist/parseJsonLogic.js +6 -6
  40. package/dist/parseJsonLogic.js.map +1 -1
  41. package/dist/parseJsonLogic.mjs +6 -6
  42. package/dist/parseJsonLogic.mjs.map +1 -1
  43. package/dist/parseMongoDB.d.mts +2 -2
  44. package/dist/parseMongoDB.d.ts +2 -2
  45. package/dist/parseMongoDB.js +6 -6
  46. package/dist/parseMongoDB.js.map +1 -1
  47. package/dist/parseMongoDB.mjs +6 -6
  48. package/dist/parseMongoDB.mjs.map +1 -1
  49. package/dist/parseSQL.d.mts +2 -2
  50. package/dist/parseSQL.d.ts +2 -2
  51. package/dist/parseSQL.js +16 -16
  52. package/dist/parseSQL.js.map +1 -1
  53. package/dist/parseSQL.mjs +16 -16
  54. package/dist/parseSQL.mjs.map +1 -1
  55. package/dist/parseSpEL.d.mts +2 -2
  56. package/dist/parseSpEL.d.ts +2 -2
  57. package/dist/parseSpEL.js +10 -10
  58. package/dist/parseSpEL.js.map +1 -1
  59. package/dist/parseSpEL.mjs +10 -10
  60. package/dist/parseSpEL.mjs.map +1 -1
  61. package/dist/{prepareQueryObjects-DO3qXriW.js → prepareQueryObjects-BoG5Rt8z.js} +6 -6
  62. package/dist/prepareQueryObjects-BoG5Rt8z.js.map +1 -0
  63. package/dist/{prepareQueryObjects-BfMlS4ql.mjs → prepareQueryObjects-uA10ZpZX.mjs} +6 -6
  64. package/dist/prepareQueryObjects-uA10ZpZX.mjs.map +1 -0
  65. package/dist/query-builder.css +1 -1
  66. package/dist/query-builder.css.map +1 -1
  67. package/dist/react-querybuilder_core.d.mts +201 -8
  68. package/dist/react-querybuilder_core.legacy-esm.d.ts +201 -8
  69. package/dist/react-querybuilder_core.legacy-esm.js +433 -89
  70. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  71. package/dist/react-querybuilder_core.mjs +393 -59
  72. package/dist/react-querybuilder_core.mjs.map +1 -1
  73. package/dist/react-querybuilder_core.production.d.mts +201 -8
  74. package/dist/react-querybuilder_core.production.mjs +1 -1
  75. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  76. package/dist/styles/_main.scss +4 -0
  77. package/dist/transformQuery.d.mts +1 -1
  78. package/dist/transformQuery.d.ts +1 -1
  79. package/dist/transformQuery.js +1 -1
  80. package/dist/transformQuery.mjs +1 -1
  81. package/dist/{utils-BlMGIhvx.mjs → utils-ChLG90DP.mjs} +3 -3
  82. package/dist/utils-ChLG90DP.mjs.map +1 -0
  83. package/dist/{utils-CZRhzje-.js → utils-Qwkq2Q0F.js} +3 -3
  84. package/dist/utils-Qwkq2Q0F.js.map +1 -0
  85. package/package.json +9 -14
  86. package/dist/convertQuery-CeJSNn37.mjs.map +0 -1
  87. package/dist/convertQuery-J8LpTG-7.js.map +0 -1
  88. package/dist/objectUtils-ButT0Mng.js.map +0 -1
  89. package/dist/objectUtils-C0WB-8ex.mjs.map +0 -1
  90. package/dist/prepareQueryObjects-BfMlS4ql.mjs.map +0 -1
  91. package/dist/prepareQueryObjects-DO3qXriW.js.map +0 -1
  92. package/dist/utils-BlMGIhvx.mjs.map +0 -1
  93. package/dist/utils-CZRhzje-.js.map +0 -1
@@ -412,6 +412,8 @@ const standardClassnames = {
412
412
  dndCopy: "dndCopy",
413
413
  dndGroup: "dndGroup",
414
414
  dndDropNotAllowed: "dndDropNotAllowed",
415
+ dndPreviewPosition: "dndPreviewPosition",
416
+ dndHidden: "dndHidden",
415
417
  dragHandle: "queryBuilder-dragHandle",
416
418
  disabled: "queryBuilder-disabled",
417
419
  muted: "queryBuilder-muted",
@@ -468,6 +470,8 @@ const defaultControlClassnames = {
468
470
  dndGroup: "",
469
471
  dndCopy: "",
470
472
  dndDropNotAllowed: "",
473
+ dndPreviewPosition: "",
474
+ dndHidden: "",
471
475
  disabled: "",
472
476
  valueListItem: "",
473
477
  branches: "",
@@ -612,7 +616,7 @@ const toArray = (a, { retainEmptyStrings } = {}) => Array.isArray(a) ? a.map((v)
612
616
  const nullFreeArray = (arr) => arr.every((el) => el === false || (el ?? false) !== false);
613
617
  //#endregion
614
618
  //#region src/utils/clsx.ts
615
- // istanbul ignore next
619
+ /* v8 ignore start -- @preserve */
616
620
  function toVal(mix) {
617
621
  let k;
618
622
  let y;
@@ -632,12 +636,13 @@ function toVal(mix) {
632
636
  }
633
637
  return str;
634
638
  }
639
+ /* v8 ignore stop -- @preserve */
635
640
  /**
636
641
  * Vendored/adapted version of the `clsx` package.
637
642
  *
638
643
  * **NOTE:** Prefer the official package from npm outside the context of React Query Builder.
639
644
  */
640
- // istanbul ignore next
645
+ // v8 ignore next
641
646
  function clsx(...args) {
642
647
  let i = 0;
643
648
  let tmp;
@@ -655,7 +660,7 @@ function clsx(...args) {
655
660
  /**
656
661
  * Converts a value to lowercase if it's a string, otherwise returns the value as is.
657
662
  */
658
- // istanbul ignore next
663
+ // v8 ignore next
659
664
  const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
660
665
  /**
661
666
  * Regex matching numeric strings. Passes for positive/negative integers, decimals,
@@ -783,8 +788,9 @@ const defaultValidator = (query) => {
783
788
  * Replace this with your custom rule validator.
784
789
  */
785
790
  const validateRule = (rule) => {
786
- // istanbul ignore else
791
+ /* v8 ignore start -- @preserve */
787
792
  if (rule.id) result[rule.id];
793
+ /* v8 ignore stop -- @preserve */
788
794
  };
789
795
  const validateGroup = (rg) => {
790
796
  const reasons = [];
@@ -795,7 +801,7 @@ const defaultValidator = (query) => {
795
801
  if (invalidICs) reasons.push(groupInvalidReasons.invalidIndependentCombinators);
796
802
  }
797
803
  if (isRuleGroupType(rg) && !defaultCombinators.map((c) => c.name).includes(rg.combinator) && rg.rules.length > 1) reasons.push(groupInvalidReasons.invalidCombinator);
798
- /* istanbul ignore else */
804
+ /* v8 ignore else -- @preserve */
799
805
  if (rg.id) result[rg.id] = reasons.length > 0 ? {
800
806
  valid: false,
801
807
  reasons
@@ -956,7 +962,7 @@ function getFirstOption(arr) {
956
962
  if (!Array.isArray(arr) || arr.length === 0) return null;
957
963
  else if (isFlexibleOptionGroupArray(arr, { allowEmpty: true })) {
958
964
  for (const og of arr) if (og.options.length > 0) return og.options[0].value ?? og.options[0].name;
959
- // istanbul ignore next
965
+ // v8 ignore next
960
966
  return null;
961
967
  }
962
968
  return arr[0].value ?? arr[0].name;
@@ -1003,7 +1009,7 @@ const uniqOptList = (originalArray) => {
1003
1009
  return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
1004
1010
  };
1005
1011
  const prepareOptionList = (props) => {
1006
- // istanbul ignore next
1012
+ // v8 ignore next
1007
1013
  const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = "~", placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
1008
1014
  const defaultOption = {
1009
1015
  id: placeholderName,
@@ -1151,7 +1157,7 @@ const isRuleOrGroupValid = (rg, validationResult, validator) => {
1151
1157
  if (typeof validator === "function" && !isRuleGroup(rg)) {
1152
1158
  const vr = validator(rg);
1153
1159
  if (typeof vr === "boolean") return vr;
1154
- // istanbul ignore else
1160
+ // v8 ignore else
1155
1161
  if (isValidationResult(vr)) return vr.valid;
1156
1162
  }
1157
1163
  return true;
@@ -1270,7 +1276,7 @@ const numerifyValues = (rg, options) => ({
1270
1276
  };
1271
1277
  const valAsArray = toArray(r.value, { retainEmptyStrings: true }).map((v) => parseNumber(v, { parseNumbers }));
1272
1278
  if (valAsArray.every((v) => typeof v === "number")) {
1273
- // istanbul ignore else
1279
+ // v8 ignore else
1274
1280
  if (valAsArray.length > 1) return {
1275
1281
  ...r,
1276
1282
  value: valAsArray
@@ -1936,22 +1942,22 @@ const defaultValueProcessorByRule = ({ operator, value, valueSource }, { escapeQ
1936
1942
  * @group Export
1937
1943
  */
1938
1944
  const defaultRuleProcessorDrizzle = (rule, _options) => {
1939
- const opts = _options ?? ( /* istanbul ignore next */ {});
1940
- // istanbul ignore next
1945
+ const opts = _options ?? ( /* v8 ignore start -- @preserve */ {});
1946
+ // v8 ignore next
1941
1947
  const { parseNumbers, preserveValueOrder, context = {} } = opts;
1942
1948
  const { columns, drizzleOperators, useRawFields } = context;
1943
- if (!columns || !drizzleOperators) return;
1949
+ if (!columns || !drizzleOperators) return void 0;
1944
1950
  const { between, eq, gt, gte, inArray, isNotNull, isNull, like, lt, lte, ne, notBetween, notInArray, notLike, sql } = drizzleOperators;
1945
1951
  const { field, operator, value, valueSource } = rule;
1946
1952
  const column = useRawFields && /[a-z][a-z0-9]*/i.test(field) ? sql.raw(field) : columns[field];
1947
1953
  const operatorLC = lc(operator);
1948
1954
  const valueIsField = valueSource === "field";
1949
1955
  const asFieldOrValue = (v) => valueIsField ? columns[v] : v;
1950
- if (!column) return;
1956
+ if (!column) return void 0;
1951
1957
  const matchEval = processMatchMode(rule);
1952
1958
  if (matchEval === false) return;
1953
1959
  else if (matchEval) {
1954
- if (opts.preset !== "postgresql") return;
1960
+ if (opts.preset !== "postgresql") return void 0;
1955
1961
  const { mode, threshold } = matchEval;
1956
1962
  const arrayElementAlias = "elem_alias";
1957
1963
  const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => ({
@@ -2040,7 +2046,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
2040
2046
  */
2041
2047
  const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns, drizzleOperators) => {
2042
2048
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
2043
- if (!columns || !drizzleOperators) return;
2049
+ if (!columns || !drizzleOperators) return void 0;
2044
2050
  const { and, not, or } = drizzleOperators;
2045
2051
  const ruleProcessor = defaultRuleProcessorDrizzle;
2046
2052
  const processRuleGroup = (rg, _outermost) => {
@@ -2259,7 +2265,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
2259
2265
  const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2260
2266
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, translations, validateRule, validationMap } = options;
2261
2267
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2262
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2268
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2263
2269
  const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
2264
2270
  const processedRules = [];
2265
2271
  let precedingCombinator = "";
@@ -2271,7 +2277,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2271
2277
  }
2272
2278
  if (isRuleGroup(rule)) {
2273
2279
  const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test(rg2.combinator ?? "")));
2274
- // istanbul ignore else
2280
+ // v8 ignore else
2275
2281
  if (processedGroup) {
2276
2282
  if (!firstRule && precedingCombinator) {
2277
2283
  processedRules.push(precedingCombinator);
@@ -2347,7 +2353,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2347
2353
  if (!isPojo(processedRule)) return "";
2348
2354
  const { sql, params: customParams } = processedRule;
2349
2355
  if (typeof sql !== "string" || !sql) return "";
2350
- // istanbul ignore else
2356
+ // v8 ignore else
2351
2357
  if (format === "parameterized" && Array.isArray(customParams)) params.push(...customParams);
2352
2358
  else if (format === "parameterized_named" && isPojo(customParams)) {
2353
2359
  Object.assign(paramsNamed, customParams);
@@ -2356,7 +2362,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2356
2362
  return sql;
2357
2363
  };
2358
2364
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2359
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2365
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2360
2366
  const processedRules = [];
2361
2367
  let precedingCombinator = "";
2362
2368
  let firstRule = true;
@@ -2367,7 +2373,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2367
2373
  }
2368
2374
  if (isRuleGroup(rule)) {
2369
2375
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2370
- // istanbul ignore else
2376
+ // v8 ignore else
2371
2377
  if (processedGroup) {
2372
2378
  if (!firstRule && precedingCombinator) {
2373
2379
  processedRules.push(precedingCombinator);
@@ -2450,10 +2456,10 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
2450
2456
  * @group Export
2451
2457
  */
2452
2458
  const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2453
- // istanbul ignore next
2459
+ // v8 ignore next
2454
2460
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap, context = {} } = options;
2455
2461
  const { sequelizeOperators: Op } = context;
2456
- if (!Op) return;
2462
+ if (!Op) return void 0;
2457
2463
  const processRuleGroup = (rg, _outermost) => {
2458
2464
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
2459
2465
  const combinator = rg.combinator.toUpperCase();
@@ -2476,7 +2482,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2476
2482
  fieldData
2477
2483
  });
2478
2484
  }).filter(Boolean);
2479
- if (expressions.length === 0) return;
2485
+ if (expressions.length === 0) return void 0;
2480
2486
  const result = expressions.length === 1 && !hasChildRules ? expressions[0] : { [lc(combinator) === "or" ? Op.or : Op.and]: expressions };
2481
2487
  return rg.not ? { [Op.not]: result } : result;
2482
2488
  };
@@ -2492,7 +2498,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2492
2498
  const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2493
2499
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2494
2500
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2495
- if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2501
+ if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2496
2502
  const processedRules = [];
2497
2503
  let precedingCombinator = "";
2498
2504
  let firstRule = true;
@@ -2503,7 +2509,7 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2503
2509
  }
2504
2510
  if (isRuleGroup(rule)) {
2505
2511
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2506
- // istanbul ignore else
2512
+ // v8 ignore else
2507
2513
  if (processedGroup) {
2508
2514
  if (!firstRule && precedingCombinator) {
2509
2515
  processedRules.push(precedingCombinator);
@@ -2539,6 +2545,325 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2539
2545
  return processRuleGroup(ruleGroup, true);
2540
2546
  };
2541
2547
  //#endregion
2548
+ //#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.ts
2549
+ const numericInputTypes = new Set([
2550
+ "number",
2551
+ "range",
2552
+ "bigint"
2553
+ ]);
2554
+ const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
2555
+ const timeRegex = /^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;
2556
+ const monthRegex = /^\d{4}-\d{2}$/;
2557
+ const weekRegex = /^\d{4}-W\d{2}$/;
2558
+ const colorRegex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
2559
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2560
+ const isValidDateComponents = (y, m, d) => {
2561
+ const date = new Date(Date.UTC(y, m - 1, d));
2562
+ return date.getUTCFullYear() === y && date.getUTCMonth() === m - 1 && date.getUTCDate() === d;
2563
+ };
2564
+ const isValidTimeComponents = (s) => {
2565
+ const parts = s.split(":");
2566
+ const h = Number(parts[0]);
2567
+ const m = Number(parts[1]);
2568
+ const sec = parts[2] ? Number.parseFloat(parts[2]) : 0;
2569
+ return h >= 0 && h <= 23 && m >= 0 && m <= 59 && sec >= 0 && sec < 60;
2570
+ };
2571
+ /**
2572
+ * Checks whether a value is compatible with the given {@link FullField.inputType}.
2573
+ * Returns a diagnostic code string if there is a mismatch, or `undefined` if OK.
2574
+ */
2575
+ const checkValueTypeMismatch = (value, inputType) => {
2576
+ if (value === null || value === void 0 || value === "") return void 0;
2577
+ if (numericInputTypes.has(inputType)) {
2578
+ const v = typeof value === "string" ? value.trim() : value;
2579
+ if (typeof v === "number" || typeof v === "bigint") return void 0;
2580
+ if (typeof v === "string" && numericRegex.test(v)) return void 0;
2581
+ return "VALUE_TYPE_MISMATCH";
2582
+ }
2583
+ if (inputType === "date") {
2584
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2585
+ const v = value.trim();
2586
+ if (!dateRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2587
+ const [y, m, d] = v.split("-").map(Number);
2588
+ return isValidDateComponents(y, m, d) ? void 0 : "VALUE_TYPE_MISMATCH";
2589
+ }
2590
+ if (inputType === "datetime-local") {
2591
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2592
+ const base = value.trim().replace(/(Z|[+-]\d{2}:?\d{2}|[+-]\d{2})$/, "");
2593
+ const tIndex = base.indexOf("T");
2594
+ if (tIndex === -1) return "VALUE_TYPE_MISMATCH";
2595
+ const datePart = base.slice(0, tIndex);
2596
+ const timePart = base.slice(tIndex + 1);
2597
+ if (!dateRegex.test(datePart) || !timeRegex.test(timePart)) return "VALUE_TYPE_MISMATCH";
2598
+ const [y, m, d] = datePart.split("-").map(Number);
2599
+ if (!isValidDateComponents(y, m, d)) return "VALUE_TYPE_MISMATCH";
2600
+ return isValidTimeComponents(timePart) ? void 0 : "VALUE_TYPE_MISMATCH";
2601
+ }
2602
+ if (inputType === "time") {
2603
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2604
+ const v = value.trim();
2605
+ if (!timeRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2606
+ return isValidTimeComponents(v) ? void 0 : "VALUE_TYPE_MISMATCH";
2607
+ }
2608
+ if (inputType === "month") {
2609
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2610
+ const v = value.trim();
2611
+ if (!monthRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2612
+ const m = Number(v.slice(5));
2613
+ return m >= 1 && m <= 12 ? void 0 : "VALUE_TYPE_MISMATCH";
2614
+ }
2615
+ if (inputType === "week") {
2616
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2617
+ const v = value.trim();
2618
+ if (!weekRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2619
+ const w = Number(v.slice(6));
2620
+ return w >= 1 && w <= 53 ? void 0 : "VALUE_TYPE_MISMATCH";
2621
+ }
2622
+ if (inputType === "color") {
2623
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2624
+ return colorRegex.test(value.trim()) ? void 0 : "VALUE_TYPE_MISMATCH";
2625
+ }
2626
+ if (inputType === "url") {
2627
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2628
+ try {
2629
+ new URL(value.trim());
2630
+ return;
2631
+ } catch {
2632
+ return "VALUE_TYPE_MISMATCH";
2633
+ }
2634
+ }
2635
+ if (inputType === "email") {
2636
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2637
+ return emailRegex.test(value.trim()) ? void 0 : "VALUE_TYPE_MISMATCH";
2638
+ }
2639
+ };
2640
+ /**
2641
+ * Rule group processor used by {@link formatQuery} for "diagnostics" format.
2642
+ *
2643
+ * Produces a {@link DiagnosticsResult} containing an annotated copy of the query
2644
+ * tree (`query`) with `valid`, `reasons`, `path`, and `level` properties on every
2645
+ * rule and group; a flat `diagnostics` array; aggregate `stats`; and a per-field
2646
+ * `fieldSummary`.
2647
+ *
2648
+ * @group Export
2649
+ */
2650
+ const defaultRuleGroupProcessorDiagnostics = (ruleGroup, options) => {
2651
+ const { fields: fieldsOption, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
2652
+ const diagnostics = [];
2653
+ const stats = {
2654
+ totalRules: 0,
2655
+ totalGroups: 0,
2656
+ validRules: 0,
2657
+ invalidRules: 0,
2658
+ validGroups: 0,
2659
+ invalidGroups: 0
2660
+ };
2661
+ const fieldSummary = {};
2662
+ const uniqueFields = toFlatOptionArray(fieldsOption);
2663
+ const fieldsByName = /* @__PURE__ */ new Map();
2664
+ for (const f of uniqueFields) fieldsByName.set(f.name, f);
2665
+ const hasFieldsConfig = fieldsByName.size > 0;
2666
+ const processRuleGroup = (rg, path) => {
2667
+ stats.totalGroups++;
2668
+ const level = path.length;
2669
+ const groupValidationEntry = validationMap[rg.id ?? ""];
2670
+ const groupSelfValid = isRuleOrGroupValid(rg, groupValidationEntry);
2671
+ const groupReasons = getReasons(groupValidationEntry);
2672
+ if (rg.muted) diagnostics.push({
2673
+ id: rg.id ?? "",
2674
+ path,
2675
+ code: "MUTED",
2676
+ message: "Group is muted",
2677
+ source: "muted"
2678
+ });
2679
+ else if (!groupSelfValid && groupValidationEntry !== void 0) diagnostics.push({
2680
+ id: rg.id ?? "",
2681
+ path,
2682
+ code: "CUSTOM_VALIDATOR",
2683
+ message: groupReasons ? `Invalid: ${groupReasons.join(", ")}` : "Group failed validation",
2684
+ source: "query-validator"
2685
+ });
2686
+ let allChildrenValid = true;
2687
+ let ruleIndex = 0;
2688
+ const annotatedRules = [];
2689
+ for (const rule of rg.rules) {
2690
+ if (typeof rule === "string") {
2691
+ annotatedRules.push(rule);
2692
+ ruleIndex++;
2693
+ continue;
2694
+ }
2695
+ const childPath = [...path, ruleIndex];
2696
+ if (isRuleGroup(rule)) {
2697
+ const annotatedGroup = processRuleGroup(rule, childPath);
2698
+ if (!annotatedGroup.valid) allChildrenValid = false;
2699
+ annotatedRules.push(annotatedGroup);
2700
+ ruleIndex++;
2701
+ continue;
2702
+ }
2703
+ stats.totalRules++;
2704
+ const childLevel = childPath.length;
2705
+ const [validationResult, fieldValidator] = validateRule(rule);
2706
+ const ruleValid = isRuleOrGroupValid(rule, validationResult, fieldValidator) && rule.field !== placeholderFieldName && rule.operator !== placeholderOperatorName && !(placeholderValueName !== void 0 && rule.value === placeholderValueName);
2707
+ collectRuleDiagnostics(rule, childPath, validationResult, fieldValidator, ruleValid, diagnostics, placeholderFieldName, placeholderOperatorName, placeholderValueName, hasFieldsConfig, fieldsByName);
2708
+ if (!ruleValid) {
2709
+ allChildrenValid = false;
2710
+ stats.invalidRules++;
2711
+ } else stats.validRules++;
2712
+ const fieldName = rule.field;
2713
+ if (!fieldSummary[fieldName]) fieldSummary[fieldName] = {
2714
+ ruleCount: 0,
2715
+ invalidCount: 0
2716
+ };
2717
+ fieldSummary[fieldName].ruleCount++;
2718
+ if (!ruleValid) fieldSummary[fieldName].invalidCount++;
2719
+ const ruleReasons = getReasons(validationResult) ?? getFieldValidatorReasons(rule, fieldValidator);
2720
+ const annotatedRule = {
2721
+ ...rule,
2722
+ valid: ruleValid,
2723
+ ...ruleReasons ? { reasons: ruleReasons } : null,
2724
+ path: childPath,
2725
+ level: childLevel
2726
+ };
2727
+ annotatedRules.push(annotatedRule);
2728
+ ruleIndex++;
2729
+ }
2730
+ const groupValid = groupSelfValid && allChildrenValid;
2731
+ if (groupValid) stats.validGroups++;
2732
+ else stats.invalidGroups++;
2733
+ if (isRuleGroupType(rg)) return {
2734
+ ...rg,
2735
+ valid: groupValid,
2736
+ ...groupReasons ? { reasons: groupReasons } : null,
2737
+ path,
2738
+ level,
2739
+ rules: annotatedRules
2740
+ };
2741
+ return {
2742
+ ...rg,
2743
+ valid: groupValid,
2744
+ ...groupReasons ? { reasons: groupReasons } : null,
2745
+ path,
2746
+ level,
2747
+ rules: annotatedRules
2748
+ };
2749
+ };
2750
+ const query = processRuleGroup(ruleGroup, []);
2751
+ if (hasFieldsConfig) {
2752
+ const referencedFields = new Set(Object.keys(fieldSummary));
2753
+ for (const [fieldName] of fieldsByName) if (!referencedFields.has(fieldName)) diagnostics.push({
2754
+ id: "",
2755
+ path: [],
2756
+ code: "UNREFERENCED_FIELD",
2757
+ message: `Field "${fieldName}" is defined in the fields config but not used in the query`,
2758
+ source: "field-check"
2759
+ });
2760
+ }
2761
+ return {
2762
+ query,
2763
+ diagnostics,
2764
+ stats,
2765
+ fieldSummary
2766
+ };
2767
+ };
2768
+ /**
2769
+ * Collects diagnostic entries for a single rule.
2770
+ */
2771
+ const collectRuleDiagnostics = (rule, path, validationResult, fieldValidator, ruleValid, diagnostics, placeholderFieldName, placeholderOperatorName, placeholderValueName, hasFieldsConfig, fieldsByName) => {
2772
+ const id = rule.id ?? "";
2773
+ if (rule.muted) diagnostics.push({
2774
+ id,
2775
+ path,
2776
+ code: "MUTED",
2777
+ message: "Rule is muted",
2778
+ source: "muted"
2779
+ });
2780
+ if (rule.field === placeholderFieldName) diagnostics.push({
2781
+ id,
2782
+ path,
2783
+ code: "PLACEHOLDER_FIELD",
2784
+ message: "Rule has a placeholder field",
2785
+ source: "placeholder"
2786
+ });
2787
+ if (rule.operator === placeholderOperatorName) diagnostics.push({
2788
+ id,
2789
+ path,
2790
+ code: "PLACEHOLDER_OPERATOR",
2791
+ message: "Rule has a placeholder operator",
2792
+ source: "placeholder"
2793
+ });
2794
+ if (placeholderValueName !== void 0 && rule.value === placeholderValueName) diagnostics.push({
2795
+ id,
2796
+ path,
2797
+ code: "PLACEHOLDER_VALUE",
2798
+ message: "Rule has a placeholder value",
2799
+ source: "placeholder"
2800
+ });
2801
+ if (!rule.muted && rule.field !== placeholderFieldName && rule.operator !== placeholderOperatorName && !(placeholderValueName !== void 0 && rule.value === placeholderValueName)) {
2802
+ if (typeof validationResult === "boolean" && !validationResult) diagnostics.push({
2803
+ id,
2804
+ path,
2805
+ code: "CUSTOM_VALIDATOR",
2806
+ message: "Rule failed validation",
2807
+ source: "query-validator"
2808
+ });
2809
+ else if (typeof validationResult !== "boolean" && isValidationResult(validationResult) && !validationResult.valid) {
2810
+ const reasons = validationResult.reasons;
2811
+ diagnostics.push({
2812
+ id,
2813
+ path,
2814
+ code: "CUSTOM_VALIDATOR",
2815
+ message: reasons ? `Invalid: ${reasons.join(", ")}` : "Rule failed validation",
2816
+ source: "query-validator"
2817
+ });
2818
+ } else if (!ruleValid && typeof fieldValidator === "function") {
2819
+ const vr = fieldValidator(rule);
2820
+ const reasons = typeof vr !== "boolean" && isValidationResult(vr) && !vr.valid ? vr.reasons : void 0;
2821
+ diagnostics.push({
2822
+ id,
2823
+ path,
2824
+ code: "CUSTOM_VALIDATOR",
2825
+ message: reasons ? `Invalid: ${reasons.join(", ")}` : "Rule failed field validation",
2826
+ source: "field-validator"
2827
+ });
2828
+ }
2829
+ }
2830
+ if (hasFieldsConfig && !fieldsByName.has(rule.field) && rule.field !== placeholderFieldName) diagnostics.push({
2831
+ id,
2832
+ path,
2833
+ code: "UNDEFINED_FIELD",
2834
+ message: `Field "${rule.field}" is not defined in the fields config`,
2835
+ source: "field-check"
2836
+ });
2837
+ if (hasFieldsConfig) {
2838
+ const fieldDef = fieldsByName.get(rule.field);
2839
+ if (fieldDef?.inputType) {
2840
+ const mismatchCode = checkValueTypeMismatch(rule.value, fieldDef.inputType);
2841
+ if (mismatchCode) diagnostics.push({
2842
+ id,
2843
+ path,
2844
+ code: mismatchCode,
2845
+ message: `Value "${rule.value}" is not compatible with input type "${fieldDef.inputType}"`,
2846
+ source: "type-check"
2847
+ });
2848
+ }
2849
+ }
2850
+ };
2851
+ /**
2852
+ * Extracts `reasons` from a validation result, if present.
2853
+ */
2854
+ const getReasons = (validationResult) => {
2855
+ if (typeof validationResult !== "boolean" && isValidationResult(validationResult) && !validationResult.valid && validationResult.reasons) return validationResult.reasons;
2856
+ };
2857
+ /**
2858
+ * Runs a field-level validator and extracts `reasons` if present.
2859
+ */
2860
+ const getFieldValidatorReasons = (rule, fieldValidator) => {
2861
+ if (typeof fieldValidator === "function") {
2862
+ const vr = fieldValidator(rule);
2863
+ if (typeof vr !== "boolean" && isValidationResult(vr) && !vr.valid && vr.reasons) return vr.reasons;
2864
+ }
2865
+ };
2866
+ //#endregion
2542
2867
  //#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.ts
2543
2868
  const rangeOperatorMap = {
2544
2869
  "<": "lt",
@@ -2917,12 +3242,12 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
2917
3242
  return negateIf(`(&(${field}>=${ldapEscape(firstValue)})(${field}<=${ldapEscape(secondValue)}))`, operatorLC === "notbetween");
2918
3243
  }
2919
3244
  }
2920
- // istanbul ignore next
3245
+ // v8 ignore next
2921
3246
  return "";
2922
3247
  };
2923
3248
  //#endregion
2924
3249
  //#region src/utils/formatQuery/defaultValueProcessorNL.ts
2925
- const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
3250
+ const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : /* v8 ignore next -- @preserve */ v;
2926
3251
  /**
2927
3252
  * Default value processor used by {@link formatQuery} for "natural_language" format.
2928
3253
  *
@@ -2940,7 +3265,7 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
2940
3265
  quoteFieldNamesWith,
2941
3266
  fieldIdentifierSeparator
2942
3267
  });
2943
- const t = translations ?? ( /* istanbul ignore next */ {});
3268
+ const t = translations ?? ( /* v8 ignore start -- @preserve */ {});
2944
3269
  const orTL = t.or ?? "or";
2945
3270
  const trueTL = t.true ?? "true";
2946
3271
  const falseTL = t.false ?? "false";
@@ -2996,7 +3321,7 @@ const defaultExportOperatorMap = {
2996
3321
  between: ["is between", "is between the values in"],
2997
3322
  notbetween: ["is not between", "is not between the values in"]
2998
3323
  };
2999
- /* istanbul ignore next */
3324
+ /* v8 ignore next -- @preserve */
3000
3325
  const defaultGetOperators = () => [];
3001
3326
  /**
3002
3327
  * Default operator processor used by {@link formatQuery} for "natural_language" format.
@@ -3005,7 +3330,7 @@ const defaultGetOperators = () => [];
3005
3330
  */
3006
3331
  const defaultOperatorProcessorNL = (rule, opts = {}) => {
3007
3332
  const { field, operator, valueSource = "value" } = rule;
3008
- // istanbul ignore next
3333
+ // v8 ignore next
3009
3334
  const { getOperators = defaultGetOperators, operatorMap: operatorMapParam = defaultExportOperatorMap } = opts;
3010
3335
  const mergedOperatorMap = new Map(Object.entries(defaultExportOperatorMap));
3011
3336
  for (const [key, value] of Object.entries(operatorMapParam)) mergedOperatorMap.set(lc(key), value);
@@ -3034,8 +3359,8 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
3034
3359
  */
3035
3360
  const defaultRuleProcessorNL = (rule, opts) => {
3036
3361
  const { field, operator } = rule;
3037
- // istanbul ignore next
3038
- const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts ?? ( /* istanbul ignore next */ {});
3362
+ // v8 ignore next
3363
+ const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts ?? ( /* v8 ignore start -- @preserve */ {});
3039
3364
  const processedField = getQuotedFieldName(fieldData?.label ?? field, {
3040
3365
  quoteFieldNamesWith,
3041
3366
  fieldIdentifierSeparator
@@ -3141,7 +3466,7 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
3141
3466
  * @group Export
3142
3467
  */
3143
3468
  const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3144
- // istanbul ignore next
3469
+ // v8 ignore next
3145
3470
  const { fieldData, format, getNextNamedParam, parseNumbers, paramPrefix, paramsKeepPrefix, numberedParams, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator, concatOperator, operatorProcessor = defaultOperatorProcessorSQL, valueProcessor = defaultValueProcessorByRule } = opts ?? {};
3146
3471
  const { processedParams = [] } = meta ?? {};
3147
3472
  const parameterized = format === "parameterized";
@@ -3160,6 +3485,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3160
3485
  });
3161
3486
  const ruleField = wrapFieldName(rule.field);
3162
3487
  const matchEval = processMatchMode(rule);
3488
+ /* v8 ignore start -- @preserve */
3163
3489
  if (matchEval === false) return;
3164
3490
  else if (matchEval) {
3165
3491
  if (opts?.preset !== "postgresql") return finalize("");
@@ -3172,7 +3498,6 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3172
3498
  ...opts,
3173
3499
  fields: []
3174
3500
  });
3175
- // istanbul ignore else
3176
3501
  if (Array.isArray(nestedParams)) params.push(...nestedParams);
3177
3502
  else Object.assign(paramsNamed, nestedParams);
3178
3503
  switch (mode) {
@@ -3187,6 +3512,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3187
3512
  }
3188
3513
  }
3189
3514
  }
3515
+ /* v8 ignore stop -- @preserve */
3190
3516
  const value = valueProcessor(rule, {
3191
3517
  parseNumbers,
3192
3518
  quoteFieldNamesWith,
@@ -3227,7 +3553,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3227
3553
  }
3228
3554
  let paramValue = rule.value;
3229
3555
  if (typeof rule.value === "string") if (shouldRenderAsNumber(rule.value, parseNumbers)) paramValue = parseNumber(rule.value, { parseNumbers });
3230
- else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : value;
3556
+ else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : /* v8 ignore next -- @preserve */ value;
3231
3557
  let paramName = "";
3232
3558
  if (parameterized) params.push(paramValue);
3233
3559
  else {
@@ -3246,9 +3572,9 @@ const processNumber = (value, fallback, parseNumbers) => shouldRenderAsNumber(va
3246
3572
  */
3247
3573
  const defaultRuleProcessorPrisma = (rule, options = {}) => {
3248
3574
  const { field, operator, value, valueSource } = rule;
3249
- // istanbul ignore next
3575
+ // v8 ignore next
3250
3576
  const { parseNumbers, preserveValueOrder } = options;
3251
- if (valueSource === "field" || processMatchMode(rule)) return;
3577
+ if (valueSource === "field" || processMatchMode(rule)) return void 0;
3252
3578
  const operatorLC = lc(operator);
3253
3579
  switch (operatorLC) {
3254
3580
  case "=": return { [field]: processNumber(value, value, parseNumbers) };
@@ -3306,7 +3632,7 @@ const defaultRuleProcessorPrisma = (rule, options = {}) => {
3306
3632
  */
3307
3633
  const defaultRuleProcessorSequelize = (rule, { parseNumbers, preserveValueOrder, context = {} } = {}) => {
3308
3634
  const { sequelizeOperators: Op, sequelizeCol: col, sequelizeFn: fn } = context;
3309
- if (processMatchMode(rule)) return;
3635
+ if (processMatchMode(rule)) return void 0;
3310
3636
  const { field, operator, value, valueSource } = rule;
3311
3637
  const valueIsField = valueSource === "field";
3312
3638
  const operatorLC = lc(operator);
@@ -3410,9 +3736,10 @@ const defaultRuleProcessors = {
3410
3736
  prisma: defaultRuleProcessorPrisma,
3411
3737
  sequelize: defaultRuleProcessorSequelize,
3412
3738
  spel: defaultRuleProcessorSpEL,
3413
- sql: defaultRuleProcessorSQL
3739
+ sql: defaultRuleProcessorSQL,
3740
+ diagnostics: defaultRuleProcessorSQL
3414
3741
  };
3415
- /* istanbul ignore next */
3742
+ /* v8 ignore next -- @preserve */
3416
3743
  const defaultOperatorProcessor = (r) => r.operator;
3417
3744
  const defaultOperatorProcessors = {
3418
3745
  cel: defaultOperatorProcessor,
@@ -3431,7 +3758,8 @@ const defaultOperatorProcessors = {
3431
3758
  prisma: defaultOperatorProcessor,
3432
3759
  sequelize: defaultOperatorProcessor,
3433
3760
  spel: defaultOperatorProcessor,
3434
- sql: defaultOperatorProcessorSQL
3761
+ sql: defaultOperatorProcessorSQL,
3762
+ diagnostics: defaultOperatorProcessor
3435
3763
  };
3436
3764
  const defaultFallbackExpressions = {
3437
3765
  cel: "1 == 1",
@@ -3505,24 +3833,26 @@ function formatQuery(ruleGroup, optionParam = {}) {
3505
3833
  const getOperators = (f, m) => toFullOptionList(getOperators_option(f, m) ?? []);
3506
3834
  const fallbackExpression = fallbackExpression_option ?? defaultFallbackExpressions[format] ?? defaultFallbackExpressions.sql;
3507
3835
  let validationMap = {};
3508
- // istanbul ignore else
3836
+ // v8 ignore else
3509
3837
  if (typeof validator === "function") {
3510
3838
  const validationResult = validator(ruleGroup);
3511
3839
  if (typeof validationResult === "boolean") {
3512
- // istanbul ignore else
3513
- if (!validationResult) return format === "parameterized" ? {
3514
- sql: fallbackExpression,
3515
- params: []
3516
- } : format === "parameterized_named" ? {
3517
- sql: fallbackExpression,
3518
- params: {}
3519
- } : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" ? void 0 : fallbackExpression;
3840
+ // v8 ignore else
3841
+ if (!validationResult) {
3842
+ if (format !== "diagnostics") return format === "parameterized" ? {
3843
+ sql: fallbackExpression,
3844
+ params: []
3845
+ } : format === "parameterized_named" ? {
3846
+ sql: fallbackExpression,
3847
+ params: {}
3848
+ } : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" ? void 0 : fallbackExpression;
3849
+ }
3520
3850
  } else validationMap = validationResult;
3521
3851
  }
3522
3852
  const validatorMap = {};
3523
3853
  const uniqueFields = toFlatOptionArray(fields);
3524
3854
  for (const f of uniqueFields)
3525
- // istanbul ignore else
3855
+ // v8 ignore else
3526
3856
  if (typeof f.validator === "function") validatorMap[f.value ?? f.name] = f.validator;
3527
3857
  const validateRule = (rule) => {
3528
3858
  let validationResult;
@@ -3532,7 +3862,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3532
3862
  const fieldArr = uniqueFields.filter((f) => f.name === rule.field);
3533
3863
  if (fieldArr.length > 0) {
3534
3864
  const field = fieldArr[0];
3535
- // istanbul ignore else
3865
+ // v8 ignore else
3536
3866
  if (typeof field.validator === "function") fieldValidator = field.validator;
3537
3867
  }
3538
3868
  }
@@ -3576,6 +3906,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3576
3906
  case "prisma": return defaultRuleGroupProcessorPrisma(ruleGroup, finalOptions);
3577
3907
  case "drizzle": return defaultRuleGroupProcessorDrizzle(ruleGroup, finalOptions);
3578
3908
  case "sequelize": return defaultRuleGroupProcessorSequelize(ruleGroup, finalOptions);
3909
+ case "diagnostics": return defaultRuleGroupProcessorDiagnostics(ruleGroup, finalOptions);
3579
3910
  default: return "";
3580
3911
  }
3581
3912
  }
@@ -3726,6 +4057,7 @@ const generateAccessibleDescription = (params) => pathsAreEqual([], params.path)
3726
4057
  //#endregion
3727
4058
  //#region src/utils/generateID.ts
3728
4059
  const cryptoModule = globalThis.crypto;
4060
+ const uuidV4regex = /^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i;
3729
4061
  /**
3730
4062
  * Default `id` generator. Generates a valid v4 UUID. Uses `crypto.randomUUID()`
3731
4063
  * when available, otherwise uses an alternate method based on `getRandomValues`.
@@ -3735,11 +4067,11 @@ const cryptoModule = globalThis.crypto;
3735
4067
  * ```
3736
4068
  * @returns Valid v4 UUID
3737
4069
  */
3738
- // istanbul ignore next
4070
+ // v8 ignore next
3739
4071
  let generateID = () => "00-0-4-2-000".replaceAll(/[^-]/g, (s) => ((Math.random() + Math.trunc(s)) * 65536 >> Number.parseInt(s)).toString(16).padStart(4, "0"));
3740
- // istanbul ignore else
4072
+ // v8 ignore else
3741
4073
  if (cryptoModule) {
3742
- // istanbul ignore else
4074
+ // v8 ignore else
3743
4075
  if (typeof cryptoModule.randomUUID === "function") generateID = () => cryptoModule.randomUUID();
3744
4076
  else if (typeof cryptoModule.getRandomValues === "function") {
3745
4077
  const position19vals = "89ab";
@@ -3772,7 +4104,7 @@ const dummyFD$1 = {
3772
4104
  * `FullOption<MatchMode>[]` of all match modes by default.
3773
4105
  */
3774
4106
  const getMatchModesUtil = (fieldData, getMatchModes) => {
3775
- const fd = fieldData ? toFullOption(fieldData) : dummyFD$1;
4107
+ const fd = fieldData ? toFullOption(fieldData) : /* v8 ignore next -- @preserve */ dummyFD$1;
3776
4108
  let matchModes = fd.matchModes ?? false;
3777
4109
  if (!matchModes && getMatchModes) matchModes = getMatchModes(fd.value, { fieldData: fd });
3778
4110
  if (matchModes === true) return defaultMatchModes;
@@ -3834,7 +4166,7 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
3834
4166
  const mergeAnyTranslations = (base, ...otherTranslations) => {
3835
4167
  const result = { ...base };
3836
4168
  for (const translations of otherTranslations)
3837
- // istanbul ignore else
4169
+ // v8 ignore else
3838
4170
  if (translations) for (const key of objectKeys(translations)) {
3839
4171
  if (isUnsafeKey(key)) continue;
3840
4172
  if (result[key]) result[key] = {
@@ -3895,6 +4227,8 @@ const mergeClassnames = (...args) => ({
3895
4227
  dndCopy: joinClassnamesByName("dndCopy", args),
3896
4228
  dndGroup: joinClassnamesByName("dndGroup", args),
3897
4229
  dndDropNotAllowed: joinClassnamesByName("dndDropNotAllowed", args),
4230
+ dndPreviewPosition: joinClassnamesByName("dndPreviewPosition", args),
4231
+ dndHidden: joinClassnamesByName("dndHidden", args),
3898
4232
  disabled: joinClassnamesByName("disabled", args),
3899
4233
  valueListItem: joinClassnamesByName("valueListItem", args),
3900
4234
  matchMode: joinClassnamesByName("matchMode", args),
@@ -3990,7 +4324,7 @@ const regenerateIDs = (subject, { idGenerator = generateID } = {}) => {
3990
4324
  ...subject,
3991
4325
  id: idGenerator()
3992
4326
  };
3993
- // istanbul ignore else
4327
+ // v8 ignore else
3994
4328
  if (Array.isArray(newGroup.rules)) newGroup.rules = subject.rules.map((r) => typeof r === "string" ? r : isRuleGroup(r) ? regenerateIDs(r, { idGenerator }) : regenerateID(r, { idGenerator }));
3995
4329
  return newGroup;
3996
4330
  };
@@ -4284,6 +4618,6 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
4284
4618
  return query;
4285
4619
  };
4286
4620
  //#endregion
4287
- export { LogType, TestID, add, addInPlace, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, removeInPlace, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace };
4621
+ export { LogType, TestID, add, addInPlace, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, removeInPlace, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex };
4288
4622
 
4289
4623
  //# sourceMappingURL=react-querybuilder_core.mjs.map