How to use the io-functions-commons/dist/src/models/message.ActiveMessage.decode function in io-functions-commons

To help you get started, we’ve selected a few io-functions-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teamdigitale / io-functions / lib / webhook_queue_handler.ts View on Github external
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
  );
github teamdigitale / io-functions / lib / emailnotifications_queue_handler.ts View on Github external
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
  );

io-functions-commons

Common code for Azure functions

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages