import { CustomAuthorizerResult , PolicyDocument , Statement } from 'aws-lambda' ; import { Dictionary } from '../../domain/declarations' ; export default ( principalId , effect , resource , context ? ) => { const policyDocument = { Statement : [ ] , Version : '2012-10-17' , } ; const statementOne = { Action : 'execute-api:Invoke' , Effect : effect , Resource : resource , } ; policyDocument . Statement [ 0 ] = statementOne ; const authResponse = { policyDocument , principalId , } ; if ( context ) { authResponse . context = context ; } return authResponse ; } ;