@aws-sdk/middleware-sdk-sqs 3.186.0 → 3.190.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.
- package/CHANGELOG.md +16 -0
- package/dist-es/receive-message.js +21 -58
- package/dist-es/send-message-batch.js +30 -78
- package/dist-es/send-message.js +13 -29
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
|
|
@@ -1,70 +1,33 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __values } from "tslib";
|
|
2
1
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
3
2
|
export function receiveMessageMiddleware(options) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
messageIds = [];
|
|
16
|
-
if (!(output.Messages !== undefined)) return [3, 9];
|
|
17
|
-
_f.label = 2;
|
|
18
|
-
case 2:
|
|
19
|
-
_f.trys.push([2, 7, 8, 9]);
|
|
20
|
-
_a = __values(output.Messages), _b = _a.next();
|
|
21
|
-
_f.label = 3;
|
|
22
|
-
case 3:
|
|
23
|
-
if (!!_b.done) return [3, 6];
|
|
24
|
-
message = _b.value;
|
|
25
|
-
md5 = message.MD5OfBody;
|
|
26
|
-
hash = new options.md5();
|
|
27
|
-
hash.update(message.Body || "");
|
|
28
|
-
_c = md5;
|
|
29
|
-
_d = toHex;
|
|
30
|
-
return [4, hash.digest()];
|
|
31
|
-
case 4:
|
|
32
|
-
if (_c !== _d.apply(void 0, [_f.sent()])) {
|
|
33
|
-
messageIds.push(message.MessageId);
|
|
34
|
-
}
|
|
35
|
-
_f.label = 5;
|
|
36
|
-
case 5:
|
|
37
|
-
_b = _a.next();
|
|
38
|
-
return [3, 3];
|
|
39
|
-
case 6: return [3, 9];
|
|
40
|
-
case 7:
|
|
41
|
-
e_1_1 = _f.sent();
|
|
42
|
-
e_1 = { error: e_1_1 };
|
|
43
|
-
return [3, 9];
|
|
44
|
-
case 8:
|
|
45
|
-
try {
|
|
46
|
-
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
47
|
-
}
|
|
48
|
-
finally { if (e_1) throw e_1.error; }
|
|
49
|
-
return [7];
|
|
50
|
-
case 9:
|
|
51
|
-
if (messageIds.length > 0) {
|
|
52
|
-
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
|
|
53
|
-
}
|
|
54
|
-
return [2, resp];
|
|
3
|
+
return (next) => async (args) => {
|
|
4
|
+
const resp = await next({ ...args });
|
|
5
|
+
const output = resp.output;
|
|
6
|
+
const messageIds = [];
|
|
7
|
+
if (output.Messages !== undefined) {
|
|
8
|
+
for (const message of output.Messages) {
|
|
9
|
+
const md5 = message.MD5OfBody;
|
|
10
|
+
const hash = new options.md5();
|
|
11
|
+
hash.update(message.Body || "");
|
|
12
|
+
if (md5 !== toHex(await hash.digest())) {
|
|
13
|
+
messageIds.push(message.MessageId);
|
|
55
14
|
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (messageIds.length > 0) {
|
|
18
|
+
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
|
|
19
|
+
}
|
|
20
|
+
return resp;
|
|
58
21
|
};
|
|
59
22
|
}
|
|
60
|
-
export
|
|
23
|
+
export const receiveMessageMiddlewareOptions = {
|
|
61
24
|
step: "initialize",
|
|
62
25
|
tags: ["VALIDATE_BODY_MD5"],
|
|
63
26
|
name: "receiveMessageMiddleware",
|
|
64
27
|
override: true,
|
|
65
28
|
};
|
|
66
|
-
export
|
|
67
|
-
applyToStack:
|
|
29
|
+
export const getReceiveMessagePlugin = (config) => ({
|
|
30
|
+
applyToStack: (clientStack) => {
|
|
68
31
|
clientStack.add(receiveMessageMiddleware(config), receiveMessageMiddlewareOptions);
|
|
69
32
|
},
|
|
70
|
-
});
|
|
33
|
+
});
|
|
@@ -1,87 +1,39 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __values } from "tslib";
|
|
2
1
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
finally { if (e_2) throw e_2.error; }
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
_j.label = 2;
|
|
34
|
-
case 2:
|
|
35
|
-
_j.trys.push([2, 7, 8, 9]);
|
|
36
|
-
_c = __values(args.input.Entries), _d = _c.next();
|
|
37
|
-
_j.label = 3;
|
|
38
|
-
case 3:
|
|
39
|
-
if (!!_d.done) return [3, 6];
|
|
40
|
-
entry = _d.value;
|
|
41
|
-
if (!entries[entry.Id]) return [3, 5];
|
|
42
|
-
md5 = entries[entry.Id].MD5OfMessageBody;
|
|
43
|
-
hash = new options.md5();
|
|
44
|
-
hash.update(entry.MessageBody || "");
|
|
45
|
-
_e = md5;
|
|
46
|
-
_f = toHex;
|
|
47
|
-
return [4, hash.digest()];
|
|
48
|
-
case 4:
|
|
49
|
-
if (_e !== _f.apply(void 0, [_j.sent()])) {
|
|
50
|
-
messageIds.push(entries[entry.Id].MessageId);
|
|
51
|
-
}
|
|
52
|
-
_j.label = 5;
|
|
53
|
-
case 5:
|
|
54
|
-
_d = _c.next();
|
|
55
|
-
return [3, 3];
|
|
56
|
-
case 6: return [3, 9];
|
|
57
|
-
case 7:
|
|
58
|
-
e_1_1 = _j.sent();
|
|
59
|
-
e_1 = { error: e_1_1 };
|
|
60
|
-
return [3, 9];
|
|
61
|
-
case 8:
|
|
62
|
-
try {
|
|
63
|
-
if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e_1) throw e_1.error; }
|
|
66
|
-
return [7];
|
|
67
|
-
case 9:
|
|
68
|
-
if (messageIds.length > 0) {
|
|
69
|
-
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
|
|
70
|
-
}
|
|
71
|
-
return [2, resp];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}); };
|
|
75
|
-
};
|
|
2
|
+
export const sendMessageBatchMiddleware = (options) => (next) => async (args) => {
|
|
3
|
+
const resp = await next({ ...args });
|
|
4
|
+
const output = resp.output;
|
|
5
|
+
const messageIds = [];
|
|
6
|
+
const entries = {};
|
|
7
|
+
if (output.Successful !== undefined) {
|
|
8
|
+
for (const entry of output.Successful) {
|
|
9
|
+
if (entry.Id !== undefined) {
|
|
10
|
+
entries[entry.Id] = entry;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
for (const entry of args.input.Entries) {
|
|
15
|
+
if (entries[entry.Id]) {
|
|
16
|
+
const md5 = entries[entry.Id].MD5OfMessageBody;
|
|
17
|
+
const hash = new options.md5();
|
|
18
|
+
hash.update(entry.MessageBody || "");
|
|
19
|
+
if (md5 !== toHex(await hash.digest())) {
|
|
20
|
+
messageIds.push(entries[entry.Id].MessageId);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (messageIds.length > 0) {
|
|
25
|
+
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
|
|
26
|
+
}
|
|
27
|
+
return resp;
|
|
76
28
|
};
|
|
77
|
-
export
|
|
29
|
+
export const sendMessageBatchMiddlewareOptions = {
|
|
78
30
|
step: "initialize",
|
|
79
31
|
tags: ["VALIDATE_BODY_MD5"],
|
|
80
32
|
name: "sendMessageBatchMiddleware",
|
|
81
33
|
override: true,
|
|
82
34
|
};
|
|
83
|
-
export
|
|
84
|
-
applyToStack:
|
|
35
|
+
export const getSendMessageBatchPlugin = (config) => ({
|
|
36
|
+
applyToStack: (clientStack) => {
|
|
85
37
|
clientStack.add(sendMessageBatchMiddleware(config), sendMessageBatchMiddlewareOptions);
|
|
86
38
|
},
|
|
87
|
-
});
|
|
39
|
+
});
|
package/dist-es/send-message.js
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
output = resp.output;
|
|
13
|
-
hash = new options.md5();
|
|
14
|
-
hash.update(args.input.MessageBody || "");
|
|
15
|
-
_a = output.MD5OfMessageBody;
|
|
16
|
-
_b = toHex;
|
|
17
|
-
return [4, hash.digest()];
|
|
18
|
-
case 2:
|
|
19
|
-
if (_a !== _b.apply(void 0, [_c.sent()])) {
|
|
20
|
-
throw new Error("InvalidChecksumError");
|
|
21
|
-
}
|
|
22
|
-
return [2, resp];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}); };
|
|
26
|
-
};
|
|
2
|
+
export const sendMessageMiddleware = (options) => (next) => async (args) => {
|
|
3
|
+
const resp = await next({ ...args });
|
|
4
|
+
const output = resp.output;
|
|
5
|
+
const hash = new options.md5();
|
|
6
|
+
hash.update(args.input.MessageBody || "");
|
|
7
|
+
if (output.MD5OfMessageBody !== toHex(await hash.digest())) {
|
|
8
|
+
throw new Error("InvalidChecksumError");
|
|
9
|
+
}
|
|
10
|
+
return resp;
|
|
27
11
|
};
|
|
28
|
-
export
|
|
12
|
+
export const sendMessageMiddlewareOptions = {
|
|
29
13
|
step: "initialize",
|
|
30
14
|
tags: ["VALIDATE_BODY_MD5"],
|
|
31
15
|
name: "sendMessageMiddleware",
|
|
32
16
|
override: true,
|
|
33
17
|
};
|
|
34
|
-
export
|
|
35
|
-
applyToStack:
|
|
18
|
+
export const getSendMessagePlugin = (config) => ({
|
|
19
|
+
applyToStack: (clientStack) => {
|
|
36
20
|
clientStack.add(sendMessageMiddleware(config), sendMessageMiddlewareOptions);
|
|
37
21
|
},
|
|
38
|
-
});
|
|
22
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-sqs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.190.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,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/types": "3.
|
|
24
|
-
"@aws-sdk/util-hex-encoding": "3.
|
|
23
|
+
"@aws-sdk/types": "3.190.0",
|
|
24
|
+
"@aws-sdk/util-hex-encoding": "3.188.0",
|
|
25
25
|
"tslib": "^2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|