@@ -25,23 +25,25 @@ Also see the [Production Considerations](https://www.graphile.org/postgraphile/p
2525
2626### CLI
2727
28- ``` bash
29- postgraphile --append-plugins ` pwd` /path/to/this/plugin/index.js
28+ ``` bash
29+ yarn add postgraphile
30+ yarn add postgraphile-plugin-connection-filter
31+ npx postgraphile --append-plugins postgraphile-plugin-connection-filter
3032```
3133
3234### Library
3335
34- ``` js
36+ ``` js
3537const express = require (" express" );
3638const { postgraphile } = require (" postgraphile" );
37- const PostGraphileConnectionFilterPlugin = require (" postgraphile-plugin-connection-filter" );
39+ const ConnectionFilterPlugin = require (" postgraphile-plugin-connection-filter" );
3840
3941const app = express ();
4042
4143app .use (
4244 postgraphile (pgConfig, schema, {
4345 graphiql: true ,
44- appendPlugins: [PostGraphileConnectionFilterPlugin ],
46+ appendPlugins: [ConnectionFilterPlugin ],
4547 })
4648);
4749
@@ -131,7 +133,7 @@ The following filter operators are exposed by default:
131133
132134<summary >Null values</summary >
133135
134- ``` graphql
136+ ``` graphql
135137query {
136138 allPosts (filter : {
137139 body : { isNull : true }
@@ -147,7 +149,7 @@ query {
147149
148150<summary >Non-null values</summary >
149151
150- ``` graphql
152+ ``` graphql
151153query {
152154 allPosts (filter : {
153155 body : { isNull : false }
@@ -163,7 +165,7 @@ query {
163165
164166<summary >Comparison operator with scalar input</summary >
165167
166- ``` graphql
168+ ``` graphql
167169query {
168170 allPosts (filter : {
169171 createdAt : { greaterThan : " 2016-01-01" }
@@ -179,7 +181,7 @@ query {
179181
180182<summary >Comparison operator with array input</summary >
181183
182- ``` graphql
184+ ``` graphql
183185query {
184186 allPosts (filter : {
185187 authorId : { in : [1 , 2 ] }
@@ -197,7 +199,7 @@ query {
197199
198200Note: Objects with multiple keys are interpreted with an implicit ` AND ` between the conditions.
199201
200- ``` graphql
202+ ``` graphql
201203query {
202204 allPosts (filter : {
203205 body : { isNull : false },
@@ -214,7 +216,7 @@ query {
214216
215217<summary >Logical operator</summary >
216218
217- ``` graphql
219+ ``` graphql
218220query {
219221 allPosts (filter : {
220222 or : [
@@ -233,7 +235,7 @@ query {
233235
234236<summary >Compound logic</summary >
235237
236- ``` graphql
238+ ``` graphql
237239query {
238240 allPosts (filter : {
239241 not : {
@@ -254,7 +256,7 @@ query {
254256
255257<summary >Relations: Nested</summary >
256258
257- ``` graphql
259+ ``` graphql
258260query {
259261 allPeople (filter : {
260262 firstName : { startsWith :"John" }
@@ -282,7 +284,7 @@ query {
282284
283285> Requires ` connectionFilterRelations: true `
284286
285- ``` graphql
287+ ``` graphql
286288query {
287289 allPosts (filter : {
288290 personByAuthorId : { createdAt : { greaterThan : " 2018-01-01" } }
@@ -300,7 +302,7 @@ query {
300302
301303> Requires ` connectionFilterRelations: true `
302304
303- ``` graphql
305+ ``` graphql
304306query {
305307 allPeople (filter : {
306308 accountByPersonId : { status : { equalTo : ACTIVE } }
@@ -332,7 +334,7 @@ When using PostGraphile as a library, the following plugin options can be passed
332334
333335Restrict filtering to specific operators:
334336
335- ``` js
337+ ``` js
336338postgraphile (pgConfig, schema, {
337339 graphileBuildOptions: {
338340 connectionFilterAllowedOperators: [
@@ -362,7 +364,7 @@ For a full list of the available operators, see the Comparison Operators table a
362364
363365Restrict filtering to specific field types:
364366
365- ``` js
367+ ``` js
366368postgraphile (pgConfig, schema, {
367369 graphileBuildOptions: {
368370 connectionFilterAllowedFieldTypes: [" String" , " Int" ],
@@ -378,9 +380,11 @@ The available field types will depend on your database schema.
378380
379381<summary >connectionFilterComputedColumns</summary >
380382
383+ TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
384+
381385Enable/disable filtering by computed columns:
382386
383- ``` js
387+ ``` js
384388postgraphile (pgConfig, schema, {
385389 graphileBuildOptions: {
386390 connectionFilterComputedColumns: false , // default: true
@@ -394,9 +398,11 @@ postgraphile(pgConfig, schema, {
394398
395399<summary >connectionFilterLists</summary >
396400
401+ TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
402+
397403Enable/disable filtering on List fields:
398404
399- ``` js
405+ ``` js
400406postgraphile (pgConfig, schema, {
401407 graphileBuildOptions: {
402408 connectionFilterLists: false , // default: true
@@ -412,7 +418,7 @@ postgraphile(pgConfig, schema, {
412418
413419Use alternative names (e.g. ` eq ` , ` ne ` ) for operators:
414420
415- ``` js
421+ ``` js
416422postgraphile (pgConfig, schema, {
417423 graphileBuildOptions: {
418424 connectionFilterOperatorNames: {
@@ -431,7 +437,7 @@ postgraphile(pgConfig, schema, {
431437
432438Enable/disable filtering on related fields:
433439
434- ``` js
440+ ``` js
435441postgraphile (pgConfig, schema, {
436442 graphileBuildOptions: {
437443 connectionFilterRelations: true , // default: false
@@ -445,9 +451,11 @@ postgraphile(pgConfig, schema, {
445451
446452<summary >connectionFilterSetofFunctions</summary >
447453
454+ TODO: VERIFY THAT THE TEST FOR THIS IS ACTUALLY WORKING!
455+
448456Enable/disable filtering on functions that return ` setof ` :
449457
450- ``` js
458+ ``` js
451459postgraphile (pgConfig, schema, {
452460 graphileBuildOptions: {
453461 connectionFilterSetofFunctions: false , // default: true
@@ -463,7 +471,7 @@ postgraphile(pgConfig, schema, {
463471
464472Allow/forbid ` null ` literals in input:
465473
466- ``` js
474+ ``` js
467475postgraphile (pgConfig, schema, {
468476 graphileBuildOptions: {
469477 connectionFilterAllowNullInput: true , // default: false
@@ -482,7 +490,7 @@ When `true`, passing `null` as a field value is equivalent to omitting the field
482490
483491Allow/forbid empty objects (` {} ` ) in input:
484492
485- ``` js
493+ ``` js
486494postgraphile (pgConfig, schema, {
487495 graphileBuildOptions: {
488496 connectionFilterAllowEmptyObjectInput: true , // default: false
@@ -498,7 +506,7 @@ When `true`, passing `{}` as a field value is equivalent to omitting the field.
498506## Development
499507
500508To 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:
501- ``` bash
509+ ``` bash
502510yarn
503511npm run test
504512```
0 commit comments