export enum Permissions { CREATE_CONVERSATION = 1 << 0 , DELETE_CONVERSATION = 1 << 1 , ADD_TEAM_MEMBER = 1 << 2 , REMOVE_TEAM_MEMBER = 1 << 3 , ADD_CONVERSATION_MEMBER = 1 << 4 , REMOVE_CONVERSATION_MEMBER = 1 << 5 , GET_BILLING = 1 << 6 , SET_BILLING = 1 << 7 , SET_TEAM_DATA = 1 << 8 , GET_MEMBER_PERMISSIONS = 1 << 9 , GET_TEAM_CONVERSATIONS = 1 << 10 , DELETE_TEAM = 1 << 11 , SET_MEMBER_PERMISSIONS = 1 << 12 } export const hasPermissions = ( permissions , expectedPermissions ) : boolean => { const validPermissions = Number . isSafeInteger ( permissions ) && permissions > 0 ; return validPermissions && ( permissions & expectedPermissions ) === expectedPermissions ; } ; export const combinePermissions = ( permissionList ) : Permissions => { return permissionList . reduce ( ( acc , permission ) => acc | permission , 0 ) ; } ;