@middy/ssm 7.0.2 → 7.0.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/README.md +2 -2
- package/index.d.ts +2 -0
- package/index.js +10 -4
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://github.com/middyjs/middy/actions/workflows/test-unit.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-unit.yml/badge.svg" alt="GitHub Actions unit test status"></a>
|
|
7
7
|
<a href="https://github.com/middyjs/middy/actions/workflows/test-dast.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-dast.yml/badge.svg" alt="GitHub Actions dast test status"></a>
|
|
8
|
-
<a href="https://github.com/middyjs/middy/actions/workflows/test-perf.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-
|
|
8
|
+
<a href="https://github.com/middyjs/middy/actions/workflows/test-perf.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-perf.yml/badge.svg" alt="GitHub Actions perf test status"></a>
|
|
9
9
|
<a href="https://github.com/middyjs/middy/actions/workflows/test-sast.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-sast.yml/badge.svg" alt="GitHub Actions SAST test status"></a>
|
|
10
10
|
<a href="https://github.com/middyjs/middy/actions/workflows/test-lint.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-lint.yml/badge.svg" alt="GitHub Actions lint test status"></a>
|
|
11
11
|
<br/>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
## License
|
|
34
34
|
|
|
35
|
-
Licensed under [MIT License](LICENSE). Copyright (c) 2017-
|
|
35
|
+
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
|
|
36
36
|
|
|
37
37
|
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
|
|
38
38
|
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { SSMClient, SSMClientConfig } from "@aws-sdk/client-ssm";
|
|
2
4
|
import type middy from "@middy/core";
|
|
3
5
|
import type { Options as MiddyOptions } from "@middy/util";
|
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import {
|
|
2
4
|
GetParametersByPathCommand,
|
|
3
5
|
GetParametersCommand,
|
|
@@ -50,7 +52,7 @@ const ssmMiddleware = (opts = {}) => {
|
|
|
50
52
|
const fetchKeys = Object.values(options.fetchData);
|
|
51
53
|
for (const internalKey of internalKeys) {
|
|
52
54
|
if (cachedValues[internalKey]) continue;
|
|
53
|
-
if (options.fetchData[internalKey].
|
|
55
|
+
if (options.fetchData[internalKey].endsWith("/")) continue; // Skip path passed in
|
|
54
56
|
namedKeys.push(internalKey);
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -69,12 +71,14 @@ const ssmMiddleware = (opts = {}) => {
|
|
|
69
71
|
Names: Array.from(batchKeys.values()),
|
|
70
72
|
WithDecryption: true,
|
|
71
73
|
});
|
|
74
|
+
const currentBatchInternalKeys = Array.from(batchKeys.keys());
|
|
72
75
|
batchReq = client
|
|
73
76
|
.send(command)
|
|
74
77
|
.catch((e) => catchInvalidSignatureException(e, client, command))
|
|
75
78
|
.then((resp) => {
|
|
76
79
|
// Don't sanitize key, mapped to set value in options
|
|
77
80
|
return Object.assign(
|
|
81
|
+
{},
|
|
78
82
|
...(resp.InvalidParameters ?? []).map((fetchKey) => {
|
|
79
83
|
return {
|
|
80
84
|
[fetchKey]: new Promise(() => {
|
|
@@ -95,7 +99,9 @@ const ssmMiddleware = (opts = {}) => {
|
|
|
95
99
|
})
|
|
96
100
|
.catch((e) => {
|
|
97
101
|
const value = getCache(options.cacheKey).value ?? {};
|
|
98
|
-
|
|
102
|
+
for (const key of currentBatchInternalKeys) {
|
|
103
|
+
value[key] = undefined;
|
|
104
|
+
}
|
|
99
105
|
modifyCache(options.cacheKey, value);
|
|
100
106
|
throw e;
|
|
101
107
|
});
|
|
@@ -121,10 +127,10 @@ const ssmMiddleware = (opts = {}) => {
|
|
|
121
127
|
|
|
122
128
|
const fetchByPathRequest = (request, cachedValues = {}) => {
|
|
123
129
|
const values = {};
|
|
124
|
-
for (const internalKey
|
|
130
|
+
for (const internalKey of Object.keys(options.fetchData)) {
|
|
125
131
|
if (cachedValues[internalKey]) continue;
|
|
126
132
|
const fetchKey = options.fetchData[internalKey];
|
|
127
|
-
if (fetchKey.
|
|
133
|
+
if (!fetchKey.endsWith("/")) continue; // Skip not path passed in
|
|
128
134
|
values[internalKey] = fetchPathRequest(fetchKey).catch((e) => {
|
|
129
135
|
const value = getCache(options.cacheKey).value ?? {};
|
|
130
136
|
value[internalKey] = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ssm",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "SSM (EC2 Systems Manager) parameters middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"module": "./index.js",
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"import": {
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"url": "https://github.com/sponsors/willfarrell"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
|
-
"@middy/util": "7.0.
|
|
68
|
+
"@middy/util": "7.0.3"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"@aws-sdk/client-ssm": "^3.0.0"
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@aws-sdk/client-ssm": "^3.0.0",
|
|
79
|
-
"@middy/core": "7.0.
|
|
80
|
+
"@middy/core": "7.0.3",
|
|
80
81
|
"@types/aws-lambda": "^8.10.101",
|
|
81
82
|
"aws-xray-sdk": "^3.3.3"
|
|
82
83
|
},
|