@@ -73,7 +73,7 @@ import { FieldPath } from './field_path';
73
73
import {
74
74
validateCollectionPath ,
75
75
validateDocumentPath ,
76
- validateExactNumberOfArgs ,
76
+ validateNonEmptyArgument ,
77
77
validatePositiveNumber
78
78
} from '../../../src/util/input_validation' ;
79
79
import { newSerializer } from '../../../src/platform/serializer' ;
@@ -335,8 +335,6 @@ export function where(
335
335
opStr : WhereFilterOp ,
336
336
value : unknown
337
337
) : QueryConstraint {
338
- // TODO(firestorelite): Consider validating the enum strings (note that
339
- // TypeScript does not support passing invalid values).
340
338
const op = opStr as Operator ;
341
339
const field = fieldPathFromArgument ( 'where' , fieldPath ) ;
342
340
return new QueryFilterConstraint ( field , op , value ) ;
@@ -381,8 +379,6 @@ export function orderBy(
381
379
fieldPath : string | FieldPath ,
382
380
directionStr : OrderByDirection = 'asc'
383
381
) : QueryConstraint {
384
- // TODO(firestorelite): Consider validating the enum strings (note that
385
- // TypeScript does not support passing invalid values).
386
382
const direction = directionStr as Direction ;
387
383
const path = fieldPathFromArgument ( 'orderBy' , fieldPath ) ;
388
384
return new QueryOrderByConstraint ( path , direction ) ;
@@ -413,7 +409,7 @@ class QueryLimitConstraint extends QueryConstraint {
413
409
* @return The created `Query`.
414
410
*/
415
411
export function limit ( limit : number ) : QueryConstraint {
416
- validatePositiveNumber ( 'limit' , 1 , limit ) ;
412
+ validatePositiveNumber ( 'limit' , limit ) ;
417
413
return new QueryLimitConstraint ( 'limit' , limit , LimitType . First ) ;
418
414
}
419
415
@@ -427,7 +423,7 @@ export function limit(limit: number): QueryConstraint {
427
423
* @return The created `Query`.
428
424
*/
429
425
export function limitToLast ( limit : number ) : QueryConstraint {
430
- validatePositiveNumber ( 'limitToLast' , 1 , limit ) ;
426
+ validatePositiveNumber ( 'limitToLast' , limit ) ;
431
427
return new QueryLimitConstraint ( 'limitToLast' , limit , LimitType . Last ) ;
432
428
}
433
429
@@ -597,7 +593,6 @@ function newQueryBoundFromDocOrFields<T>(
597
593
before : boolean
598
594
) : Bound {
599
595
if ( docOrFields [ 0 ] instanceof DocumentSnapshot ) {
600
- validateExactNumberOfArgs ( methodName , docOrFields , 1 ) ;
601
596
return newQueryBoundFromDocument (
602
597
query . _query ,
603
598
query . firestore . _databaseId ,
@@ -1234,16 +1229,3 @@ export function newUserDataReader(
1234
1229
serializer
1235
1230
) ;
1236
1231
}
1237
-
1238
- function validateNonEmptyArgument (
1239
- functionName : string ,
1240
- argumentName : string ,
1241
- argument ?: string
1242
- ) : asserts argument is string {
1243
- if ( ! argument ) {
1244
- throw new FirestoreError (
1245
- Code . INVALID_ARGUMENT ,
1246
- `Function ${ functionName } () cannot be called with an empty ${ argumentName } .`
1247
- ) ;
1248
- }
1249
- }
0 commit comments