(value: string, operation: string)
| 28 | type JsonRecord = Record<string, unknown>; |
| 29 | |
| 30 | function isRecord(value: unknown): value is JsonRecord { |
| 31 | return typeof value === 'object' && value !== null && !Array.isArray(value); |
| 32 | } |
| 33 | |
| 34 | function parseJson(value: string, operation: string): JsonRecord { |
| 35 | try { |
| 36 | const parsed: unknown = JSON.parse(value); |
| 37 | if (isRecord(parsed)) return parsed; |
| 38 | } catch { |
| 39 | // The provider output is intentionally omitted because it may contain secrets. |
| 40 | } |
| 41 | throw new Error(`${operation} returned an unexpected response.`); |
no test coverage detected