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

Function clientLayer

apps/host-selfhost/src/testing/mint-invite.ts:33–44  ·  view source on GitHub ↗
(handler: Handler, token: string)

Source from the content-addressed store, hash-verified

31
32// A FetchHttpClient backed by the in-process handler, carrying the admin bearer.
33const clientLayer = (handler: Handler, token: string) =>
34 FetchHttpClient.layer.pipe(
35 Layer.provide(
36 Layer.succeed(FetchHttpClient.Fetch)(((input: RequestInfo | URL, init?: RequestInit) => {
37 const base = input instanceof Request ? input : new Request(input, init);
38 const request = new Request(base, {
39 headers: { ...Object.fromEntries(base.headers), authorization: `Bearer ${token}` },
40 });
41 return handler(request);
42 }) as typeof globalThis.fetch),
43 ),
44 );
45
46/** Sign in once and mint each invitation through the authenticated admin API. */
47export const createInviteMinter = async (

Callers 1

createInviteMinterFunction · 0.70

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected