@@ -75,7 +75,7 @@ import {
75
75
} from '../util/input_validation' ;
76
76
import { logWarn , setLogLevel as setClientLogLevel } from '../util/log' ;
77
77
import { AutoId } from '../util/misc' ;
78
- import { _BaseFieldPath , FieldPath as ExternalFieldPath } from './field_path' ;
78
+ import { FieldPath as ExpFieldPath } from '../../lite/src/api /field_path' ;
79
79
import {
80
80
CompleteFn ,
81
81
ErrorFn ,
@@ -130,6 +130,7 @@ import {
130
130
DocumentData as PublicDocumentData ,
131
131
DocumentReference as PublicDocumentReference ,
132
132
DocumentSnapshot as PublicDocumentSnapshot ,
133
+ FieldPath as PublicFieldPath ,
133
134
FirebaseFirestore as PublicFirestore ,
134
135
FirestoreDataConverter as PublicFirestoreDataConverter ,
135
136
GetOptions as PublicGetOptions ,
@@ -530,28 +531,33 @@ export class Transaction implements PublicTransaction {
530
531
) : Transaction ;
531
532
update (
532
533
documentRef : PublicDocumentReference < unknown > ,
533
- field : string | ExternalFieldPath ,
534
+ field : string | PublicFieldPath ,
534
535
value : unknown ,
535
536
...moreFieldsAndValues : unknown [ ]
536
537
) : Transaction ;
537
538
update (
538
539
documentRef : PublicDocumentReference < unknown > ,
539
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
540
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
540
541
value ?: unknown ,
541
542
...moreFieldsAndValues : unknown [ ]
542
543
) : Transaction {
543
- let ref ;
544
- let parsed ;
544
+ const ref = validateReference (
545
+ 'Transaction.update' ,
546
+ documentRef ,
547
+ this . _firestore
548
+ ) ;
549
+
550
+ // For Compat types, we have to "extract" the underlying types before
551
+ // performing validation.
552
+ if ( fieldOrUpdateData instanceof Compat ) {
553
+ fieldOrUpdateData = ( fieldOrUpdateData as Compat < ExpFieldPath > ) . _delegate ;
554
+ }
545
555
556
+ let parsed ;
546
557
if (
547
558
typeof fieldOrUpdateData === 'string' ||
548
- fieldOrUpdateData instanceof ExternalFieldPath
559
+ fieldOrUpdateData instanceof ExpFieldPath
549
560
) {
550
- ref = validateReference (
551
- 'Transaction.update' ,
552
- documentRef ,
553
- this . _firestore
554
- ) ;
555
561
parsed = parseUpdateVarargs (
556
562
this . _dataReader ,
557
563
'Transaction.update' ,
@@ -561,11 +567,6 @@ export class Transaction implements PublicTransaction {
561
567
moreFieldsAndValues
562
568
) ;
563
569
} else {
564
- ref = validateReference (
565
- 'Transaction.update' ,
566
- documentRef ,
567
- this . _firestore
568
- ) ;
569
570
parsed = parseUpdateData (
570
571
this . _dataReader ,
571
572
'Transaction.update' ,
@@ -641,30 +642,34 @@ export class WriteBatch implements PublicWriteBatch {
641
642
) : WriteBatch ;
642
643
update (
643
644
documentRef : PublicDocumentReference < unknown > ,
644
- field : string | ExternalFieldPath ,
645
+ field : string | PublicFieldPath ,
645
646
value : unknown ,
646
647
...moreFieldsAndValues : unknown [ ]
647
648
) : WriteBatch ;
648
649
update (
649
650
documentRef : PublicDocumentReference < unknown > ,
650
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
651
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
651
652
value ?: unknown ,
652
653
...moreFieldsAndValues : unknown [ ]
653
654
) : WriteBatch {
654
655
this . verifyNotCommitted ( ) ;
656
+ const ref = validateReference (
657
+ 'WriteBatch.update' ,
658
+ documentRef ,
659
+ this . _firestore
660
+ ) ;
655
661
656
- let ref ;
657
- let parsed ;
662
+ // For Compat types, we have to "extract" the underlying types before
663
+ // performing validation.
664
+ if ( fieldOrUpdateData instanceof Compat ) {
665
+ fieldOrUpdateData = ( fieldOrUpdateData as Compat < ExpFieldPath > ) . _delegate ;
666
+ }
658
667
668
+ let parsed ;
659
669
if (
660
670
typeof fieldOrUpdateData === 'string' ||
661
- fieldOrUpdateData instanceof ExternalFieldPath
671
+ fieldOrUpdateData instanceof ExpFieldPath
662
672
) {
663
- ref = validateReference (
664
- 'WriteBatch.update' ,
665
- documentRef ,
666
- this . _firestore
667
- ) ;
668
673
parsed = parseUpdateVarargs (
669
674
this . _dataReader ,
670
675
'WriteBatch.update' ,
@@ -674,11 +679,6 @@ export class WriteBatch implements PublicWriteBatch {
674
679
moreFieldsAndValues
675
680
) ;
676
681
} else {
677
- ref = validateReference (
678
- 'WriteBatch.update' ,
679
- documentRef ,
680
- this . _firestore
681
- ) ;
682
682
parsed = parseUpdateData (
683
683
this . _dataReader ,
684
684
'WriteBatch.update' ,
@@ -830,12 +830,12 @@ export class DocumentReference<T = PublicDocumentData>
830
830
831
831
update ( value : PublicUpdateData ) : Promise < void > ;
832
832
update (
833
- field : string | ExternalFieldPath ,
833
+ field : string | PublicFieldPath ,
834
834
value : unknown ,
835
835
...moreFieldsAndValues : unknown [ ]
836
836
) : Promise < void > ;
837
837
update (
838
- fieldOrUpdateData : string | ExternalFieldPath | PublicUpdateData ,
838
+ fieldOrUpdateData : string | PublicFieldPath | PublicUpdateData ,
839
839
value ?: unknown ,
840
840
...moreFieldsAndValues : unknown [ ]
841
841
) : Promise < void > {
@@ -845,7 +845,7 @@ export class DocumentReference<T = PublicDocumentData>
845
845
} else {
846
846
return updateDoc (
847
847
this . _delegate ,
848
- fieldOrUpdateData as string | ExternalFieldPath ,
848
+ fieldOrUpdateData as string | ExpFieldPath ,
849
849
value ,
850
850
...moreFieldsAndValues
851
851
) ;
@@ -1095,7 +1095,7 @@ export class DocumentSnapshot<T = PublicDocumentData>
1095
1095
}
1096
1096
1097
1097
get (
1098
- fieldPath : string | ExternalFieldPath ,
1098
+ fieldPath : string | PublicFieldPath ,
1099
1099
options : PublicSnapshotOptions = { }
1100
1100
) : unknown {
1101
1101
if ( this . _document ) {
@@ -1576,7 +1576,7 @@ export class Query<T = PublicDocumentData> implements PublicQuery<T> {
1576
1576
}
1577
1577
1578
1578
where (
1579
- field : string | ExternalFieldPath ,
1579
+ field : string | PublicFieldPath ,
1580
1580
opStr : PublicWhereFilterOp ,
1581
1581
value : unknown
1582
1582
) : PublicQuery < T > {
@@ -1598,7 +1598,7 @@ export class Query<T = PublicDocumentData> implements PublicQuery<T> {
1598
1598
}
1599
1599
1600
1600
orderBy (
1601
- field : string | ExternalFieldPath ,
1601
+ field : string | PublicFieldPath ,
1602
1602
directionStr ?: PublicOrderByDirection
1603
1603
) : PublicQuery < T > {
1604
1604
let direction : Direction ;
0 commit comments