Files
codegraph/__tests__/fixtures/factory-closure-ts/src/index.ts
T
Colby McHenry d49265043c test(explore): add the factory-closure fixture and its selection probe (CG-27)
A file whose top-level symbol spans almost all of it — createFoo() returning
an object of closures — is how Svelte 5 rune stores, React custom-hook modules,
IIFE module-pattern JS and Zustand's create((set,get)=>({…})) are all written.
probe-factory-closure.mjs measures what such a file DELIVERS from within: which
inner symbols' definitions reach the agent, not how many bytes did.
2026-08-06 13:58:36 -05:00

24 lines
998 B
TypeScript

import { createDashboardStore } from './stores/dashboard-store';
import { createAlertsStore } from './stores/alerts-store';
import { mountPanel } from './ui/panel';
import { parseFilterText } from './services/filter-parser';
import { refreshMetricCache } from './services/metric-service';
import type { StoreDeps } from './stores/types';
/** Wire a dashboard: build both stores, mount the panel, boot it. */
export async function startDashboard(deps: StoreDeps, baseUrl: string, dashboardId: string) {
const store = createDashboardStore(deps, baseUrl);
const alerts = createAlertsStore(deps, baseUrl);
const panel = mountPanel(store, dashboardId);
await panel.boot();
await alerts.refreshAlerts(dashboardId);
return { store, alerts, panel };
}
/** Apply the filter bar's text to the dashboard store. */
export function searchDashboard(store: ReturnType<typeof createDashboardStore>, text: string) {
return store.applyFilter(parseFilterText(text));
}
export { refreshMetricCache };