From 030cb596ae83bfd88b73434388262c9810fca07a Mon Sep 17 00:00:00 2001 From: Brian Li Date: Wed, 9 Oct 2024 14:05:44 -0400 Subject: [PATCH] api comment fixes --- src/common/providers/identity.ts | 20 ++++++++++++-------- src/v2/providers/identity.ts | 27 +++++++++++++-------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/common/providers/identity.ts b/src/common/providers/identity.ts index a9a9e7bf6..fe39029e5 100644 --- a/src/common/providers/identity.ts +++ b/src/common/providers/identity.ts @@ -334,16 +334,20 @@ export interface Credential { signInMethod: string; } -/** Possible types of emails as described by the GCIP backend. */ +/** + * Possible types of emails as described by the GCIP backend, which can be: + * - An sign-in email + * - A password reset email + */ export type EmailType = "EMAIL_SIGN_IN" | "PASSWORD_RESET"; /** - * The type of SMS message + * The type of SMS message, which can be: + * - A sign-in or sign up SMS message + * - A multi-factor sign-in SMS message + * - A multi-factor enrollment SMS message */ -export type SmsType = - | "SIGN_IN_OR_SIGN_UP" // A sign-in or sign up SMS message - | "MULTI_FACTOR_SIGN_IN" // A multi-factor sign-in SMS message - | "MULTI_FACTOR_ENROLLMENT"; // A multi-factor enrollment SMS message +export type SmsType = "SIGN_IN_OR_SIGN_UP" | "MULTI_FACTOR_SIGN_IN" | "MULTI_FACTOR_ENROLLMENT"; /** Defines the auth event context for blocking events */ export interface AuthEventContext extends EventContext { @@ -374,7 +378,7 @@ export interface BeforeSmsResponse { recaptchaActionOverride?: RecaptchaActionOptions; } -/** The handler response type for beforeCreate blocking events */ +/** The handler response type for `beforeCreate` blocking events */ export interface BeforeCreateResponse { displayName?: string; disabled?: boolean; @@ -472,7 +476,7 @@ export interface DecodedPayload { * Internal definition to include all the fields that can be sent as * a response from the blocking function to the backend. * This is added mainly to have a type definition for 'generateResponsePayload' - * @internal */ + @internal */ export interface ResponsePayload { userRecord?: UserRecordResponsePayload; recaptchaActionOverride?: RecaptchaActionOptions; diff --git a/src/v2/providers/identity.ts b/src/v2/providers/identity.ts index 01ece673b..e5b276516 100644 --- a/src/v2/providers/identity.ts +++ b/src/v2/providers/identity.ts @@ -167,7 +167,7 @@ export interface BlockingOptions { /** * Handles an event that is triggered before a user is created. - * @param handler - Event handler which is run every time before a user is created + * @param handler - Event handler which is run every time before a user is created. */ export function beforeUserCreated( handler: (event: AuthBlockingEvent) => MaybeAsync @@ -175,8 +175,8 @@ export function beforeUserCreated( /** * Handles an event that is triggered before a user is created. - * @param opts - Object containing function options - * @param handler - Event handler which is run every time before a user is created + * @param opts - Object containing function options. + * @param handler - Event handler which is run every time before a user is created. */ export function beforeUserCreated( opts: BlockingOptions, @@ -184,9 +184,9 @@ export function beforeUserCreated( ): BlockingFunction; /** - * Handles an event that is triggered before a user is created - * @param optsOrHandler - Either an object containing function options, or an event handler (run before user creation) - * @param handler? - If defined, an event handler which is run every time before a user is created + * Handles an event that is triggered before a user is created. + * @param optsOrHandler - Either an object containing function options, or an event handler (run before user creation). + * @param handler? - If defined, an event handler which is run every time before a user is created. */ export function beforeUserCreated( optsOrHandler: @@ -199,7 +199,7 @@ export function beforeUserCreated( /** * Handles an event that is triggered before a user is signed in. - * @param handler - Event handler which is run every time before a user is signed in + * @param handler - Event handler which is run every time before a user is signed in. */ export function beforeUserSignedIn( handler: (event: AuthBlockingEvent) => MaybeAsync @@ -207,8 +207,8 @@ export function beforeUserSignedIn( /** * Handles an event that is triggered before a user is signed in. - * @param opts - Object containing function options - * @param handler - Event handler which is run every time before a user is signed in + * @param opts - Object containing function options. + * @param handler - Event handler which is run every time before a user is signed in. */ export function beforeUserSignedIn( opts: BlockingOptions, @@ -217,8 +217,8 @@ export function beforeUserSignedIn( /** * Handles an event that is triggered before a user is signed in. - * @param optsOrHandler - Either an object containing function options, or an event handler (run before user signin) - * @param handler - Event handler which is run every time before a user is signed in + * @param optsOrHandler - Either an object containing function options, or an event handler (run before user signin). + * @param handler - Event handler which is run every time before a user is signed in. */ export function beforeUserSignedIn( optsOrHandler: @@ -239,7 +239,7 @@ export function beforeEmailSent( /** * Handles an event that is triggered before an email is sent to a user. - * @param opts - Object containing function options + * @param opts - Object containing function options. * @param handler - Event handler that is run before an email is sent to a user. */ export function beforeEmailSent( @@ -270,7 +270,7 @@ export function beforeSmsSent( /** * Handles an event that is triggered before an SMS is sent to a user. - * @param opts - Object containing function options + * @param opts - Object containing function options. * @param handler - Event handler that is run before an SMS is sent to a user. */ export function beforeSmsSent( @@ -317,7 +317,6 @@ export function beforeOperation( // Create our own function that just calls the provided function so we know for sure that // handler takes one argument. This is something common/providers/identity depends on. - // const wrappedHandler = (event: AuthBlockingEvent) => handler(event); const annotatedHandler = Object.assign(handler, { platform: "gcfv2" as const }); const func: any = wrapTraceContext(withInit(wrapHandler(eventType, annotatedHandler)));