t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Run/fixtures/invoke-callee.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

30 lines
962 B
TypeScript

import * as GCP from "@/GCP";
import * as Effect from "effect/Effect";
import { HttpServerRequest } from "effect/http/HttpServerRequest";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
/**
* Private Effect-native Cloud Run Service (invoker IAM enforced).
* Called by {@link ./invoke-caller.ts} from {@link ../InvokeService.test.ts}.
*/
export default class InvokeCallee extends GCP.Function<InvokeCallee>()(
"InvokeCallee",
{
main: import.meta.url,
location: "us-central1",
},
Effect.gen(function* () {
return {
fetch: Effect.gen(function* () {
const request = yield* HttpServerRequest;
const body = request.method === "POST" ? yield* request.text : "";
return yield* HttpServerResponse.json({
from: "callee",
method: request.method,
path: new URL(request.originalUrl, "http://localhost").pathname,
body,
});
}),
};
}),
) {}