@bonnard/cli 0.2.15 → 0.2.16

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.
@@ -1,112 +0,0 @@
1
- # Queries
2
-
3
- > Define data queries in dashboard markdown using YAML code fences.
4
-
5
- ## Overview
6
-
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
-
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
-
11
- ## Syntax
12
-
13
- Query blocks use fenced code with the `query` language tag followed by a name:
14
-
15
- ````markdown
16
- ```query revenue_trend
17
- measures: [orders.total_revenue]
18
- timeDimension:
19
- dimension: orders.created_at
20
- granularity: month
21
- dateRange: [2025-01-01, 2025-12-31]
22
- ```
23
- ````
24
-
25
- ## Query Properties
26
-
27
- | Property | Type | Required | Description |
28
- |----------|------|----------|-------------|
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]`) |
31
- | `filters` | Filter[] | No | Row-level filters |
32
- | `timeDimension` | object | No | Time-based grouping and date range |
33
- | `orderBy` | object | No | Sort specification (e.g. `{orders.total_revenue: desc}`) |
34
- | `limit` | number | No | Maximum rows to return |
35
-
36
- ### timeDimension
37
-
38
- | Property | Type | Required | Description |
39
- |----------|------|----------|-------------|
40
- | `dimension` | string | Yes | Fully qualified time dimension name (e.g. `orders.created_at`) |
41
- | `granularity` | string | No | `day`, `week`, `month`, `quarter`, or `year` |
42
- | `dateRange` | string[] | No | `[start, end]` in `YYYY-MM-DD` format |
43
-
44
- ### filters
45
-
46
- Each filter is an object with:
47
-
48
- | Property | Type | Description |
49
- |----------|------|-------------|
50
- | `dimension` | string | Dimension to filter on |
51
- | `operator` | string | `equals`, `notEquals`, `contains`, `gt`, `gte`, `lt`, `lte` |
52
- | `values` | array | Values to filter by |
53
-
54
- ## Examples
55
-
56
- ### Simple aggregation
57
-
58
- ````markdown
59
- ```query total_orders
60
- measures: [orders.count]
61
- ```
62
- ````
63
-
64
- ### Grouped by dimension
65
-
66
- ````markdown
67
- ```query revenue_by_city
68
- measures: [orders.total_revenue]
69
- dimensions: [orders.city]
70
- orderBy:
71
- orders.total_revenue: desc
72
- limit: 10
73
- ```
74
- ````
75
-
76
- ### Time series
77
-
78
- ````markdown
79
- ```query monthly_revenue
80
- measures: [orders.total_revenue]
81
- timeDimension:
82
- dimension: orders.created_at
83
- granularity: month
84
- dateRange: [2025-01-01, 2025-12-31]
85
- ```
86
- ````
87
-
88
- ### With filters
89
-
90
- ````markdown
91
- ```query completed_orders
92
- measures: [orders.count, orders.total_revenue]
93
- dimensions: [orders.category]
94
- filters:
95
- - dimension: orders.status
96
- operator: equals
97
- values: [completed]
98
- ```
99
- ````
100
-
101
- ## Rules
102
-
103
- - Query names must be valid identifiers (letters, numbers, `_`, `$`)
104
- - Query names must be unique within a dashboard
105
- - All field names must be fully qualified with the cube or view name (e.g. `orders.count`, not `count`)
106
- - Components reference queries by name: `data={query_name}`
107
-
108
- ## See Also
109
-
110
- - [Components](dashboards.components) — chart and display components
111
- - [Dashboards](dashboards) — overview and deployment
112
- - [Querying](querying) — query format reference