@logto/core-kit
Advanced tools
Comparing version 2.5.2 to 2.5.3
@@ -0,1 +1,2 @@ | ||
import { z } from 'zod'; | ||
/** Scopes that reserved by Logto, which will be added to the auth request automatically. */ | ||
@@ -15,4 +16,22 @@ export declare enum ReservedScope { | ||
} | ||
export type UserClaim = 'name' | 'given_name' | 'family_name' | 'middle_name' | 'nickname' | 'preferred_username' | 'profile' | 'picture' | 'website' | 'email' | 'email_verified' | 'gender' | 'birthdate' | 'zoneinfo' | 'locale' | 'phone_number' | 'phone_number_verified' | 'address' | 'updated_at' | 'username' | 'roles' | 'organizations' | 'organization_data' | 'organization_roles' | 'custom_data' | 'identities' | 'sso_identities' | 'created_at'; | ||
/** | ||
* A comprehensive list of all available user claims that can be used in SAML applications. | ||
* This array serves two purposes: | ||
* 1. Acts as a single source of truth for all possible `UserClaim` values | ||
* 2. Provides a runtime accessible list of all available claims | ||
* | ||
* Previously, `UserClaim` type was defined directly as a union type. Now, we define this array first | ||
* and derive the `UserClaim` type from it using Zod. This approach maintains type safety while also | ||
* making the complete list of claims available at runtime. | ||
* | ||
* Note: This array must include ALL possible values from `UserClaim` type. | ||
* TypeScript will throw error if any value is missing. | ||
*/ | ||
export declare const userClaimsList: readonly ["name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale", "phone_number", "phone_number_verified", "address", "updated_at", "username", "roles", "organizations", "organization_data", "organization_roles", "custom_data", "identities", "sso_identities", "created_at"]; | ||
/** | ||
* Zod guard for `UserClaim` type, using `userClaimsList` as the single source of truth | ||
*/ | ||
export declare const userClaimGuard: z.ZodEnum<["name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale", "phone_number", "phone_number_verified", "address", "updated_at", "username", "roles", "organizations", "organization_data", "organization_roles", "custom_data", "identities", "sso_identities", "created_at"]>; | ||
export type UserClaim = z.infer<typeof userClaimGuard>; | ||
/** | ||
* Scopes for ID Token and Userinfo Endpoint. | ||
@@ -19,0 +38,0 @@ */ |
@@ -0,1 +1,2 @@ | ||
import { z } from 'zod'; | ||
/** Scopes that reserved by Logto, which will be added to the auth request automatically. */ | ||
@@ -18,2 +19,51 @@ export var ReservedScope; | ||
/** | ||
* A comprehensive list of all available user claims that can be used in SAML applications. | ||
* This array serves two purposes: | ||
* 1. Acts as a single source of truth for all possible `UserClaim` values | ||
* 2. Provides a runtime accessible list of all available claims | ||
* | ||
* Previously, `UserClaim` type was defined directly as a union type. Now, we define this array first | ||
* and derive the `UserClaim` type from it using Zod. This approach maintains type safety while also | ||
* making the complete list of claims available at runtime. | ||
* | ||
* Note: This array must include ALL possible values from `UserClaim` type. | ||
* TypeScript will throw error if any value is missing. | ||
*/ | ||
export const userClaimsList = [ | ||
// OIDC standard claims | ||
'name', | ||
'given_name', | ||
'family_name', | ||
'middle_name', | ||
'nickname', | ||
'preferred_username', | ||
'profile', | ||
'picture', | ||
'website', | ||
'email', | ||
'email_verified', | ||
'gender', | ||
'birthdate', | ||
'zoneinfo', | ||
'locale', | ||
'phone_number', | ||
'phone_number_verified', | ||
'address', | ||
'updated_at', | ||
// Custom claims | ||
'username', | ||
'roles', | ||
'organizations', | ||
'organization_data', | ||
'organization_roles', | ||
'custom_data', | ||
'identities', | ||
'sso_identities', | ||
'created_at', | ||
]; | ||
/** | ||
* Zod guard for `UserClaim` type, using `userClaimsList` as the single source of truth | ||
*/ | ||
export const userClaimGuard = z.enum(userClaimsList); | ||
/** | ||
* Scopes for ID Token and Userinfo Endpoint. | ||
@@ -20,0 +70,0 @@ */ |
{ | ||
"name": "@logto/core-kit", | ||
"version": "2.5.2", | ||
"version": "2.5.3", | ||
"author": "Silverhand Inc. <contact@silverhand.io>", | ||
@@ -37,3 +37,3 @@ "homepage": "https://github.com/logto-io/toolkit#readme", | ||
"@logto/language-kit": "^1.1.0", | ||
"@logto/shared": "^3.1.0", | ||
"@logto/shared": "^3.1.3", | ||
"@silverhand/essentials": "^2.9.1", | ||
@@ -40,0 +40,0 @@ "color": "^4.2.3" |
87175
1274
Updated@logto/shared@^3.1.3