0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/packages/console/src/consts/webhooks.ts
2023-05-22 14:19:15 +00:00

25 lines
879 B
TypeScript

import { type AdminConsoleKey } from '@logto/phrases';
import { HookEvent, type LogKey } from '@logto/schemas';
import { yes } from '@silverhand/essentials';
type HookEventLabel = {
[key in HookEvent]: AdminConsoleKey;
};
export const hookEventLabel = Object.freeze({
[HookEvent.PostRegister]: 'webhooks.events.post_register',
[HookEvent.PostResetPassword]: 'webhooks.events.post_reset_password',
[HookEvent.PostSignIn]: 'webhooks.events.post_sign_in',
}) satisfies HookEventLabel;
type HookEventLogKey = {
[key in HookEvent]: LogKey;
};
export const hookEventLogKey = Object.freeze({
[HookEvent.PostRegister]: 'TriggerHook.PostRegister',
[HookEvent.PostResetPassword]: 'TriggerHook.PostResetPassword',
[HookEvent.PostSignIn]: 'TriggerHook.PostSignIn',
}) satisfies HookEventLogKey;
export const isHookFeatureEnabled = yes(process.env.HOOK_FEATURE_ENABLED);