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

main
ts 34 lines 1.06 KB
Raw
1 // Package import (not the @/ alias): the test bundles a temp copy of this
2 // file from packages/alchemy/.tmp, where the alias does not resolve.
3 import * as AWS from "@alchemy.run/aws";
4 import * as Effect from "effect/Effect";
5 import * as HttpServerResponse from "effect/http/HttpServerResponse";
6
7 export class SourceChangeFunction extends AWS.Lambda.Function<AWS.Lambda.Function>()(
8 "SourceChangeFunction",
9 ) {}
10
11 export const SourceChangeFunctionLive = SourceChangeFunction.make(
12 {
13 main: import.meta.url,
14 functionUrl: false,
15 build: {
16 external: (moduleId) => moduleId.endsWith("dependency.ts"),
17 },
18 },
19 Effect.gen(function* () {
20 return {
21 fetch: Effect.gen(function* () {
22 const loadDependency = yield* Effect.sync(
23 () => process.env.LOAD_SOURCE_CHANGE_DEPENDENCY === "true",
24 );
25 if (loadDependency) {
26 yield* Effect.tryPromise(() => import("./dependency.ts")).pipe(Effect.orDie);
27 }
28 return HttpServerResponse.text("source-v1");
29 }),
30 };
31 }),
32 );
33
34 export default SourceChangeFunctionLive;