File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -193,3 +193,24 @@ export const comparisonOfDateTimeFilter = (
193
193
? ( ...args ) => comparators . map ( ( comp ) => comp ( ...args ) ) . join ( ' AND ' )
194
194
: undefined ;
195
195
} ;
196
+
197
+ export const sub =
198
+ < Input extends Record < string , any > > (
199
+ subBuilder : ( ) => ( input : Partial < Input > ) => ( q : Query ) => void ,
200
+ ) =>
201
+ <
202
+ // TODO this doesn't enforce Input type on Outer property
203
+ K extends string ,
204
+ Outer extends Partial < Record < K , Partial < Input > > > ,
205
+ > (
206
+ matchSubNode : ( sub : Query ) => Query ,
207
+ ) : Builder < Outer , K > =>
208
+ ( { key, value, query } ) =>
209
+ query
210
+ . subQuery ( 'node' , ( sub ) =>
211
+ sub
212
+ . apply ( matchSubNode )
213
+ . apply ( subBuilder ( ) ( value ) )
214
+ . return ( `true as ${ key } FiltersApplied` ) ,
215
+ )
216
+ . with ( '*' ) ;
You can’t perform that action at this time.
0 commit comments