@middy/appconfig 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
  StartConfigurationSessionCommand,
7
7
  } from "@aws-sdk/client-appconfigdata";
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
  jsonContentTypePattern,
16
17
  jsonSafeParse,
17
18
  modifyCache,
@@ -116,6 +117,7 @@ const appConfigMiddleware = (opts = {}) => {
116
117
  }
117
118
 
118
119
  const fetchDataKeys = Object.keys(options.fetchData);
120
+ const contextSpec = buildSetToContextSpec(options);
119
121
  const fetchRequest = (request, cachedValues = {}) => {
120
122
  const values = {};
121
123
  for (const internalKey of fetchDataKeys) {
@@ -162,9 +164,9 @@ const appConfigMiddleware = (opts = {}) => {
162
164
  }
163
165
  const { value } = processCache(options, fetchRequest, request);
164
166
  Object.assign(request.internal, value);
165
- if (options.setToContext) {
166
- const data = await getInternal(fetchDataKeys, request);
167
- Object.assign(request.context, data);
167
+ if (contextSpec) {
168
+ const pending = assignSetToContext(contextSpec, value, request);
169
+ if (pending) await pending;
168
170
  }
169
171
  };
170
172
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/appconfig",
3
- "version": "7.6.3",
3
+ "version": "7.6.4",
4
4
  "description": "AppConfig middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -68,11 +68,11 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@middy/util": "7.6.3"
71
+ "@middy/util": "7.6.4"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@aws-sdk/client-appconfigdata": "^3.0.0",
75
- "@middy/core": "7.6.3",
75
+ "@middy/core": "7.6.4",
76
76
  "@types/aws-lambda": "^8.0.0",
77
77
  "@types/node": "^22.0.0",
78
78
  "aws-xray-sdk": "^3.3.3"