@middy/sts 7.1.2 → 7.1.4

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/README.md CHANGED
@@ -30,10 +30,23 @@
30
30
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/sts">https://middy.js.org/docs/middlewares/sts</a></p>
31
31
  </div>
32
32
 
33
- ## License
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install --save @middy/sts @aws-sdk/client-sts
37
+ ```
38
+
39
+
40
+ ## Documentation and examples
41
+
42
+ For documentation and examples, refer to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org/docs/middlewares/sts).
34
43
 
35
- Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
36
44
 
37
- <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
38
- <img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
39
- </a>
45
+ ## Contributing
46
+
47
+ Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
48
+
49
+
50
+ ## License
51
+
52
+ Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
package/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export interface STSOptions<AwsSTSClient = STSClient>
32
32
  | "disablePrefetch"
33
33
  | "cacheKey"
34
34
  | "cacheExpiry"
35
+ | "cacheKeyExpiry"
35
36
  | "setToContext"
36
37
  > {
37
38
  fetchData?: {
@@ -61,7 +62,7 @@ declare function sts<TOptions extends STSOptions | undefined>(
61
62
  options?: TOptions,
62
63
  ): middy.MiddlewareObj<
63
64
  unknown,
64
- any,
65
+ unknown,
65
66
  Error,
66
67
  Context<TOptions>,
67
68
  Internal<TOptions>
package/index.js CHANGED
@@ -32,10 +32,11 @@ const stsMiddleware = (opts = {}) => {
32
32
  fetchData: structuredClone({ ...defaults.fetchData, ...opts.fetchData }),
33
33
  };
34
34
 
35
+ const fetchDataKeys = Object.keys(options.fetchData);
35
36
  const fetch = (request, cachedValues = {}) => {
36
37
  const values = {};
37
38
 
38
- for (const internalKey of Object.keys(options.fetchData)) {
39
+ for (const internalKey of fetchDataKeys) {
39
40
  if (cachedValues[internalKey]) continue;
40
41
  const assumeRoleOptions = options.fetchData[internalKey];
41
42
  // Date cannot be used here to assign default session name, possibility of collision when > 1 role defined
@@ -76,7 +77,7 @@ const stsMiddleware = (opts = {}) => {
76
77
  Object.assign(request.internal, value);
77
78
 
78
79
  if (options.setToContext) {
79
- const data = await getInternal(Object.keys(options.fetchData), request);
80
+ const data = await getInternal(fetchDataKeys, request);
80
81
  Object.assign(request.context, data);
81
82
  }
82
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/sts",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "description": "STS (Security Token Service) credentials middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -65,7 +65,7 @@
65
65
  "url": "https://github.com/sponsors/willfarrell"
66
66
  },
67
67
  "dependencies": {
68
- "@middy/util": "7.1.2"
68
+ "@middy/util": "7.1.4"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@aws-sdk/client-sts": "^3.0.0"
@@ -77,9 +77,9 @@
77
77
  },
78
78
  "devDependencies": {
79
79
  "@aws-sdk/client-sts": "^3.0.0",
80
- "@middy/core": "7.1.2",
80
+ "@middy/core": "7.1.4",
81
81
  "@types/aws-lambda": "^8.0.0",
82
+ "@types/node": "^22.0.0",
82
83
  "aws-xray-sdk": "^3.3.3"
83
- },
84
- "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
84
+ }
85
85
  }