@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
@@ -1,4 +1,4 @@
1
- import { O as OptionList, v as FullField, y as ValueSources } from "./index-CYT4Saz-.mjs";
1
+ import { b as ValueSources, k as OptionList, y as FullField } from "./index-Lht_Wq3V.mjs";
2
2
 
3
3
  //#region src/types/import.d.ts
4
4
  /**
@@ -24,4 +24,4 @@ interface ParserCommonOptions {
24
24
  }
25
25
  //#endregion
26
26
  export { ParserCommonOptions as t };
27
- //# sourceMappingURL=import-BwQqExpO.d.mts.map
27
+ //# sourceMappingURL=import-0wp72lLT.d.mts.map
@@ -1,4 +1,4 @@
1
- import { O as OptionList, v as FullField, y as ValueSources } from "./index-DBlQeLax.js";
1
+ import { b as ValueSources, k as OptionList, y as FullField } from "./index-D5TXNIzF.js";
2
2
 
3
3
  //#region src/types/import.d.ts
4
4
  /**
@@ -24,4 +24,4 @@ interface ParserCommonOptions {
24
24
  }
25
25
  //#endregion
26
26
  export { ParserCommonOptions as t };
27
- //# sourceMappingURL=import-CrJf23Nf.d.ts.map
27
+ //# sourceMappingURL=import-yRVJh7E1.d.ts.map
@@ -1216,7 +1216,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
1216
1216
  */
1217
1217
  type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
1218
1218
  type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
1219
- type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
1219
+ type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption } : never;
1220
1220
  type WithOptionalClassName<T> = T & {
1221
1221
  className?: Classname;
1222
1222
  };
@@ -1304,13 +1304,13 @@ type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersM
1304
1304
  *
1305
1305
  * @group Export
1306
1306
  */
1307
- type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize";
1307
+ type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize" | "diagnostics";
1308
1308
  /**
1309
1309
  * Export formats for {@link formatQuery} that produce objects instead of strings.
1310
1310
  *
1311
1311
  * @group Export
1312
1312
  */
