@middy/dynamodb 7.2.3 → 7.3.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.
Files changed (3) hide show
  1. package/index.d.ts +4 -0
  2. package/index.js +49 -0
  3. package/package.json +3 -6
package/index.d.ts CHANGED
@@ -63,4 +63,8 @@ declare function dynamodbMiddleware<
63
63
  Internal<TOptions>
64
64
  >;
65
65
 
66
+ export declare function dynamodbValidateOptions(
67
+ options?: Record<string, unknown>,
68
+ ): void;
69
+
66
70
  export default dynamodbMiddleware;
package/index.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  getInternal,
12
12
  modifyCache,
13
13
  processCache,
14
+ validateOptions,
14
15
  } from "@middy/util";
15
16
 
16
17
  const defaults = {
@@ -25,6 +26,54 @@ const defaults = {
25
26
  cacheExpiry: -1,
26
27
  setToContext: false,
27
28
  };
29
+
30
+ const optionSchema = {
31
+ type: "object",
32
+ properties: {
33
+ AwsClient: { instanceof: "Function" },
34
+ awsClientOptions: { type: "object" },
35
+ awsClientAssumeRole: { type: "string" },
36
+ awsClientCapture: { instanceof: "Function" },
37
+ fetchData: {
38
+ type: "object",
39
+ additionalProperties: {
40
+ type: "object",
41
+ required: ["TableName", "Key"],
42
+ properties: {
43
+ TableName: { type: "string" },
44
+ Key: { type: "object", additionalProperties: true },
45
+ AttributesToGet: {
46
+ type: "array",
47
+ items: { type: "string" },
48
+ },
49
+ ConsistentRead: { type: "boolean" },
50
+ ReturnConsumedCapacity: {
51
+ type: "string",
52
+ enum: ["INDEXES", "TOTAL", "NONE"],
53
+ },
54
+ ProjectionExpression: { type: "string" },
55
+ ExpressionAttributeNames: {
56
+ type: "object",
57
+ additionalProperties: { type: "string" },
58
+ },
59
+ },
60
+ additionalProperties: true,
61
+ },
62
+ },
63
+ disablePrefetch: { type: "boolean" },
64
+ cacheKey: { type: "string" },
65
+ cacheKeyExpiry: {
66
+ type: "object",
67
+ additionalProperties: { type: "number", minimum: -1 },
68
+ },
69
+ cacheExpiry: { type: "number", minimum: -1 },
70
+ setToContext: { type: "boolean" },
71
+ },
72
+ additionalProperties: false,
73
+ };
74
+
75
+ export const dynamodbValidateOptions = (options) =>
76
+ validateOptions("@middy/dynamodb", optionSchema, options);
28
77
  const dynamodbMiddleware = (opts = {}) => {
29
78
  const options = {
30
79
  ...defaults,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/dynamodb",
3
- "version": "7.2.3",
3
+ "version": "7.3.1",
4
4
  "description": "DynamoDB 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
  },
@@ -75,12 +72,12 @@
75
72
  }
76
73
  },
77
74
  "dependencies": {
78
- "@middy/util": "7.2.3"
75
+ "@middy/util": "7.3.1"
79
76
  },
80
77
  "devDependencies": {
81
78
  "@aws-sdk/client-dynamodb": "^3.0.0",
82
79
  "@aws-sdk/util-dynamodb": "^3.0.0",
83
- "@middy/core": "7.2.3",
80
+ "@middy/core": "7.3.1",
84
81
  "@types/aws-lambda": "^8.0.0",
85
82
  "@types/node": "^22.0.0",
86
83
  "aws-xray-sdk": "^3.3.3"