( clients: readonly OAuthClientSummary[] | undefined, connection: Connection, methodSupportsAutomatic: boolean, )
| 93 | * Pass `clients: undefined` while the summaries are loading: the decision is |
| 94 | * then `"unknown"`, never a guess. */ |
| 95 | export function reconnectRoute( |
| 96 | clients: readonly OAuthClientSummary[] | undefined, |
| 97 | connection: Connection, |
| 98 | methodSupportsAutomatic: boolean, |
| 99 | ): ReconnectRoute { |
| 100 | if (clients === undefined) return { kind: "unknown" }; |
| 101 | const stored = reconnectStoredClient(clients, connection); |
| 102 | if (stored !== undefined) { |
| 103 | return stored.origin.kind === "dynamic_client_registration" |
| 104 | ? { kind: "automatic", stored } |
| 105 | : { kind: "direct" }; |
| 106 | } |
| 107 | return methodSupportsAutomatic ? { kind: "automatic", stored: undefined } : { kind: "direct" }; |
| 108 | } |
| 109 | |
| 110 | /** Reconnect's view of the client-summaries query: |
| 111 | * - `"ready"` — a current successful load; routing reads these summaries. |
no test coverage detected