Skip to content

overload User related functions for auth exp #4701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 22 additions & 41 deletions packages-exp/auth-compat-exp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,7 @@ import {
InstantiationMode
} from '@firebase/component';

import {
EmailAuthProvider,
EmailAuthProvider_Instance,
FacebookAuthProvider,
FacebookAuthProvider_Instance,
FirebaseAuth as AuthCompat,
GithubAuthProvider,
GithubAuthProvider_Instance,
GoogleAuthProvider,
GoogleAuthProvider_Instance,
OAuthProvider,
PhoneAuthProvider,
PhoneAuthProvider_Instance,
PhoneMultiFactorGenerator,
RecaptchaVerifier,
RecaptchaVerifier_Instance,
SAMLAuthProvider,
TwitterAuthProvider,
TwitterAuthProvider_Instance
} from '@firebase/auth-types';
import * as types from '@firebase/auth-types';
import { version } from './package.json';
import { Auth } from './src/auth';
import { Persistence } from './src/persistence';
Expand All @@ -56,36 +37,36 @@ const AUTH_TYPE = 'auth-compat';

declare module '@firebase/component' {
interface NameServiceMapping {
'auth-compat': AuthCompat;
'auth-compat': types.FirebaseAuth;
}
}

declare module '@firebase/app-compat' {
interface FirebaseNamespace {
auth: {
(app?: FirebaseApp): AuthCompat;
Auth: typeof AuthCompat;
EmailAuthProvider: typeof EmailAuthProvider;
EmailAuthProvider_Instance: typeof EmailAuthProvider_Instance;
FacebookAuthProvider: typeof FacebookAuthProvider;
FacebookAuthProvider_Instance: typeof FacebookAuthProvider_Instance;
GithubAuthProvider: typeof GithubAuthProvider;
GithubAuthProvider_Instance: typeof GithubAuthProvider_Instance;
GoogleAuthProvider: typeof GoogleAuthProvider;
GoogleAuthProvider_Instance: typeof GoogleAuthProvider_Instance;
OAuthProvider: typeof OAuthProvider;
SAMLAuthProvider: typeof SAMLAuthProvider;
PhoneAuthProvider: typeof PhoneAuthProvider;
PhoneAuthProvider_Instance: typeof PhoneAuthProvider_Instance;
PhoneMultiFactorGenerator: typeof PhoneMultiFactorGenerator;
RecaptchaVerifier: typeof RecaptchaVerifier;
RecaptchaVerifier_Instance: typeof RecaptchaVerifier_Instance;
TwitterAuthProvider: typeof TwitterAuthProvider;
TwitterAuthProvider_Instance: typeof TwitterAuthProvider_Instance;
(app?: FirebaseApp): types.FirebaseAuth;
Auth: typeof types.FirebaseAuth;
EmailAuthProvider: typeof types.EmailAuthProvider;
EmailAuthProvider_Instance: typeof types.EmailAuthProvider_Instance;
FacebookAuthProvider: typeof types.FacebookAuthProvider;
FacebookAuthProvider_Instance: typeof types.FacebookAuthProvider_Instance;
GithubAuthProvider: typeof types.GithubAuthProvider;
GithubAuthProvider_Instance: typeof types.GithubAuthProvider_Instance;
GoogleAuthProvider: typeof types.GoogleAuthProvider;
GoogleAuthProvider_Instance: typeof types.GoogleAuthProvider_Instance;
OAuthProvider: typeof types.OAuthProvider;
SAMLAuthProvider: typeof types.SAMLAuthProvider;
PhoneAuthProvider: typeof types.PhoneAuthProvider;
PhoneAuthProvider_Instance: typeof types.PhoneAuthProvider_Instance;
PhoneMultiFactorGenerator: typeof types.PhoneMultiFactorGenerator;
RecaptchaVerifier: typeof types.RecaptchaVerifier;
RecaptchaVerifier_Instance: typeof types.RecaptchaVerifier_Instance;
TwitterAuthProvider: typeof types.TwitterAuthProvider;
TwitterAuthProvider_Instance: typeof types.TwitterAuthProvider_Instance;
};
}
interface FirebaseApp {
auth?(): AuthCompat;
auth?(): types.FirebaseAuth;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages-exp/auth-compat-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
"test:integration": "run-s test:browser:integration test:node:integration test:webdriver",
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth-exp/dist/auth-exp-public.d.ts -o dist/auth-compat-exp/index.d.ts -a -r Auth:AuthCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth-exp/dist/auth-exp-public.d.ts -o dist/auth-compat-exp/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
},
"peerDependencies": {
"@firebase/app-compat": "0.x"
Expand Down
10 changes: 4 additions & 6 deletions packages-exp/auth-exp/src/core/user/account_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ import { UserInternal } from '../../model/user';
import { _logoutIfInvalidated } from './invalidation';
import { getModularInstance } from '@firebase/util';

interface Profile {
displayName?: string | null;
photoURL?: string | null;
}

/**
* Updates a user's profile data.
*
Expand All @@ -41,7 +36,10 @@ interface Profile {
*/
export async function updateProfile(
user: User,
{ displayName, photoURL: photoUrl }: Profile
{
displayName,
photoURL: photoUrl
}: { displayName?: string | null; photoURL?: string | null }
): Promise<void> {
if (displayName === undefined && photoUrl === undefined) {
return;
Expand Down