The best way to control Claude Code, Codex and more from any computer or phone

main
ts 26 lines 1.19 KB
Raw
1 import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
2 import * as EffectContext from "effect/Context";
3 import * as HttpClient from "effect/http/HttpClient";
4 import * as Layer from "effect/Layer";
5
6 /** Node transport preserves explicit Content-Length on file-backed uploads. */
7 export const PrismaHttpClientLive = NodeHttpClient.layerNodeHttp;
8
9 /**
10 * The HTTP client Prisma artifact uploads run on. Kept as a Prisma-scoped
11 * service — overriding the global `HttpClient.HttpClient` from
12 * `Prisma.providers()` would hijack every other provider in the stack (e.g.
13 * Cloudflare Worker script uploads break on node's chunked multipart
14 * bodies). Live wiring provides the node transport here because the
15 * S3-style presigned upload URLs require an explicit Content-Length, while
16 * tests that stub the ambient `HttpClient` simply omit this service and the
17 * upload falls back to the ambient client.
18 */
19 export class PrismaUploadClient extends EffectContext.Service<
20 PrismaUploadClient,
21 HttpClient.HttpClient
22 >()("alchemy/Prisma/UploadClient") {}
23
24 export const PrismaUploadClientLive = Layer.effect(PrismaUploadClient, HttpClient.HttpClient).pipe(
25 Layer.provide(PrismaHttpClientLive),
26 );