graphile-plugin-connection-filter 2.3.2 โ 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -28
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,27 +16,40 @@
|
|
|
16
16
|
</a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**`graphile-plugin-connection-filter`** adds a powerful suite of filtering capabilities to PostGraphile schemas.
|
|
20
20
|
|
|
21
21
|
> **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/graphile-plugin-connection-filter#performance-and-security) section below for details.
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## ๐ Installation
|
|
24
24
|
|
|
25
25
|
Requires PostGraphile v4.5.0 or higher.
|
|
26
26
|
|
|
27
27
|
Install with:
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
|
|
30
|
+
pnpm add postgraphile graphile-plugin-connection-filter
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## โจ Features
|
|
34
|
+
|
|
35
|
+
This plugin supports filtering on almost all PostgreSQL types, including complex types such as domains, ranges, arrays, and composite types. For details on the specific operators supported for each type, see [docs/operators.md](https://github.com/graphile-contrib/graphile-plugin-connection-filter/blob/master/docs/operators.md).
|
|
36
|
+
|
|
37
|
+
See also:
|
|
38
|
+
|
|
39
|
+
- [@graphile/pg-aggregates](https://github.com/graphile/pg-aggregates) - integrates with this plugin to enable powerful aggregate filtering
|
|
40
|
+
- [graphile-plugin-connection-filter-postgis](https://github.com/launchql/launchql/tree/main/graphile/graphile-plugin-connection-filter-postgis) - adds PostGIS functions and operators for filtering on `geography`/`geometry` columns
|
|
41
|
+
- [postgraphile-plugin-fulltext-filter](https://github.com/mlipscombe/postgraphile-plugin-fulltext-filter) - adds a full text search operator for filtering on `tsvector` columns
|
|
42
|
+
- [postgraphile-plugin-unaccented-text-search-filter](https://github.com/spacefill/postgraphile-plugin-unaccented-text-search-filter) - adds unaccent text search operators
|
|
43
|
+
|
|
44
|
+
## ๐ฆ Usage
|
|
45
|
+
|
|
46
|
+
### CLI usage via `--append-plugins`:
|
|
34
47
|
|
|
35
48
|
```
|
|
36
49
|
postgraphile --append-plugins graphile-plugin-connection-filter -c postgres://localhost/my_db ...
|
|
37
50
|
```
|
|
38
51
|
|
|
39
|
-
Library usage via `appendPlugins`:
|
|
52
|
+
### Library usage via `appendPlugins`:
|
|
40
53
|
|
|
41
54
|
```ts
|
|
42
55
|
import ConnectionFilterPlugin from "graphile-plugin-connection-filter";
|
|
@@ -47,7 +60,7 @@ const middleware = postgraphile(DATABASE_URL, SCHEMAS, {
|
|
|
47
60
|
});
|
|
48
61
|
```
|
|
49
62
|
|
|
50
|
-
## Performance and Security
|
|
63
|
+
## โ ๏ธ Performance and Security
|
|
51
64
|
|
|
52
65
|
By default, this plugin:
|
|
53
66
|
|
|
@@ -65,24 +78,13 @@ To protect your server, you can:
|
|
|
65
78
|
|
|
66
79
|
Also see the [Production Considerations](https://www.graphile.org/postgraphile/production) page of the official PostGraphile docs, which discusses query whitelisting.
|
|
67
80
|
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
This plugin supports filtering on almost all PostgreSQL types, including complex types such as domains, ranges, arrays, and composite types. For details on the specific operators supported for each type, see [docs/operators.md](https://github.com/graphile-contrib/graphile-plugin-connection-filter/blob/master/docs/operators.md).
|
|
71
|
-
|
|
72
|
-
See also:
|
|
73
|
-
|
|
74
|
-
- [@graphile/pg-aggregates](https://github.com/graphile/pg-aggregates) - integrates with this plugin to enable powerful aggregate filtering
|
|
75
|
-
- [graphile-plugin-connection-filter-postgis](https://github.com/launchql/launchql/tree/main/graphile/graphile-plugin-connection-filter-postgis) - adds PostGIS functions and operators for filtering on `geography`/`geometry` columns
|
|
76
|
-
- [postgraphile-plugin-fulltext-filter](https://github.com/mlipscombe/postgraphile-plugin-fulltext-filter) - adds a full text search operator for filtering on `tsvector` columns
|
|
77
|
-
- [postgraphile-plugin-unaccented-text-search-filter](https://github.com/spacefill/postgraphile-plugin-unaccented-text-search-filter) - adds unaccent text search operators
|
|
78
|
-
|
|
79
|
-
## Handling `null` and empty objects
|
|
81
|
+
## ๐ฆ Handling `null` and empty objects
|
|
80
82
|
|
|
81
83
|
By default, this plugin will throw an error when `null` literals or empty objects (`{}`) are included in `filter` input objects. This prevents queries with ambiguous semantics such as `filter: { field: null }` and `filter: { field: { equalTo: null } }` from returning unexpected results. For background on this decision, see https://github.com/graphile-contrib/graphile-plugin-connection-filter/issues/58.
|
|
82
84
|
|
|
83
85
|
To allow `null` and `{}` in inputs, use the `connectionFilterAllowNullInput` and `connectionFilterAllowEmptyObjectInput` options documented under [Plugin Options](https://github.com/graphile-contrib/graphile-plugin-connection-filter#plugin-options). Please note that even with `connectionFilterAllowNullInput` enabled, `null` is never interpreted as a SQL `NULL`; fields with `null` values are simply ignored when resolving the query.
|
|
84
86
|
|
|
85
|
-
## Plugin Options
|
|
87
|
+
## ๐ง Plugin Options
|
|
86
88
|
|
|
87
89
|
When using PostGraphile as a library, the following plugin options can be passed via `graphileBuildOptions`:
|
|
88
90
|
|
|
@@ -265,7 +267,7 @@ postgraphile(pgConfig, schema, {
|
|
|
265
267
|
});
|
|
266
268
|
```
|
|
267
269
|
|
|
268
|
-
## Examples
|
|
270
|
+
## ๐งช Examples
|
|
269
271
|
|
|
270
272
|
```graphql
|
|
271
273
|
query {
|
|
@@ -279,15 +281,11 @@ query {
|
|
|
279
281
|
|
|
280
282
|
For an extensive set of examples, see [docs/examples.md](https://github.com/graphile-contrib/graphile-plugin-connection-filter/blob/master/docs/examples.md).
|
|
281
283
|
|
|
282
|
-
##
|
|
283
|
-
|
|
284
|
-
To establish a test environment, create an empty PostgreSQL database with C collation (required for consistent ordering of strings) and set a `TEST_DATABASE_URL` environment variable with your database connection string.
|
|
284
|
+
## ๐งช Testing
|
|
285
285
|
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
yarn
|
|
290
|
-
yarn test
|
|
286
|
+
```sh
|
|
287
|
+
# requires a local Postgres available (defaults to postgres/password@localhost:5432)
|
|
288
|
+
pnpm --filter graphile-plugin-connection-filter test
|
|
291
289
|
```
|
|
292
290
|
|
|
293
291
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-plugin-connection-filter",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Filtering on PostGraphile connections",
|
|
5
5
|
"author": "Matt Bretl",
|
|
6
6
|
"homepage": "https://github.com/launchql/launchql",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@graphile-contrib/pg-simplify-inflector": "^6.1.0",
|
|
51
51
|
"@types/pg": "^8.15.6",
|
|
52
|
-
"graphile-test": "^2.8.
|
|
52
|
+
"graphile-test": "^2.8.11",
|
|
53
53
|
"makage": "^0.1.6",
|
|
54
54
|
"pg": "^8.16.0",
|
|
55
|
-
"pgsql-test": "^2.14.
|
|
55
|
+
"pgsql-test": "^2.14.14"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "00c90828cab8d3e306ebb2bc6053aab4aa9ae807"
|
|
58
58
|
}
|