(body: unknown)
| 326 | * `[redacted]` marker. |
| 327 | */ |
| 328 | export const redactSensitiveBodyFields = (body: unknown): unknown => { |
| 329 | if (body === null || typeof body !== 'object' || Array.isArray(body)) { |
| 330 | return body; |
| 331 | } |
| 332 | return Object.fromEntries( |
| 333 | Object.entries(body).map(([key, value]) => [ |
| 334 | key, |
| 335 | sensitiveBodyFields.includes(key) && value !== undefined |
| 336 | ? '[redacted]' |
| 337 | : value, |
| 338 | ]), |
| 339 | ); |
| 340 | }; |
| 341 | |
| 342 | export const removeNullStringify = ( |
| 343 | json: unknown, |