Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/middleware-sdk-sqs

Package Overview
Dependencies
Maintainers
5
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-sdk-sqs - npm Package Compare versions

Comparing version 3.186.0 to 3.188.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)

@@ -8,0 +16,0 @@

79

dist-es/receive-message.js

@@ -1,61 +0,24 @@

import { __assign, __awaiter, __generator, __values } from "tslib";
import { toHex } from "@aws-sdk/util-hex-encoding";
export function receiveMessageMiddleware(options) {
var _this = this;
return function (next) {
return function (args) { return __awaiter(_this, void 0, void 0, function () {
var resp, output, messageIds, _a, _b, message, md5, hash, _c, _d, e_1_1;
var e_1, _e;
return __generator(this, function (_f) {
switch (_f.label) {
case 0: return [4, next(__assign({}, args))];
case 1:
resp = _f.sent();
output = resp.output;
messageIds = [];
if (!(output.Messages !== undefined)) return [3, 9];
_f.label = 2;
case 2:
_f.trys.push([2, 7, 8, 9]);
_a = __values(output.Messages), _b = _a.next();
_f.label = 3;
case 3:
if (!!_b.done) return [3, 6];
message = _b.value;
md5 = message.MD5OfBody;
hash = new options.md5();
hash.update(message.Body || "");
_c = md5;
_d = toHex;
return [4, hash.digest()];
case 4:
if (_c !== _d.apply(void 0, [_f.sent()])) {
messageIds.push(message.MessageId);
}
_f.label = 5;
case 5:
_b = _a.next();
return [3, 3];
case 6: return [3, 9];
case 7:
e_1_1 = _f.sent();
e_1 = { error: e_1_1 };
return [3, 9];
case 8:
try {
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
}
finally { if (e_1) throw e_1.error; }
return [7];
case 9:
if (messageIds.length > 0) {
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
}
return [2, resp];
return (next) => async (args) => {
const resp = await next({ ...args });
const output = resp.output;
const messageIds = [];
if (output.Messages !== undefined) {
for (const message of output.Messages) {
const md5 = message.MD5OfBody;
const hash = new options.md5();
hash.update(message.Body || "");
if (md5 !== toHex(await hash.digest())) {
messageIds.push(message.MessageId);
}
});
}); };
}
}
if (messageIds.length > 0) {
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
}
return resp;
};
}
export var receiveMessageMiddlewareOptions = {
export const receiveMessageMiddlewareOptions = {
step: "initialize",

@@ -66,6 +29,6 @@ tags: ["VALIDATE_BODY_MD5"],

};
export var getReceiveMessagePlugin = function (config) { return ({
applyToStack: function (clientStack) {
export const getReceiveMessagePlugin = (config) => ({
applyToStack: (clientStack) => {
clientStack.add(receiveMessageMiddleware(config), receiveMessageMiddlewareOptions);
},
}); };
});

@@ -1,78 +0,30 @@

import { __assign, __awaiter, __generator, __values } from "tslib";
import { toHex } from "@aws-sdk/util-hex-encoding";
export var sendMessageBatchMiddleware = function (options) {
return function (next) {
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
var resp, output, messageIds, entries, _a, _b, entry, _c, _d, entry, md5, hash, _e, _f, e_1_1;
var e_2, _g, e_1, _h;
return __generator(this, function (_j) {
switch (_j.label) {
case 0: return [4, next(__assign({}, args))];
case 1:
resp = _j.sent();
output = resp.output;
messageIds = [];
entries = {};
if (output.Successful !== undefined) {
try {
for (_a = __values(output.Successful), _b = _a.next(); !_b.done; _b = _a.next()) {
entry = _b.value;
if (entry.Id !== undefined) {
entries[entry.Id] = entry;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
}
finally { if (e_2) throw e_2.error; }
}
}
_j.label = 2;
case 2:
_j.trys.push([2, 7, 8, 9]);
_c = __values(args.input.Entries), _d = _c.next();
_j.label = 3;
case 3:
if (!!_d.done) return [3, 6];
entry = _d.value;
if (!entries[entry.Id]) return [3, 5];
md5 = entries[entry.Id].MD5OfMessageBody;
hash = new options.md5();
hash.update(entry.MessageBody || "");
_e = md5;
_f = toHex;
return [4, hash.digest()];
case 4:
if (_e !== _f.apply(void 0, [_j.sent()])) {
messageIds.push(entries[entry.Id].MessageId);
}
_j.label = 5;
case 5:
_d = _c.next();
return [3, 3];
case 6: return [3, 9];
case 7:
e_1_1 = _j.sent();
e_1 = { error: e_1_1 };
return [3, 9];
case 8:
try {
if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
}
finally { if (e_1) throw e_1.error; }
return [7];
case 9:
if (messageIds.length > 0) {
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
}
return [2, resp];
}
});
}); };
};
export const sendMessageBatchMiddleware = (options) => (next) => async (args) => {
const resp = await next({ ...args });
const output = resp.output;
const messageIds = [];
const entries = {};
if (output.Successful !== undefined) {
for (const entry of output.Successful) {
if (entry.Id !== undefined) {
entries[entry.Id] = entry;
}
}
}
for (const entry of args.input.Entries) {
if (entries[entry.Id]) {
const md5 = entries[entry.Id].MD5OfMessageBody;
const hash = new options.md5();
hash.update(entry.MessageBody || "");
if (md5 !== toHex(await hash.digest())) {
messageIds.push(entries[entry.Id].MessageId);
}
}
}
if (messageIds.length > 0) {
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
}
return resp;
};
export var sendMessageBatchMiddlewareOptions = {
export const sendMessageBatchMiddlewareOptions = {
step: "initialize",

@@ -83,6 +35,6 @@ tags: ["VALIDATE_BODY_MD5"],

};
export var getSendMessageBatchPlugin = function (config) { return ({
applyToStack: function (clientStack) {
export const getSendMessageBatchPlugin = (config) => ({
applyToStack: (clientStack) => {
clientStack.add(sendMessageBatchMiddleware(config), sendMessageBatchMiddlewareOptions);
},
}); };
});

@@ -1,29 +0,13 @@

import { __assign, __awaiter, __generator } from "tslib";
import { toHex } from "@aws-sdk/util-hex-encoding";
export var sendMessageMiddleware = function (options) {
return function (next) {
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
var resp, output, hash, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, next(__assign({}, args))];
case 1:
resp = _c.sent();
output = resp.output;
hash = new options.md5();
hash.update(args.input.MessageBody || "");
_a = output.MD5OfMessageBody;
_b = toHex;
return [4, hash.digest()];
case 2:
if (_a !== _b.apply(void 0, [_c.sent()])) {
throw new Error("InvalidChecksumError");
}
return [2, resp];
}
});
}); };
};
export const sendMessageMiddleware = (options) => (next) => async (args) => {
const resp = await next({ ...args });
const output = resp.output;
const hash = new options.md5();
hash.update(args.input.MessageBody || "");
if (output.MD5OfMessageBody !== toHex(await hash.digest())) {
throw new Error("InvalidChecksumError");
}
return resp;
};
export var sendMessageMiddlewareOptions = {
export const sendMessageMiddlewareOptions = {
step: "initialize",

@@ -34,6 +18,6 @@ tags: ["VALIDATE_BODY_MD5"],

};
export var getSendMessagePlugin = function (config) { return ({
applyToStack: function (clientStack) {
export const getSendMessagePlugin = (config) => ({
applyToStack: (clientStack) => {
clientStack.add(sendMessageMiddleware(config), sendMessageMiddlewareOptions);
},
}); };
});
{
"name": "@aws-sdk/middleware-sdk-sqs",
"version": "3.186.0",
"version": "3.188.0",
"scripts": {

@@ -23,4 +23,4 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@aws-sdk/types": "3.186.0",
"@aws-sdk/util-hex-encoding": "3.186.0",
"@aws-sdk/types": "3.188.0",
"@aws-sdk/util-hex-encoding": "3.188.0",
"tslib": "^2.3.1"

@@ -27,0 +27,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc