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