← Files DataARCHIVED FILE

output_formats/html/src/charting/shared/config-envelope.js

1.08 KB · Dec 5, 2026 · 00:27 UTC

↓ Download file

// Generated by scripts/sync-chart-semantics.mjs from skills/visualize-data/src/config-envelope.js.
// Edit the canonical source and regenerate; do not edit this distribution copy.
/** Envelope validation is independent of renderer loading and row validation. */
export function chartConfigMembers(config) {
  if (!config || typeof config !== "object" || Array.isArray(config))
    throw new Error("Chart input must be an object containing reviewed rows.");
  if (config.schemaVersion !== undefined && config.schemaVersion !== 1)
    throw new Error("Unsupported ChartConfig schemaVersion; expected 1.");
  if (!Object.hasOwn(config, "charts")) return [config];
  if (Object.keys(config).some(key => !["charts", "schemaVersion"].includes(key)) ||
      !Array.isArray(config.charts) || config.charts.length < 2 || config.charts.length > 3)
    throw new Error("Supply one chart or a comparison containing two or three charts.");
  if (new Set(config.charts.map(chart => chart?.id)).size !== config.charts.length)
    throw new Error("Every chart requires a distinct nonempty id.");
  return config.charts;
}

SHA-256: 29daa82d00f188d613bb20f10dee5f24e18380555bd8bf6287355f444bcd4f8a