@sanity-labs/groq-wasm 1.2.7 → 1.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.
- package/README.md +14 -7
- package/package.json +1 -1
- package/wasm/groq_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -193,22 +193,29 @@ interface ParamReference {
|
|
|
193
193
|
|
|
194
194
|
## Lint Rules
|
|
195
195
|
|
|
196
|
-
The following rules are available
|
|
196
|
+
The following rules are available. They run on Rust groq-lint's IR. `join-in-filter`, `computed-value-in-filter`, `deep-pagination`, `deep-pagination-param`, `large-pages`, `non-literal-comparison`, `count-in-correlated-subquery` and `many-joins` are reimplemented in `rust/src/rules/` so their findings match the Content Lake query plan:
|
|
197
|
+
|
|
198
|
+
- Slices of one document's attribute array (`reviews[1500..1600]`) are not pagination.
|
|
199
|
+
- A correlated `count()` is only reported when its `^` condition is not `==` or `references()`, because those are batched into one index read.
|
|
200
|
+
- `dateTime("…")` is a literal, and `lower(^.name)` is a batch key.
|
|
201
|
+
- A join inside a filter over an attribute array in a projection is not reported. The suggested rewrite is `a._ref in *[b == "c"]._id`, which the index serves.
|
|
202
|
+
- Repeated joins on the same reference count once.
|
|
203
|
+
- `upper()`, `length()`, `round()`, `coalesce()`, `select()`, `string::split(...)[i]` and `defined(arr[i])` in a filter over documents are reported, because they are evaluated in memory.
|
|
197
204
|
|
|
198
205
|
| Rule ID | Severity | Description |
|
|
199
206
|
| ------------------------------ | -------- | ---------------------------------------------------- |
|
|
200
|
-
| `join-in-filter` | error | Dereference (->) inside
|
|
207
|
+
| `join-in-filter` | error | Dereference (->) inside a document filter |
|
|
201
208
|
| `join-to-get-id` | warning | Using -> to get \_id (use .\_ref instead) |
|
|
202
|
-
| `computed-value-in-filter` | error |
|
|
209
|
+
| `computed-value-in-filter` | error | Arithmetic or in-memory function in a dataset filter |
|
|
203
210
|
| `match-on-id` | info | Using match on \_id with wildcard |
|
|
204
211
|
| `order-on-expr` | error | Ordering on computed values |
|
|
205
|
-
| `deep-pagination` | warning |
|
|
206
|
-
| `large-pages` | warning | Fetching >100
|
|
212
|
+
| `deep-pagination` | warning | Document offset >= 1000 (`[1000...]`, `[5000]`) |
|
|
213
|
+
| `large-pages` | warning | Fetching >100 documents from index 0 |
|
|
207
214
|
| `non-literal-comparison` | error | Comparing two non-literal expressions |
|
|
208
|
-
| `count-in-correlated-subquery` | info | count() on
|
|
215
|
+
| `count-in-correlated-subquery` | info | count() on a subquery not batched on `^` |
|
|
209
216
|
| `very-large-query` | error | Query exceeds 10KB |
|
|
210
217
|
| `extremely-large-query` | error | Query exceeds 100KB |
|
|
211
|
-
| `many-joins` | warning | Query has >10
|
|
218
|
+
| `many-joins` | warning | Query has >10 distinct joins |
|
|
212
219
|
| `unlimited-query` | warning | Top-level query without a slice or element limit |
|
|
213
220
|
|
|
214
221
|
## Error Handling
|
package/package.json
CHANGED
package/wasm/groq_wasm_bg.wasm
CHANGED
|
Binary file
|