t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Railway/fixtures/rpc-caller.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

28 lines
852 B
TypeScript

import { bindFunction } from "@/Railway/Bind.ts";
import { Function } from "@/Railway/Function.ts";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
import Greeter from "./rpc-greeter.ts";
import { Partition, Site } from "./rpc-shared.ts";
/**
* Tagged Function that binds {@link Greeter} and calls `.greet` over the
* private mesh. Public fetch is the only way a laptop can observe the
* trusted call.
*/
export default class Caller extends Function<Caller>()(
"Caller",
{
project: Site,
environment: Partition,
main: import.meta.url,
},
Effect.gen(function* () {
const greeter = yield* bindFunction(Greeter);
return {
fetch: greeter
.greet("sam")
.pipe(Effect.map((greeting) => HttpServerResponse.text(greeting))),
};
}),
) {}