diff --git a/packages/console/src/consts/logs.ts b/packages/console/src/consts/logs.ts index 0156bf852..7bcc1cf74 100644 --- a/packages/console/src/consts/logs.ts +++ b/packages/console/src/consts/logs.ts @@ -1,12 +1,12 @@ -import type { AuditLogKey, WebhookLogKey, JwtCustomizerLogKey, LogKey } from '@logto/schemas'; +import type { AuditLogKey, LogKey } from '@logto/schemas'; import { type Optional } from '@silverhand/essentials'; -export const auditLogEventTitle: Record> & - Record> = Object.freeze({ +export const auditLogEventTitle: Record> & { + [key in AuditLogKey]?: string; +} = Object.freeze({ 'ExchangeTokenBy.AuthorizationCode': 'Exchange token by Code', 'ExchangeTokenBy.ClientCredentials': 'Exchange token by Client Credentials', 'ExchangeTokenBy.RefreshToken': 'Exchange token by Refresh Token', - 'ExchangeTokenBy.Unknown': undefined, 'Interaction.Create': 'Interaction started', 'Interaction.End': 'Interaction ended', 'Interaction.ForgotPassword.Identifier.VerificationCode.Create': @@ -18,15 +18,6 @@ export const auditLogEventTitle: Record> & 'Interaction.ForgotPassword.Profile.Update': 'Patch update forgot-password interaction profile', 'Interaction.ForgotPassword.Submit': 'Submit forgot-password interaction', 'Interaction.ForgotPassword.Update': 'Update forgot-password interaction', - 'Interaction.ForgotPassword.BindMfa.Totp.Create': undefined, - 'Interaction.ForgotPassword.BindMfa.Totp.Submit': undefined, - 'Interaction.ForgotPassword.BindMfa.BackupCode.Create': undefined, - 'Interaction.ForgotPassword.BindMfa.BackupCode.Submit': undefined, - 'Interaction.ForgotPassword.BindMfa.WebAuthn.Create': undefined, - 'Interaction.ForgotPassword.BindMfa.WebAuthn.Submit': undefined, - 'Interaction.Register.Identifier.Password.Submit': undefined, - 'Interaction.Register.Identifier.Social.Create': undefined, - 'Interaction.Register.Identifier.Social.Submit': undefined, 'Interaction.Register.Identifier.VerificationCode.Create': 'Create and send register identifier with verification code', 'Interaction.Register.Identifier.VerificationCode.Submit': @@ -36,14 +27,6 @@ export const auditLogEventTitle: Record> & 'Interaction.Register.Profile.Update': 'Patch update register interaction profile', 'Interaction.Register.Submit': 'Submit register interaction', 'Interaction.Register.Update': 'Update register interaction', - 'Interaction.Register.BindMfa.Totp.Create': undefined, - 'Interaction.Register.BindMfa.Totp.Submit': undefined, - 'Interaction.Register.BindMfa.BackupCode.Create': undefined, - 'Interaction.Register.BindMfa.BackupCode.Submit': undefined, - 'Interaction.Register.BindMfa.WebAuthn.Create': undefined, - 'Interaction.Register.BindMfa.WebAuthn.Submit': undefined, - 'Interaction.Register.SingleSignOn.Create': undefined, - 'Interaction.Register.SingleSignOn.Submit': undefined, 'Interaction.SignIn.Identifier.Password.Submit': 'Submit sign-in identifier with password', 'Interaction.SignIn.Identifier.Social.Create': 'Create social sign-in authorization-url', 'Interaction.SignIn.Identifier.Social.Submit': 'Authenticate and submit social identifier', @@ -56,44 +39,14 @@ export const auditLogEventTitle: Record> & 'Interaction.SignIn.Profile.Update': 'Patch Update sign-in interaction profile', 'Interaction.SignIn.Submit': 'Submit sign-in interaction', 'Interaction.SignIn.Update': 'Update sign-in interaction', - 'Interaction.SignIn.BindMfa.Totp.Create': undefined, - 'Interaction.SignIn.BindMfa.Totp.Submit': undefined, - 'Interaction.SignIn.BindMfa.BackupCode.Create': undefined, - 'Interaction.SignIn.BindMfa.BackupCode.Submit': undefined, - 'Interaction.SignIn.BindMfa.WebAuthn.Create': undefined, - 'Interaction.SignIn.BindMfa.WebAuthn.Submit': undefined, - 'Interaction.SignIn.Mfa.Totp.Create': undefined, - 'Interaction.SignIn.Mfa.Totp.Submit': undefined, - 'Interaction.SignIn.Mfa.BackupCode.Create': undefined, - 'Interaction.SignIn.Mfa.BackupCode.Submit': undefined, - 'Interaction.SignIn.Mfa.WebAuthn.Create': undefined, - 'Interaction.SignIn.Mfa.WebAuthn.Submit': undefined, 'Interaction.SignIn.Identifier.SingleSignOn.Create': 'Create single-sign-on authentication session', 'Interaction.SignIn.Identifier.SingleSignOn.Submit': 'Submit single-sign-on authentication interaction', - 'Interaction.Register.Identifier.SingleSignOn.Create': undefined, - 'Interaction.Register.Identifier.SingleSignOn.Submit': undefined, - RevokeToken: undefined, - Unknown: undefined, }); -// `webhookLogEventTitle` and `logEventTitle` are not used yet, keep them just in case. -const webhookLogEventTitle: Record> & - Record> = Object.freeze({ - 'TriggerHook.PostRegister': undefined, - 'TriggerHook.PostResetPassword': undefined, - 'TriggerHook.PostSignIn': undefined, -}); - -const jwtCustomizerLogEventTitle: Record> & - Record> = Object.freeze({ - 'JwtCustomizer.AccessToken': undefined, - 'JwtCustomizer.ClientCredentials': undefined, -}); - -export const logEventTitle: Record> & Record> = { +export const logEventTitle: Record> & { + [key in LogKey]?: string; +} = { ...auditLogEventTitle, - ...webhookLogEventTitle, - ...jwtCustomizerLogEventTitle, };