@middy/appconfig 7.2.2 → 7.3.0
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.d.ts +4 -0
- package/index.js +11 -2
- package/package.json +3 -6
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,15 +6,18 @@ import {
|
|
|
6
6
|
StartConfigurationSessionCommand,
|
|
7
7
|
} from "@aws-sdk/client-appconfigdata";
|
|
8
8
|
import {
|
|
9
|
+
awsClientOptionSchema,
|
|
9
10
|
canPrefetch,
|
|
10
11
|
catchInvalidSignatureException,
|
|
11
12
|
createClient,
|
|
12
13
|
createPrefetchClient,
|
|
13
14
|
getCache,
|
|
14
15
|
getInternal,
|
|
16
|
+
jsonContentTypePattern,
|
|
15
17
|
jsonSafeParse,
|
|
16
18
|
modifyCache,
|
|
17
19
|
processCache,
|
|
20
|
+
validateOptions,
|
|
18
21
|
} from "@middy/util";
|
|
19
22
|
|
|
20
23
|
const defaults = {
|
|
@@ -29,7 +32,11 @@ const defaults = {
|
|
|
29
32
|
cacheExpiry: -1,
|
|
30
33
|
setToContext: false,
|
|
31
34
|
};
|
|
32
|
-
|
|
35
|
+
|
|
36
|
+
const optionSchema = { ...awsClientOptionSchema };
|
|
37
|
+
|
|
38
|
+
export const appConfigValidateOptions = (options) =>
|
|
39
|
+
validateOptions("@middy/appconfig", optionSchema, options);
|
|
33
40
|
const appConfigMiddleware = (opts = {}) => {
|
|
34
41
|
const options = {
|
|
35
42
|
...defaults,
|
|
@@ -103,13 +110,15 @@ const appConfigMiddleware = (opts = {}) => {
|
|
|
103
110
|
return values;
|
|
104
111
|
};
|
|
105
112
|
let client;
|
|
113
|
+
let clientInit;
|
|
106
114
|
if (canPrefetch(options)) {
|
|
107
115
|
client = createPrefetchClient(options);
|
|
108
116
|
processCache(options, fetchRequest);
|
|
109
117
|
}
|
|
110
118
|
const appConfigMiddlewareBefore = async (request) => {
|
|
111
119
|
if (!client) {
|
|
112
|
-
|
|
120
|
+
clientInit ??= createClient(options, request);
|
|
121
|
+
client = await clientInit;
|
|
113
122
|
}
|
|
114
123
|
const { value } = processCache(options, fetchRequest, request);
|
|
115
124
|
Object.assign(request.internal, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/appconfig",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "AppConfig middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"import": {
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"default": "./index.js"
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -71,11 +68,11 @@
|
|
|
71
68
|
}
|
|
72
69
|
},
|
|
73
70
|
"dependencies": {
|
|
74
|
-
"@middy/util": "7.
|
|
71
|
+
"@middy/util": "7.3.0"
|
|
75
72
|
},
|
|
76
73
|
"devDependencies": {
|
|
77
74
|
"@aws-sdk/client-appconfigdata": "^3.0.0",
|
|
78
|
-
"@middy/core": "7.
|
|
75
|
+
"@middy/core": "7.3.0",
|
|
79
76
|
"@types/aws-lambda": "^8.0.0",
|
|
80
77
|
"@types/node": "^22.0.0",
|
|
81
78
|
"aws-xray-sdk": "^3.3.3"
|