(value: unknown)
| 175 | } |
| 176 | |
| 177 | function parseSessions(value: unknown): VisualizerSession[] { |
| 178 | if (!Array.isArray(value)) {return [];} |
| 179 | const out: VisualizerSession[] = []; |
| 180 | for (const it of value) { |
| 181 | if (!isRecord(it)) {continue;} |
| 182 | const id = asString(it.id); |
| 183 | if (!id) {continue;} |
| 184 | const pid = it.pid === null ? null : asNumber(it.pid); |
| 185 | const graphName = typeof it.graphName === 'string' ? it.graphName : it.graphName === null ? null : null; |
| 186 | const connectedAt = asRequiredNumber(it.connectedAt); |
| 187 | const lastSeenAt = asRequiredNumber(it.lastSeenAt); |
| 188 | const subscribed = typeof it.subscribed === 'boolean' ? it.subscribed : false; |
| 189 | if (connectedAt === null || lastSeenAt === null) {continue;} |
| 190 | out.push({ |
| 191 | id, |
| 192 | pid, |
| 193 | graphName, |
| 194 | mode: asMode(it.mode), |
| 195 | connectedAt, |
| 196 | lastSeenAt, |
| 197 | subscribed |
| 198 | }); |
| 199 | } |
| 200 | return out; |
| 201 | } |
| 202 | |
| 203 | function parseDebugLocation(value: unknown): DebugLocation | undefined { |
| 204 | if (!isRecord(value)) {return undefined;} |
no test coverage detected