@react-querybuilder/core 8.20.2 → 8.21.1

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 (109) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +2261 -2113
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js +319 -22
  4. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  5. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +2261 -2113
  6. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  7. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  8. package/dist/{convertQuery-BJKNgecE.js → convertQuery-Cw76XFIn.js} +8 -8
  9. package/dist/{convertQuery-BJKNgecE.js.map → convertQuery-Cw76XFIn.js.map} +1 -1
  10. package/dist/{convertQuery-J1CaoDxe.mjs → convertQuery-D_4J7E-Z.mjs} +2 -2
  11. package/dist/{convertQuery-J1CaoDxe.mjs.map → convertQuery-D_4J7E-Z.mjs.map} +1 -1
  12. package/dist/formatQuery.d.mts +499 -459
  13. package/dist/formatQuery.d.ts +499 -459
  14. package/dist/formatQuery.js +170 -88
  15. package/dist/formatQuery.js.map +1 -1
  16. package/dist/formatQuery.mjs +97 -20
  17. package/dist/formatQuery.mjs.map +1 -1
  18. package/dist/import-BVdxeIBO.d.mts +26 -0
  19. package/dist/import-Ddc3d_8q.d.ts +26 -0
  20. package/dist/{index-DlVg-QXo.d.mts → index-BSwFvkeI.d.mts} +679 -648
  21. package/dist/{index-DlVg-QXo.d.ts → index-BSwFvkeI.d.ts} +679 -648
  22. package/dist/{objectUtils-DBJI82bl.js → isRuleGroup-0JNiQgLg.js} +1 -26
  23. package/dist/isRuleGroup-0JNiQgLg.js.map +1 -0
  24. package/dist/{objectUtils-ZvPkF6u6.mjs → isRuleGroup-CqLThsbu.mjs} +2 -15
  25. package/dist/isRuleGroup-CqLThsbu.mjs.map +1 -0
  26. package/dist/objectUtils-Cr02aGxb.js +27 -0
  27. package/dist/objectUtils-Cr02aGxb.js.map +1 -0
  28. package/dist/objectUtils-DBlmJgBf.mjs +16 -0
  29. package/dist/objectUtils-DBlmJgBf.mjs.map +1 -0
  30. package/dist/parseCEL.d.mts +64 -30
  31. package/dist/parseCEL.d.ts +64 -30
  32. package/dist/parseCEL.js +91 -12
  33. package/dist/parseCEL.js.map +1 -1
  34. package/dist/parseCEL.mjs +85 -8
  35. package/dist/parseCEL.mjs.map +1 -1
  36. package/dist/parseCypher.d.mts +24 -25
  37. package/dist/parseCypher.d.ts +24 -25
  38. package/dist/parseGremlin.d.mts +18 -19
  39. package/dist/parseGremlin.d.ts +18 -19
  40. package/dist/parseJSONata.d.mts +207 -20
  41. package/dist/parseJSONata.d.ts +207 -20
  42. package/dist/parseJSONata.js +92 -7
  43. package/dist/parseJSONata.js.map +1 -1
  44. package/dist/parseJSONata.mjs +80 -4
  45. package/dist/parseJSONata.mjs.map +1 -1
  46. package/dist/parseJsonLogic.d.mts +51 -18
  47. package/dist/parseJsonLogic.d.ts +51 -18
  48. package/dist/parseJsonLogic.js +95 -34
  49. package/dist/parseJsonLogic.js.map +1 -1
  50. package/dist/parseJsonLogic.mjs +65 -6
  51. package/dist/parseJsonLogic.mjs.map +1 -1
  52. package/dist/parseMongoDB.d.mts +89 -58
  53. package/dist/parseMongoDB.d.ts +89 -58
  54. package/dist/parseMongoDB.js +140 -15
  55. package/dist/parseMongoDB.js.map +1 -1
  56. package/dist/parseMongoDB.mjs +128 -5
  57. package/dist/parseMongoDB.mjs.map +1 -1
  58. package/dist/parseSPARQL.d.mts +17 -18
  59. package/dist/parseSPARQL.d.ts +17 -18
  60. package/dist/parseSPARQL.js.map +1 -1
  61. package/dist/parseSPARQL.mjs.map +1 -1
  62. package/dist/parseSQL.d.mts +266 -18
  63. package/dist/parseSQL.d.ts +266 -18
  64. package/dist/parseSQL.js +163 -10
  65. package/dist/parseSQL.js.map +1 -1
  66. package/dist/parseSQL.mjs +149 -7
  67. package/dist/parseSQL.mjs.map +1 -1
  68. package/dist/parseSpEL.d.mts +193 -19
  69. package/dist/parseSpEL.d.ts +193 -19
  70. package/dist/parseSpEL.js +166 -7
  71. package/dist/parseSpEL.js.map +1 -1
  72. package/dist/parseSpEL.mjs +142 -6
  73. package/dist/parseSpEL.mjs.map +1 -1
  74. package/dist/{prepareQueryObjects-Bni5VgYM.js → prepareQueryObjects-C2-kTZvR.js} +5 -5
  75. package/dist/prepareQueryObjects-C2-kTZvR.js.map +1 -0
  76. package/dist/{prepareQueryObjects-BCLU20Cg.mjs → prepareQueryObjects-Q18lHCKl.mjs} +3 -3
  77. package/dist/prepareQueryObjects-Q18lHCKl.mjs.map +1 -0
  78. package/dist/query-builder-layout.css.map +1 -1
  79. package/dist/query-builder.css.map +1 -1
  80. package/dist/react-querybuilder_core.d.mts +2261 -2113
  81. package/dist/react-querybuilder_core.legacy-esm.d.ts +2261 -2113
  82. package/dist/react-querybuilder_core.legacy-esm.js +335 -40
  83. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  84. package/dist/react-querybuilder_core.mjs +309 -23
  85. package/dist/react-querybuilder_core.mjs.map +1 -1
  86. package/dist/react-querybuilder_core.production.d.mts +2261 -2113
  87. package/dist/react-querybuilder_core.production.mjs +1 -1
  88. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  89. package/dist/styles/_layout.scss +18 -14
  90. package/dist/styles/_main.scss +7 -2
  91. package/dist/transformQuery.d.mts +91 -92
  92. package/dist/transformQuery.d.ts +91 -92
  93. package/dist/transformQuery.js +4 -3
  94. package/dist/transformQuery.js.map +1 -1
  95. package/dist/transformQuery.mjs +2 -1
  96. package/dist/transformQuery.mjs.map +1 -1
  97. package/dist/{utils-BpaOtylk.js → utils-DEwV7F6B.js} +108 -12
  98. package/dist/utils-DEwV7F6B.js.map +1 -0
  99. package/dist/{utils-CJRGiPb-.mjs → utils-Dt0D_DMV.mjs} +69 -3
  100. package/dist/utils-Dt0D_DMV.mjs.map +1 -0
  101. package/package.json +16 -16
  102. package/dist/import-Qs1-kgv5.d.ts +0 -27
  103. package/dist/import-ShTj5IdB.d.mts +0 -27
  104. package/dist/objectUtils-DBJI82bl.js.map +0 -1
  105. package/dist/objectUtils-ZvPkF6u6.mjs.map +0 -1
  106. package/dist/prepareQueryObjects-BCLU20Cg.mjs.map +0 -1
  107. package/dist/prepareQueryObjects-Bni5VgYM.js.map +0 -1
  108. package/dist/utils-BpaOtylk.js.map +0 -1
  109. package/dist/utils-CJRGiPb-.mjs.map +0 -1
@@ -1,5 +1,4 @@
1
- import { RulesLogic } from "json-logic-js";
2
-
1
+ import { JsonLogicLessThan, JsonLogicLessThanOrEqual, RulesLogic, RulesLogic as JsonLogicRulesLogic } from "json-logic-js";
3
2
  //#region ../../node_modules/type-fest/source/union-to-intersection.d.ts
4
3
  /**
5
4
  Convert a union type to an intersection type.
@@ -18,16 +17,21 @@ type Intersection = UnionToIntersection<Union>;
18
17
 
19
18
  @category Type
20
19
  */
21
- type UnionToIntersection<Union> = (// `extends unknown` is always going to be the case and is used to convert the
20
+ type UnionToIntersection<Union> = (
21
+ // `extends unknown` is always going to be the case and is used to convert the
22
22
  // `Union` into a [distributive conditional
23
23
  // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
24
- Union extends unknown // The union type is used as the only argument to a function since the union
24
+ Union extends unknown ?
25
+ // The union type is used as the only argument to a function since the union
25
26
  // of function arguments is an intersection.
26
- ? (distributedUnion: Union) => void // This won't happen.
27
- : never // Infer the `Intersection` type since TypeScript represents the positional
27
+ (distributedUnion: Union) => void :
28
+ // This won't happen.
29
+ never
30
+ // Infer the `Intersection` type since TypeScript represents the positional
28
31
  // arguments of unions of functions as an intersection of the union.
29
- ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
30
- ? Intersection & Union : never;
32
+ ) extends ((mergedIntersection: infer Intersection) => void) ?
33
+ // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
34
+ Intersection & Union : never;
31
35
  //#endregion
32
36
  //#region ../../node_modules/type-fest/source/keys-of-union.d.ts
33
37
  /**
@@ -67,7 +71,8 @@ type AllKeys = KeysOfUnion<Union>;
67
71
 
68
72
  @category Object
69
73
  */
70
- type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
74
+ type KeysOfUnion<ObjectType> =
75
+ // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
71
76
  keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
72
77
  //#endregion
73
78
  //#region ../../node_modules/type-fest/source/is-any.d.ts
@@ -179,8 +184,8 @@ const update2: UpdateOperation<User> = {
179
184
  @category Utilities
180
185
  */
181
186
  type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
182
- ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
183
- : never;
187
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
188
+ : never; // Should never happen
184
189
  //#endregion
185
190
  //#region ../../node_modules/type-fest/source/required-keys-of.d.ts
186
191
  /**
@@ -214,7 +219,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
214
219
  @category Utilities
215
220
  */
216
221
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
217
- ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
222
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
218
223
  //#endregion
219
224
  //#region ../../node_modules/type-fest/source/is-never.d.ts
220
225
  /**
@@ -459,7 +464,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
459
464
  @see {@link SimplifyDeep}
460
465
  @category Object
461
466
  */
462
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
467
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
463
468
  //#endregion
464
469
  //#region ../../node_modules/type-fest/source/is-equal.d.ts
465
470
  /**
@@ -584,7 +589,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
584
589
  @see {@link PickIndexSignature}
585
590
  @category Object
586
591
  */
587
- type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
592
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
588
593
  //#endregion
589
594
  //#region ../../node_modules/type-fest/source/pick-index-signature.d.ts
590
595
  /**
@@ -632,11 +637,11 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
632
637
  @see {@link OmitIndexSignature}
633
638
  @category Object
634
639
  */
635
- type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
640
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
636
641
  //#endregion
637
642
  //#region ../../node_modules/type-fest/source/merge.d.ts
638
643
  // Merges two objects without worrying about index signatures.
639
- type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
644
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
640
645
  /**
641
646
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
642
647
 
@@ -700,10 +705,9 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
700
705
  @category Object
701
706
  */
702
707
  type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
703
- ? Source extends unknown // For distributing `Source`
704
- ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
705
- : never;
706
- // Should never happen
708
+ ? Source extends unknown // For distributing `Source`
709
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
710
+ : never; // Should never happen
707
711
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
708
712
  //#endregion
709
713
  //#region ../../node_modules/type-fest/source/internal/object.d.ts
@@ -744,7 +748,7 @@ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
744
748
  type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
745
749
  //=> {}
746
750
  */
747
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
751
+ type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P]; };
748
752
  /**
749
753
  Merges user specified options with default options.
750
754
 
@@ -797,36 +801,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
797
801
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
798
802
  ```
799
803
  */
