Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function handleNotification(
lAppInsightsClient: TelemetryClient,
lNotificationModel: NotificationModel,
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
);
export async function handleNotification(
lMailerTransporter: NodeMailer.Transporter,
lAppInsightsClient: TelemetryClient,
lNotificationModel: NotificationModel,
emailNotificationEvent: NotificationEvent,
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
);