( connections: readonly Connection[], )
| 23 | /** Build an owner+slug → connections map so each app can show what it backs. |
| 24 | * Static connections (null `oauthClient`) are skipped. */ |
| 25 | export function buildUsageMap( |
| 26 | connections: readonly Connection[], |
| 27 | ): ReadonlyMap<string, readonly Connection[]> { |
| 28 | const map = new Map<string, Connection[]>(); |
| 29 | for (const connection of connections) { |
| 30 | const slug = connection.oauthClient; |
| 31 | if (slug == null) continue; |
| 32 | const key = oauthClientUsageKey(connection.oauthClientOwner, slug); |
| 33 | const existing = map.get(key); |
| 34 | if (existing) existing.push(connection); |
| 35 | else map.set(key, [connection]); |
| 36 | } |
| 37 | return map; |
| 38 | } |
| 39 | |
| 40 | /** Connections backing one app, or an empty array. */ |
| 41 | export function connectionsUsingClient( |
no test coverage detected