add the arbitrary-service pre-auth client factory

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 20:32:23 +03:00
parent 88477d0767
commit cc295497fe
+20
View File
@@ -24,3 +24,23 @@ export function createLexClient(
): Client {
return new Client(agent, {strictResponseProcessing: false, ...options})
}
/**
* An unauthenticated {@link Client} pointed at an arbitrary service URL, for
* the PRE-AUTH flows that talk to a host the user typed or picked (hosting
* provider description, password reset, handle availability). Those requests
* cannot go through a session-scoped client, because there is no session yet.
*
* Deliberately NOT memoized: `service` is user-supplied and changes as the user
* edits it, so there is no stable key to cache on. Each call builds a fresh
* client, mirroring the ad-hoc agents these call sites constructed inline. That
* keeps client identity per-render, so callers must not put the returned client
* in a React Query key or a dependency array.
*
* Requests use PLAIN `fetch`, not `networkAwareFetch`: the host is untrusted
* input, and a typo'd or dead service must not be reported as the app losing
* network reachability.
*/
export function createServiceClient(service: string): Client {
return createLexClient({service})
}