t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/AppSync/resolver-handler.ts
Julius Marminge 108e01746c
Upgrade Effect and Alchemy betas (#4643)
Prepare Relay production infrastructure for the PlanetScale PS_20 HA topology, upgrade Effect and Alchemy to compatible betas, reconcile migration state, and preserve patched MCP session termination behavior.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
2026-07-27 16:21:02 +02:00

23 lines
687 B
TypeScript

/**
* AppSync Lambda data-source fixture. The JS resolvers under test invoke
* this function with `{ field, args }` payloads and surface the returned
* value as the GraphQL result — proving the value was computed here.
*/
const handler = async (event: {
field?: string;
args?: Record<string, number & string>;
}) => {
switch (event?.field) {
case "add":
return Number(event.args?.a) + Number(event.args?.b);
case "double":
return Number(event.args?.n) * 2;
case "greet":
return `Hello, ${event.args?.name}! (from Lambda)`;
default:
throw new Error(`Unknown field: ${event?.field}`);
}
};
export { handler };
export default handler;