Skip to content

Commit 1b9cfaa

Browse files
committed
Formatting
1 parent fd9d539 commit 1b9cfaa

File tree

8 files changed

+41
-31
lines changed

8 files changed

+41
-31
lines changed

packages-exp/auth-exp/src/api/authentication/token.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
import { querystring } from '@firebase/util';
2121

22-
import { _getFinalTarget, _performFetchWithErrorHandling, HttpMethod } from '../';
22+
import {
23+
_getFinalTarget,
24+
_performFetchWithErrorHandling,
25+
HttpMethod
26+
} from '../';
2327
import { FetchProvider } from '../../core/util/fetch_provider';
2428
import { AuthCore } from '../../model/auth';
2529

@@ -51,7 +55,10 @@ export async function requestStsToken(
5155
'refresh_token': refreshToken
5256
}).slice(1);
5357
const { apiScheme, tokenApiHost, apiKey, sdkClientVersion } = auth.config;
54-
const url = _getFinalTarget(auth, `${apiScheme}://${tokenApiHost}/${_ENDPOINT}`);
58+
const url = _getFinalTarget(
59+
auth,
60+
`${apiScheme}://${tokenApiHost}/${_ENDPOINT}`
61+
);
5562

5663
return FetchProvider.fetch()(`${url}?key=${apiKey}`, {
5764
method: HttpMethod.POST,

packages-exp/auth-exp/src/api/index.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,11 @@
1717

1818
import { FirebaseError, querystring } from '@firebase/util';
1919

20-
<<<<<<< HEAD
21-
import {
22-
AUTH_ERROR_FACTORY,
23-
AuthErrorCode,
24-
NamedErrorParams
25-
} from '../core/errors';
26-
import { fail } from '../core/util/assert';
27-
import { Delay } from '../core/util/delay';
28-
import { FetchProvider } from '../core/util/fetch_provider';
29-
import { AuthCore } from '../model/auth';
30-
=======
3120
import { AUTH_ERROR_FACTORY, AuthErrorCode, NamedErrorParams } from '../core/errors';
3221
import { fail } from '../core/util/assert';
3322
import { Delay } from '../core/util/delay';
3423
import { FetchProvider } from '../core/util/fetch_provider';
3524
import { Auth, AuthCore } from '../model/auth';
36-
>>>>>>> be103af54 (Add hooks into emulator for auth-next)
3725
import { IdTokenResponse, TaggedWithTokenResponse } from '../model/id_token';
3826
import { IdTokenMfaResponse } from './authentication/mfa';
3927
import { SERVER_ERROR_MAP, ServerError, ServerErrorMap } from './errors';
@@ -107,7 +95,10 @@ export async function _performApiRequest<T, V>(
10795
}
10896

10997
return FetchProvider.fetch()(
110-
_getFinalTarget(auth, `${auth.config.apiScheme}://${auth.config.apiHost}${path}?${query}`),
98+
_getFinalTarget(
99+
auth,
100+
`${auth.config.apiScheme}://${auth.config.apiHost}${path}?${query}`
101+
),
111102
{
112103
method,
113104
headers,
@@ -193,7 +184,7 @@ export async function _performSignInRequest<T, V extends IdTokenResponse>(
193184
}
194185

195186
export function _getFinalTarget(auth: AuthCore, url: string): string {
196-
const {emulator} = auth.config;
187+
const { emulator } = auth.config;
197188
if (!emulator) {
198189
return url;
199190
}

packages-exp/auth-exp/src/core/auth/auth_impl.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
import { _FirebaseService, FirebaseApp } from '@firebase/app-types-exp';
1919
import * as externs from '@firebase/auth-types-exp';
2020
import {
21-
CompleteFn, createSubscribe, ErrorFn, NextFn, Observer, Subscribe, Unsubscribe
21+
CompleteFn,
22+
createSubscribe,
23+
ErrorFn,
24+
NextFn,
25+
Observer,
26+
Subscribe,
27+
Unsubscribe
2228
} from '@firebase/util';
2329

2430
import { Auth, AuthCore } from '../../model/auth';
@@ -27,7 +33,8 @@ import { User, UserParameters } from '../../model/user';
2733
import { AuthErrorCode } from '../errors';
2834
import { Persistence } from '../persistence';
2935
import {
30-
_REDIRECT_USER_KEY_NAME, PersistenceUserManager
36+
_REDIRECT_USER_KEY_NAME,
37+
PersistenceUserManager
3138
} from '../persistence/persistence_user_manager';
3239
import { _reloadWithoutSaving } from '../user/reload';
3340
import { UserImpl } from '../user/user_impl';
@@ -56,7 +63,7 @@ export class AuthImplCompat<T extends User> implements Auth, _FirebaseService {
5663
private idTokenSubscription = new Subscription<T>(this);
5764
private redirectUser: T | null = null;
5865
private isProactiveRefreshEnabled = false;
59-
66+
6067
// Any network calls will set this to true and prevent subsequent emulator
6168
// initialization
6269
_canInitEmulator = true;

packages-exp/auth-exp/src/core/auth/initialize.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ describe('core/auth/initialize', () => {
3838
user = testUser(_castAuth(auth), 'uid', 'email', true);
3939
fetch.setUp();
4040
normalEndpoint = mockEndpoint(Endpoint.DELETE_ACCOUNT, {});
41-
emulatorEndpoint = fetch.mock(`http://localhost:2020/${endpointUrl(Endpoint.DELETE_ACCOUNT).replace(/^.*:\/\//, '')}`, {});
41+
emulatorEndpoint = fetch.mock(
42+
`http://localhost:2020/${endpointUrl(Endpoint.DELETE_ACCOUNT).replace(
43+
/^.*:\/\//,
44+
''
45+
)}`,
46+
{}
47+
);
4248
});
4349

4450
afterEach(() => {
@@ -48,7 +54,10 @@ describe('core/auth/initialize', () => {
4854
context('useEmulator', () => {
4955
it('fails if a network request has already been made', async () => {
5056
await user.delete();
51-
expect(() => useEmulator(auth, 'localhost', 2020)).to.throw(FirebaseError, 'auth/emulator-config-failed');
57+
expect(() => useEmulator(auth, 'localhost', 2020)).to.throw(
58+
FirebaseError,
59+
'auth/emulator-config-failed'
60+
);
5261
});
5362

5463
it('updates the endpoint appropriately', async () => {
@@ -58,4 +67,4 @@ describe('core/auth/initialize', () => {
5867
expect(emulatorEndpoint.calls.length).to.eq(1);
5968
});
6069
});
61-
});
70+
});

packages-exp/auth-exp/src/core/auth/initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function initializeAuth(
3939
export function useEmulator(
4040
authExtern: externs.Auth,
4141
hostname: string,
42-
port: number,
42+
port: number
4343
): void {
4444
const auth = _castAuth(authExtern);
4545
if (!auth._canInitEmulator) {

packages-exp/auth-exp/src/core/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const enum AuthErrorCode {
117117
USER_MISMATCH = 'user-mismatch',
118118
USER_SIGNED_OUT = 'user-signed-out',
119119
WEAK_PASSWORD = 'weak-password',
120-
WEB_STORAGE_UNSUPPORTED = 'web-storage-unsupported',
120+
WEB_STORAGE_UNSUPPORTED = 'web-storage-unsupported'
121121
}
122122

123123
const ERRORS: ErrorMap<AuthErrorCode> = {

packages-exp/auth-exp/src/model/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface ConfigInternal extends externs.Config {
2929
emulator?: {
3030
hostname: string;
3131
port: number;
32-
}
32+
};
3333
}
3434

3535
/**

packages-exp/auth-exp/test/helpers/api/helper.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Endpoint } from '../../../src/api';
1919
import { TEST_HOST, TEST_KEY, TEST_SCHEME } from '../mock_auth';
2020
import { mock, Route } from '../mock_fetch';
2121

22-
export function endpointUrl(endpoint: Endpoint):string {
22+
export function endpointUrl(endpoint: Endpoint): string {
2323
return `${TEST_SCHEME}://${TEST_HOST}${endpoint}?key=${TEST_KEY}`;
2424
}
2525

@@ -28,9 +28,5 @@ export function mockEndpoint(
2828
response: object,
2929
status = 200
3030
): Route {
31-
return mock(
32-
endpointUrl(endpoint),
33-
response,
34-
status
35-
);
31+
return mock(endpointUrl(endpoint), response, status);
3632
}

0 commit comments

Comments
 (0)