Skip to content

Expose only public types from Auth exp #4398

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 2 commits into from
Feb 3, 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
7 changes: 6 additions & 1 deletion packages-exp/auth-exp/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": "../../config/api-extractor.json",
// Point it to your entry point d.ts file.
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.d.ts",
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"
}
}
5 changes: 3 additions & 2 deletions packages-exp/auth-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c && yarn api-report",
"build:deps": "lerna run --scope @firebase/auth-exp --include-dependencies build",
"build:release": "rollup -c rollup.config.release.js",
"build:release": "rollup -c rollup.config.release.js && yarn api-report && yarn typings:public",
"dev": "rollup -c -w",
"test": "run-p lint test:all",
"test:all": "run-p test:browser test:node",
Expand All @@ -31,7 +31,8 @@
"api-report": "api-extractor run --local --verbose",
"predoc": "node ../../scripts/exp/remove-exp.js temp",
"doc": "api-documenter markdown --input temp --output docs",
"build:doc": "yarn build && yarn doc"
"build:doc": "yarn build && yarn doc",
"typings:public": "node ../../scripts/exp/use_typings.js ./dist/auth-exp-public.d.ts"
},
"peerDependencies": {
"@firebase/app-exp": "0.x",
Expand Down
3 changes: 0 additions & 3 deletions packages-exp/auth-exp/src/core/action_code_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { _assert } from './util/assert';
* Enums for fields in URL query string.
*
* @enum {string}
* @internal
*/
const enum QueryField {
API_KEY = 'apiKey',
Expand All @@ -38,7 +37,6 @@ const enum QueryField {
* Maps the mode string in action code URL to Action Code Info operation.
*
* @param mode
* @internal
*/
function parseMode(mode: string | null): externs.ActionCodeOperation | null {
switch (mode) {
Expand All @@ -63,7 +61,6 @@ function parseMode(mode: string | null): externs.ActionCodeOperation | null {
* Helper to parse FDL links
*
* @param url
* @internal
*/
function parseDeepLink(url: string): string {
const uri = new URL(url);
Expand Down
3 changes: 0 additions & 3 deletions packages-exp/auth-exp/src/core/credentials/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import { AuthCredential } from './auth_credential';

const IDP_REQUEST_URI = 'http://localhost';

/**
* @internal
*/
export interface OAuthCredentialParams {
// OAuth 2 uses either id token or access token
idToken?: string | null;
Expand Down
1 change: 0 additions & 1 deletion packages-exp/auth-exp/src/core/credentials/phone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { Auth } from '../../model/auth';
import { IdTokenResponse } from '../../model/id_token';
import { AuthCredential } from './auth_credential';

/** @internal */
export interface PhoneAuthCredentialParameters {
verificationId?: string;
verificationCode?: string;
Expand Down
1 change: 0 additions & 1 deletion packages-exp/auth-exp/src/core/strategies/credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { _reauthenticate } from '../user/reauthenticate';
import { UserCredentialImpl } from '../user/user_credential_impl';
import { _castAuth } from '../auth/auth_impl';

/** @internal */
export async function _signInWithCredential(
auth: Auth,
credential: AuthCredential,
Expand Down
6 changes: 0 additions & 6 deletions packages-exp/auth-exp/src/core/strategies/idp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { _assert } from '../util/assert';
import { _signInWithCredential } from './credential';
import { AuthErrorCode } from '../errors';

/** @internal */
export interface IdpTaskParams {
auth: Auth;
requestUri: string;
Expand All @@ -43,10 +42,8 @@ export interface IdpTaskParams {
bypassAuthState?: boolean;
}

/** @internal */
export type IdpTask = (params: IdpTaskParams) => Promise<UserCredential>;

/** @internal */
class IdpCredential extends AuthCredential {
constructor(readonly params: IdpTaskParams) {
super(externs.ProviderId.CUSTOM, externs.ProviderId.CUSTOM);
Expand Down Expand Up @@ -82,7 +79,6 @@ class IdpCredential extends AuthCredential {
}
}

/** @internal */
export function _signIn(params: IdpTaskParams): Promise<UserCredential> {
return _signInWithCredential(
params.auth,
Expand All @@ -91,7 +87,6 @@ export function _signIn(params: IdpTaskParams): Promise<UserCredential> {
) as Promise<UserCredential>;
}

/** @internal */
export function _reauth(params: IdpTaskParams): Promise<UserCredential> {
const { auth, user } = params;
_assert(user, auth, AuthErrorCode.INTERNAL_ERROR);
Expand All @@ -102,7 +97,6 @@ export function _reauth(params: IdpTaskParams): Promise<UserCredential> {
);
}

/** @internal */
export async function _link(params: IdpTaskParams): Promise<UserCredential> {
const { auth, user } = params;
_assert(user, auth, AuthErrorCode.INTERNAL_ERROR);
Expand Down
1 change: 0 additions & 1 deletion packages-exp/auth-exp/src/core/user/account_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export function updatePassword(
return updateEmailOrPassword(user as User, null, newPassword);
}

/** @internal */
async function updateEmailOrPassword(
user: User,
email: string | null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { UserCredential } from '../../model/user';
/**
* Parse the `AdditionalUserInfo` from the ID token response.
*
* @internal
*/
export function _fromIdTokenResponse(
idTokenResponse?: IdTokenResponse
Expand Down
3 changes: 0 additions & 3 deletions packages-exp/auth-exp/src/core/user/id_token_result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ function secondsStringToMilliseconds(seconds: string): number {
return Number(seconds) * 1000;
}

/** @internal */
export function _parseToken(token: string): externs.ParsedToken | null {
const [algorithm, payload, signature] = token.split('.');
if (
Expand All @@ -121,8 +120,6 @@ export function _parseToken(token: string): externs.ParsedToken | null {

/**
* Extract expiresIn TTL from a token by subtracting the expiration from the issuance.
*
* @internal
*/
export function _tokenExpiresIn(token: string): number {
const parsedToken = _parseToken(token);
Expand Down
2 changes: 0 additions & 2 deletions packages-exp/auth-exp/src/core/user/link_unlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export async function unlink(
return user;
}

/** @internal */
export async function _link(
user: User,
credential: AuthCredential,
Expand All @@ -77,7 +76,6 @@ export async function _link(
);
}

/** @internal */
export async function _assertLinkedStatus(
expected: boolean,
user: User,
Expand Down
2 changes: 0 additions & 2 deletions packages-exp/auth-exp/src/core/user/token_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import { _tokenExpiresIn } from './id_token_result';
/**
* The number of milliseconds before the official expiration time of a token
* to refresh that token, to provide a buffer for RPCs to complete.
*
* @internal
*/
export const enum Buffer {
TOKEN_REFRESH = 30_000
Expand Down
2 changes: 0 additions & 2 deletions packages-exp/auth-exp/src/core/util/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { _getInstance } from './instantiator';
* Chooses a popup/redirect resolver to use. This prefers the override (which
* is directly passed in), and falls back to the property set on the auth
* object. If neither are available, this function errors w/ an argument error.
*
* @internal
*/
export function _withDefaultResolver(
auth: Auth,
Expand Down
5 changes: 3 additions & 2 deletions packages-exp/auth-exp/src/model/application_verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

import * as externs from '@firebase/auth-types-exp';

/** @internal */
export interface ApplicationVerifier extends externs.ApplicationVerifier {
/** @internal */
/**
* @internal
*/
_reset(): void;
}
27 changes: 0 additions & 27 deletions packages-exp/auth-exp/src/model/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,76 +22,49 @@ import { AuthErrorCode, AuthErrorParams } from '../core/errors';
import { PopupRedirectResolver } from './popup_redirect';
import { User } from './user';

/** @internal */
export type AppName = string;
/** @internal */
export type ApiKey = string;
/** @internal */
export type AuthDomain = string;

/** @internal */
export interface ConfigInternal extends externs.Config {
/**
* @internal
* @readonly
*/
emulator?: {
url: string;
};
}

/** @internal */
export interface Auth extends externs.Auth {
/** @internal */
currentUser: externs.User | null;
/** @internal */
_canInitEmulator: boolean;
/** @internal */
_isInitialized: boolean;
/** @internal */
_initializationPromise: Promise<void> | null;
/** @internal */
_updateCurrentUser(user: User | null): Promise<void>;

/** @internal */
_onStorageEvent(): void;

/** @internal */
_notifyListenersIfCurrent(user: User): void;
/** @internal */
_persistUserIfCurrent(user: User): Promise<void>;
/** @internal */
_setRedirectUser(
user: User | null,
popupRedirectResolver?: externs.PopupRedirectResolver
): Promise<void>;
/** @internal */
_redirectUserForId(id: string): Promise<User | null>;
/** @internal */
_popupRedirectResolver: PopupRedirectResolver | null;
/** @internal */
_key(): string;
/** @internal */
_startProactiveRefresh(): void;
/** @internal */
_stopProactiveRefresh(): void;
_getPersistence(): string;

/** @internal */
readonly name: AppName;
/** @internal */
readonly config: ConfigInternal;
/** @internal */
languageCode: string | null;
/** @internal */
tenantId: string | null;
/** @internal */
readonly settings: externs.AuthSettings;
_errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;

/** @internal */
useDeviceLanguage(): void;
/** @internal */
signOut(): Promise<void>;
}

Expand Down
7 changes: 0 additions & 7 deletions packages-exp/auth-exp/src/model/id_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ import { PhoneOrOauthTokenResponse } from '../api/authentication/mfa';
/**
* Raw encoded JWT
*
* @internal
*/
export type IdToken = string;

/**
* Raw parsed JWT
*
* @internal
*/
export interface ParsedIdToken {
iss: string;
Expand All @@ -51,7 +49,6 @@ export interface ParsedIdToken {
/**
* IdToken as returned by the API
*
* @internal
*/
export interface IdTokenResponse {
localId: string;
Expand All @@ -72,7 +69,6 @@ export interface IdTokenResponse {
/**
* The possible types of the `IdTokenResponse`
*
* @internal
*/
export const enum IdTokenResponseKind {
CreateAuthUri = 'identitytoolkit#CreateAuthUriResponse',
Expand All @@ -91,9 +87,6 @@ export const enum IdTokenResponseKind {
VerifyPassword = 'identitytoolkit#VerifyPasswordResponse'
}

/**
* @internal
*/
export interface TaggedWithTokenResponse {
_tokenResponse?: PhoneOrOauthTokenResponse;
}
Loading