diff --git a/common/api-review/auth-exp.api.md b/common/api-review/auth-exp.api.md index d9a1e801127..256644e00db 100644 --- a/common/api-review/auth-exp.api.md +++ b/common/api-review/auth-exp.api.md @@ -173,6 +173,11 @@ export interface ConfirmationResult { // @public export function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise; +// @public +export function connectAuthEmulator(auth: Auth, url: string, options?: { + disableWarnings: boolean; +}): void; + // @public export function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise; @@ -644,11 +649,6 @@ export function updateProfile(user: User, { displayName, photoURL: photoUrl }: { photoURL?: string | null; }): Promise; -// @public -export function useAuthEmulator(auth: Auth, url: string, options?: { - disableWarnings: boolean; -}): void; - // @public export function useDeviceLanguage(auth: Auth): void; diff --git a/common/api-review/database.api.md b/common/api-review/database.api.md index ad8490ac286..b959ea21736 100644 --- a/common/api-review/database.api.md +++ b/common/api-review/database.api.md @@ -10,6 +10,11 @@ import { FirebaseApp } from '@firebase/app'; // @public export function child(parent: Reference, path: string): Reference; +// @public +export function connectDatabaseEmulator(db: FirebaseDatabase, host: string, port: number, options?: { + mockUserToken?: EmulatorMockTokenOptions; +}): void; + // @public export class DataSnapshot { child(path: string): DataSnapshot; @@ -229,10 +234,5 @@ export type Unsubscribe = () => void; // @public export function update(ref: Reference, values: object): Promise; -// @public -export function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number, options?: { - mockUserToken?: EmulatorMockTokenOptions; -}): void; - ``` diff --git a/common/api-review/functions-exp.api.md b/common/api-review/functions-exp.api.md index 340f5cdbdad..c10af4b0f6c 100644 --- a/common/api-review/functions-exp.api.md +++ b/common/api-review/functions-exp.api.md @@ -7,6 +7,9 @@ import { FirebaseApp } from '@firebase/app-exp'; import { FirebaseError } from '@firebase/util'; +// @public +export function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; + // @public export interface Functions { app: FirebaseApp; @@ -42,8 +45,5 @@ export interface HttpsCallableResult { readonly data: ResponseData; } -// @public -export function useFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; - ``` diff --git a/common/api-review/storage.api.md b/common/api-review/storage.api.md index 2847b663aac..a4d2022d479 100644 --- a/common/api-review/storage.api.md +++ b/common/api-review/storage.api.md @@ -15,6 +15,9 @@ import { Provider } from '@firebase/component'; import { Subscribe } from '@firebase/util'; import { Unsubscribe } from '@firebase/util'; +// @public +export function connectStorageEmulator(storage: StorageService, host: string, port: number): void; + // @public export function deleteObject(ref: StorageReference): Promise; @@ -254,8 +257,5 @@ export interface UploadTaskSnapshot { totalBytes: number; } -// @public -export function useStorageEmulator(storage: StorageService, host: string, port: number): void; - ``` diff --git a/packages-exp/auth-compat-exp/src/auth.ts b/packages-exp/auth-compat-exp/src/auth.ts index 513ab3f7036..b7d3ae33d86 100644 --- a/packages-exp/auth-compat-exp/src/auth.ts +++ b/packages-exp/auth-compat-exp/src/auth.ts @@ -127,7 +127,7 @@ export class Auth return this._delegate.signOut(); } useEmulator(url: string, options?: { disableWarnings: boolean }): void { - exp.useAuthEmulator(this._delegate, url, options); + exp.connectAuthEmulator(this._delegate, url, options); } applyActionCode(code: string): Promise { return exp.applyActionCode(this._delegate, code); diff --git a/packages-exp/auth-exp/src/core/auth/emulator.test.ts b/packages-exp/auth-exp/src/core/auth/emulator.test.ts index 933123afa75..cf7737232ca 100644 --- a/packages-exp/auth-exp/src/core/auth/emulator.test.ts +++ b/packages-exp/auth-exp/src/core/auth/emulator.test.ts @@ -28,7 +28,7 @@ import * as fetch from '../../../test/helpers/mock_fetch'; import { Endpoint } from '../../api'; import { UserInternal } from '../../model/user'; import { _castAuth } from './auth_impl'; -import { useAuthEmulator } from './emulator'; +import { connectAuthEmulator } from './emulator'; use(sinonChai); use(chaiAsPromised); @@ -67,48 +67,49 @@ describe('core/auth/emulator', () => { } }); - context('useAuthEmulator', () => { + context('connectAuthEmulator', () => { it('fails if a network request has already been made', async () => { await user.delete(); - expect(() => useAuthEmulator(auth, 'http://localhost:2020')).to.throw( + expect(() => connectAuthEmulator(auth, 'http://localhost:2020')).to.throw( FirebaseError, 'auth/emulator-config-failed' ); }); it('updates the endpoint appropriately', async () => { - useAuthEmulator(auth, 'http://localhost:2020'); + connectAuthEmulator(auth, 'http://localhost:2020'); await user.delete(); expect(normalEndpoint.calls.length).to.eq(0); expect(emulatorEndpoint.calls.length).to.eq(1); }); it('updates the endpoint appropriately with trailing slash', async () => { - useAuthEmulator(auth, 'http://localhost:2020/'); + connectAuthEmulator(auth, 'http://localhost:2020/'); await user.delete(); expect(normalEndpoint.calls.length).to.eq(0); expect(emulatorEndpoint.calls.length).to.eq(1); }); it('checks the scheme properly', () => { - expect(() => useAuthEmulator(auth, 'http://localhost:2020')).not.to.throw; + expect(() => connectAuthEmulator(auth, 'http://localhost:2020')).not.to + .throw; delete auth.config.emulator; - expect(() => useAuthEmulator(auth, 'https://localhost:2020')).not.to + expect(() => connectAuthEmulator(auth, 'https://localhost:2020')).not.to .throw; delete auth.config.emulator; - expect(() => useAuthEmulator(auth, 'ssh://localhost:2020')).to.throw( + expect(() => connectAuthEmulator(auth, 'ssh://localhost:2020')).to.throw( FirebaseError, 'auth/invalid-emulator-scheme' ); delete auth.config.emulator; - expect(() => useAuthEmulator(auth, 'localhost:2020')).to.throw( + expect(() => connectAuthEmulator(auth, 'localhost:2020')).to.throw( FirebaseError, 'auth/invalid-emulator-scheme' ); }); it('attaches a banner to the DOM', () => { - useAuthEmulator(auth, 'http://localhost:2020'); + connectAuthEmulator(auth, 'http://localhost:2020'); if (typeof document !== 'undefined') { const el = document.querySelector('.firebase-emulator-warning')!; expect(el).not.to.be.null; @@ -121,7 +122,7 @@ describe('core/auth/emulator', () => { it('logs out a warning to the console', () => { sinon.stub(console, 'info'); - useAuthEmulator(auth, 'http://localhost:2020'); + connectAuthEmulator(auth, 'http://localhost:2020'); expect(console.info).to.have.been.calledWith( 'WARNING: You are using the Auth Emulator,' + ' which is intended for local testing only. Do not use with' + @@ -131,7 +132,9 @@ describe('core/auth/emulator', () => { it('logs out the warning but has no banner if disableBanner true', () => { sinon.stub(console, 'info'); - useAuthEmulator(auth, 'http://localhost:2020', { disableWarnings: true }); + connectAuthEmulator(auth, 'http://localhost:2020', { + disableWarnings: true + }); expect(console.info).to.have.been.calledWith( 'WARNING: You are using the Auth Emulator,' + ' which is intended for local testing only. Do not use with' + @@ -143,7 +146,7 @@ describe('core/auth/emulator', () => { }); it('sets emulatorConfig on the Auth object', async () => { - useAuthEmulator(auth, 'http://localhost:2020'); + connectAuthEmulator(auth, 'http://localhost:2020'); expect(auth.emulatorConfig).to.eql({ protocol: 'http', host: 'localhost', @@ -153,7 +156,7 @@ describe('core/auth/emulator', () => { }); it('sets disableWarnings in emulatorConfig accordingly', async () => { - useAuthEmulator(auth, 'https://127.0.0.1', { disableWarnings: true }); + connectAuthEmulator(auth, 'https://127.0.0.1', { disableWarnings: true }); expect(auth.emulatorConfig).to.eql({ protocol: 'https', host: '127.0.0.1', @@ -163,7 +166,7 @@ describe('core/auth/emulator', () => { }); it('quotes IPv6 address in emulatorConfig', async () => { - useAuthEmulator(auth, 'http://[::1]:2020/'); + connectAuthEmulator(auth, 'http://[::1]:2020/'); expect(auth.emulatorConfig).to.eql({ protocol: 'http', host: '[::1]', @@ -181,9 +184,9 @@ describe('core/auth/emulator', () => { }); it('also stringifies the current user', () => { - auth.currentUser = ({ + auth.currentUser = { toJSON: (): object => ({ foo: 'bar' }) - } as unknown) as UserInternal; + } as unknown as UserInternal; expect(JSON.stringify(auth)).to.eq( '{"apiKey":"test-api-key","authDomain":"localhost",' + '"appName":"test-app","currentUser":{"foo":"bar"}}' diff --git a/packages-exp/auth-exp/src/core/auth/emulator.ts b/packages-exp/auth-exp/src/core/auth/emulator.ts index 4f6d12ae0c2..69e465fd84f 100644 --- a/packages-exp/auth-exp/src/core/auth/emulator.ts +++ b/packages-exp/auth-exp/src/core/auth/emulator.ts @@ -31,7 +31,7 @@ import { _castAuth } from './auth_impl'; * * @example * ```javascript - * useAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); + * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); * ``` * * @param auth - The Auth instance. @@ -40,7 +40,7 @@ import { _castAuth } from './auth_impl'; * * @public */ -export function useAuthEmulator( +export function connectAuthEmulator( auth: Auth, url: string, options?: { disableWarnings: boolean } diff --git a/packages-exp/auth-exp/src/core/errors.ts b/packages-exp/auth-exp/src/core/errors.ts index 651e6b08a78..f177292620c 100644 --- a/packages-exp/auth-exp/src/core/errors.ts +++ b/packages-exp/auth-exp/src/core/errors.ts @@ -169,7 +169,7 @@ function _debugErrorMap(): ErrorMap { [AuthErrorCode.EMULATOR_CONFIG_FAILED]: 'Auth instance has already been used to make a network call. Auth can ' + 'no longer be configured to use the emulator. Try calling ' + - '"useAuthEmulator()" sooner.', + '"connectAuthEmulator()" sooner.', [AuthErrorCode.EXPIRED_OOB_CODE]: 'The action code has expired.', [AuthErrorCode.EXPIRED_POPUP_REQUEST]: 'This operation has been cancelled due to another conflicting popup being opened.', diff --git a/packages-exp/auth-exp/src/core/index.ts b/packages-exp/auth-exp/src/core/index.ts index 9041cd72d38..a10530a73fe 100644 --- a/packages-exp/auth-exp/src/core/index.ts +++ b/packages-exp/auth-exp/src/core/index.ts @@ -150,7 +150,7 @@ export function signOut(auth: Auth): Promise { } export { initializeAuth } from './auth/initialize'; -export { useAuthEmulator } from './auth/emulator'; +export { connectAuthEmulator } from './auth/emulator'; // credentials export { AuthCredential } from './credentials'; diff --git a/packages-exp/auth-exp/test/helpers/integration/helpers.ts b/packages-exp/auth-exp/test/helpers/integration/helpers.ts index 8be53a23e52..e84a22b491b 100644 --- a/packages-exp/auth-exp/test/helpers/integration/helpers.ts +++ b/packages-exp/auth-exp/test/helpers/integration/helpers.ts @@ -19,7 +19,7 @@ import * as sinon from 'sinon'; import { deleteApp, initializeApp } from '@firebase/app-exp'; import { Auth, User } from '../../../src/model/public_types'; -import { getAuth, useAuthEmulator } from '../../../'; // Use browser OR node dist entrypoint depending on test env. +import { getAuth, connectAuthEmulator } from '../../../'; // Use browser OR node dist entrypoint depending on test env. import { _generateEventId } from '../../../src/core/util/event_id'; import { getAppConfig, getEmulatorUrl } from './settings'; import { resetEmulator } from './emulator_rest_helpers'; @@ -42,7 +42,7 @@ export function getTestInstance(requireEmulator = false): Auth { if (emulatorUrl) { const stub = stubConsoleToSilenceEmulatorWarnings(); - useAuthEmulator(auth, emulatorUrl, { disableWarnings: true }); + connectAuthEmulator(auth, emulatorUrl, { disableWarnings: true }); stub.restore(); } else if (requireEmulator) { /* Emulator wasn't configured but test must use emulator */ diff --git a/packages-exp/auth-exp/test/integration/webdriver/static/index.js b/packages-exp/auth-exp/test/integration/webdriver/static/index.js index ec69288acc2..92149f0fbd6 100644 --- a/packages-exp/auth-exp/test/integration/webdriver/static/index.js +++ b/packages-exp/auth-exp/test/integration/webdriver/static/index.js @@ -22,7 +22,7 @@ import * as popup from './popup'; import * as email from './email'; import * as persistence from './persistence'; import { initializeApp } from '@firebase/app-exp'; -import { getAuth, useAuthEmulator } from '@firebase/auth-exp'; +import { getAuth, connectAuthEmulator } from '@firebase/auth-exp'; window.core = core; window.anonymous = anonymous; @@ -39,7 +39,7 @@ window.legacyAuth = null; window.startAuth = async () => { const app = initializeApp(firebaseConfig); const auth = getAuth(app); - useAuthEmulator(auth, emulatorUrl); + connectAuthEmulator(auth, emulatorUrl); window.auth = auth; }; diff --git a/packages-exp/functions-compat/src/service.test.ts b/packages-exp/functions-compat/src/service.test.ts index 4c81596cacf..04c26d6950a 100644 --- a/packages-exp/functions-compat/src/service.test.ts +++ b/packages-exp/functions-compat/src/service.test.ts @@ -31,7 +31,7 @@ describe('Firebase Functions > Service', () => { let httpsCallableStub: SinonStub = stub(); before(() => { - functionsEmulatorStub = stub(functionsExp, 'useFunctionsEmulator'); + functionsEmulatorStub = stub(functionsExp, 'connectFunctionsEmulator'); httpsCallableStub = stub(functionsExp, 'httpsCallable'); }); diff --git a/packages-exp/functions-compat/src/service.ts b/packages-exp/functions-compat/src/service.ts index d72902dc62e..5921dd60e84 100644 --- a/packages-exp/functions-compat/src/service.ts +++ b/packages-exp/functions-compat/src/service.ts @@ -18,7 +18,7 @@ import { FirebaseFunctions, HttpsCallable } from '@firebase/functions-types'; import { httpsCallable as httpsCallableExp, - useFunctionsEmulator as useFunctionsEmulatorExp, + connectFunctionsEmulator as useFunctionsEmulatorExp, HttpsCallableOptions, Functions as FunctionsServiceExp } from '@firebase/functions-exp'; diff --git a/packages-exp/functions-exp/src/api.ts b/packages-exp/functions-exp/src/api.ts index 70b98696960..01c54377e36 100644 --- a/packages-exp/functions-exp/src/api.ts +++ b/packages-exp/functions-exp/src/api.ts @@ -23,7 +23,7 @@ import { Functions, HttpsCallableOptions, HttpsCallable } from './public-types'; import { FunctionsService, DEFAULT_REGION, - useFunctionsEmulator as _useFunctionsEmulator, + connectFunctionsEmulator as _connectFunctionsEmulator, httpsCallable as _httpsCallable } from './service'; import { getModularInstance } from '@firebase/util'; @@ -62,12 +62,12 @@ export function getFunctions( * @param port - The emulator port (ex: 5001) * @public */ -export function useFunctionsEmulator( +export function connectFunctionsEmulator( functionsInstance: Functions, host: string, port: number ): void { - _useFunctionsEmulator( + _connectFunctionsEmulator( getModularInstance(functionsInstance as FunctionsService), host, port diff --git a/packages-exp/functions-exp/src/service.test.ts b/packages-exp/functions-exp/src/service.test.ts index 764e323ed03..1a43b32136f 100644 --- a/packages-exp/functions-exp/src/service.test.ts +++ b/packages-exp/functions-exp/src/service.test.ts @@ -16,7 +16,7 @@ */ import { assert } from 'chai'; import { createTestService } from '../test/utils'; -import { FunctionsService, useFunctionsEmulator } from './service'; +import { FunctionsService, connectFunctionsEmulator } from './service'; describe('Firebase Functions > Service', () => { describe('simple constructor', () => { @@ -41,7 +41,7 @@ describe('Firebase Functions > Service', () => { it('can use emulator', () => { service = createTestService(app); - useFunctionsEmulator(service, 'localhost', 5005); + connectFunctionsEmulator(service, 'localhost', 5005); assert.equal( service._url('foo'), 'http://localhost:5005/my-project/us-central1/foo' @@ -58,7 +58,7 @@ describe('Firebase Functions > Service', () => { it('correctly sets region with emulator', () => { service = createTestService(app, 'my-region'); - useFunctionsEmulator(service, 'localhost', 5005); + connectFunctionsEmulator(service, 'localhost', 5005); assert.equal( service._url('foo'), 'http://localhost:5005/my-project/my-region/foo' @@ -72,7 +72,7 @@ describe('Firebase Functions > Service', () => { it('prefers emulator to custom domain', () => { const service = createTestService(app, 'https://mydomain.com'); - useFunctionsEmulator(service, 'localhost', 5005); + connectFunctionsEmulator(service, 'localhost', 5005); assert.equal( service._url('foo'), 'http://localhost:5005/my-project/us-central1/foo' diff --git a/packages-exp/functions-exp/src/service.ts b/packages-exp/functions-exp/src/service.ts index 3ec217aaabc..980371c35a1 100644 --- a/packages-exp/functions-exp/src/service.ts +++ b/packages-exp/functions-exp/src/service.ts @@ -147,7 +147,7 @@ export class FunctionsService implements _FirebaseService { * @param port The emulator port (ex: 5001) * @public */ -export function useFunctionsEmulator( +export function connectFunctionsEmulator( functionsInstance: FunctionsService, host: string, port: number diff --git a/packages-exp/functions-exp/test/utils.ts b/packages-exp/functions-exp/test/utils.ts index 8a258bf23ca..18368efb092 100644 --- a/packages-exp/functions-exp/test/utils.ts +++ b/packages-exp/functions-exp/test/utils.ts @@ -21,7 +21,7 @@ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; import { FirebaseMessagingName } from '@firebase/messaging-types'; import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; import { FunctionsService } from '../src/service'; -import { useFunctionsEmulator } from '../src/api'; +import { connectFunctionsEmulator } from '../src/api'; import nodeFetch from 'node-fetch'; export function makeFakeApp(options: FirebaseOptions = {}): FirebaseApp { @@ -71,7 +71,7 @@ export function createTestService( const useEmulator = !!process.env.FIREBASE_FUNCTIONS_EMULATOR_ORIGIN; if (useEmulator) { const url = new URL(process.env.FIREBASE_FUNCTIONS_EMULATOR_ORIGIN!); - useFunctionsEmulator( + connectFunctionsEmulator( functions, url.hostname, Number.parseInt(url.port, 10) diff --git a/packages/database/exp/api.ts b/packages/database/exp/api.ts index b4a70deddc2..b15d3ee426d 100644 --- a/packages/database/exp/api.ts +++ b/packages/database/exp/api.ts @@ -21,7 +21,7 @@ export { getDatabase, goOffline, goOnline, - useDatabaseEmulator, + connectDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database'; export { diff --git a/packages/database/src/api/Database.ts b/packages/database/src/api/Database.ts index 5428fe2e8e1..671104f848e 100644 --- a/packages/database/src/api/Database.ts +++ b/packages/database/src/api/Database.ts @@ -26,7 +26,7 @@ import { import { goOnline, - useDatabaseEmulator, + connectDatabaseEmulator, goOffline, ref, refFromURL, @@ -78,7 +78,7 @@ export class Database implements FirebaseService, Compat { mockUserToken?: EmulatorMockTokenOptions; } = {} ): void { - useDatabaseEmulator(this._delegate, host, port, options); + connectDatabaseEmulator(this._delegate, host, port, options); } /** diff --git a/packages/database/src/exp/Database.ts b/packages/database/src/exp/Database.ts index b34e8035ebe..bdbb539e6b5 100644 --- a/packages/database/src/exp/Database.ts +++ b/packages/database/src/exp/Database.ts @@ -302,7 +302,7 @@ export function getDatabase( * @param port - The emulator port (ex: 8080) * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules */ -export function useDatabaseEmulator( +export function connectDatabaseEmulator( db: FirebaseDatabase, host: string, port: number, diff --git a/packages/firestore/exp/api.ts b/packages/firestore/exp/api.ts index 00cb3c52b87..747a1fbcb17 100644 --- a/packages/firestore/exp/api.ts +++ b/packages/firestore/exp/api.ts @@ -28,7 +28,7 @@ export { disableNetwork, enableNetwork, terminate, - useFirestoreEmulator, + connectFirestoreEmulator, loadBundle, namedQuery, ensureFirestoreConfigured diff --git a/packages/firestore/lite/index.ts b/packages/firestore/lite/index.ts index 12e1696c713..8191d53d424 100644 --- a/packages/firestore/lite/index.ts +++ b/packages/firestore/lite/index.ts @@ -34,7 +34,7 @@ export { initializeFirestore, getFirestore, terminate, - useFirestoreEmulator + connectFirestoreEmulator } from '../src/lite/database'; export { diff --git a/packages/firestore/src/api/database.ts b/packages/firestore/src/api/database.ts index 4be6d7bb4fb..cff8445c24d 100644 --- a/packages/firestore/src/api/database.ts +++ b/packages/firestore/src/api/database.ts @@ -60,7 +60,7 @@ import { enableNetwork, ensureFirestoreConfigured, FirebaseFirestore as ExpFirebaseFirestore, - useFirestoreEmulator, + connectFirestoreEmulator, waitForPendingWrites, FieldPath as ExpFieldPath, limit, @@ -199,7 +199,8 @@ export class IndexedDbPersistenceProvider implements PersistenceProvider { * to the functional API of firestore-exp. */ export class Firestore - implements PublicFirestore, FirebaseService, Compat { + implements PublicFirestore, FirebaseService, Compat +{ _appCompat?: FirebaseApp; constructor( databaseIdOrApp: DatabaseId | FirebaseApp, @@ -246,7 +247,7 @@ export class Firestore mockUserToken?: EmulatorMockTokenOptions; } = {} ): void { - useFirestoreEmulator(this._delegate, host, port, options); + connectFirestoreEmulator(this._delegate, host, port, options); } enableNetwork(): Promise { @@ -568,7 +569,8 @@ export class WriteBatch implements PublicWriteBatch, Compat { class FirestoreDataConverter implements UntypedFirestoreDataConverter, - Compat> { + Compat> +{ private static readonly INSTANCES = new WeakMap(); private constructor( @@ -643,7 +645,8 @@ class FirestoreDataConverter * A reference to a particular document in a collection in the database. */ export class DocumentReference - implements PublicDocumentReference, Compat> { + implements PublicDocumentReference, Compat> +{ private _userDataWriter: UserDataWriter; constructor( @@ -927,7 +930,8 @@ export function wrapObserver( export interface SnapshotOptions extends PublicSnapshotOptions {} export class DocumentSnapshot - implements PublicDocumentSnapshot, Compat> { + implements PublicDocumentSnapshot, Compat> +{ constructor( private readonly _firestore: Firestore, readonly _delegate: ExpDocumentSnapshot @@ -969,7 +973,8 @@ export class DocumentSnapshot export class QueryDocumentSnapshot extends DocumentSnapshot - implements PublicQueryDocumentSnapshot { + implements PublicQueryDocumentSnapshot +{ data(options?: PublicSnapshotOptions): T { const data = this._delegate.data(options); debugAssert( @@ -981,7 +986,8 @@ export class QueryDocumentSnapshot } export class Query - implements PublicQuery, Compat> { + implements PublicQuery, Compat> +{ private readonly _userDataWriter: UserDataWriter; constructor(readonly firestore: Firestore, readonly _delegate: ExpQuery) { @@ -1159,7 +1165,8 @@ export class Query } export class DocumentChange - implements PublicDocumentChange, Compat> { + implements PublicDocumentChange, Compat> +{ constructor( private readonly _firestore: Firestore, readonly _delegate: ExpDocumentChange @@ -1183,7 +1190,8 @@ export class DocumentChange } export class QuerySnapshot - implements PublicQuerySnapshot, Compat> { + implements PublicQuerySnapshot, Compat> +{ constructor( readonly _firestore: Firestore, readonly _delegate: ExpQuerySnapshot @@ -1238,7 +1246,8 @@ export class QuerySnapshot export class CollectionReference extends Query - implements PublicCollectionReference { + implements PublicCollectionReference +{ constructor( readonly firestore: Firestore, readonly _delegate: ExpCollectionReference diff --git a/packages/firestore/src/exp/database.ts b/packages/firestore/src/exp/database.ts index 97d73ac2fe3..812bddc06bd 100644 --- a/packages/firestore/src/exp/database.ts +++ b/packages/firestore/src/exp/database.ts @@ -60,7 +60,7 @@ import { Deferred } from '../util/promise'; import { LoadBundleTask } from './bundle'; import { PersistenceSettings, Settings } from './settings'; -export { useFirestoreEmulator } from '../lite/database'; +export { connectFirestoreEmulator } from '../lite/database'; /** DOMException error code constants. */ const DOM_EXCEPTION_INVALID_STATE = 11; diff --git a/packages/firestore/src/lite/database.ts b/packages/firestore/src/lite/database.ts index 1c9d1beb64d..292aff14691 100644 --- a/packages/firestore/src/lite/database.ts +++ b/packages/firestore/src/lite/database.ts @@ -233,7 +233,7 @@ export function getFirestore(app: FirebaseApp = getApp()): FirebaseFirestore { * @param options.mockUserToken - the mock auth token to use for unit testing * Security Rules. */ -export function useFirestoreEmulator( +export function connectFirestoreEmulator( firestore: FirebaseFirestore, host: string, port: number, diff --git a/packages/storage/compat/service.ts b/packages/storage/compat/service.ts index b85aae6636f..ab6c6912c5b 100644 --- a/packages/storage/compat/service.ts +++ b/packages/storage/compat/service.ts @@ -23,7 +23,7 @@ import { ReferenceCompat } from './reference'; import { isUrl, StorageService, - useStorageEmulator as internalUseEmulator + connectStorageEmulator as internalUseEmulator } from '../src/service'; import { invalidArgument } from '../src/implementation/error'; import { Compat } from '@firebase/util'; @@ -33,7 +33,8 @@ import { Compat } from '@firebase/util'; * @param opt_url gs:// url to a custom Storage Bucket */ export class StorageServiceCompat - implements types.FirebaseStorage, Compat { + implements types.FirebaseStorage, Compat +{ constructor(public app: FirebaseApp, readonly _delegate: StorageService) {} INTERNAL = { diff --git a/packages/storage/exp/index.ts b/packages/storage/exp/index.ts index 0581a7fae33..b2452fe08ab 100644 --- a/packages/storage/exp/index.ts +++ b/packages/storage/exp/index.ts @@ -31,7 +31,7 @@ import { import { ConnectionPool } from '../src/implementation/connectionPool'; import { StorageService as StorageServiceInternal, - useStorageEmulator as useEmulatorInternal + connectStorageEmulator as useEmulatorInternal } from '../src/service'; import { Component, @@ -53,7 +53,7 @@ import { STORAGE_TYPE } from './constants'; * @param port - The emulator port (ex: 5001) * @public */ -export function useStorageEmulator( +export function connectStorageEmulator( storage: StorageService, host: string, port: number diff --git a/packages/storage/src/service.ts b/packages/storage/src/service.ts index 2ce805dd45c..87f5b05f002 100644 --- a/packages/storage/src/service.ts +++ b/packages/storage/src/service.ts @@ -133,7 +133,7 @@ function extractBucket( return Location.makeFromBucketSpec(bucketString, host); } -export function useStorageEmulator( +export function connectStorageEmulator( storage: StorageService, host: string, port: number diff --git a/packages/storage/test/unit/service.compat.test.ts b/packages/storage/test/unit/service.compat.test.ts index 60f4383ff72..b5d5c502ca8 100644 --- a/packages/storage/test/unit/service.compat.test.ts +++ b/packages/storage/test/unit/service.compat.test.ts @@ -187,7 +187,7 @@ describe('Firebase Storage > Service', () => { }, 'storage/invalid-default-bucket'); }); }); - describe('useStorageEmulator(service, host, port)', () => { + describe('connectStorageEmulator(service, host, port)', () => { it('sets emulator host correctly', done => { function newSend( connection: TestingConnection, diff --git a/packages/storage/test/unit/service.exp.test.ts b/packages/storage/test/unit/service.exp.test.ts index 430407b07f5..840e04102ac 100644 --- a/packages/storage/test/unit/service.exp.test.ts +++ b/packages/storage/test/unit/service.exp.test.ts @@ -18,7 +18,7 @@ import { expect } from 'chai'; import { TaskEvent } from '../../src/implementation/taskenums'; import { Headers } from '../../src/implementation/connection'; import { ConnectionPool } from '../../src/implementation/connectionPool'; -import { StorageService, ref, useStorageEmulator } from '../../src/service'; +import { StorageService, ref, connectStorageEmulator } from '../../src/service'; import * as testShared from './testshared'; import { DEFAULT_HOST } from '../../src/implementation/constants'; import { FirebaseStorageError } from '../../src/implementation/error'; @@ -231,7 +231,7 @@ GOOG4-RSA-SHA256` ); }); }); - describe('useStorageEmulator(service, host, port)', () => { + describe('connectStorageEmulator(service, host, port)', () => { it('sets emulator host correctly', done => { function newSend( connection: TestingConnection, @@ -252,7 +252,7 @@ GOOG4-RSA-SHA256` testShared.fakeAppCheckTokenProvider, testShared.makePool(newSend) ); - useStorageEmulator(service, 'test.host.org', 1234); + connectStorageEmulator(service, 'test.host.org', 1234); expect(service.host).to.equal('http://test.host.org:1234'); void getDownloadURL(ref(service, 'test.png')); });