(handler: Handler, token: string)
| 27 | |
| 28 | // A FetchHttpClient backed by the in-process handler, carrying the admin bearer. |
| 29 | const clientLayer = (handler: Handler, token: string) => |
| 30 | FetchHttpClient.layer.pipe( |
| 31 | Layer.provide( |
| 32 | Layer.succeed(FetchHttpClient.Fetch)(((input: RequestInfo | URL, init?: RequestInit) => { |
| 33 | const base = input instanceof Request ? input : new Request(input, init); |
| 34 | const request = new Request(base, { |
| 35 | headers: { ...Object.fromEntries(base.headers), authorization: `Bearer ${token}` }, |
| 36 | }); |
| 37 | return handler(request); |
| 38 | }) as typeof globalThis.fetch), |
| 39 | ), |
| 40 | ); |
| 41 | |
| 42 | export const mintInviteCode = async ( |
| 43 | handler: Handler, |
no test coverage detected