@middy/ssm 4.6.1 → 4.6.2

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.
Files changed (3) hide show
  1. package/index.cjs +4 -2
  2. package/index.js +4 -2
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -44,9 +44,10 @@ const ssmMiddleware = (opts = {})=>{
44
44
  for (const [idx, internalKey] of internalKeys.entries()){
45
45
  if (cachedValues[internalKey]) continue;
46
46
  const fetchKey = options.fetchData[internalKey];
47
- if (fetchKey.substr(-1) === '/') continue;
47
+ if (fetchKey.substr(-1) === '/') continue; // Skip path passed in
48
48
  batchInternalKeys.push(internalKey);
49
49
  batchFetchKeys.push(fetchKey);
50
+ // from the first to the batch size skip, unless it's the last entry
50
51
  if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === internalKeys.length)) {
51
52
  continue;
52
53
  }
@@ -54,6 +55,7 @@ const ssmMiddleware = (opts = {})=>{
54
55
  Names: batchFetchKeys,
55
56
  WithDecryption: true
56
57
  })).then((resp)=>{
58
+ // Don't sanitize key, mapped to set value in options
57
59
  return Object.assign(...(resp.InvalidParameters ?? []).map((fetchKey)=>{
58
60
  return {
59
61
  [fetchKey]: new Promise(()=>{
@@ -91,7 +93,7 @@ const ssmMiddleware = (opts = {})=>{
91
93
  for(const internalKey in options.fetchData){
92
94
  if (cachedValues[internalKey]) continue;
93
95
  const fetchKey = options.fetchData[internalKey];
94
- if (fetchKey.substr(-1) !== '/') continue;
96
+ if (fetchKey.substr(-1) !== '/') continue; // Skip not path passed in
95
97
  values[internalKey] = fetchPath(fetchKey).catch((e)=>{
96
98
  const value = (0, _util.getCache)(options.cacheKey).value ?? {};
97
99
  value[internalKey] = undefined;
package/index.js CHANGED
@@ -34,9 +34,10 @@ const ssmMiddleware = (opts = {})=>{
34
34
  for (const [idx, internalKey] of internalKeys.entries()){
35
35
  if (cachedValues[internalKey]) continue;
36
36
  const fetchKey = options.fetchData[internalKey];
37
- if (fetchKey.substr(-1) === '/') continue;
37
+ if (fetchKey.substr(-1) === '/') continue; // Skip path passed in
38
38
  batchInternalKeys.push(internalKey);
39
39
  batchFetchKeys.push(fetchKey);
40
+ // from the first to the batch size skip, unless it's the last entry
40
41
  if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === internalKeys.length)) {
41
42
  continue;
42
43
  }
@@ -44,6 +45,7 @@ const ssmMiddleware = (opts = {})=>{
44
45
  Names: batchFetchKeys,
45
46
  WithDecryption: true
46
47
  })).then((resp)=>{
48
+ // Don't sanitize key, mapped to set value in options
47
49
  return Object.assign(...(resp.InvalidParameters ?? []).map((fetchKey)=>{
48
50
  return {
49
51
  [fetchKey]: new Promise(()=>{
@@ -81,7 +83,7 @@ const ssmMiddleware = (opts = {})=>{
81
83
  for(const internalKey in options.fetchData){
82
84
  if (cachedValues[internalKey]) continue;
83
85
  const fetchKey = options.fetchData[internalKey];
84
- if (fetchKey.substr(-1) !== '/') continue;
86
+ if (fetchKey.substr(-1) !== '/') continue; // Skip not path passed in
85
87
  values[internalKey] = fetchPath(fetchKey).catch((e)=>{
86
88
  const value = getCache(options.cacheKey).value ?? {};
87
89
  value[internalKey] = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ssm",
3
- "version": "4.6.1",
3
+ "version": "4.6.2",
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.6.1"
69
+ "@middy/util": "4.6.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@aws-sdk/client-ssm": "^3.0.0",
73
- "@middy/core": "4.6.1",
73
+ "@middy/core": "4.6.2",
74
74
  "@types/aws-lambda": "^8.10.101",
75
75
  "aws-xray-sdk": "^3.3.3",
76
76
  "type-fest": "^4.0.0"
77
77
  },
78
- "gitHead": "253ed0e4ca95623decbade03938a07d837a1eba2"
78
+ "gitHead": "8b03a01abf5a9c08231ec5ced775e87f8be8f67d"
79
79
  }