@bonnard/cli 0.2.10 → 0.2.12
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 +166 -51
- package/dist/bin/api-B7cdKn9j.mjs +3 -0
- package/dist/bin/api-DqgY-30K.mjs +75 -0
- package/dist/bin/bon.mjs +243 -282
- package/dist/bin/{cubes-9rklhdAJ.mjs → cubes-BvtwNBUG.mjs} +1 -1
- package/dist/bin/local-BkK5XL7T.mjs +3 -0
- package/dist/bin/local-ByvuW3eV.mjs +149 -0
- package/dist/bin/project-Dj085D_B.mjs +27 -0
- package/dist/bin/{push-Bv9AFGc2.mjs → push-BOkUmRL8.mjs} +2 -1
- package/dist/bin/{validate-Bc8zGNw7.mjs → validate-C4W_Vto2.mjs} +1 -1
- package/dist/docs/topics/dashboards.examples.md +59 -76
- package/dist/docs/topics/dashboards.inputs.md +17 -23
- package/dist/docs/topics/dashboards.md +5 -7
- package/dist/docs/topics/dashboards.queries.md +17 -24
- package/dist/docs/topics/querying.sdk.md +3 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Each query fetches data from your semantic layer and makes it available to chart components. Queries use the same measures and dimensions defined in your cubes and views — field names stay consistent whether you're querying from a dashboard, MCP, or the API.
|
|
8
8
|
|
|
9
|
-
Query blocks have a unique name and map to a `QueryOptions` shape. Components reference them using `data={query_name}`.
|
|
9
|
+
Query blocks have a unique name and map to a `QueryOptions` shape. Components reference them using `data={query_name}`. All field names must be fully qualified with the cube or view name (e.g. `orders.count`, `orders.created_at`).
|
|
10
10
|
|
|
11
11
|
## Syntax
|
|
12
12
|
|
|
@@ -14,10 +14,9 @@ Query blocks use fenced code with the `query` language tag followed by a name:
|
|
|
14
14
|
|
|
15
15
|
````markdown
|
|
16
16
|
```query revenue_trend
|
|
17
|
-
|
|
18
|
-
measures: [total_revenue]
|
|
17
|
+
measures: [orders.total_revenue]
|
|
19
18
|
timeDimension:
|
|
20
|
-
dimension: created_at
|
|
19
|
+
dimension: orders.created_at
|
|
21
20
|
granularity: month
|
|
22
21
|
dateRange: [2025-01-01, 2025-12-31]
|
|
23
22
|
```
|
|
@@ -27,19 +26,18 @@ timeDimension:
|
|
|
27
26
|
|
|
28
27
|
| Property | Type | Required | Description |
|
|
29
28
|
|----------|------|----------|-------------|
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `dimensions` | string[] | No | Dimensions to group by (e.g. `[status, city]`) |
|
|
29
|
+
| `measures` | string[] | No | Fully qualified measures to aggregate (e.g. `[orders.count, orders.total_revenue]`) |
|
|
30
|
+
| `dimensions` | string[] | No | Fully qualified dimensions to group by (e.g. `[orders.status, orders.city]`) |
|
|
33
31
|
| `filters` | Filter[] | No | Row-level filters |
|
|
34
32
|
| `timeDimension` | object | No | Time-based grouping and date range |
|
|
35
|
-
| `orderBy` | object | No | Sort specification (e.g. `{total_revenue: desc}`) |
|
|
33
|
+
| `orderBy` | object | No | Sort specification (e.g. `{orders.total_revenue: desc}`) |
|
|
36
34
|
| `limit` | number | No | Maximum rows to return |
|
|
37
35
|
|
|
38
36
|
### timeDimension
|
|
39
37
|
|
|
40
38
|
| Property | Type | Required | Description |
|
|
41
39
|
|----------|------|----------|-------------|
|
|
42
|
-
| `dimension` | string | Yes |
|
|
40
|
+
| `dimension` | string | Yes | Fully qualified time dimension name (e.g. `orders.created_at`) |
|
|
43
41
|
| `granularity` | string | No | `day`, `week`, `month`, `quarter`, or `year` |
|
|
44
42
|
| `dateRange` | string[] | No | `[start, end]` in `YYYY-MM-DD` format |
|
|
45
43
|
|
|
@@ -59,8 +57,7 @@ Each filter is an object with:
|
|
|
59
57
|
|
|
60
58
|
````markdown
|
|
61
59
|
```query total_orders
|
|
62
|
-
|
|
63
|
-
measures: [count]
|
|
60
|
+
measures: [orders.count]
|
|
64
61
|
```
|
|
65
62
|
````
|
|
66
63
|
|
|
@@ -68,11 +65,10 @@ measures: [count]
|
|
|
68
65
|
|
|
69
66
|
````markdown
|
|
70
67
|
```query revenue_by_city
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
dimensions: [city]
|
|
68
|
+
measures: [orders.total_revenue]
|
|
69
|
+
dimensions: [orders.city]
|
|
74
70
|
orderBy:
|
|
75
|
-
total_revenue: desc
|
|
71
|
+
orders.total_revenue: desc
|
|
76
72
|
limit: 10
|
|
77
73
|
```
|
|
78
74
|
````
|
|
@@ -81,10 +77,9 @@ limit: 10
|
|
|
81
77
|
|
|
82
78
|
````markdown
|
|
83
79
|
```query monthly_revenue
|
|
84
|
-
|
|
85
|
-
measures: [total_revenue]
|
|
80
|
+
measures: [orders.total_revenue]
|
|
86
81
|
timeDimension:
|
|
87
|
-
dimension: created_at
|
|
82
|
+
dimension: orders.created_at
|
|
88
83
|
granularity: month
|
|
89
84
|
dateRange: [2025-01-01, 2025-12-31]
|
|
90
85
|
```
|
|
@@ -94,11 +89,10 @@ timeDimension:
|
|
|
94
89
|
|
|
95
90
|
````markdown
|
|
96
91
|
```query completed_orders
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
dimensions: [category]
|
|
92
|
+
measures: [orders.count, orders.total_revenue]
|
|
93
|
+
dimensions: [orders.category]
|
|
100
94
|
filters:
|
|
101
|
-
- dimension: status
|
|
95
|
+
- dimension: orders.status
|
|
102
96
|
operator: equals
|
|
103
97
|
values: [completed]
|
|
104
98
|
```
|
|
@@ -108,8 +102,7 @@ filters:
|
|
|
108
102
|
|
|
109
103
|
- Query names must be valid identifiers (letters, numbers, `_`, `$`)
|
|
110
104
|
- Query names must be unique within a dashboard
|
|
111
|
-
-
|
|
112
|
-
- Field names are unqualified (use `count` not `orders.count`) — the `cube` provides the context
|
|
105
|
+
- All field names must be fully qualified with the cube or view name (e.g. `orders.count`, not `count`)
|
|
113
106
|
- Components reference queries by name: `data={query_name}`
|
|
114
107
|
|
|
115
108
|
## See Also
|
|
@@ -18,11 +18,10 @@ const bonnard = createClient({
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const result = await bonnard.query({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
dimensions: ['status'],
|
|
21
|
+
measures: ['orders.revenue', 'orders.count'],
|
|
22
|
+
dimensions: ['orders.status'],
|
|
24
23
|
timeDimension: {
|
|
25
|
-
dimension: 'created_at',
|
|
24
|
+
dimension: 'orders.created_at',
|
|
26
25
|
granularity: 'month',
|
|
27
26
|
dateRange: ['2025-01-01', '2025-12-31'],
|
|
28
27
|
},
|