
function replaceAllAuthForEnum(code: string) {
  const regexp = /hasAuth\('(.*)'\)/g

  return code.replace(regexp, (match, p1) => {
    const newStr = p1.replace(/\./g, '_').split('_').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('_')
    return `hasAuth(AuthzPerms.${newStr})`
  })
}
export const resolveCode = (code: string) => {
  return replaceAllAuthForEnum(code)
}
