@react-querybuilder/core 8.20.2 → 8.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) 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 +4 -10
  90. package/dist/transformQuery.d.mts +91 -92
  91. package/dist/transformQuery.d.ts +91 -92
  92. package/dist/transformQuery.js +4 -3
  93. package/dist/transformQuery.js.map +1 -1
  94. package/dist/transformQuery.mjs +2 -1
  95. package/dist/transformQuery.mjs.map +1 -1
  96. package/dist/{utils-BpaOtylk.js → utils-DEwV7F6B.js} +108 -12
  97. package/dist/utils-DEwV7F6B.js.map +1 -0
  98. package/dist/{utils-CJRGiPb-.mjs → utils-Dt0D_DMV.mjs} +69 -3
  99. package/dist/utils-Dt0D_DMV.mjs.map +1 -0
  100. package/package.json +14 -14
  101. package/dist/import-Qs1-kgv5.d.ts +0 -27
  102. package/dist/import-ShTj5IdB.d.mts +0 -27
  103. package/dist/objectUtils-DBJI82bl.js.map +0 -1
  104. package/dist/objectUtils-ZvPkF6u6.mjs.map +0 -1
  105. package/dist/prepareQueryObjects-BCLU20Cg.mjs.map +0 -1
  106. package/dist/prepareQueryObjects-Bni5VgYM.js.map +0 -1
  107. package/dist/utils-BpaOtylk.js.map +0 -1
  108. package/dist/utils-CJRGiPb-.mjs.map +0 -1
