@middy/ssm 4.3.1 → 4.4.1
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.cjs +10 -9
- package/index.js +3 -4
- package/package.json +4 -4
package/index.cjs
CHANGED
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(module, "exports", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _util = require("@middy/util");
|
|
10
|
-
const
|
|
12
|
+
const _clientssm = require("@aws-sdk/client-ssm");
|
|
11
13
|
const awsRequestLimit = 10;
|
|
12
14
|
const defaults = {
|
|
13
|
-
AwsClient:
|
|
15
|
+
AwsClient: _clientssm.SSMClient,
|
|
14
16
|
awsClientOptions: {},
|
|
15
17
|
awsClientAssumeRole: undefined,
|
|
16
18
|
awsClientCapture: undefined,
|
|
@@ -47,7 +49,7 @@ const ssmMiddleware = (opts = {})=>{
|
|
|
47
49
|
if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === internalKeys.length)) {
|
|
48
50
|
continue;
|
|
49
51
|
}
|
|
50
|
-
batchReq = client.send(new
|
|
52
|
+
batchReq = client.send(new _clientssm.GetParametersCommand({
|
|
51
53
|
Names: batchFetchKeys,
|
|
52
54
|
WithDecryption: true
|
|
53
55
|
})).then((resp)=>{
|
|
@@ -99,7 +101,7 @@ const ssmMiddleware = (opts = {})=>{
|
|
|
99
101
|
return values;
|
|
100
102
|
};
|
|
101
103
|
const fetchPath = (path, nextToken, values = {})=>{
|
|
102
|
-
return client.send(new
|
|
104
|
+
return client.send(new _clientssm.GetParametersByPathCommand({
|
|
103
105
|
Path: path,
|
|
104
106
|
NextToken: nextToken,
|
|
105
107
|
Recursive: true,
|
|
@@ -120,22 +122,21 @@ const ssmMiddleware = (opts = {})=>{
|
|
|
120
122
|
}
|
|
121
123
|
return (0, _util.jsonSafeParse)(param.Value);
|
|
122
124
|
};
|
|
123
|
-
let
|
|
125
|
+
let client;
|
|
124
126
|
if ((0, _util.canPrefetch)(options)) {
|
|
125
127
|
client = (0, _util.createPrefetchClient)(options);
|
|
126
|
-
|
|
128
|
+
(0, _util.processCache)(options, fetch);
|
|
127
129
|
}
|
|
128
130
|
const ssmMiddlewareBefore = async (request)=>{
|
|
129
131
|
if (!client) {
|
|
130
132
|
client = await (0, _util.createClient)(options, request);
|
|
131
133
|
}
|
|
132
|
-
const { value } =
|
|
134
|
+
const { value } = (0, _util.processCache)(options, fetch, request);
|
|
133
135
|
Object.assign(request.internal, value);
|
|
134
136
|
if (options.setToContext) {
|
|
135
137
|
const data = await (0, _util.getInternal)(Object.keys(options.fetchData), request);
|
|
136
138
|
Object.assign(request.context, data);
|
|
137
139
|
}
|
|
138
|
-
prefetch = null;
|
|
139
140
|
};
|
|
140
141
|
return {
|
|
141
142
|
before: ssmMiddlewareBefore
|
package/index.js
CHANGED
|
@@ -112,22 +112,21 @@ const ssmMiddleware = (opts = {})=>{
|
|
|
112
112
|
}
|
|
113
113
|
return jsonSafeParse(param.Value);
|
|
114
114
|
};
|
|
115
|
-
let
|
|
115
|
+
let client;
|
|
116
116
|
if (canPrefetch(options)) {
|
|
117
117
|
client = createPrefetchClient(options);
|
|
118
|
-
|
|
118
|
+
processCache(options, fetch);
|
|
119
119
|
}
|
|
120
120
|
const ssmMiddlewareBefore = async (request)=>{
|
|
121
121
|
if (!client) {
|
|
122
122
|
client = await createClient(options, request);
|
|
123
123
|
}
|
|
124
|
-
const { value } =
|
|
124
|
+
const { value } = processCache(options, fetch, request);
|
|
125
125
|
Object.assign(request.internal, value);
|
|
126
126
|
if (options.setToContext) {
|
|
127
127
|
const data = await getInternal(Object.keys(options.fetchData), request);
|
|
128
128
|
Object.assign(request.context, data);
|
|
129
129
|
}
|
|
130
|
-
prefetch = null;
|
|
131
130
|
};
|
|
132
131
|
return {
|
|
133
132
|
before: ssmMiddlewareBefore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ssm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "SSM (EC2 Systems Manager) parameters middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"url": "https://github.com/sponsors/willfarrell"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@middy/util": "4.
|
|
69
|
+
"@middy/util": "4.4.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@aws-sdk/client-ssm": "^3.0.0",
|
|
73
|
-
"@middy/core": "4.
|
|
73
|
+
"@middy/core": "4.4.1",
|
|
74
74
|
"@types/aws-lambda": "^8.10.101",
|
|
75
75
|
"aws-xray-sdk": "^3.3.3",
|
|
76
76
|
"type-fest": "^3.0.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "51e5c1f83483a60d9e40f5db59b03af56d2ee710"
|
|
79
79
|
}
|