add the arbitrary-service pre-auth client factory
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,3 +24,23 @@ export function createLexClient(
|
|||||||
): Client {
|
): Client {
|
||||||
return new Client(agent, {strictResponseProcessing: false, ...options})
|
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})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user