@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 32 lines 1.12 KB
Raw
1 import * as Lambda from "@alchemy.run/aws/Lambda";
2 import * as SQS from "@alchemy.run/aws/SQS";
3 import * as Effect from "effect/Effect";
4 import * as HttpServerResponse from "effect/http/HttpServerResponse";
5
6 // Host Function for the `alias` test: a function URL plus an SQS event
7 // source, so the test can check both follow the alias. `fetch` echoes the
8 // RELEASE_MARKER env var, which the test changes to publish a new version.
9 export class AliasFunction extends Lambda.Function<AliasFunction>()("AliasFunction") {}
10
11 export const aliasFunction = (alias: string | undefined) =>
12 AliasFunction.make(
13 {
14 main: import.meta.url,
15 functionUrl: true,
16 alias,
17 },
18 Effect.gen(function* () {
19 const queue = yield* SQS.Queue("AliasQueue");
20
21 yield* SQS.consumeQueueMessages(queue, () => Effect.void);
22
23 return {
24 fetch: Effect.gen(function* () {
25 const marker = yield* Effect.sync(() => process.env.RELEASE_MARKER);
26 return HttpServerResponse.text(marker ?? "missing");
27 }),
28 };
29 }).pipe(Effect.provide(Lambda.QueueEventSource)),
30 );
31
32 export default aliasFunction(undefined);