Skip to content

Commit 15ae0db

Browse files
committed
Formatting
1 parent 79d2ff4 commit 15ae0db

File tree

6 files changed

+94
-54
lines changed

6 files changed

+94
-54
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ export class Auth
219219
break;
220220
case Persistence.LOCAL:
221221
// Not using isIndexedDBAvailable() since it only checks if indexedDB is defined.
222-
const isIndexedDBFullySupported = await exp._getInstance<exp.PersistenceInternal>(exp.indexedDBLocalPersistence)._isAvailable();
222+
const isIndexedDBFullySupported = await exp
223+
._getInstance<exp.PersistenceInternal>(exp.indexedDBLocalPersistence)
224+
._isAvailable();
223225
converted = isIndexedDBFullySupported
224226
? exp.indexedDBLocalPersistence
225227
: exp.browserLocalPersistence;
@@ -333,7 +335,7 @@ export class Auth
333335
return this.auth._delete();
334336
}
335337
private linkUnderlyingAuth(): void {
336-
(this.auth as unknown as ReverseWrapper<Auth>).wrapped = () => this;
338+
((this.auth as unknown) as ReverseWrapper<Auth>).wrapped = () => this;
337339
}
338340
}
339341

packages-exp/auth-compat-exp/src/user_credential.ts

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { unwrap, wrapped } from './wrap';
2424

2525
const enum CredentialFrom {
2626
ERROR = 'credentialFromError',
27-
RESULT = 'credentialFromResult',
27+
RESULT = 'credentialFromResult'
2828
}
2929

