File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,17 @@ import * as assert from 'assert';
13
13
14
14
// tslint:disable:no-any
15
15
16
+ const nonWhereFields = [
17
+ 'fields' ,
18
+ 'order' ,
19
+ 'limit' ,
20
+ 'skip' ,
21
+ 'offset' ,
22
+ 'include' ,
23
+ ] ;
24
+
25
+ const filterFields = [ 'where' , ...nonWhereFields ] ;
26
+
16
27
/**
17
28
* Operators for where clauses
18
29
*/
@@ -208,15 +219,6 @@ export function isFilter<MT extends object>(
208
219
candidate : any ,
209
220
) : candidate is Filter < MT > {
210
221
if ( typeof candidate !== 'object' ) return false ;
211
- const filterFields = [
212
- 'where' ,
213
- 'fields' ,
214
- 'order' ,
215
- 'limit' ,
216
- 'skip' ,
217
- 'offset' ,
218
- 'include' ,
219
- ] ;
220
222
for ( const key in candidate ) {
221
223
if ( ! filterFields . includes ( key ) ) {
222
224
return false ;
@@ -583,14 +585,6 @@ export class FilterBuilder<MT extends object = AnyObject> {
583
585
} else {
584
586
if ( isFilter ( constraint ) ) {
585
587
// throw error if imposed Filter has non-where fields
586
- const nonWhereFields = [
587
- 'fields' ,
588
- 'order' ,
589
- 'limit' ,
590
- 'skip' ,
591
- 'offset' ,
592
- 'include' ,
593
- ] ;
594
588
for ( const key of Object . keys ( constraint ) ) {
595
589
if ( nonWhereFields . includes ( key ) ) {
596
590
throw new Error (
You can’t perform that action at this time.
0 commit comments