|
4 | 4 |
|
5 | 5 | Adds a powerful suite of filtering capabilities to a PostGraphile schema. |
6 | 6 |
|
7 | | -> **Warning:** Use of this plugin with the default options may make it **astoundingly trivial** for a malicious actor (or a well-intentioned application that generates complex GraphQL queries) to overwhelm your database with expensive queries. See the [Performance and Security](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter#performance-and-security) section below for details. |
| 7 | +> [!WARNING] |
| 8 | +> Use of this plugin with the default options may make it **astoundingly trivial** for a malicious actor (or a well-intentioned application that generates complex GraphQL queries) to overwhelm your database with expensive queries. See the [Performance and Security](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter#performance-and-security) section below for details. |
8 | 9 |
|
9 | 10 | ## Usage |
10 | 11 |
|
11 | | -Requires PostGraphile v4.5.0 or higher. |
12 | | - |
13 | 12 | Install with: |
14 | 13 |
|
15 | 14 | ``` |
16 | 15 | yarn add postgraphile postgraphile-plugin-connection-filter |
17 | 16 | ``` |
18 | 17 |
|
19 | | -for PostGraphile v5 (beta): |
20 | | - |
21 | | -``` |
22 | | -yarn add postgraphile@beta postgraphile-plugin-connection-filter@beta |
23 | | -``` |
24 | | - |
25 | | -CLI usage via `--append-plugins`: |
26 | | - |
27 | | -``` |
28 | | -postgraphile --append-plugins postgraphile-plugin-connection-filter -c postgres://localhost/my_db ... |
29 | | -``` |
30 | | - |
31 | | -Library usage via `appendPlugins`: |
32 | | - |
33 | | -```ts |
34 | | -import ConnectionFilterPlugin from "postgraphile-plugin-connection-filter"; |
35 | | -// or: const ConnectionFilterPlugin = require("postgraphile-plugin-connection-filter"); |
36 | | - |
37 | | -const middleware = postgraphile(DATABASE_URL, SCHEMAS, { |
38 | | - appendPlugins: [ConnectionFilterPlugin], |
39 | | -}); |
40 | | -``` |
41 | | - |
42 | | -Config example for PostGraphile v5 (beta), `graphile.config.mjs`: |
| 18 | +Add to your `graphile.config.ts` configuration: |
43 | 19 |
|
44 | 20 | ```ts |
45 | | -import ConnectionFilterPlugin from "postgraphile-plugin-connection-filter"; |
| 21 | +import { PostGraphileConnectionFilterPreset } from "postgraphile-plugin-connection-filter"; |
46 | 22 |
|
47 | 23 | const preset = { |
48 | | - extends: [ConnectionFilterPlugin.PostGraphileConnectionFilterPreset], |
| 24 | + extends: [PostGraphileConnectionFilterPreset], |
49 | 25 | }; |
50 | 26 |
|
51 | 27 | export default preset; |
|
0 commit comments