UNPKG

@message-queue-toolkit/sqs

Version:
22 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OFFLOADED_PAYLOAD_SIZE_ATTRIBUTE = void 0; exports.resolveOutgoingMessageAttributes = resolveOutgoingMessageAttributes; exports.hasOffloadedPayload = hasOffloadedPayload; const core_1 = require("@message-queue-toolkit/core"); exports.OFFLOADED_PAYLOAD_SIZE_ATTRIBUTE = 'payloadOffloading.size'; function resolveOutgoingMessageAttributes(payload) { const attributes = {}; if ((0, core_1.isOffloadedPayloadPointerPayload)(payload)) { attributes[exports.OFFLOADED_PAYLOAD_SIZE_ATTRIBUTE] = { DataType: 'Number', // The SQS SDK does not provide properties to set numeric values, we have to convert it to string StringValue: payload.offloadedPayloadSize.toString(), }; } return attributes; } function hasOffloadedPayload(message) { return !!message.attributes && exports.OFFLOADED_PAYLOAD_SIZE_ATTRIBUTE in message.attributes; } //# sourceMappingURL=messageUtils.js.map