@@ -1,28 +1,27 @@
1
- import { E as DefaultRuleGroupType, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.mjs";
2
-
1
+ import { T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.mjs";
3
2
  //#region src/utils/parseGremlin/parseGremlin.d.ts
4
3
  /**
5
- * Options for {@link parseGremlin}.
6
- */
4
+ * Options for {@link parseGremlin}.
5
+ */
7
6
  interface ParseGremlinOptions {
8
7
  independentCombinators?: boolean;
9
8
  }
10
9
  /**
11
- * Parses a Gremlin traversal string into a {@link DefaultRuleGroupType}.
12
- *
13
- * Accepts a full Gremlin traversal or a chain of `.has()` steps.
14
- * Pattern steps (`.hasLabel()`, `.out()`, `.in()`, `.both()`, `.as()`) are
15
- * consumed but discarded — only `.has()` filter predicates are returned.
16
- *
17
- * @example
18
- * ```ts
19
- * // Full traversal — extracts .has() conditions only
20
- * parseGremlin("g.V().hasLabel('Person').has('age', gt(30))");
21
- *
22
- * // Bare .has() chain
23
- * parseGremlin(".has('age', gt(30)).has('name', 'Alice')");
24
- * ```
25
- */
10
+ * Parses a Gremlin traversal string into a {@link DefaultRuleGroupType}.
11
+ *
12
+ * Accepts a full Gremlin traversal or a chain of `.has()` steps.
13
+ * Pattern steps (`.hasLabel()`, `.out()`, `.in()`, `.both()`, `.as()`) are
14
+ * consumed but discarded — only `.has()` filter predicates are returned.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Full traversal — extracts .has() conditions only
19
+ * parseGremlin("g.V().hasLabel('Person').has('age', gt(30))");
20
+ *
21
+ * // Bare .has() chain
22
+ * parseGremlin(".has('age', gt(30)).has('name', 'Alice')");
23
+ * ```
24
+ */
26
25
  declare function parseGremlin(gremlin: string): DefaultRuleGroupType;
27
26
  declare function parseGremlin(gremlin: string, options: Omit<ParseGremlinOptions, "independentCombinators"> & {
28
27
  independentCombinators?: false;
@@ -1,28 +1,27 @@
1
- import { E as DefaultRuleGroupType, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.js";
2
-
1
+ import { T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.js";
3
2
  //#region src/utils/parseGremlin/parseGremlin.d.ts
4
3
  /**
5
- * Options for {@link parseGremlin}.
6
- */
4
+ * Options for {@link parseGremlin}.
5
+ */
7
6
  interface ParseGremlinOptions {
8
7
  independentCombinators?: boolean;
9
8
  }
10
9
  /**
11
- * Parses a Gremlin traversal string into a {@link DefaultRuleGroupType}.
12
- *
13
- * Accepts a full Gremlin traversal or a chain of `.has()` steps.
14
- * Pattern steps (`.hasLabel()`, `.out()`, `.in()`, `.both()`, `.as()`) are
15
- * consumed but discarded — only `.has()` filter predicates are returned.
16
- *
17
- * @example
18
- * ```ts
19
- * // Full traversal — extracts .has() conditions only
20
- * parseGremlin("g.V().hasLabel('Person').has('age', gt(30))");
21
- *
22
- * // Bare .has() chain
23
- * parseGremlin(".has('age', gt(30)).has('name', 'Alice')");
24
- * ```
25
- */
10
+ * Parses a Gremlin traversal string into a {@link DefaultRuleGroupType}.
11
+ *
12
+ * Accepts a full Gremlin traversal or a chain of `.has()` steps.
13
+ * Pattern steps (`.hasLabel()`, `.out()`, `.in()`, `.both()`, `.as()`) are
14
+ * consumed but discarded — only `.has()` filter predicates are returned.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Full traversal — extracts .has() conditions only
19
+ * parseGremlin("g.V().hasLabel('Person').has('age', gt(30))");
20
+ *
21
+ * // Bare .has() chain
22
+ * parseGremlin(".has('age', gt(30)).has('name', 'Alice')");
23
+ * ```
24
+ */
26
25
  declare function parseGremlin(gremlin: string): DefaultRuleGroupType;
27
26
  declare function parseGremlin(gremlin: string, options: Omit<ParseGremlinOptions, "independentCombinators"> & {
28
27
  independentCombinators?: false;
@@ -1,35 +1,222 @@
1
- import { E as DefaultRuleGroupType, j as Except, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.mjs";
2
- import { t as ParserCommonOptions } from "./import-ShTj5IdB.mjs";
1
+ import { L as Except, P as ExpressionNode, R as Merge, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.mjs";
2
+ import { t as ParserCommonOptions } from "./import-BVdxeIBO.mjs";
3
+ //#region ../../node_modules/type-fest/source/override-properties.d.ts
4
+ /**
5
+ Override existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.
6
+
7
+ This is useful when you want to override existing properties with a different type and make sure that these properties really exist in the original.
8
+
9
+ @example
10
+ ```
11
+ import type {OverrideProperties} from 'type-fest';
12
+
13
+ type Foo = {
14
+ a: string;
15
+ b: string;
16
+ };
17
+
18
+ type Bar = OverrideProperties<Foo, {b: number}>;
19
+ //=> {a: string; b: number}
3
20
 
21
+ // @ts-expect-error
22
+ type Baz = OverrideProperties<Foo, {c: number}>;
23
+ // Error, type '{ c: number; }' does not satisfy the constraint '{ c: never; }'
24
+
25
+ // @ts-expect-error
26
+ type Fizz = OverrideProperties<Foo, {b: number; c: number}>;
27
+ // Error, type '{ b: number; c: number; }' does not satisfy the constraint '{ b: number; c: never; }'
28
+ ```
29
+
30
+ @category Object
31
+ */
32
+ type OverrideProperties<TOriginal,
33
+ // This first bit where we use `Partial` is to enable autocomplete
34
+ // and the second bit with the mapped type is what enforces that we don't try
35
+ // to override properties that doesn't exist in the original type.
36
+ TOverride extends Partial<Record<keyof TOriginal, unknown>> & { [Key in keyof TOverride]: Key extends keyof TOriginal ? TOverride[Key] : never; }> = Merge<TOriginal, TOverride>;
37
+ //#endregion
38
+ //#region src/utils/parseJSONata/types.d.ts
39
+ interface JSONataExprNode {
40
+ type: string;
41
+ value?: any;
42
+ position?: number;
43
+ arguments?: JSONataExprNode[];
44
+ name?: string;
45
+ procedure?: JSONataExprNode;
46
+ steps?: JSONataExprNode[];
47
+ expressions?: JSONataExprNode[];
48
+ stages?: JSONataExprNode[];
49
+ lhs?: JSONataExprNode;
50
+ rhs?: JSONataExprNode;
51
+ }
52
+ interface JSONataPath extends JSONataExprNode {
53
+ type: "path";
54
+ steps: [JSONataExprNode, ...JSONataExprNode[]];
55
+ }
56
+ interface JSONataName extends JSONataExprNode {
57
+ type: "name";
58
+ value: string;
59
+ }
60
+ interface JSONataIdentifier extends JSONataPath {
61
+ steps: [JSONataName, ...JSONataName[]];
62
+ }
63
+ interface JSONataBlock extends JSONataExprNode {
64
+ type: "block";
65
+ expressions: [JSONataExprNode];
66
+ }
67
+ interface JSONataString extends JSONataExprNode {
68
+ type: "string";
69
+ value: string;
70
+ }
71
+ interface JSONataNumber extends JSONataExprNode {
72
+ type: "number";
73
+ value: number;
74
+ }
75
+ interface JSONataBoolean extends JSONataExprNode {
76
+ type: "value";
77
+ value: boolean;
78
+ }
79
+ interface JSONataNull extends JSONataExprNode {
80
+ type: "value";
81
+ value: null;
82
+ }
83
+ interface JSONataRegex extends JSONataExprNode {
84
+ type: "regex";
85
+ value: RegExp;
86
+ }
87
+ interface JSONataBinaryNode extends JSONataExprNode {
88
+ type: "binary";
89
+ lhs: JSONataExprNode;
90
+ rhs: JSONataExprNode;
91
+ }
92
+ interface JSONataAnd extends JSONataBinaryNode {
93
+ value: "and";
94
+ }
95
+ interface JSONataOr extends JSONataBinaryNode {
96
+ value: "or";
97
+ }
98
+ interface JSONataEqual extends JSONataBinaryNode {
99
+ value: "=";
100
+ }
101
+ interface JSONataNotEqual extends JSONataBinaryNode {
102
+ value: "!=";
103
+ }
104
+ interface JSONataGreaterThan extends JSONataBinaryNode {
105
+ value: ">";
106
+ }
107
+ interface JSONataGreaterThanOrEqual extends JSONataBinaryNode {
108
+ value: ">=";
109
+ }
110
+ interface JSONataLessThan extends JSONataBinaryNode {
111
+ value: "<";
112
+ }
113
+ interface JSONataLessThanOrEqual extends JSONataBinaryNode {
114
+ value: "<=";
115
+ }
116
+ interface JSONataIn extends JSONataBinaryNode {
117
+ value: "in";
118
+ lhs: JSONataPath;
119
+ rhs: JSONataList;
120
+ }
121
+ interface JSONataNot extends JSONataExprNode {
122
+ type: "function";
123
+ value: "(";
124
+ arguments: [JSONataExprNode];
125
+ procedure: OverrideProperties<JSONataExprNode, {
126
+ value: "not";
127
+ type: "variable";
128
+ }>;
129
+ }
130
+ interface JSONataContains extends JSONataExprNode {
131
+ type: "function";
132
+ value: "(";
133
+ arguments: [JSONataPath, JSONataString | JSONataRegex];
134
+ procedure: OverrideProperties<JSONataExprNode, {
135
+ value: "contains";
136
+ type: "variable";
137
+ }>;
138
+ }
139
+ interface JSONataToMillis extends JSONataExprNode {
140
+ type: "function";
141
+ value: "(";
142
+ arguments: [JSONataString, ...JSONataString[]];
143
+ procedure: OverrideProperties<JSONataExprNode, {
144
+ value: "toMillis";
145
+ type: "variable";
146
+ }>;
147
+ }
148
+ interface JSONataList extends JSONataExprNode {
149
+ type: "unary";
150
+ value: "[";
151
+ expressions: JSONataExprNode[];
152
+ }
153
+ /**
154
+ * A JSONata operand subtree that {@link parseJSONata!ParseJSONataOptions.getExpression} may
155
+ * receive — an arithmetic infix node (`+ - * / %`) or a function-call node
156
+ * (`$abs`/`$min`/`$max`/`$uppercase`/`$lowercase`, etc.).
157
+ */
158
+ type JSONataExpressionOperand = JSONataExprNode;
159
+ /** Context passed to {@link parseJSONata!ParseJSONataOptions.getExpression}. */
160
+ interface ParseJSONataExpressionContext {
161
+ /** Returns `true` if the field is configured (or if no `fields` were supplied). */
162
+ fieldExists: (fieldName: string) => boolean;
163
+ }
164
+ //#endregion
4
165
  //#region src/utils/parseJSONata/parseJSONata.d.ts
5
166
  /**
6
- * Options object for {@link parseJSONata}.
7
- *
8
- * Note: `listsAsArrays` is ignored by `parseJSONata`; lists are _always_ arrays.
9
- */
10
- interface ParseJSONataOptions extends ParserCommonOptions {}
167
+ * Options object for {@link parseJSONata}.
168
+ *
169
+ * Note: `listsAsArrays` is ignored by `parseJSONata`; lists are _always_ arrays.
170
+ */
171
+ interface ParseJSONataOptions extends ParserCommonOptions {
172
+ /**
173
+ * Handler that converts a JSONata arithmetic/function operand subtree into an
174
+ * {@link ExpressionNode}. Return `null` to reject (the rule is dropped). Supplied by
175
+ * `@react-querybuilder/expr` (`expressionParserJSONata`). When omitted, expression
176
+ * operands are ignored (rule dropped).
177
+ */
178
+ getExpression?: (node: JSONataExpressionOperand, ctx: ParseJSONataExpressionContext) => ExpressionNode | null;
179
+ }
11
180
  /**
12
- * Converts a JSONata string expression into a query suitable for the
13
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
14
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
15
- */
181
+ * Converts a JSONata string expression into a query suitable for the
182
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
183
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
184
+ */
16
185
  declare function parseJSONata(jsonataInput: string): DefaultRuleGroupType;
17
186
  /**
18
- * Converts a JSONata string expression into a query suitable for the
19
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
20
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
21
- */
187
+ * Converts a JSONata string expression into a query suitable for the
188
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
189
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
190
+ */
22
191
  declare function parseJSONata(jsonataInput: string, options: Except<ParseJSONataOptions, "independentCombinators"> & {
23
192
  independentCombinators?: false;
24
193
  }): DefaultRuleGroupType;
25
194
  /**
26
- * Converts a JSONata string expression into a query suitable for the
27
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
28
- * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
29
- */
195
+ * Converts a JSONata string expression into a query suitable for the
196
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
197
+ * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
198
+ */
30
199
  declare function parseJSONata(jsonataInput: string, options: Except<ParseJSONataOptions, "independentCombinators"> & {
31
200
  independentCombinators: true;
32
201
  }): DefaultRuleGroupTypeIC;
33
202
  //#endregion
34
- export { ParseJSONataOptions, parseJSONata };
203
+ //#region src/utils/parseJSONata/utils.d.ts
204
+ type Any = any;
205
+ declare const isJSONataIdentifier: (expr: Any) => expr is JSONataIdentifier;
206
+ declare const isJSONataString: (expr: Any) => expr is JSONataString;
207
+ declare const isJSONataNumber: (expr: Any) => expr is JSONataNumber;
208
+ declare const isJSONataBoolean: (expr: Any) => expr is JSONataBoolean;
209
+ declare const isJSONataNull: (expr: Any) => expr is JSONataNull;
210
+ declare const isJSONataList: (expr: Any) => expr is JSONataList;
211
+ /**
212
+ * A JSONata comparison operand that is a candidate expression subtree: an arithmetic infix node
213
+ * (`+ - * / %`) or a function-call node (excluding the `not`/`contains` predicates handled
214
+ * elsewhere). The expr-supplied `getExpression` handler decides whether it maps to a known
215
+ * function.
216
+ */
217
+ declare const isJSONataExpressionOperand: (expr: Any) => expr is JSONataExprNode;
218
+ declare const getValidValue: (expr: Any) => Any;
219
+ declare const getFieldFromPath: (path: JSONataPath) => string;
220
+ //#endregion
221
+ export { JSONataAnd, JSONataBinaryNode, JSONataBlock, JSONataBoolean, JSONataContains, JSONataEqual, JSONataExprNode, JSONataExpressionOperand, JSONataGreaterThan, JSONataGreaterThanOrEqual, JSONataIdentifier, JSONataIn, JSONataLessThan, JSONataLessThanOrEqual, JSONataList, JSONataName, JSONataNot, JSONataNotEqual, JSONataNull, JSONataNumber, JSONataOr, JSONataPath, JSONataRegex, JSONataString, JSONataToMillis, ParseJSONataExpressionContext, ParseJSONataOptions, getFieldFromPath, getValidValue, isJSONataBoolean, isJSONataExpressionOperand, isJSONataIdentifier, isJSONataList, isJSONataNull, isJSONataNumber, isJSONataString, parseJSONata };
35
222
  //# sourceMappingURL=parseJSONata.d.mts.map
@@ -1,35 +1,222 @@
1
- import { E as DefaultRuleGroupType, j as Except, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.js";
2
- import { t as ParserCommonOptions } from "./import-Qs1-kgv5.js";
1
+ import { L as Except, P as ExpressionNode, R as Merge, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.js";
2
+ import { t as ParserCommonOptions } from "./import-Ddc3d_8q.js";
3
+ //#region ../../node_modules/type-fest/source/override-properties.d.ts
4
+ /**
5
+ Override existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.
6
+
7
+ This is useful when you want to override existing properties with a different type and make sure that these properties really exist in the original.
8
+
9
+ @example
10
+ ```
11
+ import type {OverrideProperties} from 'type-fest';
12
+
13
+ type Foo = {
14
+ a: string;
15
+ b: string;
16
+ };
17
+
18
+ type Bar = OverrideProperties<Foo, {b: number}>;
19
+ //=> {a: string; b: number}
3
20
 
21
+ // @ts-expect-error
22
+ type Baz = OverrideProperties<Foo, {c: number}>;
23
+ // Error, type '{ c: number; }' does not satisfy the constraint '{ c: never; }'
24
+
25
+ // @ts-expect-error
26
+ type Fizz = OverrideProperties<Foo, {b: number; c: number}>;
27
+ // Error, type '{ b: number; c: number; }' does not satisfy the constraint '{ b: number; c: never; }'
28
+ ```
29
+
30
+ @category Object
31
+ */
32
+ type OverrideProperties<TOriginal,
33
+ // This first bit where we use `Partial` is to enable autocomplete
34
+ // and the second bit with the mapped type is what enforces that we don't try
35
+ // to override properties that doesn't exist in the original type.
36
+ TOverride extends Partial<Record<keyof TOriginal, unknown>> & { [Key in keyof TOverride]: Key extends keyof TOriginal ? TOverride[Key] : never; }> = Merge<TOriginal, TOverride>;
37
+ //#endregion
38
+ //#region src/utils/parseJSONata/types.d.ts
39
+ interface JSONataExprNode {
40
+ type: string;
41
+ value?: any;
42
+ position?: number;
43
+ arguments?: JSONataExprNode[];
44
+ name?: string;
45
+ procedure?: JSONataExprNode;
46
+ steps?: JSONataExprNode[];
47
+ expressions?: JSONataExprNode[];
48
+ stages?: JSONataExprNode[];
49
+ lhs?: JSONataExprNode;
50
+ rhs?: JSONataExprNode;
51
+ }
52
+ interface JSONataPath extends JSONataExprNode {
53
+ type: "path";
54
+ steps: [JSONataExprNode, ...JSONataExprNode[]];
55
+ }
56
+ interface JSONataName extends JSONataExprNode {
57
+ type: "name";
58
+ value: string;
59
+ }
60
+ interface JSONataIdentifier extends JSONataPath {
61
+ steps: [JSONataName, ...JSONataName[]];
62
+ }
63
+ interface JSONataBlock extends JSONataExprNode {
64
+ type: "block";
65
+ expressions: [JSONataExprNode];
66
+ }
67
+ interface JSONataString extends JSONataExprNode {
68
+ type: "string";
69
+ value: string;
70
+ }
71
+ interface JSONataNumber extends JSONataExprNode {
72
+ type: "number";
73
+ value: number;
74
+ }
75
+ interface JSONataBoolean extends JSONataExprNode {
76
+ type: "value";
77
+ value: boolean;
78
+ }
79
+ interface JSONataNull extends JSONataExprNode {
80
+ type: "value";
81
+ value: null;
82
+ }
83
+ interface JSONataRegex extends JSONataExprNode {
84
+ type: "regex";
85
+ value: RegExp;
86
+ }
87
+ interface JSONataBinaryNode extends JSONataExprNode {
88
+ type: "binary";
89
+ lhs: JSONataExprNode;
90
+ rhs: JSONataExprNode;
91
+ }
92
+ interface JSONataAnd extends JSONataBinaryNode {
93
+ value: "and";
94
+ }
95
+ interface JSONataOr extends JSONataBinaryNode {
96
+ value: "or";
97
+ }
98
+ interface JSONataEqual extends JSONataBinaryNode {
99
+ value: "=";
100
+ }
101
+ interface JSONataNotEqual extends JSONataBinaryNode {
102
+ value: "!=";
103
+ }
104
+ interface JSONataGreaterThan extends JSONataBinaryNode {
105
+ value: ">";
106
+ }
107
+ interface JSONataGreaterThanOrEqual extends JSONataBinaryNode {
108
+ value: ">=";
109
+ }
110
+ interface JSONataLessThan extends JSONataBinaryNode {
111
+ value: "<";
112
+ }
113
+ interface JSONataLessThanOrEqual extends JSONataBinaryNode {
114
+ value: "<=";
115
+ }
116
+ interface JSONataIn extends JSONataBinaryNode {
117
+ value: "in";
118
+ lhs: JSONataPath;
119
+ rhs: JSONataList;
120
+ }
121
+ interface JSONataNot extends JSONataExprNode {
122
+ type: "function";
123
+ value: "(";
124
+ arguments: [JSONataExprNode];
125
+ procedure: OverrideProperties<JSONataExprNode, {
126
+ value: "not";
127
+ type: "variable";
128
+ }>;
129
+ }
130
+ interface JSONataContains extends JSONataExprNode {
131
+ type: "function";
132
+ value: "(";
133
+ arguments: [JSONataPath, JSONataString | JSONataRegex];
134
+ procedure: OverrideProperties<JSONataExprNode, {
135
+ value: "contains";
136
+ type: "variable";
137
+ }>;
138
+ }
139
+ interface JSONataToMillis extends JSONataExprNode {
140
+ type: "function";
141
+ value: "(";
142
+ arguments: [JSONataString, ...JSONataString[]];
143
+ procedure: OverrideProperties<JSONataExprNode, {
144
+ value: "toMillis";
145
+ type: "variable";
146
+ }>;
147
+ }
148
+ interface JSONataList extends JSONataExprNode {
149
+ type: "unary";
150
+ value: "[";
151
+ expressions: JSONataExprNode[];
152
+ }
153
+ /**
154
+ * A JSONata operand subtree that {@link parseJSONata!ParseJSONataOptions.getExpression} may
155
+ * receive — an arithmetic infix node (`+ - * / %`) or a function-call node
156
+ * (`$abs`/`$min`/`$max`/`$uppercase`/`$lowercase`, etc.).
157
+ */
158
+ type JSONataExpressionOperand = JSONataExprNode;
159
+ /** Context passed to {@link parseJSONata!ParseJSONataOptions.getExpression}. */
160
+ interface ParseJSONataExpressionContext {
161
+ /** Returns `true` if the field is configured (or if no `fields` were supplied). */
162
+ fieldExists: (fieldName: string) => boolean;
163
+ }
164
+ //#endregion
4
165
  //#region src/utils/parseJSONata/parseJSONata.d.ts
5
166
  /**
6
- * Options object for {@link parseJSONata}.
7
- *
8
- * Note: `listsAsArrays` is ignored by `parseJSONata`; lists are _always_ arrays.
9
- */
10
- interface ParseJSONataOptions extends ParserCommonOptions {}
167
+ * Options object for {@link parseJSONata}.
168
+ *
169
+ * Note: `listsAsArrays` is ignored by `parseJSONata`; lists are _always_ arrays.
170
+ */
171
+ interface ParseJSONataOptions extends ParserCommonOptions {
172
+ /**
173
+ * Handler that converts a JSONata arithmetic/function operand subtree into an
174
+ * {@link ExpressionNode}. Return `null` to reject (the rule is dropped). Supplied by
175
+ * `@react-querybuilder/expr` (`expressionParserJSONata`). When omitted, expression
176
+ * operands are ignored (rule dropped).
177
+ */
178
+ getExpression?: (node: JSONataExpressionOperand, ctx: ParseJSONataExpressionContext) => ExpressionNode | null;
179
+ }
11
180
  /**
12
- * Converts a JSONata string expression into a query suitable for the
13
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
14
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
15
- */
181
+ * Converts a JSONata string expression into a query suitable for the
182
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
183
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
184
+ */
16
185
  declare function parseJSONata(jsonataInput: string): DefaultRuleGroupType;
17
186
  /**
18
- * Converts a JSONata string expression into a query suitable for the
19
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
20
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
21
- */
187
+ * Converts a JSONata string expression into a query suitable for the
188
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
189
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
190
+ */
22
191
  declare function parseJSONata(jsonataInput: string, options: Except<ParseJSONataOptions, "independentCombinators"> & {
23
192
  independentCombinators?: false;
24
193
  }): DefaultRuleGroupType;
25
194
  /**
26
- * Converts a JSONata string expression into a query suitable for the
27
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
28
- * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
29
- */
195
+ * Converts a JSONata string expression into a query suitable for the
196
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
197
+ * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
198
+ */
30
199
  declare function parseJSONata(jsonataInput: string, options: Except<ParseJSONataOptions, "independentCombinators"> & {
31
200
  independentCombinators: true;
32
201
  }): DefaultRuleGroupTypeIC;
33
202
  //#endregion
34
- export { ParseJSONataOptions, parseJSONata };
203
+ //#region src/utils/parseJSONata/utils.d.ts
204
+ type Any = any;
205
+ declare const isJSONataIdentifier: (expr: Any) => expr is JSONataIdentifier;
206
+ declare const isJSONataString: (expr: Any) => expr is JSONataString;
207
+ declare const isJSONataNumber: (expr: Any) => expr is JSONataNumber;
208
+ declare const isJSONataBoolean: (expr: Any) => expr is JSONataBoolean;
209
+ declare const isJSONataNull: (expr: Any) => expr is JSONataNull;
210
+ declare const isJSONataList: (expr: Any) => expr is JSONataList;
211
+ /**
212
+ * A JSONata comparison operand that is a candidate expression subtree: an arithmetic infix node
213
+ * (`+ - * / %`) or a function-call node (excluding the `not`/`contains` predicates handled
214
+ * elsewhere). The expr-supplied `getExpression` handler decides whether it maps to a known
215
+ * function.
216
+ */
217
+ declare const isJSONataExpressionOperand: (expr: Any) => expr is JSONataExprNode;
218
+ declare const getValidValue: (expr: Any) => Any;
219
+ declare const getFieldFromPath: (path: JSONataPath) => string;
220
+ //#endregion
221
+ export { JSONataAnd, JSONataBinaryNode, JSONataBlock, JSONataBoolean, JSONataContains, JSONataEqual, JSONataExprNode, JSONataExpressionOperand, JSONataGreaterThan, JSONataGreaterThanOrEqual, JSONataIdentifier, JSONataIn, JSONataLessThan, JSONataLessThanOrEqual, JSONataList, JSONataName, JSONataNot, JSONataNotEqual, JSONataNull, JSONataNumber, JSONataOr, JSONataPath, JSONataRegex, JSONataString, JSONataToMillis, ParseJSONataExpressionContext, ParseJSONataOptions, getFieldFromPath, getValidValue, isJSONataBoolean, isJSONataExpressionOperand, isJSONataIdentifier, isJSONataList, isJSONataNull, isJSONataNumber, isJSONataString, parseJSONata };
35
222
  //# sourceMappingURL=parseJSONata.d.ts.map