@routier/core 0.2.0 → 0.3.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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/{readme.md → README.md} +2 -2
  3. package/dist/assertions/index.cjs +191 -0
  4. package/dist/assertions/index.cjs.map +1 -0
  5. package/dist/assertions/index.d.ts +30 -0
  6. package/dist/assertions/index.js +94 -30
  7. package/dist/assertions/index.js.map +1 -1
  8. package/dist/capabilities/index.cjs +820 -0
  9. package/dist/capabilities/index.cjs.map +1 -0
  10. package/dist/capabilities/index.js +580 -545
  11. package/dist/capabilities/index.js.map +1 -1
  12. package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
  13. package/dist/codegen/handlers/SetHandlerBuilder.d.ts +4 -0
  14. package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
  15. package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
  16. package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
  17. package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
  18. package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
  19. package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
  20. package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
  21. package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
  22. package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
  23. package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
  24. package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
  25. package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
  26. package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
  27. package/dist/codegen/handlers/index.d.ts +1 -0
  28. package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
  29. package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
  30. package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
  31. package/dist/codegen/handlers/serialize/SerializeComputedHandler.d.ts +6 -0
  32. package/dist/codegen/handlers/set/SetComplexHandler.d.ts +6 -0
  33. package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
  34. package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
  35. package/dist/codegen/handlers/types.d.ts +55 -1
  36. package/dist/codegen/index.cjs +618 -0
  37. package/dist/codegen/index.cjs.map +1 -0
  38. package/dist/codegen/index.js +100 -127
  39. package/dist/codegen/index.js.map +1 -1
  40. package/dist/collections/Changes.d.ts +2 -2
  41. package/dist/collections/MemoryDataCollection.d.ts +15 -1
  42. package/dist/collections/TagCollection.d.ts +7 -8
  43. package/dist/collections/index.cjs +702 -0
  44. package/dist/collections/index.cjs.map +1 -0
  45. package/dist/collections/index.js +282 -276
  46. package/dist/collections/index.js.map +1 -1
  47. package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
  48. package/dist/errors/PluginDestroyedError.d.ts +10 -0
  49. package/dist/errors/index.cjs +132 -0
  50. package/dist/errors/index.cjs.map +1 -0
  51. package/dist/errors/index.d.ts +2 -0
  52. package/dist/errors/index.js +61 -19
  53. package/dist/errors/index.js.map +1 -1
  54. package/dist/expressions/constants.d.ts +2 -0
  55. package/dist/expressions/evaluate.d.ts +53 -0
  56. package/dist/expressions/index.cjs +2087 -0
  57. package/dist/expressions/index.cjs.map +1 -0
  58. package/dist/expressions/index.d.ts +2 -0
  59. package/dist/expressions/index.js +1784 -772
  60. package/dist/expressions/index.js.map +1 -1
  61. package/dist/expressions/parser.d.ts +19 -0
  62. package/dist/expressions/types.d.ts +87 -2
  63. package/dist/expressions/utils.d.ts +1 -2
  64. package/dist/index.cjs +13925 -0
  65. package/dist/index.cjs.map +1 -0
  66. package/dist/index.js +12094 -7049
  67. package/dist/index.js.map +1 -1
  68. package/dist/performance/index.cjs +217 -0
  69. package/dist/performance/index.cjs.map +1 -0
  70. package/dist/performance/index.js +126 -50
  71. package/dist/performance/index.js.map +1 -1
  72. package/dist/pipeline/index.cjs +576 -0
  73. package/dist/pipeline/index.cjs.map +1 -0
  74. package/dist/pipeline/index.js +229 -156
  75. package/dist/pipeline/index.js.map +1 -1
  76. package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
  77. package/dist/plugins/CacheDbPlugin.d.ts +70 -0
  78. package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
  79. package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
  80. package/dist/plugins/RetryDbPlugin.d.ts +77 -0
  81. package/dist/plugins/index.cjs +6104 -0
  82. package/dist/plugins/index.cjs.map +1 -0
  83. package/dist/plugins/index.d.ts +5 -1
  84. package/dist/plugins/index.js +5572 -1491
  85. package/dist/plugins/index.js.map +1 -1
  86. package/dist/plugins/query/QueryOptionsCollection.d.ts +22 -0
  87. package/dist/plugins/query/index.d.ts +2 -0
  88. package/dist/plugins/query/join.d.ts +210 -0
  89. package/dist/plugins/query/similarity.d.ts +38 -0
  90. package/dist/plugins/query/types.d.ts +64 -1
  91. package/dist/plugins/translators/DataTranslator.d.ts +28 -0
  92. package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
  93. package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
  94. package/dist/plugins/translators/TranslatedArrayValue.d.ts +3 -1
  95. package/dist/plugins/translators/TranslatedGroupValue.d.ts +3 -1
  96. package/dist/plugins/translators/TranslatedSingleValue.d.ts +3 -1
  97. package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
  98. package/dist/plugins/translators/index.d.ts +1 -0
  99. package/dist/plugins/translators/types.d.ts +8 -1
  100. package/dist/plugins/types.d.ts +87 -11
  101. package/dist/plugins/wire/handler.d.ts +122 -0
  102. package/dist/plugins/wire/index.d.ts +4 -0
  103. package/dist/plugins/wire/persist.d.ts +43 -0
  104. package/dist/plugins/wire/query.d.ts +49 -0
  105. package/dist/plugins/wire/types.d.ts +123 -0
  106. package/dist/results/Result.d.ts +2 -2
  107. package/dist/results/index.cjs +174 -0
  108. package/dist/results/index.cjs.map +1 -0
  109. package/dist/results/index.js +29 -44
  110. package/dist/results/index.js.map +1 -1
  111. package/dist/schema/PropertyInfo.d.ts +35 -2
  112. package/dist/schema/SchemaDefinition.d.ts +51 -1
  113. package/dist/schema/builder.d.ts +35 -1
  114. package/dist/schema/communication/broadcast.d.ts +17 -1
  115. package/dist/schema/index.cjs +6911 -0
  116. package/dist/schema/index.cjs.map +1 -0
  117. package/dist/schema/index.d.ts +4 -0
  118. package/dist/schema/index.js +5781 -3973
  119. package/dist/schema/index.js.map +1 -1
  120. package/dist/schema/property/base/SchemaBase.d.ts +50 -2
  121. package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +5 -1
  122. package/dist/schema/property/modifiers/SchemaForeignKey.d.ts +15 -0
  123. package/dist/schema/property/modifiers/SchemaKey.d.ts +2 -0
  124. package/dist/schema/property/modifiers/SchemaNullable.d.ts +15 -1
  125. package/dist/schema/property/modifiers/SchemaOptional.d.ts +22 -1
  126. package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
  127. package/dist/schema/property/modifiers/SchemaTag.d.ts +27 -0
  128. package/dist/schema/property/modifiers/SchemaTracked.d.ts +5 -1
  129. package/dist/schema/property/modifiers/index.d.ts +3 -0
  130. package/dist/schema/property/types/SchemaArray.d.ts +2 -0
  131. package/dist/schema/property/types/SchemaBoolean.d.ts +2 -0
  132. package/dist/schema/property/types/SchemaDate.d.ts +2 -0
  133. package/dist/schema/property/types/SchemaFile.d.ts +60 -0
  134. package/dist/schema/property/types/SchemaNumber.d.ts +5 -1
  135. package/dist/schema/property/types/SchemaObject.d.ts +2 -0
  136. package/dist/schema/property/types/SchemaString.d.ts +25 -1
  137. package/dist/schema/property/types/SchemaVector.d.ts +61 -0
  138. package/dist/schema/property/types/index.d.ts +2 -0
  139. package/dist/schema/table/SchemaTransform.d.ts +40 -0
  140. package/dist/schema/table/index.d.ts +1 -0
  141. package/dist/schema/types.d.ts +200 -32
  142. package/dist/schema/utils/propertyKind.d.ts +4 -0
  143. package/dist/schema/utils/standardJsonSchema.d.ts +90 -0
  144. package/dist/types/index.cjs +23 -0
  145. package/dist/types/index.cjs.map +1 -0
  146. package/dist/types/index.js +0 -14
  147. package/dist/types/index.js.map +1 -1
  148. package/dist/utilities/functions.d.ts +1 -1
  149. package/dist/utilities/index.cjs +982 -0
  150. package/dist/utilities/index.cjs.map +1 -0
  151. package/dist/utilities/index.js +590 -321
  152. package/dist/utilities/index.js.map +1 -1
  153. package/dist/utilities/logger.d.ts +48 -0
  154. package/package.json +152 -98
  155. package/dist/collections/Changes.test.d.ts +0 -1
  156. package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
  157. package/dist/collections/TagCollection.test.d.ts +0 -1
  158. package/dist/expressions/parser.test.d.ts +0 -1
  159. package/dist/expressions/utils.test.d.ts +0 -1
  160. package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
  161. package/dist/pipeline/WorkPipeline.test.d.ts +0 -1
  162. package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
  163. package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
  164. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +0 -23
  165. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +0 -22
  166. package/dist/plugins/replication/index.d.ts +0 -3
  167. package/dist/plugins/replication/types.d.ts +0 -5
  168. package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
  169. package/dist/schema/PropertyInfo.test.d.ts +0 -1
  170. package/dist/schema/schemaGeneration.test.d.ts +0 -1
  171. package/dist/schema/testSchemas.test.d.ts +0 -314
  172. package/dist/utilities/arrays.test.d.ts +0 -1
  173. package/dist/utilities/dates.test.d.ts +0 -1
  174. package/dist/utilities/strings.test.d.ts +0 -1
