@@ -77,7 +77,7 @@ import {
77
77
} from '../util/input_validation' ;
78
78
import { logWarn , setLogLevel as setClientLogLevel } from '../util/log' ;
79
79
import { AutoId } from '../util/misc' ;
80
- import { _BaseFieldPath , FieldPath as ExternalFieldPath } from './field_path' ;
80
+ import { FieldPath as ExpFieldPath } from '../../lite/src/api /field_path' ;
81
81
import {
82
82
CompleteFn ,
83
83
ErrorFn ,
@@ -119,6 +119,7 @@ import {
119
119
DocumentData as PublicDocumentData ,
120
120
DocumentReference as PublicDocumentReference ,
121
121
DocumentSnapshot as PublicDocumentSnapshot ,
122
+ FieldPath as PublicFieldPath ,
122
123
FirebaseFirestore as PublicFirestore ,
123
124
FirestoreDataConverter as PublicFirestoreDataConverter ,
124
125
GetOptions as PublicGetOptions ,
@@ -518,22 +519,28 @@ export class Transaction implements PublicTransaction {
518
519
) : Transaction ;
519
520
update (
520
521
documentRef : PublicDocumentReference < unknown > ,
521
- field : string | ExternalFieldPath ,
522
+ field : string | PublicFieldPath ,
522
523
value : unknown ,
523
524
...moreFieldsAndValues : unknown [ ]
524
525
) : Transaction ;
525
526
update (
526
527
documentRef : PublicDocumentReference < unknown > ,
527
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
528
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
528
529
value ?: unknown ,
529
530
...moreFieldsAndValues : unknown [ ]
530
531
) : Transaction {
531
532
let ref ;
532
533
let parsed ;
533
534
535
+ // For Compat types, we have to "extract" the underlying types before
536
+ // performing validation.
537
+ if ( fieldOrUpdateData instanceof Compat ) {
538
+ fieldOrUpdateData = ( fieldOrUpdateData as Compat < ExpFieldPath > ) . _delegate ;
539
+ }
540
+
534
541
if (
535
542
typeof fieldOrUpdateData === 'string' ||
536
- fieldOrUpdateData instanceof ExternalFieldPath
543
+ fieldOrUpdateData instanceof ExpFieldPath
537
544
) {
538
545
ref = validateReference (
539
546
'Transaction.update' ,
@@ -629,24 +636,30 @@ export class WriteBatch implements PublicWriteBatch {
629
636
) : WriteBatch ;
630
637
update (
631
638
documentRef : PublicDocumentReference < unknown > ,
632
- field : string | ExternalFieldPath ,
639
+ field : string | PublicFieldPath ,
633
640
value : unknown ,
634
641
...moreFieldsAndValues : unknown [ ]
635
642
) : WriteBatch ;
636
643
update (
637
644
documentRef : PublicDocumentReference < unknown > ,
638
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
645
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
639
646
value ?: unknown ,
640
647
...moreFieldsAndValues : unknown [ ]
641
648
) : WriteBatch {
642
649
this . verifyNotCommitted ( ) ;
643
650
651
+ // For Compat types, we have to "extract" the underlying types before
652
+ // performing validation.
653
+ if ( fieldOrUpdateData instanceof Compat ) {
654
+ fieldOrUpdateData = ( fieldOrUpdateData as Compat < ExpFieldPath > ) . _delegate ;
655
+ }
656
+
644
657
let ref ;
645
658
let parsed ;
646
659
647
660
if (
648
661
typeof fieldOrUpdateData === 'string' ||
649
- fieldOrUpdateData instanceof ExternalFieldPath
662
+ fieldOrUpdateData instanceof ExpFieldPath
650
663
) {
651
664
ref = validateReference (
652
665
'WriteBatch.update' ,
@@ -825,26 +838,25 @@ export class DocumentReference<T = PublicDocumentData>
825
838
826
839
update ( value : PublicUpdateData ) : Promise < void > ;
827
840
update (
828
- field : string | ExternalFieldPath ,
841
+ field : string | PublicFieldPath ,
829
842
value : unknown ,
830
843
...moreFieldsAndValues : unknown [ ]
831
844
) : Promise < void > ;
832
845
update (
833
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
846
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
834
847
value ?: unknown ,
835
848
...moreFieldsAndValues : unknown [ ]
836
849
) : Promise < void > {
837
850
// For Compat types, we have to "extract" the underlying types before
838
851
// performing validation.
839
852
if ( fieldOrUpdateData instanceof Compat ) {
840
- fieldOrUpdateData = ( fieldOrUpdateData as Compat < _BaseFieldPath > )
841
- . _delegate ;
853
+ fieldOrUpdateData = ( fieldOrUpdateData as Compat < ExpFieldPath > ) . _delegate ;
842
854
}
843
855
844
856
let parsed ;
845
857
if (
846
858
typeof fieldOrUpdateData === 'string' ||
847
- fieldOrUpdateData instanceof _BaseFieldPath
859
+ fieldOrUpdateData instanceof ExpFieldPath
848
860
) {
849
861
parsed = parseUpdateVarargs (
850
862
this . _dataReader ,
@@ -1080,7 +1092,7 @@ export class DocumentSnapshot<T = PublicDocumentData>
1080
1092
}
1081
1093
1082
1094
get (
1083
- fieldPath : string | ExternalFieldPath ,
1095
+ fieldPath : string | PublicFieldPath ,
1084
1096
options : PublicSnapshotOptions = { }
1085
1097
) : unknown {
1086
1098
if ( this . _document ) {
@@ -1556,7 +1568,7 @@ export class Query<T = PublicDocumentData> implements PublicQuery<T> {
1556
1568
}
1557
1569
1558
1570
where (
1559
- field : string | ExternalFieldPath ,
1571
+ field : string | PublicFieldPath ,
1560
1572
opStr : PublicWhereFilterOp ,
1561
1573
value : unknown
1562
1574
) : PublicQuery < T > {
@@ -1578,7 +1590,7 @@ export class Query<T = PublicDocumentData> implements PublicQuery<T> {
1578
1590
}
1579
1591
1580
1592
orderBy (
1581
- field : string | ExternalFieldPath ,
1593
+ field : string | PublicFieldPath ,
1582
1594
directionStr ?: PublicOrderByDirection
1583
1595
) : PublicQuery < T > {
1584
1596
let direction : Direction ;
0 commit comments