Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
notificationDefaultParams: INotificationDefaults
): Promise> {
const {
message,
content,
notificationId,
senderMetadata
} = emailNotificationEvent;
// Check if the message is not expired
const errorOrActiveMessage = ActiveMessage.decode(message);
if (isLeft(errorOrActiveMessage)) {
// if the message is expired no more processing is necessary
return left(
ExpiredError(
`Message expired|notification=${notificationId}|message=${message.id}`
)
);
}
// fetch the notification
const errorOrMaybeNotification = await lNotificationModel.find(
notificationId,
message.id
);
if (isLeft(errorOrMaybeNotification)) {
const error = errorOrMaybeNotification.value;
// we got an error while fetching the notification
return left(
TransientError(
webhookNotificationEvent: NotificationEvent
): Promise> {
const {
content,
message,
notificationId,
senderMetadata
} = webhookNotificationEvent;
// Check if the message is not expired
const errorOrActiveMessage = ActiveMessage.decode(message);
if (isLeft(errorOrActiveMessage)) {
// if the message is expired no more processing is necessary
return left(
ExpiredError(
`Message expired|notification=${notificationId}|message=${message.id}`
)
);
}
// fetch the notification
const errorOrMaybeNotification = await lNotificationModel.find(
notificationId,
message.id
);
if (isLeft(errorOrMaybeNotification)) {
const error = errorOrMaybeNotification.value;
// we got an error while fetching the notification
return left(
TransientError(