@@ -0,0 +1,2087 @@
1
+ (() => {
2
+ "use strict";
3
+ var __webpack_modules__ = ({
4
+ 126(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
5
+ __webpack_require__.d(__webpack_exports__, {
6
+ assertString: () => (assertString),
7
+ isComparatorExpression: () => (isComparatorExpression),
8
+ isOperatorExpression: () => (isOperatorExpression),
9
+ isPropertyExpression: () => (isPropertyExpression),
10
+ isValueExpression: () => (isValueExpression)
11
+ });
12
+
13
+
14
+ function assertDate(data) {
15
+ if (isDate(data) === false) {
16
+ throw new TypeError('Value is not a Date');
17
+ }
18
+ }
19
+ function assertIsNotNull(data, message) {
20
+ if (data == null) {
21
+ if (message == null) {
22
+ throw new TypeError('Assertion failed, data is null');
23
+ }
24
+ if (typeof message === "string") {
25
+ throw new TypeError(message);
26
+ }
27
+ throw new TypeError(message());
28
+ }
29
+ }
30
+ function assertIsArray(data, message) {
31
+ if (!Array.isArray(data)) {
32
+ throw new TypeError(message ?? 'Assertion failed, data is not of type Array');
33
+ }
34
+ }
35
+ function assertString(data, message) {
36
+ if (typeof data !== "string") {
37
+ throw new TypeError(message ?? 'Assertion failed, data is not of type String');
38
+ }
39
+ }
40
+ function assertInstanceOf(value, Instance) {
41
+ if (value instanceof Instance) {
42
+ return;
43
+ }
44
+ if (value != null && typeof value === "object" && "constructor" in value) {
45
+ throw new TypeError(`value is not instance of type. Type: ${value.constructor.name}`);
46
+ }
47
+ throw new TypeError(`value is not instance of type`);
48
+ }
49
+ function assertIsNumber(value) {
50
+ if (typeof value !== "number") {
51
+ throw new TypeError("value is not of type `number`");
52
+ }
53
+ }
54
+ function isObjectWithType(value) {
55
+ return typeof value === "object" && value !== null && "type" in value;
56
+ }
57
+ /**
58
+ * Type guard: narrows `value` to `Expression` when it is an object with a valid `type` property.
59
+ */ function isExpression(value) {
60
+ return isObjectWithType(value) && EXPRESSION_TYPES.includes(value.type);
61
+ }
62
+ /**
63
+ * Type guard: narrows `value` to `OperatorExpression` when it is an object with `type === "operator"`.
64
+ */ function isOperatorExpression(value) {
65
+ return isObjectWithType(value) && value.type === "operator";
66
+ }
67
+ /**
68
+ * Type guard: narrows `value` to `ComparatorExpression` when it is an object with `type === "comparator"`.
69
+ */ function isComparatorExpression(value) {
70
+ return isObjectWithType(value) && value.type === "comparator";
71
+ }
72
+ /**
73
+ * Type guard: narrows `value` to `PropertyExpression` when it is an object with `type === "property"`.
74
+ */ function isPropertyExpression(value) {
75
+ return isObjectWithType(value) && value.type === "property";
76
+ }
77
+ /**
78
+ * Type guard: narrows `value` to `ValueExpression` when it is an object with `type === "value"`.
79
+ */ function isValueExpression(value) {
80
+ return isObjectWithType(value) && value.type === "value";
81
+ }
82
+ /**
83
+ * Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === "empty"`.
84
+ */ function isEmptyExpression(value) {
85
+ return isObjectWithType(value) && value.type === "empty";
86
+ }
87
+ /**
88
+ * Type guard: narrows `value` to `NotParsableExpression` when it is an object with `type === "not-parsable"`.
89
+ */ function isNotParsableExpression(value) {
90
+ return isObjectWithType(value) && value.type === "not-parsable";
91
+ }
92
+
93
+
94
+ },
95
+ 835(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
96
+ __webpack_require__.d(__webpack_exports__, {
97
+ t: () => (EXPRESSION_TYPES)
98
+ });
99
+ const EXPRESSION_TYPES = [
100
+ "operator",
101
+ "comparator",
102
+ "property",
103
+ "value",
104
+ "empty",
105
+ "not-parsable"
106
+ ];
107
+
108
+
109
+ },
110
+ 379(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
111
+ __webpack_require__.d(__webpack_exports__, {
112
+ Vu: () => (toPredicate),
113
+ _3: () => (evaluate),
114
+ wS: () => (toStrictPredicate)
115
+ });
116
+ /* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
117
+
118
+ /** Reads a property or literal operand, or `UNRESOLVED` when the node is not one. */ const UNRESOLVED = Symbol("unresolved");
119
+ const applyTransformer = (value, transformer)=>{
120
+ if (transformer == null) {
121
+ return value;
122
+ }
123
+ // A transformer applied to an absent value has no answer, and inventing one ("" for a missing
124
+ // string) is how a filter starts matching rows it should not.
125
+ if (value == null) {
126
+ return UNRESOLVED;
127
+ }
128
+ if (transformer === "to-lower-case") {
129
+ return typeof value === "string" ? value.toLowerCase() : UNRESOLVED;
130
+ }
131
+ if (transformer === "to-upper-case") {
132
+ return typeof value === "string" ? value.toUpperCase() : UNRESOLVED;
133
+ }
134
+ if (transformer === "length") {
135
+ return typeof value === "string" || Array.isArray(value) ? value.length : UNRESOLVED;
136
+ }
137
+ return UNRESOLVED;
138
+ };
139
+ const operand = (expression, row)=>{
140
+ if (expression == null) {
141
+ return UNRESOLVED;
142
+ }
143
+ if ((0,_assertions__rspack_import_0.isValueExpression)(expression)) {
144
+ return applyTransformer(expression.value, expression.transformer);
145
+ }
146
+ if ((0,_assertions__rspack_import_0.isPropertyExpression)(expression)) {
147
+ // Through the PropertyInfo, so a nested path and a `from`-renamed segment resolve the same
148
+ // way every other consumer of the tree resolves them.
149
+ return applyTransformer(expression.property.getValue(row), expression.transformer);
150
+ }
151
+ return UNRESOLVED;
152
+ };
153
+ /**
154
+ * `a === b` for the comparators, with Dates compared by VALUE.
155
+ *
156
+ * A Date compares by reference under `===`, so two Dates holding the same instant would be
157
+ * unequal — which is not what a filter on a date means, and not what any backend does.
158
+ */ const equals = (left, right, strict)=>{
159
+ if (left instanceof Date && right instanceof Date) {
160
+ return left.getTime() === right.getTime();
161
+ }
162
+ // oxlint-disable-next-line eqeqeq
163
+ return strict ? left === right : left == right;
164
+ };
165
+ /** Ordered comparison, only for shapes that have an order. */ const compare = (left, right, comparator)=>{
166
+ const asComparable = (value)=>value instanceof Date ? value.getTime() : value;
167
+ const a = asComparable(left);
168
+ const b = asComparable(right);
169
+ const comparable = typeof a === "number" && typeof b === "number" || typeof a === "string" && typeof b === "string";
170
+ if (comparable === false) {
171
+ return undefined;
172
+ }
173
+ if (comparator === "greater-than") {
174
+ return a > b;
175
+ }
176
+ if (comparator === "greater-than-equals") {
177
+ return a >= b;
178
+ }
179
+ if (comparator === "less-than") {
180
+ return a < b;
181
+ }
182
+ return a <= b;
183
+ };
184
+ const evaluateComparator = (comparator, left, right, strict)=>{
185
+ if (comparator === "equals") {
186
+ return equals(left, right, strict);
187
+ }
188
+ if (comparator === "includes") {
189
+ // Two shapes, and the tree does not distinguish them: `array.includes(value)` and
190
+ // `string.includes(substring)`. Whichever side is the container decides.
191
+ if (Array.isArray(left)) {
192
+ return left.some((item)=>equals(item, right, strict));
193
+ }
194
+ if (Array.isArray(right)) {
195
+ return right.some((item)=>equals(item, left, strict));
196
+ }
197
+ return typeof left === "string" && typeof right === "string" ? left.includes(right) : undefined;
198
+ }
199
+ if (comparator === "starts-with") {
200
+ return typeof left === "string" && typeof right === "string" ? left.startsWith(right) : undefined;
201
+ }
202
+ if (comparator === "ends-with") {
203
+ return typeof left === "string" && typeof right === "string" ? left.endsWith(right) : undefined;
204
+ }
205
+ return compare(left, right, comparator);
206
+ };
207
+ /**
208
+ * Evaluates `expression` against `row`, or returns `undefined` when it cannot.
209
+ *
210
+ * See the note at the top of this file: `undefined` means KEEP the row.
211
+ */ const evaluate = (expression, row)=>{
212
+ if ((0,_assertions__rspack_import_0.isOperatorExpression)(expression)) {
213
+ const left = expression.left == null ? undefined : evaluate(expression.left, row);
214
+ const right = expression.right == null ? undefined : evaluate(expression.right, row);
215
+ /**
216
+ * One unevaluable side does not have to sink the whole tree.
217
+ *
218
+ * `a && b` where `a` is definitely false is false whatever `b` is, and `a || b` where `a`
219
+ * is definitely true is true. That short-circuiting is what lets a mostly-understood
220
+ * predicate still narrow anything at all — without it, one unfamiliar sub-expression makes
221
+ * the entire filter a no-op.
222
+ */ if (expression.operator === "&&") {
223
+ if (left === false || right === false) {
224
+ return false;
225
+ }
226
+ return left === true && right === true ? true : undefined;
227
+ }
228
+ if (left === true || right === true) {
229
+ return true;
230
+ }
231
+ return left === false && right === false ? false : undefined;
232
+ }
233
+ if ((0,_assertions__rspack_import_0.isComparatorExpression)(expression)) {
234
+ const left = operand(expression.left, row);
235
+ const right = operand(expression.right, row);
236
+ if (left === UNRESOLVED || right === UNRESOLVED) {
237
+ return undefined;
238
+ }
239
+ const result = evaluateComparator(expression.comparator, left, right, expression.strict);
240
+ if (result === undefined) {
241
+ return undefined;
242
+ }
243
+ return expression.negated ? result === false : result;
244
+ }
245
+ // A tautology excludes nothing, which is exactly `true`. Anything else — a bare property, a
246
+ // literal, `not-parsable` — is not a predicate this can judge.
247
+ return expression.type === "empty" ? true : undefined;
248
+ };
249
+ /**
250
+ * `evaluate`, as a predicate that keeps whatever it cannot judge.
251
+ *
252
+ * The form every narrowing caller wants, with the fail-open rule applied once here rather than
253
+ * remembered at each call site.
254
+ */ const toPredicate = (expression)=>(row)=>evaluate(expression, row) !== false;
255
+ /**
256
+ * `evaluate`, as a predicate that THROWS on anything it cannot judge.
257
+ *
258
+ * The opposite default to `toPredicate`, and the right one when the predicate is the only thing
259
+ * standing between a caller and rows they asked to exclude — a filter that arrived over a wire and
260
+ * is being applied by the receiver. Failing open there does not cost a wasted comparison; it returns
261
+ * data the requester filtered out, and reports nothing.
262
+ *
263
+ * Use `toPredicate` when something authoritative re-checks the result, and this when nothing does.
264
+ */ const toStrictPredicate = (expression)=>(row)=>{
265
+ const result = evaluate(expression, row);
266
+ if (result === undefined) {
267
+ throw new Error("Cannot apply this filter: its expression cannot be evaluated in memory, and applying it partially would " + "return rows the filter excludes. This happens when a filter arrives without a runnable predicate — over a " + "wire, or rebuilt from a serialized query — and names something the evaluator does not understand.");
268
+ }
269
+ return result;
270
+ };
271
+
272
+
273
+ },
274
+ 91(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
275
+ __webpack_require__.d(__webpack_exports__, {
276
+ MY: () => (toExpression),
277
+ oH: () => (parseFragment),
278
+ pg: () => (combineExpressions)
279
+ });
280
+ /* import */ var _utilities__rspack_import_3 = __webpack_require__(581);
281
+ /* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
282
+ /* import */ var _schema__rspack_import_2 = __webpack_require__(537);
283
+ /* import */ var _types__rspack_import_1 = __webpack_require__(27);
284
+
285
+
286
+
287
+
288
+ // Error message constants
289
+ const ERROR_MESSAGES = {
290
+ PROPERTY_NOT_FOUND: (path)=>`Error parsing query, could not find PropertyInfo for path: ${path}`,
291
+ PARAM_PATH_NOT_FOUND: (value, params)=>`Cannot find path in params for .where(). Make sure parameters are not used inline.\r\nPath: ${value}, Params: ${JSON.stringify(params)}`,
292
+ VARIABLE_VALUE: (value)=>`Cannot derive value from variable, please pass parameters into the expression.
293
+
294
+ Example: .where(([x, params]) => x.id === params.id, { id: someVar.id })
295
+ Issue At: ${value}`,
296
+ UNSUPPORTED: (value)=>`Unsupported expression format: ${value}`
297
+ };
298
+ const parseUnknown = (value)=>{
299
+ (0,_assertions__rspack_import_0.assertString)(value);
300
+ return JSON.parse(value);
301
+ };
302
+ /**
303
+ * A parse failure caused by the params VALUES rather than the filter source.
304
+ * These must never poison the template cache — the same source can succeed
305
+ * with different params.
306
+ */ class ParamDependentParseError extends Error {
307
+ }
308
+ const converters = {
309
+ Array: (v)=>v,
310
+ Boolean: (v)=>v == null ? v : Boolean(v),
311
+ // Stryker disable next-line ArrowFunction: filters on computed properties route to
312
+ // in-memory execution, so this entry cannot be reached through a parsable filter.
313
+ Computed: (v)=>v,
314
+ Date: (v)=>v,
315
+ // A file is a reference, and a filter can legitimately compare its fields — content type
316
+ // and size are ordinary columns. The value passes through unconverted like an object.
317
+ File: (v)=>v,
318
+ // Stryker disable next-line ArrowFunction: SchemaTypes.Definition is handled as a
319
+ // generic primitive everywhere (specs/known-defects.md) and never pairs in a filter.
320
+ Definition: (v)=>v,
321
+ // Stryker disable next-line ArrowFunction: filters on function properties route to
322
+ // in-memory execution, so this entry cannot be reached through a parsable filter.
323
+ Function: (v)=>v,
324
+ Number: (v)=>v == null ? v : Number(v),
325
+ Object: (v)=>v,
326
+ String: (v)=>v == null ? v : String(v),
327
+ // A vector is a list of numbers and passes through like any other array. Nothing
328
+ // converts it because nothing compares it: similarity is `.nearest()`, not a filter.
329
+ Vector: (v)=>v
330
+ };
331
+ // Longest first so multi-character punctuation wins over its prefixes
332
+ const MULTI_CHARACTER_PUNCTUATION = [
333
+ "===",
334
+ "!==",
335
+ "?.",
336
+ "&&",
337
+ "||",
338
+ "==",
339
+ "!=",
340
+ ">=",
341
+ "<=",
342
+ "=>"
343
+ ];
344
+ // Stryker disable next-line all: documented equivalent cluster (see
345
+ // docs/mutation-backlog.md) — dropping an entry only affects source the parser rejects
346
+ // either way, and the rejection message names the character from the source rather than
347
+ // from this set, so no observable boundary distinguishes the mutant. Established
348
+ // experimentally: 30 message-asserting tests killed 1 of 12.
349
+ const SINGLE_CHARACTER_PUNCTUATION = new Set([
350
+ "(",
351
+ ")",
352
+ "[",
353
+ "]",
354
+ "{",
355
+ "}",
356
+ ".",
357
+ ",",
358
+ ";",
359
+ "!",
360
+ ">",
361
+ "<",
362
+ "-",
363
+ "+",
364
+ "*",
365
+ "/",
366
+ "%",
367
+ "=",
368
+ "?",
369
+ ":",
370
+ "&",
371
+ "|"
372
+ ]);
373
+ const STRING_ESCAPES = {
374
+ "n": "\n",
375
+ "r": "\r",
376
+ "t": "\t",
377
+ "b": "\b",
378
+ "f": "\f",
379
+ "v": "\v",
380
+ "0": "\0"
381
+ };
382
+ const isIdentifierStart = (char)=>/[a-zA-Z_$]/.test(char);
383
+ const isIdentifierPart = (char)=>/[a-zA-Z0-9_$]/.test(char);
384
+ const isDigit = (char)=>char >= "0" && char <= "9";
385
+ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >= "A" && char <= "F";
386
+ /**
387
+ * Decodes a `\uXXXX`, `\u{...}` or `\xXX` escape starting at the backslash.
388
+ * Returns the decoded character and the index just past the escape. These
389
+ * escapes carry a computed character, so mapping them through STRING_ESCAPES
390
+ * (which would yield the literal "u"/"x") silently corrupts the value.
391
+ */ const decodeCodeEscape = (source, backslashIndex)=>{
392
+ const kind = source[backslashIndex + 1];
393
+ let start = backslashIndex + 2;
394
+ if (kind === "u" && source[start] === "{") {
395
+ const end = source.indexOf("}", start + 1);
396
+ if (end === -1) {
397
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated unicode escape"));
398
+ }
399
+ return {
400
+ value: String.fromCodePoint(parseInt(source.slice(start + 1, end), 16)),
401
+ nextIndex: end + 1
402
+ };
403
+ }
404
+ const length = kind === "u" ? 4 : 2;
405
+ const digits = source.slice(start, start + length);
406
+ if (digits.length < length || [
407
+ ...digits
408
+ ].some((d)=>!isHexDigit(d))) {
409
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'\\${kind}' escape`));
410
+ }
411
+ return {
412
+ value: String.fromCharCode(parseInt(digits, 16)),
413
+ nextIndex: start + length
414
+ };
415
+ };
416
+ /**
417
+ * Converts filter source text into a flat token stream. Strings and comments are
418
+ * consumed here so operator characters inside literals can never be mistaken for
419
+ * real operators.
420
+ */ const tokenize = (source)=>{
421
+ const tokens = [];
422
+ let i = 0;
423
+ while(i < source.length){
424
+ const char = source[i];
425
+ // Whitespace
426
+ if (char === " " || char === "\t" || char === "\r" || char === "\n") {
427
+ i++;
428
+ continue;
429
+ }
430
+ // Comments
431
+ if (char === "/" && source[i + 1] === "/") {
432
+ while(i < source.length && source[i] !== "\n"){
433
+ i++;
434
+ }
435
+ continue;
436
+ }
437
+ if (char === "/" && source[i + 1] === "*") {
438
+ i += 2;
439
+ while(i < source.length && !(source[i] === "*" && source[i + 1] === "/")){
440
+ i++;
441
+ }
442
+ i += 2;
443
+ continue;
444
+ }
445
+ // String literals
446
+ if (char === "'" || char === "\"" || char === "`") {
447
+ const quote = char;
448
+ let value = "";
449
+ i++;
450
+ while(i < source.length && source[i] !== quote){
451
+ if (source[i] === "\\") {
452
+ const escaped = source[i + 1];
453
+ if (escaped === "u" || escaped === "x") {
454
+ const decoded = decodeCodeEscape(source, i);
455
+ value += decoded.value;
456
+ i = decoded.nextIndex;
457
+ continue;
458
+ }
459
+ value += STRING_ESCAPES[escaped] ?? escaped;
460
+ i += 2;
461
+ continue;
462
+ }
463
+ if (quote === "`" && source[i] === "$" && source[i + 1] === "{") {
464
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("template literal interpolation"));
465
+ }
466
+ value += source[i];
467
+ i++;
468
+ }
469
+ if (i >= source.length) {
470
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated string literal"));
471
+ }
472
+ i++; // consume closing quote
473
+ tokens.push({
474
+ kind: "string",
475
+ value
476
+ });
477
+ continue;
478
+ }
479
+ // Numbers — covers decimals, exponents (1e6), hex/octal/binary (0xFF),
480
+ // and numeric separators (1_000_000). Values are normalized here (the
481
+ // separator stripped) so the parser can hand them straight to Number()
482
+ if (isDigit(char)) {
483
+ let value = "";
484
+ const nextChar = source[i + 1];
485
+ const radixPrefix = char === "0" && nextChar != null && "xXoObB".includes(nextChar);
486
+ if (radixPrefix) {
487
+ value = source[i] + source[i + 1];
488
+ i += 2;
489
+ while(i < source.length && (isHexDigit(source[i]) || source[i] === "_")){
490
+ value += source[i];
491
+ i++;
492
+ }
493
+ } else {
494
+ while(i < source.length && (isDigit(source[i]) || source[i] === "." || source[i] === "_")){
495
+ value += source[i];
496
+ i++;
497
+ }
498
+ // Exponent part: e/E, optional sign, then digits. Only consumed when
499
+ // digits follow, so a stray identifier after a number still errors
500
+ if (source[i] === "e" || source[i] === "E") {
501
+ const signLength = source[i + 1] === "+" || source[i + 1] === "-" ? 1 : 0;
502
+ if (isDigit(source[i + 1 + signLength])) {
503
+ value += source[i];
504
+ i++;
505
+ if (signLength === 1) {
506
+ value += source[i];
507
+ i++;
508
+ }
509
+ while(i < source.length && isDigit(source[i])){
510
+ value += source[i];
511
+ i++;
512
+ }
513
+ }
514
+ }
515
+ }
516
+ tokens.push({
517
+ kind: "number",
518
+ value: value.replace(/_/g, "")
519
+ });
520
+ continue;
521
+ }
522
+ // Identifiers / keywords
523
+ if (isIdentifierStart(char)) {
524
+ let value = "";
525
+ while(i < source.length && isIdentifierPart(source[i])){
526
+ value += source[i];
527
+ i++;
528
+ }
529
+ tokens.push({
530
+ kind: "identifier",
531
+ value
532
+ });
533
+ continue;
534
+ }
535
+ // Multi-character punctuation (longest match first)
536
+ const multi = MULTI_CHARACTER_PUNCTUATION.find((w)=>source.startsWith(w, i));
537
+ if (multi != null) {
538
+ tokens.push({
539
+ kind: "punctuation",
540
+ value: multi
541
+ });
542
+ i += multi.length;
543
+ continue;
544
+ }
545
+ if (SINGLE_CHARACTER_PUNCTUATION.has(char)) {
546
+ tokens.push({
547
+ kind: "punctuation",
548
+ value: char
549
+ });
550
+ i++;
551
+ continue;
552
+ }
553
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`unexpected character '${char}'`));
554
+ }
555
+ return tokens;
556
+ };
557
+ /**
558
+ * Cursor over the token stream with the small set of lookahead operations the
559
+ * parser needs.
560
+ */ class TokenStream {
561
+ tokens;
562
+ index = 0;
563
+ constructor(tokens){
564
+ this.tokens = tokens;
565
+ }
566
+ get isAtEnd() {
567
+ return this.index >= this.tokens.length;
568
+ }
569
+ peek(offset = 0) {
570
+ return this.tokens[this.index + offset] ?? null;
571
+ }
572
+ next() {
573
+ const token = this.tokens[this.index];
574
+ if (token == null) {
575
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("unexpected end of expression"));
576
+ }
577
+ this.index++;
578
+ return token;
579
+ }
580
+ isPunctuation(value, offset = 0) {
581
+ const token = this.peek(offset);
582
+ return token != null && token.kind === "punctuation" && token.value === value;
583
+ }
584
+ matchPunctuation(value) {
585
+ if (this.isPunctuation(value)) {
586
+ this.index++;
587
+ return true;
588
+ }
589
+ return false;
590
+ }
591
+ expectPunctuation(value) {
592
+ if (!this.matchPunctuation(value)) {
593
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`expected '${value}'`));
594
+ }
595
+ }
596
+ }
597
+ const COMPARATOR_METHODS = {
598
+ startsWith: "starts-with",
599
+ endsWith: "ends-with",
600
+ includes: "includes"
601
+ };
602
+ const TRANSFORM_METHODS = {
603
+ toLowerCase: {
604
+ transformer: "to-lower-case",
605
+ locale: null
606
+ },
607
+ toUpperCase: {
608
+ transformer: "to-upper-case",
609
+ locale: null
610
+ },
611
+ toLocaleLowerCase: {
612
+ transformer: "to-lower-case",
613
+ locale: "en-US"
614
+ },
615
+ toLocaleUpperCase: {
616
+ transformer: "to-upper-case",
617
+ locale: "en-US"
618
+ }
619
+ };
620
+ const COMPARISON_OPERATORS = {
621
+ "==": {
622
+ comparator: "equals",
623
+ negated: false,
624
+ strict: false
625
+ },
626
+ "===": {
627
+ comparator: "equals",
628
+ negated: false,
629
+ strict: true
630
+ },
631
+ "!=": {
632
+ comparator: "equals",
633
+ negated: true,
634
+ strict: false
635
+ },
636
+ "!==": {
637
+ comparator: "equals",
638
+ negated: true,
639
+ strict: true
640
+ },
641
+ ">": {
642
+ comparator: "greater-than",
643
+ negated: false,
644
+ strict: false
645
+ },
646
+ ">=": {
647
+ comparator: "greater-than-equals",
648
+ negated: false,
649
+ strict: false
650
+ },
651
+ "<": {
652
+ comparator: "less-than",
653
+ negated: false,
654
+ strict: false
655
+ },
656
+ "<=": {
657
+ comparator: "less-than-equals",
658
+ negated: false,
659
+ strict: false
660
+ }
661
+ };
662
+ const SWAPPED_COMPARATORS = {
663
+ "equals": "equals",
664
+ "greater-than": "less-than",
665
+ "greater-than-equals": "less-than-equals",
666
+ "less-than": "greater-than",
667
+ "less-than-equals": "greater-than-equals",
668
+ "starts-with": "starts-with",
669
+ "ends-with": "ends-with",
670
+ "includes": "includes"
671
+ };
672
+ // #endregion
673
+ // #region Param references
674
+ /**
675
+ * Placeholder for a parameter value inside a cached expression template. Never
676
+ * escapes this module — binding replaces it with a plain ValueExpression that
677
+ * holds the resolved value.
678
+ */ class ParamReferenceExpression extends _types__rspack_import_1/* .ValueExpression */.Ko {
679
+ /** Path into the params object, excluding the params root name. */ paramPath;
680
+ /** The property this value is compared against; drives serialization/conversion at bind time. */ pairedProperty;
681
+ /** Whether the paired property's type converter applies (equality/relational comparisons only). */ applyConverter;
682
+ constructor(options){
683
+ super({
684
+ value: undefined
685
+ });
686
+ this.paramPath = options.paramPath;
687
+ this.pairedProperty = options.pairedProperty;
688
+ this.applyConverter = options.applyConverter;
689
+ }
690
+ }
691
+ const resolveParamPath = (paramsName, path, data)=>{
692
+ let result = data;
693
+ for(let i = 0; i < path.length; i++){
694
+ const name = path[i];
695
+ if (result != null && typeof result === "object" && name in result) {
696
+ result = result[name];
697
+ continue;
698
+ }
699
+ throw new ParamDependentParseError(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND([
700
+ paramsName,
701
+ ...path
702
+ ].join("."), data));
703
+ }
704
+ return result;
705
+ };
706
+ /**
707
+ * Applies the paired property's value serializer and (optionally) its schema
708
+ * type converter, matching how literal values are treated at parse time.
709
+ */ const resolvePairedValue = (value, pairedProperty, applyConverter)=>{
710
+ if (pairedProperty == null) {
711
+ return value;
712
+ }
713
+ let result = value;
714
+ if (pairedProperty.valueSerializer != null) {
715
+ result = String(pairedProperty.valueSerializer(parseUnknown(result)));
716
+ }
717
+ if (applyConverter) {
718
+ result = converters[pairedProperty.type](result);
719
+ }
720
+ return result;
721
+ };
722
+ // #endregion
723
+ // #region Parser
724
+ /**
725
+ * Recursive descent parser over the token stream. Produces an expression
726
+ * template: literal values are fully resolved, parameter values are represented
727
+ * as ParamReferenceExpression placeholders so the template can be cached and
728
+ * re-bound with different params.
729
+ */ class ExpressionParser {
730
+ schema;
731
+ stream;
732
+ entityName;
733
+ paramsName;
734
+ params;
735
+ /** Set when a param value shaped the tree itself (e.g. x[p.name]) — such templates cannot be cached. */ structurallyDependsOnParams = false;
736
+ constructor(schema, stream, entityName, paramsName, params){
737
+ this.schema = schema;
738
+ this.stream = stream;
739
+ this.entityName = entityName;
740
+ this.paramsName = paramsName;
741
+ this.params = params;
742
+ }
743
+ parse() {
744
+ const expression = this.parseOr();
745
+ if (!this.stream.isAtEnd) {
746
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`unexpected token '${this.stream.peek()?.value}'`));
747
+ }
748
+ return expression;
749
+ }
750
+ // || binds loosest, so it sits at the root of the parse
751
+ parseOr() {
752
+ let left = this.parseAnd();
753
+ while(this.stream.matchPunctuation("||")){
754
+ const right = this.parseAnd();
755
+ // A tautology (`true`) absorbs the whole disjunction
756
+ if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(left) || _types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(right)) {
757
+ left = _types__rspack_import_1/* .Expression.EMPTY */.r4.EMPTY;
758
+ continue;
759
+ }
760
+ left = new _types__rspack_import_1/* .OperatorExpression */.fw({
761
+ operator: "||",
762
+ left,
763
+ right
764
+ });
765
+ }
766
+ return left;
767
+ }
768
+ parseAnd() {
769
+ let left = this.parseUnary();
770
+ while(this.stream.matchPunctuation("&&")){
771
+ const right = this.parseUnary();
772
+ // A tautology (`true`) is the identity of a conjunction
773
+ if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(left)) {
774
+ left = right;
775
+ continue;
776
+ }
777
+ if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(right)) {
778
+ continue;
779
+ }
780
+ left = new _types__rspack_import_1/* .OperatorExpression */.fw({
781
+ operator: "&&",
782
+ left,
783
+ right
784
+ });
785
+ }
786
+ return left;
787
+ }
788
+ parseUnary() {
789
+ if (this.stream.matchPunctuation("!")) {
790
+ return this.negateExpression(this.parseUnary());
791
+ }
792
+ return this.parseComparison();
793
+ }
794
+ /**
795
+ * Applies `!` to an already-parsed expression: comparators flip their
796
+ * negated flag, compound expressions distribute via De Morgan's laws.
797
+ */ negateExpression(expression) {
798
+ if (expression instanceof _types__rspack_import_1/* .ComparatorExpression */.bQ) {
799
+ expression.negated = !expression.negated;
800
+ return expression;
801
+ }
802
+ if (expression instanceof _types__rspack_import_1/* .OperatorExpression */.fw && expression.left != null && expression.right != null) {
803
+ return new _types__rspack_import_1/* .OperatorExpression */.fw({
804
+ operator: expression.operator === "&&" ? "||" : "&&",
805
+ left: this.negateExpression(expression.left),
806
+ right: this.negateExpression(expression.right)
807
+ });
808
+ }
809
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("'!' on this expression"));
810
+ }
811
+ parseComparison() {
812
+ // Parenthesized group
813
+ if (this.stream.matchPunctuation("(")) {
814
+ const expression = this.parseOr();
815
+ this.stream.expectPunctuation(")");
816
+ const trailing = this.stream.peek();
817
+ if (trailing != null && trailing.kind === "punctuation" && COMPARISON_OPERATORS[trailing.value] != null) {
818
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("comparison against a parenthesized expression"));
819
+ }
820
+ return expression;
821
+ }
822
+ const left = this.parseOperand();
823
+ const operatorToken = this.stream.peek();
824
+ if (operatorToken != null && operatorToken.kind === "punctuation" && COMPARISON_OPERATORS[operatorToken.value] != null) {
825
+ this.stream.next();
826
+ const right = this.parseOperand();
827
+ return this.buildComparison(left, COMPARISON_OPERATORS[operatorToken.value], right);
828
+ }
829
+ return this.buildStandalone(left);
830
+ }
831
+ parseOperand() {
832
+ const token = this.stream.peek();
833
+ if (token == null) {
834
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("unexpected end of expression"));
835
+ }
836
+ if (token.kind === "string") {
837
+ this.stream.next();
838
+ return this.withValueTransformer({
839
+ kind: "value",
840
+ value: token.value,
841
+ transformer: null,
842
+ locale: null
843
+ });
844
+ }
845
+ if (token.kind === "number") {
846
+ this.stream.next();
847
+ return {
848
+ kind: "value",
849
+ value: Number(token.value),
850
+ transformer: null,
851
+ locale: null
852
+ };
853
+ }
854
+ if (token.kind === "punctuation" && token.value === "-") {
855
+ this.stream.next();
856
+ const numberToken = this.stream.next();
857
+ if (numberToken.kind !== "number") {
858
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("unary '-' on a non-number"));
859
+ }
860
+ return {
861
+ kind: "value",
862
+ value: -Number(numberToken.value),
863
+ transformer: null,
864
+ locale: null
865
+ };
866
+ }
867
+ if (token.kind === "punctuation" && token.value === "[") {
868
+ return this.parseArrayLiteralOperand();
869
+ }
870
+ if (token.kind === "identifier") {
871
+ return this.parseIdentifierOperand();
872
+ }
873
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(String(token.value)));
874
+ }
875
+ /**
876
+ * Parses an inline array of literals, e.g. `["active", "pending"]`, and the
877
+ * membership test that follows it: `[...].includes(entity.property)`.
878
+ */ parseArrayLiteralOperand() {
879
+ this.stream.expectPunctuation("[");
880
+ const elements = [];
881
+ while(!this.stream.isPunctuation("]")){
882
+ const element = this.parseOperand();
883
+ if (element.kind !== "value" || element.transformer != null) {
884
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("a non-literal element in an array literal"));
885
+ }
886
+ elements.push(element.value);
887
+ if (!this.stream.matchPunctuation(",")) {
888
+ break;
889
+ }
890
+ }
891
+ this.stream.expectPunctuation("]");
892
+ const array = {
893
+ kind: "value",
894
+ value: elements,
895
+ transformer: null,
896
+ locale: null
897
+ };
898
+ // The only supported use is a membership test on a schema property
899
+ if (this.stream.isPunctuation(".") || this.stream.isPunctuation("?.")) {
900
+ this.stream.next();
901
+ const method = this.stream.next();
902
+ if (method.kind !== "identifier" || method.value !== "includes") {
903
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'.${method.value}' on an array literal`));
904
+ }
905
+ this.stream.expectPunctuation("(");
906
+ const argument = this.parseOperand();
907
+ this.stream.expectPunctuation(")");
908
+ if (argument.kind === "method-call") {
909
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("nested method call inside .includes()"));
910
+ }
911
+ return {
912
+ kind: "method-call",
913
+ target: array,
914
+ method: "includes",
915
+ argument
916
+ };
917
+ }
918
+ return array;
919
+ }
920
+ parseIdentifierOperand() {
921
+ const root = this.stream.next().value;
922
+ // Keyword literals
923
+ if (root === "true" || root === "false") {
924
+ return {
925
+ kind: "value",
926
+ value: root === "true",
927
+ transformer: null,
928
+ locale: null
929
+ };
930
+ }
931
+ if (root === "null") {
932
+ return {
933
+ kind: "value",
934
+ value: null,
935
+ transformer: null,
936
+ locale: null
937
+ };
938
+ }
939
+ if (root === "undefined") {
940
+ return {
941
+ kind: "value",
942
+ value: undefined,
943
+ transformer: null,
944
+ locale: null
945
+ };
946
+ }
947
+ if (root === "void") {
948
+ this.stream.next(); // the '0'
949
+ return {
950
+ kind: "value",
951
+ value: undefined,
952
+ transformer: null,
953
+ locale: null
954
+ };
955
+ }
956
+ if (root === this.entityName) {
957
+ return this.parseChain({
958
+ kind: "property",
959
+ root
960
+ });
961
+ }
962
+ if (this.paramsName != null && root === this.paramsName) {
963
+ return this.parseChain({
964
+ kind: "param",
965
+ root
966
+ });
967
+ }
968
+ // A bare variable from the outer scope — its value cannot be derived from source text
969
+ throw new Error(ERROR_MESSAGES.VARIABLE_VALUE(root));
970
+ }
971
+ /**
972
+ * Parses the segments after an entity/params root: dot access, bracket
973
+ * access, transform methods and comparator methods.
974
+ */ parseChain(options) {
975
+ const path = [];
976
+ let transformer = null;
977
+ let locale = null;
978
+ while(true){
979
+ if (this.stream.matchPunctuation(".") || this.stream.matchPunctuation("?.")) {
980
+ const segment = this.stream.next();
981
+ if (segment.kind !== "identifier") {
982
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'.${segment.value}'`));
983
+ }
984
+ // Method call
985
+ if (this.stream.isPunctuation("(")) {
986
+ const method = segment.value;
987
+ if (TRANSFORM_METHODS[method] != null) {
988
+ this.stream.expectPunctuation("(");
989
+ this.stream.expectPunctuation(")");
990
+ transformer = TRANSFORM_METHODS[method].transformer;
991
+ locale = TRANSFORM_METHODS[method].locale;
992
+ continue;
993
+ }
994
+ if (COMPARATOR_METHODS[method] != null) {
995
+ this.stream.expectPunctuation("(");
996
+ const argument = this.parseOperand();
997
+ this.stream.expectPunctuation(")");
998
+ if (argument.kind === "method-call") {
999
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`nested method call inside .${method}()`));
1000
+ }
1001
+ return {
1002
+ kind: "method-call",
1003
+ target: this.resolveChain(options.kind, path, transformer, locale),
1004
+ method: method,
1005
+ argument
1006
+ };
1007
+ }
1008
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`method '.${method}()'`));
1009
+ }
1010
+ if (transformer != null) {
1011
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("property access after a transform method"));
1012
+ }
1013
+ path.push(segment.value);
1014
+ continue;
1015
+ }
1016
+ if (this.stream.matchPunctuation("[")) {
1017
+ path.push(this.parseBracketSegment(options.kind));
1018
+ this.stream.expectPunctuation("]");
1019
+ continue;
1020
+ }
1021
+ break;
1022
+ }
1023
+ return this.resolveChain(options.kind, path, transformer, locale);
1024
+ }
1025
+ parseBracketSegment(kind) {
1026
+ const token = this.stream.next();
1027
+ // Literal segment: entity["name"]
1028
+ if (token.kind === "string") {
1029
+ return token.value;
1030
+ }
1031
+ // Param-driven segment: entity[p.name] — the property depends on the
1032
+ // param VALUE, so the resulting template is tied to these params.
1033
+ // Stryker disable next-line all: documented equivalent cluster (see
1034
+ // docs/mutation-backlog.md) — every mutation of this four-conjunct guard reroutes
1035
+ // bracket access between two paths that both collapse to NOT_PARSABLE; the
1036
+ // experiment recorded there aimed 30 tests at this line and killed none.
1037
+ if (kind === "property" && token.kind === "identifier" && this.paramsName != null && token.value === this.paramsName) {
1038
+ const paramPath = [];
1039
+ while(this.stream.matchPunctuation(".") || this.stream.matchPunctuation("?.")){
1040
+ paramPath.push(this.stream.next().value);
1041
+ }
1042
+ const resolved = resolveParamPath(this.paramsName, paramPath, this.params);
1043
+ if (typeof resolved !== "string") {
1044
+ throw new ParamDependentParseError(ERROR_MESSAGES.PROPERTY_NOT_FOUND(paramPath.join(".")));
1045
+ }
1046
+ this.structurallyDependsOnParams = true;
1047
+ return resolved;
1048
+ }
1049
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`bracket access '[${token.value}]'`));
1050
+ }
1051
+ resolveChain(kind, path, transformer, locale) {
1052
+ if (kind === "param") {
1053
+ if (path.length === 0) {
1054
+ // `params` alone is a variable, not a value we can resolve
1055
+ throw new Error(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND(this.paramsName ?? "params", this.params));
1056
+ }
1057
+ return {
1058
+ kind: "param",
1059
+ path,
1060
+ transformer,
1061
+ locale
1062
+ };
1063
+ }
1064
+ const pathString = path.join(".");
1065
+ const property = this.schema.properties.find((w)=>w.getAssignmentPath() == pathString);
1066
+ if (property == null) {
1067
+ // `.length` on a string/array property — a real schema property named
1068
+ // `length` wins (checked above); otherwise treat it as a transformer
1069
+ if (path.length > 1 && path[path.length - 1] === "length" && transformer == null) {
1070
+ const parentPath = path.slice(0, -1).join(".");
1071
+ const parent = this.schema.properties.find((w)=>w.getAssignmentPath() == parentPath);
1072
+ // Vector is deliberately absent. Its length is the dimension count declared
1073
+ // in the schema — a constant, not data — so a filter on it answers a question
1074
+ // nobody asks, and pushing it down would need `json_array_length` on a
1075
+ // backend storing JSON and something else entirely on one with a native
1076
+ // vector column. Not parsing it leaves a clear error instead of a dialect gap.
1077
+ if (parent != null && (parent.type === _schema__rspack_import_2/* .SchemaTypes.String */.L.String || parent.type === _schema__rspack_import_2/* .SchemaTypes.Array */.L.Array)) {
1078
+ return {
1079
+ kind: "property",
1080
+ property: parent,
1081
+ transformer: "length",
1082
+ locale: null
1083
+ };
1084
+ }
1085
+ }
1086
+ throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(pathString));
1087
+ }
1088
+ return {
1089
+ kind: "property",
1090
+ property,
1091
+ transformer,
1092
+ locale
1093
+ };
1094
+ }
1095
+ withValueTransformer(operand) {
1096
+ if (this.stream.isPunctuation(".")) {
1097
+ const method = this.stream.peek(1);
1098
+ // Stryker disable next-line all: documented equivalent cluster (see
1099
+ // docs/mutation-backlog.md) — the guard's conjuncts each route to a rejection that
1100
+ // collapses to NOT_PARSABLE with an indistinguishable message; 18 targeted tests
1101
+ // killed none of these.
1102
+ if (method != null && method.kind === "identifier" && TRANSFORM_METHODS[method.value] != null) {
1103
+ this.stream.next(); // .
1104
+ this.stream.next(); // method name
1105
+ this.stream.expectPunctuation("(");
1106
+ this.stream.expectPunctuation(")");
1107
+ operand.transformer = TRANSFORM_METHODS[method.value].transformer;
1108
+ operand.locale = TRANSFORM_METHODS[method.value].locale;
1109
+ }
1110
+ }
1111
+ return operand;
1112
+ }
1113
+ // #region Condition building
1114
+ buildComparison(left, operator, right) {
1115
+ // methodCall == true/false — fold the boolean into negation
1116
+ if (left.kind === "method-call") {
1117
+ if (operator.comparator === "equals" && right.kind === "value" && typeof right.value === "boolean") {
1118
+ const comparator = this.buildMethodComparator(left);
1119
+ const comparedToFalse = right.value === false;
1120
+ comparator.negated = comparator.negated !== (operator.negated !== comparedToFalse);
1121
+ return comparator;
1122
+ }
1123
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("comparing a method call to a non-boolean"));
1124
+ }
1125
+ if (right.kind === "method-call") {
1126
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("method call on the right side of a comparison"));
1127
+ }
1128
+ if (left.kind === "property" && right.kind === "property") {
1129
+ // Casing transformers are only valid with string-matching comparators,
1130
+ // which cannot produce a property-to-property comparison
1131
+ if (left.transformer === "to-lower-case" || left.transformer === "to-upper-case" || right.transformer === "to-lower-case" || right.transformer === "to-upper-case") {
1132
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("transform method outside of startsWith/endsWith/includes"));
1133
+ }
1134
+ return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
1135
+ comparator: operator.comparator,
1136
+ negated: operator.negated,
1137
+ strict: operator.strict,
1138
+ left: this.createPropertyExpression(left),
1139
+ right: this.createPropertyExpression(right)
1140
+ });
1141
+ }
1142
+ if (left.kind === "property" && right.kind !== "property") {
1143
+ return this.buildPropertyComparator(left, operator, right, /* applyConverter */ true);
1144
+ }
1145
+ if (right.kind === "property" && left.kind !== "property") {
1146
+ const swapped = {
1147
+ ...operator,
1148
+ comparator: SWAPPED_COMPARATORS[operator.comparator]
1149
+ };
1150
+ return this.buildPropertyComparator(right, swapped, left, /* applyConverter */ true);
1151
+ }
1152
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("comparison requires a schema property on at least one side"));
1153
+ }
1154
+ buildStandalone(operand) {
1155
+ if (operand.kind === "method-call") {
1156
+ return this.buildMethodComparator(operand);
1157
+ }
1158
+ if (operand.kind === "property") {
1159
+ // Truthy shorthand on `.length`: a length is truthy exactly when > 0
1160
+ if (operand.transformer === "length") {
1161
+ return this.buildPropertyComparator(operand, COMPARISON_OPERATORS[">"], {
1162
+ kind: "value",
1163
+ value: 0,
1164
+ transformer: null,
1165
+ locale: null
1166
+ }, /* applyConverter */ true);
1167
+ }
1168
+ // Truthy shorthand: `w.isActive` → isActive === true
1169
+ return this.buildPropertyComparator(operand, COMPARISON_OPERATORS["==="], {
1170
+ kind: "value",
1171
+ value: true,
1172
+ transformer: null,
1173
+ locale: null
1174
+ }, /* applyConverter */ true);
1175
+ }
1176
+ // Constant `true` — a tautology, which parseAnd/parseOr simplify away
1177
+ if (operand.kind === "value" && operand.value === true && operand.transformer == null) {
1178
+ return _types__rspack_import_1/* .Expression.EMPTY */.r4.EMPTY;
1179
+ }
1180
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("a filter condition must reference a schema property"));
1181
+ }
1182
+ buildMethodComparator(operand) {
1183
+ const { target, method, argument } = operand;
1184
+ if (target.kind === "property") {
1185
+ if (argument.kind === "property") {
1186
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`.${method}() comparing two schema properties`));
1187
+ }
1188
+ // Method arguments skip type conversion — only the value serializer applies
1189
+ return this.buildPropertyComparator(target, {
1190
+ comparator: COMPARATOR_METHODS[method],
1191
+ negated: false,
1192
+ strict: false
1193
+ }, argument, /* applyConverter */ false);
1194
+ }
1195
+ // ["a", "b"].includes(x.prop) / params.list.includes(x.prop) —
1196
+ // membership test with the collection on the left
1197
+ if (method === "includes" && argument.kind === "property") {
1198
+ if (target.transformer != null) {
1199
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("transform method on a collection used with .includes()"));
1200
+ }
1201
+ return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
1202
+ comparator: "includes",
1203
+ negated: false,
1204
+ strict: false,
1205
+ left: this.createValueExpression(target, argument.property, /* applyConverter */ false),
1206
+ right: this.createPropertyExpression(argument)
1207
+ });
1208
+ }
1209
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED(`.${method}() on a non-property target`));
1210
+ }
1211
+ buildPropertyComparator(property, operator, value, applyConverter) {
1212
+ const isStringMatch = operator.comparator === "starts-with" || operator.comparator === "ends-with" || operator.comparator === "includes";
1213
+ // `.length` compares a NUMBER, so the paired property's serializer and
1214
+ // type converter must not touch the value; and a length has no meaning
1215
+ // inside a string-matching comparator
1216
+ if (property.transformer === "length") {
1217
+ if (isStringMatch) {
1218
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("'.length' with startsWith/endsWith/includes"));
1219
+ }
1220
+ return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
1221
+ comparator: operator.comparator,
1222
+ negated: operator.negated,
1223
+ strict: operator.strict,
1224
+ left: this.createPropertyExpression(property),
1225
+ right: this.createValueExpression(value, null, /* applyConverter */ false)
1226
+ });
1227
+ }
1228
+ // Casing transformers on a property are only meaningful with string-matching
1229
+ // comparators; on relational comparators the plugins would silently
1230
+ // ignore them and return wrong data
1231
+ if (property.transformer != null && !isStringMatch) {
1232
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("transform method outside of startsWith/endsWith/includes"));
1233
+ }
1234
+ return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
1235
+ comparator: operator.comparator,
1236
+ negated: operator.negated,
1237
+ strict: operator.strict,
1238
+ left: this.createPropertyExpression(property),
1239
+ right: this.createValueExpression(value, property.property, applyConverter)
1240
+ });
1241
+ }
1242
+ createPropertyExpression(operand) {
1243
+ const expression = new _types__rspack_import_1/* .PropertyExpression */.ep({
1244
+ property: operand.property
1245
+ });
1246
+ expression.transformer = operand.transformer;
1247
+ expression.locale = operand.locale;
1248
+ return expression;
1249
+ }
1250
+ createValueExpression(operand, pairedProperty, applyConverter) {
1251
+ if (operand.kind === "param") {
1252
+ const expression = new ParamReferenceExpression({
1253
+ paramPath: operand.path,
1254
+ pairedProperty,
1255
+ applyConverter
1256
+ });
1257
+ expression.transformer = operand.transformer;
1258
+ expression.locale = operand.locale;
1259
+ return expression;
1260
+ }
1261
+ const expression = new _types__rspack_import_1/* .ValueExpression */.Ko({
1262
+ value: resolvePairedValue(operand.value, pairedProperty, applyConverter)
1263
+ });
1264
+ expression.transformer = operand.transformer;
1265
+ expression.locale = operand.locale;
1266
+ return expression;
1267
+ }
1268
+ }
1269
+ // #endregion
1270
+ // #region Template binding
1271
+ /**
1272
+ * Deep-clones a template into a consumer-facing tree, resolving parameter
1273
+ * placeholders against the supplied params. Always clones so cached templates
1274
+ * can never be mutated by consumers.
1275
+ */ const bindExpression = (expression, paramsName, params)=>{
1276
+ if (expression instanceof ParamReferenceExpression) {
1277
+ const raw = resolveParamPath(paramsName ?? "params", expression.paramPath, params);
1278
+ const bound = new _types__rspack_import_1/* .ValueExpression */.Ko({
1279
+ value: resolvePairedValue(raw, expression.pairedProperty, expression.applyConverter)
1280
+ });
1281
+ bound.transformer = expression.transformer;
1282
+ bound.locale = expression.locale;
1283
+ return bound;
1284
+ }
1285
+ if (expression instanceof _types__rspack_import_1/* .ValueExpression */.Ko) {
1286
+ const clone = new _types__rspack_import_1/* .ValueExpression */.Ko({
1287
+ value: expression.value
1288
+ });
1289
+ clone.transformer = expression.transformer;
1290
+ clone.locale = expression.locale;
1291
+ return clone;
1292
+ }
1293
+ if (expression instanceof _types__rspack_import_1/* .PropertyExpression */.ep) {
1294
+ const clone = new _types__rspack_import_1/* .PropertyExpression */.ep({
1295
+ property: expression.property
1296
+ });
1297
+ clone.transformer = expression.transformer;
1298
+ clone.locale = expression.locale;
1299
+ return clone;
1300
+ }
1301
+ if (expression instanceof _types__rspack_import_1/* .ComparatorExpression */.bQ) {
1302
+ return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
1303
+ comparator: expression.comparator,
1304
+ negated: expression.negated,
1305
+ strict: expression.strict,
1306
+ left: expression.left ? bindExpression(expression.left, paramsName, params) : undefined,
1307
+ right: expression.right ? bindExpression(expression.right, paramsName, params) : undefined
1308
+ });
1309
+ }
1310
+ if (expression instanceof _types__rspack_import_1/* .OperatorExpression */.fw) {
1311
+ return new _types__rspack_import_1/* .OperatorExpression */.fw({
1312
+ operator: expression.operator,
1313
+ left: expression.left ? bindExpression(expression.left, paramsName, params) : undefined,
1314
+ right: expression.right ? bindExpression(expression.right, paramsName, params) : undefined
1315
+ });
1316
+ }
1317
+ return expression;
1318
+ };
1319
+ /**
1320
+ * Splits stringified filter source into parameter names and the expression
1321
+ * body, unwrapping single-return block bodies.
1322
+ */ const resolveFunctionShape = (stringifiedFunction, hasParams)=>{
1323
+ const source = stringifiedFunction.trim();
1324
+ let parameterNames;
1325
+ let body;
1326
+ // `function (x) { ... }` / `function name(x) { ... }` — what ES5-targeting
1327
+ // transpilers rewrite every arrow filter into
1328
+ const functionHead = /^function\b[^(]*\(/.exec(source);
1329
+ if (functionHead != null) {
1330
+ const parametersEnd = source.indexOf(")", functionHead[0].length);
1331
+ if (parametersEnd === -1) {
1332
+ throw new Error("Invalid Function");
1333
+ }
1334
+ parameterNames = source.slice(functionHead[0].length, parametersEnd).trim();
1335
+ body = source.slice(parametersEnd + 1).trim();
1336
+ } else {
1337
+ const arrowIndex = source.indexOf("=>");
1338
+ if (arrowIndex === -1) {
1339
+ throw new Error("Invalid Function");
1340
+ }
1341
+ parameterNames = source.substring(0, arrowIndex).trim();
1342
+ body = source.substring(arrowIndex + 2).trim();
1343
+ // Strip wrapping parens: (entity) or ([x, p])
1344
+ if (parameterNames.startsWith("(") && parameterNames.endsWith(")")) {
1345
+ parameterNames = parameterNames.slice(1, -1).trim();
1346
+ }
1347
+ }
1348
+ let entityName;
1349
+ let paramsName = null;
1350
+ if (parameterNames.startsWith("[") && parameterNames.endsWith("]")) {
1351
+ const destructured = parameterNames.slice(1, -1).split(",").map((w)=>w.trim());
1352
+ entityName = destructured[0];
1353
+ if (hasParams) {
1354
+ paramsName = destructured[1] ?? null;
1355
+ }
1356
+ } else {
1357
+ entityName = parameterNames;
1358
+ }
1359
+ if (entityName == null || entityName.length === 0) {
1360
+ throw new Error("Invalid Function");
1361
+ }
1362
+ // Unwrap a single-return block body: { return <expression>; }
1363
+ if (body.startsWith("{")) {
1364
+ const inner = body.slice(1, body.lastIndexOf("}")).trim();
1365
+ if (!inner.startsWith("return")) {
1366
+ throw new Error(ERROR_MESSAGES.UNSUPPORTED("block body without a single return statement"));
1367
+ }
1368
+ body = inner.slice("return".length).trim();
1369
+ if (body.endsWith(";")) {
1370
+ body = body.slice(0, -1).trim();
1371
+ }
1372
+ }
1373
+ return {
1374
+ entityName,
1375
+ paramsName,
1376
+ body
1377
+ };
1378
+ };
1379
+ // Keyed by schema instance so identical filter source on different schemas can
1380
+ // never collide; entries live only as long as the schema does
1381
+ const templateCache = new WeakMap();
1382
+ const MAX_CACHED_TEMPLATES_PER_SCHEMA = 1024;
1383
+ const getCachedTemplate = (schema, source)=>{
1384
+ return templateCache.get(schema)?.get(source) ?? null;
1385
+ };
1386
+ const setCachedTemplate = (schema, source, entry)=>{
1387
+ let bySource = templateCache.get(schema);
1388
+ if (bySource == null) {
1389
+ bySource = new Map();
1390
+ templateCache.set(schema, bySource);
1391
+ }
1392
+ // Filter source strings come from static code, so this cap should never be
1393
+ // hit in practice — it only guards against unbounded dynamic generation.
1394
+ // Stryker disable next-line all: the cap is a pure resource bound — every mutation of
1395
+ // it (never clear, always clear, off-by-one) parses identically and differs only in
1396
+ // memory growth, which no observable boundary can assert.
1397
+ if (bySource.size >= MAX_CACHED_TEMPLATES_PER_SCHEMA) {
1398
+ bySource.clear();
1399
+ }
1400
+ bySource.set(source, entry);
1401
+ };
1402
+ // #endregion
1403
+ const combineExpressions = (...expressions)=>{
1404
+ if (expressions.length === 0) {
1405
+ throw new Error("combineExpressions requires at least 1 expression");
1406
+ }
1407
+ if (expressions.length === 1) {
1408
+ return expressions[0];
1409
+ }
1410
+ // Start with the first expression
1411
+ let result = expressions[0];
1412
+ // Loop through remaining expressions and combine them
1413
+ for(let i = 1; i < expressions.length; i++){
1414
+ result = new _types__rspack_import_1/* .OperatorExpression */.fw({
1415
+ operator: "&&",
1416
+ left: result,
1417
+ right: expressions[i]
1418
+ });
1419
+ }
1420
+ return result;
1421
+ };
1422
+ /**
1423
+ * Parses an expression SOURCE FRAGMENT against one schema and one root name.
1424
+ *
1425
+ * `toExpression` starts from a function and works out its own roots. This starts from text, which
1426
+ * is what a caller has when it has split a larger predicate apart — `p.rank > 10` lifted out of
1427
+ * `([p, m]) => p.rank > 10 && m.won === true`.
1428
+ *
1429
+ * **A fragment naming anything other than `rootName` returns `NOT_PARSABLE`, and that is the
1430
+ * point.** It is how a caller discovers which side of a join a conjunct belongs to: parse it
1431
+ * against each side in turn, and exactly one succeeds for a single-side condition. A condition
1432
+ * spanning both fails against both, which is the correct answer — it cannot be pushed to either.
1433
+ *
1434
+ * No params: a fragment carrying a params reference has no bag to resolve it against here, so it
1435
+ * fails rather than binding to nothing.
1436
+ *
1437
+ * Deliberately NOT cached. The cache is keyed by function source, and a fragment is not a function
1438
+ * — two different lambdas can contain the same fragment text against different schemas.
1439
+ */ const parseFragment = (schema, body, rootName)=>{
1440
+ try {
1441
+ const stream = new TokenStream(tokenize(body));
1442
+ const parser = new ExpressionParser(schema, stream, rootName, null, undefined);
1443
+ return parser.parse();
1444
+ } catch {
1445
+ // The failure is expected and informative — see above — so it is not logged. A caller that
1446
+ // parses one conjunct against two schemas would otherwise warn on every successful split.
1447
+ return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
1448
+ }
1449
+ };
1450
+ const toExpression = (schema, fn, params)=>{
1451
+ const stringifiedFunction = fn.toString();
1452
+ const warn = (error)=>_utilities__rspack_import_3/* .logger.warn */.vF.warn("Error parsing expression", {
1453
+ error,
1454
+ collectionName: schema.collectionName,
1455
+ params,
1456
+ selector: stringifiedFunction
1457
+ });
1458
+ const cached = getCachedTemplate(schema, stringifiedFunction);
1459
+ if (cached != null) {
1460
+ // A cached failure — the warning was already logged when it was discovered
1461
+ if (_types__rspack_import_1/* .Expression.isNotParsable */.r4.isNotParsable(cached.template)) {
1462
+ return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
1463
+ }
1464
+ try {
1465
+ return bindExpression(cached.template, cached.paramsName, params);
1466
+ } catch (error) {
1467
+ // Binding failures are param-dependent by nature — never cached
1468
+ warn(error);
1469
+ return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
1470
+ }
1471
+ }
1472
+ let paramsName = null;
1473
+ let template;
1474
+ let structurallyDependsOnParams;
1475
+ try {
1476
+ const shape = resolveFunctionShape(stringifiedFunction, params != null);
1477
+ const stream = new TokenStream(tokenize(shape.body));
1478
+ const parser = new ExpressionParser(schema, stream, shape.entityName, shape.paramsName, params);
1479
+ paramsName = shape.paramsName;
1480
+ template = parser.parse();
1481
+ structurallyDependsOnParams = parser.structurallyDependsOnParams;
1482
+ } catch (error) {
1483
+ // Cache the failure so a hot query on an unsupported filter doesn't
1484
+ // re-parse and re-warn on every execution. Param-dependent failures are
1485
+ // exempt: the same source can succeed with different params.
1486
+ if (!(error instanceof ParamDependentParseError)) {
1487
+ setCachedTemplate(schema, stringifiedFunction, {
1488
+ template: _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE,
1489
+ paramsName: null
1490
+ });
1491
+ }
1492
+ warn(error);
1493
+ return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
1494
+ }
1495
+ // Templates whose structure was resolved from param values are only
1496
+ // valid for this exact params object — parse those fresh every time
1497
+ if (!structurallyDependsOnParams) {
1498
+ setCachedTemplate(schema, stringifiedFunction, {
1499
+ template,
1500
+ paramsName
1501
+ });
1502
+ }
1503
+ try {
1504
+ return bindExpression(template, paramsName, params);
1505
+ } catch (error) {
1506
+ warn(error);
1507
+ return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
1508
+ }
1509
+ };
1510
+
1511
+
1512
+ },
1513
+ 27(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1514
+ __webpack_require__.d(__webpack_exports__, {
1515
+ Ko: () => (ValueExpression),
1516
+ SC: () => (NotParsableExpression),
1517
+ Sm: () => (EmptyExpression),
1518
+ bQ: () => (ComparatorExpression),
1519
+ ep: () => (PropertyExpression),
1520
+ fw: () => (OperatorExpression),
1521
+ r4: () => (Expression)
1522
+ });
1523
+ const valueToJson = (value)=>{
1524
+ if (value === undefined) {
1525
+ return {
1526
+ k: "undefined"
1527
+ };
1528
+ }
1529
+ if (value === null) {
1530
+ return {
1531
+ k: "raw",
1532
+ v: null
1533
+ };
1534
+ }
1535
+ if (value instanceof Date) {
1536
+ // ISO rather than epoch millis: it survives a human reading the payload, and an invalid
1537
+ // Date has no ISO form — so it is caught here rather than becoming a silent `null`.
1538
+ return {
1539
+ k: "date",
1540
+ v: value.toISOString()
1541
+ };
1542
+ }
1543
+ if (Array.isArray(value)) {
1544
+ return {
1545
+ k: "array",
1546
+ v: value.map(valueToJson)
1547
+ };
1548
+ }
1549
+ if (typeof value === "number" && Number.isFinite(value) === false) {
1550
+ // `JSON.stringify` turns all three of these into `null`, which would compare as a different
1551
+ // value entirely rather than failing.
1552
+ return {
1553
+ k: "number",
1554
+ v: Number.isNaN(value) ? "NaN" : value > 0 ? "Infinity" : "-Infinity"
1555
+ };
1556
+ }
1557
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
1558
+ return {
1559
+ k: "raw",
1560
+ v: value
1561
+ };
1562
+ }
1563
+ throw new Error(`Cannot serialize this filter value: only strings, numbers, booleans, null, undefined, Dates and arrays of those can cross a wire. ` + `Received: ${Object.prototype.toString.call(value)}`);
1564
+ };
1565
+ const valueFromJson = (value)=>{
1566
+ if (value.k === "undefined") {
1567
+ return undefined;
1568
+ }
1569
+ if (value.k === "date") {
1570
+ return new Date(value.v);
1571
+ }
1572
+ if (value.k === "array") {
1573
+ return value.v.map(valueFromJson);
1574
+ }
1575
+ if (value.k === "number") {
1576
+ return value.v === "NaN" ? Number.NaN : value.v === "Infinity" ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
1577
+ }
1578
+ return value.v;
1579
+ };
1580
+ /**
1581
+ * The base class for all expression types.
1582
+ */ class Expression {
1583
+ /** The left-hand side of the expression (if applicable). */ left;
1584
+ /** The right-hand side of the expression (if applicable). */ right;
1585
+ constructor(left, right){
1586
+ this.left = left;
1587
+ this.right = right;
1588
+ }
1589
+ static get EMPTY() {
1590
+ return new EmptyExpression();
1591
+ }
1592
+ static get NOT_PARSABLE() {
1593
+ return new NotParsableExpression();
1594
+ }
1595
+ static isEmpty(expression) {
1596
+ return expression.type === "empty" || expression instanceof EmptyExpression;
1597
+ }
1598
+ static isNotParsable(expression) {
1599
+ return expression.type === "not-parsable" || expression instanceof NotParsableExpression;
1600
+ }
1601
+ /**
1602
+ * Turns a tree into plain JSON, so a whole query can cross a wire.
1603
+ *
1604
+ * On the class rather than beside it, because this is the type's own REPRESENTATION — there is one
1605
+ * right answer and it belongs with the thing being represented, next to `EMPTY` and `isEmpty`.
1606
+ * Rendering a tree into some other language (`toSql`, `toMql`, `evaluate`) is a different kind of
1607
+ * thing: there are many, each belongs to its consumer, and none of them is canonical.
1608
+ *
1609
+ * ## Why it is this small
1610
+ *
1611
+ * Of the six node types a bound tree can contain, exactly one holds anything JSON cannot carry:
1612
+ * `PropertyExpression`, whose live `PropertyInfo` has functions, a parent chain and caches. It
1613
+ * reduces to a property PATH — `PropertyInfo.id` IS the dotted path, and `getProperty` is keyed by
1614
+ * exactly that — so rebinding is one lookup.
1615
+ *
1616
+ * `ParamReferenceExpression` never appears: it is a parse-time placeholder that binding replaces
1617
+ * with a plain `ValueExpression` holding the resolved value. A serialized tree is always already
1618
+ * bound, so there is no params object to send alongside it.
1619
+ *
1620
+ * Switches on `type` rather than using the `isXExpression` guards, which live in `../assertions`
1621
+ * and import this module — the guards test the same discriminant, so nothing is lost.
1622
+ */ static toJson(expression) {
1623
+ if (expression.type === "operator") {
1624
+ const operator = expression;
1625
+ return {
1626
+ t: "operator",
1627
+ operator: operator.operator,
1628
+ ...operator.left != null && {
1629
+ left: Expression.toJson(operator.left)
1630
+ },
1631
+ ...operator.right != null && {
1632
+ right: Expression.toJson(operator.right)
1633
+ }
1634
+ };
1635
+ }
1636
+ if (expression.type === "comparator") {
1637
+ const comparator = expression;
1638
+ return {
1639
+ t: "comparator",
1640
+ comparator: comparator.comparator,
1641
+ negated: comparator.negated,
1642
+ strict: comparator.strict,
1643
+ ...comparator.left != null && {
1644
+ left: Expression.toJson(comparator.left)
1645
+ },
1646
+ ...comparator.right != null && {
1647
+ right: Expression.toJson(comparator.right)
1648
+ }
1649
+ };
1650
+ }
1651
+ if (expression.type === "property") {
1652
+ const property = expression;
1653
+ return {
1654
+ t: "property",
1655
+ // The dotted path, which is exactly the key `getProperty` is looking up
1656
+ path: property.property.id,
1657
+ transformer: property.transformer,
1658
+ locale: property.locale
1659
+ };
1660
+ }
1661
+ if (expression.type === "value") {
1662
+ const value = expression;
1663
+ return {
1664
+ t: "value",
1665
+ value: valueToJson(value.value),
1666
+ transformer: value.transformer,
1667
+ locale: value.locale
1668
+ };
1669
+ }
1670
+ return expression.type === "empty" ? {
1671
+ t: "empty"
1672
+ } : {
1673
+ t: "not-parsable"
1674
+ };
1675
+ }
1676
+ /**
1677
+ * Rebuilds a tree from JSON, rebinding every property against `schema`.
1678
+ *
1679
+ * The schema is SUPPLIED rather than read out of the payload. A filter always belongs to a known
1680
+ * collection, and the RECEIVER's schema is the authority on what its properties are — taking an
1681
+ * id from the payload would mean rebinding against a schema the sender chose, which is backwards
1682
+ * for anything crossing a trust boundary.
1683
+ *
1684
+ * @throws when a property path is not declared by `schema`. Not `NOT_PARSABLE`: on a receiver, a
1685
+ * filter that silently stops filtering returns rows the requester excluded, which is the one
1686
+ * failure here worse than an error.
1687
+ */ static fromJson(json, schema) {
1688
+ const child = (node)=>node == null ? undefined : Expression.fromJson(node, schema);
1689
+ if (json.t === "operator") {
1690
+ return new OperatorExpression({
1691
+ operator: json.operator,
1692
+ left: child(json.left),
1693
+ right: child(json.right)
1694
+ });
1695
+ }
1696
+ if (json.t === "comparator") {
1697
+ return new ComparatorExpression({
1698
+ comparator: json.comparator,
1699
+ negated: json.negated,
1700
+ strict: json.strict,
1701
+ left: child(json.left),
1702
+ right: child(json.right)
1703
+ });
1704
+ }
1705
+ if (json.t === "property") {
1706
+ const property = schema.getProperty(json.path);
1707
+ if (property == null) {
1708
+ throw new Error(`Cannot deserialize a filter: this schema does not declare the property it names. ` + `Property: ${json.path}, Collection: ${schema.collectionName}. ` + `The two sides disagree about the shape of the data, so the filter cannot be applied.`);
1709
+ }
1710
+ const rebuilt = new PropertyExpression({
1711
+ property
1712
+ });
1713
+ rebuilt.transformer = json.transformer;
1714
+ rebuilt.locale = json.locale;
1715
+ return rebuilt;
1716
+ }
1717
+ if (json.t === "value") {
1718
+ const rebuilt = new ValueExpression({
1719
+ value: valueFromJson(json.value)
1720
+ });
1721
+ rebuilt.transformer = json.transformer;
1722
+ rebuilt.locale = json.locale;
1723
+ return rebuilt;
1724
+ }
1725
+ return json.t === "empty" ? Expression.EMPTY : Expression.NOT_PARSABLE;
1726
+ }
1727
+ }
1728
+ class EmptyExpression extends Expression {
1729
+ type = "empty";
1730
+ }
1731
+ class NotParsableExpression extends Expression {
1732
+ type = "not-parsable";
1733
+ }
1734
+ /**
1735
+ * A class representing a comparison operation (e.g., equals, greater-than).
1736
+ */ class ComparatorExpression extends Expression {
1737
+ /** The type of the expression (always 'comparator'). */ type = "comparator";
1738
+ /** The comparator operation (e.g., equals, greater-than). */ comparator;
1739
+ /** Whether the comparison is negated (e.g., not equals). */ negated;
1740
+ /** Whether the comparison is strict (type-sensitive). */ strict;
1741
+ constructor(options){
1742
+ super(options.left, options.right);
1743
+ this.comparator = options.comparator;
1744
+ this.negated = options.negated;
1745
+ this.strict = options.strict;
1746
+ }
1747
+ }
1748
+ /**
1749
+ * A class representing a logical operator (e.g., &&, ||).
1750
+ */ class OperatorExpression extends Expression {
1751
+ /** The type of the expression (always 'operator'). */ type = "operator";
1752
+ /** The logical operator. */ operator;
1753
+ constructor(options){
1754
+ super(options.left, options.right);
1755
+ this.operator = options.operator;
1756
+ }
1757
+ }
1758
+ /**
1759
+ * A class representing a property path.
1760
+ */ class PropertyExpression extends Expression {
1761
+ /** The type of the expression (always 'property'). */ type = "property";
1762
+ /** The property info for the path. */ property;
1763
+ transformer = null;
1764
+ locale = null;
1765
+ constructor(options){
1766
+ super();
1767
+ this.property = options.property;
1768
+ }
1769
+ }
1770
+ /**
1771
+ * A class representing a literal value.
1772
+ */ class ValueExpression extends Expression {
1773
+ /** The type of the expression (always 'value'). */ type = "value";
1774
+ /** The literal value. */ value;
1775
+ transformer = null;
1776
+ locale = null;
1777
+ constructor(options){
1778
+ super();
1779
+ this.value = options.value;
1780
+ }
1781
+ }
1782
+
1783
+
1784
+ },
1785
+ 63(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1786
+ __webpack_require__.d(__webpack_exports__, {
1787
+ j: () => (forEach),
1788
+ o: () => (getProperties)
1789
+ });
1790
+ /**
1791
+ * Extracts all properties referenced in an expression
1792
+ * @param expression The expression to analyze
1793
+ * @returns Array of PropertyInfo objects referenced in the expression
1794
+ */ function getProperties(expression) {
1795
+ const properties = [];
1796
+ function traverse(expr) {
1797
+ // If this is a property expression, add it to our collection
1798
+ if (expr.type === "property") {
1799
+ properties.push(expr.property);
1800
+ }
1801
+ // Traverse left and right expressions if they exist
1802
+ if (expr.left) {
1803
+ traverse(expr.left);
1804
+ }
1805
+ if (expr.right) {
1806
+ traverse(expr.right);
1807
+ }
1808
+ }
1809
+ traverse(expression);
1810
+ return properties;
1811
+ }
1812
+ function forEach(expression, callback) {
1813
+ function traverse(expr) {
1814
+ // Call the callback for this expression
1815
+ // If callback returns false, stop traversing
1816
+ if (!callback(expr)) {
1817
+ return false;
1818
+ }
1819
+ // Traverse left and right expressions if they exist
1820
+ if (expr.left) {
1821
+ if (!traverse(expr.left)) {
1822
+ return false;
1823
+ }
1824
+ }
1825
+ if (expr.right) {
1826
+ if (!traverse(expr.right)) {
1827
+ return false;
1828
+ }
1829
+ }
1830
+ return true;
1831
+ }
1832
+ traverse(expression);
1833
+ }
1834
+
1835
+
1836
+ },
1837
+ 537(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1838
+ __webpack_require__.d(__webpack_exports__, {
1839
+ L: () => (SchemaTypes)
1840
+ });
1841
+ var SchemaTypes = /*#__PURE__*/ function(SchemaTypes) {
1842
+ SchemaTypes["Array"] = "Array";
1843
+ SchemaTypes["Boolean"] = "Boolean";
1844
+ SchemaTypes["Date"] = "Date";
1845
+ SchemaTypes["Number"] = "Number";
1846
+ SchemaTypes["Object"] = "Object";
1847
+ SchemaTypes["String"] = "String";
1848
+ SchemaTypes["Definition"] = "Definition";
1849
+ SchemaTypes["Function"] = "Function";
1850
+ SchemaTypes["Computed"] = "Computed";
1851
+ /**
1852
+ * Content in, reference out. The only type whose write shape differs from its stored
1853
+ * shape, and a leaf on purpose — see `SchemaFile`.
1854
+ */ SchemaTypes["File"] = "File";
1855
+ /**
1856
+ * A fixed-length list of numbers, carrying its dimension count — see `SchemaVector`.
1857
+ *
1858
+ * Value-shaped exactly like `s.array(s.number())`, which is why every array codegen
1859
+ * handler accepts it. It is a distinct type only so a backend can recognise it and store
1860
+ * it natively; nothing else needs to tell the two apart.
1861
+ */ SchemaTypes["Vector"] = "Vector";
1862
+ return SchemaTypes;
1863
+ }({});
1864
+ var HashType = /*#__PURE__*/ (/* unused pure expression or super */ null && (function(HashType) {
1865
+ HashType["Ids"] = "Ids";
1866
+ HashType["Object"] = "Object";
1867
+ return HashType;
1868
+ }({})));
1869
+
1870
+
1871
+ },
1872
+ 581(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1873
+ __webpack_require__.d(__webpack_exports__, {
1874
+ vF: () => (logger)
1875
+ });
1876
+ /**
1877
+ * Levelled logging, resolved once.
1878
+ *
1879
+ * Three things about the previous implementation drove this shape:
1880
+ *
1881
+ * - **There was no way to turn logging off.** `globalThis.__ROUTIER_DEBUG__` was only ever
1882
+ * compared against `true`, so setting it to `false` did nothing — while
1883
+ * `docs/how-to/debug-logging.md` documented exactly that as the way to force logging off.
1884
+ * A documented switch that silently does nothing is worse than no switch.
1885
+ * - **`NODE_ENV === 'test'` enabled it.** Every Jest run therefore logged, because Jest always
1886
+ * sets `NODE_ENV=test`. Measured on the S7 stress scenario, which drives ~2,000 saves through
1887
+ * a plugin that logs three lines per query: 12.4s with logging, ~6s without. Test runners also
1888
+ * capture console output by snapshotting a stack trace per call, so the cost is far above what
1889
+ * writing to a terminal would suggest — and the output buries whatever the failure was.
1890
+ * - **It was all-or-nothing, and re-resolved per call.** An error could not be kept while debug
1891
+ * was dropped, and every one of the ~97 call sites re-read `globalThis` and `process.env`.
1892
+ *
1893
+ * Levels are compared numerically against a value cached at module load. Measured against a
1894
+ * no-op console at 200k calls: an enabled call costs ~70ns, a call rejected by the gate ~3ns.
1895
+ * Building the arguments the call site passes in accounts for ~0.2ns of that 3ns, which is why
1896
+ * this keeps the ordinary `logger.debug(msg, payload)` signature instead of taking a thunk —
1897
+ * a lazy API would recover 0.3% of an enabled call's cost and would have to change every call
1898
+ * site to do it.
1899
+ */ /** Ordered from most severe to most verbose. `silent` discards everything. */ const LOG_LEVELS = [
1900
+ 'silent',
1901
+ 'error',
1902
+ 'warn',
1903
+ 'info',
1904
+ 'debug'
1905
+ ];
1906
+ /** Numeric rank, so a gate is one integer comparison. */ const RANK = {
1907
+ silent: 0,
1908
+ error: 1,
1909
+ warn: 2,
1910
+ info: 3,
1911
+ debug: 4
1912
+ };
1913
+ const isLogLevel = (value)=>typeof value === 'string' && LOG_LEVELS.includes(value);
1914
+ /**
1915
+ * Resolves the configured level, in precedence order.
1916
+ *
1917
+ * Ordered most specific first: an explicit level beats a boolean flag, a boolean flag beats an
1918
+ * environment variable, and an environment variable beats an inference from `NODE_ENV`. Anything
1919
+ * unrecognised is ignored rather than treated as an error — a typo'd level should not take down
1920
+ * an application, and `silent` is the safe direction to fall back to.
1921
+ */ const resolveLevel = ()=>{
1922
+ if (typeof globalThis !== 'undefined') {
1923
+ const g = globalThis;
1924
+ if (isLogLevel(g.__ROUTIER_LOG_LEVEL__)) {
1925
+ return g.__ROUTIER_LOG_LEVEL__;
1926
+ }
1927
+ // Both directions honoured. `=== false` used to fall through to the NODE_ENV checks
1928
+ // below and re-enable the logging it was asked to suppress.
1929
+ if (g.__ROUTIER_DEBUG__ === true) return 'debug';
1930
+ if (g.__ROUTIER_DEBUG__ === false) return 'silent';
1931
+ }
1932
+ // There is deliberately no `import.meta.env` branch, although the documentation used to
1933
+ // promise one. It could never work: this package is bundled with rspack, which replaces
1934
+ // `import.meta` with `undefined`, so the check would read the *library's* build-time
1935
+ // environment rather than the application's — and referencing `import.meta` at all is a parse
1936
+ // error under a CommonJS build target, which is how the test suite loads this file. Vite and
1937
+ // similar apps set `__ROUTIER_LOG_LEVEL__` or `__ROUTIER_DEBUG__` from their own
1938
+ // `import.meta.env`, which is what the docs now describe.
1939
+ if (typeof process !== 'undefined' && process.env != null) {
1940
+ if (isLogLevel(process.env.ROUTIER_LOG_LEVEL)) {
1941
+ return process.env.ROUTIER_LOG_LEVEL;
1942
+ }
1943
+ const debug = process.env.DEBUG;
1944
+ if (debug === 'routier' || debug === '*') return 'debug';
1945
+ const env = "production"?.toLowerCase();
1946
+ // `test` is deliberately absent. It used to be here, which meant no test suite anywhere
1947
+ // could run Routier quietly. Opt in with DEBUG=routier or ROUTIER_LOG_LEVEL when a test
1948
+ // needs the output.
1949
+ if (env === 'dev' || env === 'development') return 'debug';
1950
+ }
1951
+ return 'silent';
1952
+ };
1953
+ let level = resolveLevel();
1954
+ let rank = RANK[level];
1955
+ /**
1956
+ * Overrides the level for the rest of the process.
1957
+ *
1958
+ * The configuration above is read once, at import, which is what makes the gate cheap — but it
1959
+ * also means an application that decides its verbosity after startup, or a test that wants to
1960
+ * assert on output, has no way in. This is that way in.
1961
+ */ const setLogLevel = (next)=>{
1962
+ if (isLogLevel(next) === false) {
1963
+ throw new Error(`Unknown log level "${next}". Expected one of: ${LOG_LEVELS.join(', ')}`);
1964
+ }
1965
+ level = next;
1966
+ rank = RANK[next];
1967
+ };
1968
+ const getLogLevel = ()=>level;
1969
+ /** Re-reads the environment. For tests that change it after this module was imported. */ const resetLogLevel = ()=>{
1970
+ level = resolveLevel();
1971
+ rank = RANK[level];
1972
+ };
1973
+ /**
1974
+ * Whether a message at this level would be emitted.
1975
+ *
1976
+ * For the rare call site whose *arguments* are expensive to build — a serialization, a deep
1977
+ * clone, a join over a large collection. An ordinary payload object is not worth guarding; see
1978
+ * the measurement in the header.
1979
+ */ const isLogLevelEnabled = (at)=>rank >= RANK[at];
1980
+ const emit = (at, method, args)=>{
1981
+ if (rank < RANK[at]) {
1982
+ return;
1983
+ }
1984
+ // Resolved at call time rather than captured once: test harnesses and browser devtools both
1985
+ // replace console methods after modules have loaded, and a captured reference would keep
1986
+ // writing past the replacement.
1987
+ console[method](...args);
1988
+ };
1989
+ const logger = {
1990
+ /** General-purpose output. Carried at `info`, since `log` names a console method, not a level. */ log: (...args)=>emit('info', 'log', args),
1991
+ info: (...args)=>emit('info', 'info', args),
1992
+ warn: (...args)=>emit('warn', 'warn', args),
1993
+ error: (...args)=>emit('error', 'error', args),
1994
+ debug: (...args)=>emit('debug', 'debug', args),
1995
+ /** Diagnostic tabular output; verbose by nature, so it sits at `debug`. */ table: (...args)=>emit('debug', 'table', args)
1996
+ };
1997
+
1998
+
1999
+ },
2000
+
2001
+ });
2002
+ // The module cache
2003
+ var __webpack_module_cache__ = {};
2004
+
2005
+ // The require function
2006
+ function __webpack_require__(moduleId) {
2007
+
2008
+ // Check if module is in cache
2009
+ var cachedModule = __webpack_module_cache__[moduleId];
2010
+ if (cachedModule !== undefined) {
2011
+ return cachedModule.exports;
2012
+ }
2013
+ // Create a new module (and put it into the cache)
2014
+ var module = (__webpack_module_cache__[moduleId] = {
2015
+ exports: {}
2016
+ });
2017
+ // Execute the module function
2018
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2019
+
2020
+ // Return the exports of the module
2021
+ return module.exports;
2022
+
2023
+ }
2024
+
2025
+ // webpack/runtime/define_property_getters
2026
+ (() => {
2027
+ __webpack_require__.d = (exports, definition) => {
2028
+ for(var key in definition) {
2029
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2030
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2031
+ }
2032
+ }
2033
+ };
2034
+ })();
2035
+ // webpack/runtime/has_own_property
2036
+ (() => {
2037
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2038
+ })();
2039
+ // webpack/runtime/make_namespace_object
2040
+ (() => {
2041
+ // define __esModule on exports
2042
+ __webpack_require__.r = (exports) => {
2043
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2044
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2045
+ }
2046
+ Object.defineProperty(exports, '__esModule', { value: true });
2047
+ };
2048
+ })();
2049
+ var __webpack_exports__ = {};
2050
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
2051
+ (() => {
2052
+ __webpack_require__.r(__webpack_exports__);
2053
+ __webpack_require__.d(__webpack_exports__, {
2054
+ ComparatorExpression: () => (/* reexport safe */ _types__rspack_import_2.bQ),
2055
+ EXPRESSION_TYPES: () => (/* reexport safe */ _constants__rspack_import_4.t),
2056
+ EmptyExpression: () => (/* reexport safe */ _types__rspack_import_2.Sm),
2057
+ Expression: () => (/* reexport safe */ _types__rspack_import_2.r4),
2058
+ NotParsableExpression: () => (/* reexport safe */ _types__rspack_import_2.SC),
2059
+ OperatorExpression: () => (/* reexport safe */ _types__rspack_import_2.fw),
2060
+ PropertyExpression: () => (/* reexport safe */ _types__rspack_import_2.ep),
2061
+ ValueExpression: () => (/* reexport safe */ _types__rspack_import_2.Ko),
2062
+ combineExpressions: () => (/* reexport safe */ _parser__rspack_import_1.pg),
2063
+ evaluate: () => (/* reexport safe */ _evaluate__rspack_import_0._3),
2064
+ forEach: () => (/* reexport safe */ _utils__rspack_import_3.j),
2065
+ getProperties: () => (/* reexport safe */ _utils__rspack_import_3.o),
2066
+ parseFragment: () => (/* reexport safe */ _parser__rspack_import_1.oH),
2067
+ toExpression: () => (/* reexport safe */ _parser__rspack_import_1.MY),
2068
+ toPredicate: () => (/* reexport safe */ _evaluate__rspack_import_0.Vu),
2069
+ toStrictPredicate: () => (/* reexport safe */ _evaluate__rspack_import_0.wS)
2070
+ });
2071
+ /* import */ var _evaluate__rspack_import_0 = __webpack_require__(379);
2072
+ /* import */ var _parser__rspack_import_1 = __webpack_require__(91);
2073
+ /* import */ var _types__rspack_import_2 = __webpack_require__(27);
2074
+ /* import */ var _utils__rspack_import_3 = __webpack_require__(63);
2075
+ /* import */ var _constants__rspack_import_4 = __webpack_require__(835);
2076
+
2077
+
2078
+
2079
+
2080
+
2081
+
2082
+ })();
2083
+
2084
+ module.exports = __webpack_exports__;
2085
+ })()
2086
+ ;
2087
+ //# sourceMappingURL=index.cjs.map