@middy/secrets-manager 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 +12 -7
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -66,18 +66,21 @@ const secretsManagerMiddleware = (opts = {}) => {
|
|
|
66
66
|
)
|
|
67
67
|
.then((resp) => {
|
|
68
68
|
if (options.cacheExpiry < 0) {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (resp.NextRotationDate) {
|
|
70
|
+
options.cacheKeyExpiry[internalKey] =
|
|
71
|
+
resp.NextRotationDate * 1000;
|
|
72
|
+
}
|
|
71
73
|
} else {
|
|
72
|
-
|
|
74
|
+
const lastChanged =
|
|
73
75
|
Math.max(
|
|
74
76
|
resp.LastRotationDate ?? 0,
|
|
75
77
|
resp.LastChangedDate ?? 0,
|
|
76
78
|
) *
|
|
77
79
|
1000 +
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
options.cacheExpiry;
|
|
81
|
+
options.cacheKeyExpiry[internalKey] = resp.NextRotationDate
|
|
82
|
+
? Math.min(lastChanged, resp.NextRotationDate * 1000)
|
|
83
|
+
: lastChanged;
|
|
81
84
|
}
|
|
82
85
|
})
|
|
83
86
|
: undefined;
|
|
@@ -105,6 +108,7 @@ const secretsManagerMiddleware = (opts = {}) => {
|
|
|
105
108
|
};
|
|
106
109
|
|
|
107
110
|
let client;
|
|
111
|
+
let clientInit;
|
|
108
112
|
if (canPrefetch(options)) {
|
|
109
113
|
client = createPrefetchClient(options);
|
|
110
114
|
processCache(options, fetchRequest);
|
|
@@ -112,7 +116,8 @@ const secretsManagerMiddleware = (opts = {}) => {
|
|
|
112
116
|
|
|
113
117
|
const secretsManagerMiddlewareBefore = async (request) => {
|
|
114
118
|
if (!client) {
|
|
115
|
-
|
|
119
|
+
clientInit ??= createClient(options, request);
|
|
120
|
+
client = await clientInit;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
const { value } = processCache(options, fetchRequest, request);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/secrets-manager",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "Secrets Manager middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"url": "https://github.com/sponsors/willfarrell"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@middy/util": "7.2.
|
|
66
|
+
"@middy/util": "7.2.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@aws-sdk/client-secrets-manager": "^3.0.0"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@aws-sdk/client-secrets-manager": "^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"
|