The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { RelayApi } from "@t3tools/contracts/relay"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as FetchHttpClient from "effect/http/FetchHttpClient"; |
| 4 | import * as HttpClient from "effect/http/HttpClient"; |
| 5 | import * as HttpClientRequest from "effect/http/HttpClientRequest"; |
| 6 | import * as HttpApiClient from "effect/http-api/HttpApiClient"; |
| 7 | |
| 8 | export const makeRelayEnvironmentClient = (connection: { |
| 9 | readonly url: string; |
| 10 | readonly environmentCredential: string; |
| 11 | }) => |
| 12 | HttpApiClient.make(RelayApi, { |
| 13 | baseUrl: connection.url, |
| 14 | transformClient: HttpClient.mapRequest( |
| 15 | HttpClientRequest.setHeader("authorization", `Bearer ${connection.environmentCredential}`), |
| 16 | ), |
| 17 | }).pipe(Effect.provide(FetchHttpClient.layer)); |