@middy/appconfig 7.2.1 → 7.2.3
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/index.js +4 -2
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createPrefetchClient,
|
|
13
13
|
getCache,
|
|
14
14
|
getInternal,
|
|
15
|
+
jsonContentTypePattern,
|
|
15
16
|
jsonSafeParse,
|
|
16
17
|
modifyCache,
|
|
17
18
|
processCache,
|
|
@@ -29,7 +30,6 @@ const defaults = {
|
|
|
29
30
|
cacheExpiry: -1,
|
|
30
31
|
setToContext: false,
|
|
31
32
|
};
|
|
32
|
-
const jsonContentTypePattern = /^application\/([a-z0-9.+-]+\+)?json(;|$)/i;
|
|
33
33
|
const appConfigMiddleware = (opts = {}) => {
|
|
34
34
|
const options = {
|
|
35
35
|
...defaults,
|
|
@@ -103,13 +103,15 @@ const appConfigMiddleware = (opts = {}) => {
|
|
|
103
103
|
return values;
|
|
104
104
|
};
|
|
105
105
|
let client;
|
|
106
|
+
let clientInit;
|
|
106
107
|
if (canPrefetch(options)) {
|
|
107
108
|
client = createPrefetchClient(options);
|
|
108
109
|
processCache(options, fetchRequest);
|
|
109
110
|
}
|
|
110
111
|
const appConfigMiddlewareBefore = async (request) => {
|
|
111
112
|
if (!client) {
|
|
112
|
-
|
|
113
|
+
clientInit ??= createClient(options, request);
|
|
114
|
+
client = await clientInit;
|
|
113
115
|
}
|
|
114
116
|
const { value } = processCache(options, fetchRequest, request);
|
|
115
117
|
Object.assign(request.internal, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/appconfig",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "AppConfig middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@middy/util": "7.2.
|
|
74
|
+
"@middy/util": "7.2.3"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@aws-sdk/client-appconfigdata": "^3.0.0",
|
|
78
|
-
"@middy/core": "7.2.
|
|
78
|
+
"@middy/core": "7.2.3",
|
|
79
79
|
"@types/aws-lambda": "^8.0.0",
|
|
80
80
|
"@types/node": "^22.0.0",
|
|
81
81
|
"aws-xray-sdk": "^3.3.3"
|