Home / Function/ getBestAction() — supabase Function Reference

getBestAction() — supabase Function Reference

Architecture documentation for the getBestAction() function in Permissions.utils.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/Permissions/Permissions.utils.ts lines 3–17

const getBestAction = (actions: string[]): string => {
  const availableActions = actions.filter((a) => a !== 'no access')

  if (availableActions.length === 0) return 'no access'

  const priority = ['read', 'write', 'create', 'delete', 'read-write']

  for (const priorityAction of priority) {
    if (availableActions.includes(priorityAction)) {
      return priorityAction
    }
  }

  return availableActions[0]
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free