@clerk/types 4.60.0-snapshot.v20250604034807 → 4.60.0
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 +86 -4
- package/dist/index.d.ts +86 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -862,11 +862,26 @@ interface SessionVerificationResource extends ClerkResource {
|
|
|
862
862
|
supportedSecondFactors: SessionVerificationSecondFactor[] | null;
|
|
863
863
|
}
|
|
864
864
|
type SessionVerificationStatus = 'needs_first_factor' | 'needs_second_factor' | 'complete';
|
|
865
|
+
/**
|
|
866
|
+
* @inline
|
|
867
|
+
*/
|
|
865
868
|
type SessionVerificationTypes = 'strict_mfa' | 'strict' | 'moderate' | 'lax';
|
|
869
|
+
/**
|
|
870
|
+
* The `ReverificationConfig` type has the following properties:
|
|
871
|
+
*/
|
|
866
872
|
type ReverificationConfig = SessionVerificationTypes | {
|
|
873
|
+
/**
|
|
874
|
+
* The reverification level of credentials to check for.
|
|
875
|
+
*/
|
|
867
876
|
level: SessionVerificationLevel;
|
|
877
|
+
/**
|
|
878
|
+
* The age of the factor level to check for. Value should be greater than or equal to 1 and less than 99,999.
|
|
879
|
+
*/
|
|
868
880
|
afterMinutes: SessionVerificationAfterMinutes;
|
|
869
881
|
};
|
|
882
|
+
/**
|
|
883
|
+
* @inline
|
|
884
|
+
*/
|
|
870
885
|
type SessionVerificationLevel = 'first_factor' | 'second_factor' | 'multi_factor';
|
|
871
886
|
type SessionVerificationAfterMinutes = number;
|
|
872
887
|
type SessionVerificationFirstFactor = EmailCodeFactor | PhoneCodeFactor | PasswordFactor | PasskeyFactor;
|
|
@@ -1362,12 +1377,27 @@ type CheckAuthorizationFn<Params> = (isAuthorizedParams: Params) => boolean;
|
|
|
1362
1377
|
/** @inline */
|
|
1363
1378
|
type CheckAuthorizationWithCustomPermissions = CheckAuthorizationFn<CheckAuthorizationParamsWithCustomPermissions>;
|
|
1364
1379
|
type WithReverification<T> = T & {
|
|
1380
|
+
/**
|
|
1381
|
+
* The reverification configuration to check for. This feature is currently in public beta. **It is not recommended for production use.**
|
|
1382
|
+
*/
|
|
1365
1383
|
reverification?: ReverificationConfig;
|
|
1366
1384
|
};
|
|
1367
1385
|
type CheckAuthorizationParamsWithCustomPermissions = WithReverification<{
|
|
1386
|
+
/**
|
|
1387
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1388
|
+
*/
|
|
1368
1389
|
role: OrganizationCustomRoleKey;
|
|
1390
|
+
/**
|
|
1391
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1392
|
+
*/
|
|
1369
1393
|
permission?: never;
|
|
1394
|
+
/**
|
|
1395
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1396
|
+
*/
|
|
1370
1397
|
feature?: never;
|
|
1398
|
+
/**
|
|
1399
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1400
|
+
*/
|
|
1371
1401
|
plan?: never;
|
|
1372
1402
|
} | {
|
|
1373
1403
|
role?: never;
|
|
@@ -1392,9 +1422,21 @@ type CheckAuthorizationParamsWithCustomPermissions = WithReverification<{
|
|
|
1392
1422
|
}>;
|
|
1393
1423
|
type CheckAuthorization = CheckAuthorizationFn<CheckAuthorizationParams>;
|
|
1394
1424
|
type CheckAuthorizationParams = WithReverification<{
|
|
1425
|
+
/**
|
|
1426
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1427
|
+
*/
|
|
1395
1428
|
role: OrganizationCustomRoleKey;
|
|
1429
|
+
/**
|
|
1430
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1431
|
+
*/
|
|
1396
1432
|
permission?: never;
|
|
1433
|
+
/**
|
|
1434
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1435
|
+
*/
|
|
1397
1436
|
feature?: never;
|
|
1437
|
+
/**
|
|
1438
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1439
|
+
*/
|
|
1398
1440
|
plan?: never;
|
|
1399
1441
|
} | {
|
|
1400
1442
|
role?: never;
|
|
@@ -1423,10 +1465,25 @@ type CheckAuthorizationParams = WithReverification<{
|
|
|
1423
1465
|
* in session claims and cannot be verified on the server side.
|
|
1424
1466
|
*/
|
|
1425
1467
|
type CheckAuthorizationFromSessionClaims = <P extends OrganizationCustomPermissionKey>(isAuthorizedParams: CheckAuthorizationParamsFromSessionClaims<P>) => boolean;
|
|
1468
|
+
/**
|
|
1469
|
+
* @interface
|
|
1470
|
+
*/
|
|
1426
1471
|
type CheckAuthorizationParamsFromSessionClaims<P extends OrganizationCustomPermissionKey> = WithReverification<{
|
|
1472
|
+
/**
|
|
1473
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1474
|
+
*/
|
|
1427
1475
|
role: OrganizationCustomRoleKey;
|
|
1476
|
+
/**
|
|
1477
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1478
|
+
*/
|
|
1428
1479
|
permission?: never;
|
|
1480
|
+
/**
|
|
1481
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1482
|
+
*/
|
|
1429
1483
|
feature?: never;
|
|
1484
|
+
/**
|
|
1485
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1486
|
+
*/
|
|
1430
1487
|
plan?: never;
|
|
1431
1488
|
} | {
|
|
1432
1489
|
role?: never;
|
|
@@ -1942,7 +1999,7 @@ interface ActClaim {
|
|
|
1942
1999
|
[x: string]: unknown;
|
|
1943
2000
|
}
|
|
1944
2001
|
/**
|
|
1945
|
-
*
|
|
2002
|
+
* The current state of the session which can only be `active` or `pending`.
|
|
1946
2003
|
*/
|
|
1947
2004
|
type SessionStatusClaim = Extract<SessionStatus, 'active' | 'pending'>;
|
|
1948
2005
|
|
|
@@ -7131,19 +7188,44 @@ type InitialState = Serializable<{
|
|
|
7131
7188
|
* @internal
|
|
7132
7189
|
*/
|
|
7133
7190
|
type SharedSignedInAuthObjectProperties = {
|
|
7191
|
+
/**
|
|
7192
|
+
* The current user's [session claims](https://clerk.com/docs/backend-requests/resources/session-tokens).
|
|
7193
|
+
*/
|
|
7134
7194
|
sessionClaims: JwtPayload;
|
|
7195
|
+
/**
|
|
7196
|
+
* The ID of the current session.
|
|
7197
|
+
*/
|
|
7135
7198
|
sessionId: string;
|
|
7199
|
+
/**
|
|
7200
|
+
* The current state of the session.
|
|
7201
|
+
*/
|
|
7136
7202
|
sessionStatus: SessionStatusClaim | null;
|
|
7203
|
+
/**
|
|
7204
|
+
* Holds identifier for the user that is impersonating the current user. Read more about [impersonation](https://clerk.com/docs/users/user-impersonation).
|
|
7205
|
+
*/
|
|
7137
7206
|
actor: ActClaim | undefined;
|
|
7207
|
+
/**
|
|
7208
|
+
* The ID of the current user.
|
|
7209
|
+
*/
|
|
7138
7210
|
userId: string;
|
|
7211
|
+
/**
|
|
7212
|
+
* The ID of the user's active organization.
|
|
7213
|
+
*/
|
|
7139
7214
|
orgId: string | undefined;
|
|
7215
|
+
/**
|
|
7216
|
+
* The current user's role in their active organization.
|
|
7217
|
+
*/
|
|
7140
7218
|
orgRole: OrganizationCustomRoleKey | undefined;
|
|
7219
|
+
/**
|
|
7220
|
+
* The URL-friendly identifier of the user's active organization.
|
|
7221
|
+
*/
|
|
7141
7222
|
orgSlug: string | undefined;
|
|
7223
|
+
/**
|
|
7224
|
+
* The current user's active organization permissions.
|
|
7225
|
+
*/
|
|
7142
7226
|
orgPermissions: OrganizationCustomPermissionKey[] | undefined;
|
|
7143
7227
|
/**
|
|
7144
|
-
*
|
|
7145
|
-
* Each item represents the minutes that have passed since the last time a first or second factor were verified.
|
|
7146
|
-
* [fistFactorAge, secondFactorAge]
|
|
7228
|
+
* An array where each item represents the number of minutes since the last verification of a first or second factor: `[firstFactorAge, secondFactorAge]`.
|
|
7147
7229
|
*/
|
|
7148
7230
|
factorVerificationAge: [firstFactorAge: number, secondFactorAge: number] | null;
|
|
7149
7231
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -862,11 +862,26 @@ interface SessionVerificationResource extends ClerkResource {
|
|
|
862
862
|
supportedSecondFactors: SessionVerificationSecondFactor[] | null;
|
|
863
863
|
}
|
|
864
864
|
type SessionVerificationStatus = 'needs_first_factor' | 'needs_second_factor' | 'complete';
|
|
865
|
+
/**
|
|
866
|
+
* @inline
|
|
867
|
+
*/
|
|
865
868
|
type SessionVerificationTypes = 'strict_mfa' | 'strict' | 'moderate' | 'lax';
|
|
869
|
+
/**
|
|
870
|
+
* The `ReverificationConfig` type has the following properties:
|
|
871
|
+
*/
|
|
866
872
|
type ReverificationConfig = SessionVerificationTypes | {
|
|
873
|
+
/**
|
|
874
|
+
* The reverification level of credentials to check for.
|
|
875
|
+
*/
|
|
867
876
|
level: SessionVerificationLevel;
|
|
877
|
+
/**
|
|
878
|
+
* The age of the factor level to check for. Value should be greater than or equal to 1 and less than 99,999.
|
|
879
|
+
*/
|
|
868
880
|
afterMinutes: SessionVerificationAfterMinutes;
|
|
869
881
|
};
|
|
882
|
+
/**
|
|
883
|
+
* @inline
|
|
884
|
+
*/
|
|
870
885
|
type SessionVerificationLevel = 'first_factor' | 'second_factor' | 'multi_factor';
|
|
871
886
|
type SessionVerificationAfterMinutes = number;
|
|
872
887
|
type SessionVerificationFirstFactor = EmailCodeFactor | PhoneCodeFactor | PasswordFactor | PasskeyFactor;
|
|
@@ -1362,12 +1377,27 @@ type CheckAuthorizationFn<Params> = (isAuthorizedParams: Params) => boolean;
|
|
|
1362
1377
|
/** @inline */
|
|
1363
1378
|
type CheckAuthorizationWithCustomPermissions = CheckAuthorizationFn<CheckAuthorizationParamsWithCustomPermissions>;
|
|
1364
1379
|
type WithReverification<T> = T & {
|
|
1380
|
+
/**
|
|
1381
|
+
* The reverification configuration to check for. This feature is currently in public beta. **It is not recommended for production use.**
|
|
1382
|
+
*/
|
|
1365
1383
|
reverification?: ReverificationConfig;
|
|
1366
1384
|
};
|
|
1367
1385
|
type CheckAuthorizationParamsWithCustomPermissions = WithReverification<{
|
|
1386
|
+
/**
|
|
1387
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1388
|
+
*/
|
|
1368
1389
|
role: OrganizationCustomRoleKey;
|
|
1390
|
+
/**
|
|
1391
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1392
|
+
*/
|
|
1369
1393
|
permission?: never;
|
|
1394
|
+
/**
|
|
1395
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1396
|
+
*/
|
|
1370
1397
|
feature?: never;
|
|
1398
|
+
/**
|
|
1399
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1400
|
+
*/
|
|
1371
1401
|
plan?: never;
|
|
1372
1402
|
} | {
|
|
1373
1403
|
role?: never;
|
|
@@ -1392,9 +1422,21 @@ type CheckAuthorizationParamsWithCustomPermissions = WithReverification<{
|
|
|
1392
1422
|
}>;
|
|
1393
1423
|
type CheckAuthorization = CheckAuthorizationFn<CheckAuthorizationParams>;
|
|
1394
1424
|
type CheckAuthorizationParams = WithReverification<{
|
|
1425
|
+
/**
|
|
1426
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1427
|
+
*/
|
|
1395
1428
|
role: OrganizationCustomRoleKey;
|
|
1429
|
+
/**
|
|
1430
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1431
|
+
*/
|
|
1396
1432
|
permission?: never;
|
|
1433
|
+
/**
|
|
1434
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1435
|
+
*/
|
|
1397
1436
|
feature?: never;
|
|
1437
|
+
/**
|
|
1438
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1439
|
+
*/
|
|
1398
1440
|
plan?: never;
|
|
1399
1441
|
} | {
|
|
1400
1442
|
role?: never;
|
|
@@ -1423,10 +1465,25 @@ type CheckAuthorizationParams = WithReverification<{
|
|
|
1423
1465
|
* in session claims and cannot be verified on the server side.
|
|
1424
1466
|
*/
|
|
1425
1467
|
type CheckAuthorizationFromSessionClaims = <P extends OrganizationCustomPermissionKey>(isAuthorizedParams: CheckAuthorizationParamsFromSessionClaims<P>) => boolean;
|
|
1468
|
+
/**
|
|
1469
|
+
* @interface
|
|
1470
|
+
*/
|
|
1426
1471
|
type CheckAuthorizationParamsFromSessionClaims<P extends OrganizationCustomPermissionKey> = WithReverification<{
|
|
1472
|
+
/**
|
|
1473
|
+
* The [role](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1474
|
+
*/
|
|
1427
1475
|
role: OrganizationCustomRoleKey;
|
|
1476
|
+
/**
|
|
1477
|
+
* The [permission](https://clerk.com/docs/organizations/roles-permissions) to check for.
|
|
1478
|
+
*/
|
|
1428
1479
|
permission?: never;
|
|
1480
|
+
/**
|
|
1481
|
+
* The [feature](https://clerk.com/docs/billing/overview) to check for.
|
|
1482
|
+
*/
|
|
1429
1483
|
feature?: never;
|
|
1484
|
+
/**
|
|
1485
|
+
* The [plan](https://clerk.com/docs/billing/overview) to check for.
|
|
1486
|
+
*/
|
|
1430
1487
|
plan?: never;
|
|
1431
1488
|
} | {
|
|
1432
1489
|
role?: never;
|
|
@@ -1942,7 +1999,7 @@ interface ActClaim {
|
|
|
1942
1999
|
[x: string]: unknown;
|
|
1943
2000
|
}
|
|
1944
2001
|
/**
|
|
1945
|
-
*
|
|
2002
|
+
* The current state of the session which can only be `active` or `pending`.
|
|
1946
2003
|
*/
|
|
1947
2004
|
type SessionStatusClaim = Extract<SessionStatus, 'active' | 'pending'>;
|
|
1948
2005
|
|
|
@@ -7131,19 +7188,44 @@ type InitialState = Serializable<{
|
|
|
7131
7188
|
* @internal
|
|
7132
7189
|
*/
|
|
7133
7190
|
type SharedSignedInAuthObjectProperties = {
|
|
7191
|
+
/**
|
|
7192
|
+
* The current user's [session claims](https://clerk.com/docs/backend-requests/resources/session-tokens).
|
|
7193
|
+
*/
|
|
7134
7194
|
sessionClaims: JwtPayload;
|
|
7195
|
+
/**
|
|
7196
|
+
* The ID of the current session.
|
|
7197
|
+
*/
|
|
7135
7198
|
sessionId: string;
|
|
7199
|
+
/**
|
|
7200
|
+
* The current state of the session.
|
|
7201
|
+
*/
|
|
7136
7202
|
sessionStatus: SessionStatusClaim | null;
|
|
7203
|
+
/**
|
|
7204
|
+
* Holds identifier for the user that is impersonating the current user. Read more about [impersonation](https://clerk.com/docs/users/user-impersonation).
|
|
7205
|
+
*/
|
|
7137
7206
|
actor: ActClaim | undefined;
|
|
7207
|
+
/**
|
|
7208
|
+
* The ID of the current user.
|
|
7209
|
+
*/
|
|
7138
7210
|
userId: string;
|
|
7211
|
+
/**
|
|
7212
|
+
* The ID of the user's active organization.
|
|
7213
|
+
*/
|
|
7139
7214
|
orgId: string | undefined;
|
|
7215
|
+
/**
|
|
7216
|
+
* The current user's role in their active organization.
|
|
7217
|
+
*/
|
|
7140
7218
|
orgRole: OrganizationCustomRoleKey | undefined;
|
|
7219
|
+
/**
|
|
7220
|
+
* The URL-friendly identifier of the user's active organization.
|
|
7221
|
+
*/
|
|
7141
7222
|
orgSlug: string | undefined;
|
|
7223
|
+
/**
|
|
7224
|
+
* The current user's active organization permissions.
|
|
7225
|
+
*/
|
|
7142
7226
|
orgPermissions: OrganizationCustomPermissionKey[] | undefined;
|
|
7143
7227
|
/**
|
|
7144
|
-
*
|
|
7145
|
-
* Each item represents the minutes that have passed since the last time a first or second factor were verified.
|
|
7146
|
-
* [fistFactorAge, secondFactorAge]
|
|
7228
|
+
* An array where each item represents the number of minutes since the last verification of a first or second factor: `[firstFactorAge, secondFactorAge]`.
|
|
7147
7229
|
*/
|
|
7148
7230
|
factorVerificationAge: [firstFactorAge: number, secondFactorAge: number] | null;
|
|
7149
7231
|
};
|