800
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
801
- ? Result : never;
802
- type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key] }>>>;
803
- /**
804
- Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
805
-
806
- Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
807
-
808
- Use-case: For collapsing unions created using {@link LiteralUnion}.
809
-
810
- @example
811
- ```
812
- import type {LiteralUnion} from 'type-fest';
813
-
814
- type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
815
- //=> string
816
-
817
- type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
818
- //=> number
819
-
820
- type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
821
- //=> `on${string}`
822
-
823
- type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
824
- //=> 'click' | 'change' | `on${string}`
825
-
826
- type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
827
- //=> string | null | undefined
828
- ```
829
- */
804
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
805
+ ) ? Result : never;
806
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
830
807
  //#endregion
831
808
  //#region ../../node_modules/type-fest/source/except.d.ts
832
809
  /**
@@ -859,10 +836,12 @@ type Filtered = Filter<'bar', 'foo'>;
859
836
  type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
860
837
  type ExceptOptions = {
861
838
  /**
862
- Disallow assigning non-specified properties.
863
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
864
- @default false
865
- */
839
+ Disallow assigning non-specified properties.
840
+
841
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
842
+
843
+ @default false
844
+ */
866
845
  requireExactProps?: boolean;
867
846
  };
868
847
  type DefaultExceptOptions = {
@@ -924,7 +903,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
924
903
  @category Object
925
904
  */
926
905
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
927
- type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
906
+ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
928
907
  //#endregion
929
908
  //#region ../../node_modules/type-fest/source/set-required.d.ts
930
909
  /**
@@ -953,38 +932,42 @@ type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;
953
932
  @category Object
954
933
  */
955
934
  type SetRequired<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetRequired<BaseType, Keys>;
956
- type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends infer ResultantArray ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify< // Pick just the keys that are optional from the base type.
957
- Except<BaseType, Keys> // Pick the keys that should be required from the base type and make them required.
958
- & Required<HomomorphicPick<BaseType, Keys>>>;
935
+ type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends (infer ResultantArray) ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify<
936
+ // Pick just the keys that are optional from the base type.
937
+ Except<BaseType, Keys> &
938
+ // Pick the keys that should be required from the base type and make them required.
939
+ Required<HomomorphicPick<BaseType, Keys>>>;
959
940
  /**
960
941
  Remove the optional modifier from the specified keys in an array.
961
942
  */
962
943
  type SetArrayRequired<TArray extends UnknownArray, Keys, Counter extends any[] = [], Accumulator extends UnknownArray = []> = TArray extends unknown // For distributing `TArray` when it's a union
963
- ? keyof TArray & `${number}` extends never // Exit if `TArray` is empty (e.g., []), or
944
+ ? keyof TArray & `${number}` extends never ?
945
+ // Exit if `TArray` is empty (e.g., []), or
964
946
  // `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
965
- ? [...Accumulator, ...TArray] : TArray extends readonly [(infer First)?, ...infer Rest] ? '0' extends OptionalKeysOf<TArray> // If the first element of `TArray` is optional
966
- ? `${Counter['length']}` extends `${Keys & (string | number)}` // If the current index needs to be required
967
- ? SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, First]> // If the current element is optional, but it doesn't need to be required,
947
+ [...Accumulator, ...TArray] : TArray extends readonly [(infer First)?, ...infer Rest] ? '0' extends OptionalKeysOf<TArray> // If the first element of `TArray` is optional
948
+ ? `${Counter['length']}` extends `${Keys & (string | number)}` // If the current index needs to be required
949
+ ? SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, First]> :
950
+ // If the current element is optional, but it doesn't need to be required,
968
951
  // then we can exit early, since no further elements can now be made required.
969
- : [...Accumulator, ...TArray] : SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, TArray[0]]> : never // Should never happen, since `[(infer F)?, ...infer R]` is a top-type for arrays.
970
- : never; // Should never happen
952
+ [...Accumulator, ...TArray] : SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, TArray[0]]> : never // Should never happen, since `[(infer F)?, ...infer R]` is a top-type for arrays.
953
+ : never; // Should never happen
971
954
  //#endregion
972
955
  //#region src/types/options.d.ts
973
- type RequireAtLeastOne<O, K extends keyof O> = { [P in K]-?: Required<Pick<O, P>> & Partial<Pick<O, Exclude<K, P>>> }[K] & Except<O, K>;
956
+ type RequireAtLeastOne<O, K extends keyof O> = { [P in K]-?: Required<Pick<O, P>> & Partial<Pick<O, Exclude<K, P>>>; }[K] & Except<O, K>;
974
957
  /**
975
- * Adds an `unknown` index property to an interface.
976
- */
958
+ * Adds an `unknown` index property to an interface.
959
+ */
977
960
  type WithUnknownIndex<T> = T & {
978
961
  [key: string]: unknown;
979
962
  };
980
963
  /**
981
- * Do not use this type directly; use {@link Option}, {@link ValueOption},
982
- * or {@link FullOption} instead. For specific option types, you can use
983
- * {@link FullField}, {@link FullOperator}, or {@link FullCombinator},
984
- * all of which extend {@link FullOption}.
985
- *
986
- * @group Option Lists
987
- */
964
+ * Do not use this type directly; use {@link Option}, {@link ValueOption},
965
+ * or {@link FullOption} instead. For specific option types, you can use
966
+ * {@link FullField}, {@link FullOperator}, or {@link FullCombinator},
967
+ * all of which extend {@link FullOption}.
968
+ *
969
+ * @group Option Lists
970
+ */
988
971
  interface BaseOption<N extends string = string> {
989
972
  name?: N;
990
973
  value?: N;
@@ -992,115 +975,141 @@ interface BaseOption<N extends string = string> {
992
975
  disabled?: boolean;
993
976
  }
994
977
  /**
995
- * A generic option. Used directly in {@link OptionList} or
996
- * as the child element of an {@link OptionGroup}.
997
- *
998
- * @group Option Lists
999
- */
978
+ * A generic option. Used directly in {@link OptionList} or
979
+ * as the child element of an {@link OptionGroup}.
980
+ *
981
+ * @group Option Lists
982
+ */
1000
983
  type Option<N extends string = string> = Simplify<WithUnknownIndex<SetRequired<BaseOption<N>, "name">>>;
1001
984
  /**
1002
- * A generic {@link Option} with either a `name` or `value` as its primary identifier.
1003
- * {@link OptionList}-type props on the {@link react-querybuilder!QueryBuilder QueryBuilder} component accept this type,
1004
- * but corresponding props passed down to subcomponents will always be augmented
1005
- * to {@link FullOption} first.
1006
- *
1007
- * @group Option Lists
1008
- */
985
+ * A generic {@link Option} with either a `name` or `value` as its primary identifier.
986
+ * {@link OptionList}-type props on the {@link react-querybuilder!QueryBuilder QueryBuilder} component accept this type,
987
+ * but corresponding props passed down to subcomponents will always be augmented
988
+ * to {@link FullOption} first.
989
+ *
990
+ * @group Option Lists
991
+ */
1009
992
  type FlexibleOption<N extends string = string> = Simplify<WithUnknownIndex<RequireAtLeastOne<BaseOption<N>, "name" | "value">>>;
1010
993
  /**
1011
- * Utility type to turn an {@link Option}, {@link ValueOption}, or {@link BaseOption}
1012
- * into a {@link FlexibleOption}.
1013
- *
1014
- * @group Option Lists
1015
- */
994
+ * Utility type to turn an {@link Option}, {@link ValueOption}, or {@link BaseOption}
995
+ * into a {@link FlexibleOption}.
996
+ *
997
+ * @group Option Lists
998
+ */
1016
999
  type ToFlexibleOption<Opt extends BaseOption | string> = WithUnknownIndex<RequireAtLeastOne<Opt extends string ? FlexibleOption<Opt> : Opt, "name" | "value">>;
1017
1000
  /**
1018
- * A generic {@link Option} requiring both `name` _and_ `value` properties.
1019
- * Props that extend {@link OptionList} accept {@link BaseOption}, but
1020
- * corresponding props sent to subcomponents will always be augmented to this
1021
- * type first to ensure both `name` and `value` are available.
1022
- *
1023
- * NOTE: Do not extend from this type directly. Use {@link BaseFullOption}
1024
- * (optionally wrapped in {@link WithUnknownIndex}) instead, otherwise
1025
- * the `unknown` index property will cause issues. See {@link Option} and
1026
- * {@link ValueOption} for examples.
1027
- *
1028
- * @group Option Lists
1029
- */
1001
+ * A generic {@link Option} requiring both `name` _and_ `value` properties.
1002
+ * Props that extend {@link OptionList} accept {@link BaseOption}, but
1003
+ * corresponding props sent to subcomponents will always be augmented to this
1004
+ * type first to ensure both `name` and `value` are available.
1005
+ *
1006
+ * NOTE: Do not extend from this type directly. Use {@link BaseFullOption}
1007
+ * (optionally wrapped in {@link WithUnknownIndex}) instead, otherwise
1008
+ * the `unknown` index property will cause issues. See {@link Option} and
1009
+ * {@link ValueOption} for examples.
1010
+ *
1011
+ * @group Option Lists
1012
+ */
1030
1013
  type FullOption<N extends string = string> = Simplify<WithUnknownIndex<SetRequired<BaseOption<N>, "name" | "value">>>;
1031
1014
  /**
1032
- * This type is identical to {@link FullOption} but without the `unknown` index
1033
- * property. Extend from this type instead of {@link FullOption} directly.
1034
- *
1035
- * @group Option Lists
1036
- */
1015
+ * This type is identical to {@link FullOption} but without the `unknown` index
1016
+ * property. Extend from this type instead of {@link FullOption} directly.
1017
+ *
1018
+ * @group Option Lists
1019
+ */
1037
1020
  type BaseFullOption<N extends string = string> = Simplify<SetRequired<BaseOption<N>, "name" | "value">>;
1038
1021
  /**
1039
- * Utility type to turn an {@link Option}, {@link ValueOption} or
1040
- * {@link BaseOption} into a {@link FullOption}.
1041
- *
1042
- * @group Option Lists
1043
- */
1022
+ * Utility type to turn an {@link Option}, {@link ValueOption} or
1023
+ * {@link BaseOption} into a {@link FullOption}.
1024
+ *
1025
+ * @group Option Lists
1026
+ */
1044
1027
  type ToFullOption<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt : Opt extends BaseOption<infer IdentifierType> ? WithUnknownIndex<Opt & FullOption<IdentifierType>> : never;
1045
1028
  /**
1046
- * A group of {@link Option}s, usually within an {@link OptionList}.
1047
- *
1048
- * @group Option Lists
1049
- */
1029
+ * A group of {@link Option}s, usually within an {@link OptionList}.
1030
+ *
1031
+ * @group Option Lists
1032
+ */
1050
1033
  interface OptionGroup<Opt extends BaseOption = FlexibleOption> {
1051
1034
  label: string;
1052
1035
  options: WithUnknownIndex<Opt>[];
1053
1036
  }
1054
1037
  /**
1055
- * A group of {@link BaseOption}s, usually within a {@link FlexibleOptionList}.
1056
- *
1057
- * @group Option Lists
1058
- */
1038
+ * A group of {@link BaseOption}s, usually within a {@link FlexibleOptionList}.
1039
+ *
1040
+ * @group Option Lists
1041
+ */
1059
1042
  type FlexibleOptionGroup<Opt extends BaseOption | string = BaseOption> = {
1060
1043
  label: string;
1061
1044
  options: (Opt extends BaseFullOption ? Opt : ToFlexibleOption<Opt>)[];
1062
1045
  };
1063
1046
  /**
1064
- * Either an array of {@link Option}s or an array of {@link OptionGroup}s.
1065
- *
1066
- * @group Option Lists
1067
- */
1047
+ * Either an array of {@link Option}s or an array of {@link OptionGroup}s.
1048
+ *
1049
+ * @group Option Lists
1050
+ */
1068
1051
  type OptionList<Opt extends Option = Option> = Opt[] | OptionGroup<Opt>[];
1069
1052
  /**
1070
- * An array of options or option groups, like {@link OptionList} but the option type
1071
- * may use either `name` or `value` as the primary identifier.
1072
- *
1073
- * @group Option Lists
1074
- */
1053
+ * An array of options or option groups, like {@link OptionList} but the option type
1054
+ * may use either `name` or `value` as the primary identifier.
1055
+ *
1056
+ * @group Option Lists
1057
+ */
1075
1058
  type FlexibleOptionList<Opt extends BaseOption> = ToFlexibleOption<Opt>[] | FlexibleOptionGroup<ToFlexibleOption<Opt>>[];
1076
1059
  /**
1077
- * An array of options or option groups, like {@link OptionList}, but using
1078
- * {@link FullOption} instead of {@link Option}. This means that every member is
1079
- * guaranteed to have both `name` and `value`.
1080
- *
1081
- * @group Option Lists
1082
- */
1060
+ * An array of options or option groups, like {@link OptionList}, but using
1061
+ * {@link FullOption} instead of {@link Option}. This means that every member is
1062
+ * guaranteed to have both `name` and `value`.
1063
+ *
1064
+ * @group Option Lists
1065
+ */
1083
1066
  type FullOptionList<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt[] | OptionGroup<Opt>[] : ToFullOption<Opt>[] | OptionGroup<ToFullOption<Opt>>[];
1084
1067
  //#endregion
1068
+ //#region src/types/expression.d.ts
1069
+ /**
1070
+ * A single node in an expression tree. Expressions are recursive: a `func` node's
1071
+ * arguments are themselves {@link ExpressionNode}s, enabling arbitrary nesting.
1072
+ *
1073
+ * Used by `@react-querybuilder/expr` for arithmetic/function expressions on a rule's
1074
+ * left- and right-hand sides. The core library preserves these nodes (on
1075
+ * {@link RuleType.lhs} and, for the right-hand side, in `value` when `valueSource` is
1076
+ * `"expression"`) but does not interpret them.
1077
+ */
1078
+ type ExpressionNode = {
1079
+ kind: "field";
1080
+ field: string;
1081
+ } | {
1082
+ kind: "value";
1083
+ value: unknown;
1084
+ valueType?: string;
1085
+ } | {
1086
+ kind: "parameter";
1087
+ parameter: string;
1088
+ } | {
1089
+ kind: "func";
1090
+ fn: string;
1091
+ args: ExpressionNode[];
1092
+ };
1093
+ //#endregion
1085
1094
  //#region src/types/ruleGroups.d.ts
1086
1095
  /**
1087
- * Properties common to both rules and groups.
1088
- */
1096
+ * Properties common to both rules and groups.
1097
+ */
1089
1098
  interface CommonRuleAndGroupProperties {
1090
1099
  path?: Path;
1091
1100
  id?: string;
1092
1101
  disabled?: boolean;
1093
1102
  /**
1094
- * Whether this rule or group is muted. When muted, the rule or group
1095
- * is excluded from query export formats (SQL, JSON, MongoDB, etc.).
1096
- * For groups, muting recursively mutes all children.
1097
- */
1103
+ * Whether this rule or group is muted. When muted, the rule or group
1104
+ * is excluded from query export formats (SQL, JSON, MongoDB, etc.).
1105
+ * For groups, muting recursively mutes all children.
1106
+ */
1098
1107
  muted?: boolean;
1099
1108
  }
1100
1109
  /**
1101
- * The main rule type. The `field`, `operator`, and `value` properties
1102
- * can be narrowed with generics.
1103
- */
1110
+ * The main rule type. The `field`, `operator`, and `value` properties
1111
+ * can be narrowed with generics.
1112
+ */
1104
1113
  interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string, M = Record<string, any>> extends CommonRuleAndGroupProperties {
1105
1114
  field: F;
1106
1115
  operator: O;
@@ -1108,60 +1117,65 @@ interface RuleType<F extends string = string, O extends string = string, V = any
1108
1117
  valueSource?: ValueSource;
1109
1118
  match?: MatchConfig;
1110
1119
  /**
1111
- * Only used when adding a rule to a query that uses independent combinators.
1112
- */
1120
+ * When present, the rule's left-hand side is this expression. The `field`
1121
+ * property continues to drive operator selection and validation.
1122
+ */
1123
+ lhs?: ExpressionNode;
1124
+ /**
1125
+ * Only used when adding a rule to a query that uses independent combinators.
1126
+ */
1113
1127
  combinatorPreceding?: C;
1114
1128
  /**
1115
- * Opaque metadata for use by extension packages. The core library
1116
- * preserves this property but does not read or interpret it.
1117
- */
1129
+ * Opaque metadata for use by extension packages. The core library
1130
+ * preserves this property but does not read or interpret it.
1131
+ */
1118
1132
  meta?: M;
1119
1133
  }
1120
1134
  /**
1121
- * The main rule group type. This type is used for query definitions as well as
1122
- * all sub-groups of queries.
1123
- */
1135
+ * The main rule group type. This type is used for query definitions as well as
1136
+ * all sub-groups of queries.
1137
+ */
1124
1138
  interface RuleGroupType<R extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
1125
1139
  combinator: C;
1126
1140
  rules: RuleGroupArray<RuleGroupType<R, C>, R>;
1127
1141
  not?: boolean;
1128
1142
  }
