@fusedashlabs/ui9000-workspace
Version:
UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.
64 lines (63 loc) • 2.32 kB
TypeScript
export interface Suggestion {
mapType: string;
value: string;
}
export interface RegionWarning {
value: string;
type: "countryMismatch";
dataCountry: string;
actualCountry: string;
didYouMean: string;
}
export interface LayerValidation {
applicable: true;
mapType: string;
geospatialKey: string;
mapsCorrectly: boolean;
coverage: number;
matched: {
value: string;
regionId: string;
}[];
warnings: RegionWarning[];
unmatched: {
value: string;
didYouMean: Suggestion | null;
}[];
}
export interface MapValidation {
applicable: boolean;
mapsCorrectly: boolean;
layers: LayerValidation[];
llmMessage: string;
}
export type LoadCatalog = (mapType: string) => Promise<GeoJSON.Feature[]> | GeoJSON.Feature[];
/**
* Resolve the map type exactly like the renderer's getMapType(): an explicit type
* wins; otherwise the dataset field subtype (when the caller knows it), then the
* self-describing geospatial key names. Generated data-links carry neither an
* explicit type nor dataset metadata, so they fall to key-name inference — which
* is precisely how a "state__created" key holding county values ends up resolving
* to "state" and failing to render.
*/
export declare const resolveMapType: (geospatialData: string[], opts?: {
mapType?: string;
fieldSubtype?: string;
}) => string;
/**
* Validate values against pre-loaded boundary features for one resolved map type.
* Pure: pass the same features (geometry-free is fine) the renderer would load.
*/
export declare const validateRegions: (values: string[], mapType: string, features: GeoJSON.Feature[]) => LayerValidation;
export declare const isMapConfig: (config: unknown) => boolean;
/**
* Validate a whole chart config (data-link payload or raw config). `loadCatalog`
* supplies geometry-free boundary features for a map type — the caller owns I/O
* (vendored JSON import, fs read…), keeping this pure. Pass `opts.mapType` or
* `opts.fieldSubtype` when the caller already knows them (the MCP does at
* generation time) for a fully faithful resolution.
*/
export declare const validateMapData: (config: unknown, loadCatalog: LoadCatalog, opts?: {
mapType?: string;
fieldSubtype?: string;
}) => Promise<MapValidation>;