| 1 | import { InsufficientScopesError } from '../../lib/github/github.errors.js'; |
| 2 | import { hasScope, type |
| 3 | import type { GithubViewer |
| 4 | |
| 5 | /** Refuses unless the viewer's token holds one of `anyOf`; `field` names the GraphQL field or REST route in GitHub's message. */ |
| 6 | export function requireScope(viewer |
| 7 | if (!anyOf.some |
| 8 | } |
| 9 | |
| 10 | /** A write to a repository needs `repo`, or `public_repo` when the repository is public. */ |
| 11 | export function requireWriteScope(viewer |
| 12 | if (repository.isPrivate |
| 13 | else requireScope(viewer, |
| 14 | } |