The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as AWS from "@alchemy.run/aws"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | |
| 4 | // #region show |
| 5 | export default AWS.Lambda.Function( |
| 6 | "Archive", |
| 7 | { main: import.meta.url }, |
| 8 | Effect.gen(function* () { |
| 9 | const source = yield* AWS.DynamoDB.Table("Messages", { |
| 10 | partitionKey: "room", |
| 11 | attributes: { room: "S" }, |
| 12 | }); |
| 13 | |
| 14 | yield* AWS.DynamoDB.consumeTableChanges( |
| 15 | source, |
| 16 | { streamViewType: "NEW_IMAGE" }, |
| 17 | Effect.fn(function* (event) { |
| 18 | yield* Effect.log(event.Records); |
| 19 | }), |
| 20 | ); |
| 21 | |
| 22 | return {}; |
| 23 | }).pipe(Effect.provide(AWS.Lambda.TableEventSource)), |
| 24 | ); |
| 25 | // #endregion show |