Skip to content

Remove Auth internal types from the public typings #5460

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
Sep 8, 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
5 changes: 5 additions & 0 deletions .changeset/slimy-penguins-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/auth": patch
---

Remove `const enum`s from the public typing file.
3 changes: 3 additions & 0 deletions packages/auth/src/api/authentication/idp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export interface SignInWithIdpRequest {
pendingToken?: string;
}

/**
* @internal
*/
export interface SignInWithIdpResponse extends IdTokenResponse {
oauthAccessToken?: string;
oauthTokenSecret?: string;
Expand Down
6 changes: 6 additions & 0 deletions packages/auth/src/api/authentication/mfa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export interface FinalizeMfaResponse {
refreshToken: string;
}

/**
* @internal
*/
export interface IdTokenMfaResponse extends IdTokenResponse {
mfaPendingCredential?: string;
mfaInfo?: MfaEnrollment[];
Expand Down Expand Up @@ -84,6 +87,9 @@ export function finalizeSignInPhoneMfa(
});
}

/**
* @internal
*/
export type PhoneOrOauthTokenResponse =
| SignInWithPhoneNumberResponse
| SignInWithIdpResponse
Expand Down
6 changes: 6 additions & 0 deletions packages/auth/src/api/authentication/sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export async function sendPhoneVerificationCode(
);
}

/**
* @internal
*/
export interface SignInWithPhoneNumberRequest {
temporaryProof?: string;
phoneNumber?: string;
Expand All @@ -66,6 +69,9 @@ export interface LinkWithPhoneNumberRequest
idToken: string;
}

/**
* @internal
*/
export interface SignInWithPhoneNumberResponse extends IdTokenResponse {
temporaryProof?: string;
phoneNumber?: string;
Expand Down
8 changes: 8 additions & 0 deletions packages/auth/src/core/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { AuthCredential } from './credentials';

/**
* Enumeration of Firebase Auth error codes.
*
* @internal
*/
export const enum AuthErrorCode {
ADMIN_ONLY_OPERATION = 'admin-restricted-operation',
Expand Down Expand Up @@ -399,6 +401,9 @@ export interface NamedErrorParams {
serverResponse?: object;
}

/**
* @internal
*/
type GenericAuthErrorParams = {
[key in Exclude<
AuthErrorCode,
Expand All @@ -415,6 +420,9 @@ type GenericAuthErrorParams = {
};
};

/**
* @internal
*/
export interface AuthErrorParams extends GenericAuthErrorParams {
[AuthErrorCode.ARGUMENT_ERROR]: { appName?: AppName };
[AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: { appName?: AppName };
Expand Down
3 changes: 3 additions & 0 deletions packages/auth/src/core/util/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export const enum ClientImplementation {
CORE = 'JsCore'
}

/**
* @internal
*/
export const enum ClientPlatform {
BROWSER = 'Browser',
NODE = 'Node',
Expand Down
3 changes: 3 additions & 0 deletions packages/auth/src/model/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export type AppName = string;
export type ApiKey = string;
export type AuthDomain = string;

/**
* @internal
*/
export interface ConfigInternal extends Config {
/**
* @readonly
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/src/model/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/**
* Enumeration of supported providers.
*
* @internal
*/
export const enum ProviderId {
/** @internal */
Expand All @@ -42,7 +42,7 @@ export const enum ProviderId {

/**
* Enumeration of supported sign-in methods.
*
* @internal
*/
export const enum SignInMethod {
/** @internal */
Expand All @@ -65,7 +65,7 @@ export const enum SignInMethod {

/**
* Enumeration of supported operation types.
*
* @internal
*/
export const enum OperationType {
/** Operation involving linking an additional provider to an already signed-in user. */
Expand Down
2 changes: 2 additions & 0 deletions packages/auth/src/model/id_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface ParsedIdToken {
/**
* IdToken as returned by the API
*
* @internal
*/
export interface IdTokenResponse {
localId: string;
Expand All @@ -67,6 +68,7 @@ export interface IdTokenResponse {
/**
* The possible types of the `IdTokenResponse`
*
* @internal
*/
export const enum IdTokenResponseKind {
CreateAuthUri = 'identitytoolkit#CreateAuthUriResponse',
Expand Down
12 changes: 12 additions & 0 deletions packages/auth/src/model/popup_redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export interface GapiAuthEvent extends gapi.iframes.Message {
authEvent: AuthEvent;
}

/**
* @internal
*/
export const enum AuthEventType {
LINK_VIA_POPUP = 'linkViaPopup',
LINK_VIA_REDIRECT = 'linkViaRedirect',
Expand All @@ -57,6 +60,9 @@ export interface AuthEventError extends Error {
message: string;
}

/**
* @internal
*/
export interface AuthEvent {
type: AuthEventType;
eventId: string | null;
Expand All @@ -67,13 +73,19 @@ export interface AuthEvent {
error?: AuthEventError;
}

/**
* @internal
*/
export interface AuthEventConsumer {
readonly filter: AuthEventType[];
eventId: string | null;
onAuthEvent(event: AuthEvent): unknown;
onError(error: FirebaseError): unknown;
}

/**
* @internal
*/
export interface EventManager {
registerConsumer(authEventConsumer: AuthEventConsumer): void;
unregisterConsumer(authEventConsumer: AuthEventConsumer): void;
Expand Down