Before callback on graphql endpoints

Is there a way to get a callback called for graphql endpoints? Something like beforeSave for objects. Reason: I want to do dynamic checking of conditions for queries or mutations.

All triggers also work for the GraphQL mutations as well. So if you add a beforeSave trigger to SomeClass, it will also be triggered on createSomeClass mutation.

But that will restrict the entire application, and not just GraphQL endpoints, right? Is there a specific callback for the GraphQL endpoint?

Yes. That would restrict to both REST and GraphQL APIs.