@aws-sdk/middleware-recursion-detection 3.972.12 → 3.972.13
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/dist-cjs/index.js +4 -24
- package/dist-es/index.js +1 -2
- package/dist-types/index.d.ts +1 -2
- package/package.json +3 -26
- package/dist-cjs/recursionDetectionMiddleware.browser.js +0 -5
- package/dist-cjs/recursionDetectionMiddleware.js +0 -33
- package/dist-cjs/recursionDetectionMiddleware.native.js +0 -5
- package/dist-es/configuration.js +0 -7
- package/dist-es/getRecursionDetectionPlugin.js +0 -7
- package/dist-es/recursionDetectionMiddleware.browser.js +0 -1
- package/dist-es/recursionDetectionMiddleware.js +0 -29
- package/dist-es/recursionDetectionMiddleware.native.js +0 -1
- package/dist-types/configuration.d.ts +0 -5
- package/dist-types/getRecursionDetectionPlugin.d.ts +0 -5
- package/dist-types/recursionDetectionMiddleware.browser.d.ts +0 -6
- package/dist-types/recursionDetectionMiddleware.d.ts +0 -6
- package/dist-types/recursionDetectionMiddleware.native.d.ts +0 -6
- package/dist-types/ts3.4/configuration.d.ts +0 -3
- package/dist-types/ts3.4/getRecursionDetectionPlugin.d.ts +0 -4
- package/dist-types/ts3.4/index.d.ts +0 -2
- package/dist-types/ts3.4/recursionDetectionMiddleware.browser.d.ts +0 -5
- package/dist-types/ts3.4/recursionDetectionMiddleware.d.ts +0 -5
- package/dist-types/ts3.4/recursionDetectionMiddleware.native.d.ts +0 -5
package/dist-cjs/index.js
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var client = require('@aws-sdk/core/client');
|
|
4
4
|
|
|
5
|
-
const recursionDetectionMiddlewareOptions = {
|
|
6
|
-
step: "build",
|
|
7
|
-
tags: ["RECURSION_DETECTION"],
|
|
8
|
-
name: "recursionDetectionMiddleware",
|
|
9
|
-
override: true,
|
|
10
|
-
priority: "low",
|
|
11
|
-
};
|
|
12
5
|
|
|
13
|
-
const getRecursionDetectionPlugin = (options) => ({
|
|
14
|
-
applyToStack: (clientStack) => {
|
|
15
|
-
clientStack.add(recursionDetectionMiddleware.recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
6
|
|
|
19
|
-
exports.getRecursionDetectionPlugin = getRecursionDetectionPlugin;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(exports, '__proto__', {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
value: recursionDetectionMiddleware['__proto__']
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
Object.keys(recursionDetectionMiddleware).forEach(function (k) {
|
|
28
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = recursionDetectionMiddleware[k];
|
|
29
|
-
});
|
|
7
|
+
exports.getRecursionDetectionPlugin = client.getRecursionDetectionPlugin;
|
|
8
|
+
exports.recursionDetectionMiddleware = client.recursionDetectionMiddleware;
|
|
9
|
+
exports.recursionDetectionMiddlewareOptions = client.recursionDetectionMiddlewareOptions;
|
package/dist-es/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./recursionDetectionMiddleware";
|
|
1
|
+
export { getRecursionDetectionPlugin, recursionDetectionMiddleware, recursionDetectionMiddlewareOptions, } from "@aws-sdk/core/client";
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./recursionDetectionMiddleware";
|
|
1
|
+
export { getRecursionDetectionPlugin, recursionDetectionMiddleware, recursionDetectionMiddlewareOptions, } from "@aws-sdk/core/client";
|
package/package.json
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-recursion-detection",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.13",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-recursion-detection",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
10
|
-
"
|
|
11
|
-
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
12
|
-
"test": "yarn g:vitest run",
|
|
13
|
-
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
|
|
14
|
-
"test:watch": "yarn g:vitest watch",
|
|
15
|
-
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
10
|
+
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
|
|
16
11
|
},
|
|
17
12
|
"main": "./dist-cjs/index.js",
|
|
18
13
|
"module": "./dist-es/index.js",
|
|
@@ -24,22 +19,12 @@
|
|
|
24
19
|
},
|
|
25
20
|
"license": "Apache-2.0",
|
|
26
21
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/
|
|
28
|
-
"@aws/lambda-invoke-store": "^0.2.2",
|
|
29
|
-
"@smithy/core": "^3.24.1",
|
|
30
|
-
"@smithy/types": "^4.14.1",
|
|
22
|
+
"@aws-sdk/core": "^3.974.11",
|
|
31
23
|
"tslib": "^2.6.2"
|
|
32
24
|
},
|
|
33
25
|
"engines": {
|
|
34
26
|
"node": ">=20.0.0"
|
|
35
27
|
},
|
|
36
|
-
"typesVersions": {
|
|
37
|
-
"<4.5": {
|
|
38
|
-
"dist-types/*": [
|
|
39
|
-
"dist-types/ts3.4/*"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
28
|
"files": [
|
|
44
29
|
"dist-*/**"
|
|
45
30
|
],
|
|
@@ -52,15 +37,7 @@
|
|
|
52
37
|
"devDependencies": {
|
|
53
38
|
"@tsconfig/recommended": "1.0.1",
|
|
54
39
|
"concurrently": "7.0.0",
|
|
55
|
-
"downlevel-dts": "0.10.1",
|
|
56
40
|
"premove": "4.0.0",
|
|
57
41
|
"typescript": "~5.8.3"
|
|
58
|
-
},
|
|
59
|
-
"browser": {
|
|
60
|
-
"./dist-es/recursionDetectionMiddleware": "./dist-es/recursionDetectionMiddleware.browser"
|
|
61
|
-
},
|
|
62
|
-
"react-native": {
|
|
63
|
-
"./dist-es/recursionDetectionMiddleware": "./dist-es/recursionDetectionMiddleware.native",
|
|
64
|
-
"./dist-cjs/recursionDetectionMiddleware": "./dist-cjs/recursionDetectionMiddleware.native"
|
|
65
42
|
}
|
|
66
43
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursionDetectionMiddleware = void 0;
|
|
4
|
-
const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|
|
5
|
-
exports.recursionDetectionMiddleware = recursionDetectionMiddleware;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursionDetectionMiddleware = void 0;
|
|
4
|
-
const lambda_invoke_store_1 = require("@aws/lambda-invoke-store");
|
|
5
|
-
const protocols_1 = require("@smithy/core/protocols");
|
|
6
|
-
const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
|
|
7
|
-
const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
|
|
8
|
-
const ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
|
|
9
|
-
const recursionDetectionMiddleware = () => (next) => async (args) => {
|
|
10
|
-
const { request } = args;
|
|
11
|
-
if (!protocols_1.HttpRequest.isInstance(request)) {
|
|
12
|
-
return next(args);
|
|
13
|
-
}
|
|
14
|
-
const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ??
|
|
15
|
-
TRACE_ID_HEADER_NAME;
|
|
16
|
-
if (request.headers.hasOwnProperty(traceIdHeader)) {
|
|
17
|
-
return next(args);
|
|
18
|
-
}
|
|
19
|
-
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
|
20
|
-
const traceIdFromEnv = process.env[ENV_TRACE_ID];
|
|
21
|
-
const invokeStore = await lambda_invoke_store_1.InvokeStore.getInstanceAsync();
|
|
22
|
-
const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
|
|
23
|
-
const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
|
|
24
|
-
const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
|
|
25
|
-
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
|
|
26
|
-
request.headers[TRACE_ID_HEADER_NAME] = traceId;
|
|
27
|
-
}
|
|
28
|
-
return next({
|
|
29
|
-
...args,
|
|
30
|
-
request,
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
exports.recursionDetectionMiddleware = recursionDetectionMiddleware;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursionDetectionMiddleware = void 0;
|
|
4
|
-
const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|
|
5
|
-
exports.recursionDetectionMiddleware = recursionDetectionMiddleware;
|
package/dist-es/configuration.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { recursionDetectionMiddlewareOptions } from "./configuration";
|
|
2
|
-
import { recursionDetectionMiddleware } from "./recursionDetectionMiddleware";
|
|
3
|
-
export const getRecursionDetectionPlugin = (options) => ({
|
|
4
|
-
applyToStack: (clientStack) => {
|
|
5
|
-
clientStack.add(recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
|
|
6
|
-
},
|
|
7
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { InvokeStore } from "@aws/lambda-invoke-store";
|
|
2
|
-
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
-
const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
|
|
4
|
-
const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
|
|
5
|
-
const ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
|
|
6
|
-
export const recursionDetectionMiddleware = () => (next) => async (args) => {
|
|
7
|
-
const { request } = args;
|
|
8
|
-
if (!HttpRequest.isInstance(request)) {
|
|
9
|
-
return next(args);
|
|
10
|
-
}
|
|
11
|
-
const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ??
|
|
12
|
-
TRACE_ID_HEADER_NAME;
|
|
13
|
-
if (request.headers.hasOwnProperty(traceIdHeader)) {
|
|
14
|
-
return next(args);
|
|
15
|
-
}
|
|
16
|
-
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
|
17
|
-
const traceIdFromEnv = process.env[ENV_TRACE_ID];
|
|
18
|
-
const invokeStore = await InvokeStore.getInstanceAsync();
|
|
19
|
-
const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
|
|
20
|
-
const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
|
|
21
|
-
const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
|
|
22
|
-
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
|
|
23
|
-
request.headers[TRACE_ID_HEADER_NAME] = traceId;
|
|
24
|
-
}
|
|
25
|
-
return next({
|
|
26
|
-
...args,
|
|
27
|
-
request,
|
|
28
|
-
});
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|