@adminforth/dashboard 1.7.0 → 1.8.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/custom/model/dashboard.types.ts +25 -10
- package/custom/skills/adminforth-dashboard/SKILL.md +26 -3
- package/dist/custom/model/dashboard.types.d.ts +19 -7
- package/dist/custom/model/dashboard.types.ts +25 -10
- package/dist/custom/queries/useDashboardConfig.d.ts +322 -4
- package/dist/custom/queries/useWidgetData.d.ts +322 -4
- package/dist/custom/skills/adminforth-dashboard/SKILL.md +26 -3
- package/dist/schema/api.d.ts +8099 -1620
- package/dist/schema/api.js +2 -2
- package/dist/schema/widget.d.ts +622 -33
- package/dist/schema/widget.js +1 -1
- package/dist/schema/widgets/charts.d.ts +785 -39
- package/dist/schema/widgets/charts.js +2 -2
- package/dist/schema/widgets/common.d.ts +35 -6
- package/dist/schema/widgets/common.js +23 -5
- package/dist/schema/widgets/gauge-card.d.ts +56 -2
- package/dist/schema/widgets/kpi-card.d.ts +56 -2
- package/dist/schema/widgets/pivot-table.d.ts +56 -2
- package/dist/schema/widgets/table.d.ts +56 -2
- package/dist/services/widgetDataService.js +37 -32
- package/package.json +1 -1
- package/schema/api.ts +1 -2
- package/schema/widget.ts +0 -1
- package/schema/widgets/charts.ts +1 -2
- package/schema/widgets/common.ts +24 -5
- package/services/widgetDataService.ts +62 -50
|
@@ -117,7 +117,8 @@ export type QueryOrderByItem = {
|
|
|
117
117
|
direction?: 'asc' | 'desc'
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
export type
|
|
120
|
+
export type ResourceQueryConfig = {
|
|
121
|
+
source?: 'resource'
|
|
121
122
|
resource: string
|
|
122
123
|
select?: QuerySelectItem[]
|
|
123
124
|
sparkline?: {
|
|
@@ -139,17 +140,31 @@ export type QueryConfig = {
|
|
|
139
140
|
formatting?: Record<string, JsonValue>
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
export type
|
|
143
|
-
|
|
143
|
+
export type StepsQueryStepConfig =
|
|
144
|
+
| {
|
|
145
|
+
name: string
|
|
146
|
+
resource: string
|
|
147
|
+
metric: QueryAggregateSelectItem
|
|
148
|
+
filters?: FilterExpression
|
|
149
|
+
}
|
|
150
|
+
| {
|
|
151
|
+
name: string
|
|
152
|
+
resource: string
|
|
153
|
+
select: QueryAggregateSelectItem[]
|
|
154
|
+
filters?: FilterExpression
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type StepsQueryConfig = {
|
|
158
|
+
source: 'steps'
|
|
159
|
+
steps: StepsQueryStepConfig[]
|
|
144
160
|
calcs?: QueryCalcSelectItem[]
|
|
161
|
+
order_by?: QueryOrderByItem[]
|
|
162
|
+
limit?: number
|
|
163
|
+
offset?: number
|
|
164
|
+
formatting?: Record<string, JsonValue>
|
|
145
165
|
}
|
|
146
166
|
|
|
147
|
-
export type
|
|
148
|
-
name: string
|
|
149
|
-
resource: string
|
|
150
|
-
metric: QueryAggregateSelectItem
|
|
151
|
-
filters?: FilterExpression
|
|
152
|
-
}
|
|
167
|
+
export type QueryConfig = ResourceQueryConfig | StepsQueryConfig
|
|
153
168
|
|
|
154
169
|
export type FieldRef = string | {
|
|
155
170
|
field: string
|
|
@@ -246,7 +261,7 @@ export type TableWidgetConfig = WidgetBaseConfig & {
|
|
|
246
261
|
export type ChartDashboardWidgetConfig = WidgetBaseConfig & {
|
|
247
262
|
target: 'chart'
|
|
248
263
|
chart: ChartWidgetConfig
|
|
249
|
-
query: QueryConfig
|
|
264
|
+
query: QueryConfig
|
|
250
265
|
}
|
|
251
266
|
|
|
252
267
|
export type KpiCardWidgetConfig = WidgetBaseConfig & {
|
|
@@ -151,8 +151,8 @@ Use resource, not resourceId.
|
|
|
151
151
|
|
|
152
152
|
## Query shape rules
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
All chart widgets, including funnel charts, use the same query shape.
|
|
155
|
+
Use a single-resource query by default.
|
|
156
156
|
|
|
157
157
|
For kpi_card and normal charts, use:
|
|
158
158
|
- query.resource
|
|
@@ -162,6 +162,29 @@ For kpi_card and normal charts, use:
|
|
|
162
162
|
- optional query.order_by
|
|
163
163
|
- optional query.calcs
|
|
164
164
|
|
|
165
|
+
For multi-resource charts or widgets, use the general steps source:
|
|
166
|
+
|
|
167
|
+
query:
|
|
168
|
+
source: steps
|
|
169
|
+
steps:
|
|
170
|
+
- name: Leads
|
|
171
|
+
resource: leads
|
|
172
|
+
metric:
|
|
173
|
+
agg: count
|
|
174
|
+
as: value
|
|
175
|
+
- name: Customers
|
|
176
|
+
resource: orders
|
|
177
|
+
metric:
|
|
178
|
+
agg: count_distinct
|
|
179
|
+
field: customer_id
|
|
180
|
+
as: value
|
|
181
|
+
|
|
182
|
+
Each step may use either:
|
|
183
|
+
- metric for one aggregate
|
|
184
|
+
- select for multiple aggregate fields
|
|
185
|
+
|
|
186
|
+
Do not use bare query.steps without source: steps.
|
|
187
|
+
|
|
165
188
|
## Date range rules
|
|
166
189
|
|
|
167
190
|
Use only query.filters for time ranges.
|
|
@@ -203,7 +226,7 @@ select raw token totals:
|
|
|
203
226
|
then query.calcs:
|
|
204
227
|
- calculate total_spend from those aliases and lookup variables
|
|
205
228
|
|
|
206
|
-
For today vs yesterday KPI, use multiple aggregate select items with filters and distinct aliases, then calcs.
|
|
229
|
+
For today vs yesterday KPI, use multiple aggregate select items with filters and distinct aliases, then calcs.
|
|
207
230
|
|
|
208
231
|
## Calc variables
|
|
209
232
|
|
|
@@ -87,7 +87,8 @@ export type QueryOrderByItem = {
|
|
|
87
87
|
field: string;
|
|
88
88
|
direction?: 'asc' | 'desc';
|
|
89
89
|
};
|
|
90
|
-
export type
|
|
90
|
+
export type ResourceQueryConfig = {
|
|
91
|
+
source?: 'resource';
|
|
91
92
|
resource: string;
|
|
92
93
|
select?: QuerySelectItem[];
|
|
93
94
|
sparkline?: {
|
|
@@ -112,16 +113,27 @@ export type QueryConfig = {
|
|
|
112
113
|
calcs?: QueryCalcSelectItem[];
|
|
113
114
|
formatting?: Record<string, JsonValue>;
|
|
114
115
|
};
|
|
115
|
-
export type
|
|
116
|
-
steps: FunnelQueryStep[];
|
|
117
|
-
calcs?: QueryCalcSelectItem[];
|
|
118
|
-
};
|
|
119
|
-
export type FunnelQueryStep = {
|
|
116
|
+
export type StepsQueryStepConfig = {
|
|
120
117
|
name: string;
|
|
121
118
|
resource: string;
|
|
122
119
|
metric: QueryAggregateSelectItem;
|
|
123
120
|
filters?: FilterExpression;
|
|
121
|
+
} | {
|
|
122
|
+
name: string;
|
|
123
|
+
resource: string;
|
|
124
|
+
select: QueryAggregateSelectItem[];
|
|
125
|
+
filters?: FilterExpression;
|
|
124
126
|
};
|
|
127
|
+
export type StepsQueryConfig = {
|
|
128
|
+
source: 'steps';
|
|
129
|
+
steps: StepsQueryStepConfig[];
|
|
130
|
+
calcs?: QueryCalcSelectItem[];
|
|
131
|
+
order_by?: QueryOrderByItem[];
|
|
132
|
+
limit?: number;
|
|
133
|
+
offset?: number;
|
|
134
|
+
formatting?: Record<string, JsonValue>;
|
|
135
|
+
};
|
|
136
|
+
export type QueryConfig = ResourceQueryConfig | StepsQueryConfig;
|
|
125
137
|
export type FieldRef = string | {
|
|
126
138
|
field: string;
|
|
127
139
|
label?: string;
|
|
@@ -210,7 +222,7 @@ export type TableWidgetConfig = WidgetBaseConfig & {
|
|
|
210
222
|
export type ChartDashboardWidgetConfig = WidgetBaseConfig & {
|
|
211
223
|
target: 'chart';
|
|
212
224
|
chart: ChartWidgetConfig;
|
|
213
|
-
query: QueryConfig
|
|
225
|
+
query: QueryConfig;
|
|
214
226
|
};
|
|
215
227
|
export type KpiCardWidgetConfig = WidgetBaseConfig & {
|
|
216
228
|
target: 'kpi_card';
|
|
@@ -117,7 +117,8 @@ export type QueryOrderByItem = {
|
|
|
117
117
|
direction?: 'asc' | 'desc'
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
export type
|
|
120
|
+
export type ResourceQueryConfig = {
|
|
121
|
+
source?: 'resource'
|
|
121
122
|
resource: string
|
|
122
123
|
select?: QuerySelectItem[]
|
|
123
124
|
sparkline?: {
|
|
@@ -139,17 +140,31 @@ export type QueryConfig = {
|
|
|
139
140
|
formatting?: Record<string, JsonValue>
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
export type
|
|
143
|
-
|
|
143
|
+
export type StepsQueryStepConfig =
|
|
144
|
+
| {
|
|
145
|
+
name: string
|
|
146
|
+
resource: string
|
|
147
|
+
metric: QueryAggregateSelectItem
|
|
148
|
+
filters?: FilterExpression
|
|
149
|
+
}
|
|
150
|
+
| {
|
|
151
|
+
name: string
|
|
152
|
+
resource: string
|
|
153
|
+
select: QueryAggregateSelectItem[]
|
|
154
|
+
filters?: FilterExpression
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type StepsQueryConfig = {
|
|
158
|
+
source: 'steps'
|
|
159
|
+
steps: StepsQueryStepConfig[]
|
|
144
160
|
calcs?: QueryCalcSelectItem[]
|
|
161
|
+
order_by?: QueryOrderByItem[]
|
|
162
|
+
limit?: number
|
|
163
|
+
offset?: number
|
|
164
|
+
formatting?: Record<string, JsonValue>
|
|
145
165
|
}
|
|
146
166
|
|
|
147
|
-
export type
|
|
148
|
-
name: string
|
|
149
|
-
resource: string
|
|
150
|
-
metric: QueryAggregateSelectItem
|
|
151
|
-
filters?: FilterExpression
|
|
152
|
-
}
|
|
167
|
+
export type QueryConfig = ResourceQueryConfig | StepsQueryConfig
|
|
153
168
|
|
|
154
169
|
export type FieldRef = string | {
|
|
155
170
|
field: string
|
|
@@ -246,7 +261,7 @@ export type TableWidgetConfig = WidgetBaseConfig & {
|
|
|
246
261
|
export type ChartDashboardWidgetConfig = WidgetBaseConfig & {
|
|
247
262
|
target: 'chart'
|
|
248
263
|
chart: ChartWidgetConfig
|
|
249
|
-
query: QueryConfig
|
|
264
|
+
query: QueryConfig
|
|
250
265
|
}
|
|
251
266
|
|
|
252
267
|
export type KpiCardWidgetConfig = WidgetBaseConfig & {
|