import { APIGatewayEvent , APIGatewayProxyEventV2 , AppSyncResolverEvent , ALBEvent , CloudWatchLogsEvent , ScheduledEvent , CloudFrontRequestEvent , DynamoDBStreamEvent , KinesisStreamEvent , S3Event , SNSEvent , SQSEvent , } from "aws-lambda" ; import { apiGatewayEventV2 } from "../trace/constants" ; export function isAPIGatewayEvent ( event ) { return event . requestContext ?. stage !== undefined && event . httpMethod !== undefined && event . resource !== undefined ; } export function isAPIGatewayEventV2 ( event ) { return ( event . requestContext !== undefined && event . version === apiGatewayEventV2 && event . rawQueryString !== undefined ) ; } export function isALBEvent ( event ) { return event . requestContext !== undefined && event . requestContext . elb !== undefined ; } export function isCloudWatchLogsEvent ( event ) { return event . awslogs !== undefined ; } export function isCloudWatchEvent ( event ) { return event . source !== undefined && event . source === "aws.events" ; } export function isCloudFrontRequestEvent ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . cf !== undefined ; } export function isDynamoDBStreamEvent ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . dynamodb !== undefined ; } export function isKinesisStreamEvent ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . kinesis !== undefined ; } export function isS3Event ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . s3 !== undefined ; } export function isSNSEvent ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . Sns !== undefined ; } export function isSQSEvent ( event ) { return Array . isArray ( event . Records ) && event . Records . length > 0 && event . Records [ 0 ] . eventSource === "aws:sqs" ; } export function isAppSyncResolverEvent ( event ) { return event . info !== undefined && event . info . selectionSetGraphQL !== undefined ; }