1129
1143
  /**
1130
- * The type of the `rules` array in a {@link RuleGroupType}.
1131
- */
1144
+ * The type of the `rules` array in a {@link RuleGroupType}.
1145
+ */
1132
1146
  type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R extends RuleType = RuleType> = (R | RG)[];
1133
1147
  /**
1134
- * The type of the `rules` array in a {@link DefaultRuleGroupType}.
1135
- */
1148
+ * The type of the `rules` array in a {@link DefaultRuleGroupType}.
1149
+ */
1136
1150
  type DefaultRuleGroupArray<F extends string = string> = RuleGroupArray<DefaultRuleGroupType, DefaultRuleType<F>>;
1137
1151
  /**
1138
- * {@link RuleGroupType} with the `combinator` property limited to
1139
- * {@link DefaultCombinatorNameExtended} and `rules` limited to {@link DefaultRuleType}.
1140
- */
1152
+ * {@link RuleGroupType} with the `combinator` property limited to
1153
+ * {@link DefaultCombinatorNameExtended} and `rules` limited to {@link DefaultRuleType}.
1154
+ */
1141
1155
  type DefaultRuleGroupType<F extends string = string> = RuleGroupType<DefaultRuleType<F>, DefaultCombinatorNameExtended> & {
1142
1156
  rules: DefaultRuleGroupArray<F>;
1143
1157
  };
1144
1158
  /**
1145
- * {@link RuleType} with the `operator` property limited to {@link DefaultOperatorName}.
1146
- */
1159
+ * {@link RuleType} with the `operator` property limited to {@link DefaultOperatorName}.
1160
+ */
1147
1161
  type DefaultRuleType<F extends string = string> = RuleType<F, DefaultOperatorName>;
1148
1162
  /**
1149
- * Default allowed values for the `combinator` property.
1150
- *
1151
- * @group Option Lists
1152
- */
1163
+ * Default allowed values for the `combinator` property.
1164
+ *
1165
+ * @group Option Lists
1166
+ */
1153
1167
  type DefaultCombinatorName = "and" | "or";
1154
1168
  /**
1155
- * Default allowed values for the `combinator` property, plus `"xor"`.
1156
- *
1157
- * @group Option Lists
1158
- */
1169
+ * Default allowed values for the `combinator` property, plus `"xor"`.
1170
+ *
1171
+ * @group Option Lists
1172
+ */
1159
1173
  type DefaultCombinatorNameExtended = DefaultCombinatorName | "xor";
1160
1174
  /**
1161
- * Default values for the `operator` property.
1162
- *
1163
- * @group Option Lists
1164
- */
1175
+ * Default values for the `operator` property.
1176
+ *
1177
+ * @group Option Lists
1178
+ */
1165
1179
  type DefaultOperatorName = "=" | "!=" | "<" | ">" | "<=" | ">=" | "contains" | "beginsWith" | "endsWith" | "doesNotContain" | "doesNotBeginWith" | "doesNotEndWith" | "null" | "notNull" | "in" | "notIn" | "between" | "notBetween";
1166
1180
  //#endregion
1167
1181
  //#region src/types/ruleGroupsIC.utils.d.ts