1313
- type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query";
1313
+ type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query" | "diagnostics";
1314
1314
  /**
1315
1315
  * Available presets for the "sql" export format.
1316
1316
  *
@@ -1685,6 +1685,150 @@ interface ParameterizedNamedSQL {
1685
1685
  params: Record<string, any>;
1686
1686
  }
1687
1687
  /**
1688
+ * A {@link RuleType} annotated with diagnostics results, as produced
1689
+ * by {@link formatQuery} for the `"diagnostics"` format.
1690
+ *
1691
+ * The generics mirror those of {@link RuleType}.
1692
+ *
1693
+ * @group Export
1694
+ */
1695
+ type RuleDiagnosticsResult<F extends string = string, O extends string = string, V = any, C extends string = string> = RuleType<F, O, V, C> & {
1696
+ /** Whether the rule passed all validation checks. */valid: boolean;
1697
+ /**
1698
+ * Reasons why the rule is invalid. Only present when
1699
+ * the rule is invalid and specific reasons were provided
1700
+ * by the validator.
1701
+ */
1702
+ reasons?: any[]; /** The path to this rule within the query tree. */
1703
+ path: number[]; /** The nesting depth of this rule (`path.length`). */
1704
+ level: number;
1705
+ };
1706
+ /**
1707
+ * The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
1708
+ *
1709
+ * @group Export
1710
+ */
1711
+ type RuleGroupDiagnosticsArray<RG extends RuleGroupDiagnosticsResult = RuleGroupDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult> = RuleGroupArray<RG, R>;
1712
+ /**
1713
+ * A {@link RuleGroupType} annotated with diagnostics results, as produced
1714
+ * by {@link formatQuery} for the `"diagnostics"` format.
1715
+ *
1716
+ * The generics mirror those of {@link RuleGroupType}.
1717
+ *
1718
+ * @group Export
1719
+ */
1720
+ interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupType<R, C>, "rules"> {
1721
+ /** Whether the group and all of its descendants are valid. */
1722
+ valid: boolean;
1723
+ /**
1724
+ * Reasons why the group itself is invalid. Only present when
1725
+ * the group is invalid and specific reasons were provided
1726
+ * by the validator.
1727
+ */
1728
+ reasons?: any[];
1729
+ /** The path to this group within the query tree. */
1730
+ path: number[];
1731
+ /** The nesting depth of this group (`path.length`). */
1732
+ level: number;
1733
+ rules: RuleGroupDiagnosticsArray<RuleGroupDiagnosticsResult<R, C>, R>;
1734
+ }
1735
+ /**
1736
+ * The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
1737
+ *
1738
+ * Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
1739
+ *
1740
+ * @group Export
1741
+ */
1742
+ type RuleGroupICDiagnosticsArray<RG extends RuleGroupICDiagnosticsResult = RuleGroupICDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> = RuleGroupICArray<RG, R, C>;
1743
+ /**
1744
+ * A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
1745
+ * by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
1746
+ *
1747
+ * The generics mirror those of {@link RuleGroupTypeIC}.
1748
+ *
1749
+ * @group Export
1750
+ */
1751
+ interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupTypeIC<R, C>, "rules"> {
1752
+ /** Whether the group and all of its descendants are valid. */
1753
+ valid: boolean;
1754
+ /**
1755
+ * Reasons why the group itself is invalid. Only present when
1756
+ * the group is invalid and specific reasons were provided
1757
+ * by the validator.
1758
+ */
1759
+ reasons?: any[];
1760
+ /** The path to this group within the query tree. */
1761
+ path: number[];
1762
+ /** The nesting depth of this group (`path.length`). */
1763
+ level: number;
1764
+ rules: RuleGroupICDiagnosticsArray<RuleGroupICDiagnosticsResult<R, C>, R, C>;
1765
+ }
1766
+ /**
1767
+ * A single diagnostic entry produced by the `"diagnostics"` format.
1768
+ *
1769
+ * @group Export
1770
+ */
1771
+ interface DiagnosticEntry {
1772
+ /** The `id` of the rule or group this diagnostic pertains to. */
1773
+ id: string;
1774
+ /** The path to the rule or group within the query tree. */
1775
+ path: number[];
1776
+ /** A machine-readable code identifying the type of diagnostic. */
1777
+ code: string;
1778
+ /** A human-readable description of the diagnostic. */
1779
+ message: string;
1780
+ /**
1781
+ * Which check produced this diagnostic.
1782
+ *
1783
+ * - `"placeholder"` — a placeholder field, operator, or value
1784
+ * - `"muted"` — a muted rule or group
1785
+ * - `"query-validator"` — the query-level validator
1786
+ * - `"field-validator"` — a field-level validator
1787
+ * - `"type-check"` — value/type mismatch based on field `inputType`
1788
+ * - `"field-check"` — field existence check against the `fields` config
1789
+ */
1790
+ source: "placeholder" | "muted" | "query-validator" | "field-validator" | "type-check" | "field-check";
1791
+ }
1792
+ /**
1793
+ * Aggregate statistics for the `"diagnostics"` format.
1794
+ *
1795
+ * @group Export
1796
+ */
1797
+ interface DiagnosticsStats {
1798
+ totalRules: number;
1799
+ totalGroups: number;
1800
+ validRules: number;
1801
+ invalidRules: number;
1802
+ validGroups: number;
1803
+ invalidGroups: number;
1804
+ }
1805
+ /**
1806
+ * Per-field summary entry for the `"diagnostics"` format.
1807
+ *
1808
+ * @group Export
1809
+ */
1810
+ interface DiagnosticsFieldSummaryEntry {
1811
+ /** Number of rules referencing this field. */
1812
+ ruleCount: number;
1813
+ /** Number of invalid rules referencing this field. */
1814
+ invalidCount: number;
1815
+ }
1816
+ /**
1817
+ * Top-level result of {@link formatQuery} for the `"diagnostics"` format.
1818
+ *
1819
+ * @group Export
1820
+ */
1821
+ interface DiagnosticsResult {
1822
+ /** The annotated query tree with `valid`, `path`, and `level` on every node. */
1823
+ query: RuleGroupDiagnosticsResult | RuleGroupICDiagnosticsResult;
1824
+ /** A flat array of all diagnostic entries across the tree. */
1825
+ diagnostics: DiagnosticEntry[];
1826
+ /** Aggregate statistics about the query. */
1827
+ stats: DiagnosticsStats;
1828
+ /** Per-field summary of rule counts and invalid counts. */
1829
+ fieldSummary: Record<string, DiagnosticsFieldSummaryEntry>;
1830
+ }
1831
+ /**
1688
1832
  * @group Export
1689
1833
  */
