File tree Expand file tree Collapse file tree 5 files changed +26
-1
lines changed
firestore/src/platform/browser Expand file tree Collapse file tree 5 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @firebase/firestore ' : minor
3+ ' @firebase/firestore-compat ' : minor
4+ ' @firebase/webchannel-wrapper ' : minor
5+ ' firebase ' : minor
6+ ---
7+
8+ Set withCredentials=true when making requests via non-streaming RPCs, like is done for streaming RPCs.
Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ import {
2222 Firestore as FirestoreExp ,
2323 FirestoreError ,
2424 _EmptyAuthCredentialsProvider ,
25- _EmptyAppCheckTokenProvider
25+ _EmptyAppCheckTokenProvider ,
26+ Query as ExpQuery ,
27+ getCountFromServer
2628} from '@firebase/firestore' ;
29+ import { Compat } from '@firebase/util' ;
2730
2831import {
2932 Firestore as FirestoreCompat ,
@@ -98,6 +101,15 @@ export class Firestore extends FirestoreCompat {
98101 new MemoryPersistenceProvider ( )
99102 ) ;
100103 }
104+
105+ INTERNAL = {
106+ delete : ( ) => this . terminate ( ) ,
107+ count : ( query : Compat < ExpQuery < unknown > > ) => {
108+ return getCountFromServer ( query . _delegate ) . then ( response => {
109+ return response . data ( ) . count ;
110+ } ) ;
111+ }
112+ } ;
101113}
102114
103115function databaseIdFromFirestoreDatabase (
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export class WebChannelConnection extends RestConnection {
7272 ) : Promise < Resp > {
7373 return new Promise ( ( resolve : Resolver < Resp > , reject : Rejecter ) => {
7474 const xhr = new XhrIo ( ) ;
75+ xhr . setWithCredentials ( true ) ;
7576 xhr . listenOnce ( EventType . COMPLETE , ( ) => {
7677 try {
7778 switch ( xhr . getLastErrorCode ( ) ) {
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ export class XhrIo {
7474 getResponseJson ( ) : WebChannelError | object ;
7575
7676 listenOnce ( type : string , cb : ( param : unknown ) => void ) : void ;
77+
78+ setWithCredentials ( withCredentials : boolean ) : void ;
7779}
7880
7981export interface WebChannelOptions {
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ goog.net.XhrIo.prototype['getResponseJson'] =
7575goog . net . XhrIo . prototype [ 'getResponseText' ] =
7676 goog . net . XhrIo . prototype . getResponseText ;
7777goog . net . XhrIo . prototype [ 'send' ] = goog . net . XhrIo . prototype . send ;
78+ goog . net . XhrIo . prototype [ 'setWithCredentials' ] =
79+ goog . net . XhrIo . prototype . setWithCredentials ;
7880
7981module [ 'exports' ] [ 'createWebChannelTransport' ] =
8082 goog . net . createWebChannelTransport ;
You can’t perform that action at this time.
0 commit comments