@@ -1170,110 +1184,110 @@ type MappedTuple<Tuple extends Array<unknown>, Result extends Array<unknown> = [
1170
1184
  //#endregion
1171
1185
  //#region src/types/ruleGroupsIC.d.ts
1172
1186
  /**
1173
- * The main rule group interface when using independent combinators. This type is used
1174
- * for query definitions as well as all sub-groups of queries.
1175
- */
1187
+ * The main rule group interface when using independent combinators. This type is used
1188
+ * for query definitions as well as all sub-groups of queries.
1189
+ */
1176
1190
  interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R, C>, "combinator" | "rules"> {
1177
1191
  combinator?: undefined;
1178
1192
  rules: RuleGroupICArray<RuleGroupTypeIC<R, C>, R, C>;
1179
1193
  /**
1180
- * Only used when adding a rule to a query that uses independent combinators
1181
- */
1194
+ * Only used when adding a rule to a query that uses independent combinators
1195
+ */
1182
1196
  combinatorPreceding?: C;
1183
1197
  }
1184
1198
  /**
1185
- * Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
1186
- */
1199
+ * Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
1200
+ */
1187
1201
  type RuleGroupTypeAny<R extends RuleType = RuleType, C extends string = string> = RuleGroupType<R, C> | RuleGroupTypeIC<R, C>;
1188
1202
  /**
1189
- * The type of the `rules` array in a {@link RuleGroupTypeIC}.
1190
- */
1203
+ * The type of the `rules` array in a {@link RuleGroupTypeIC}.
1204
+ */
1191
1205
  type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R extends RuleType = RuleType, C extends string = string> = [R | RG] | [R | RG, ...MappedTuple<[C, R | RG]>] | ((R | RG)[] & {
1192
1206
  length: 0;
1193
1207
  });
1194
1208
  /**
1195
- * The type of the `rules` array in a {@link DefaultRuleGroupTypeIC}.
1196
- */
1209
+ * The type of the `rules` array in a {@link DefaultRuleGroupTypeIC}.
1210
+ */
1197
1211
  type DefaultRuleGroupICArray<F extends string = string> = RuleGroupICArray<DefaultRuleGroupTypeIC<F>, DefaultRuleType<F>, DefaultCombinatorName>;
1198
1212
  /**
1199
- * {@link RuleGroupTypeIC} with combinators limited to
1200
- * {@link DefaultCombinatorName} and rules limited to {@link DefaultRuleType}.
1201
- */
1213
+ * {@link RuleGroupTypeIC} with combinators limited to
1214
+ * {@link DefaultCombinatorName} and rules limited to {@link DefaultRuleType}.
1215
+ */
1202
1216
  interface DefaultRuleGroupTypeIC<F extends string = string> extends RuleGroupTypeIC<DefaultRuleType<F>> {
1203
1217
  rules: DefaultRuleGroupICArray<F>;
1204
1218
  }
1205
1219
  //#endregion
1206
1220
  //#region src/types/validation.d.ts
1207
1221
  /**
1208
- * Object with a `valid` boolean value and optional `reasons`.
1209
- */
1222
+ * Object with a `valid` boolean value and optional `reasons`.
1223
+ */
1210
1224
  interface ValidationResult {
1211
1225
  valid: boolean;
1212
1226
  reasons?: any[];
1213
1227
  }
1214
1228
  /**
1215
- * Map of rule/group `id` to its respective {@link ValidationResult}.
1216
- */
1229
+ * Map of rule/group `id` to its respective {@link ValidationResult}.
1230
+ */
1217
1231
  type ValidationMap = Record<string, boolean | ValidationResult>;
1218
1232
  /**
1219
- * Function that validates a query.
1220
- */
1233
+ * Function that validates a query.
1234
+ */
1221
1235
  type QueryValidator = (query: RuleGroupTypeAny) => boolean | ValidationMap;
1222
1236
  /**
1223
- * Function that validates a rule.
1224
- */
1237
+ * Function that validates a rule.
1238
+ */
1225
1239
  type RuleValidator = (rule: RuleType) => boolean | ValidationResult;
1226
1240
  //#endregion
1227
1241
  //#region src/types/basic.d.ts
1228
1242
  /**
1229
- * @see https://react-querybuilder.js.org/docs/tips/path
1230
- */
1243
+ * @see https://react-querybuilder.js.org/docs/tips/path
1244
+ */
1231
1245
  type Path = number[];
1232
1246
  /**
1233
- * String of classnames, array of classname strings, or object where the
1234
- * keys are classnames and those with truthy values will be included.
1235
- * Suitable for passing to the `clsx` package.
1236
- */
1247
+ * String of classnames, array of classname strings, or object where the
1248
+ * keys are classnames and those with truthy values will be included.
1249
+ * Suitable for passing to the `clsx` package.
1250
+ */
1237
1251
  type Classname = string | string[] | Record<string, any>;
1238
1252
  /**
1239
- * A source for the `value` property of a rule.
1240
- */
1241
- type ValueSource = "value" | "field";
1253
+ * A source for the `value` property of a rule.
1254
+ */
1255
+ type ValueSource = "value" | "field" | "expression" | "parameter";
1242
1256
  /**
1243
- * Type of {@link react-querybuilder!ValueEditor ValueEditor} that will be displayed.
1244
- */
1257
+ * Type of {@link react-querybuilder!ValueEditor ValueEditor} that will be displayed.
1258
+ */
1245
1259
  type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "switch" | "multiselect" | null;
1246
1260
  /**
1247
- * A valid array of potential value sources.
1248
- *
1249
- * @see {@link ValueSource}
1250
- */
1251
- type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
1261
+ * A valid array of potential value sources.
1262
+ *
1263
+ * @see {@link ValueSource}
1264
+ */
1265
+ type ValueSources = [ValueSource, ...ValueSource[]];
1252
1266
  type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
1253
- type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption } : never;
1267
+ type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption; } : never;
1254
1268
  type WithOptionalClassName<T> = T & {
1255
1269
  className?: Classname;
1256
1270
  };
1257
1271
  /**
1258
- * HTML5 input types
1259
- */
1272
+ * HTML5 input types
1273
+ */
1260
1274
  type InputType = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week" | "bigint" | (string & {});
1261
1275
  /**
1262
- * Quantification mode describing how many elements of the value array must pass
1263
- * the filter for the rule itself to pass.
1264
- *
1265
- * For "atLeast", "atMost", and "exactly", the threshold value will be converted to
1266
- * a percentage if the number is less than 1. Non-numeric values and numbers less
1267
- * than 0 will be ignored.
1268
- */
1276
+ * Quantification mode describing how many elements of the value array must pass
1277
+ * the filter for the rule itself to pass.
1278
+ *
1279
+ * For "atLeast", "atMost", and "exactly", the threshold value will be converted to
1280
+ * a percentage if the number is less than 1. Non-numeric values and numbers less
1281
+ * than 0 will be ignored.
1282
+ */
1269
1283
  interface MatchConfig {
1270
1284
  mode: MatchMode;
1271
1285
  threshold?: number | null | undefined;
1272
1286
  }
1273
1287
  type MatchMode = "all" | "some" | "none" | "atLeast" | "atMost" | "exactly";
1274
1288
  /**
1275
- * Base for all Field types/interfaces.
1276
- */
1289
+ * Base for all Field types/interfaces.
1290
+ */
1277
1291
  interface BaseFullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> extends WithOptionalClassName<BaseFullOption<FieldName>> {
1278
1292
  id?: string;
1279
1293
  operators?: FlexibleOptionList<OperatorObj> | OperatorName[] | FlexibleOption<OperatorName>[] | (OperatorName | FlexibleOption<OperatorName>)[];
@@ -1291,329 +1305,337 @@ interface BaseFullField<FieldName extends string = string, OperatorName extends
1291
1305
  comparator?: string | ((f: FullField, operator: string) => boolean);
1292
1306
  }
1293
1307
  /**
1294
- * Full field definition used in the `fields` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
1295
- * This type requires both `name` and `value`, but the `fields` prop itself
1296
- * can use a {@link FlexibleOption} where only one of `name` or `value` is
1297
- * required (along with `label`), or {@link Field} where only `name` and
1298
- * `label` are required.
1299
- *
1300
- * The `name`/`value`, `operators`, and `values` properties of this interface
1301
- * can be narrowed with generics.
1302
- *
1303
- * @group Option Lists
1304
- */
1308
+ * Full field definition used in the `fields` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
1309
+ * This type requires both `name` and `value`, but the `fields` prop itself
1310
+ * can use a {@link FlexibleOption} where only one of `name` or `value` is
1311
+ * required (along with `label`), or {@link Field} where only `name` and
1312
+ * `label` are required.
1313
+ *
1314
+ * The `name`/`value`, `operators`, and `values` properties of this interface
1315
+ * can be narrowed with generics.
1316
+ *
1317
+ * @group Option Lists
1318
+ */
1305
1319
  type FullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> = Simplify<FullOption<FieldName> & BaseFullField<FieldName, OperatorName, ValueName, OperatorObj, ValueObj>>;
1306
1320
  /**
1307
- * Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
1308
- * a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
1309
- */
1321
+ * Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
1322
+ * a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
1323
+ */
1310
1324
  type Arity = number | "unary" | "binary" | "ternary";
1311
1325
  /**
1312
- * Full operator definition used in the `operators`/`getOperators` props of
1313
- * {@link react-querybuilder!QueryBuilder QueryBuilder}. This type requires both `name` and `value`, but the
1314
- * `operators`/`getOperators` props themselves can use a {@link FlexibleOption}
1315
- * where only one of `name` or `value` is required, or {@link FullOperator} where
1316
- * only `name` is required.
1317
- *
1318
- * The `name`/`value` properties of this interface can be narrowed with generics.
1319
- *
1320
- * @group Option Lists
1321
- */
1326
+ * Full operator definition used in the `operators`/`getOperators` props of
1327
+ * {@link react-querybuilder!QueryBuilder QueryBuilder}. This type requires both `name` and `value`, but the
1328
+ * `operators`/`getOperators` props themselves can use a {@link FlexibleOption}
1329
+ * where only one of `name` or `value` is required, or {@link FullOperator} where
1330
+ * only `name` is required.
1331
+ *
1332
+ * The `name`/`value` properties of this interface can be narrowed with generics.
1333
+ *
1334
+ * @group Option Lists
1335
+ */
1322
1336
  interface FullOperator<N extends string = string> extends WithOptionalClassName<FullOption<N>> {
1323
1337
  arity?: Arity;
1324
1338
  }
1325
1339
  type ParseNumberMethodName = "enhanced" | "native" | "strict";
1326
- /**
1327
- * Parsing algorithms used by {@link parseNumber}.
1328
- */
1329
1340
  type ParseNumbersModerationLevel = "-limited" | "";
