11import { CompositeOperator } from '../core/filter' ;
22
33import {
4- And as AndFunction ,
4+ And , Avg , Expr , Field ,
55 FilterExpr ,
6- Or as OrFunction
6+ Or , Sum
77} from './expressions' ;
8+
89import {
910 QueryCompositeFilterConstraint ,
1011 QueryConstraint ,
1112 QueryFilterConstraint ,
1213 validateQueryFilterConstraint
1314} from './query' ;
15+ import { FieldPath } from "./field_path" ;
16+ import { AggregateField } from "./aggregate_types" ;
17+ import { fieldPathFromArgument } from "./user_data_reader" ;
1418
1519/**
1620 * @beta
@@ -27,7 +31,7 @@ import {
2731 * @param right Additional filter conditions to 'OR' together.
2832 * @return A new {@code Expr} representing the logical 'OR' operation.
2933 */
30- export function or ( left : FilterExpr , ...right : FilterExpr [ ] ) : OrFunction ;
34+ export function or ( left : FilterExpr , ...right : FilterExpr [ ] ) : Or ;
3135
3236/**
3337 * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
@@ -46,23 +50,22 @@ export function or(
4650export function or (
4751 leftFilterExprOrQueryConstraint ?: FilterExpr | QueryFilterConstraint ,
4852 ...right : FilterExpr [ ] | QueryFilterConstraint [ ]
49- ) : OrFunction | QueryCompositeFilterConstraint {
53+ ) : Or | QueryCompositeFilterConstraint {
5054 if ( leftFilterExprOrQueryConstraint === undefined ) {
5155 return or . _orFilters ( ) ;
5256 }
53- if (
57+ else if (
5458 leftFilterExprOrQueryConstraint instanceof QueryConstraint ||
59+ leftFilterExprOrQueryConstraint instanceof QueryCompositeFilterConstraint ||
5560 leftFilterExprOrQueryConstraint === undefined
5661 ) {
5762 return or . _orFilters (
5863 leftFilterExprOrQueryConstraint ,
5964 ...( right as QueryFilterConstraint [ ] )
6065 ) ;
6166 } else {
62- return or . _orFunction (
63- leftFilterExprOrQueryConstraint as FilterExpr ,
64- ...( right as FilterExpr [ ] )
65- ) ;
67+ // @ts -ignore
68+ return or . _orFunction ( leftFilterExprOrQueryConstraint , ...( right ) ) ;
6669 }
6770}
6871
@@ -83,7 +86,7 @@ or._orFilters = function (
8386or . _orFunction = function (
8487 left : FilterExpr ,
8588 ...right : FilterExpr [ ]
86- ) : OrFunction {
89+ ) : Or {
8790 throw new Error (
8891 'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
8992 ) ;
@@ -104,7 +107,7 @@ or._orFunction = function (
104107 * @param right Additional filter conditions to 'AND' together.
105108 * @return A new {@code Expr} representing the logical 'AND' operation.
106109 */
107- export function and ( left : FilterExpr , ...right : FilterExpr [ ] ) : AndFunction ;
110+ export function and ( left : FilterExpr , ...right : FilterExpr [ ] ) : And ;
108111
109112/**
110113 * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
@@ -123,7 +126,7 @@ export function and(
123126export function and (
124127 leftFilterExprOrQueryConstraint ?: FilterExpr | QueryFilterConstraint ,
125128 ...right : FilterExpr [ ] | QueryFilterConstraint [ ]
126- ) : AndFunction | QueryCompositeFilterConstraint {
129+ ) : And | QueryCompositeFilterConstraint {
127130 if ( leftFilterExprOrQueryConstraint === undefined ) {
128131 return and . _andFilters ( ) ;
129132 }
@@ -160,7 +163,7 @@ and._andFilters = function (
160163and . _andFunction = function (
161164 left : FilterExpr ,
162165 ...right : FilterExpr [ ]
163- ) : AndFunction {
166+ ) : And {
164167 throw new Error (
165168 'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
166169 ) ;
0 commit comments