@aws-sdk/middleware-recursion-detection 3.489.0 → 3.496.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.
Files changed (2) hide show
  1. package/dist-cjs/index.js +64 -36
  2. package/package.json +5 -5
package/dist-cjs/index.js CHANGED
@@ -1,39 +1,67 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRecursionDetectionPlugin = exports.addRecursionDetectionMiddlewareOptions = exports.recursionDetectionMiddleware = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
5
- const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
6
- const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
7
- const ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
8
- const recursionDetectionMiddleware = (options) => (next) => async (args) => {
9
- const { request } = args;
10
- if (!protocol_http_1.HttpRequest.isInstance(request) ||
11
- options.runtime !== "node" ||
12
- request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) {
13
- return next(args);
14
- }
15
- const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
16
- const traceId = process.env[ENV_TRACE_ID];
17
- const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
18
- if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
19
- request.headers[TRACE_ID_HEADER_NAME] = traceId;
20
- }
21
- return next({
22
- ...args,
23
- request,
24
- });
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
25
9
  };
26
- exports.recursionDetectionMiddleware = recursionDetectionMiddleware;
27
- exports.addRecursionDetectionMiddlewareOptions = {
28
- step: "build",
29
- tags: ["RECURSION_DETECTION"],
30
- name: "recursionDetectionMiddleware",
31
- override: true,
32
- priority: "low",
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
33
17
  };
34
- const getRecursionDetectionPlugin = (options) => ({
35
- applyToStack: (clientStack) => {
36
- clientStack.add((0, exports.recursionDetectionMiddleware)(options), exports.addRecursionDetectionMiddlewareOptions);
37
- },
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ addRecursionDetectionMiddlewareOptions: () => addRecursionDetectionMiddlewareOptions,
24
+ getRecursionDetectionPlugin: () => getRecursionDetectionPlugin,
25
+ recursionDetectionMiddleware: () => recursionDetectionMiddleware
38
26
  });
39
- exports.getRecursionDetectionPlugin = getRecursionDetectionPlugin;
27
+ module.exports = __toCommonJS(src_exports);
28
+ var import_protocol_http = require("@smithy/protocol-http");
29
+ var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
30
+ var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
31
+ var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
32
+ var recursionDetectionMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => {
33
+ const { request } = args;
34
+ if (!import_protocol_http.HttpRequest.isInstance(request) || options.runtime !== "node" || request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) {
35
+ return next(args);
36
+ }
37
+ const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
38
+ const traceId = process.env[ENV_TRACE_ID];
39
+ const nonEmptyString = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0, "nonEmptyString");
40
+ if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
41
+ request.headers[TRACE_ID_HEADER_NAME] = traceId;
42
+ }
43
+ return next({
44
+ ...args,
45
+ request
46
+ });
47
+ }, "recursionDetectionMiddleware");
48
+ var addRecursionDetectionMiddlewareOptions = {
49
+ step: "build",
50
+ tags: ["RECURSION_DETECTION"],
51
+ name: "recursionDetectionMiddleware",
52
+ override: true,
53
+ priority: "low"
54
+ };
55
+ var getRecursionDetectionPlugin = /* @__PURE__ */ __name((options) => ({
56
+ applyToStack: (clientStack) => {
57
+ clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
58
+ }
59
+ }), "getRecursionDetectionPlugin");
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+
62
+ 0 && (module.exports = {
63
+ addRecursionDetectionMiddlewareOptions,
64
+ getRecursionDetectionPlugin,
65
+ recursionDetectionMiddleware
66
+ });
67
+
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-recursion-detection",
3
- "version": "3.489.0",
3
+ "version": "3.496.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
- "build:cjs": "tsc -p tsconfig.cjs.json",
6
+ "build:cjs": "node ../../scripts/compilation/inline middleware-recursion-detection",
7
7
  "build:es": "tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
9
9
  "build:types": "tsc -p tsconfig.types.json",
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@aws-sdk/types": "3.489.0",
25
- "@smithy/protocol-http": "^3.0.12",
26
- "@smithy/types": "^2.8.0",
24
+ "@aws-sdk/types": "3.496.0",
25
+ "@smithy/protocol-http": "^3.1.1",
26
+ "@smithy/types": "^2.9.1",
27
27
  "tslib": "^2.5.0"
28
28
  },
29
29
  "engines": {