Skip to content

Commit df0918a

Browse files
authored
Merge pull request #996 from constructive-io/feat/scrub-stale-filter-arg-comments
chore: scrub stale `filter` argument references in comments/errors
2 parents 875fb9c + ffefcf0 commit df0918a

11 files changed

Lines changed: 32 additions & 29 deletions

graphile/graphile-connection-filter/src/plugins/ConnectionFilterArgPlugin.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ const version = '1.0.0';
77
/**
88
* ConnectionFilterArgPlugin
99
*
10-
* Adds the filter argument (configurable name, default 'where') to connection
11-
* and simple collection fields. Uses `applyPlan` to create a PgCondition that
12-
* child filter fields can add WHERE clauses to.
10+
* Adds the `where` argument (name configurable via
11+
* `connectionFilterArgumentName`, default `'where'`) to connection and
12+
* simple collection fields. Uses `applyPlan` to create a PgCondition
13+
* that child filter fields can add WHERE clauses to.
1314
*
1415
* This runs before PgConnectionArgOrderByPlugin so that filters are applied
1516
* before ordering (important for e.g. full-text search rank ordering).
1617
*/
1718
export const ConnectionFilterArgPlugin: GraphileConfig.Plugin = {
1819
name: 'ConnectionFilterArgPlugin',
1920
version,
20-
description: 'Adds the filter argument to connection and list fields',
21+
description: 'Adds the `where` argument to connection and list fields',
2122
before: ['PgConnectionArgOrderByPlugin'],
2223

2324
schema: {
@@ -100,7 +101,7 @@ export const ConnectionFilterArgPlugin: GraphileConfig.Plugin = {
100101
fieldArg.apply(
101102
$pgSelect,
102103
(queryBuilder: any, value: any) => {
103-
// If filter is null/undefined or empty {}, treat as "no filter" — skip
104+
// If where is null/undefined or empty {}, treat as "no filter" — skip
104105
if (value == null || isEmpty(value)) return;
105106
const condition = new PgCondition(queryBuilder);
106107
if (attributeCodec) {
@@ -126,7 +127,7 @@ export const ConnectionFilterArgPlugin: GraphileConfig.Plugin = {
126127
fieldArg.apply(
127128
$pgSelect,
128129
(queryBuilder: any, value: any) => {
129-
// If filter is null/undefined or empty {}, treat as "no filter" — skip
130+
// If where is null/undefined or empty {}, treat as "no filter" — skip
130131
if (value == null || isEmpty(value)) return;
131132
const condition = new PgCondition(queryBuilder);
132133
if (attributeCodec) {
@@ -143,7 +144,7 @@ export const ConnectionFilterArgPlugin: GraphileConfig.Plugin = {
143144
}),
144145
},
145146
},
146-
`Adding connection filter '${argName}' arg to field '${fieldName}' of '${Self.name}'`
147+
`Adding connection where arg '${argName}' to field '${fieldName}' of '${Self.name}'`
147148
);
148149
},
149150
},

graphile/graphile-connection-filter/src/plugins/ConnectionFilterAttributesPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const ConnectionFilterAttributesPlugin: GraphileConfig.Plugin = {
9696
if (isEmpty(value)) {
9797
throw Object.assign(
9898
new Error(
99-
'Empty objects are forbidden in filter argument input.'
99+
'Empty objects are forbidden in where argument input.'
100100
),
101101
{}
102102
);
@@ -107,7 +107,7 @@ export const ConnectionFilterAttributesPlugin: GraphileConfig.Plugin = {
107107
) {
108108
throw Object.assign(
109109
new Error(
110-
'Null literals are forbidden in filter argument input.'
110+
'Null literals are forbidden in where argument input.'
111111
),
112112
{}
113113
);

graphile/graphile-connection-filter/src/plugins/ConnectionFilterBackwardRelationsPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ const version = '1.0.0';
1515
*
1616
* For unique backward relations (one-to-one), a single filter field is added:
1717
* ```graphql
18-
* allClients(filter: {
18+
* allClients(where: {
1919
* profileByClientId: { bio: { includes: "engineer" } }
2020
* }) { ... }
2121
* ```
2222
*
2323
* For non-unique backward relations (one-to-many), a "many" filter type is added
2424
* with `some`, `every`, and `none` sub-fields:
2525
* ```graphql
26-
* allClients(filter: {
26+
* allClients(where: {
2727
* ordersByClientId: { some: { total: { greaterThan: 1000 } } }
2828
* }) { ... }
2929
* ```

graphile/graphile-connection-filter/src/plugins/ConnectionFilterComputedAttributesPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const version = '1.0.0';
1818
*
1919
* This plugin adds a `fullName` filter field to `PersonFilter`, typed as `StringFilter`,
2020
* allowing queries like:
21-
* { people(filter: { fullName: { startsWith: "John" } }) { ... } }
21+
* { people(where: { fullName: { startsWith: "John" } }) { ... } }
2222
*
2323
* Controlled by the `connectionFilterComputedColumns` schema option (default: true).
2424
* Requires the `filterBy` behavior on the pgResource to be enabled.

graphile/graphile-connection-filter/src/plugins/ConnectionFilterForwardRelationsPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const version = '1.0.0';
1818
* allowing queries like:
1919
*
2020
* ```graphql
21-
* allOrders(filter: {
21+
* allOrders(where: {
2222
* clientByClientId: { name: { startsWith: "Acme" } }
2323
* }) { ... }
2424
* ```

graphile/graphile-connection-filter/src/plugins/operatorApply.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function makeApplyFromOperatorSpec(
8383
}
8484
if (!connectionFilterAllowNullInput && value === null) {
8585
throw Object.assign(
86-
new Error('Null literals are forbidden in filter argument input.'),
86+
new Error('Null literals are forbidden in where argument input.'),
8787
{}
8888
);
8989
}

graphile/graphile-connection-filter/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ export function makeAssertAllowed(build: any): (value: unknown, mode: 'object' |
116116
isEmpty: (o: unknown) => boolean
117117
) =>
118118
function (value: unknown, mode: 'object' | 'list') {
119-
// Reject empty objects in nested filter contexts (and/or/not, relation filters)
119+
// Reject empty objects in nested where contexts (and/or/not, relation filters)
120120
if (mode === 'object' && isEmpty(value)) {
121121
throw Object.assign(
122122
new Error(
123-
'Empty objects are forbidden in filter argument input.'
123+
'Empty objects are forbidden in where argument input.'
124124
),
125125
{}
126126
);
@@ -134,7 +134,7 @@ export function makeAssertAllowed(build: any): (value: unknown, mode: 'object' |
134134
if (isEmpty(arr[i])) {
135135
throw Object.assign(
136136
new Error(
137-
'Empty objects are forbidden in filter argument input.'
137+
'Empty objects are forbidden in where argument input.'
138138
),
139139
{}
140140
);
@@ -147,7 +147,7 @@ export function makeAssertAllowed(build: any): (value: unknown, mode: 'object' |
147147
if (!connectionFilterAllowNullInput && value === null) {
148148
throw Object.assign(
149149
new Error(
150-
'Null literals are forbidden in filter argument input.'
150+
'Null literals are forbidden in where argument input.'
151151
),
152152
{}
153153
);

graphile/graphile-postgis/src/plugins/spatial-relations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import type { PostgisExtensionInfo } from './detect-extension';
4646
* Generated GraphQL (for the `st_dwithin` case):
4747
*
4848
* ```graphql
49-
* telemedicineClinics(filter: {
49+
* telemedicineClinics(where: {
5050
* nearbyClinic: {
5151
* distance: 5000,
5252
* some: { specialty: { eq: "pediatrics" } }

graphile/graphile-settings/__tests__/preset-integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('Schema introspection', () => {
131131
expect(fieldNames).toContain('embedding');
132132
});
133133

134-
it('locations connection exists and has filter argument but no condition', async () => {
134+
it('locations connection exists and has where argument but no condition', async () => {
135135
const result = await query<{ __type: { fields: { name: string; args: { name: string }[] }[] } | null }>({
136136
query: `
137137
query {

graphile/graphile-settings/src/plugins/enable-all-filter-columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import type { GraphileConfig } from 'graphile-config';
3939
* and adds `+attribute:filterBy` and `+attribute:orderBy` back to ALL columns, regardless of index status.
4040
*
4141
* This means:
42-
* - All columns will appear in the connection filter's filter argument
42+
* - All columns will appear in the connection filter's `where` argument
4343
* - All columns will appear in the connection's orderBy enum
4444
* - Developers can filter and sort by any column
4545
* - It's the developer's/DBA's responsibility to add indexes for frequently filtered/sorted columns

0 commit comments

Comments
 (0)