@@ -112,24 +112,28 @@ export const PgConnectionArgFilterForwardRelationsPlugin: GraphileConfig.Plugin
112112 ( ) => ( {
113113 description : `Filter by the object’s \`${ fieldName } \` relation.` ,
114114 type : ForeignTableFilterType ,
115- applyPlan ( $where : PgConditionStep < any > , fieldArgs ) {
116- assertAllowed ( fieldArgs , "object" ) ;
117- const $subQuery = $where . existsPlan ( {
118- tableExpression : foreignTableExpression ,
119- alias : foreignTable . name ,
120- } ) ;
121- localAttributes . forEach ( ( localAttribute , i ) => {
122- const remoteAttribute = remoteAttributes [ i ] ;
123- $subQuery . where (
124- sql `${ $where . alias } .${ sql . identifier (
125- localAttribute as string
126- ) } = ${ $subQuery . alias } .${ sql . identifier (
127- remoteAttribute as string
128- ) } `
129- ) ;
130- } ) ;
131- fieldArgs . apply ( $subQuery ) ;
132- } ,
115+ applyPlan : build . EXPORTABLE (
116+ ( ) =>
117+ function ( $where : PgConditionStep < any > , fieldArgs ) {
118+ //assertAllowed(fieldArgs, "object");
119+ const $subQuery = $where . existsPlan ( {
120+ tableExpression : foreignTableExpression ,
121+ alias : foreignTable . name ,
122+ } ) ;
123+ localAttributes . forEach ( ( localAttribute , i ) => {
124+ const remoteAttribute = remoteAttributes [ i ] ;
125+ $subQuery . where (
126+ sql `${ $where . alias } .${ sql . identifier (
127+ localAttribute as string
128+ ) } = ${ $subQuery . alias } .${ sql . identifier (
129+ remoteAttribute as string
130+ ) } `
131+ ) ;
132+ } ) ;
133+ fieldArgs . apply ( $subQuery ) ;
134+ } ,
135+ [ ]
136+ ) ,
133137 } )
134138 ) ,
135139 } ,
@@ -154,24 +158,28 @@ export const PgConnectionArgFilterForwardRelationsPlugin: GraphileConfig.Plugin
154158 ( ) => ( {
155159 description : `A related \`${ fieldName } \` exists.` ,
156160 type : GraphQLBoolean ,
157- applyPlan ( $where : PgConditionStep < any > , fieldArgs ) {
158- assertAllowed ( fieldArgs , "scalar" ) ;
159- const $subQuery = $where . existsPlan ( {
160- tableExpression : foreignTableExpression ,
161- alias : foreignTable . name ,
162- $equals : fieldArgs . get ( ) ,
163- } ) ;
164- localAttributes . forEach ( ( localAttribute , i ) => {
165- const remoteAttribute = remoteAttributes [ i ] ;
166- $subQuery . where (
167- sql `${ $where . alias } .${ sql . identifier (
168- localAttribute as string
169- ) } = ${ $subQuery . alias } .${ sql . identifier (
170- remoteAttribute as string
171- ) } `
172- ) ;
173- } ) ;
174- } ,
161+ applyPlan : build . EXPORTABLE (
162+ ( ) =>
163+ function ( $where : PgConditionStep < any > , fieldArgs ) {
164+ //assertAllowed(fieldArgs, "scalar");
165+ const $subQuery = $where . existsPlan ( {
166+ tableExpression : foreignTableExpression ,
167+ alias : foreignTable . name ,
168+ $equals : fieldArgs . get ( ) ,
169+ } ) ;
170+ localAttributes . forEach ( ( localAttribute , i ) => {
171+ const remoteAttribute = remoteAttributes [ i ] ;
172+ $subQuery . where (
173+ sql `${ $where . alias } .${ sql . identifier (
174+ localAttribute as string
175+ ) } = ${ $subQuery . alias } .${ sql . identifier (
176+ remoteAttribute as string
177+ ) } `
178+ ) ;
179+ } ) ;
180+ } ,
181+ [ ]
182+ ) ,
175183 } )
176184 ) ,
177185 } ,
0 commit comments