How to use the rhea-promise.uuid_to_string function in rhea-promise

To help you get started, we’ve selected a few rhea-promise 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 Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
props.lockedUntilUtc = new Date(msg.message_annotations[Constants.lockedUntil] as number);
    }
  }
  if (msg.ttl != null && msg.ttl >= Constants.maxDurationValue - props.enqueuedTimeUtc.getTime()) {
    props.expiresAtUtc = new Date(Constants.maxDurationValue);
  } else {
    props.expiresAtUtc = new Date(props.enqueuedTimeUtc.getTime() + msg.ttl!);
  }

  const rcvdsbmsg: ReceivedMessageInfo = {
    _amqpMessage: msg,
    _delivery: delivery,
    deliveryCount: msg.delivery_count,
    lockToken:
      delivery && delivery.tag && delivery.tag.length !== 0
        ? uuid_to_string(
            shouldReorderLockToken === true
              ? reorderLockToken(
                  typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag
                )
              : typeof delivery.tag === "string"
              ? Buffer.from(delivery.tag)
              : delivery.tag
          )
        : undefined,
    ...sbmsg,
    ...props
  };

  log.message("AmqpMessage to ReceivedSBMessage: %O", rcvdsbmsg);
  return rcvdsbmsg;
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusMessage.ts View on Github external
props.lockedUntilUtc = new Date(msg.message_annotations[Constants.lockedUntil] as number);
    }
  }
  if (msg.ttl != null && msg.ttl >= Constants.maxDurationValue - props.enqueuedTimeUtc.getTime()) {
    props.expiresAtUtc = new Date(Constants.maxDurationValue);
  } else {
    props.expiresAtUtc = new Date(props.enqueuedTimeUtc.getTime() + msg.ttl!);
  }

  const rcvdsbmsg: ReceivedMessageInfo = {
    _amqpMessage: msg,
    _delivery: delivery,
    deliveryCount: msg.delivery_count,
    lockToken:
      delivery && delivery.tag && delivery.tag.length !== 0
        ? uuid_to_string(
            shouldReorderLockToken === true
              ? reorderLockToken(
                  typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag
                )
              : typeof delivery.tag === "string"
              ? Buffer.from(delivery.tag)
              : delivery.tag
          )
        : undefined,
    ...sbmsg,
    ...props
  };

  log.message("AmqpMessage to ReceivedSBMessage: %O", rcvdsbmsg);
  return rcvdsbmsg;
}