@lightdash/cli 3.88.0 → 3.90.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.
|
@@ -130,6 +130,33 @@ A field's position in the YAML determines whether it goes in `.dimensions()` or
|
|
|
130
130
|
|
|
131
131
|
Use the **metric key name**, not the label. YAML `label: "Order Count"` → SDK field name is `order_count`.
|
|
132
132
|
|
|
133
|
+
### Field links — `urls`
|
|
134
|
+
|
|
135
|
+
A dimension or metric may declare `urls:` — link patterns for its values:
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
columns:
|
|
139
|
+
- name: account_number
|
|
140
|
+
meta:
|
|
141
|
+
dimension:
|
|
142
|
+
type: string
|
|
143
|
+
urls:
|
|
144
|
+
- label: Open account
|
|
145
|
+
url: "https://portal.example.com/accounts/${value.raw | url_encode }"
|
|
146
|
+
- label: Open owner
|
|
147
|
+
url: "https://portal.example.com/users/${row.accounts.owner_id.raw }"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**When a field you display declares `urls`, render its values as links built from those patterns** — in tables, underlying-data views, and anywhere the raw value is shown. Dashboards already do this; the app must match. Resolve placeholders yourself (simple substitution):
|
|
151
|
+
|
|
152
|
+
- `${value.raw}` / `${value.formatted}` — the cell's own raw/formatted value.
|
|
153
|
+
- `${row.<model>.<field>.raw}` (or `.formatted`) — another field in the same result row. **Add that field to the query** so it's present in the row.
|
|
154
|
+
- A `| url_encode` filter means URL-encode the substituted value (`encodeURIComponent`).
|
|
155
|
+
|
|
156
|
+
One pattern → the cell is a plain link (open in a new tab). Several → a primary link plus a menu, or a small dropdown. Skip the link for null/empty values. Never invent patterns for fields without `urls`.
|
|
157
|
+
|
|
158
|
+
**Links must look like links at rest, not only on hover**: underline them (e.g. `underline underline-offset-4`) and/or use a distinct link color that fits the app's theme, plus a hover state. A viewer should spot the clickable cells without mousing over the table.
|
|
159
|
+
|
|
133
160
|
### Joined table fields — dot notation
|
|
134
161
|
|
|
135
162
|
When a model has `joins`, the joined table's dimensions and metrics are available in your query. **Use dot notation** (`table.field`) to reference fields from joined tables:
|
|
@@ -638,6 +665,8 @@ Use `formatField` for cells so dates render `Jun 16, 2025` instead of `2025-06-1
|
|
|
638
665
|
|
|
639
666
|
For the action-menu label and clipboard copy on a cell, the same helper applies — pass `format` so the per-field server format wins for currency/percent.
|
|
640
667
|
|
|
668
|
+
**Before writing any table or value display, check each displayed field's model YAML for a `urls:` block.** A field with `urls` MUST render its values as links, not plain text — see [Field links — `urls`](#field-links--urls). This applies to joined-table fields too: `customers.first_name` queried through `orders` is defined in `customers.yml`, so check the joined model's file (the index marks models whose fields carry links with `urls=…`). This is not optional polish: dashboards render these links, and an app that drops them loses functionality the user already relies on.
|
|
669
|
+
|
|
641
670
|
### Filters
|
|
642
671
|
|
|
643
672
|
Use `.filters([...])` for dimension/WHERE filters and `.metricFilters([...])`
|
|
@@ -1283,6 +1312,7 @@ The action-menu example above shows typical `drillDown()` usage. For the full AP
|
|
|
1283
1312
|
| Mistake | Why it breaks | Fix |
|
|
1284
1313
|
|---|---|---|
|
|
1285
1314
|
| Guessing field names | API returns opaque errors | Read the dbt YAML first — always |
|
|
1315
|
+
| Rendering a `urls` field's values as plain text | Dashboards render those values as links; the app silently drops functionality the user relies on | Check every displayed field's model YAML — including joined models (`customers.first_name` lives in `customers.yml`) — for `urls:` and render links per [Field links — `urls`](#field-links--urls) |
|
|
1286
1316
|
| `.metrics()` on a pre-aggregated model | Re-aggregates already-aggregated values → wrong numbers | If `wins` is a dimension in the YAML, use `.dimensions(['wins'])` |
|
|
1287
1317
|
| `.metrics(['max_cumulative_points'])` instead of `.dimensions(['cumulative_points'])` | Aggregates per-row data into a single value — collapses line charts | Check YAML: is it under `columns[].name` (dimension) or `meta.metrics` (metric)? |
|
|
1288
1318
|
| Unused dimensions in `.dimensions()` | Changes GROUP BY → wrong numbers | Only include dimensions you render or require for sorting; hidden sort fields stay selected but can be omitted from the UI |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.90.0",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@actions/core": "1.11.1",
|
|
23
23
|
"@aws-sdk/credential-providers": "3.995.0",
|
|
24
24
|
"@casl/ability": "6.8.0",
|
|
25
|
-
"@lightdash/common": "3.
|
|
26
|
-
"@lightdash/warehouses": "3.
|
|
25
|
+
"@lightdash/common": "3.90.0",
|
|
26
|
+
"@lightdash/warehouses": "3.90.0",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|