Skip to content

Commit 464c68e

Browse files
committed
internal getSettings returns PrivateSettings
1 parent 7dce485 commit 464c68e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

packages/firestore/src/lite-api/database.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export class Firestore implements FirestoreService {
7272

7373
private _settings = new FirestoreSettingsImpl({});
7474
private _settingsFrozen = false;
75-
private _emulatorOptions? : { mockUserToken?: EmulatorMockTokenOptions | string; };
75+
private _emulatorOptions?: {
76+
mockUserToken?: EmulatorMockTokenOptions | string;
77+
};
7678

7779
// A task that is assigned when the terminate() is invoked and resolved when
7880
// all components have shut down. Otherwise, Firestore is not terminated,
@@ -122,22 +124,18 @@ export class Firestore implements FirestoreService {
122124
}
123125
this._settings = new FirestoreSettingsImpl(settings);
124126
this._emulatorOptions = settings.emulatorOptions;
125-
127+
126128
if (settings.credentials !== undefined) {
127129
this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
128130
}
129131
}
130132

131-
_getSettings(): FirestoreSettingsImpl {
132-
return this._settings;
133-
}
134-
135-
_getPrivateSettings() : PrivateSettings {
136-
const privateSettings : PrivateSettings = {
133+
_getSettings(): PrivateSettings {
134+
const privateSettings: PrivateSettings = {
137135
...this._settings,
138136
emulatorOptions: this._emulatorOptions
139137
};
140-
if(this._settings.localCache !== undefined) {
138+
if (this._settings.localCache !== undefined) {
141139
privateSettings.localCache = this._settings.localCache;
142140
}
143141
return privateSettings;
@@ -330,7 +328,7 @@ export function connectFirestoreEmulator(
330328
} = {}
331329
): void {
332330
firestore = cast(firestore, Firestore);
333-
const settings = firestore._getPrivateSettings();
331+
const settings = firestore._getSettings();
334332
const newHostSetting = `${host}:${port}`;
335333

336334
if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) {
@@ -348,11 +346,11 @@ export function connectFirestoreEmulator(
348346

349347
// No-op if the new configuration matches the current configuration. This supports SSR
350348
// enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
351-
if(deepEqual(newSettings, settings)) {
352-
console.error("DEDB settings are the same!");
349+
if (deepEqual(newSettings, settings)) {
350+
console.error('DEDB settings are the same!');
353351
return;
354352
}
355-
console.error("DEDB settings differ!")
353+
console.error('DEDB settings differ!');
356354

357355
firestore._setSettings(newSettings);
358356

packages/firestore/src/lite-api/settings.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { EmulatorMockTokenOptions } from '@firebase/util';
19+
1820
import { FirestoreLocalCache } from '../api/cache_config';
1921
import { CredentialsSettings } from '../api/credentials';
2022
import {
@@ -29,7 +31,6 @@ import {
2931
import { LRU_MINIMUM_CACHE_SIZE_BYTES } from '../local/lru_garbage_collector_impl';
3032
import { Code, FirestoreError } from '../util/error';
3133
import { validateIsNotUsedTogether } from '../util/input_validation';
32-
import { EmulatorMockTokenOptions } from '@firebase/util';
3334

3435
// settings() defaults:
3536
export const DEFAULT_HOST = 'firestore.googleapis.com';
@@ -81,7 +82,7 @@ export interface PrivateSettings extends FirestoreSettings {
8182
experimentalAutoDetectLongPolling?: boolean;
8283
experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
8384
useFetchStreams?: boolean;
84-
emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string; };
85+
emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string };
8586

8687
localCache?: FirestoreLocalCache;
8788
}

0 commit comments

Comments
 (0)