1690
1834
  interface RQBJsonLogicStartsWith {
@@ -1744,5 +1888,5 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
1744
1888
  */
1745
1889
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
1746
1890
  //#endregion
1747
- export { Except as A, DefaultCombinatorName as C, RuleType as D, RuleGroupType as E, OptionList as O, RuleGroupTypeIC as S, DefaultRuleGroupType as T, ValueProcessorOptions as _, FormatQueryOptions as a, DefaultRuleGroupTypeIC as b, NLTranslations as c, RQBJsonLogic as d, RuleGroupProcessor as f, ValueProcessorLegacy as g, ValueProcessorByRule as h, ExportOperatorMap as i, SetRequired as k, ParameterizedNamedSQL as l, SQLPreset as m, ExportFormat as n, GroupVariantCondition as o, RuleProcessor as p, ExportObjectFormats as r, NLTranslationKey as s, ConstituentWordOrder as t, ParameterizedSQL as u, FullField as v, DefaultOperatorName as w, RuleGroupTypeAny as x, ValueSources as y };
1748
- //# sourceMappingURL=index-CYT4Saz-.d.mts.map
1891
+ export { SetRequired as A, RuleGroupTypeIC as C, RuleGroupType as D, DefaultRuleGroupType as E, RuleType as O, RuleGroupTypeAny as S, DefaultOperatorName as T, ValueProcessorLegacy as _, ExportOperatorMap as a, ValueSources as b, NLTranslationKey as c, ParameterizedSQL as d, RQBJsonLogic as f, ValueProcessorByRule as g, SQLPreset as h, ExportObjectFormats as i, Except as j, OptionList as k, NLTranslations as l, RuleProcessor as m, DiagnosticsResult as n, FormatQueryOptions as o, RuleGroupProcessor as p, ExportFormat as r, GroupVariantCondition as s, ConstituentWordOrder as t, ParameterizedNamedSQL as u, ValueProcessorOptions as v, DefaultCombinatorName as w, DefaultRuleGroupTypeIC as x, FullField as y };
1892
+ //# sourceMappingURL=index-D5TXNIzF.d.ts.map
@@ -1216,7 +1216,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
1216
1216
  */
1217
1217
  type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
1218
1218
  type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
1219
- type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
1219
+ type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption } : never;
1220
1220
  type WithOptionalClassName<T> = T & {
1221
1221
  className?: Classname;
1222
1222
  };
@@ -1304,13 +1304,13 @@ type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersM
1304
1304
  *
1305
1305
  * @group Export
1306
1306
  */
1307
- type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize";
1307
+ type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize" | "diagnostics";
1308
1308
  /**
1309
1309
  * Export formats for {@link formatQuery} that produce objects instead of strings.
1310
1310
  *
1311
1311
  * @group Export
1312
1312
  */
