The best way to control Claude Code, Codex and more from any computer or phone

main
ts 38 lines 1.32 KB
Raw
1 import * as Lambda from "@alchemy.run/aws/Lambda";
2 import * as Effect from "effect/Effect";
3 import * as HttpServerResponse from "effect/http/HttpServerResponse";
4 import { isolatedProject } from "../../../IsolatedProject.ts";
5
6 /**
7 * The isolated consumer project this function is bundled from (see
8 * `test/IsolatedProject.ts`): `main` lives outside the repository, so the
9 * bundle `cwd` resolves none of alchemy's dependencies and the Lambda
10 * bootstrap's own imports (`@distilled.cloud/aws/*`,
11 * `@effect/platform-node`, …) must be anchored by the bundler.
12 */
13 export const project = isolatedProject("lambda-function", import.meta.filename, [
14 "@alchemy.run/aws",
15 ]);
16
17 export const BODY = "hello from isolated project";
18
19 /**
20 * Minimal `AWS.Lambda.Function` (zip, Node runtime) with a function URL.
21 * A 200 from the URL proves the generated bootstrap loaded — with its
22 * imports left external the runtime fails at init with `Cannot find
23 * package` and the URL answers 5xx.
24 */
25 export class IsolatedProjectFunction extends Lambda.Function<Lambda.Function>()(
26 "LambdaIsolatedProjectFunction",
27 ) {}
28
29 export default IsolatedProjectFunction.make(
30 { main: project.main, functionUrl: true },
31 Effect.gen(function* () {
32 return {
33 fetch: Effect.gen(function* () {
34 return HttpServerResponse.text(BODY);
35 }),
36 };
37 }),
38 );