@@ -49,7 +49,17 @@ import {
49
49
} from '../core/view/EventRegistration' ;
50
50
51
51
import { Repo } from '../core/Repo' ;
52
- import { QueryParams } from '../core/view/QueryParams' ;
52
+ import {
53
+ QueryParams ,
54
+ queryParamsLimitToFirst ,
55
+ queryParamsLimitToLast ,
56
+ queryParamsStartAfter ,
57
+ queryParamsStartAt ,
58
+ queryParamsEndAt ,
59
+ queryParamsEndBefore ,
60
+ queryParamsGetQueryObject ,
61
+ queryParamsOrderBy
62
+ } from '../core/view/QueryParams' ;
53
63
import { Reference } from './Reference' ;
54
64
import { DataSnapshot } from './DataSnapshot' ;
55
65
@@ -355,7 +365,7 @@ export class Query {
355
365
return new Query (
356
366
this . repo ,
357
367
this . path ,
358
- this . queryParams_ . limitToFirst ( limit ) ,
368
+ queryParamsLimitToFirst ( this . queryParams_ , limit ) ,
359
369
this . orderByCalled_
360
370
) ;
361
371
}
@@ -384,7 +394,7 @@ export class Query {
384
394
return new Query (
385
395
this . repo ,
386
396
this . path ,
387
- this . queryParams_ . limitToLast ( limit ) ,
397
+ queryParamsLimitToLast ( this . queryParams_ , limit ) ,
388
398
this . orderByCalled_
389
399
) ;
390
400
}
@@ -416,7 +426,7 @@ export class Query {
416
426
) ;
417
427
}
418
428
const index = new PathIndex ( parsedPath ) ;
419
- const newParams = this . queryParams_ . orderBy ( index ) ;
429
+ const newParams = queryParamsOrderBy ( this . queryParams_ , index ) ;
420
430
Query . validateQueryEndpoints_ ( newParams ) ;
421
431
422
432
return new Query ( this . repo , this . path , newParams , /*orderByCalled=*/ true ) ;
@@ -428,7 +438,7 @@ export class Query {
428
438
orderByKey ( ) : Query {
429
439
validateArgCount ( 'Query.orderByKey' , 0 , 0 , arguments . length ) ;
430
440
this . validateNoPreviousOrderByCall_ ( 'Query.orderByKey' ) ;
431
- const newParams = this . queryParams_ . orderBy ( KEY_INDEX ) ;
441
+ const newParams = queryParamsOrderBy ( this . queryParams_ , KEY_INDEX ) ;
432
442
Query . validateQueryEndpoints_ ( newParams ) ;
433
443
return new Query ( this . repo , this . path , newParams , /*orderByCalled=*/ true ) ;
434
444
}
@@ -439,7 +449,7 @@ export class Query {
439
449
orderByPriority ( ) : Query {
440
450
validateArgCount ( 'Query.orderByPriority' , 0 , 0 , arguments . length ) ;
441
451
this . validateNoPreviousOrderByCall_ ( 'Query.orderByPriority' ) ;
442
- const newParams = this . queryParams_ . orderBy ( PRIORITY_INDEX ) ;
452
+ const newParams = queryParamsOrderBy ( this . queryParams_ , PRIORITY_INDEX ) ;
443
453
Query . validateQueryEndpoints_ ( newParams ) ;
444
454
return new Query ( this . repo , this . path , newParams , /*orderByCalled=*/ true ) ;
445
455
}
@@ -450,7 +460,7 @@ export class Query {
450
460
orderByValue ( ) : Query {
451
461
validateArgCount ( 'Query.orderByValue' , 0 , 0 , arguments . length ) ;
452
462
this . validateNoPreviousOrderByCall_ ( 'Query.orderByValue' ) ;
453
- const newParams = this . queryParams_ . orderBy ( VALUE_INDEX ) ;
463
+ const newParams = queryParamsOrderBy ( this . queryParams_ , VALUE_INDEX ) ;
454
464
Query . validateQueryEndpoints_ ( newParams ) ;
455
465
return new Query ( this . repo , this . path , newParams , /*orderByCalled=*/ true ) ;
456
466
}
@@ -463,7 +473,7 @@ export class Query {
463
473
validateFirebaseDataArg ( 'Query.startAt' , 1 , value , this . path , true ) ;
464
474
validateKey ( 'Query.startAt' , 2 , name , true ) ;
465
475
466
- const newParams = this . queryParams_ . startAt ( value , name ) ;
476
+ const newParams = queryParamsStartAt ( this . queryParams_ , value , name ) ;
467
477
Query . validateLimit_ ( newParams ) ;
468
478
Query . validateQueryEndpoints_ ( newParams ) ;
469
479
if ( this . queryParams_ . hasStart ( ) ) {
@@ -490,7 +500,7 @@ export class Query {
490
500
validateFirebaseDataArg ( 'Query.startAfter' , 1 , value , this . path , false ) ;
491
501
validateKey ( 'Query.startAfter' , 2 , name , true ) ;
492
502
493
- const newParams = this . queryParams_ . startAfter ( value , name ) ;
503
+ const newParams = queryParamsStartAfter ( this . queryParams_ , value , name ) ;
494
504
Query . validateLimit_ ( newParams ) ;
495
505
Query . validateQueryEndpoints_ ( newParams ) ;
496
506
if ( this . queryParams_ . hasStart ( ) ) {
@@ -511,7 +521,7 @@ export class Query {
511
521
validateFirebaseDataArg ( 'Query.endAt' , 1 , value , this . path , true ) ;
512
522
validateKey ( 'Query.endAt' , 2 , name , true ) ;
513
523
514
- const newParams = this . queryParams_ . endAt ( value , name ) ;
524
+ const newParams = queryParamsEndAt ( this . queryParams_ , value , name ) ;
515
525
Query . validateLimit_ ( newParams ) ;
516
526
Query . validateQueryEndpoints_ ( newParams ) ;
517
527
if ( this . queryParams_ . hasEnd ( ) ) {
@@ -532,7 +542,7 @@ export class Query {
532
542
validateFirebaseDataArg ( 'Query.endBefore' , 1 , value , this . path , false ) ;
533
543
validateKey ( 'Query.endBefore' , 2 , name , true ) ;
534
544
535
- const newParams = this . queryParams_ . endBefore ( value , name ) ;
545
+ const newParams = queryParamsEndBefore ( this . queryParams_ , value , name ) ;
536
546
Query . validateLimit_ ( newParams ) ;
537
547
Query . validateQueryEndpoints_ ( newParams ) ;
538
548
if ( this . queryParams_ . hasEnd ( ) ) {
@@ -589,7 +599,7 @@ export class Query {
589
599
* An object representation of the query parameters used by this Query.
590
600
*/
591
601
queryObject ( ) : object {
592
- return this . queryParams_ . getQueryObject ( ) ;
602
+ return queryParamsGetQueryObject ( this . queryParams_ ) ;
593
603
}
594
604
595
605
queryIdentifier ( ) : string {
0 commit comments