graphile-plugin-connection-filter 2.3.1 โ 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 +32 -30
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,31 +8,48 @@
|
|
|
8
8
|
<a href="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml">
|
|
9
9
|
<img height="20" src="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<a href="https://github.com/launchql/launchql/blob/main/LICENSE">
|
|
12
|
+
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/graphile-plugin-connection-filter">
|
|
15
|
+
<img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql?filename=graphile%2Fgraphile-plugin-connection-filter%2Fpackage.json"/>
|
|
16
|
+
</a>
|
|
13
17
|
</p>
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
**`graphile-plugin-connection-filter`** adds a powerful suite of filtering capabilities to PostGraphile schemas.
|
|
16
20
|
|
|
17
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.
|
|
18
22
|
|
|
19
|
-
##
|
|
23
|
+
## ๐ Installation
|
|
20
24
|
|
|
21
25
|
Requires PostGraphile v4.5.0 or higher.
|
|
22
26
|
|
|
23
27
|
Install with:
|
|
24
28
|
|
|
25
29
|
```
|
|
26
|
-
|
|
30
|
+
pnpm add postgraphile graphile-plugin-connection-filter
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
|
|
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`:
|
|
30
47
|
|
|
31
48
|
```
|
|
32
49
|
postgraphile --append-plugins graphile-plugin-connection-filter -c postgres://localhost/my_db ...
|
|
33
50
|
```
|
|
34
51
|
|
|
35
|
-
Library usage via `appendPlugins`:
|
|
52
|
+
### Library usage via `appendPlugins`:
|
|
36
53
|
|
|
37
54
|
```ts
|
|
38
55
|
import ConnectionFilterPlugin from "graphile-plugin-connection-filter";
|
|
@@ -43,7 +60,7 @@ const middleware = postgraphile(DATABASE_URL, SCHEMAS, {
|
|
|
43
60
|
});
|
|
44
61
|
```
|
|
45
62
|
|
|
46
|
-
## Performance and Security
|
|
63
|
+
## โ ๏ธ Performance and Security
|
|
47
64
|
|
|
48
65
|
By default, this plugin:
|
|
49
66
|
|
|
@@ -61,24 +78,13 @@ To protect your server, you can:
|
|
|
61
78
|
|
|
62
79
|
Also see the [Production Considerations](https://www.graphile.org/postgraphile/production) page of the official PostGraphile docs, which discusses query whitelisting.
|
|
63
80
|
|
|
64
|
-
##
|
|
65
|
-
|
|
66
|
-
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).
|
|
67
|
-
|
|
68
|
-
See also:
|
|
69
|
-
|
|
70
|
-
- [@graphile/pg-aggregates](https://github.com/graphile/pg-aggregates) - integrates with this plugin to enable powerful aggregate filtering
|
|
71
|
-
- [postgraphile-plugin-connection-filter-postgis](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter-postgis) - adds PostGIS functions and operators for filtering on `geography`/`geometry` columns
|
|
72
|
-
- [postgraphile-plugin-fulltext-filter](https://github.com/mlipscombe/postgraphile-plugin-fulltext-filter) - adds a full text search operator for filtering on `tsvector` columns
|
|
73
|
-
- [postgraphile-plugin-unaccented-text-search-filter](https://github.com/spacefill/postgraphile-plugin-unaccented-text-search-filter) - adds unaccent text search operators
|
|
74
|
-
|
|
75
|
-
## Handling `null` and empty objects
|
|
81
|
+
## ๐ฆ Handling `null` and empty objects
|
|
76
82
|
|
|
77
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.
|
|
78
84
|
|
|
79
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.
|
|
80
86
|
|
|
81
|
-
## Plugin Options
|
|
87
|
+
## ๐ง Plugin Options
|
|
82
88
|
|
|
83
89
|
When using PostGraphile as a library, the following plugin options can be passed via `graphileBuildOptions`:
|
|
84
90
|
|
|
@@ -261,7 +267,7 @@ postgraphile(pgConfig, schema, {
|
|
|
261
267
|
});
|
|
262
268
|
```
|
|
263
269
|
|
|
264
|
-
## Examples
|
|
270
|
+
## ๐งช Examples
|
|
265
271
|
|
|
266
272
|
```graphql
|
|
267
273
|
query {
|
|
@@ -275,15 +281,11 @@ query {
|
|
|
275
281
|
|
|
276
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).
|
|
277
283
|
|
|
278
|
-
##
|
|
279
|
-
|
|
280
|
-
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
|
|
281
285
|
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
yarn
|
|
286
|
-
yarn test
|
|
286
|
+
```sh
|
|
287
|
+
# requires a local Postgres available (defaults to postgres/password@localhost:5432)
|
|
288
|
+
pnpm --filter graphile-plugin-connection-filter test
|
|
287
289
|
```
|
|
288
290
|
|
|
289
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
|
}
|