Skip to content

Commit de48aa8

Browse files
committed
Restore old code order
1 parent 79488b0 commit de48aa8

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/PgConnectionArgFilterAttributesPlugin.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,37 @@ export const PgConnectionArgFilterAttributesPlugin: GraphileConfig.Plugin = {
7474
description: `Filter by the object’s \`${fieldName}\` field.`,
7575
type: OperatorsType,
7676
apply: EXPORTABLE(
77-
(PgCondition, colSpec, connectionFilterAllowEmptyObjectInput, connectionFilterAllowNullInput, isEmpty) => function (
77+
(
78+
PgCondition,
79+
colSpec,
80+
connectionFilterAllowEmptyObjectInput,
81+
connectionFilterAllowNullInput,
82+
isEmpty
83+
) =>
84+
function (
7885
queryBuilder: PgConditionCapableParent,
7986
value: unknown
8087
) {
8188
if (value === undefined) {
8289
return;
8390
}
84-
if (!connectionFilterAllowNullInput && value === null) {
91+
if (
92+
!connectionFilterAllowEmptyObjectInput &&
93+
isEmpty(value)
94+
) {
8595
throw Object.assign(
8696
new Error(
87-
"Null literals are forbidden in filter argument input."
97+
"Empty objects are forbidden in filter argument input."
8898
),
8999
{
90100
//TODO: mark this error as safe
91101
}
92102
);
93103
}
94-
if (
95-
!connectionFilterAllowEmptyObjectInput &&
96-
isEmpty(value)
97-
) {
104+
if (!connectionFilterAllowNullInput && value === null) {
98105
throw Object.assign(
99106
new Error(
100-
"Empty objects are forbidden in filter argument input."
107+
"Null literals are forbidden in filter argument input."
101108
),
102109
{
103110
//TODO: mark this error as safe
@@ -108,7 +115,13 @@ export const PgConnectionArgFilterAttributesPlugin: GraphileConfig.Plugin = {
108115
condition.extensions.pgFilterAttribute = colSpec;
109116
return condition;
110117
},
111-
[PgCondition, colSpec, connectionFilterAllowEmptyObjectInput, connectionFilterAllowNullInput, isEmpty]
118+
[
119+
PgCondition,
120+
colSpec,
121+
connectionFilterAllowEmptyObjectInput,
122+
connectionFilterAllowNullInput,
123+
isEmpty,
124+
]
112125
),
113126
})
114127
),

0 commit comments

Comments
 (0)