@aws-sdk/middleware-recursion-detection 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/index.js +29 -24
- 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-recursion-detection
|
|
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-recursion-detection
|
package/dist-es/index.js
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
2
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
|
|
4
|
+
var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
|
|
5
|
+
var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
|
|
6
|
+
export var recursionDetectionMiddleware = function (options) {
|
|
7
|
+
return function (next) {
|
|
8
|
+
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9
|
+
var request, functionName, traceId, nonEmptyString;
|
|
10
|
+
return __generator(this, function (_a) {
|
|
11
|
+
request = args.request;
|
|
12
|
+
if (!HttpRequest.isInstance(request) ||
|
|
13
|
+
options.runtime !== "node" ||
|
|
14
|
+
request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) {
|
|
15
|
+
return [2, next(args)];
|
|
16
|
+
}
|
|
17
|
+
functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
|
18
|
+
traceId = process.env[ENV_TRACE_ID];
|
|
19
|
+
nonEmptyString = function (str) { return typeof str === "string" && str.length > 0; };
|
|
20
|
+
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
|
|
21
|
+
request.headers[TRACE_ID_HEADER_NAME] = traceId;
|
|
22
|
+
}
|
|
23
|
+
return [2, next(__assign(__assign({}, args), { request: request }))];
|
|
24
|
+
});
|
|
25
|
+
}); };
|
|
26
|
+
};
|
|
22
27
|
};
|
|
23
|
-
export
|
|
28
|
+
export var addRecursionDetectionMiddlewareOptions = {
|
|
24
29
|
step: "build",
|
|
25
30
|
tags: ["RECURSION_DETECTION"],
|
|
26
31
|
name: "recursionDetectionMiddleware",
|
|
27
32
|
override: true,
|
|
28
33
|
priority: "low",
|
|
29
34
|
};
|
|
30
|
-
export
|
|
31
|
-
applyToStack: (clientStack)
|
|
35
|
+
export var getRecursionDetectionPlugin = function (options) { return ({
|
|
36
|
+
applyToStack: function (clientStack) {
|
|
32
37
|
clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
|
|
33
38
|
},
|
|
34
|
-
});
|
|
39
|
+
}); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-recursion-detection",
|
|
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/protocol-http": "3.
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
23
|
+
"@aws-sdk/protocol-http": "3.186.0",
|
|
24
|
+
"@aws-sdk/types": "3.186.0",
|
|
25
25
|
"tslib": "^2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|