@middy/ssm 7.6.3 → 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
@@ -6,12 +6,13 @@ import {
6
6
  SSMClient,
7
7
  } from "@aws-sdk/client-ssm";
8
8
  import {
9
+ assignSetToContext,
10
+ buildSetToContextSpec,
9
11
  canPrefetch,
10
12
  catchInvalidSignatureException,
11
13
  createClient,
12
14
  createPrefetchClient,
13
15
  getCache,
14
- getInternal,
15
16
  jsonSafeParse,
16
17
  modifyCache,
17
18
  processCache,
@@ -68,6 +69,7 @@ const ssmMiddleware = (opts = {}) => {
68
69
 
69
70
  const fetchDataKeys = Object.keys(options.fetchData);
70
71
  const fetchDataValues = Object.values(options.fetchData);
72
+ const contextSpec = buildSetToContextSpec(options);
71
73
  const fetchRequest = (request, cachedValues) => {
72
74
  const single = fetchSingleRequest(request, cachedValues);
73
75
  const path = fetchByPathRequest(request, cachedValues);
@@ -215,9 +217,9 @@ const ssmMiddleware = (opts = {}) => {
215
217
 
216
218
  Object.assign(request.internal, value);
217
219
 
218
- if (options.setToContext) {
219
- const data = await getInternal(fetchDataKeys, request);
220
- Object.assign(request.context, data);
220
+ if (contextSpec) {
221
+ const pending = assignSetToContext(contextSpec, value, request);
222
+ if (pending) await pending;
221
223
  }
222
224
  };
223
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ssm",
3
- "version": "7.6.3",
3
+ "version": "7.6.4",
4
4
  "description": "SSM (EC2 Systems Manager) parameters 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.3"
65
+ "@middy/util": "7.6.4"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@aws-sdk/client-ssm": "^3.0.0"
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@aws-sdk/client-ssm": "^3.0.0",
77
- "@middy/core": "7.6.3",
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"