1330
1341
  /**
1331
- * Options for the `parseNumbers` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
1332
- */
1342
+ * Options for the `parseNumbers` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
1343
+ */
1333
1344
  type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersModerationLevel}`;
1334
1345
  //#endregion
1335
1346
  //#region src/types/export.d.ts
1336
1347
  /**
1337
- * Available export formats for {@link formatQuery}.
1338
- *
1339
- * @group Export
1340
- */
1348
+ * Available export formats for {@link formatQuery}.
1349
+ *
1350
+ * @group Export
1351
+ */
1341
1352
  type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "tanstack_db" | "prisma" | "sequelize" | "cypher" | "gql" | "sparql" | "gremlin" | "diagnostics";
1342
1353
  /**
1343
- * Export formats for {@link formatQuery} that produce objects instead of strings.
1344
- *
1345
- * @group Export
1346
- */
1354
+ * Export formats for {@link formatQuery} that produce objects instead of strings.
1355
+ *
1356
+ * @group Export
1357
+ */
1347
1358
  type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query" | "diagnostics";
1348
1359
  /**
1349
- * Available presets for the "sql" export format.
1350
- *
1351
- * @group Export
1352
- */
1360
+ * Available presets for the "sql" export format.
1361
+ *
1362
+ * @group Export
1363
+ */
1353
1364
  type SQLPreset = "ansi" | "sqlite" | "postgresql" | "mysql" | "mssql" | "oracle";
1354
1365
  /**
1355
- * A map of operators to strings to be used in the output of {@link formatQuery}. If the
1356
- * result can differ based on the `valueSource`, the key should map to an array where the
1357
- * second element represents the string to be used when `valueSource` is "field". The first
1358
- * element will be used in all other cases.
1359
- *
1360
- * @group Export
1361
- */
1366
+ * A map of operators to strings to be used in the output of {@link formatQuery}. If the
1367
+ * result can differ based on the `valueSource`, the key should map to an array where the
1368
+ * second element represents the string to be used when `valueSource` is "field". The first
1369
+ * element will be used in all other cases.
1370
+ *
1371
+ * @group Export
1372
+ */
1362
1373
  type ExportOperatorMap = Partial<Record<Lowercase<DefaultOperatorName> | DefaultOperatorName, string | [string, string]>>;
1363
1374
  /**
1364
- * Options object shape for {@link formatQuery}.
1365
- *
1366
- * @group Export
1367
- */
1375
+ * Options object shape for {@link formatQuery}.
1376
+ *
1377
+ * @group Export
1378
+ */
1368
1379
  interface FormatQueryOptions {
1369
1380
  /**
1370
- * The {@link ExportFormat}.
1371
- */
1381
+ * The {@link ExportFormat}.
1382
+ */
1372
1383
  format?: ExportFormat;
1373
1384
  /**
1374
- * This function will be used to process the `operator` from each rule
1375
- * for query language formats. If not defined, the appropriate
1376
- * `defaultOperatorProcessor*` for the format will be used.
1377
- */
1385
+ * This function will be used to process the `operator` from each rule
1386
+ * for query language formats. If not defined, the appropriate
1387
+ * `defaultOperatorProcessor*` for the format will be used.
1388
+ */
1378
1389
  operatorProcessor?: RuleProcessor;
1379
1390
  /**
1380
- * This function will be used to process the `value` from each rule
1381
- * for query language formats. If not defined, the appropriate
1382
- * `defaultValueProcessor*` for the format will be used.
1383
- */
1391
+ * This function will be used to process the `value` from each rule
1392
+ * for query language formats. If not defined, the appropriate
1393
+ * `defaultValueProcessor*` for the format will be used.
1394
+ */
1384
1395
  valueProcessor?: ValueProcessorLegacy | ValueProcessorByRule;
1385
1396
  /**
1386
- * This function will be used to process each rule. If not defined, the appropriate
1387
- * `defaultRuleProcessor*` for the given format will be used.
1388
- */
1397
+ * This function will be used to process each rule. If not defined, the appropriate
1398
+ * `defaultRuleProcessor*` for the given format will be used.
1399
+ */
1389
1400
  ruleProcessor?: RuleProcessor;
1390
1401
  /**
1391
- * This function will be used to process each rule group. If not defined, the appropriate
1392
- * `defaultRuleGroupProcessor*` for the format will be used.
1393
- *
1394
- * If this function is defined, it will override the `format` option. This also allows
1395
- * `formatQuery` to produce completely custom output formats.
1396
- */
1402
+ * This function will be used to process each rule group. If not defined, the appropriate
1403
+ * `defaultRuleGroupProcessor*` for the format will be used.
1404
+ *
1405
+ * If this function is defined, it will override the `format` option. This also allows
1406
+ * `formatQuery` to produce completely custom output formats.
1407
+ */
1397
1408
  ruleGroupProcessor?: RuleGroupProcessor;
1398
1409
  /**
1399
- * In the "sql", "parameterized", "parameterized_named", and "jsonata" export
1400
- * formats, field names will be bracketed by this string. If an array of strings
1401
- * is passed, field names will be preceded by the first element and
1402
- * succeeded by the second element.
1403
- *
1404
- * Tip: Use `fieldIdentifierSeparator` to bracket identifiers individually within field names.
1405
- *
1406
- * @default '' // the empty string
1407
- *
1408
- * @example
1409
- * formatQuery(query, { format: 'sql', quoteFieldNamesWith: '"' })
1410
- * // `"First name" = 'Steve'`
1411
- *
1412
- * @example
1413
- * formatQuery(query, { format: 'sql', quoteFieldNamesWith: ['[', ']'] })
1414
- * // "[First name] = 'Steve'"
1415
- */
1410
+ * In the "sql", "parameterized", "parameterized_named", and "jsonata" export
1411
+ * formats, field names will be bracketed by this string. If an array of strings
1412
+ * is passed, field names will be preceded by the first element and
1413
+ * succeeded by the second element.
1414
+ *
1415
+ * Tip: Use `fieldIdentifierSeparator` to bracket identifiers individually within field names.
1416
+ *
1417
+ * @default '' // the empty string
1418
+ *
1419
+ * @example
1420
+ * formatQuery(query, { format: 'sql', quoteFieldNamesWith: '"' })
1421
+ * // `"First name" = 'Steve'`
1422
+ *
1423
+ * @example
1424
+ * formatQuery(query, { format: 'sql', quoteFieldNamesWith: ['[', ']'] })
1425
+ * // "[First name] = 'Steve'"
1426
+ */
1416
1427
  quoteFieldNamesWith?: string | [string, string];
1417
1428
  /**
1418
- * When used in conjunction with the `quoteFieldNamesWith` option, field names will
1419
- * be split by this string, each part being individually processed as per the rules
1420
- * of the `quoteFieldNamesWith` configuration. The parts will then be re-joined
1421
- * by the same string.
1422
- *
1423
- * A common value for this option is `'.'`.
1424
- *
1425
- * A value of `''` (the empty string) will disable splitting/rejoining.
1426
- *
1427
- * @default ''
1428
- *
1429
- * @example
1430
- * formatQuery(query, {
1431
- * format: 'sql',
1432
- * quoteFieldNamesWith: ['[', ']'],
1433
- * fieldIdentifierSeparator: '.',
1434
- * })
1435
- * // "[dbo].[Musicians].[First name] = 'Steve'"
1436
- */
1429
+ * When used in conjunction with the `quoteFieldNamesWith` option, field names will
1430
+ * be split by this string, each part being individually processed as per the rules
1431
+ * of the `quoteFieldNamesWith` configuration. The parts will then be re-joined
1432
+ * by the same string.
1433
+ *
1434
+ * A common value for this option is `'.'`.
1435
+ *
1436
+ * A value of `''` (the empty string) will disable splitting/rejoining.
1437
+ *
1438
+ * @default ''
1439
+ *
1440
+ * @example
1441
+ * formatQuery(query, {
1442
+ * format: 'sql',
1443
+ * quoteFieldNamesWith: ['[', ']'],
1444
+ * fieldIdentifierSeparator: '.',
1445
+ * })
1446
+ * // "[dbo].[Musicians].[First name] = 'Steve'"
1447
+ */
1437
1448
  fieldIdentifierSeparator?: string;
1438
1449
  /**
1439
- * Character to use for quoting string values in the SQL format.
1440
- * @default `'`
1441
- */
1450
+ * Character to use for quoting string values in the SQL format.
1451
+ * @default `'`
1452
+ */
1442
1453
  quoteValuesWith?: string;
1443
1454
  /**
1444
- * Validator function for the entire query. Can be the same function passed
1445
- * as `validator` prop to {@link react-querybuilder!QueryBuilder QueryBuilder}.
1446
- */
1455
+ * Validator function for the entire query. Can be the same function passed
1456
+ * as `validator` prop to {@link react-querybuilder!QueryBuilder QueryBuilder}.
1457
+ */
1447
1458
  validator?: QueryValidator;
1448
1459
  /**
1449
- * This can be the same {@link FullField} array passed to {@link react-querybuilder!QueryBuilder QueryBuilder}, but
1450
- * really all you need to provide is the `name` and `validator` for each field.
1451
- *
1452
- * The full field object from this array, where the field's identifying property
1453
- * matches the rule's `field`, will be passed to the rule processor.
1454
- */
1460
+ * This can be the same {@link FullField} array passed to {@link react-querybuilder!QueryBuilder QueryBuilder}, but
1461
+ * really all you need to provide is the `name` and `validator` for each field.
1462
+ *
1463
+ * The full field object from this array, where the field's identifying property
1464
+ * matches the rule's `field`, will be passed to the rule processor.
1465
+ */
1455
1466
  fields?: FlexibleOptionList<FullField>;
1456
1467
  /**
1457
- * This can be the same `getOperators` function passed to {@link react-querybuilder!QueryBuilder QueryBuilder}.
1458
- *
1459
- * The full operator object from this array, where the operator's identifying property
1460
- * matches the rule's `operator`, will be passed to the rule processor.
1461
- */
1468
+ * This can be the same `getOperators` function passed to {@link react-querybuilder!QueryBuilder QueryBuilder}.
1469
+ *
1470
+ * The full operator object from this array, where the operator's identifying property
1471
+ * matches the rule's `operator`, will be passed to the rule processor.
1472
+ */
1462
1473
  getOperators?(field: string, misc: {
1463
1474
  fieldData: FullField;
1464
1475
  }): FlexibleOptionList<FullOperator> | null;
1465
1476
  /**
1466
- * This string will be inserted in place of invalid groups for non-JSON formats.
1467
- * Defaults to `'(1 = 1)'` for "sql"/"parameterized"/"parameterized_named" and
1468
- * `'$and:[{$expr:true}]'` for "mongodb".
1469
- */
1477
+ * This can be the same `getParameters` function passed to {@link react-querybuilder!QueryBuilder QueryBuilder}.
1478
+ * When provided, any rule whose `valueSource` is `"parameter"` and whose value (with any
1479
+ * leading `paramPrefix` stripped) is not found in this list will be treated as invalid.
1480
+ *
1481
+ * As with the `getParameters` prop, prefer names _without_ the parameter prefix.
1482
+ */
1483
+ getParameters?(field?: string, operator?: string, misc?: {
1484
+ fieldData: FullField;
1485
+ }): FlexibleOptionList<FullOption>;
1486
+ /**
1487
+ * This string will be inserted in place of invalid groups for non-JSON formats.
1488
+ * Defaults to `'(1 = 1)'` for "sql"/"parameterized"/"parameterized_named" and
1489
+ * `'$and:[{$expr:true}]'` for "mongodb".
1490
+ */
1470
1491
  fallbackExpression?: string;
1471
1492
  /**
1472
- * This string will be placed in front of named parameters (aka bind variables)
1473
- * when using the "parameterized_named" export format.
1474
- *
1475
- * @default ":"
1476
- */
1493
+ * This string will be placed in front of named parameters (aka bind variables)
1494
+ * when using the "parameterized_named" export format.
1495
+ *
1496
+ * @default ":"
1497
+ */
1477
1498
  paramPrefix?: string;
1478
1499
  /**
1479
- * Maintains the parameter prefix in the `params` object keys when using the
1480
- * "parameterized_named" export format. Recommended when using SQLite.
1481
- *
1482
- * @default false
1483
- *
1484
- * @example
1485
- * console.log(formatQuery(query, {
1486
- * format: "parameterized_named",
1487
- * paramPrefix: "$",
1488
- * paramsKeepPrefix: true
1489
- * }).params)
1490
- * // { $firstName: "Stev" }
1491
- * // Default (`paramsKeepPrefix` is `false`):
1492
- * // { firstName: "Stev" }
1493
- */
1500
+ * Maintains the parameter prefix in the `params` object keys when using the
1501
+ * "parameterized_named" export format. Recommended when using SQLite.
1502
+ *
1503
+ * @default false
1504
+ *
1505
+ * @example
1506
+ * console.log(formatQuery(query, {
1507
+ * format: "parameterized_named",
1508
+ * paramPrefix: "$",
1509
+ * paramsKeepPrefix: true
1510
+ * }).params)
1511
+ * // { $firstName: "Stev" }
1512
+ * // Default (`paramsKeepPrefix` is `false`):
1513
+ * // { firstName: "Stev" }
1514
+ */
1494
1515
  paramsKeepPrefix?: boolean;
1495
1516
  /**
1496
- * Renders parameter placeholders as a series of sequential numbers
1497
- * instead of '?' like the default. This option will respect the
1498
- * `paramPrefix` option like the 'parameterized_named' format.
1499
- *
1500
- * @default false
1501
- */
1517
+ * Renders parameter placeholders as a series of sequential numbers
1518
+ * instead of '?' like the default. This option will respect the
1519
+ * `paramPrefix` option like the 'parameterized_named' format.
1520
+ *
1521
+ * @default false
1522
+ */
1502
1523
  numberedParams?: boolean;
1503
1524
  /**
1504
- * Preserves the order of values for "between" and "notBetween" rules, even if a larger
1505
- * value comes before a smaller value (which will always evaluate to false).
1506
- */
1525
+ * Preserves the order of values for "between" and "notBetween" rules, even if a larger
1526
+ * value comes before a smaller value (which will always evaluate to false).
1527
+ */
1507
1528
  preserveValueOrder?: boolean;
1508
1529
  /**
1509
- * Renders values as either `number`-types or unquoted strings, as
1510
- * appropriate and when possible. Each `string`-type value is evaluated
1511
- * against {@link numericRegex} to determine if it can be represented as a
1512
- * plain numeric value. If so, `parseFloat` is used to convert it to a number.
1513
- */
1530
+ * Renders values as either `number`-types or unquoted strings, as
1531
+ * appropriate and when possible. Each `string`-type value is evaluated
1532
+ * against {@link numericRegex} to determine if it can be represented as a
1533
+ * plain numeric value. If so, `parseFloat` is used to convert it to a number.
1534
+ */
1514
1535
  parseNumbers?: ParseNumbersPropConfig;
