@devries-cameron20 / t3code Mirror · read-only
Fork 0

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, 06:00 UTC

main
ts 21 lines 859 Bytes
Raw
1 import * as Layer from "effect/Layer";
2 import { StreamSinkFromWriteStream } from "./StreamSinkBatch.ts";
3 import { WriteStreamBinding } from "./WriteStreamBinding.ts";
4
5 /**
6 * Implementation of the {@link StreamSink} service over the native Worker `pipelines` binding ({@link WriteStreamBinding}). Registers the same binding as `WriteStream`, so a Worker can use both on one stream.
7 * ### Providing the Layer
8 * **Example:** Provide the sink layer
9 * ```typescript
10 * Effect.gen(function* () {
11 * const sink = yield* Cloudflare.Basin.StreamSink(PageViews);
12 * // ...
13 * }).pipe(Effect.provide(Cloudflare.Basin.StreamSinkBinding));
14 * ```
15 *
16 * @layer
17 * @provides Cloudflare.Pipelines.StreamSink
18 * @product Pipelines
19 * @category Storage & Databases
20 */
21 export const StreamSinkBinding = StreamSinkFromWriteStream.pipe(Layer.provide(WriteStreamBinding));