0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): replace ts with js for JWT customizer (#5760)

replace ts with js for JWT customizer
This commit is contained in:
simeng-li 2024-04-19 17:24:01 +08:00 committed by GitHub
parent 9707d66930
commit 15e543abc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View file

@ -98,10 +98,17 @@ function MonacoCodeEditor({
}
if (activeModel.language === 'typescript') {
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
});
// Set the typescript compiler options
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
allowNonTsExtensions: true,
strictNullChecks: true,
allowJs: true,
checkJs: true,
});
}
}, [activeModel, monaco, environmentVariablesDefinition]);

View file

@ -47,15 +47,13 @@ export const defaultAccessTokenJwtCustomizerCode = `/**
* This function is called during the access token generation process to get custom claims for the JWT token.
* Limit custom claims to under 50KB.
*
* @param {Payload} payload - The input payload of the function.
* @param {Object} payload - The input payload of the function.
* @param {${JwtCustomizerTypeDefinitionKey.AccessTokenPayload}} payload.token -The JWT token.
* @param {Context} payload.context - Logto internal data that can be used to pass additional information
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserContext}} payload.context.user - The user info associated with the token.
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
*
* @returns The custom claims.
*/
const getCustomJwtClaims = async ({ token, context, environmentVariables }) => {
return {};
}`;
@ -64,19 +62,18 @@ export const defaultClientCredentialsJwtCustomizerCode = `/**
* This function is called during the access token generation process to get custom claims for the JWT token.
* Limit custom claims to under 50KB.
*
* @param {Payload} payload - The input payload of the function.
* @param {Object} payload - The input payload of the function.
* @param {${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}} payload.token -The JWT token.
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
*
* @returns The custom claims.
*/
const getCustomJwtClaims = async ({ token, environmentVariables }) => {
return {};
}`;
export const accessTokenJwtCustomizerModel: ModelSettings = {
name: 'user-jwt.ts',
name: 'user-jwt.js',
title: 'User access token',
language: 'typescript',
defaultValue: defaultAccessTokenJwtCustomizerCode,
@ -93,7 +90,7 @@ export const accessTokenJwtCustomizerModel: ModelSettings = {
};
export const clientCredentialsModel: ModelSettings = {
name: 'machine-to-machine-jwt.ts',
name: 'machine-to-machine-jwt.js',
title: 'Machine-to-machine token',
language: 'typescript',
defaultValue: defaultClientCredentialsJwtCustomizerCode,