(value: unknown)
| 80 | } |
| 81 | |
| 82 | function parseConnectionProfile(value: unknown): RemoteConfigProfile { |
| 83 | if (!value || typeof value !== 'object' || Array.isArray(value)) { |
| 84 | throw new AppError('COMMAND_FAILED', 'Cloud connection profile response is invalid.'); |
| 85 | } |
| 86 | const connection = (value as CloudConnectionProfileResponse).connection; |
| 87 | if (!connection || typeof connection !== 'object') { |
| 88 | throw new AppError('COMMAND_FAILED', 'Cloud connection profile response is missing profile.'); |
| 89 | } |
| 90 | if (connection.remoteConfigProfile !== undefined) { |
| 91 | return parseRemoteConfigProfile(connection.remoteConfigProfile); |
| 92 | } |
| 93 | throw new AppError( |
| 94 | 'COMMAND_FAILED', |
| 95 | 'Cloud connection profile did not include remoteConfigProfile.', |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | function parseRemoteConfigProfile(value: unknown): RemoteConfigProfile { |
| 100 | if (!value || typeof value !== 'object' || Array.isArray(value)) { |
no test coverage detected