MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / reconnectRoute

Function reconnectRoute

packages/react/src/plugins/oauth-reconnect.ts:95–108  ·  view source on GitHub ↗
(
  clients: readonly OAuthClientSummary[] | undefined,
  connection: Connection,
  methodSupportsAutomatic: boolean,
)

Source from the content-addressed store, hash-verified

93 * Pass `clients: undefined` while the summaries are loading: the decision is
94 * then `"unknown"`, never a guess. */
95export 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.

Callers 2

handleReconnectFunction · 0.90

Calls 1

reconnectStoredClientFunction · 0.85

Tested by

no test coverage detected