graphile / graphile/persisted-operations

Enable bypassing persisted operations

Open
#2 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
40
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### Feature description

Add a function, like [`allowExplain`](https://www.graphile.org/postgraphile/usage-library/), that governs whether a request may use arbitrary operations versus only persisted operations.

### Motivating example

In development it's common to want to send arbitrary queries from GraphiQL whilst also enforcing Persisted Operations from the application.

```js
app.use(postgraphile(DATABASE_URL, SCHEMAS, {
allowUnpersistedOperation(req) {
return process.env.NODE_ENV === "development" && req.headers.referer.endsWith("/graphiql");
}
});
```

(Should we pass the operation too, I wonder?)

### Breaking changes

None

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.