@@ -46,7 +46,7 @@ import {
46
46
import { FirebaseApp } from '@firebase/app-types' ;
47
47
import { _FirebaseApp , FirebaseService } from '@firebase/app-types/private' ;
48
48
import { Blob } from './blob' ;
49
- import { DatabaseId , DatabaseInfo } from '../core/database_info' ;
49
+ import { DatabaseId } from '../core/database_info' ;
50
50
import { ListenOptions } from '../core/event_manager' ;
51
51
import {
52
52
FirestoreClient ,
@@ -111,7 +111,6 @@ import { AutoId } from '../util/misc';
111
111
import { FieldPath as ExternalFieldPath } from './field_path' ;
112
112
import {
113
113
CredentialsProvider ,
114
- CredentialsSettings ,
115
114
EmptyCredentialsProvider ,
116
115
FirebaseCredentialsProvider ,
117
116
makeCredentialsProvider
@@ -142,15 +141,12 @@ import {
142
141
enableIndexedDbPersistence ,
143
142
enableMultiTabIndexedDbPersistence
144
143
} from '../../exp/src/api/database' ;
144
+ import { LRU_COLLECTION_DISABLED } from '../local/lru_garbage_collector' ;
145
145
import {
146
- LRU_COLLECTION_DISABLED ,
147
- LRU_DEFAULT_CACHE_SIZE_BYTES ,
148
- LRU_MINIMUM_CACHE_SIZE_BYTES
149
- } from '../local/lru_garbage_collector' ;
150
-
151
- // settings() defaults:
152
- const DEFAULT_HOST = 'firestore.googleapis.com' ;
153
- const DEFAULT_SSL = true ;
146
+ FirestoreSettings ,
147
+ makeDatabaseInfo
148
+ } from '../../lite/src/api/database' ;
149
+ import { DEFAULT_HOST } from '../../lite/src/api/components' ;
154
150
155
151
/**
156
152
* Constant used to indicate the LRU garbage collection should be disabled.
@@ -159,12 +155,6 @@ const DEFAULT_SSL = true;
159
155
*/
160
156
export const CACHE_SIZE_UNLIMITED = LRU_COLLECTION_DISABLED ;
161
157
162
- /** Undocumented, private additional settings not exposed in our public API. */
163
- interface PrivateSettings extends PublicSettings {
164
- // Can be a google-auth-library or gapi client.
165
- credentials ?: CredentialsSettings ;
166
- }
167
-
168
158
/**
169
159
* Options that can be provided in the Firestore constructor when not using
170
160
* Firebase (aka standalone mode).
@@ -174,90 +164,6 @@ export interface FirestoreDatabase {
174
164
database ?: string ;
175
165
}
176
166
177
- /**
178
- * A concrete type describing all the values that can be applied via a
179
- * user-supplied firestore.Settings object. This is a separate type so that
180
- * defaults can be supplied and the value can be checked for equality.
181
- */
182
- export class FirestoreSettings {
183
- /** The hostname to connect to. */
184
- readonly host : string ;
185
-
186
- /** Whether to use SSL when connecting. */
187
- readonly ssl : boolean ;
188
-
189
- readonly cacheSizeBytes : number ;
190
-
191
- readonly experimentalForceLongPolling : boolean ;
192
-
193
- readonly experimentalAutoDetectLongPolling : boolean ;
194
-
195
- readonly ignoreUndefinedProperties : boolean ;
196
-
197
- // Can be a google-auth-library or gapi client.
198
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
- credentials ?: any ;
200
-
201
- constructor ( settings : PrivateSettings ) {
202
- if ( settings . host === undefined ) {
203
- if ( settings . ssl !== undefined ) {
204
- throw new FirestoreError (
205
- Code . INVALID_ARGUMENT ,
206
- "Can't provide ssl option if host option is not set"
207
- ) ;
208
- }
209
- this . host = DEFAULT_HOST ;
210
- this . ssl = DEFAULT_SSL ;
211
- } else {
212
- this . host = settings . host ;
213
- this . ssl = settings . ssl ?? DEFAULT_SSL ;
214
- }
215
-
216
- this . credentials = settings . credentials ;
217
- this . ignoreUndefinedProperties = ! ! settings . ignoreUndefinedProperties ;
218
-
219
- if ( settings . cacheSizeBytes === undefined ) {
220
- this . cacheSizeBytes = LRU_DEFAULT_CACHE_SIZE_BYTES ;
221
- } else {
222
- if (
223
- settings . cacheSizeBytes !== LRU_COLLECTION_DISABLED &&
224
- settings . cacheSizeBytes < LRU_MINIMUM_CACHE_SIZE_BYTES
225
- ) {
226
- throw new FirestoreError (
227
- Code . INVALID_ARGUMENT ,
228
- `cacheSizeBytes must be at least ${ LRU_MINIMUM_CACHE_SIZE_BYTES } `
229
- ) ;
230
- } else {
231
- this . cacheSizeBytes = settings . cacheSizeBytes ;
232
- }
233
- }
234
-
235
- this . experimentalForceLongPolling = ! ! settings . experimentalForceLongPolling ;
236
- this . experimentalAutoDetectLongPolling = ! ! settings . experimentalAutoDetectLongPolling ;
237
-
238
- validateIsNotUsedTogether (
239
- 'experimentalForceLongPolling' ,
240
- settings . experimentalForceLongPolling ,
241
- 'experimentalAutoDetectLongPolling' ,
242
- settings . experimentalAutoDetectLongPolling
243
- ) ;
244
- }
245
-
246
- isEqual ( other : FirestoreSettings ) : boolean {
247
- return (
248
- this . host === other . host &&
249
- this . ssl === other . ssl &&
250
- this . credentials === other . credentials &&
251
- this . cacheSizeBytes === other . cacheSizeBytes &&
252
- this . experimentalForceLongPolling ===
253
- other . experimentalForceLongPolling &&
254
- this . experimentalAutoDetectLongPolling ===
255
- other . experimentalAutoDetectLongPolling &&
256
- this . ignoreUndefinedProperties === other . ignoreUndefinedProperties
257
- ) ;
258
- }
259
- }
260
-
261
167
// TODO(firestore-compat): This interface exposes internal APIs that the Compat
262
168
// layer implements to interact with the firestore-exp SDK. We can remove this
263
169
// class once we have an actual compat class for FirebaseFirestore.
@@ -667,21 +573,6 @@ export function configureFirestore(firestore: FirestoreCompat): void {
667
573
) ;
668
574
}
669
575
670
- export function makeDatabaseInfo (
671
- databaseId : DatabaseId ,
672
- persistenceKey : string ,
673
- settings : FirestoreSettings
674
- ) : DatabaseInfo {
675
- return new DatabaseInfo (
676
- databaseId ,
677
- persistenceKey ,
678
- settings . host ,
679
- settings . ssl ,
680
- settings . experimentalForceLongPolling ,
681
- settings . experimentalAutoDetectLongPolling
682
- ) ;
683
- }
684
-
685
576
export function setLogLevel ( level : PublicLogLevel ) : void {
686
577
setClientLogLevel ( level ) ;
687
578
}
0 commit comments