somod-chat-service
Version:
Serverless Chat Service from SOMOD
17 lines (16 loc) • 837 B
TypeScript
import { Middleware } from "somod";
import { APIGatewayProxyEventV2, APIGatewayProxyResultV2, APIGatewayProxyWebsocketEventV2 } from "aws-lambda";
type InterfaceToRecordConvertor<T> = {
[K in keyof T]: T[K];
};
/**
* This Middleware sets the context user in Lambda function integrated for
* - HTTP SyncMessage Route - take value from headers
* - HTTP SendMessage Route - take value from headers
* - WebSocket Connect Route - take value from headers
* - WebSocket OnMessage Route - take value from body
*
* This is a sample implementation, For PROD usecase , derive the value from event.requestContext.authorizer
*/
declare const userProviderMiddleware: Middleware<InterfaceToRecordConvertor<APIGatewayProxyEventV2 | APIGatewayProxyWebsocketEventV2>, APIGatewayProxyResultV2>;
export default userProviderMiddleware;