@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, 04:45 UTC

main
ts 26 lines 1.07 KB
Raw
1 import * as Layer from "effect/Layer";
2 import { StreamSinkFromWriteStream } from "./StreamSinkBatch.ts";
3 import { WriteStreamLocal } from "./WriteStreamLocal.ts";
4
5 /**
6 * Implementation of the {@link StreamSink} service over the stream's HTTP ingest endpoint with the **current credentials** ({@link WriteStreamLocal}) — for draining an Effect Stream into a Pipelines stream from an Action, with no Worker host. The stream needs `http` enabled.
7 * ### Providing the Layer
8 * **Example:** Provide the sink layer
9 * ```typescript
10 * const Seed = Alchemy.Action(
11 * "Seed",
12 * Effect.gen(function* () {
13 * const sink = yield* Cloudflare.Basin.StreamSink(PageViews);
14 * return Effect.fn(function* () {
15 * yield* EffectStream.fromIterable(views).pipe(EffectStream.run(sink));
16 * });
17 * }).pipe(Effect.provide(Cloudflare.Basin.StreamSinkLocal)),
18 * );
19 * ```
20 *
21 * @layer
22 * @provides Cloudflare.Pipelines.StreamSink
23 * @product Pipelines
24 * @category Storage & Databases
25 */
26 export const StreamSinkLocal = StreamSinkFromWriteStream.pipe(Layer.provide(WriteStreamLocal));