Lambda Handlers
@notation/aws/lambda.fn exports typed handler wrappers for each Lambda event source.
handle.apiRequest
For API Gateway HTTP API events.
runtime/todos.fn.ts
import { handle, json } from "@notation/aws/lambda.fn";
export const getUsers = handle.apiRequest((event) => {
return json([{ id: 1, name: "Alice" }]);
});handle.jwtAuthorizedApiRequest
For API Gateway events with JWT authorization. Accepts a generic for JWT claims.
runtime/user.fn.ts
import { handle, json } from "@notation/aws/lambda.fn";
type Claims = { sub: string; email: string };
export const getProfile = handle.jwtAuthorizedApiRequest<Claims>((event) => {
const { sub } = event.requestContext.authorizer.jwt.claims;
return json({ sub });
});handle.eventBridgeScheduledEvent
For EventBridge scheduled events.
runtime/cleanup.fn.ts