1515
1536
  /**
1516
- * Any rules where the field is equal to this value will be ignored.
1517
- *
1518
- * @default '~'
1519
- */
1537
+ * Any rules where the field is equal to this value will be ignored.
1538
+ *
1539
+ * @default '~'
1540
+ */
1520
1541
  placeholderFieldName?: string;
1521
1542
  /**
1522
- * Any rules where the operator is equal to this value will be ignored.
1523
- *
1524
- * @default '~'
1525
- */
1543
+ * Any rules where the operator is equal to this value will be ignored.
1544
+ *
1545
+ * @default '~'
1546
+ */
1526
1547
  placeholderOperatorName?: string;
1527
1548
  /**
1528
- * Any rules where the value is equal to this value will be ignored.
1529
- *
1530
- * @default '~'
1531
- */
1549
+ * Any rules where the value is equal to this value will be ignored.
1550
+ *
1551
+ * @default '~'
1552
+ */
1532
1553
  placeholderValueName?: string;
1533
1554
  /**
1534
- * Operator to use when concatenating wildcard characters and field names in "sql" format.
1535
- * The ANSI standard is `||`, while SQL Server uses `+`. MySQL does not implement a concatenation
1536
- * operator by default, and therefore requires use of the `CONCAT` function.
1537
- *
1538
- * If `concatOperator` is set to `"CONCAT"` (case-insensitive), the `CONCAT` function will be
1539
- * used. Note that Oracle SQL does not support more than two values in the `CONCAT` function,
1540
- * so this option should not be used in that context. The default setting (`"||"`) is already
1541
- * compatible with Oracle SQL.
1542
- *
1543
- * @default '||'
1544
- */
1555
+ * Operator to use when concatenating wildcard characters and field names in "sql" format.
1556
+ * The ANSI standard is `||`, while SQL Server uses `+`. MySQL does not implement a concatenation
1557
+ * operator by default, and therefore requires use of the `CONCAT` function.
1558
+ *
1559
+ * If `concatOperator` is set to `"CONCAT"` (case-insensitive), the `CONCAT` function will be
1560
+ * used. Note that Oracle SQL does not support more than two values in the `CONCAT` function,
1561
+ * so this option should not be used in that context. The default setting (`"||"`) is already
1562
+ * compatible with Oracle SQL.
1563
+ *
1564
+ * @default '||'
1565
+ */
1545
1566
  concatOperator?: "||" | "+" | "CONCAT" | (string & {});
1546
1567
  /**
1547
- * Option presets to maximize compatibility with various SQL dialects.
1548
- */
1568
+ * Option presets to maximize compatibility with various SQL dialects.
1569
+ */
1549
1570
  preset?: SQLPreset;
1550
1571
  /**
1551
- * Map of operators to their translations for the "natural_language" format. If the
1552
- * result can differ based on the `valueSource`, the key should map to an array where the
1553
- * second element represents the string to be used when `valueSource` is "field". The first
1554
- * element will be used in all other cases.
1555
- */
1572
+ * Map of operators to their translations for the "natural_language" format. If the
1573
+ * result can differ based on the `valueSource`, the key should map to an array where the
1574
+ * second element represents the string to be used when `valueSource` is "field". The first
1575
+ * element will be used in all other cases.
1576
+ */
1556
1577
  operatorMap?: ExportOperatorMap;
1557
1578
  /**
1558
- * [Constituent word order](https://en.wikipedia.org/wiki/Word_order#Constituent_word_orders)
1559
- * for the "natural_language" format. Can be abbreviated like "SVO" or spelled out like
1560
- * "subject-verb-object".
1561
- *
1562
- * - Subject = field
1563
- * - Verb = operator
1564
- * - Object = value
1565
- */
1579
+ * [Constituent word order](https://en.wikipedia.org/wiki/Word_order#Constituent_word_orders)
1580
+ * for the "natural_language" format. Can be abbreviated like "SVO" or spelled out like
1581
+ * "subject-verb-object".
1582
+ *
1583
+ * - Subject = field
1584
+ * - Verb = operator
1585
+ * - Object = value
1586
+ */
1566
1587
  wordOrder?: ConstituentWordOrderString | Lowercase<ConstituentWordOrderString> | ({} & string);
1567
1588
  /**
1568
- * Translatable strings used by the "natural_language" format.
1569
- */
1589
+ * Translatable strings used by the "natural_language" format.
1590
+ */
1570
1591
  translations?: Partial<Record<NLTranslationKey, string>>;
1571
1592
  context?: Record<string, any>;
1572
1593
  }
1573
1594
  /**
1574
- * Options object for {@link ValueProcessorByRule} functions.
1575
- *
1576
- * @group Export
1577
- */
1595
+ * Options object for {@link ValueProcessorByRule} functions.
1596
+ *
1597
+ * @group Export
1598
+ */
1578
1599
  interface ValueProcessorOptions extends FormatQueryOptions {
1579
1600
  valueProcessor?: ValueProcessorByRule;
1580
1601
  escapeQuotes?: boolean;
1581
1602
  /**
1582
- * The full field object, if `fields` was provided in the
1583
- * {@link formatQuery} options parameter.
1584
- */
1603
+ * The full field object, if `fields` was provided in the
1604
+ * {@link formatQuery} options parameter.
1605
+ */
1585
1606
  fieldData?: FullField;
1586
1607
  /**
1587
- * Included for the "parameterized_named" format only. Keys of this object represent
1588
- * field names and values represent the current list of parameter names for that
1589
- * field based on the query rules processed up to that point. Use this list to
1590
- * ensure that parameter names generated by the custom rule processor are unique.
1591
- */
1608
+ * Included for the "parameterized_named" format only. Keys of this object represent
1609
+ * field names and values represent the current list of parameter names for that
1610
+ * field based on the query rules processed up to that point. Use this list to
1611
+ * ensure that parameter names generated by the custom rule processor are unique.
1612
+ */
1592
1613
  fieldParamNames?: Record<string, string[]>;
1593
1614
  /**
1594
- * Included for the "parameterized_named" format only. Call this function with a
1595
- * field name to get a unique parameter name, as yet unused during query processing.
1596
- */
1615
+ * Included for the "parameterized_named" format only. Call this function with a
1616
+ * field name to get a unique parameter name, as yet unused during query processing.
1617
+ */
1597
1618
  getNextNamedParam?: (field: string) => string;
1598
1619
  /**
1599
- * Additional prefix and suffix characters to wrap the value in. Useful for augmenting
1600
- * the default value processor results with special syntax (e.g., for dates or function
1601
- * calls).
1602
- */
1620
+ * Additional prefix and suffix characters to wrap the value in. Useful for augmenting
1621
+ * the default value processor results with special syntax (e.g., for dates or function
1622
+ * calls).
1623
+ */
1603
1624
  wrapValueWith?: [string, string];
1604
1625
  /**
1605
- * Parse numbers in the rule value.
1606
- *
1607
- * @default false
1608
- */
1626
+ * Parse numbers in the rule value.
1627
+ *
1628
+ * @default false
1629
+ */
1609
1630
  parseNumbers?: boolean;
1610
1631
  }
