@middy/sts 7.6.2 → 7.6.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.
Files changed (2) hide show
  1. package/index.js +6 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -2,12 +2,13 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
4
4
  import {
5
+ assignSetToContext,
6
+ buildSetToContextSpec,
5
7
  canPrefetch,
6
8
  catchInvalidSignatureException,
7
9
  createClient,
8
10
  createPrefetchClient,
9
11
  getCache,
10
- getInternal,
11
12
  modifyCache,
12
13
  processCache,
13
14
  validateOptions,
@@ -80,6 +81,7 @@ const stsMiddleware = (opts = {}) => {
80
81
  };
81
82
 
82
83
  const fetchDataKeys = Object.keys(options.fetchData);
84
+ const contextSpec = buildSetToContextSpec(options);
83
85
  const fetch = (request, cachedValues = {}) => {
84
86
  const values = {};
85
87
 
@@ -125,9 +127,9 @@ const stsMiddleware = (opts = {}) => {
125
127
 
126
128
  Object.assign(request.internal, value);
127
129
 
128
- if (options.setToContext) {
129
- const data = await getInternal(fetchDataKeys, request);
130
- Object.assign(request.context, data);
130
+ if (contextSpec) {
131
+ const pending = assignSetToContext(contextSpec, value, request);
132
+ if (pending) await pending;
131
133
  }
132
134
  };
133
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/sts",
3
- "version": "7.6.2",
3
+ "version": "7.6.4",
4
4
  "description": "STS (Security Token Service) credentials middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,7 +62,7 @@
62
62
  "url": "https://github.com/sponsors/willfarrell"
63
63
  },
64
64
  "dependencies": {
65
- "@middy/util": "7.6.2"
65
+ "@middy/util": "7.6.4"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@aws-sdk/client-sts": "^3.0.0"
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@aws-sdk/client-sts": "^3.0.0",
77
- "@middy/core": "7.6.2",
77
+ "@middy/core": "7.6.4",
78
78
  "@types/aws-lambda": "^8.0.0",
79
79
  "@types/node": "^22.0.0",
80
80
  "aws-xray-sdk": "^3.3.3"