@contractspec/example.analytics-dashboard 3.9.8 → 3.9.10
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/dist/browser/dashboard/dashboard.enum.js +1 -34
- package/dist/browser/dashboard/dashboard.operation.js +1 -289
- package/dist/browser/dashboard/dashboard.presentation.js +1 -200
- package/dist/browser/dashboard/dashboard.schema.js +1 -126
- package/dist/browser/dashboard/dashboard.test-spec.js +1 -213
- package/dist/browser/dashboard/index.js +1 -299
- package/dist/browser/dashboard.feature.js +1 -683
- package/dist/browser/datasource/posthog-datasource.js +4 -289
- package/dist/browser/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/events.js +1 -81
- package/dist/browser/example.js +1 -42
- package/dist/browser/handlers/analytics.handlers.js +4 -278
- package/dist/browser/handlers/index.js +7 -571
- package/dist/browser/handlers/query.handlers.js +4 -294
- package/dist/browser/index.js +12 -2317
- package/dist/browser/query/index.js +1 -159
- package/dist/browser/query/query.enum.js +1 -11
- package/dist/browser/query/query.operation.js +1 -154
- package/dist/browser/query/query.presentation.js +1 -122
- package/dist/browser/query/query.schema.js +1 -70
- package/dist/browser/query/query.test-spec.js +1 -113
- package/dist/browser/query-engine/index.js +4 -491
- package/dist/browser/seeders/index.js +2 -20
- package/dist/browser/ui/AnalyticsDashboard.js +1 -1115
- package/dist/browser/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/browser/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/browser/ui/hooks/index.js +1 -660
- package/dist/browser/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/browser/ui/index.js +5 -1283
- package/dist/browser/ui/renderers/analytics.markdown.js +5 -756
- package/dist/browser/ui/renderers/index.js +5 -756
- package/dist/browser/visualizations/catalog.js +1 -457
- package/dist/browser/visualizations/index.js +1 -611
- package/dist/browser/visualizations/specs.breakdown.js +1 -140
- package/dist/browser/visualizations/specs.performance.js +1 -198
- package/dist/browser/visualizations/widgets.js +1 -595
- package/dist/dashboard/dashboard.enum.js +1 -34
- package/dist/dashboard/dashboard.operation.js +1 -289
- package/dist/dashboard/dashboard.presentation.js +1 -200
- package/dist/dashboard/dashboard.schema.js +1 -126
- package/dist/dashboard/dashboard.test-spec.js +1 -213
- package/dist/dashboard/index.js +1 -299
- package/dist/dashboard.feature.js +1 -683
- package/dist/datasource/posthog-datasource.js +4 -289
- package/dist/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/docs/index.js +5 -49
- package/dist/events.js +1 -81
- package/dist/example.js +1 -42
- package/dist/handlers/analytics.handlers.js +4 -278
- package/dist/handlers/index.js +7 -571
- package/dist/handlers/query.handlers.js +4 -294
- package/dist/index.js +12 -2317
- package/dist/node/dashboard/dashboard.enum.js +1 -34
- package/dist/node/dashboard/dashboard.operation.js +1 -289
- package/dist/node/dashboard/dashboard.presentation.js +1 -200
- package/dist/node/dashboard/dashboard.schema.js +1 -126
- package/dist/node/dashboard/dashboard.test-spec.js +1 -213
- package/dist/node/dashboard/index.js +1 -299
- package/dist/node/dashboard.feature.js +1 -683
- package/dist/node/datasource/posthog-datasource.js +4 -289
- package/dist/node/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/node/docs/index.js +5 -49
- package/dist/node/events.js +1 -81
- package/dist/node/example.js +1 -42
- package/dist/node/handlers/analytics.handlers.js +4 -278
- package/dist/node/handlers/index.js +7 -571
- package/dist/node/handlers/query.handlers.js +4 -294
- package/dist/node/index.js +12 -2317
- package/dist/node/query/index.js +1 -159
- package/dist/node/query/query.enum.js +1 -11
- package/dist/node/query/query.operation.js +1 -154
- package/dist/node/query/query.presentation.js +1 -122
- package/dist/node/query/query.schema.js +1 -70
- package/dist/node/query/query.test-spec.js +1 -113
- package/dist/node/query-engine/index.js +4 -491
- package/dist/node/seeders/index.js +2 -20
- package/dist/node/ui/AnalyticsDashboard.js +1 -1115
- package/dist/node/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/node/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/node/ui/hooks/index.js +1 -660
- package/dist/node/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/node/ui/index.js +5 -1283
- package/dist/node/ui/renderers/analytics.markdown.js +5 -756
- package/dist/node/ui/renderers/index.js +5 -756
- package/dist/node/visualizations/catalog.js +1 -457
- package/dist/node/visualizations/index.js +1 -611
- package/dist/node/visualizations/specs.breakdown.js +1 -140
- package/dist/node/visualizations/specs.performance.js +1 -198
- package/dist/node/visualizations/widgets.js +1 -595
- package/dist/query/index.js +1 -159
- package/dist/query/query.enum.js +1 -11
- package/dist/query/query.operation.js +1 -154
- package/dist/query/query.presentation.js +1 -122
- package/dist/query/query.schema.js +1 -70
- package/dist/query/query.test-spec.js +1 -113
- package/dist/query-engine/index.js +4 -491
- package/dist/seeders/index.js +2 -20
- package/dist/ui/AnalyticsDashboard.js +1 -1115
- package/dist/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/ui/hooks/index.js +1 -660
- package/dist/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/ui/index.js +5 -1283
- package/dist/ui/renderers/analytics.markdown.js +5 -756
- package/dist/ui/renderers/index.js +5 -756
- package/dist/visualizations/catalog.js +1 -457
- package/dist/visualizations/index.js +1 -611
- package/dist/visualizations/specs.breakdown.js +1 -140
- package/dist/visualizations/specs.performance.js +1 -198
- package/dist/visualizations/widgets.js +1 -595
- package/package.json +13 -13
|
@@ -1,289 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(reader, options = {}) {
|
|
6
|
-
this.reader = reader;
|
|
7
|
-
this.defaultLimit = options.defaultLimit ?? 100;
|
|
8
|
-
}
|
|
9
|
-
async execute(definition, params) {
|
|
10
|
-
const startTime = Date.now();
|
|
11
|
-
const validation = this.validateQuery(definition);
|
|
12
|
-
if (!validation.valid) {
|
|
13
|
-
return {
|
|
14
|
-
data: [],
|
|
15
|
-
columns: [],
|
|
16
|
-
rowCount: 0,
|
|
17
|
-
executionTimeMs: Date.now() - startTime,
|
|
18
|
-
cached: false,
|
|
19
|
-
error: validation.errors.join(", ")
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
if (!this.reader.queryHogQL) {
|
|
23
|
-
return {
|
|
24
|
-
data: [],
|
|
25
|
-
columns: [],
|
|
26
|
-
rowCount: 0,
|
|
27
|
-
executionTimeMs: Date.now() - startTime,
|
|
28
|
-
cached: false,
|
|
29
|
-
error: "Analytics reader does not support HogQL queries."
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const result = await this.executeHogQL(definition, params);
|
|
34
|
-
return {
|
|
35
|
-
data: result.data,
|
|
36
|
-
columns: result.columns,
|
|
37
|
-
rowCount: result.rowCount,
|
|
38
|
-
executionTimeMs: Date.now() - startTime,
|
|
39
|
-
cached: false
|
|
40
|
-
};
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return {
|
|
43
|
-
data: [],
|
|
44
|
-
columns: [],
|
|
45
|
-
rowCount: 0,
|
|
46
|
-
executionTimeMs: Date.now() - startTime,
|
|
47
|
-
cached: false,
|
|
48
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
validateQuery(definition) {
|
|
53
|
-
const errors = [];
|
|
54
|
-
if (definition.type === "SQL" && !definition.sql) {
|
|
55
|
-
errors.push("SQL query is missing.");
|
|
56
|
-
}
|
|
57
|
-
if (definition.type === "AGGREGATION" && !definition.aggregation) {
|
|
58
|
-
errors.push("Aggregation definition is missing.");
|
|
59
|
-
}
|
|
60
|
-
if (definition.type === "METRIC" && !definition.metricIds?.length) {
|
|
61
|
-
errors.push("Metric IDs are missing.");
|
|
62
|
-
}
|
|
63
|
-
if (definition.type === "CUSTOM" && !definition.custom?.handler) {
|
|
64
|
-
errors.push("Custom handler is missing.");
|
|
65
|
-
}
|
|
66
|
-
return { valid: errors.length === 0, errors };
|
|
67
|
-
}
|
|
68
|
-
async executeHogQL(definition, params) {
|
|
69
|
-
if (!this.reader.queryHogQL) {
|
|
70
|
-
throw new Error("Analytics reader does not support HogQL queries.");
|
|
71
|
-
}
|
|
72
|
-
if (definition.type === "SQL") {
|
|
73
|
-
const result = await this.reader.queryHogQL({
|
|
74
|
-
query: definition.sql ?? "",
|
|
75
|
-
values: params.parameters ?? {}
|
|
76
|
-
});
|
|
77
|
-
return mapHogqlResult(result);
|
|
78
|
-
}
|
|
79
|
-
if (definition.type === "AGGREGATION" && definition.aggregation) {
|
|
80
|
-
const { query, values } = buildAggregationQuery(definition.aggregation, params);
|
|
81
|
-
const result = await this.reader.queryHogQL({ query, values });
|
|
82
|
-
return mapHogqlResult(result);
|
|
83
|
-
}
|
|
84
|
-
if (definition.type === "METRIC" && definition.metricIds) {
|
|
85
|
-
const { query, values } = buildMetricQuery(definition.metricIds, params);
|
|
86
|
-
const result = await this.reader.queryHogQL({ query, values });
|
|
87
|
-
return mapHogqlResult(result);
|
|
88
|
-
}
|
|
89
|
-
throw new Error("Unsupported query type for PostHog datasource.");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function createPosthogQueryEngine(reader, options) {
|
|
93
|
-
return new PosthogQueryEngine(reader, options);
|
|
94
|
-
}
|
|
95
|
-
function buildMetricQuery(metricIds, params) {
|
|
96
|
-
const range = resolveDateRange(params);
|
|
97
|
-
const values = {
|
|
98
|
-
dateFrom: range?.from.toISOString(),
|
|
99
|
-
dateTo: range?.to.toISOString()
|
|
100
|
-
};
|
|
101
|
-
const metricClauses = metricIds.map((metricId, index) => {
|
|
102
|
-
values[`metric${index}`] = metricId;
|
|
103
|
-
return `event = {metric${index}}`;
|
|
104
|
-
});
|
|
105
|
-
const whereClauses = [
|
|
106
|
-
metricClauses.length ? `(${metricClauses.join(" or ")})` : "",
|
|
107
|
-
range ? "timestamp >= {dateFrom} and timestamp < {dateTo}" : ""
|
|
108
|
-
].filter(Boolean).join(" and ");
|
|
109
|
-
return {
|
|
110
|
-
query: [
|
|
111
|
-
"select",
|
|
112
|
-
" event as metric,",
|
|
113
|
-
" count() as total",
|
|
114
|
-
"from events",
|
|
115
|
-
whereClauses ? `where ${whereClauses}` : "",
|
|
116
|
-
"group by metric"
|
|
117
|
-
].filter(Boolean).join(`
|
|
118
|
-
`),
|
|
119
|
-
values
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function buildAggregationQuery(aggregation, params) {
|
|
123
|
-
const measures = aggregation.measures.map((measure) => ({
|
|
124
|
-
...measure,
|
|
125
|
-
expression: buildMeasureExpression(measure.field, measure.aggregation)
|
|
126
|
-
}));
|
|
127
|
-
const dimensions = aggregation.dimensions.map((dimension) => ({
|
|
128
|
-
...dimension,
|
|
129
|
-
expression: buildDimensionExpression(dimension.field, dimension.type, dimension.granularity)
|
|
130
|
-
}));
|
|
131
|
-
const selections = [
|
|
132
|
-
...dimensions.map((dimension) => `${dimension.expression} as ${dimension.name}`),
|
|
133
|
-
...measures.map((measure) => `${measure.expression} as ${measure.name}`)
|
|
134
|
-
];
|
|
135
|
-
const values = {};
|
|
136
|
-
const filters = buildFilterClauses(aggregation, params, values);
|
|
137
|
-
const limit = aggregation.limit ?? 100;
|
|
138
|
-
const orderBy = aggregation.orderBy?.length ? `order by ${aggregation.orderBy.map((order) => `${order.field} ${order.direction}`).join(", ")}` : "";
|
|
139
|
-
return {
|
|
140
|
-
query: [
|
|
141
|
-
"select",
|
|
142
|
-
` ${selections.join(`,
|
|
143
|
-
`)}`,
|
|
144
|
-
`from ${aggregation.source}`,
|
|
145
|
-
filters.length ? `where ${filters.join(" and ")}` : "",
|
|
146
|
-
dimensions.length ? `group by ${dimensions.map((d) => d.name).join(", ")}` : "",
|
|
147
|
-
orderBy,
|
|
148
|
-
`limit ${limit}`
|
|
149
|
-
].filter(Boolean).join(`
|
|
150
|
-
`),
|
|
151
|
-
values
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function buildMeasureExpression(field, aggregation) {
|
|
155
|
-
switch (aggregation) {
|
|
156
|
-
case "COUNT":
|
|
157
|
-
return field === "*" ? "count()" : `count(${field})`;
|
|
158
|
-
case "COUNT_DISTINCT":
|
|
159
|
-
return `countDistinct(${field})`;
|
|
160
|
-
case "SUM":
|
|
161
|
-
return `sum(${field})`;
|
|
162
|
-
case "AVG":
|
|
163
|
-
return `avg(${field})`;
|
|
164
|
-
case "MIN":
|
|
165
|
-
return `min(${field})`;
|
|
166
|
-
case "MAX":
|
|
167
|
-
return `max(${field})`;
|
|
168
|
-
default:
|
|
169
|
-
return `count(${field})`;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
function buildDimensionExpression(field, type, granularity) {
|
|
173
|
-
if (type === "TIME") {
|
|
174
|
-
switch (granularity) {
|
|
175
|
-
case "HOUR":
|
|
176
|
-
return `toStartOfHour(${field})`;
|
|
177
|
-
case "WEEK":
|
|
178
|
-
return `toStartOfWeek(${field})`;
|
|
179
|
-
case "MONTH":
|
|
180
|
-
return `toStartOfMonth(${field})`;
|
|
181
|
-
case "YEAR":
|
|
182
|
-
return `toStartOfYear(${field})`;
|
|
183
|
-
case "DAY":
|
|
184
|
-
default:
|
|
185
|
-
return `toStartOfDay(${field})`;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return field;
|
|
189
|
-
}
|
|
190
|
-
function buildFilterClauses(aggregation, params, values) {
|
|
191
|
-
const clauses = [];
|
|
192
|
-
const range = resolveDateRange(params);
|
|
193
|
-
if (range) {
|
|
194
|
-
values.dateFrom = range.from.toISOString();
|
|
195
|
-
values.dateTo = range.to.toISOString();
|
|
196
|
-
clauses.push(`timestamp >= {dateFrom} and timestamp < {dateTo}`);
|
|
197
|
-
}
|
|
198
|
-
aggregation.filters?.forEach((filter, index) => {
|
|
199
|
-
const key = `filter${index}`;
|
|
200
|
-
switch (filter.operator) {
|
|
201
|
-
case "eq":
|
|
202
|
-
values[key] = filter.value;
|
|
203
|
-
clauses.push(`${filter.field} = {${key}}`);
|
|
204
|
-
break;
|
|
205
|
-
case "neq":
|
|
206
|
-
values[key] = filter.value;
|
|
207
|
-
clauses.push(`${filter.field} != {${key}}`);
|
|
208
|
-
break;
|
|
209
|
-
case "gt":
|
|
210
|
-
values[key] = filter.value;
|
|
211
|
-
clauses.push(`${filter.field} > {${key}}`);
|
|
212
|
-
break;
|
|
213
|
-
case "gte":
|
|
214
|
-
values[key] = filter.value;
|
|
215
|
-
clauses.push(`${filter.field} >= {${key}}`);
|
|
216
|
-
break;
|
|
217
|
-
case "lt":
|
|
218
|
-
values[key] = filter.value;
|
|
219
|
-
clauses.push(`${filter.field} < {${key}}`);
|
|
220
|
-
break;
|
|
221
|
-
case "lte":
|
|
222
|
-
values[key] = filter.value;
|
|
223
|
-
clauses.push(`${filter.field} <= {${key}}`);
|
|
224
|
-
break;
|
|
225
|
-
case "contains":
|
|
226
|
-
values[key] = filter.value;
|
|
227
|
-
clauses.push(`${filter.field} LIKE '%' || {${key}} || '%'`);
|
|
228
|
-
break;
|
|
229
|
-
case "between": {
|
|
230
|
-
if (Array.isArray(filter.value) && filter.value.length >= 2) {
|
|
231
|
-
values[`${key}Start`] = filter.value[0];
|
|
232
|
-
values[`${key}End`] = filter.value[1];
|
|
233
|
-
clauses.push(`${filter.field} BETWEEN {${key}Start} AND {${key}End}`);
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case "in":
|
|
238
|
-
case "nin":
|
|
239
|
-
if (Array.isArray(filter.value)) {
|
|
240
|
-
const placeholders = [];
|
|
241
|
-
filter.value.forEach((value, valueIndex) => {
|
|
242
|
-
const valueKey = `${key}_${valueIndex}`;
|
|
243
|
-
values[valueKey] = value;
|
|
244
|
-
placeholders.push(`{${valueKey}}`);
|
|
245
|
-
});
|
|
246
|
-
if (placeholders.length) {
|
|
247
|
-
clauses.push(`${filter.field} ${filter.operator === "in" ? "IN" : "NOT IN"} (${placeholders.join(", ")})`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
default:
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
return clauses;
|
|
256
|
-
}
|
|
257
|
-
function resolveDateRange(params) {
|
|
258
|
-
const range = params.dateRange;
|
|
259
|
-
if (!range)
|
|
260
|
-
return null;
|
|
261
|
-
return { from: range.start, to: range.end };
|
|
262
|
-
}
|
|
263
|
-
function mapHogqlResult(result) {
|
|
264
|
-
if (!Array.isArray(result.results) || !Array.isArray(result.columns)) {
|
|
265
|
-
return { data: [], columns: [], rowCount: 0 };
|
|
266
|
-
}
|
|
267
|
-
const columns = result.columns.map((name) => ({
|
|
268
|
-
name,
|
|
269
|
-
type: "STRING"
|
|
270
|
-
}));
|
|
271
|
-
const data = result.results.map((row) => {
|
|
272
|
-
if (!Array.isArray(row))
|
|
273
|
-
return {};
|
|
274
|
-
const record = {};
|
|
275
|
-
result.columns?.forEach((column, index) => {
|
|
276
|
-
record[column] = row[index];
|
|
277
|
-
});
|
|
278
|
-
return record;
|
|
279
|
-
});
|
|
280
|
-
return {
|
|
281
|
-
data,
|
|
282
|
-
columns,
|
|
283
|
-
rowCount: data.length
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
export {
|
|
287
|
-
createPosthogQueryEngine,
|
|
288
|
-
PosthogQueryEngine
|
|
289
|
-
};
|
|
1
|
+
class y{reader;defaultLimit;constructor(e,t={}){this.reader=e,this.defaultLimit=t.defaultLimit??100}async execute(e,t){let r=Date.now(),s=this.validateQuery(e);if(!s.valid)return{data:[],columns:[],rowCount:0,executionTimeMs:Date.now()-r,cached:!1,error:s.errors.join(", ")};if(!this.reader.queryHogQL)return{data:[],columns:[],rowCount:0,executionTimeMs:Date.now()-r,cached:!1,error:"Analytics reader does not support HogQL queries."};try{let a=await this.executeHogQL(e,t);return{data:a.data,columns:a.columns,rowCount:a.rowCount,executionTimeMs:Date.now()-r,cached:!1}}catch(a){return{data:[],columns:[],rowCount:0,executionTimeMs:Date.now()-r,cached:!1,error:a instanceof Error?a.message:"Unknown error"}}}validateQuery(e){let t=[];if(e.type==="SQL"&&!e.sql)t.push("SQL query is missing.");if(e.type==="AGGREGATION"&&!e.aggregation)t.push("Aggregation definition is missing.");if(e.type==="METRIC"&&!e.metricIds?.length)t.push("Metric IDs are missing.");if(e.type==="CUSTOM"&&!e.custom?.handler)t.push("Custom handler is missing.");return{valid:t.length===0,errors:t}}async executeHogQL(e,t){if(!this.reader.queryHogQL)throw Error("Analytics reader does not support HogQL queries.");if(e.type==="SQL"){let r=await this.reader.queryHogQL({query:e.sql??"",values:t.parameters??{}});return m(r)}if(e.type==="AGGREGATION"&&e.aggregation){let{query:r,values:s}=h(e.aggregation,t),a=await this.reader.queryHogQL({query:r,values:s});return m(a)}if(e.type==="METRIC"&&e.metricIds){let{query:r,values:s}=d(e.metricIds,t),a=await this.reader.queryHogQL({query:r,values:s});return m(a)}throw Error("Unsupported query type for PostHog datasource.")}}function f(e,t){return new y(e,t)}function d(e,t){let r=g(t),s={dateFrom:r?.from.toISOString(),dateTo:r?.to.toISOString()},a=e.map((i,o)=>{return s[`metric${o}`]=i,`event = {metric${o}}`}),n=[a.length?`(${a.join(" or ")})`:"",r?"timestamp >= {dateFrom} and timestamp < {dateTo}":""].filter(Boolean).join(" and ");return{query:["select"," event as metric,"," count() as total","from events",n?`where ${n}`:"","group by metric"].filter(Boolean).join(`
|
|
2
|
+
`),values:s}}function h(e,t){let r=e.measures.map((u)=>({...u,expression:$(u.field,u.aggregation)})),s=e.dimensions.map((u)=>({...u,expression:w(u.field,u.type,u.granularity)})),a=[...s.map((u)=>`${u.expression} as ${u.name}`),...r.map((u)=>`${u.expression} as ${u.name}`)],n={},i=Q(e,t,n),o=e.limit??100,c=e.orderBy?.length?`order by ${e.orderBy.map((u)=>`${u.field} ${u.direction}`).join(", ")}`:"";return{query:["select",` ${a.join(`,
|
|
3
|
+
`)}`,`from ${e.source}`,i.length?`where ${i.join(" and ")}`:"",s.length?`group by ${s.map((u)=>u.name).join(", ")}`:"",c,`limit ${o}`].filter(Boolean).join(`
|
|
4
|
+
`),values:n}}function $(e,t){switch(t){case"COUNT":return e==="*"?"count()":`count(${e})`;case"COUNT_DISTINCT":return`countDistinct(${e})`;case"SUM":return`sum(${e})`;case"AVG":return`avg(${e})`;case"MIN":return`min(${e})`;case"MAX":return`max(${e})`;default:return`count(${e})`}}function w(e,t,r){if(t==="TIME")switch(r){case"HOUR":return`toStartOfHour(${e})`;case"WEEK":return`toStartOfWeek(${e})`;case"MONTH":return`toStartOfMonth(${e})`;case"YEAR":return`toStartOfYear(${e})`;case"DAY":default:return`toStartOfDay(${e})`}return e}function Q(e,t,r){let s=[],a=g(t);if(a)r.dateFrom=a.from.toISOString(),r.dateTo=a.to.toISOString(),s.push("timestamp >= {dateFrom} and timestamp < {dateTo}");return e.filters?.forEach((n,i)=>{let o=`filter${i}`;switch(n.operator){case"eq":r[o]=n.value,s.push(`${n.field} = {${o}}`);break;case"neq":r[o]=n.value,s.push(`${n.field} != {${o}}`);break;case"gt":r[o]=n.value,s.push(`${n.field} > {${o}}`);break;case"gte":r[o]=n.value,s.push(`${n.field} >= {${o}}`);break;case"lt":r[o]=n.value,s.push(`${n.field} < {${o}}`);break;case"lte":r[o]=n.value,s.push(`${n.field} <= {${o}}`);break;case"contains":r[o]=n.value,s.push(`${n.field} LIKE '%' || {${o}} || '%'`);break;case"between":{if(Array.isArray(n.value)&&n.value.length>=2)r[`${o}Start`]=n.value[0],r[`${o}End`]=n.value[1],s.push(`${n.field} BETWEEN {${o}Start} AND {${o}End}`);break}case"in":case"nin":if(Array.isArray(n.value)){let c=[];if(n.value.forEach((u,p)=>{let l=`${o}_${p}`;r[l]=u,c.push(`{${l}}`)}),c.length)s.push(`${n.field} ${n.operator==="in"?"IN":"NOT IN"} (${c.join(", ")})`)}break;default:break}}),s}function g(e){let t=e.dateRange;if(!t)return null;return{from:t.start,to:t.end}}function m(e){if(!Array.isArray(e.results)||!Array.isArray(e.columns))return{data:[],columns:[],rowCount:0};let t=e.columns.map((s)=>({name:s,type:"STRING"})),r=e.results.map((s)=>{if(!Array.isArray(s))return{};let a={};return e.columns?.forEach((n,i)=>{a[n]=s[i]}),a});return{data:r,columns:t,rowCount:r.length}}export{f as createPosthogQueryEngine,y as PosthogQueryEngine};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var analyticsDashboardDocBlocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.analytics-dashboard",
|
|
6
|
-
title: "Analytics Dashboard",
|
|
7
|
-
summary: "Multi-tenant analytics with dashboards, widgets, query builder, and scheduled reports built on the Event Bus.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/analytics-dashboard",
|
|
11
|
-
tags: ["analytics", "dashboards", "bi", "queries"],
|
|
12
|
-
body: `## Entities
|
|
1
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var j=[{id:"docs.examples.analytics-dashboard",title:"Analytics Dashboard",summary:"Multi-tenant analytics with dashboards, widgets, query builder, and scheduled reports built on the Event Bus.",kind:"reference",visibility:"public",route:"/docs/examples/analytics-dashboard",tags:["analytics","dashboards","bi","queries"],body:`## Entities
|
|
13
2
|
|
|
14
3
|
- Dashboard, Widget, Query, Report.
|
|
15
4
|
- Widget/query configs stay declarative for regeneration.
|
|
@@ -35,17 +24,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
35
24
|
- Use Feature Flags for beta widgets; Metering to track query volume.
|
|
36
25
|
- PostHog datasource can back query execution via HogQL for dashboard widgets.
|
|
37
26
|
- The saved-queries table demonstrates client-mode sorting, pagination, visibility, resizing, pinning, and row expansion on the shared table stack.
|
|
38
|
-
`
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "docs.examples.analytics-dashboard.goal",
|
|
42
|
-
title: "Analytics Dashboard — Goal",
|
|
43
|
-
summary: "Why this template matters and what success looks like.",
|
|
44
|
-
kind: "goal",
|
|
45
|
-
visibility: "public",
|
|
46
|
-
route: "/docs/examples/analytics-dashboard/goal",
|
|
47
|
-
tags: ["analytics", "goal"],
|
|
48
|
-
body: `## Why it matters
|
|
27
|
+
`},{id:"docs.examples.analytics-dashboard.goal",title:"Analytics Dashboard — Goal",summary:"Why this template matters and what success looks like.",kind:"goal",visibility:"public",route:"/docs/examples/analytics-dashboard/goal",tags:["analytics","goal"],body:`## Why it matters
|
|
49
28
|
- Give teams a regenerable analytics workspace that stays in sync with Event Bus, Usage/Metering, and presentations.
|
|
50
29
|
- Avoid dashboard drift by keeping schema-first widgets/queries.
|
|
51
30
|
|
|
@@ -55,17 +34,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
55
34
|
|
|
56
35
|
## Success criteria
|
|
57
36
|
- Dashboards can be regenerated safely from spec changes.
|
|
58
|
-
- Queries/widgets have enforced validation; PII is redacted per policy.`
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "docs.examples.analytics-dashboard.usage",
|
|
62
|
-
title: "Analytics Dashboard — Usage",
|
|
63
|
-
summary: "How to seed, extend, and safely regenerate dashboards.",
|
|
64
|
-
kind: "usage",
|
|
65
|
-
visibility: "public",
|
|
66
|
-
route: "/docs/examples/analytics-dashboard/usage",
|
|
67
|
-
tags: ["analytics", "usage"],
|
|
68
|
-
body: `## Setup
|
|
37
|
+
- Queries/widgets have enforced validation; PII is redacted per policy.`},{id:"docs.examples.analytics-dashboard.usage",title:"Analytics Dashboard — Usage",summary:"How to seed, extend, and safely regenerate dashboards.",kind:"usage",visibility:"public",route:"/docs/examples/analytics-dashboard/usage",tags:["analytics","usage"],body:`## Setup
|
|
69
38
|
1) Seed dashboards/widgets (via template registry) to preload sample queries.
|
|
70
39
|
2) Configure org/tenant scope and attach Usage/Metering for cost/sampling controls.
|
|
71
40
|
|
|
@@ -76,17 +45,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
76
45
|
|
|
77
46
|
## Guardrails
|
|
78
47
|
- Keep all query inputs validated; mark PII paths in policy.
|
|
79
|
-
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "docs.examples.analytics-dashboard.constraints",
|
|
83
|
-
title: "Analytics Dashboard — Constraints & Safety",
|
|
84
|
-
summary: "Internal guardrails for queries, widgets, and regeneration.",
|
|
85
|
-
kind: "reference",
|
|
86
|
-
visibility: "internal",
|
|
87
|
-
route: "/docs/examples/analytics-dashboard/constraints",
|
|
88
|
-
tags: ["analytics", "constraints", "internal"],
|
|
89
|
-
body: `## Constraints
|
|
48
|
+
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`},{id:"docs.examples.analytics-dashboard.constraints",title:"Analytics Dashboard — Constraints & Safety",summary:"Internal guardrails for queries, widgets, and regeneration.",kind:"reference",visibility:"internal",route:"/docs/examples/analytics-dashboard/constraints",tags:["analytics","constraints","internal"],body:`## Constraints
|
|
90
49
|
- Queries and widgets must declare inputs/validation in spec; no ad-hoc query strings.
|
|
91
50
|
- Regeneration must preserve sampling/windowing semantics; document changes explicitly.
|
|
92
51
|
- Events/usage metrics should remain consistent with Metering/Audit wiring.
|
|
@@ -98,7 +57,4 @@ var analyticsDashboardDocBlocks = [
|
|
|
98
57
|
## Verification
|
|
99
58
|
- Add fixtures for widget/query schema changes and scheduled reports.
|
|
100
59
|
- Run regeneration diff when adjusting query builders; ensure UI/markdown targets updated.
|
|
101
|
-
- Confirm feature-flagged widgets default to safe/off for new tenants.`
|
|
102
|
-
}
|
|
103
|
-
];
|
|
104
|
-
registerDocBlocks(analyticsDashboardDocBlocks);
|
|
60
|
+
- Confirm feature-flagged widgets default to safe/off for new tenants.`}];f(j);
|
package/dist/node/docs/index.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var analyticsDashboardDocBlocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.analytics-dashboard",
|
|
6
|
-
title: "Analytics Dashboard",
|
|
7
|
-
summary: "Multi-tenant analytics with dashboards, widgets, query builder, and scheduled reports built on the Event Bus.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/analytics-dashboard",
|
|
11
|
-
tags: ["analytics", "dashboards", "bi", "queries"],
|
|
12
|
-
body: `## Entities
|
|
1
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.analytics-dashboard",title:"Analytics Dashboard",summary:"Multi-tenant analytics with dashboards, widgets, query builder, and scheduled reports built on the Event Bus.",kind:"reference",visibility:"public",route:"/docs/examples/analytics-dashboard",tags:["analytics","dashboards","bi","queries"],body:`## Entities
|
|
13
2
|
|
|
14
3
|
- Dashboard, Widget, Query, Report.
|
|
15
4
|
- Widget/query configs stay declarative for regeneration.
|
|
@@ -35,17 +24,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
35
24
|
- Use Feature Flags for beta widgets; Metering to track query volume.
|
|
36
25
|
- PostHog datasource can back query execution via HogQL for dashboard widgets.
|
|
37
26
|
- The saved-queries table demonstrates client-mode sorting, pagination, visibility, resizing, pinning, and row expansion on the shared table stack.
|
|
38
|
-
`
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "docs.examples.analytics-dashboard.goal",
|
|
42
|
-
title: "Analytics Dashboard — Goal",
|
|
43
|
-
summary: "Why this template matters and what success looks like.",
|
|
44
|
-
kind: "goal",
|
|
45
|
-
visibility: "public",
|
|
46
|
-
route: "/docs/examples/analytics-dashboard/goal",
|
|
47
|
-
tags: ["analytics", "goal"],
|
|
48
|
-
body: `## Why it matters
|
|
27
|
+
`},{id:"docs.examples.analytics-dashboard.goal",title:"Analytics Dashboard — Goal",summary:"Why this template matters and what success looks like.",kind:"goal",visibility:"public",route:"/docs/examples/analytics-dashboard/goal",tags:["analytics","goal"],body:`## Why it matters
|
|
49
28
|
- Give teams a regenerable analytics workspace that stays in sync with Event Bus, Usage/Metering, and presentations.
|
|
50
29
|
- Avoid dashboard drift by keeping schema-first widgets/queries.
|
|
51
30
|
|
|
@@ -55,17 +34,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
55
34
|
|
|
56
35
|
## Success criteria
|
|
57
36
|
- Dashboards can be regenerated safely from spec changes.
|
|
58
|
-
- Queries/widgets have enforced validation; PII is redacted per policy.`
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "docs.examples.analytics-dashboard.usage",
|
|
62
|
-
title: "Analytics Dashboard — Usage",
|
|
63
|
-
summary: "How to seed, extend, and safely regenerate dashboards.",
|
|
64
|
-
kind: "usage",
|
|
65
|
-
visibility: "public",
|
|
66
|
-
route: "/docs/examples/analytics-dashboard/usage",
|
|
67
|
-
tags: ["analytics", "usage"],
|
|
68
|
-
body: `## Setup
|
|
37
|
+
- Queries/widgets have enforced validation; PII is redacted per policy.`},{id:"docs.examples.analytics-dashboard.usage",title:"Analytics Dashboard — Usage",summary:"How to seed, extend, and safely regenerate dashboards.",kind:"usage",visibility:"public",route:"/docs/examples/analytics-dashboard/usage",tags:["analytics","usage"],body:`## Setup
|
|
69
38
|
1) Seed dashboards/widgets (via template registry) to preload sample queries.
|
|
70
39
|
2) Configure org/tenant scope and attach Usage/Metering for cost/sampling controls.
|
|
71
40
|
|
|
@@ -76,17 +45,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
76
45
|
|
|
77
46
|
## Guardrails
|
|
78
47
|
- Keep all query inputs validated; mark PII paths in policy.
|
|
79
|
-
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "docs.examples.analytics-dashboard.constraints",
|
|
83
|
-
title: "Analytics Dashboard — Constraints & Safety",
|
|
84
|
-
summary: "Internal guardrails for queries, widgets, and regeneration.",
|
|
85
|
-
kind: "reference",
|
|
86
|
-
visibility: "internal",
|
|
87
|
-
route: "/docs/examples/analytics-dashboard/constraints",
|
|
88
|
-
tags: ["analytics", "constraints", "internal"],
|
|
89
|
-
body: `## Constraints
|
|
48
|
+
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`},{id:"docs.examples.analytics-dashboard.constraints",title:"Analytics Dashboard — Constraints & Safety",summary:"Internal guardrails for queries, widgets, and regeneration.",kind:"reference",visibility:"internal",route:"/docs/examples/analytics-dashboard/constraints",tags:["analytics","constraints","internal"],body:`## Constraints
|
|
90
49
|
- Queries and widgets must declare inputs/validation in spec; no ad-hoc query strings.
|
|
91
50
|
- Regeneration must preserve sampling/windowing semantics; document changes explicitly.
|
|
92
51
|
- Events/usage metrics should remain consistent with Metering/Audit wiring.
|
|
@@ -98,7 +57,4 @@ var analyticsDashboardDocBlocks = [
|
|
|
98
57
|
## Verification
|
|
99
58
|
- Add fixtures for widget/query schema changes and scheduled reports.
|
|
100
59
|
- Run regeneration diff when adjusting query builders; ensure UI/markdown targets updated.
|
|
101
|
-
- Confirm feature-flagged widgets default to safe/off for new tenants.`
|
|
102
|
-
}
|
|
103
|
-
];
|
|
104
|
-
registerDocBlocks(analyticsDashboardDocBlocks);
|
|
60
|
+
- Confirm feature-flagged widgets default to safe/off for new tenants.`}];m(f);
|
package/dist/node/events.js
CHANGED
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var DashboardEventPayload = defineSchemaModel({
|
|
5
|
-
name: "DashboardEventPayload",
|
|
6
|
-
description: "Payload for dashboard events",
|
|
7
|
-
fields: {
|
|
8
|
-
dashboardId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
var WidgetEventPayload = defineSchemaModel({
|
|
16
|
-
name: "WidgetEventPayload",
|
|
17
|
-
description: "Payload for widget events",
|
|
18
|
-
fields: {
|
|
19
|
-
widgetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
|
-
dashboardId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
21
|
-
widgetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
var QueryEventPayload = defineSchemaModel({
|
|
27
|
-
name: "QueryEventPayload",
|
|
28
|
-
description: "Payload for query events",
|
|
29
|
-
fields: {
|
|
30
|
-
queryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
-
queryType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var DashboardCreatedEvent = defineEvent({
|
|
39
|
-
meta: {
|
|
40
|
-
key: "analytics.dashboard.created",
|
|
41
|
-
version: "1.0.0",
|
|
42
|
-
description: "A dashboard was created.",
|
|
43
|
-
stability: "stable",
|
|
44
|
-
owners: ["@analytics-team"],
|
|
45
|
-
tags: ["dashboard"]
|
|
46
|
-
},
|
|
47
|
-
payload: DashboardEventPayload
|
|
48
|
-
});
|
|
49
|
-
var WidgetAddedEvent = defineEvent({
|
|
50
|
-
meta: {
|
|
51
|
-
key: "analytics.widget.added",
|
|
52
|
-
version: "1.0.0",
|
|
53
|
-
description: "A widget was added to a dashboard.",
|
|
54
|
-
stability: "stable",
|
|
55
|
-
owners: ["@analytics-team"],
|
|
56
|
-
tags: ["dashboard"]
|
|
57
|
-
},
|
|
58
|
-
payload: WidgetEventPayload
|
|
59
|
-
});
|
|
60
|
-
var QueryCreatedEvent = defineEvent({
|
|
61
|
-
meta: {
|
|
62
|
-
key: "analytics.query.created",
|
|
63
|
-
version: "1.0.0",
|
|
64
|
-
description: "A query was created.",
|
|
65
|
-
stability: "stable",
|
|
66
|
-
owners: ["@analytics-team"],
|
|
67
|
-
tags: ["dashboard"]
|
|
68
|
-
},
|
|
69
|
-
payload: QueryEventPayload
|
|
70
|
-
});
|
|
71
|
-
var AnalyticsDashboardEvents = {
|
|
72
|
-
DashboardCreatedEvent,
|
|
73
|
-
WidgetAddedEvent,
|
|
74
|
-
QueryCreatedEvent
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
WidgetAddedEvent,
|
|
78
|
-
QueryCreatedEvent,
|
|
79
|
-
DashboardCreatedEvent,
|
|
80
|
-
AnalyticsDashboardEvents
|
|
81
|
-
};
|
|
1
|
+
import{defineEvent as k}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as q,ScalarTypeEnum as j}from"@contractspec/lib.schema";var w=q({name:"DashboardEventPayload",description:"Payload for dashboard events",fields:{dashboardId:{type:j.String_unsecure(),isOptional:!1},title:{type:j.String_unsecure(),isOptional:!1},orgId:{type:j.String_unsecure(),isOptional:!1},createdBy:{type:j.String_unsecure(),isOptional:!1},timestamp:{type:j.DateTime(),isOptional:!1}}}),x=q({name:"WidgetEventPayload",description:"Payload for widget events",fields:{widgetId:{type:j.String_unsecure(),isOptional:!1},dashboardId:{type:j.String_unsecure(),isOptional:!1},widgetType:{type:j.String_unsecure(),isOptional:!1},orgId:{type:j.String_unsecure(),isOptional:!1},timestamp:{type:j.DateTime(),isOptional:!1}}}),z=q({name:"QueryEventPayload",description:"Payload for query events",fields:{queryId:{type:j.String_unsecure(),isOptional:!1},name:{type:j.String_unsecure(),isOptional:!1},queryType:{type:j.String_unsecure(),isOptional:!1},orgId:{type:j.String_unsecure(),isOptional:!1},createdBy:{type:j.String_unsecure(),isOptional:!1},timestamp:{type:j.DateTime(),isOptional:!1}}}),B=k({meta:{key:"analytics.dashboard.created",version:"1.0.0",description:"A dashboard was created.",stability:"stable",owners:["@analytics-team"],tags:["dashboard"]},payload:w}),F=k({meta:{key:"analytics.widget.added",version:"1.0.0",description:"A widget was added to a dashboard.",stability:"stable",owners:["@analytics-team"],tags:["dashboard"]},payload:x}),G=k({meta:{key:"analytics.query.created",version:"1.0.0",description:"A query was created.",stability:"stable",owners:["@analytics-team"],tags:["dashboard"]},payload:z}),J={DashboardCreatedEvent:B,WidgetAddedEvent:F,QueryCreatedEvent:G};export{F as WidgetAddedEvent,G as QueryCreatedEvent,B as DashboardCreatedEvent,J as AnalyticsDashboardEvents};
|
package/dist/node/example.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var example = defineExample({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "analytics-dashboard",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "Analytics Dashboard",
|
|
8
|
-
description: "Tenant-scoped dashboards, widgets, query builder, and scheduled reports (spec-first widgets/queries).",
|
|
9
|
-
kind: "template",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@platform.core"],
|
|
13
|
-
tags: ["analytics", "dashboards", "bi", "queries"]
|
|
14
|
-
},
|
|
15
|
-
docs: {
|
|
16
|
-
rootDocId: "docs.examples.analytics-dashboard",
|
|
17
|
-
goalDocId: "docs.examples.analytics-dashboard.goal",
|
|
18
|
-
usageDocId: "docs.examples.analytics-dashboard.usage",
|
|
19
|
-
constraintsDocId: "docs.examples.analytics-dashboard.constraints"
|
|
20
|
-
},
|
|
21
|
-
entrypoints: {
|
|
22
|
-
packageName: "@contractspec/example.analytics-dashboard",
|
|
23
|
-
feature: "./feature",
|
|
24
|
-
contracts: "./contracts",
|
|
25
|
-
presentations: "./presentations",
|
|
26
|
-
handlers: "./handlers",
|
|
27
|
-
docs: "./docs"
|
|
28
|
-
},
|
|
29
|
-
surfaces: {
|
|
30
|
-
templates: true,
|
|
31
|
-
sandbox: {
|
|
32
|
-
enabled: true,
|
|
33
|
-
modes: ["playground", "specs", "builder", "markdown", "evolution"]
|
|
34
|
-
},
|
|
35
|
-
studio: { enabled: true, installable: true },
|
|
36
|
-
mcp: { enabled: true }
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
var example_default = example;
|
|
40
|
-
export {
|
|
41
|
-
example_default as default
|
|
42
|
-
};
|
|
1
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec";var h=g({meta:{key:"analytics-dashboard",version:"1.0.0",title:"Analytics Dashboard",description:"Tenant-scoped dashboards, widgets, query builder, and scheduled reports (spec-first widgets/queries).",kind:"template",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["analytics","dashboards","bi","queries"]},docs:{rootDocId:"docs.examples.analytics-dashboard",goalDocId:"docs.examples.analytics-dashboard.goal",usageDocId:"docs.examples.analytics-dashboard.usage",constraintsDocId:"docs.examples.analytics-dashboard.constraints"},entrypoints:{packageName:"@contractspec/example.analytics-dashboard",feature:"./feature",contracts:"./contracts",presentations:"./presentations",handlers:"./handlers",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["playground","specs","builder","markdown","evolution"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),q=h;export{q as default};
|