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 | /** |
| 2 | * AppSync Lambda data-source fixture. The JS resolvers under test invoke |
| 3 | * this function with `{ field, args }` payloads and surface the returned |
| 4 | * value as the GraphQL result — proving the value was computed here. |
| 5 | */ |
| 6 | const handler = async (event: { field?: string; args?: Record<string, number & string> }) => { |
| 7 | switch (event?.field) { |
| 8 | case "add": |
| 9 | return Number(event.args?.a) + Number(event.args?.b); |
| 10 | case "double": |
| 11 | return Number(event.args?.n) * 2; |
| 12 | case "greet": |
| 13 | return `Hello, ${event.args?.name}! (from Lambda)`; |
| 14 | default: |
| 15 | throw new Error(`Unknown field: ${event?.field}`); |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | export { handler }; |
| 20 | export default handler; |