@@ -98,6 +98,7 @@ import {
98
98
validateIsNotUsedTogether ,
99
99
validateNonEmptyArgument ,
100
100
validatePositiveNumber ,
101
+ validateSetOptions ,
101
102
valueDescription
102
103
} from '../util/input_validation' ;
103
104
import { setLogLevel as setClientLogLevel , logWarn } from '../util/log' ;
@@ -140,9 +141,6 @@ import {
140
141
// settings() defaults:
141
142
const DEFAULT_HOST = 'firestore.googleapis.com' ;
142
143
const DEFAULT_SSL = true ;
143
- const DEFAULT_FORCE_LONG_POLLING = false ;
144
- const DEFAULT_FORCE_AUTO_DETECT_LONG_POLLING = false ;
145
- const DEFAULT_IGNORE_UNDEFINED_PROPERTIES = false ;
146
144
147
145
/**
148
146
* Constant used to indicate the LRU garbage collection should be disabled.
@@ -151,10 +149,6 @@ const DEFAULT_IGNORE_UNDEFINED_PROPERTIES = false;
151
149
*/
152
150
export const CACHE_SIZE_UNLIMITED = LruParams . COLLECTION_DISABLED ;
153
151
154
- // enablePersistence() defaults:
155
- const DEFAULT_SYNCHRONIZE_TABS = false ;
156
- const DEFAULT_FORCE_OWNING_TAB = false ;
157
-
158
152
/** Undocumented, private additional settings not exposed in our public API. */
159
153
interface PrivateSettings extends PublicSettings {
160
154
// Can be a google-auth-library or gapi client.
@@ -206,13 +200,11 @@ class FirestoreSettings {
206
200
this . ssl = DEFAULT_SSL ;
207
201
} else {
208
202
this . host = settings . host ;
209
-
210
203
this . ssl = settings . ssl ?? DEFAULT_SSL ;
211
204
}
212
205
213
206
this . credentials = settings . credentials ;
214
- this . ignoreUndefinedProperties =
215
- settings . ignoreUndefinedProperties ?? DEFAULT_IGNORE_UNDEFINED_PROPERTIES ;
207
+ this . ignoreUndefinedProperties = ! ! settings . ignoreUndefinedProperties ;
216
208
217
209
if ( settings . cacheSizeBytes === undefined ) {
218
210
this . cacheSizeBytes = LruParams . DEFAULT_CACHE_SIZE_BYTES ;
@@ -230,12 +222,8 @@ class FirestoreSettings {
230
222
}
231
223
}
232
224
233
- this . experimentalForceLongPolling =
234
- settings . experimentalForceLongPolling ?? DEFAULT_FORCE_LONG_POLLING ;
235
-
236
- this . experimentalAutoDetectLongPolling =
237
- settings . experimentalAutoDetectLongPolling ??
238
- DEFAULT_FORCE_AUTO_DETECT_LONG_POLLING ;
225
+ this . experimentalForceLongPolling = ! ! settings . experimentalForceLongPolling ;
226
+ this . experimentalAutoDetectLongPolling = ! ! settings . experimentalAutoDetectLongPolling ;
239
227
240
228
validateIsNotUsedTogether (
241
229
'experimentalForceLongPolling' ,
@@ -495,9 +483,8 @@ export class Firestore implements PublicFirestore, FirebaseService {
495
483
let experimentalForceOwningTab = false ;
496
484
497
485
if ( settings ) {
498
- synchronizeTabs = settings . synchronizeTabs ?? DEFAULT_SYNCHRONIZE_TABS ;
499
- experimentalForceOwningTab =
500
- settings . experimentalForceOwningTab ?? DEFAULT_FORCE_OWNING_TAB ;
486
+ synchronizeTabs = ! ! settings . synchronizeTabs ;
487
+ experimentalForceOwningTab = ! ! settings . experimentalForceOwningTab ;
501
488
502
489
validateIsNotUsedTogether (
503
490
'synchronizeTabs' ,
@@ -2274,27 +2261,6 @@ export class CollectionReference<T = DocumentData>
2274
2261
}
2275
2262
}
2276
2263
2277
- export function validateSetOptions (
2278
- methodName : string ,
2279
- options : SetOptions | undefined
2280
- ) : SetOptions {
2281
- if ( options === undefined ) {
2282
- return {
2283
- merge : false
2284
- } ;
2285
- }
2286
-
2287
- if ( options . mergeFields !== undefined && options . merge !== undefined ) {
2288
- throw new FirestoreError (
2289
- Code . INVALID_ARGUMENT ,
2290
- `Invalid options passed to function ${ methodName } (): You cannot specify both "merge" ` +
2291
- `and "mergeFields".`
2292
- ) ;
2293
- }
2294
-
2295
- return options ;
2296
- }
2297
-
2298
2264
function validateGetOptions (
2299
2265
methodName : string ,
2300
2266
options : GetOptions | undefined
0 commit comments