1
1
import { CompositeOperator } from '../core/filter' ;
2
2
3
3
import {
4
- And as AndFunction ,
4
+ And , Avg , Expr , Field ,
5
5
FilterExpr ,
6
- Or as OrFunction
6
+ Or , Sum
7
7
} from './expressions' ;
8
+
8
9
import {
9
10
QueryCompositeFilterConstraint ,
10
11
QueryConstraint ,
11
12
QueryFilterConstraint ,
12
13
validateQueryFilterConstraint
13
14
} from './query' ;
15
+ import { FieldPath } from "./field_path" ;
16
+ import { AggregateField } from "./aggregate_types" ;
17
+ import { fieldPathFromArgument } from "./user_data_reader" ;
14
18
15
19
/**
16
20
* @beta
@@ -27,7 +31,7 @@ import {
27
31
* @param right Additional filter conditions to 'OR' together.
28
32
* @return A new {@code Expr} representing the logical 'OR' operation.
29
33
*/
30
- export function or ( left : FilterExpr , ...right : FilterExpr [ ] ) : OrFunction ;
34
+ export function or ( left : FilterExpr , ...right : FilterExpr [ ] ) : Or ;
31
35
32
36
/**
33
37
* Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
@@ -46,23 +50,22 @@ export function or(
46
50
export function or (
47
51
leftFilterExprOrQueryConstraint ?: FilterExpr | QueryFilterConstraint ,
48
52
...right : FilterExpr [ ] | QueryFilterConstraint [ ]
49
- ) : OrFunction | QueryCompositeFilterConstraint {
53
+ ) : Or | QueryCompositeFilterConstraint {
50
54
if ( leftFilterExprOrQueryConstraint === undefined ) {
51
55
return or . _orFilters ( ) ;
52
56
}
53
- if (
57
+ else if (
54
58
leftFilterExprOrQueryConstraint instanceof QueryConstraint ||
59
+ leftFilterExprOrQueryConstraint instanceof QueryCompositeFilterConstraint ||
55
60
leftFilterExprOrQueryConstraint === undefined
56
61
) {
57
62
return or . _orFilters (
58
63
leftFilterExprOrQueryConstraint ,
59
64
...( right as QueryFilterConstraint [ ] )
60
65
) ;
61
66
} else {
62
- return or . _orFunction (
63
- leftFilterExprOrQueryConstraint as FilterExpr ,
64
- ...( right as FilterExpr [ ] )
65
- ) ;
67
+ // @ts -ignore
68
+ return or . _orFunction ( leftFilterExprOrQueryConstraint , ...( right ) ) ;
66
69
}
67
70
}
68
71
@@ -83,7 +86,7 @@ or._orFilters = function (
83
86
or . _orFunction = function (
84
87
left : FilterExpr ,
85
88
...right : FilterExpr [ ]
86
- ) : OrFunction {
89
+ ) : Or {
87
90
throw new Error (
88
91
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
89
92
) ;
@@ -104,7 +107,7 @@ or._orFunction = function (
104
107
* @param right Additional filter conditions to 'AND' together.
105
108
* @return A new {@code Expr} representing the logical 'AND' operation.
106
109
*/
107
- export function and ( left : FilterExpr , ...right : FilterExpr [ ] ) : AndFunction ;
110
+ export function and ( left : FilterExpr , ...right : FilterExpr [ ] ) : And ;
108
111
109
112
/**
110
113
* Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
@@ -123,7 +126,7 @@ export function and(
123
126
export function and (
124
127
leftFilterExprOrQueryConstraint ?: FilterExpr | QueryFilterConstraint ,
125
128
...right : FilterExpr [ ] | QueryFilterConstraint [ ]
126
- ) : AndFunction | QueryCompositeFilterConstraint {
129
+ ) : And | QueryCompositeFilterConstraint {
127
130
if ( leftFilterExprOrQueryConstraint === undefined ) {
128
131
return and . _andFilters ( ) ;
129
132
}
@@ -160,7 +163,7 @@ and._andFilters = function (
160
163
and . _andFunction = function (
161
164
left : FilterExpr ,
162
165
...right : FilterExpr [ ]
163
- ) : AndFunction {
166
+ ) : And {
164
167
throw new Error (
165
168
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
166
169
) ;
0 commit comments