( value: Record<string, unknown>, )
| 191 | } |
| 192 | |
| 193 | export function normalizeOpenDevice( |
| 194 | value: Record<string, unknown>, |
| 195 | ): AgentDeviceSessionDevice | undefined { |
| 196 | const platform = value.platform; |
| 197 | const id = readOptionalString(value, 'id'); |
| 198 | const name = readOptionalString(value, 'device'); |
| 199 | if (!isPublicPlatform(platform) || !id || !name) { |
| 200 | return undefined; |
| 201 | } |
| 202 | const target = readDeviceTarget(value, 'target'); |
| 203 | const identifiers = buildDeviceIdentifiers(platform, id, name); |
| 204 | return { |
| 205 | platform, |
| 206 | target, |
| 207 | id, |
| 208 | name, |
| 209 | identifiers, |
| 210 | ios: |
| 211 | platform === 'ios' |
| 212 | ? { |
| 213 | udid: readOptionalString(value, 'device_udid') ?? id, |
| 214 | simulatorSetPath: readNullableString(value, 'ios_simulator_device_set'), |
| 215 | } |
| 216 | : undefined, |
| 217 | android: |
| 218 | platform === 'android' ? { serial: readOptionalString(value, 'serial') ?? id } : undefined, |
| 219 | }; |
| 220 | } |
| 221 | |
| 222 | export function normalizeStartupSample(value: unknown): StartupPerfSample | undefined { |
| 223 | if (!isRecord(value)) return undefined; |
no test coverage detected