(connection: Connection, verbose: boolean)
| 385 | /** Lean projection for `connections.list`. Summarizes `oauthScope` and health |
| 386 | * diagnostics unless `verbose`, where the full grant string is included too. */ |
| 387 | const connectionToListItem = (connection: Connection, verbose: boolean) => ({ |
| 388 | owner: connection.owner, |
| 389 | name: String(connection.name), |
| 390 | integration: String(connection.integration), |
| 391 | template: String(connection.template), |
| 392 | provider: String(connection.provider), |
| 393 | address: String(connection.address), |
| 394 | identityLabel: connection.identityLabel ?? null, |
| 395 | description: connection.description ?? null, |
| 396 | expiresAt: connection.expiresAt ?? null, |
| 397 | oauthClient: connection.oauthClient == null ? null : String(connection.oauthClient), |
| 398 | oauthClientOwner: connection.oauthClientOwner ?? null, |
| 399 | oauthScopeCount: oauthScopeCount(connection.oauthScope), |
| 400 | // Keep full probe diagnostics behind the explicit verbose opt-in. |
| 401 | lastHealth: |
| 402 | connection.lastHealth == null || verbose |
| 403 | ? (connection.lastHealth ?? null) |
| 404 | : { |
| 405 | status: connection.lastHealth.status, |
| 406 | ...(connection.lastHealth.identity !== undefined |
| 407 | ? { identity: connection.lastHealth.identity } |
| 408 | : {}), |
| 409 | checkedAt: connection.lastHealth.checkedAt, |
| 410 | }, |
| 411 | ...(verbose ? { oauthScope: connection.oauthScope ?? null } : {}), |
| 412 | }); |
| 413 | |
| 414 | /** How long a non-healthy persisted verdict may be served to an agent before |
| 415 | * it is re-verified. Verdicts are sticky — nothing re-probes them between UI |
no test coverage detected