@aws-sdk/middleware-sdk-sqs 3.224.0 → 3.254.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getReceiveMessagePlugin = exports.receiveMessageMiddlewareOptions = exports.receiveMessageMiddleware = void 0;
4
4
  const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
5
+ const util_utf8_1 = require("@aws-sdk/util-utf8");
5
6
  function receiveMessageMiddleware(options) {
6
7
  return (next) => async (args) => {
7
8
  const resp = await next({ ...args });
@@ -11,7 +12,7 @@ function receiveMessageMiddleware(options) {
11
12
  for (const message of output.Messages) {
12
13
  const md5 = message.MD5OfBody;
13
14
  const hash = new options.md5();
14
- hash.update(message.Body || "");
15
+ hash.update((0, util_utf8_1.toUint8Array)(message.Body || ""));
15
16
  if (md5 !== (0, util_hex_encoding_1.toHex)(await hash.digest())) {
16
17
  messageIds.push(message.MessageId);
17
18
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSendMessageBatchPlugin = exports.sendMessageBatchMiddlewareOptions = exports.sendMessageBatchMiddleware = void 0;
4
4
  const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
5
+ const util_utf8_1 = require("@aws-sdk/util-utf8");
5
6
  const sendMessageBatchMiddleware = (options) => (next) => async (args) => {
6
7
  const resp = await next({ ...args });
7
8
  const output = resp.output;
@@ -18,7 +19,7 @@ const sendMessageBatchMiddleware = (options) => (next) => async (args) => {
18
19
  if (entries[entry.Id]) {
19
20
  const md5 = entries[entry.Id].MD5OfMessageBody;
20
21
  const hash = new options.md5();
21
- hash.update(entry.MessageBody || "");
22
+ hash.update((0, util_utf8_1.toUint8Array)(entry.MessageBody || ""));
22
23
  if (md5 !== (0, util_hex_encoding_1.toHex)(await hash.digest())) {
23
24
  messageIds.push(entries[entry.Id].MessageId);
24
25
  }
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSendMessagePlugin = exports.sendMessageMiddlewareOptions = exports.sendMessageMiddleware = void 0;
4
4
  const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
5
+ const util_utf8_1 = require("@aws-sdk/util-utf8");
5
6
  const sendMessageMiddleware = (options) => (next) => async (args) => {
6
7
  const resp = await next({ ...args });
7
8
  const output = resp.output;
8
9
  const hash = new options.md5();
9
- hash.update(args.input.MessageBody || "");
10
+ hash.update((0, util_utf8_1.toUint8Array)(args.input.MessageBody || ""));
10
11
  if (output.MD5OfMessageBody !== (0, util_hex_encoding_1.toHex)(await hash.digest())) {
11
12
  throw new Error("InvalidChecksumError");
12
13
  }
@@ -1,4 +1,5 @@
1
1
  import { toHex } from "@aws-sdk/util-hex-encoding";
2
+ import { toUint8Array } from "@aws-sdk/util-utf8";
2
3
  export function receiveMessageMiddleware(options) {
3
4
  return (next) => async (args) => {
4
5
  const resp = await next({ ...args });
@@ -8,7 +9,7 @@ export function receiveMessageMiddleware(options) {
8
9
  for (const message of output.Messages) {
9
10
  const md5 = message.MD5OfBody;
10
11
  const hash = new options.md5();
11
- hash.update(message.Body || "");
12
+ hash.update(toUint8Array(message.Body || ""));
12
13
  if (md5 !== toHex(await hash.digest())) {
13
14
  messageIds.push(message.MessageId);
14
15
  }
@@ -1,4 +1,5 @@
1
1
  import { toHex } from "@aws-sdk/util-hex-encoding";
2
+ import { toUint8Array } from "@aws-sdk/util-utf8";
2
3
  export const sendMessageBatchMiddleware = (options) => (next) => async (args) => {
3
4
  const resp = await next({ ...args });
4
5
  const output = resp.output;
@@ -15,7 +16,7 @@ export const sendMessageBatchMiddleware = (options) => (next) => async (args) =>
15
16
  if (entries[entry.Id]) {
16
17
  const md5 = entries[entry.Id].MD5OfMessageBody;
17
18
  const hash = new options.md5();
18
- hash.update(entry.MessageBody || "");
19
+ hash.update(toUint8Array(entry.MessageBody || ""));
19
20
  if (md5 !== toHex(await hash.digest())) {
20
21
  messageIds.push(entries[entry.Id].MessageId);
21
22
  }
@@ -1,9 +1,10 @@
1
1
  import { toHex } from "@aws-sdk/util-hex-encoding";
2
+ import { toUint8Array } from "@aws-sdk/util-utf8";
2
3
  export const sendMessageMiddleware = (options) => (next) => async (args) => {
3
4
  const resp = await next({ ...args });
4
5
  const output = resp.output;
5
6
  const hash = new options.md5();
6
- hash.update(args.input.MessageBody || "");
7
+ hash.update(toUint8Array(args.input.MessageBody || ""));
7
8
  if (output.MD5OfMessageBody !== toHex(await hash.digest())) {
8
9
  throw new Error("InvalidChecksumError");
9
10
  }
@@ -1,4 +1,4 @@
1
- import { HashConstructor } from "@aws-sdk/types";
1
+ import { ChecksumConstructor, HashConstructor } from "@aws-sdk/types";
2
2
  export interface PreviouslyResolved {
3
- md5: HashConstructor;
3
+ md5: ChecksumConstructor | HashConstructor;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { HashConstructor } from "@aws-sdk/types";
1
+ import { ChecksumConstructor, HashConstructor } from "@aws-sdk/types";
2
2
  export interface PreviouslyResolved {
3
- md5: HashConstructor;
3
+ md5: ChecksumConstructor | HashConstructor;
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-sqs",
3
- "version": "3.224.0",
3
+ "version": "3.254.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,8 +20,9 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.224.0",
23
+ "@aws-sdk/types": "3.254.0",
24
24
  "@aws-sdk/util-hex-encoding": "3.201.0",
25
+ "@aws-sdk/util-utf8": "3.254.0",
25
26
  "tslib": "^2.3.1"
26
27
  },
27
28
  "engines": {