MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / meta

Function meta

telemetry-dashboard/src/api.ts:223–250  ·  view source on GitHub ↗

* What the picker anchors on. The dashboard asks for this first and ends every * default range on `latest_day`, because the nightly cron has not rolled up * today yet — anchoring on the wall clock would put a phantom zero on the right * edge of every line chart.

(env: Env)

Source from the content-addressed store, hash-verified

221 * edge of every line chart.
222 */
223async function meta(env: Env): Promise<ApiResult> {
224 const row = await env.DB.prepare(
225 `SELECT (SELECT max(day) FROM daily_event_counts) AS latest_rollup_day,
226 (SELECT min(day) FROM daily_event_counts) AS earliest_rollup_day,
227 (SELECT max(day) FROM machine_days) AS latest_active_day,
228 (SELECT min(day) FROM machine_days) AS earliest_active_day,
229 (SELECT min(day) FROM events) AS earliest_raw_day,
230 (SELECT max(day) FROM events) AS latest_raw_day`,
231 ).first<MetaRow>();
232
233 const latest = row?.latest_rollup_day ?? row?.latest_active_day ?? null;
234 const earliest = row?.earliest_rollup_day ?? row?.earliest_active_day ?? null;
235 return {
236 body: {
237 latest_day: latest,
238 earliest_day: earliest,
239 latest_rollup_day: row?.latest_rollup_day ?? null,
240 latest_active_day: row?.latest_active_day ?? null,
241 /** Below this day the activation funnel is blind — raw events are purged. */
242 earliest_raw_day: row?.earliest_raw_day ?? null,
243 latest_raw_day: row?.latest_raw_day ?? null,
244 max_range_days: MAX_RANGE_DAYS,
245 retention_days: RETENTION_DAYS,
246 generated_at: new Date().toISOString(),
247 },
248 cacheControl: CACHE_CONTROL,
249 };
250}
251
252// ---------------------------------------------------------------------------
253// /api/summary — the big numbers

Callers 1

handleApiFunction · 0.85

Calls 1

prepareMethod · 0.65

Tested by

no test coverage detected