(toolResult: unknown)
| 86 | } |
| 87 | |
| 88 | function extractChartPayloads(toolResult: unknown): ChartPayload[] { |
| 89 | if (!isRecord(toolResult)) return [] |
| 90 | const details = isRecord(toolResult.details) ? toolResult.details : toolResult |
| 91 | const charts: ChartPayload[] = [] |
| 92 | if (isChartPayload(details.chart)) charts.push(details.chart) |
| 93 | if (Array.isArray(details.charts)) { |
| 94 | for (const chart of details.charts) { |
| 95 | if (isChartPayload(chart)) charts.push(chart) |
| 96 | } |
| 97 | } |
| 98 | return charts |
| 99 | } |
| 100 | |
| 101 | function toPersistedChartPayload(chart: ChartPayload): ChartPayload { |
| 102 | return { |
no test coverage detected