1313
- type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query";
1313
+ type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query" | "diagnostics";
1314
1314
  /**
1315
1315
  * Available presets for the "sql" export format.
1316
1316
  *
@@ -1685,6 +1685,150 @@ interface ParameterizedNamedSQL {
1685
1685
  params: Record<string, any>;
1686
1686
  }
1687
1687
  /**
1688
+ * A {@link RuleType} annotated with diagnostics results, as produced
1689
+ * by {@link formatQuery} for the `"diagnostics"` format.
1690
+ *
1691
+ * The generics mirror those of {@link RuleType}.
1692
+ *
1693
+ * @group Export
1694
+ */
1695
+ type RuleDiagnosticsResult<F extends string = string, O extends string = string, V = any, C extends string = string> = RuleType<F, O, V, C> & {
1696
+ /** Whether the rule passed all validation checks. */valid: boolean;
1697
+ /**
1698
+ * Reasons why the rule is invalid. Only present when
1699
+ * the rule is invalid and specific reasons were provided
1700
+ * by the validator.
1701
+ */
1702
+ reasons?: any[]; /** The path to this rule within the query tree. */
1703
+ path: number[]; /** The nesting depth of this rule (`path.length`). */
1704
+ level: number;
1705
+ };
1706
+ /**
1707
+ * The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
1708
+ *
1709
+ * @group Export
1710
+ */
1711
+ type RuleGroupDiagnosticsArray<RG extends RuleGroupDiagnosticsResult = RuleGroupDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult> = RuleGroupArray<RG, R>;
1712
+ /**
1713
+ * A {@link RuleGroupType} annotated with diagnostics results, as produced
1714
+ * by {@link formatQuery} for the `"diagnostics"` format.
1715
+ *
1716
+ * The generics mirror those of {@link RuleGroupType}.
1717
+ *
1718
+ * @group Export
1719
+ */
1720
+ interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupType<R, C>, "rules"> {
1721
+ /** Whether the group and all of its descendants are valid. */
1722
+ valid: boolean;
1723
+ /**
1724
+ * Reasons why the group itself is invalid. Only present when
1725
+ * the group is invalid and specific reasons were provided
1726
+ * by the validator.
1727
+ */
1728
+ reasons?: any[];
1729
+ /** The path to this group within the query tree. */
1730
+ path: number[];
1731
+ /** The nesting depth of this group (`path.length`). */
1732
+ level: number;
1733
+ rules: RuleGroupDiagnosticsArray<RuleGroupDiagnosticsResult<R, C>, R>;
1734
+ }
1735
+ /**
1736
+ * The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
1737
+ *
1738
+ * Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
1739
+ *
1740
+ * @group Export
1741
+ */
1742
+ type RuleGroupICDiagnosticsArray<RG extends RuleGroupICDiagnosticsResult = RuleGroupICDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> = RuleGroupICArray<RG, R, C>;
1743
+ /**
1744
+ * A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
1745
+ * by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
1746
+ *
1747
+ * The generics mirror those of {@link RuleGroupTypeIC}.
1748
+ *
1749
+ * @group Export
1750
+ */
1751
+ interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupTypeIC<R, C>, "rules"> {
1752
+ /** Whether the group and all of its descendants are valid. */
1753
+ valid: boolean;
1754
+ /**
1755
+ * Reasons why the group itself is invalid. Only present when
1756
+ * the group is invalid and specific reasons were provided
1757
+ * by the validator.
1758
+ */
1759
+ reasons?: any[];
1760
+ /** The path to this group within the query tree. */
1761
+ path: number[];
1762
+ /** The nesting depth of this group (`path.length`). */
1763
+ level: number;
1764
+ rules: RuleGroupICDiagnosticsArray<RuleGroupICDiagnosticsResult<R, C>, R, C>;
1765
+ }
1766
+ /**
1767
+ * A single diagnostic entry produced by the `"diagnostics"` format.
1768
+ *
1769
+ * @group Export
1770
+ */
1771
+ interface DiagnosticEntry {
1772
+ /** The `id` of the rule or group this diagnostic pertains to. */
1773
+ id: string;
1774
+ /** The path to the rule or group within the query tree. */
1775
+ path: number[];
1776
+ /** A machine-readable code identifying the type of diagnostic. */
1777
+ code: string;
1778
+ /** A human-readable description of the diagnostic. */
1779
+ message: string;
1780
+ /**
1781
+ * Which check produced this diagnostic.
1782
+ *
1783
+ * - `"placeholder"` — a placeholder field, operator, or value
1784
+ * - `"muted"` — a muted rule or group
1785
+ * - `"query-validator"` — the query-level validator
1786
+ * - `"field-validator"` — a field-level validator
1787
+ * - `"type-check"` — value/type mismatch based on field `inputType`
1788
+ * - `"field-check"` — field existence check against the `fields` config
1789
+ */
1790
+ source: "placeholder" | "muted" | "query-validator" | "field-validator" | "type-check" | "field-check";
1791
+ }
1792
+ /**
1793
+ * Aggregate statistics for the `"diagnostics"` format.
1794
+ *
1795
+ * @group Export
1796
+ */
1797
+ interface DiagnosticsStats {
1798
+ totalRules: number;
1799
+ totalGroups: number;
1800
+ validRules: number;
1801
+ invalidRules: number;
1802
+ validGroups: number;
1803
+ invalidGroups: number;
1804
+ }
1805
+ /**
1806
+ * Per-field summary entry for the `"diagnostics"` format.
1807
+ *
1808
+ * @group Export
1809
+ */
1810
+ interface DiagnosticsFieldSummaryEntry {
1811
+ /** Number of rules referencing this field. */
1812
+ ruleCount: number;
1813
+ /** Number of invalid rules referencing this field. */
1814
+ invalidCount: number;
1815
+ }
1816
+ /**
1817
+ * Top-level result of {@link formatQuery} for the `"diagnostics"` format.
1818
+ *
1819
+ * @group Export
1820
+ */
1821
+ interface DiagnosticsResult {
1822
+ /** The annotated query tree with `valid`, `path`, and `level` on every node. */
1823
+ query: RuleGroupDiagnosticsResult | RuleGroupICDiagnosticsResult;
1824
+ /** A flat array of all diagnostic entries across the tree. */
1825
+ diagnostics: DiagnosticEntry[];
1826
+ /** Aggregate statistics about the query. */
1827
+ stats: DiagnosticsStats;
1828
+ /** Per-field summary of rule counts and invalid counts. */
1829
+ fieldSummary: Record<string, DiagnosticsFieldSummaryEntry>;
1830
+ }
1831
+ /**
1688
1832
  * @group Export
1689
1833
  */