3030
function credentialFromResponse(
@@ -33,15 +33,17 @@ function credentialFromResponse(
3333
return credentialFromObject(userCredential);
3434
}
3535

36-
function modifyError(
37-
auth: exp.Auth, e: FirebaseError,
38-
): void {
36+
function modifyError(auth: exp.Auth, e: FirebaseError): void {
3937
// The response contains all fields from the server which may or may not
4038
// actually match the underlying type
41-
const response = (e.customData as exp.TaggedWithTokenResponse|undefined)?._tokenResponse as unknown as Record<string, string>;
39+
const response = ((e.customData as exp.TaggedWithTokenResponse | undefined)
40+
?._tokenResponse as unknown) as Record<string, string>;
4241
if (e.code === 'auth/multi-factor-auth-required') {
4342
const mfaErr = e as compat.MultiFactorError;
44-
mfaErr.resolver = new MultiFactorResolver(auth, exp.getMultiFactorResolver(auth, e as any));
43+
mfaErr.resolver = new MultiFactorResolver(
44+
auth,
45+
exp.getMultiFactorResolver(auth, e as any)
46+
);
4547
} else if (response) {
4648
const credential = credentialFromObject(e);
4749
const credErr = e as compat.AuthError;
@@ -54,13 +56,20 @@ function modifyError(
5456
}
5557
}
5658

57-
function credentialFromObject(object: FirebaseError|exp.UserCredential): exp.AuthCredential|null {
58-
const {_tokenResponse} = (object instanceof FirebaseError ? object.customData : object) as exp.TaggedWithTokenResponse;
59+
function credentialFromObject(
60+
object: FirebaseError | exp.UserCredential
61+
): exp.AuthCredential | null {
62+
const { _tokenResponse } = (object instanceof FirebaseError
63+
? object.customData
64+
: object) as exp.TaggedWithTokenResponse;
5965
if (!_tokenResponse) {
6066
return null;
6167
}
6268

63-
const fn = object instanceof FirebaseError ? CredentialFrom.ERROR : CredentialFrom.RESULT;
69+
const fn =
70+
object instanceof FirebaseError
71+
? CredentialFrom.ERROR
72+
: CredentialFrom.RESULT;
6473

6574
// Handle phone Auth credential responses, as they have a different format
6675
// from other backend responses (i.e. no providerId). This is also only the
@@ -72,7 +81,7 @@ function credentialFromObject(object: FirebaseError|exp.UserCredential): exp.Aut
7281
}
7382

7483
const providerId = _tokenResponse.providerId;
75-
84+
7685
// Email and password is not supported as there is no situation where the
7786
// server would return the password to the client.
7887
if (!providerId || providerId === exp.ProviderId.PASSWORD) {
@@ -115,14 +124,13 @@ function credentialFromObject(object: FirebaseError|exp.UserCredential): exp.Aut
115124
return exp.SAMLAuthCredential._create(providerId, pendingToken);
116125
} else {
117126
// OIDC and non-default providers excluding Twitter.
118-
return exp.OAuthCredential._fromParams(
119-
{
120-
providerId,
121-
signInMethod: providerId,
122-
pendingToken,
123-
idToken: oauthIdToken,
124-
accessToken: oauthAccessToken
125-
});
127+
return exp.OAuthCredential._fromParams({
128+
providerId,
129+
signInMethod: providerId,
130+
pendingToken,
131+
idToken: oauthIdToken,
132+
accessToken: oauthAccessToken
133+
});
126134
}
127135
}
128136
return new exp.OAuthProvider(providerId).credential({
@@ -174,7 +182,10 @@ export async function convertConfirmationResult(
174182

175183
class MultiFactorResolver implements compat.MultiFactorResolver {
176184
readonly auth: Auth;
177-
constructor(auth: exp.Auth, private readonly resolver: exp.MultiFactorResolver) {
185+
constructor(
186+
auth: exp.Auth,
187+
private readonly resolver: exp.MultiFactorResolver
188+
) {
178189
this.auth = wrapped(auth);
179190
}
180191

@@ -186,7 +197,12 @@ class MultiFactorResolver implements compat.MultiFactorResolver {
186197
return this.resolver.hints;
187198
}
188199

189-
resolveSignIn(assertion: compat.MultiFactorAssertion): Promise<compat.UserCredential> {
190-
return convertCredential(unwrap(this.auth), this.resolver.resolveSignIn(assertion as exp.MultiFactorAssertion));
200+
resolveSignIn(
201+
assertion: compat.MultiFactorAssertion
202+
): Promise<compat.UserCredential> {
203+
return convertCredential(
204+
unwrap(this.auth),
205+
this.resolver.resolveSignIn(assertion as exp.MultiFactorAssertion)
206+
);
191207
}
192208
}

packages-exp/auth-compat-exp/test/integration/webdriver/static/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ window.legacyAuth = null;
3939
window.startAuth = async () => {
4040
// Make sure we haven't confused our firebase with the old firebase
4141
if (!firebase.SDK_VERSION.startsWith('0.9')) {
42-
throw new Error('Using legacy SDK version instead of compat version ' + firebase.SDK_VERSION);
42+
throw new Error(
43+
'Using legacy SDK version instead of compat version ' +
44+
firebase.SDK_VERSION
45+
);
4346
}
4447
firebase.initializeApp(firebaseConfig);
4548
firebase.auth().useEmulator(emulatorUrl);
4649
window.compat = firebase;
4750
};
4851

49-
5052
window.startLegacySDK = async persistence => {
5153
return new Promise((resolve, reject) => {
5254
const appScript = document.createElement('script');
@@ -63,7 +65,12 @@ window.startLegacySDK = async persistence => {
6365
window.firebase.initializeApp(firebaseConfig);
6466
// Make sure the firebase variable here is the legacy SDK
6567
if (window.firebase.SDK_VERSION !== '8.3.0') {
66-
reject(new Error('Not using correct legacy version; using ' + window.firebase.SDK_VERSION));
68+
reject(
69+
new Error(
70+
'Not using correct legacy version; using ' +
71+
window.firebase.SDK_VERSION
72+
)
73+
);
6774
}
6875
const legacyAuth = window.firebase.auth();
6976
legacyAuth.useEmulator(emulatorUrl);
@@ -74,4 +81,3 @@ window.startLegacySDK = async persistence => {
7481
document.head.appendChild(authScript);
7582
});
7683
};
77-

packages-exp/auth-compat-exp/test/integration/webdriver/static/popup.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ export function idpPopup(optProvider) {
3333
}
3434

3535
export function idpReauthPopup() {
36-
popupPromise = compat.auth().currentUser.reauthenticateWithPopup(
37-
new compat.auth.GoogleAuthProvider()
38-
);
36+
popupPromise = compat
37+
.auth()
38+
.currentUser.reauthenticateWithPopup(new compat.auth.GoogleAuthProvider());
3939
}
4040

4141
export function idpLinkPopup() {
42-
popupPromise = compat.auth().currentUser.linkWithPopup(new compat.auth.GoogleAuthProvider());
42+
popupPromise = compat
43+
.auth()
44+
.currentUser.linkWithPopup(new compat.auth.GoogleAuthProvider());
4345
}
4446

4547
export function popupResult() {
@@ -64,20 +66,24 @@ export async function linkWithErrorCredential() {
6466
// the popup tests.
6567

6668
export function createFakeGoogleUser(email) {
67-
return compat.auth().signInWithCredential(
68-
compat.auth.GoogleAuthProvider.credential(
69-
`{"sub": "__${email}__", "email": "${email}", "email_verified": true}`
70-
)
71-
);
69+
return compat
70+
.auth()
71+
.signInWithCredential(
72+
compat.auth.GoogleAuthProvider.credential(
73+
`{"sub": "__${email}__", "email": "${email}", "email_verified": true}`
74+
)
75+
);
7276
}
7377

7478
export async function tryToSignInUnverified(email) {
7579
try {
76-
await compat.auth().signInWithCredential(
77-
compat.auth.FacebookAuthProvider.credential(
78-
`{"sub": "$$${email}$$", "email": "${email}", "email_verified": false}`
79-
)
80-
);
80+
await compat
81+
.auth()
82+
.signInWithCredential(
83+
compat.auth.FacebookAuthProvider.credential(
84+
`{"sub": "$$${email}$$", "email": "${email}", "email_verified": false}`
85+
)
86+
);
8187
} catch (e) {
8288
errorCred = e.credential;
8389
throw e;

packages-exp/auth-compat-exp/test/integration/webdriver/static/redirect.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ export function idpRedirect(optProvider) {
2626
}
2727

2828
export function idpReauthRedirect() {
29-
compat.auth().currentUser.reauthenticateWithRedirect(new compat.auth.GoogleAuthProvider());
29+
compat
30+
.auth()
31+
.currentUser.reauthenticateWithRedirect(
32+
new compat.auth.GoogleAuthProvider()
33+
);
3034
}
3135

3236
export function idpLinkRedirect() {
33-
compat.auth().currentUser.linkWithRedirect(new compat.auth.GoogleAuthProvider());
37+
compat
38+
.auth()
39+
.currentUser.linkWithRedirect(new compat.auth.GoogleAuthProvider());
3440
}
3541

3642
export function redirectResult() {
@@ -55,20 +61,24 @@ export async function linkWithErrorCredential() {
5561
// the redirect tests.
5662

5763
export function createFakeGoogleUser(email) {
58-
return compat.auth().signInWithCredential(
59-
compat.auth.GoogleAuthProvider.credential(
60-
`{"sub": "__${email}__", "email": "${email}", "email_verified": true}`
61-
)
62-
);
64+
return compat
65+
.auth()
66+
.signInWithCredential(
67+
compat.auth.GoogleAuthProvider.credential(
68+
`{"sub": "__${email}__", "email": "${email}", "email_verified": true}`
69+
)
70+
);
6371
}
6472

6573
export async function tryToSignInUnverified(email) {
6674
try {
67-
await compat.auth().signInWithCredential(
68-
compat.auth.FacebookAuthProvider.credential(
69-
`{"sub": "$$${email}$$", "email": "${email}", "email_verified": false}`
70-
)
71-
);
75+
await compat
76+
.auth()
77+
.signInWithCredential(
78+
compat.auth.FacebookAuthProvider.credential(
79+
`{"sub": "$$${email}$$", "email": "${email}", "email_verified": false}`
80+
)
81+
);
7282
} catch (e) {
7383
errorCred = e.credential;
7484
throw e;

packages-exp/auth-exp/internal/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export { DefaultConfig, AuthImpl, _castAuth } from '../src/core/auth/auth_impl';
3838
export { ClientPlatform, _getClientVersion } from '../src/core/util/version';
3939

4040
export { _generateEventId } from '../src/core/util/event_id';
41-
export { TaggedWithTokenResponse} from '../src/model/id_token';
41+
export { TaggedWithTokenResponse } from '../src/model/id_token';
4242
export { _fail, _assert } from '../src/core/util/assert';
4343
export { AuthPopup } from '../src/platform_browser/util/popup';
4444
export { _getRedirectResult } from '../src/platform_browser/strategies/redirect';

0 commit comments

Comments
 (0)