@clerk/types 4.53.0 → 4.53.1-canary.v20250411131008

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -461,7 +461,13 @@ interface OrganizationDomainVerification {
461
461
  attempts: number;
462
462
  expiresAt: Date;
463
463
  }
464
+ /**
465
+ * @inline
466
+ */
464
467
  type OrganizationDomainVerificationStatus = 'unverified' | 'verified';
468
+ /**
469
+ * @inline
470
+ */
465
471
  type OrganizationEnrollmentMode = 'manual_invitation' | 'automatic_invitation' | 'automatic_suggestion';
466
472
  interface OrganizationDomainResource extends ClerkResource {
467
473
  id: string;
@@ -513,6 +519,9 @@ interface OrganizationInvitationResource extends ClerkResource {
513
519
  updatedAt: Date;
514
520
  revoke: () => Promise<OrganizationInvitationResource>;
515
521
  }
522
+ /**
523
+ * @inline
524
+ */
516
525
  type OrganizationInvitationStatus = 'pending' | 'accepted' | 'revoked';
517
526
 
518
527
  type SnakeToCamel<T> = T extends `${infer A}_${infer B}` ? `${Uncapitalize<A>}${Capitalize<SnakeToCamel<B>>}` : T extends object ? {
@@ -527,6 +536,9 @@ type DeepCamelToSnake<T> = T extends `${infer C0}${infer R}` ? `${C0 extends Upp
527
536
  type CamelToSnake<T> = T extends `${infer C0}${infer R}` ? `${C0 extends Uppercase<C0> ? '_' : ''}${Lowercase<C0>}${CamelToSnake<R>}` : T extends object ? {
528
537
  [K in keyof T as CamelToSnake<Extract<K, string>>]: T[K];
529
538
  } : T;
539
+ /**
540
+ * @internal
541
+ */
530
542
  type DeepPartial<T> = {
531
543
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
532
544
  };
@@ -981,6 +993,9 @@ interface ImageResource extends ClerkResource {
981
993
  publicUrl: string | null;
982
994
  }
983
995
 
996
+ /**
997
+ * @inline
998
+ */
984
999
  type OrganizationSuggestionStatus = 'pending' | 'accepted';
985
1000
  interface OrganizationSuggestionResource extends ClerkResource {
986
1001
  id: string;
@@ -1149,6 +1164,15 @@ declare global {
1149
1164
  [k: string]: unknown;
1150
1165
  }
1151
1166
  }
1167
+ /**
1168
+ * The `User` object holds all of the information for a single user of your application and provides a set of methods to manage their account. Each `User` has at least one authentication [identifier](https://clerk.com/docs/authentication/configuration/sign-up-sign-in-options#identifiers), which might be their email address, phone number, or a username.
1169
+ *
1170
+ * A user can be contacted at their primary email address or primary phone number. They can have more than one registered email address, but only one of them will be their primary email address. This goes for phone numbers as well; a user can have more than one, but only one phone number will be their primary. At the same time, a user can also have one or more external accounts by connecting to [social providers](https://clerk.com/docs/authentication/social-connections/oauth) such as Google, Apple, Facebook, and many more.
1171
+ *
1172
+ * Finally, a `User` object holds profile data like the user's name, profile picture, and a set of [metadata](/docs/users/metadata) that can be used internally to store arbitrary information. The metadata are split into `publicMetadata` and `privateMetadata`. Both types are set from the [Backend API](https://clerk.com/docs/reference/backend-api){{ target: '_blank' }}, but public metadata can also be accessed from the [Frontend API](https://clerk.com/docs/reference/frontend-api){{ target: '_blank' }}.
1173
+ *
1174
+ * The ClerkJS SDK provides some helper [methods](#methods) on the `User` object to help retrieve and update user information and authentication status.
1175
+ */
1152
1176
  interface UserResource extends ClerkResource {
1153
1177
  id: string;
1154
1178
  externalId: string | null;
@@ -1253,6 +1277,9 @@ type GetUserOrganizationSuggestionsParams = ClerkPaginationParams<{
1253
1277
  type GetUserOrganizationMembershipParams = ClerkPaginationParams;
1254
1278
  type GetOrganizationMemberships = (params?: GetUserOrganizationMembershipParams) => Promise<ClerkPaginatedResponse<OrganizationMembershipResource>>;
1255
1279
 
1280
+ /**
1281
+ * @inline
1282
+ */
1256
1283
  type PendingSessionOptions = {
1257
1284
  /**
1258
1285
  * Determines if pending sessions are considered as signed-out state.
@@ -1261,7 +1288,9 @@ type PendingSessionOptions = {
1261
1288
  treatPendingAsSignedOut?: boolean;
1262
1289
  };
1263
1290
  type DisallowSystemPermissions<P extends string> = P extends `${OrganizationSystemPermissionPrefix}${string}` ? 'System permissions are not included in session claims and cannot be used on the server-side' : P;
1291
+ /** @inline */
1264
1292
  type CheckAuthorizationFn<Params> = (isAuthorizedParams: Params) => boolean;
1293
+ /** @inline */
1265
1294
  type CheckAuthorizationWithCustomPermissions = CheckAuthorizationFn<CheckAuthorizationParamsWithCustomPermissions>;
1266
1295
  type WithReverification<T> = T & {
1267
1296
  reverification?: ReverificationConfig;
@@ -1421,6 +1450,9 @@ type GetTokenOptions = {
1421
1450
  leewayInSeconds?: number;
1422
1451
  skipCache?: boolean;
1423
1452
  };
1453
+ /**
1454
+ * @inline
1455
+ */
1424
1456
  type GetToken = (options?: GetTokenOptions) => Promise<string | null>;
1425
1457
  type SessionVerifyCreateParams = {
1426
1458
  level: SessionVerificationLevel;
@@ -1596,7 +1628,11 @@ interface OrganizationMembershipResource extends ClerkResource {
1596
1628
  }
1597
1629
  type OrganizationCustomPermissionKey = ClerkAuthorization extends Placeholder ? ClerkAuthorization['permission'] extends string ? ClerkAuthorization['permission'] : Base['permission'] : Base['permission'];
1598
1630
  /**
1599
- * OrganizationCustomRoleKey will be string unless the developer has provided their own types through `ClerkAuthorization`
1631
+ * `OrganizationCustomRoleKey` is a type that represents the user's role in an organization. It will be string unless the developer has provided their own types through [`ClerkAuthorization`](https://clerk.com/docs/guides/custom-types#example-custom-roles-and-permissions).
1632
+ *
1633
+ * Clerk provides the [default roles](https://clerk.com/docs/organizations/roles-permissions#default-roles) `org:admin` and `org:member`. However, you can create [custom roles](https://clerk.com/docs/organizations/create-roles-permissions) as well.
1634
+ *
1635
+ * @interface
1600
1636
  */
1601
1637
  type OrganizationCustomRoleKey = ClerkAuthorization extends Placeholder ? ClerkAuthorization['role'] extends string ? ClerkAuthorization['role'] : Base['role'] : Base['role'];
1602
1638
  type OrganizationSystemPermissionPrefix = 'org:sys_';
@@ -2058,6 +2094,7 @@ type SignInForceRedirectUrl = {
2058
2094
 
2059
2095
  /**
2060
2096
  * The `SignIn` object 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.
2097
+ * @interface
2061
2098
  */
2062
2099
  interface SignInResource extends ClerkResource {
2063
2100
  /**
@@ -6133,10 +6170,17 @@ type CreateBulkOrganizationInvitationParams = {
6133
6170
  role: OrganizationCustomRoleKey;
6134
6171
  };
6135
6172
  /**
6136
- * @inline
6173
+ * Parameters for the `createOrganization()` method.
6174
+ * @interface
6137
6175
  */
6138
6176
  interface CreateOrganizationParams {
6177
+ /**
6178
+ * The name of the organization.
6179
+ */
6139
6180
  name: string;
6181
+ /**
6182
+ * The slug of the organization.
6183
+ */
6140
6184
  slug?: string;
6141
6185
  }
6142
6186
  interface ClerkAuthenticateWithWeb3Params {
@@ -6201,12 +6245,22 @@ interface EnvironmentResource extends ClerkResource {
6201
6245
  __internal_toSnapshot: () => EnvironmentJSONSnapshot;
6202
6246
  }
6203
6247
 
6248
+ /**
6249
+ * @inline
6250
+ */
6204
6251
  type CheckAuthorizationSignedOut = undefined;
6252
+ /**
6253
+ * @inline
6254
+ */
6205
6255
  type CheckAuthorizationWithoutOrgOrUser = (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => false;
6206
6256
  /**
6207
6257
  * @inline
6208
6258
  */
6209
- type UseAuthReturn = {
6259
+ type UseAuthReturn =
6260
+ /**
6261
+ * During initialization
6262
+ */
6263
+ {
6210
6264
  /**
6211
6265
  * A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
6212
6266
  */
@@ -6255,7 +6309,11 @@ type UseAuthReturn = {
6255
6309
  * A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
6256
6310
  */
6257
6311
  getToken: GetToken;
6258
- } | {
6312
+ }
6313
+ /**
6314
+ * When signed out
6315
+ */
6316
+ | {
6259
6317
  isLoaded: true;
6260
6318
  isSignedIn: false;
6261
6319
  userId: null;
@@ -6268,7 +6326,11 @@ type UseAuthReturn = {
6268
6326
  has: CheckAuthorizationWithoutOrgOrUser;
6269
6327
  signOut: SignOut;
6270
6328
  getToken: GetToken;
6271
- } | {
6329
+ }
6330
+ /**
6331
+ * When signed in (no active organization)
6332
+ */
6333
+ | {
6272
6334
  isLoaded: true;
6273
6335
  isSignedIn: true;
6274
6336
  userId: string;
@@ -6281,7 +6343,11 @@ type UseAuthReturn = {
6281
6343
  has: CheckAuthorizationWithCustomPermissions;
6282
6344
  signOut: SignOut;
6283
6345
  getToken: GetToken;
6284
- } | {
6346
+ }
6347
+ /**
6348
+ * When signed in (with active organization)
6349
+ */
6350
+ | {
6285
6351
  isLoaded: true;
6286
6352
  isSignedIn: true;
6287
6353
  userId: string;
@@ -6396,7 +6462,7 @@ type UseUserReturn = {
6396
6462
  */
6397
6463
  isSignedIn: undefined;
6398
6464
  /**
6399
- * The [`User`](https://clerk.com/docs/references/javascript/user) object for the current user. If the user isn't signed in, `user` will be `null`.
6465
+ * The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
6400
6466
  */
6401
6467
  user: undefined;
6402
6468
  } | {
package/dist/index.d.ts CHANGED
@@ -461,7 +461,13 @@ interface OrganizationDomainVerification {
461
461
  attempts: number;
462
462
  expiresAt: Date;
463
463
  }
464
+ /**
465
+ * @inline
466
+ */
464
467
  type OrganizationDomainVerificationStatus = 'unverified' | 'verified';
468
+ /**
469
+ * @inline
470
+ */
465
471
  type OrganizationEnrollmentMode = 'manual_invitation' | 'automatic_invitation' | 'automatic_suggestion';
466
472
  interface OrganizationDomainResource extends ClerkResource {
467
473
  id: string;
@@ -513,6 +519,9 @@ interface OrganizationInvitationResource extends ClerkResource {
513
519
  updatedAt: Date;
514
520
  revoke: () => Promise<OrganizationInvitationResource>;
515
521
  }
522
+ /**
523
+ * @inline
524
+ */
516
525
  type OrganizationInvitationStatus = 'pending' | 'accepted' | 'revoked';
517
526
 
518
527
  type SnakeToCamel<T> = T extends `${infer A}_${infer B}` ? `${Uncapitalize<A>}${Capitalize<SnakeToCamel<B>>}` : T extends object ? {
@@ -527,6 +536,9 @@ type DeepCamelToSnake<T> = T extends `${infer C0}${infer R}` ? `${C0 extends Upp
527
536
  type CamelToSnake<T> = T extends `${infer C0}${infer R}` ? `${C0 extends Uppercase<C0> ? '_' : ''}${Lowercase<C0>}${CamelToSnake<R>}` : T extends object ? {
528
537
  [K in keyof T as CamelToSnake<Extract<K, string>>]: T[K];
529
538
  } : T;
539
+ /**
540
+ * @internal
541
+ */
530
542
  type DeepPartial<T> = {
531
543
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
532
544
  };
@@ -981,6 +993,9 @@ interface ImageResource extends ClerkResource {
981
993
  publicUrl: string | null;
982
994
  }
983
995
 
996
+ /**
997
+ * @inline
998
+ */
984
999
  type OrganizationSuggestionStatus = 'pending' | 'accepted';
985
1000
  interface OrganizationSuggestionResource extends ClerkResource {
986
1001
  id: string;
@@ -1149,6 +1164,15 @@ declare global {
1149
1164
  [k: string]: unknown;
1150
1165
  }
1151
1166
  }
1167
+ /**
1168
+ * The `User` object holds all of the information for a single user of your application and provides a set of methods to manage their account. Each `User` has at least one authentication [identifier](https://clerk.com/docs/authentication/configuration/sign-up-sign-in-options#identifiers), which might be their email address, phone number, or a username.
1169
+ *
1170
+ * A user can be contacted at their primary email address or primary phone number. They can have more than one registered email address, but only one of them will be their primary email address. This goes for phone numbers as well; a user can have more than one, but only one phone number will be their primary. At the same time, a user can also have one or more external accounts by connecting to [social providers](https://clerk.com/docs/authentication/social-connections/oauth) such as Google, Apple, Facebook, and many more.
1171
+ *
1172
+ * Finally, a `User` object holds profile data like the user's name, profile picture, and a set of [metadata](/docs/users/metadata) that can be used internally to store arbitrary information. The metadata are split into `publicMetadata` and `privateMetadata`. Both types are set from the [Backend API](https://clerk.com/docs/reference/backend-api){{ target: '_blank' }}, but public metadata can also be accessed from the [Frontend API](https://clerk.com/docs/reference/frontend-api){{ target: '_blank' }}.
1173
+ *
1174
+ * The ClerkJS SDK provides some helper [methods](#methods) on the `User` object to help retrieve and update user information and authentication status.
1175
+ */
1152
1176
  interface UserResource extends ClerkResource {
1153
1177
  id: string;
1154
1178
  externalId: string | null;
@@ -1253,6 +1277,9 @@ type GetUserOrganizationSuggestionsParams = ClerkPaginationParams<{
1253
1277
  type GetUserOrganizationMembershipParams = ClerkPaginationParams;
1254
1278
  type GetOrganizationMemberships = (params?: GetUserOrganizationMembershipParams) => Promise<ClerkPaginatedResponse<OrganizationMembershipResource>>;
1255
1279
 
1280
+ /**
1281
+ * @inline
1282
+ */
1256
1283
  type PendingSessionOptions = {
1257
1284
  /**
1258
1285
  * Determines if pending sessions are considered as signed-out state.
@@ -1261,7 +1288,9 @@ type PendingSessionOptions = {
1261
1288
  treatPendingAsSignedOut?: boolean;
1262
1289
  };
1263
1290
  type DisallowSystemPermissions<P extends string> = P extends `${OrganizationSystemPermissionPrefix}${string}` ? 'System permissions are not included in session claims and cannot be used on the server-side' : P;
1291
+ /** @inline */
1264
1292
  type CheckAuthorizationFn<Params> = (isAuthorizedParams: Params) => boolean;
1293
+ /** @inline */
1265
1294
  type CheckAuthorizationWithCustomPermissions = CheckAuthorizationFn<CheckAuthorizationParamsWithCustomPermissions>;
1266
1295
  type WithReverification<T> = T & {
1267
1296
  reverification?: ReverificationConfig;
@@ -1421,6 +1450,9 @@ type GetTokenOptions = {
1421
1450
  leewayInSeconds?: number;
1422
1451
  skipCache?: boolean;
1423
1452
  };
1453
+ /**
1454
+ * @inline
1455
+ */
1424
1456
  type GetToken = (options?: GetTokenOptions) => Promise<string | null>;
1425
1457
  type SessionVerifyCreateParams = {
1426
1458
  level: SessionVerificationLevel;
@@ -1596,7 +1628,11 @@ interface OrganizationMembershipResource extends ClerkResource {
1596
1628
  }
1597
1629
  type OrganizationCustomPermissionKey = ClerkAuthorization extends Placeholder ? ClerkAuthorization['permission'] extends string ? ClerkAuthorization['permission'] : Base['permission'] : Base['permission'];
1598
1630
  /**
1599
- * OrganizationCustomRoleKey will be string unless the developer has provided their own types through `ClerkAuthorization`
1631
+ * `OrganizationCustomRoleKey` is a type that represents the user's role in an organization. It will be string unless the developer has provided their own types through [`ClerkAuthorization`](https://clerk.com/docs/guides/custom-types#example-custom-roles-and-permissions).
1632
+ *
1633
+ * Clerk provides the [default roles](https://clerk.com/docs/organizations/roles-permissions#default-roles) `org:admin` and `org:member`. However, you can create [custom roles](https://clerk.com/docs/organizations/create-roles-permissions) as well.
1634
+ *
1635
+ * @interface
1600
1636
  */
1601
1637
  type OrganizationCustomRoleKey = ClerkAuthorization extends Placeholder ? ClerkAuthorization['role'] extends string ? ClerkAuthorization['role'] : Base['role'] : Base['role'];
1602
1638
  type OrganizationSystemPermissionPrefix = 'org:sys_';
@@ -2058,6 +2094,7 @@ type SignInForceRedirectUrl = {
2058
2094
 
2059
2095
  /**
2060
2096
  * The `SignIn` object 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.
2097
+ * @interface
2061
2098
  */
2062
2099
  interface SignInResource extends ClerkResource {
2063
2100
  /**
@@ -6133,10 +6170,17 @@ type CreateBulkOrganizationInvitationParams = {
6133
6170
  role: OrganizationCustomRoleKey;
6134
6171
  };
6135
6172
  /**
6136
- * @inline
6173
+ * Parameters for the `createOrganization()` method.
6174
+ * @interface
6137
6175
  */
6138
6176
  interface CreateOrganizationParams {
6177
+ /**
6178
+ * The name of the organization.
6179
+ */
6139
6180
  name: string;
6181
+ /**
6182
+ * The slug of the organization.
6183
+ */
6140
6184
  slug?: string;
6141
6185
  }
6142
6186
  interface ClerkAuthenticateWithWeb3Params {
@@ -6201,12 +6245,22 @@ interface EnvironmentResource extends ClerkResource {
6201
6245
  __internal_toSnapshot: () => EnvironmentJSONSnapshot;
6202
6246
  }
6203
6247
 
6248
+ /**
6249
+ * @inline
6250
+ */
6204
6251
  type CheckAuthorizationSignedOut = undefined;
6252
+ /**
6253
+ * @inline
6254
+ */
6205
6255
  type CheckAuthorizationWithoutOrgOrUser = (params: Parameters<CheckAuthorizationWithCustomPermissions>[0]) => false;
6206
6256
  /**
6207
6257
  * @inline
6208
6258
  */
6209
- type UseAuthReturn = {
6259
+ type UseAuthReturn =
6260
+ /**
6261
+ * During initialization
6262
+ */
6263
+ {
6210
6264
  /**
6211
6265
  * A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
6212
6266
  */
@@ -6255,7 +6309,11 @@ type UseAuthReturn = {
6255
6309
  * A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
6256
6310
  */
6257
6311
  getToken: GetToken;
6258
- } | {
6312
+ }
6313
+ /**
6314
+ * When signed out
6315
+ */
6316
+ | {
6259
6317
  isLoaded: true;
6260
6318
  isSignedIn: false;
6261
6319
  userId: null;
@@ -6268,7 +6326,11 @@ type UseAuthReturn = {
6268
6326
  has: CheckAuthorizationWithoutOrgOrUser;
6269
6327
  signOut: SignOut;
6270
6328
  getToken: GetToken;
6271
- } | {
6329
+ }
6330
+ /**
6331
+ * When signed in (no active organization)
6332
+ */
6333
+ | {
6272
6334
  isLoaded: true;
6273
6335
  isSignedIn: true;
6274
6336
  userId: string;
@@ -6281,7 +6343,11 @@ type UseAuthReturn = {
6281
6343
  has: CheckAuthorizationWithCustomPermissions;
6282
6344
  signOut: SignOut;
6283
6345
  getToken: GetToken;
6284
- } | {
6346
+ }
6347
+ /**
6348
+ * When signed in (with active organization)
6349
+ */
6350
+ | {
6285
6351
  isLoaded: true;
6286
6352
  isSignedIn: true;
6287
6353
  userId: string;
@@ -6396,7 +6462,7 @@ type UseUserReturn = {
6396
6462
  */
6397
6463
  isSignedIn: undefined;
6398
6464
  /**
6399
- * The [`User`](https://clerk.com/docs/references/javascript/user) object for the current user. If the user isn't signed in, `user` will be `null`.
6465
+ * The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
6400
6466
  */
6401
6467
  user: undefined;
6402
6468
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerk/types",
3
- "version": "4.53.0",
3
+ "version": "4.53.1-canary.v20250411131008",
4
4
  "description": "Typings for Clerk libraries.",
5
5
  "keywords": [
6
6
  "clerk",