@aws-sdk/middleware-sdk-sqs 3.183.0 → 3.186.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 +8 -0
- package/dist-es/receive-message.js +58 -21
- package/dist-es/send-message-batch.js +78 -30
- package/dist-es/send-message.js +29 -13
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/middleware-sdk-sqs
|
|
@@ -1,33 +1,70 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator, __values } from "tslib";
|
|
1
2
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
2
3
|
export function receiveMessageMiddleware(options) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var _this = this;
|
|
5
|
+
return function (next) {
|
|
6
|
+
return function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
7
|
+
var resp, output, messageIds, _a, _b, message, md5, hash, _c, _d, e_1_1;
|
|
8
|
+
var e_1, _e;
|
|
9
|
+
return __generator(this, function (_f) {
|
|
10
|
+
switch (_f.label) {
|
|
11
|
+
case 0: return [4, next(__assign({}, args))];
|
|
12
|
+
case 1:
|
|
13
|
+
resp = _f.sent();
|
|
14
|
+
output = resp.output;
|
|
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];
|
|
14
55
|
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (messageIds.length > 0) {
|
|
18
|
-
throw new Error("Invalid MD5 checksum on messages: " + messageIds.join(", "));
|
|
19
|
-
}
|
|
20
|
-
return resp;
|
|
56
|
+
});
|
|
57
|
+
}); };
|
|
21
58
|
};
|
|
22
59
|
}
|
|
23
|
-
export
|
|
60
|
+
export var receiveMessageMiddlewareOptions = {
|
|
24
61
|
step: "initialize",
|
|
25
62
|
tags: ["VALIDATE_BODY_MD5"],
|
|
26
63
|
name: "receiveMessageMiddleware",
|
|
27
64
|
override: true,
|
|
28
65
|
};
|
|
29
|
-
export
|
|
30
|
-
applyToStack: (clientStack)
|
|
66
|
+
export var getReceiveMessagePlugin = function (config) { return ({
|
|
67
|
+
applyToStack: function (clientStack) {
|
|
31
68
|
clientStack.add(receiveMessageMiddleware(config), receiveMessageMiddlewareOptions);
|
|
32
69
|
},
|
|
33
|
-
});
|
|
70
|
+
}); };
|
|
@@ -1,39 +1,87 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator, __values } from "tslib";
|
|
1
2
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
export var sendMessageBatchMiddleware = function (options) {
|
|
4
|
+
return function (next) {
|
|
5
|
+
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6
|
+
var resp, output, messageIds, entries, _a, _b, entry, _c, _d, entry, md5, hash, _e, _f, e_1_1;
|
|
7
|
+
var e_2, _g, e_1, _h;
|
|
8
|
+
return __generator(this, function (_j) {
|
|
9
|
+
switch (_j.label) {
|
|
10
|
+
case 0: return [4, next(__assign({}, args))];
|
|
11
|
+
case 1:
|
|
12
|
+
resp = _j.sent();
|
|
13
|
+
output = resp.output;
|
|
14
|
+
messageIds = [];
|
|
15
|
+
entries = {};
|
|
16
|
+
if (output.Successful !== undefined) {
|
|
17
|
+
try {
|
|
18
|
+
for (_a = __values(output.Successful), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
19
|
+
entry = _b.value;
|
|
20
|
+
if (entry.Id !== undefined) {
|
|
21
|
+
entries[entry.Id] = entry;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
26
|
+
finally {
|
|
27
|
+
try {
|
|
28
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
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
|
+
};
|
|
28
76
|
};
|
|
29
|
-
export
|
|
77
|
+
export var sendMessageBatchMiddlewareOptions = {
|
|
30
78
|
step: "initialize",
|
|
31
79
|
tags: ["VALIDATE_BODY_MD5"],
|
|
32
80
|
name: "sendMessageBatchMiddleware",
|
|
33
81
|
override: true,
|
|
34
82
|
};
|
|
35
|
-
export
|
|
36
|
-
applyToStack: (clientStack)
|
|
83
|
+
export var getSendMessageBatchPlugin = function (config) { return ({
|
|
84
|
+
applyToStack: function (clientStack) {
|
|
37
85
|
clientStack.add(sendMessageBatchMiddleware(config), sendMessageBatchMiddlewareOptions);
|
|
38
86
|
},
|
|
39
|
-
});
|
|
87
|
+
}); };
|
package/dist-es/send-message.js
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
2
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export var sendMessageMiddleware = function (options) {
|
|
4
|
+
return function (next) {
|
|
5
|
+
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6
|
+
var resp, output, hash, _a, _b;
|
|
7
|
+
return __generator(this, function (_c) {
|
|
8
|
+
switch (_c.label) {
|
|
9
|
+
case 0: return [4, next(__assign({}, args))];
|
|
10
|
+
case 1:
|
|
11
|
+
resp = _c.sent();
|
|
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
|
+
};
|
|
11
27
|
};
|
|
12
|
-
export
|
|
28
|
+
export var sendMessageMiddlewareOptions = {
|
|
13
29
|
step: "initialize",
|
|
14
30
|
tags: ["VALIDATE_BODY_MD5"],
|
|
15
31
|
name: "sendMessageMiddleware",
|
|
16
32
|
override: true,
|
|
17
33
|
};
|
|
18
|
-
export
|
|
19
|
-
applyToStack: (clientStack)
|
|
34
|
+
export var getSendMessagePlugin = function (config) { return ({
|
|
35
|
+
applyToStack: function (clientStack) {
|
|
20
36
|
clientStack.add(sendMessageMiddleware(config), sendMessageMiddlewareOptions);
|
|
21
37
|
},
|
|
22
|
-
});
|
|
38
|
+
}); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-sqs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.186.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.186.0",
|
|
24
|
+
"@aws-sdk/util-hex-encoding": "3.186.0",
|
|
25
25
|
"tslib": "^2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|