@@ -2294,6 +2294,7 @@ firebase.firestore._getDocumentReference = (docRef?: JDocumentReference): firest
22942294 id : docRef . getId ( ) ,
22952295 parent : firebase . firestore . _getCollectionReference ( docRef . getParent ( ) ) ,
22962296 path : docRef . getPath ( ) ,
2297+ firestore : firebase . firestore ,
22972298 collection : cp => firebase . firestore . collection ( `${ collectionPath } /${ docRef . getId ( ) } /${ cp } ` ) ,
22982299 set : ( data : any , options ?: firestore . SetOptions ) => firebase . firestore . set ( collectionPath , docRef . getId ( ) , data , options ) ,
22992300 get : ( options ?: firestore . GetOptions ) => firebase . firestore . getDocument ( collectionPath , docRef . getId ( ) , options ) ,
@@ -2324,17 +2325,18 @@ firebase.firestore._getCollectionReference = (colRef?: JCollectionReference): fi
23242325 return {
23252326 id : colRef . getId ( ) ,
23262327 parent : firebase . firestore . _getDocumentReference ( colRef . getParent ( ) ) ,
2328+ firestore : firebase . firestore ,
23272329 doc : ( documentPath ?: string ) => firebase . firestore . doc ( collectionPath , documentPath ) ,
23282330 add : document => firebase . firestore . add ( collectionPath , document ) ,
23292331 get : ( options ?: firestore . GetOptions ) => firebase . firestore . get ( collectionPath , options ) ,
23302332 where : ( fieldPath : string , opStr : firestore . WhereFilterOp , value : any ) => firebase . firestore . where ( collectionPath , fieldPath , opStr , value ) ,
23312333 orderBy : ( fieldPath : string , directionStr : firestore . OrderByDirection ) : firestore . Query => firebase . firestore . orderBy ( collectionPath , fieldPath , directionStr , colRef ) ,
23322334 limit : ( limit : number ) : firestore . Query => firebase . firestore . limit ( collectionPath , limit , colRef ) ,
23332335 onSnapshot : ( optionsOrCallback : firestore . SnapshotListenOptions | ( ( snapshot : QuerySnapshot ) => void ) , callbackOrOnError ?: ( snapshotOrError : QuerySnapshot | Error ) => void , onError ?: ( error : Error ) => void ) => firebase . firestore . onCollectionSnapshot ( colRef , optionsOrCallback , callbackOrOnError , onError ) ,
2334- startAfter : ( snapshot : DocumentSnapshot ) : firestore . Query => firebase . firestore . startAfter ( collectionPath , snapshot , colRef ) ,
2335- startAt : ( snapshot : DocumentSnapshot ) : firestore . Query => firebase . firestore . startAt ( collectionPath , snapshot , colRef ) ,
2336- endAt : ( snapshot : DocumentSnapshot ) : firestore . Query => firebase . firestore . endAt ( collectionPath , snapshot , colRef ) ,
2337- endBefore : ( snapshot : DocumentSnapshot ) : firestore . Query => firebase . firestore . endBefore ( collectionPath , snapshot , colRef ) ,
2336+ startAfter : ( snapshotOrFieldValue : DocumentSnapshot | any , ... fieldValues : any [ ] ) : firestore . Query => firebase . firestore . startAfter ( collectionPath , snapshotOrFieldValue , fieldValues , colRef ) ,
2337+ startAt : ( snapshotOrFieldValue : DocumentSnapshot | any , ... fieldValues : any [ ] ) : firestore . Query => firebase . firestore . startAt ( collectionPath , snapshotOrFieldValue , fieldValues , colRef ) ,
2338+ endAt : ( snapshotOrFieldValue : DocumentSnapshot | any , ... fieldValues : any [ ] ) : firestore . Query => firebase . firestore . endAt ( collectionPath , snapshotOrFieldValue , fieldValues , colRef ) ,
2339+ endBefore : ( snapshotOrFieldValue : DocumentSnapshot | any , ... fieldValues : any [ ] ) : firestore . Query => firebase . firestore . endBefore ( collectionPath , snapshotOrFieldValue , fieldValues , colRef )
23382340 } ;
23392341} ;
23402342
@@ -2579,10 +2581,11 @@ firebase.firestore._getQuery = (collectionPath: string, query: com.google.fireba
25792581 orderBy : ( fp : string , directionStr : firestore . OrderByDirection ) : firestore . Query => firebase . firestore . orderBy ( collectionPath , fp , directionStr , query ) ,
25802582 limit : ( limit : number ) : firestore . Query => firebase . firestore . limit ( collectionPath , limit , query ) ,
25812583 onSnapshot : ( optionsOrCallback : firestore . SnapshotListenOptions | ( ( snapshot : QuerySnapshot ) => void ) , callbackOrOnError ?: ( snapshotOrError : QuerySnapshot | Error ) => void , onError ?: ( error : Error ) => void ) => firebase . firestore . onCollectionSnapshot ( query , optionsOrCallback , callbackOrOnError , onError ) ,
2582- startAfter : ( snapshot : DocumentSnapshot ) => firebase . firestore . startAfter ( collectionPath , snapshot , query ) ,
2583- startAt : ( snapshot : DocumentSnapshot ) => firebase . firestore . startAt ( collectionPath , snapshot , query ) ,
2584- endAt : ( snapshot : DocumentSnapshot ) => firebase . firestore . endAt ( collectionPath , snapshot , query ) ,
2585- endBefore : ( snapshot : DocumentSnapshot ) => firebase . firestore . endBefore ( collectionPath , snapshot , query ) ,
2584+ startAfter : ( snapshotOrFieldValue : DocumentSnapshot | any , ...fieldValues : any [ ] ) : firestore . Query => firebase . firestore . startAfter ( collectionPath , snapshotOrFieldValue , fieldValues , query ) ,
2585+ startAt : ( snapshotOrFieldValue : DocumentSnapshot | any , ...fieldValues : any [ ] ) : firestore . Query => firebase . firestore . startAt ( collectionPath , snapshotOrFieldValue , fieldValues , query ) ,
2586+ endAt : ( snapshotOrFieldValue : DocumentSnapshot | any , ...fieldValues : any [ ] ) : firestore . Query => firebase . firestore . endAt ( collectionPath , snapshotOrFieldValue , fieldValues , query ) ,
2587+ endBefore : ( snapshotOrFieldValue : DocumentSnapshot | any , ...fieldValues : any [ ] ) : firestore . Query => firebase . firestore . endBefore ( collectionPath , snapshotOrFieldValue , fieldValues , query ) ,
2588+ firestore : firebase . firestore
25862589 } ;
25872590} ;
25882591
@@ -2631,22 +2634,43 @@ firebase.firestore.limit = (collectionPath: string, limit: number, query: com.go
26312634 return firebase . firestore . _getQuery ( collectionPath , query ) ;
26322635} ;
26332636
2634- firebase . firestore . startAfter = ( collectionPath : string , snapshot : DocumentSnapshot , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2635- return firebase . firestore . _getQuery ( collectionPath , query . startAfter ( snapshot . android ) ) ;
2637+ firebase . firestore . startAfter = ( collectionPath : string , snapshotOrFieldValue : DocumentSnapshot | any , fieldValues : any [ ] , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2638+ return firebase . firestore . _getQuery ( collectionPath , query . startAfter ( firebase . firestore . _getSnapshotOrFieldValues ( snapshotOrFieldValue , fieldValues ) ) ) ;
26362639} ;
26372640
2638- firebase . firestore . startAt = ( collectionPath : string , snapshot : DocumentSnapshot , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2639- return firebase . firestore . _getQuery ( collectionPath , query . startAt ( snapshot . android ) ) ;
2641+ firebase . firestore . startAt = ( collectionPath : string , snapshotOrFieldValue : DocumentSnapshot | any , fieldValues : any [ ] , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2642+ return firebase . firestore . _getQuery ( collectionPath , query . startAt ( firebase . firestore . _getSnapshotOrFieldValues ( snapshotOrFieldValue , fieldValues ) ) ) ;
26402643} ;
26412644
2642- firebase . firestore . endAt = ( collectionPath : string , snapshot : DocumentSnapshot , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2643- return firebase . firestore . _getQuery ( collectionPath , query . endAt ( snapshot . android ) ) ;
2645+ firebase . firestore . endAt = ( collectionPath : string , snapshotOrFieldValue : DocumentSnapshot | any , fieldValues : any [ ] , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2646+ return firebase . firestore . _getQuery ( collectionPath , query . endAt ( firebase . firestore . _getSnapshotOrFieldValues ( snapshotOrFieldValue , fieldValues ) ) ) ;
26442647} ;
26452648
2646- firebase . firestore . endBefore = ( collectionPath : string , snapshot : DocumentSnapshot , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2647- return firebase . firestore . _getQuery ( collectionPath , query . endBefore ( snapshot . android ) ) ;
2649+ firebase . firestore . endBefore = ( collectionPath : string , snapshotOrFieldValue : DocumentSnapshot | any , fieldValues : any [ ] , query : com . google . firebase . firestore . Query ) : firestore . Query => {
2650+ return firebase . firestore . _getQuery ( collectionPath , query . endBefore ( firebase . firestore . _getSnapshotOrFieldValues ( snapshotOrFieldValue , fieldValues ) ) ) ;
26482651} ;
26492652
2653+ firebase . firestore . _getSnapshotOrFieldValues = ( snapshotOrFieldValue : DocumentSnapshot | any , fieldValues : any [ ] ) : any => {
2654+ if ( snapshotOrFieldValue && snapshotOrFieldValue . android ) {
2655+ return snapshotOrFieldValue ;
2656+ } else {
2657+ const AllFieldValues = [ snapshotOrFieldValue , ...fieldValues ] ;
2658+ const javaArray = Array . create ( 'java.lang.Object' , AllFieldValues . length ) ;
2659+ AllFieldValues . forEach ( ( value , index ) => {
2660+ // support only Number and String type
2661+ // Not sure whether other types are supported by OrderBy
2662+ let javaValue : java . lang . String | java . lang . Double ;
2663+ if ( isNaN ( value ) ) {
2664+ javaValue = new java . lang . String ( value . toString ( ) ) ;
2665+ } else {
2666+ javaValue = new java . lang . Double ( value ) ;
2667+ }
2668+ javaArray [ index ] = javaValue ;
2669+ } ) ;
2670+ return javaArray ;
2671+ }
2672+ }
2673+
26502674export type JDocumentReference = com . google . firebase . firestore . DocumentReference ;
26512675export type JCollectionReference = com . google . firebase . firestore . CollectionReference ;
26522676
0 commit comments