@ruleflow-ts/dsl-core 0.3.1 → 0.3.2
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.
- package/README.md +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ TypeScript interpreter for the Ruleflow DSL. It runs in isomorphic environments
|
|
|
16
16
|
- Regex utility: `regex_strip(prop, 're')`
|
|
17
17
|
- Unary: `abs(expr)`
|
|
18
18
|
- Geo: `geohash_encode`, `geohash_decode`, `distance`, `within_radius`
|
|
19
|
+
- List evaluation: `evalInList('listName', predicate)` — evaluate a predicate against each element in a stored list
|
|
19
20
|
- Actions: `action('name', { 'k': 'v' })` with params using properties (`{'id': user.id}`)
|
|
20
21
|
- Evaluation mode: `evaluation_mode multi_match` (or default `single_match`)
|
|
21
22
|
|
|
@@ -110,6 +111,34 @@ within_radius(37.7749, -122.4194, 37.7750, -122.4195, 1) = true
|
|
|
110
111
|
distance(geohash_encode(37.7749, -122.4194, 7), geohash_encode(37.7750, -122.4195, 7)) < 0.5
|
|
111
112
|
```
|
|
112
113
|
|
|
114
|
+
- evalInList (evaluate predicate against list elements):
|
|
115
|
+
|
|
116
|
+
```sql
|
|
117
|
+
# Basic: check if any element in 'blacklist' has field1 = 'test'
|
|
118
|
+
evalInList('blacklist', elem.field1 = 'test')
|
|
119
|
+
|
|
120
|
+
# Nested properties
|
|
121
|
+
evalInList('blacklist', elem.field1.field2 = 'value')
|
|
122
|
+
|
|
123
|
+
# Numeric comparison
|
|
124
|
+
evalInList('items', elem.price > 100)
|
|
125
|
+
|
|
126
|
+
# AND/OR conditions
|
|
127
|
+
evalInList('blacklist', elem.field1 = 'test' AND elem.field2 = 'value')
|
|
128
|
+
evalInList('blacklist', elem.field1 = 'test' OR elem.field1 = 'other')
|
|
129
|
+
|
|
130
|
+
# Access parent context (user.id from data, elem.field1 from list element)
|
|
131
|
+
evalInList('blacklist', elem.field1 = user.id)
|
|
132
|
+
|
|
133
|
+
# Math operations
|
|
134
|
+
evalInList('items', elem.quantity * elem.price > 1000)
|
|
135
|
+
|
|
136
|
+
# With date functions
|
|
137
|
+
evalInList('subscriptions', elem.email = user.email AND date(elem.endDate) >= date(now()))
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The predicate is evaluated for each element in the stored list. Returns `true` if **any** element matches (semantics similar to `any{}`).
|
|
141
|
+
|
|
113
142
|
- Multi-match mode:
|
|
114
143
|
|
|
115
144
|
```sql
|