(toolResult: unknown)
| 116 | } |
| 117 | |
| 118 | export function extractChartPayloads(toolResult: unknown): ChartPayload[] { |
| 119 | if (!isRecord(toolResult)) return [] |
| 120 | const details = isRecord(toolResult.details) ? toolResult.details : toolResult |
| 121 | const charts: ChartPayload[] = [] |
| 122 | |
| 123 | if (isChartPayload(details.chart)) charts.push(details.chart) |
| 124 | if (Array.isArray(details.charts)) { |
| 125 | for (const chart of details.charts) { |
| 126 | if (isChartPayload(chart)) charts.push(chart) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return charts |
| 131 | } |
| 132 | |
| 133 | export function toPersistedChartPayload(chart: ChartPayload): ChartPayload { |
| 134 | return { |
no test coverage detected