1611
1632
  /**
1612
- * Options object curated by {@link formatQuery} and passed to a {@link RuleGroupProcessor}.
1613
- *
1614
- * @group Export
1615
- */
1616
- interface FormatQueryFinalOptions extends Required<Except<FormatQueryOptions, "context" | "valueProcessor" | "validator" | "placeholderValueName" | "ruleGroupProcessor" | "parseNumbers">> {
1633
+ * Options object curated by {@link formatQuery} and passed to a {@link RuleGroupProcessor}.
1634
+ *
1635
+ * @group Export
1636
+ */
1637
+ interface FormatQueryFinalOptions extends Required<Except<FormatQueryOptions, "context" | "valueProcessor" | "validator" | "placeholderValueName" | "ruleGroupProcessor" | "parseNumbers" | "getParameters">> {
1638
+ getParameters?: FormatQueryOptions["getParameters"];
1617
1639
  fields: FullOptionList<FullField>;
1618
1640
  getParseNumberBoolean: (inputType?: InputType | null) => boolean | undefined;
1619
1641
  parseNumbers?: ParseNumbersPropConfig | undefined;
@@ -1625,159 +1647,162 @@ interface FormatQueryFinalOptions extends Required<Except<FormatQueryOptions, "c
1625
1647
  context?: Record<string, unknown>;
1626
1648
  }
1627
1649
  /**
1628
- * Function that produces a processed value for a given {@link RuleType}.
1629
- *
1630
- * @group Export
1631
- */
1650
+ * Function that produces a processed value for a given {@link RuleType}.
1651
+ *
1652
+ * @group Export
1653
+ */
1632
1654
  type ValueProcessorByRule = (rule: RuleType, options?: ValueProcessorOptions) => string;
1633
1655
  /**
1634
- * Function that produces a processed value for a given `field`, `operator`, `value`,
1635
- * and `valueSource`.
1636
- *
1637
- * @group Export
1638
- */
1656
+ * Function that produces a processed value for a given `field`, `operator`, `value`,
1657
+ * and `valueSource`.
1658
+ *
1659
+ * @group Export
1660
+ */
1639
1661
  type ValueProcessorLegacy = (field: string, operator: string, value: any, valueSource?: ValueSource) => string;
1640
1662
  /**
1641
- * Function to produce a result that {@link formatQuery} uses when processing a
1642
- * {@link RuleType} object.
1643
- *
1644
- * See the default rule processor for each format to know what type to return.
1645
- * | Format | Default rule processor |
1646
- * | ------------------------ | ----------------------------------------- |
1647
- * | `sql` | {@link defaultRuleProcessorSQL} |
1648
- * | `parameterized` | {@link defaultRuleProcessorParameterized} |
1649
- * | `parameterized_named` | {@link defaultRuleProcessorParameterized} |
1650
- * | `mongodb` _(deprecated)_ | {@link defaultRuleProcessorMongoDB} |
1651
- * | `mongodb_query` | {@link defaultRuleProcessorMongoDBQuery} |
1652
- * | `cel` | {@link defaultRuleProcessorCEL} |
1653
- * | `spel` | {@link defaultRuleProcessorSpEL} |
1654
- * | `jsonlogic` | {@link defaultRuleProcessorJsonLogic} |
1655
- * | `elasticsearch` | {@link defaultRuleProcessorElasticSearch} |
1656
- * | `jsonata` | {@link defaultRuleProcessorJSONata} |
1657
- * | `natural_language` | {@link defaultRuleProcessorNL} |
1658
- * | `ldap` | {@link defaultRuleProcessorLDAP} |
1659
- * | `drizzle` | {@link defaultRuleProcessorDrizzle} |
1660
- * | `tanstack_db` | {@link defaultRuleProcessorTanStackDB} |
1661
- * | `prisma` | {@link defaultRuleProcessorPrisma} |
1662
- * | `sequelize` | {@link defaultRuleProcessorSequelize} |
1663
- * | `cypher` | {@link defaultRuleProcessorCypher} |
1664
- * | `sparql` | {@link defaultRuleProcessorSPARQL} |
1665
- * | `gremlin` | {@link defaultRuleProcessorGremlin} |
1666
- *
1667
- * @group Export
1668
- */
1663
+ * Function to produce a result that {@link formatQuery} uses when processing a
1664
+ * {@link RuleType} object.
1665
+ *
1666
+ * See the default rule processor for each format to know what type to return.
1667
+ * | Format | Default rule processor |
1668
+ * | ------------------------ | ----------------------------------------- |
1669
+ * | `sql` | {@link defaultRuleProcessorSQL} |
1670
+ * | `parameterized` | {@link defaultRuleProcessorParameterized} |
1671
+ * | `parameterized_named` | {@link defaultRuleProcessorParameterized} |
1672
+ * | `mongodb` _(deprecated)_ | {@link defaultRuleProcessorMongoDB} |
1673
+ * | `mongodb_query` | {@link defaultRuleProcessorMongoDBQuery} |
1674
+ * | `cel` | {@link defaultRuleProcessorCEL} |
1675
+ * | `spel` | {@link defaultRuleProcessorSpEL} |
1676
+ * | `jsonlogic` | {@link defaultRuleProcessorJsonLogic} |
1677
+ * | `elasticsearch` | {@link defaultRuleProcessorElasticSearch} |
1678
+ * | `jsonata` | {@link defaultRuleProcessorJSONata} |
1679
+ * | `natural_language` | {@link defaultRuleProcessorNL} |
1680
+ * | `ldap` | {@link defaultRuleProcessorLDAP} |
1681
+ * | `drizzle` | {@link defaultRuleProcessorDrizzle} |
1682
+ * | `tanstack_db` | {@link defaultRuleProcessorTanStackDB} |
1683
+ * | `prisma` | {@link defaultRuleProcessorPrisma} |
1684
+ * | `sequelize` | {@link defaultRuleProcessorSequelize} |
1685
+ * | `cypher` | {@link defaultRuleProcessorCypher} |
1686
+ * | `sparql` | {@link defaultRuleProcessorSPARQL} |
1687
+ * | `gremlin` | {@link defaultRuleProcessorGremlin} |
1688
+ *
1689
+ * @group Export
1690
+ */
1669
1691
  type RuleProcessor = (rule: RuleType, options?: ValueProcessorOptions, meta?: {
1670
1692
  processedParams?: Record<string, any> | any[];
1671
1693
  context?: Record<string, any>;
1672
1694
  }) => any;
1673
1695
  /**
1674
- * Function to produce a result that {@link formatQuery} uses when processing a
1675
- * {@link RuleGroupType} or {@link RuleGroupTypeIC} object.
1676
- *
1677
- * See the default rule group processor for each format to know what type to return.
1678
- * | Format | Default rule group processor |
1679
- * | ------------------------ | ---------------------------------------------- |
1680
- * | `sql` | {@link defaultRuleGroupProcessorSQL} |
1681
- * | `parameterized` | {@link defaultRuleGroupProcessorParameterized} |
1682
- * | `parameterized_named` | {@link defaultRuleGroupProcessorParameterized} |
1683
- * | `mongodb` _(deprecated)_ | {@link defaultRuleGroupProcessorMongoDB} |
1684
- * | `mongodb_query` | {@link defaultRuleGroupProcessorMongoDBQuery} |
1685
- * | `cel` | {@link defaultRuleGroupProcessorCEL} |
1686
- * | `spel` | {@link defaultRuleGroupProcessorSpEL} |
1687
- * | `jsonlogic` | {@link defaultRuleGroupProcessorJsonLogic} |
1688
- * | `elasticsearch` | {@link defaultRuleGroupProcessorElasticSearch} |
1689
- * | `jsonata` | {@link defaultRuleGroupProcessorJSONata} |
1690
- * | `natural_language` | {@link defaultRuleGroupProcessorNL} |
1691
- * | `ldap` | {@link defaultRuleGroupProcessorLDAP} |
1692
- * | `drizzle` | {@link defaultRuleGroupProcessorDrizzle} |
1693
- * | `tanstack_db` | {@link defaultRuleGroupProcessorTanStackDB} |
1694
- * | `prisma` | {@link defaultRuleGroupProcessorPrisma} |
1695
- * | `sequelize` | {@link defaultRuleGroupProcessorSequelize} |
1696
- * | `cypher` | {@link defaultRuleGroupProcessorCypher} |
1697
- * | `sparql` | {@link defaultRuleGroupProcessorSPARQL} |
1698
- * | `gremlin` | {@link defaultRuleGroupProcessorGremlin} |
1699
- * | `diagnostics` | {@link defaultRuleGroupProcessorDiagnostics} |
1700
- *
1701
- * @group Export
1702
- */
1696
+ * Function to produce a result that {@link formatQuery} uses when processing a
1697
+ * {@link RuleGroupType} or {@link RuleGroupTypeIC} object.
1698
+ *
1699
+ * See the default rule group processor for each format to know what type to return.
1700
+ * | Format | Default rule group processor |
1701
+ * | ------------------------ | ---------------------------------------------- |
1702
+ * | `sql` | {@link defaultRuleGroupProcessorSQL} |
1703
+ * | `parameterized` | {@link defaultRuleGroupProcessorParameterized} |
1704
+ * | `parameterized_named` | {@link defaultRuleGroupProcessorParameterized} |
1705
+ * | `mongodb` _(deprecated)_ | {@link defaultRuleGroupProcessorMongoDB} |
1706
+ * | `mongodb_query` | {@link defaultRuleGroupProcessorMongoDBQuery} |
1707
+ * | `cel` | {@link defaultRuleGroupProcessorCEL} |
1708
+ * | `spel` | {@link defaultRuleGroupProcessorSpEL} |
1709
+ * | `jsonlogic` | {@link defaultRuleGroupProcessorJsonLogic} |
1710
+ * | `elasticsearch` | {@link defaultRuleGroupProcessorElasticSearch} |
1711
+ * | `jsonata` | {@link defaultRuleGroupProcessorJSONata} |
1712
+ * | `natural_language` | {@link defaultRuleGroupProcessorNL} |
1713
+ * | `ldap` | {@link defaultRuleGroupProcessorLDAP} |
1714
+ * | `drizzle` | {@link defaultRuleGroupProcessorDrizzle} |
1715
+ * | `tanstack_db` | {@link defaultRuleGroupProcessorTanStackDB} |
1716
+ * | `prisma` | {@link defaultRuleGroupProcessorPrisma} |
1717
+ * | `sequelize` | {@link defaultRuleGroupProcessorSequelize} |
1718
+ * | `cypher` | {@link defaultRuleGroupProcessorCypher} |
1719
+ * | `sparql` | {@link defaultRuleGroupProcessorSPARQL} |
1720
+ * | `gremlin` | {@link defaultRuleGroupProcessorGremlin} |
1721
+ * | `diagnostics` | {@link defaultRuleGroupProcessorDiagnostics} |
1722
+ *
1723
+ * @group Export
1724
+ */
1703
1725
  type RuleGroupProcessor<TResult = unknown> = (ruleGroup: RuleGroupTypeAny, options: FormatQueryFinalOptions, meta?: {
1704
1726
  processedParams?: Record<string, any> | any[];
1705
1727
  context?: Record<string, any>;
1706
1728
  }) => TResult;
1707
1729
  /**
1708
- * Rule validator for {@link formatQuery}.
1709
- *
1710
- * @group Export
1711
- */
1730
+ * Rule validator for {@link formatQuery}.
1731
+ *
1732
+ * @group Export
1733
+ */
1712
1734
  type FormatQueryValidateRule = (rule: RuleType) => readonly [boolean | ValidationResult | undefined, RuleValidator | undefined];
1713
1735
  /**
1714
- * Object produced by {@link formatQuery} for the `"parameterized"` format.
1715
- *
1716
- * @group Export
1717
- */
1736
+ * Object produced by {@link formatQuery} for the `"parameterized"` format.
1737
+ *
1738
+ * @group Export
1739
+ */
1718
1740
  interface ParameterizedSQL {
1719
1741
  /** The SQL `WHERE` clause fragment with `?` placeholders for each value. */
1720
1742
  sql: string;
1721
1743
  /**
1722
- * Parameter values in the same order their respective placeholders
1723
- * appear in the `sql` string.
1724
- */
1744
+ * Parameter values in the same order their respective placeholders
1745
+ * appear in the `sql` string.
1746
+ */
1725
1747
  params: any[];
1726
1748
  }
1727
1749
  /**
1728
- * Object produced by {@link formatQuery} for the `"parameterized_named"` format.
1729
- *
1730
- * @group Export
1731
- */
1750
+ * Object produced by {@link formatQuery} for the `"parameterized_named"` format.
1751
+ *
1752
+ * @group Export
1753
+ */
1732
1754
  interface ParameterizedNamedSQL {
1733
1755
  /** The SQL `WHERE` clause fragment with bind variable placeholders for each value. */
1734
1756
  sql: string;
1735
1757
  /**
1736
- * Map of bind variable names from the `sql` string to the associated values.
1737
- */
1758
+ * Map of bind variable names from the `sql` string to the associated values.
1759
+ */
1738
1760
  params: Record<string, any>;
1739
1761
  }
1740
1762
  /**
1741
- * A {@link RuleType} annotated with diagnostics results, as produced
1742
- * by {@link formatQuery} for the `"diagnostics"` format.
1743
- *
1744
- * The generics mirror those of {@link RuleType}.
1745
- *
1746
- * @group Export
1747
- */
1763
+ * A {@link RuleType} annotated with diagnostics results, as produced
1764
+ * by {@link formatQuery} for the `"diagnostics"` format.
1765
+ *
1766
+ * The generics mirror those of {@link RuleType}.
1767
+ *
1768
+ * @group Export
1769
+ */
1748
1770
  type RuleDiagnosticsResult<F extends string = string, O extends string = string, V = any, C extends string = string> = RuleType<F, O, V, C> & {
1749
- /** Whether the rule passed all validation checks. */valid: boolean;
1771
+ /** Whether the rule passed all validation checks. */
1772
+ valid: boolean;
1750
1773
  /**
1751
- * Reasons why the rule is invalid. Only present when
1752
- * the rule is invalid and specific reasons were provided
1753
- * by the validator.
1754
- */
1755
- reasons?: any[]; /** The path to this rule within the query tree. */
1756
- path: number[]; /** The nesting depth of this rule (`path.length`). */
1774
+ * Reasons why the rule is invalid. Only present when
1775
+ * the rule is invalid and specific reasons were provided
1776
+ * by the validator.
1777
+ */
1778
+ reasons?: any[];
1779
+ /** The path to this rule within the query tree. */
1780
+ path: number[];
1781
+ /** The nesting depth of this rule (`path.length`). */
1757
1782
  level: number;
1758
1783
  };
1759
1784
  /**
1760
- * The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
1761
- *
1762
- * @group Export
1763
- */
1785
+ * The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
1786
+ *
1787
+ * @group Export
1788
+ */
1764
1789
  type RuleGroupDiagnosticsArray<RG extends RuleGroupDiagnosticsResult = RuleGroupDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult> = RuleGroupArray<RG, R>;
1765
1790
  /**
1766
- * A {@link RuleGroupType} annotated with diagnostics results, as produced
1767
- * by {@link formatQuery} for the `"diagnostics"` format.
1768
- *
1769
- * The generics mirror those of {@link RuleGroupType}.
1770
- *
1771
- * @group Export
1772
- */
1791
+ * A {@link RuleGroupType} annotated with diagnostics results, as produced
1792
+ * by {@link formatQuery} for the `"diagnostics"` format.
1793
+ *
1794
+ * The generics mirror those of {@link RuleGroupType}.
1795
+ *
1796
+ * @group Export
1797
+ */
1773
1798
  interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupType<R, C>, "rules"> {
1774
1799
  /** Whether the group and all of its descendants are valid. */
1775
1800
  valid: boolean;
1776
1801
  /**
1777
- * Reasons why the group itself is invalid. Only present when
1778
- * the group is invalid and specific reasons were provided
1779
- * by the validator.
1780
- */
1802
+ * Reasons why the group itself is invalid. Only present when
1803
+ * the group is invalid and specific reasons were provided
1804
+ * by the validator.
1805
+ */
1781
1806
  reasons?: any[];
1782
1807
  /** The path to this group within the query tree. */
1783
1808
  path: number[];
@@ -1786,29 +1811,29 @@ interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagn
1786
1811
  rules: RuleGroupDiagnosticsArray<RuleGroupDiagnosticsResult<R, C>, R>;
1787
1812
  }
1788
1813
  /**
1789
- * The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
1790
- *
1791
- * Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
1792
- *
1793
- * @group Export
1794
- */
1814
+ * The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
1815
+ *
1816
+ * Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
1817
+ *
1818
+ * @group Export
1819
+ */
1795
1820
  type RuleGroupICDiagnosticsArray<RG extends RuleGroupICDiagnosticsResult = RuleGroupICDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> = RuleGroupICArray<RG, R, C>;
1796
1821
  /**
1797
- * A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
1798
- * by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
1799
- *
1800
- * The generics mirror those of {@link RuleGroupTypeIC}.
1801
- *
1802
- * @group Export
1803
- */
1822
+ * A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
1823
+ * by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
1824
+ *
1825
+ * The generics mirror those of {@link RuleGroupTypeIC}.
1826
+ *
1827
+ * @group Export
1828
+ */
1804
1829
  interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupTypeIC<R, C>, "rules"> {
1805
1830
  /** Whether the group and all of its descendants are valid. */
1806
1831
  valid: boolean;
1807
1832
  /**
1808
- * Reasons why the group itself is invalid. Only present when
1809
- * the group is invalid and specific reasons were provided
1810
- * by the validator.
1811
- */
1833
+ * Reasons why the group itself is invalid. Only present when
1834
+ * the group is invalid and specific reasons were provided
1835
+ * by the validator.
1836
+ */
1812
1837
  reasons?: any[];
1813
1838
  /** The path to this group within the query tree. */
1814
1839
  path: number[];
@@ -1817,10 +1842,10 @@ interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDia
1817
1842
  rules: RuleGroupICDiagnosticsArray<RuleGroupICDiagnosticsResult<R, C>, R, C>;
1818
1843
  }
1819
1844
  /**
1820
- * A single diagnostic entry produced by the `"diagnostics"` format.
1821
- *
1822
- * @group Export
1823
- */
1845
+ * A single diagnostic entry produced by the `"diagnostics"` format.
1846
+ *
1847
+ * @group Export
1848
+ */
1824
1849
  interface DiagnosticEntry {
1825
1850
  /** The `id` of the rule or group this diagnostic pertains to. */
1826
1851
  id: string;
@@ -1831,22 +1856,22 @@ interface DiagnosticEntry {
1831
1856
  /** A human-readable description of the diagnostic. */
1832
1857
  message: string;
1833
1858
  /**
1834
- * Which check produced this diagnostic.
1835
- *
1836
- * - `"placeholder"` — a placeholder field, operator, or value
1837
- * - `"muted"` — a muted rule or group
1838
- * - `"query-validator"` — the query-level validator
1839
- * - `"field-validator"` — a field-level validator
1840
- * - `"type-check"` — value/type mismatch based on field `inputType`
1841
- * - `"field-check"` — field existence check against the `fields` config
1842
- */
1859
+ * Which check produced this diagnostic.
1860
+ *
1861
+ * - `"placeholder"` — a placeholder field, operator, or value
1862
+ * - `"muted"` — a muted rule or group
1863
+ * - `"query-validator"` — the query-level validator
1864
+ * - `"field-validator"` — a field-level validator
1865
+ * - `"type-check"` — value/type mismatch based on field `inputType`
1866
+ * - `"field-check"` — field existence check against the `fields` config
1867
+ */
1843
1868
  source: "placeholder" | "muted" | "query-validator" | "field-validator" | "type-check" | "field-check";
1844
1869
  }
1845
1870
  /**
1846
- * Aggregate statistics for the `"diagnostics"` format.
1847
- *
1848
- * @group Export
1849
- */
1871
+ * Aggregate statistics for the `"diagnostics"` format.
1872
+ *
1873
+ * @group Export
1874
+ */
1850
1875
  interface DiagnosticsStats {
1851
1876
  totalRules: number;
1852
1877
  totalGroups: number;
@@ -1856,10 +1881,10 @@ interface DiagnosticsStats {
1856
1881
  invalidGroups: number;
1857
1882
  }
1858
1883
  /**
1859
- * Per-field summary entry for the `"diagnostics"` format.
1860
- *
1861
- * @group Export
1862
- */
1884
+ * Per-field summary entry for the `"diagnostics"` format.
1885
+ *
1886
+ * @group Export
1887
+ */
1863
1888
  interface DiagnosticsFieldSummaryEntry {
1864
1889
  /** Number of rules referencing this field. */
1865
1890
  ruleCount: number;
@@ -1867,10 +1892,10 @@ interface DiagnosticsFieldSummaryEntry {
1867
1892
  invalidCount: number;
1868
1893
  }
1869
1894
  /**
1870
- * Top-level result of {@link formatQuery} for the `"diagnostics"` format.
1871
- *
1872
- * @group Export
1873
- */
1895
+ * Top-level result of {@link formatQuery} for the `"diagnostics"` format.
1896
+ *
1897
+ * @group Export
1898
+ */
1874
1899
  interface DiagnosticsResult {
1875
1900
  /** The annotated query tree with `valid`, `path`, and `level` on every node. */
1876
1901
  query: RuleGroupDiagnosticsResult | RuleGroupICDiagnosticsResult;
@@ -1882,64 +1907,70 @@ interface DiagnosticsResult {
1882
1907
  fieldSummary: Record<string, DiagnosticsFieldSummaryEntry>;
1883
1908
  }
1884
1909
  /**
1885
- * @group Export
1886
- */
1910
+ * @group Export
1911
+ */
1887
1912
  interface RQBJsonLogicStartsWith {
1888
1913
  startsWith: [RQBJsonLogic, RQBJsonLogic, ...RQBJsonLogic[]];
1889
1914
  }
1890
1915
  /**
1891
- * @group Export
1892
- */
1916
+ * @group Export
1917
+ */
1893
1918
  interface RQBJsonLogicEndsWith {
1894
1919
  endsWith: [RQBJsonLogic, RQBJsonLogic, ...RQBJsonLogic[]];
1895
1920
  }
1896
1921
  /**
1897
- * JsonLogic rule object with additional operators generated by {@link formatQuery}
1898
- * and accepted by {@link parseJsonLogic!parseJsonLogic}.
1899
- *
1900
- * @group Export
1901
- */
1922
+ * @group Export
1923
+ */
1924
+ interface RQBJsonLogicVar {
1925
+ var: string;
1926
+ }
1927
+ /**
1928
+ * JsonLogic rule object with additional operators generated by {@link formatQuery}
1929
+ * and accepted by {@link parseJsonLogic!parseJsonLogic}.
1930
+ *
1931
+ * @group Export
1932
+ */
1902
1933
  type RQBJsonLogic = RulesLogic<RQBJsonLogicStartsWith | RQBJsonLogicEndsWith>;
1903
1934
  /**
1904
- * Constituent word order (as array) for the "natural_language" format.
1905
- *
1906
- * - S (subject) = field
1907
- * - V (verb) = operator
1908
- * - O (object) = value
1909
- *
1910
- * @group Export
1911
- */
1935
+ * Constituent word order (as array) for the "natural_language" format.
1936
+ *
1937
+ * - S (subject) = field
1938
+ * - V (verb) = operator
1939
+ * - O (object) = value
1940
+ *
1941
+ * @group Export
1942
+ */
1912
1943
  type ConstituentWordOrder = ["S", "V", "O"] | ["S", "O", "V"] | ["O", "S", "V"] | ["O", "V", "S"] | ["V", "S", "O"] | ["V", "O", "S"];
1913
1944
  /**
1914
- * Constituent word order (as string) for the "natural_language" format.
1915
- *
1916
- * - S (subject) = field
1917
- * - V (verb) = operator
1918
- * - O (object) = value
1919
- *
1920
- * @group Export
1921
- */
1945
+ * Constituent word order (as string) for the "natural_language" format.
1946
+ *
1947
+ * - S (subject) = field
1948
+ * - V (verb) = operator
1949
+ * - O (object) = value
1950
+ *
1951
+ * @group Export
1952
+ */
1922
1953
  type ConstituentWordOrderString = "SVO" | "SOV" | "OSV" | "OVS" | "VSO" | "VOS";
1923
1954
  type RepeatStrings<S extends string[], Depth extends number[] = []> = Depth["length"] extends 2 ? "" : "" | `_${S[number]}${RepeatStrings<S, [...Depth, 1]>}`;
1924
1955
  type ZeroOrMoreGroupVariants = RepeatStrings<["xor", "not"]>;
1925
1956
  /**
1926
- * Rule group condition identifier for the "natural_language" format.
1927
- *
1928
- * @group Export
1929
- */
1957
+ * Rule group condition identifier for the "natural_language" format.
1958
+ *
1959
+ * @group Export
1960
+ */
1930
1961
  type GroupVariantCondition = "not" | "xor";
1931
1962
  /**
1932
- * Keys for the `translations` config object used by the "natural_language" format.
1933
- *
1934
- * @group Export
1935
- */
1963
+ * Keys for the `translations` config object used by the "natural_language" format.
1964
+ *
1965
+ * @group Export
1966
+ */
1936
1967
  type NLTranslationKey = "and" | "or" | "true" | "false" | "ruleSeparator" | "betweenAnd" | "afterSubject" | "afterVerb" | "afterObject" | "listSeparator" | `groupPrefix${ZeroOrMoreGroupVariants}` | `groupSuffix${ZeroOrMoreGroupVariants}`;
1937
1968
  /**
1938
- * `translations` config object for "natural_language" format.
1939
- *
1940
- * @group Export
1941
- */
1969
+ * `translations` config object for "natural_language" format.
1970
+ *
1971
+ * @group Export
1972
+ */
1942
1973
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
1943
1974
  //#endregion
1944
- 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 };
1945
- //# sourceMappingURL=index-DlVg-QXo.d.ts.map
1975
+ export { DefaultOperatorName as A, FullField as C, RuleGroupTypeIC as D, RuleGroupTypeAny as E, OptionList as F, SetRequired as I, Except as L, RuleGroupType as M, RuleType as N, DefaultCombinatorName as O, ExpressionNode as P, Merge as R, ValueProcessorOptions as S, DefaultRuleGroupTypeIC as T, RuleGroupProcessor as _, DiagnosticsResult as a, ValueProcessorByRule as b, ExportOperatorMap as c, NLTranslationKey as d, NLTranslations as f, RQBJsonLogicVar as g, RQBJsonLogic as h, ConstituentWordOrder as i, DefaultRuleGroupType as j, DefaultCombinatorNameExtended as k, FormatQueryOptions as l, ParameterizedSQL as m, JsonLogicLessThanOrEqual as n, ExportFormat as o, ParameterizedNamedSQL as p, JsonLogicRulesLogic as r, ExportObjectFormats as s, JsonLogicLessThan as t, GroupVariantCondition as u, RuleProcessor as v, ValueSources as w, ValueProcessorLegacy as x, SQLPreset as y };
1976
+ //# sourceMappingURL=index-BSwFvkeI.d.ts.map