@middy/ssm 7.2.3 → 7.3.0

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.d.ts +4 -0
  2. package/index.js +11 -1
  3. package/package.json +3 -6
package/index.d.ts CHANGED
@@ -46,4 +46,8 @@ declare function ssm<TOptions extends SSMOptions>(
46
46
  Internal<TOptions>
47
47
  >;
48
48
 
49
+ export declare function ssmValidateOptions(
50
+ options?: Record<string, unknown>,
51
+ ): void;
52
+
49
53
  export default ssm;
package/index.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  SSMClient,
7
7
  } from "@aws-sdk/client-ssm";
8
8
  import {
9
+ awsClientOptionSchema,
9
10
  canPrefetch,
10
11
  catchInvalidSignatureException,
11
12
  createClient,
@@ -16,6 +17,7 @@ import {
16
17
  modifyCache,
17
18
  processCache,
18
19
  sanitizeKey,
20
+ validateOptions,
19
21
  } from "@middy/util";
20
22
 
21
23
  const defaults = {
@@ -32,6 +34,14 @@ const defaults = {
32
34
  awsRequestLimit: 10,
33
35
  };
34
36
 
37
+ const optionSchema = {
38
+ ...awsClientOptionSchema,
39
+ awsRequestLimit: (v) => Number.isInteger(v) && v >= 1,
40
+ };
41
+
42
+ export const ssmValidateOptions = (options) =>
43
+ validateOptions("@middy/ssm", optionSchema, options);
44
+
35
45
  const ssmMiddleware = (opts = {}) => {
36
46
  const options = { ...defaults, ...opts };
37
47
 
@@ -150,7 +160,7 @@ const ssmMiddleware = (opts = {}) => {
150
160
  .send(command)
151
161
  .catch((e) => catchInvalidSignatureException(e, client, command))
152
162
  .then((resp) => {
153
- for (const param of resp.Parameters) {
163
+ for (const param of resp.Parameters ?? []) {
154
164
  values[sanitizeKey(param.Name.replace(path, ""))] = parseValue(param);
155
165
  }
156
166
  if (resp.NextToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ssm",
3
- "version": "7.2.3",
3
+ "version": "7.3.0",
4
4
  "description": "SSM (EC2 Systems Manager) parameters middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,9 +17,6 @@
17
17
  "import": {
18
18
  "types": "./index.d.ts",
19
19
  "default": "./index.js"
20
- },
21
- "require": {
22
- "default": "./index.js"
23
20
  }
24
21
  }
25
22
  },
@@ -65,7 +62,7 @@
65
62
  "url": "https://github.com/sponsors/willfarrell"
66
63
  },
67
64
  "dependencies": {
68
- "@middy/util": "7.2.3"
65
+ "@middy/util": "7.3.0"
69
66
  },
70
67
  "peerDependencies": {
71
68
  "@aws-sdk/client-ssm": "^3.0.0"
@@ -77,7 +74,7 @@
77
74
  },
78
75
  "devDependencies": {
79
76
  "@aws-sdk/client-ssm": "^3.0.0",
80
- "@middy/core": "7.2.3",
77
+ "@middy/core": "7.3.0",
81
78
  "@types/aws-lambda": "^8.0.0",
82
79
  "@types/node": "^22.0.0",
83
80
  "aws-xray-sdk": "^3.3.3"