15
15
* limitations under the License.
16
16
*/
17
17
18
- import { Firestore } from './database' ;
18
+ import { FirebaseFirestore } from './database' ;
19
19
import { PersistenceSettings } from '../../../src/core/firestore_client' ;
20
20
import {
21
21
MemoryOfflineComponentProvider ,
@@ -45,16 +45,16 @@ export const LOG_TAG = 'ComponentProvider';
45
45
// Instance maps that ensure that only one component provider exists per
46
46
// Firestore instance.
47
47
const offlineComponentProviders = new Map <
48
- Firestore ,
48
+ FirebaseFirestore ,
49
49
Promise < OfflineComponentProvider >
50
50
> ( ) ;
51
51
const onlineComponentProviders = new Map <
52
- Firestore ,
52
+ FirebaseFirestore ,
53
53
Promise < OnlineComponentProvider >
54
54
> ( ) ;
55
55
56
56
export async function setOfflineComponentProvider (
57
- firestore : Firestore ,
57
+ firestore : FirebaseFirestore ,
58
58
persistenceSettings : PersistenceSettings ,
59
59
offlineComponentProvider : OfflineComponentProvider
60
60
) : Promise < void > {
@@ -83,7 +83,7 @@ export async function setOfflineComponentProvider(
83
83
}
84
84
85
85
export async function setOnlineComponentProvider (
86
- firestore : Firestore ,
86
+ firestore : FirebaseFirestore ,
87
87
onlineComponentProvider : OnlineComponentProvider
88
88
) : Promise < void > {
89
89
const onlineDeferred = new Deferred < OnlineComponentProvider > ( ) ;
@@ -112,7 +112,7 @@ export async function setOnlineComponentProvider(
112
112
}
113
113
114
114
function getOfflineComponentProvider (
115
- firestore : Firestore
115
+ firestore : FirebaseFirestore
116
116
) : Promise < OfflineComponentProvider > {
117
117
firestore . _queue . verifyOperationInProgress ( ) ;
118
118
@@ -129,7 +129,7 @@ function getOfflineComponentProvider(
129
129
}
130
130
131
131
function getOnlineComponentProvider (
132
- firestore : Firestore
132
+ firestore : FirebaseFirestore
133
133
) : Promise < OnlineComponentProvider > {
134
134
firestore . _queue . verifyOperationInProgress ( ) ;
135
135
@@ -144,19 +144,25 @@ function getOnlineComponentProvider(
144
144
// Note: These functions cannot be `async` since we want to throw an exception
145
145
// when Firestore is terminated (via `getOnlineComponentProvider()`).
146
146
147
- export function getSyncEngine ( firestore : Firestore ) : Promise < SyncEngine > {
147
+ export function getSyncEngine (
148
+ firestore : FirebaseFirestore
149
+ ) : Promise < SyncEngine > {
148
150
return getOnlineComponentProvider ( firestore ) . then (
149
151
components => components . syncEngine
150
152
) ;
151
153
}
152
154
153
- export function getRemoteStore ( firestore : Firestore ) : Promise < RemoteStore > {
155
+ export function getRemoteStore (
156
+ firestore : FirebaseFirestore
157
+ ) : Promise < RemoteStore > {
154
158
return getOnlineComponentProvider ( firestore ) . then (
155
159
components => components . remoteStore
156
160
) ;
157
161
}
158
162
159
- export function getEventManager ( firestore : Firestore ) : Promise < EventManager > {
163
+ export function getEventManager (
164
+ firestore : FirebaseFirestore
165
+ ) : Promise < EventManager > {
160
166
return getOnlineComponentProvider ( firestore ) . then ( components => {
161
167
const eventManager = components . eventManager ;
162
168
eventManager . onListen = syncEngineListen . bind ( null , components . syncEngine ) ;
@@ -168,13 +174,17 @@ export function getEventManager(firestore: Firestore): Promise<EventManager> {
168
174
} ) ;
169
175
}
170
176
171
- export function getPersistence ( firestore : Firestore ) : Promise < Persistence > {
177
+ export function getPersistence (
178
+ firestore : FirebaseFirestore
179
+ ) : Promise < Persistence > {
172
180
return getOfflineComponentProvider ( firestore ) . then (
173
181
components => components . persistence
174
182
) ;
175
183
}
176
184
177
- export function getLocalStore ( firestore : Firestore ) : Promise < LocalStore > {
185
+ export function getLocalStore (
186
+ firestore : FirebaseFirestore
187
+ ) : Promise < LocalStore > {
178
188
return getOfflineComponentProvider ( firestore ) . then (
179
189
provider => provider . localStore
180
190
) ;
@@ -184,7 +194,9 @@ export function getLocalStore(firestore: Firestore): Promise<LocalStore> {
184
194
* Removes all components associated with the provided instance. Must be called
185
195
* when the Firestore instance is terminated.
186
196
*/
187
- export async function removeComponents ( firestore : Firestore ) : Promise < void > {
197
+ export async function removeComponents (
198
+ firestore : FirebaseFirestore
199
+ ) : Promise < void > {
188
200
const onlineComponentProviderPromise = onlineComponentProviders . get (
189
201
firestore
190
202
) ;
0 commit comments