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
| 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 | import * as Layer from "effect/Layer"; |
| 6 | |
| 7 | // Minimal host Function for the EventSourceMapping `list()` test: it owns an |
| 8 | // SQS Queue and subscribes to it via `consumeQueueMessages(queue, ...)`, which |
| 9 | // (through the Lambda `QueueEventSource` layer + registered |
| 10 | // `QueueEventSourcePolicy`) creates the `AWS.Lambda.EventSourceMapping` |
| 11 | // resource and grants the role the SQS read permissions the mapping needs. |
| 12 | export class EventSourceMappingFunction extends Lambda.Function<EventSourceMappingFunction>()( |
| 13 | "EventSourceMappingFunction", |
| 14 | ) {} |
| 15 | |
| 16 | export default EventSourceMappingFunction.make( |
| 17 | { |
| 18 | main: import.meta.url, |
| 19 | functionUrl: false, |
| 20 | }, |
| 21 | Effect.gen(function* () { |
| 22 | const queue = yield* SQS.Queue("EventSourceMappingQueue"); |
| 23 | |
| 24 | yield* SQS.consumeQueueMessages(queue, () => Effect.void); |
| 25 | |
| 26 | return { |
| 27 | fetch: Effect.gen(function* () { |
| 28 | return HttpServerResponse.text("ok"); |
| 29 | }).pipe(Effect.orDie), |
| 30 | }; |
| 31 | }).pipe(Effect.provide(Layer.mergeAll(Lambda.QueueEventSource))), |
| 32 | ); |