The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Layer from "effect/Layer"; |
| 2 | import { StreamSinkFromWriteStream } from "./StreamSinkBatch.ts"; |
| 3 | import { WriteStreamHttp } from "./WriteStreamHttp.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Implementation of the {@link StreamSink} service over the stream's HTTP |
| 7 | * input ({@link WriteStreamHttp}), authenticated with a scoped `K2 Produce` |
| 8 | * API token bound into the host. The stream needs `http: true`. |
| 9 | * ### Providing the Layer |
| 10 | * **Example:** Drain a Stream over HTTP |
| 11 | * ```typescript |
| 12 | * Effect.gen(function* () { |
| 13 | * const sink = yield* Cloudflare.K2.StreamSink(Orders); |
| 14 | * // ... |
| 15 | * }).pipe(Effect.provide(Cloudflare.K2.StreamSinkHttp)); |
| 16 | * ``` |
| 17 | * |
| 18 | * @layer |
| 19 | * @provides Cloudflare.K2.StreamSink |
| 20 | * @product K2 |
| 21 | * @category Storage & Databases |
| 22 | */ |
| 23 | export const StreamSinkHttp = StreamSinkFromWriteStream.pipe(Layer.provide(WriteStreamHttp)); |