Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/middleware-recursion-detection

Package Overview
Dependencies
Maintainers
5
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-recursion-detection - npm Package Compare versions

Comparing version 3.178.0 to 3.183.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
**Note:** Version bump only for package @aws-sdk/middleware-recursion-detection
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)

@@ -8,0 +16,0 @@

53

dist-es/index.js

@@ -1,29 +0,24 @@

import { __assign, __awaiter, __generator } from "tslib";
import { HttpRequest } from "@aws-sdk/protocol-http";
var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
export var recursionDetectionMiddleware = function (options) {
return function (next) {
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
var request, functionName, traceId, nonEmptyString;
return __generator(this, function (_a) {
request = args.request;
if (!HttpRequest.isInstance(request) ||
options.runtime !== "node" ||
request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) {
return [2, next(args)];
}
functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
traceId = process.env[ENV_TRACE_ID];
nonEmptyString = function (str) { return typeof str === "string" && str.length > 0; };
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
request.headers[TRACE_ID_HEADER_NAME] = traceId;
}
return [2, next(__assign(__assign({}, args), { request: request }))];
});
}); };
};
const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
const ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
export const recursionDetectionMiddleware = (options) => (next) => async (args) => {
const { request } = args;
if (!HttpRequest.isInstance(request) ||
options.runtime !== "node" ||
request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) {
return next(args);
}
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
const traceId = process.env[ENV_TRACE_ID];
const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
request.headers[TRACE_ID_HEADER_NAME] = traceId;
}
return next({
...args,
request,
});
};
export var addRecursionDetectionMiddlewareOptions = {
export const addRecursionDetectionMiddlewareOptions = {
step: "build",

@@ -35,6 +30,6 @@ tags: ["RECURSION_DETECTION"],

};
export var getRecursionDetectionPlugin = function (options) { return ({
applyToStack: function (clientStack) {
export const getRecursionDetectionPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
},
}); };
});
{
"name": "@aws-sdk/middleware-recursion-detection",
"version": "3.178.0",
"version": "3.183.0",
"scripts": {

@@ -23,4 +23,4 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@aws-sdk/protocol-http": "3.178.0",
"@aws-sdk/types": "3.178.0",
"@aws-sdk/protocol-http": "3.183.0",
"@aws-sdk/types": "3.183.0",
"tslib": "^2.3.1"

@@ -27,0 +27,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc