1import * as Lambda from "@/AWS/Lambda";
2import * as Effect from "effect/Effect";
3import * as HttpServerResponse from "effect/http/HttpServerResponse";
4import { 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 */
13export const project = isolatedProject("lambda-function", import.meta.filename);
14
15export const BODY = "hello from isolated project";
16
17/**
18 * Minimal `AWS.Lambda.Function` (zip, Node runtime) with a function URL.
19 * A 200 from the URL proves the generated bootstrap loaded — with its
20 * imports left external the runtime fails at init with `Cannot find
21 * package` and the URL answers 5xx.
22 */
23export class IsolatedProjectFunction extends Lambda.Function<Lambda.Function>()(
24 "LambdaIsolatedProjectFunction",
25) {}
26
27export default IsolatedProjectFunction.make(
28 { main: project.main, functionUrl: true },
29 Effect.gen(function* () {
30 return {
31 fetch: Effect.gen(function* () {
32 return HttpServerResponse.text(BODY);
33 }),
34 };
35 }),
36);