@middy/ssm 4.6.4 → 4.6.5

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 +7 -3
  2. package/index.js +7 -3
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -39,16 +39,20 @@ const ssmMiddleware = (opts = {})=>{
39
39
  let batchReq = null;
40
40
  let batchInternalKeys = [];
41
41
  let batchFetchKeys = [];
42
+ const namedKeys = [];
42
43
  const internalKeys = Object.keys(options.fetchData);
43
44
  const fetchKeys = Object.values(options.fetchData);
44
- for (const [idx, internalKey] of internalKeys.entries()){
45
+ for (const internalKey of internalKeys){
45
46
  if (cachedValues[internalKey]) continue;
47
+ if (options.fetchData[internalKey].substr(-1) === '/') continue; // Skip path passed in
48
+ namedKeys.push(internalKey);
49
+ }
50
+ for (const [idx, internalKey] of namedKeys.entries()){
46
51
  const fetchKey = options.fetchData[internalKey];
47
- if (fetchKey.substr(-1) === '/') continue; // Skip path passed in
48
52
  batchInternalKeys.push(internalKey);
49
53
  batchFetchKeys.push(fetchKey);
50
54
  // from the first to the batch size skip, unless it's the last entry
51
- if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === internalKeys.length)) {
55
+ if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === namedKeys.length)) {
52
56
  continue;
53
57
  }
54
58
  batchReq = client.send(new _clientssm.GetParametersCommand({
package/index.js CHANGED
@@ -29,16 +29,20 @@ const ssmMiddleware = (opts = {})=>{
29
29
  let batchReq = null;
30
30
  let batchInternalKeys = [];
31
31
  let batchFetchKeys = [];
32
+ const namedKeys = [];
32
33
  const internalKeys = Object.keys(options.fetchData);
33
34
  const fetchKeys = Object.values(options.fetchData);
34
- for (const [idx, internalKey] of internalKeys.entries()){
35
+ for (const internalKey of internalKeys){
35
36
  if (cachedValues[internalKey]) continue;
37
+ if (options.fetchData[internalKey].substr(-1) === '/') continue; // Skip path passed in
38
+ namedKeys.push(internalKey);
39
+ }
40
+ for (const [idx, internalKey] of namedKeys.entries()){
36
41
  const fetchKey = options.fetchData[internalKey];
37
- if (fetchKey.substr(-1) === '/') continue; // Skip path passed in
38
42
  batchInternalKeys.push(internalKey);
39
43
  batchFetchKeys.push(fetchKey);
40
44
  // from the first to the batch size skip, unless it's the last entry
41
- if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === internalKeys.length)) {
45
+ if ((!idx || (idx + 1) % awsRequestLimit !== 0) && !(idx + 1 === namedKeys.length)) {
42
46
  continue;
43
47
  }
44
48
  batchReq = client.send(new GetParametersCommand({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ssm",
3
- "version": "4.6.4",
3
+ "version": "4.6.5",
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.4"
69
+ "@middy/util": "4.6.5"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@aws-sdk/client-ssm": "^3.0.0",
73
- "@middy/core": "4.6.4",
73
+ "@middy/core": "4.6.5",
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": "706ec39ce569407d51007200b995542ad3d7af2b"
78
+ "gitHead": "573d7b0bb243d8c5a9bcb00cf29d031aa7a0c606"
79
79
  }