@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.
20 lines (19 loc) • 937 B
JavaScript
import { loadCatalog } from "./loadCatalog.js";
import { isMapConfig, validateMapData } from "./validateMapData.js";
/**
* Map validation for a chart payload before a data-link is signed.
* Returns undefined only when the payload is not a map. A throw means the
* check did not finish — the caller must not sign.
*
* The map type is resolved exactly like the renderer's getMapType(): generated
* data-links carry no explicit type or dataset metadata, so it falls to the
* geospatial key names (e.g. a "state__created" key holding county values resolves
* to "state"). Pass `opts.mapType` / `opts.fieldSubtype` when the MCP already
* knows them for a fully faithful resolution.
*/
export const validateChartConfig = async (config, opts = {}) => {
if (!isMapConfig(config))
return undefined;
const result = await validateMapData(config, loadCatalog, opts);
return result.applicable ? result : undefined;
};