Skip to content

Commit 196fba4

Browse files
committed
generate signinfutureresource; fix file-structure test
1 parent 0e3cbd6 commit 196fba4

4 files changed

Lines changed: 51 additions & 49 deletions

File tree

.typedoc/__tests__/file-structure.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ describe('Typedoc output', () => {
5858
"shared/client-resource/methods",
5959
"shared/session-resource",
6060
"shared/session-resource/methods",
61+
"shared/user-resource",
62+
"shared/user-resource/methods",
63+
"shared/sign-in-future-resource",
64+
"shared/sign-in-future-resource/methods",
6165
]
6266
`);
6367
});

.typedoc/reference-objects.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export const REFERENCE_OBJECT_CONFIG = {
3131
symbol: 'UserResource',
3232
declarationHint: 'types/user',
3333
},
34+
'shared/sign-in-future-resource/sign-in-future-resource.mdx': {
35+
symbol: 'SignInFutureResource',
36+
declarationHint: 'types/signInFuture',
37+
},
3438
};
3539

3640
/** Stable iteration order matches key order in {@link REFERENCE_OBJECT_CONFIG}. */

packages/shared/src/types/signInCommon.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ import type {
5757
} from './strategies';
5858
import type { StartEmailLinkFlowParams } from './verification';
5959

60+
/**
61+
* @property {string} 'needs_identifier' - The user's identifier (e.g., email address, phone number, username) hasn't been provided.
62+
* @property {string} 'needs_first_factor' - One of the following [first factor verification](!first-factor-verification) strategies is missing: `'email_link'`, `'email_code'`, `passkey`, `password`, `'phone_code'`, `'web3_base_signature'`, `'web3_metamask_signature'`, `'web3_coinbase_wallet_signature'`, `'web3_okx_wallet_signature'`, `'web3_solana_signature'`, [`OAuthStrategy`](https://clerk.com/docs/reference/types/sso#o-auth-strategy), or `'enterprise_sso'`.
63+
* @property {string} 'needs_second_factor' - One of the following [second factor verification](!second-factor-verification) strategies is missing: `'phone_code'`, `'totp'`, `'backup_code'`, `'email_code'`, or `'email_link'`.
64+
* @property {string} 'needs_client_trust' - The user is signing in from a new device and must complete a [second factor verification](!second-factor-verification) to establish [Client Trust](https://clerk.com/docs/guides/secure/client-trust). See the [Client Trust custom flow guide](https://clerk.com/docs/guides/development/custom-flows/authentication/client-trust) for more information.
65+
* @property {string} 'needs_new_password' - The user needs to set a new password. See the [dedicated custom flow](https://clerk.com/docs/guides/development/custom-flows/account-updates/forgot-password) guide for more information.
66+
*
67+
* @interface
68+
* @inline
69+
*/
6070
export type SignInStatus =
6171
| 'needs_identifier'
6272
| 'needs_first_factor'

packages/shared/src/types/signInFuture.ts

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,35 @@ import type { Web3Provider } from './web3';
88

99
export interface SignInFutureCreateParams {
1010
/**
11-
* The authentication identifier for the sign-in. This can be the value of the user's email address, phone number,
12-
* username, or Web3 wallet address.
11+
* The authentication identifier for the sign-in. This can be the value of the user's email address, phone number, username, or Web3 wallet address.
1312
*/
1413
identifier?: string;
1514
/**
16-
* The user's password. Only supported if
17-
* [password](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options#password) is enabled.
15+
* The user's password. Only supported if [password](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options#password) is enabled.
1816
*/
1917
password?: string;
2018
/**
21-
* The first factor verification strategy to use in the sign-in flow. Depends on the `identifier` value. Each
22-
* authentication identifier supports different verification strategies.
19+
* The first factor verification strategy to use in the sign-in flow. Depends on the `identifier` value. Each authentication identifier supports different verification strategies.
2320
*/
2421
strategy?: OAuthStrategy | 'enterprise_sso' | PasskeyStrategy | TicketStrategy;
2522
/**
2623
* The full URL or path that the OAuth provider should redirect to after successful authorization on their part.
2724
*/
2825
redirectUrl?: string;
2926
/**
30-
* The URL that the user will be redirected to, after successful authorization from the OAuth provider and
31-
* Clerk sign-in.
27+
* The URL that the user will be redirected to, after successful authorization from the OAuth provider and Clerk sign-in.
3228
*/
3329
actionCompleteRedirectUrl?: string;
3430
/**
35-
* When set to `true`, the `SignIn` will attempt to retrieve information from the active `SignUp` instance and use it
36-
* to complete the sign-in process. This is useful when you want to seamlessly transition a user from a sign-up
37-
* attempt to a sign-in attempt.
31+
* When set to `true`, the `SignIn` will attempt to retrieve information from the active `SignUp` instance and use it to complete the sign-in process. This is useful when you want to seamlessly transition a user from a sign-up attempt to a sign-in attempt.
3832
*/
3933
transfer?: boolean;
4034
/**
41-
* The [ticket _or token_](https://clerk.com/docs/guides/development/custom-flows/authentication/application-invitations)
42-
* generated from the Backend API. **Required** if `strategy` is set to `'ticket'`.
35+
* **Required** if `strategy` is set to `'ticket'`. The [ticket _or token_](https://clerk.com/docs/guides/development/custom-flows/authentication/application-invitations) generated from the Backend API.
4336
*/
4437
ticket?: string;
4538
/**
46-
* When set to `true`, if a user does not exist, the sign-up will prepare a transfer to sign up a new
47-
* account. If bot sign-up protection is enabled, captcha will also be required on sign in.
39+
* When set to `true`, if a user does not exist, the sign-up will prepare a transfer to sign up a new account. If bot sign-up protection is enabled, captcha will also be required on sign in.
4840
*/
4941
signUpIfMissing?: boolean;
5042
}
@@ -90,6 +82,7 @@ export type SignInFuturePasswordParams = {
9082
}
9183
);
9284

85+
/** Parameters for sending a sign-in email verification code. */
9386
export type SignInFutureEmailCodeSendParams =
9487
| {
9588
/**
@@ -107,6 +100,7 @@ export type SignInFutureEmailCodeSendParams =
107100
emailAddress?: never;
108101
};
109102

103+
/** Parameters for sending a sign-in email link. */
110104
export type SignInFutureEmailLinkSendParams = {
111105
/**
112106
* The full URL that the user will be redirected to when they visit the email link.
@@ -115,15 +109,14 @@ export type SignInFutureEmailLinkSendParams = {
115109
} & (
116110
| {
117111
/**
118-
* The user's email address. Only supported if [Email address](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options#email)
119-
* is enabled.
112+
* The user's email address. Only supported if [Email address](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options#email) is enabled. Provide either `emailAddress` or `emailAddressId`, not both. Omit both when a sign-in already exists and you are sending to the identified user.
120113
*/
121114
emailAddress?: string;
122115
emailAddressId?: never;
123116
}
124117
| {
125118
/**
126-
* The ID for the user's email address that will receive an email with the email link.
119+
* The ID for the user's email address that will receive an email with the email link. Provide either `emailAddress` or `emailAddressId`, not both.
127120
*/
128121
emailAddressId?: string;
129122
emailAddress?: never;
@@ -302,9 +295,7 @@ export interface SignInFutureFinalizeParams {
302295
}
303296

304297
/**
305-
* The `SignInFuture` class holds the state of the current sign-in and provides helper methods to navigate and complete
306-
* the sign-in process. It is used to manage the sign-in lifecycle, including the first and second factor verification,
307-
* and the creation of a new session.
298+
* The `SignInFuture` class holds the state of the current sign-in and provides helper methods to navigate and complete the sign-in process. It is used to manage the sign-in lifecycle, including the first and second factor verification, and the creation of a new session.
308299
*/
309300
export interface SignInFutureResource {
310301
/**
@@ -313,14 +304,12 @@ export interface SignInFutureResource {
313304
readonly id?: string;
314305

315306
/**
316-
* Array of the first factors that are supported in the current sign-in. Each factor contains information about the
317-
* verification strategy that can be used.
307+
* Array of the first factors that are supported in the current sign-in. Each factor contains information about the verification strategy that can be used.
318308
*/
319309
readonly supportedFirstFactors: SignInFirstFactor[];
320310

321311
/**
322-
* Array of the second factors that are supported in the current sign-in. Each factor contains information about the
323-
* verification strategy that can be used. This property is populated only when the first factor is verified.
312+
* Array of the second factors that are supported in the current sign-in. Each factor contains information about the verification strategy that can be used. This property is populated only when the first factor is verified.
324313
*/
325314
readonly supportedSecondFactors: SignInSecondFactor[];
326315

@@ -330,41 +319,38 @@ export interface SignInFutureResource {
330319
readonly status: SignInStatus;
331320

332321
/**
333-
* Indicates that there is not a matching user for the first-factor verification used, and that the sign-in can be
334-
* transferred to a sign-up.
322+
* Indicates that there is not a matching user for the first-factor verification used, and that the sign-in can be transferred to a sign-up.
335323
*/
336324
readonly isTransferable: boolean;
337325

326+
/**
327+
* Reflects that the sign-in was not able to create a new session because the identifier already exists in an existing session.
328+
* @property {string} sessionId - The ID of the existing session.
329+
*/
338330
readonly existingSession?: { sessionId: string };
339331

340332
/**
341-
* The state of the verification process for the selected first factor. Initially, this property contains an empty
342-
* verification object, since there is no first factor selected.
333+
* The state of the verification process for the selected first factor. Initially, this property contains an empty verification object, since there is no first factor selected.
343334
*/
344335
readonly firstFactorVerification: VerificationResource;
345336

346337
/**
347-
* The state of the verification process for the selected second factor. Initially, this property contains an empty
348-
* verification object, since there is no second factor selected.
338+
* The state of the verification process for the selected second factor. Initially, this property contains an empty verification object, since there is no second factor selected.
349339
*/
350340
readonly secondFactorVerification: VerificationResource;
351341

352342
/**
353-
* The authentication identifier value for the current sign-in. `null` if the `strategy` is `'oauth_<provider>'`
354-
* or `'enterprise_sso'`.
343+
* The authentication identifier value for the current sign-in. `null` if the `strategy` is `'oauth_<provider>'` or `'enterprise_sso'`.
355344
*/
356345
readonly identifier: string | null;
357346

358347
/**
359-
* The identifier of the session that was created upon completion of the current sign-in. The value of this property
360-
* is `null` if the sign-in status is not `'complete'`.
348+
* The ID of the session that was created upon completion of the current sign-in. The value of this property is `null` if the sign-in status is not `'complete'`.
361349
*/
362350
readonly createdSessionId: string | null;
363351

364352
/**
365-
* An object containing information about the user of the current sign-in. This property is populated only once an
366-
* identifier is given to the `SignIn` object through `signIn.create()` or another method that populates the
367-
* `identifier` property.
353+
* An object containing information about the user of the current sign-in. This property is populated only once an identifier is given to the `SignIn` object through `signIn.create()` or another method that populates the `identifier` property.
368354
*/
369355
readonly userData: UserData;
370356

@@ -376,18 +362,14 @@ export interface SignInFutureResource {
376362
readonly canBeDiscarded: boolean;
377363

378364
/**
379-
* Creates a new `SignIn` instance initialized with the provided parameters. The instance maintains the sign-in
380-
* lifecycle state through its `status` property, which updates as the authentication flow progresses.
365+
* Creates a new `SignIn` instance initialized with the provided parameters. The instance maintains the sign-in lifecycle state through its `status` property, which updates as the authentication flow progresses. Once the sign-in process is complete, call the `signIn.finalize()` method to set the newly created session as the active session.
381366
*
382-
* What you must pass to `params` depends on which [sign-in options](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options)
383-
* you have enabled in your app's settings in the Clerk Dashboard.
367+
* What you must pass to `params` depends on which [sign-in options](https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options) you have enabled in your app's settings in the Clerk Dashboard.
384368
*
385-
* You can complete the sign-in process in one step if you supply the required fields to `create()`. Otherwise,
386-
* Clerk's sign-in process provides great flexibility and allows users to easily create multi-step sign-in flows.
369+
* You can complete the sign-in process in one step if you supply the required fields to `create()`. Otherwise, Clerk's sign-in process provides great flexibility and allows users to easily create multi-step sign-in flows.
387370
*
388-
* > [!WARNING]
389-
* > Once the sign-in process is complete, call the `signIn.finalize()` method to set the newly created session as
390-
* > the active session.
371+
* > [!IMPORTANT]
372+
* > The `signIn.create()` method is intended for advanced use cases. For most use cases, prefer the use of the factor-specific methods such as `signIn.password()`, `signIn.emailCode.sendCode()`, etc.
391373
*/
392374
create: (params: SignInFutureCreateParams) => Promise<{ error: ClerkError | null }>;
393375

@@ -426,7 +408,9 @@ export interface SignInFutureResource {
426408
waitForVerification: () => Promise<{ error: ClerkError | null }>;
427409

428410
/**
429-
* The verification status
411+
* The verification status of the email link. This property is populated by reading query parameters from the URL after the user visits the email link. Returns `null` if no verification status is available.
412+
*
413+
* @propertyTableDoc
430414
*/
431415
verification: {
432416
/**
@@ -435,7 +419,7 @@ export interface SignInFutureResource {
435419
status: 'verified' | 'expired' | 'failed' | 'client_mismatch';
436420

437421
/**
438-
* The created session ID
422+
* The ID of the session that was created upon completion of the current sign-in.
439423
*/
440424
createdSessionId: string;
441425

0 commit comments

Comments
 (0)