1690
1834
  interface RQBJsonLogicStartsWith {
@@ -1744,5 +1888,5 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
1744
1888
  */
1745
1889
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
1746
1890
  //#endregion
1747
- export { Except as A, DefaultCombinatorName as C, RuleType as D, RuleGroupType as E, OptionList as O, RuleGroupTypeIC as S, DefaultRuleGroupType as T, ValueProcessorOptions as _, FormatQueryOptions as a, DefaultRuleGroupTypeIC as b, NLTranslations as c, RQBJsonLogic as d, RuleGroupProcessor as f, ValueProcessorLegacy as g, ValueProcessorByRule as h, ExportOperatorMap as i, SetRequired as k, ParameterizedNamedSQL as l, SQLPreset as m, ExportFormat as n, GroupVariantCondition as o, RuleProcessor as p, ExportObjectFormats as r, NLTranslationKey as s, ConstituentWordOrder as t, ParameterizedSQL as u, FullField as v, DefaultOperatorName as w, RuleGroupTypeAny as x, ValueSources as y };
1748
- //# sourceMappingURL=index-DBlQeLax.d.ts.map
1891
+ export { SetRequired as A, RuleGroupTypeIC as C, RuleGroupType as D, DefaultRuleGroupType as E, RuleType as O, RuleGroupTypeAny as S, DefaultOperatorName as T, ValueProcessorLegacy as _, ExportOperatorMap as a, ValueSources as b, NLTranslationKey as c, ParameterizedSQL as d, RQBJsonLogic as f, ValueProcessorByRule as g, SQLPreset as h, ExportObjectFormats as i, Except as j, OptionList as k, NLTranslations as l, RuleProcessor as m, DiagnosticsResult as n, FormatQueryOptions as o, RuleGroupProcessor as p, ExportFormat as r, GroupVariantCondition as s, ConstituentWordOrder as t, ParameterizedNamedSQL as u, ValueProcessorOptions as v, DefaultCombinatorName as w, DefaultRuleGroupTypeIC as x, FullField as y };
1892
+ //# sourceMappingURL=index-Lht_Wq3V.d.mts.map
@@ -4,7 +4,7 @@ let numeric_quantity = require("numeric-quantity");
4
4
  /**
5
5
  * Converts a value to lowercase if it's a string, otherwise returns the value as is.
6
6
  */
7
- // istanbul ignore next
7
+ // v8 ignore next
8
8
  const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
9
9
  /**
10
10
  * Regex matching numeric strings. Passes for positive/negative integers, decimals,
@@ -102,4 +102,4 @@ Object.defineProperty(exports, "objectKeys", {
102
102
  }
103
103
  });
104
104
 
105
- //# sourceMappingURL=objectUtils-ButT0Mng.js.map
105
+ //# sourceMappingURL=objectUtils-Bzug_QfX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectUtils-Bzug_QfX.js","names":["numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts","../src/utils/objectUtils.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// v8 ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n","// All code in this file is adapted from:\n// npm: https://www.npmjs.com/package/ts-extras\n// src: https://github.com/sindresorhus/ts-extras\n\n/**\n * Original looked like this (not sure why template string is used):\n * ```\n * type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;\n * ```\n */\ntype ObjectKeys<T extends object> = Exclude<keyof T, symbol>;\n\n/**\n * A strongly-typed version of `Object.keys()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)\n */\nexport const objectKeys = Object.keys as <Type extends object>(\n value: Type\n) => Array<ObjectKeys<Type>>;\n\n/**\n * A strongly-typed version of `Object.entries()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)\n */\nexport const objectEntries = Object.entries as <Type extends Record<PropertyKey, unknown>>(\n value: Type\n) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;\n\n/**\n * Returns `true` if the key could cause prototype pollution when used\n * as a property name in bracket-notation assignment.\n */\nexport const isUnsafeKey = (key: unknown): boolean =>\n key === '__proto__' || key === 'constructor' || key === 'prototype';\n"],"mappings":";;;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAa,eAAuB,IAAI,OACtCA,iBAAAA,aAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe,KAAA;;;;;;;;ACRvC,MAAa,aAAa,OAAO;;;;;AAiBjC,MAAa,eAAe,QAC1B,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ"}
@@ -3,7 +3,7 @@ import { numericRegex } from "numeric-quantity";
3
3
  /**
4
4
  * Converts a value to lowercase if it's a string, otherwise returns the value as is.
5
5
  */
6
- // istanbul ignore next
6
+ // v8 ignore next
7
7
  const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
8
8
  /**
9
9
  * Regex matching numeric strings. Passes for positive/negative integers, decimals,
@@ -48,4 +48,4 @@ const isUnsafeKey = (key) => key === "__proto__" || key === "constructor" || key
48
48
  //#endregion
49
49
  export { isRuleGroupTypeIC as a, nullOrUndefinedOrEmpty as c, isRuleGroupType as i, numericRegex$1 as l, objectKeys as n, isPojo as o, isRuleGroup as r, lc as s, isUnsafeKey as t };
50
50
 
51
- //# sourceMappingURL=objectUtils-C0WB-8ex.mjs.map
51
+ //# sourceMappingURL=objectUtils-D96eEEzL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectUtils-D96eEEzL.mjs","names":["numericRegex","numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts","../src/utils/objectUtils.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// v8 ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n","// All code in this file is adapted from:\n// npm: https://www.npmjs.com/package/ts-extras\n// src: https://github.com/sindresorhus/ts-extras\n\n/**\n * Original looked like this (not sure why template string is used):\n * ```\n * type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;\n * ```\n */\ntype ObjectKeys<T extends object> = Exclude<keyof T, symbol>;\n\n/**\n * A strongly-typed version of `Object.keys()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)\n */\nexport const objectKeys = Object.keys as <Type extends object>(\n value: Type\n) => Array<ObjectKeys<Type>>;\n\n/**\n * A strongly-typed version of `Object.entries()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)\n */\nexport const objectEntries = Object.entries as <Type extends Record<PropertyKey, unknown>>(\n value: Type\n) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;\n\n/**\n * Returns `true` if the key could cause prototype pollution when used\n * as a property name in bracket-notation assignment.\n */\nexport const isUnsafeKey = (key: unknown): boolean =>\n key === '__proto__' || key === 'constructor' || key === 'prototype';\n"],"mappings":";;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAaA,iBAAuB,IAAI,OACtCC,aAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe,KAAA;;;;;;;;ACRvC,MAAa,aAAa,OAAO;;;;;AAiBjC,MAAa,eAAe,QAC1B,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ"}
@@ -1,5 +1,5 @@
1
- import { A as Except, C as DefaultCombinatorName, D as RuleType, E as RuleGroupType, S as RuleGroupTypeIC, T as DefaultRuleGroupType, b as DefaultRuleGroupTypeIC, w as DefaultOperatorName } from "./index-CYT4Saz-.mjs";
2
- import { t as ParserCommonOptions } from "./import-BwQqExpO.mjs";
1
+ import { C as RuleGroupTypeIC, D as RuleGroupType, E as DefaultRuleGroupType, O as RuleType, T as DefaultOperatorName, j as Except, w as DefaultCombinatorName, x as DefaultRuleGroupTypeIC } from "./index-Lht_Wq3V.mjs";
2
+ import { t as ParserCommonOptions } from "./import-0wp72lLT.mjs";
3
3
 
4
4
  //#region src/utils/parseCEL/types.d.ts
5
5
  type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";
@@ -1,5 +1,5 @@
1
- import { A as Except, C as DefaultCombinatorName, D as RuleType, E as RuleGroupType, S as RuleGroupTypeIC, T as DefaultRuleGroupType, b as DefaultRuleGroupTypeIC, w as DefaultOperatorName } from "./index-DBlQeLax.js";
2
- import { t as ParserCommonOptions } from "./import-CrJf23Nf.js";
1
+ import { C as RuleGroupTypeIC, D as RuleGroupType, E as DefaultRuleGroupType, O as RuleType, T as DefaultOperatorName, j as Except, w as DefaultCombinatorName, x as DefaultRuleGroupTypeIC } from "./index-D5TXNIzF.js";
2
+ import { t as ParserCommonOptions } from "./import-yRVJh7E1.js";
3
3
 
4
4
  //#region src/utils/parseCEL/types.d.ts
5
5
  type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";