You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-19Lines changed: 41 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# postgraphile-plugin-connection-filter
2
2
This plugin adds a `filter` argument to Connection types in PostGraphile v4.
3
3
4
-
## Disclaimer
4
+
> **Note:** This plugin targets the alpha release of PostGraphile v4. Because of possible API changes, releases of this plugin are pinned to specific alpha versions of PostGraphile. See the Compatibility table below for details.
5
5
6
-
This plugin targets the alpha release of PostGraphile v4. Bug reports and pull requests are very much welcome.
6
+
> **Warning:**This plugin exposes a large number of operators (including some that can perform expensive pattern matching) by default. Before enabling this plugin in production, you should consider the performance and security implications. Use of the `connectionFilterAllowedOperators` option to limit the operators exposed through GraphQL is strongly encouraged.
7
7
8
8
## Compatibility
9
9
@@ -177,12 +177,49 @@ For additional examples, see the [tests](https://github.com/mattbretl/postgraphi
177
177
178
178
When using PostGraphile as a library, the following plugin options can be passed via `graphileBuildOptions` (called `graphqlBuildOptions` in PostGraphile 4.0.0-alpha2.20 and earlier):
179
179
180
+
### connectionFilterAllowedOperators
181
+
182
+
Restrict filtering to specific operators
183
+
```js
184
+
postgraphile(pgConfig, schema, {
185
+
graphileBuildOptions: {
186
+
connectionFilterAllowedOperators: [
187
+
"null",
188
+
"equalTo",
189
+
"notEqualTo",
190
+
"distinctFrom",
191
+
"notDistinctFrom",
192
+
"lessThan",
193
+
"lessThanOrEqualTo",
194
+
"greaterThan",
195
+
"greaterThanOrEqualTo",
196
+
"in",
197
+
"notIn",
198
+
],
199
+
},
200
+
})
201
+
```
202
+
203
+
For a full list of the available operators, see the Comparison Operators table above.
To add/remove/modify individual operators, you can edit src/PgConnectionArgFilterOperatorsPlugin.js.
243
-
244
266
## Development
245
267
246
268
To establish a test environment, create an empty Postgres database (e.g. `graphile_build_test`) and set a `TEST_DATABASE_URL` environment variable with your connection string (e.g. `postgres://localhost:5432/graphile_build_test`). Ensure that `psql` is installed locally and then run:
0 commit comments