import { APIGatewayProxyResult } from 'aws-lambda' ; import { httpStatusCodeFor , toClassTitle } from '@boostercloud/framework-types' ; export async function requestFailed ( error ) { const statusCode = httpStatusCodeFor ( error ) ; return { headers : { 'Access-Control-Allow-Origin' : '*' , } , statusCode , body : JSON . stringify ( { statusCode , title : toClassTitle ( error ) , reason : error . message , } ) , } ; } export async function requestSucceeded ( body ? , headers ? ) { return { headers : { 'Access-Control-Allow-Origin' : '*' , ... headers , } , statusCode : 200 , body : body ? JSON . stringify ( body ) : '' , } ; }