import { ApiGatewayManagementApi } from 'aws-sdk' ; import { APIGatewayEventRequestContext } from 'aws-lambda' ; import { ConnectionAckMessage , NextMessage , CompleteMessage , ErrorMessage , PingMessage , PongMessage , } from 'graphql-ws' ; export const sendMessage = ( a ) => new ApiGatewayManagementApi ( { apiVersion : 'latest' , endpoint : `${ a . domainName }/${ a . stage }` , } ) . postToConnection ( { ConnectionId : a . connectionId ! , Data : JSON . stringify ( a . message ) , } ) . promise ( ) ; export const deleteConnection = ( a ) => new ApiGatewayManagementApi ( { apiVersion : 'latest' , endpoint : `${ a . domainName }/${ a . stage }` , } ) . deleteConnection ( { ConnectionId : a . connectionId ! } ) . promise ( ) ;