import { CognitoUser } from "@aws-amplify/auth" ; export class User { private readonly _attributes ? : { [ id ] : any ; } ; constructor ( private cognitoUser ) { this . _attributes = this . cognitoUser ?. getSignInUserSession ( ) ?. isValid ( ) ? this . cognitoUser . getSignInUserSession ( ) ?. getIdToken ( ) ?. decodePayload ( ) : undefined ; } get groups ( ) : string [ ] { return this . attributes [ "cognito:groups" ] || [ ] ; } get attributes ( ) : { [ id ] : any ; } { return this . _attributes || { } ; } get name ( ) : string { return this . attributes [ "name" ] ; } get email ( ) : string { return this . attributes [ "email" ] ; } }