@xube/kit-aws-hooks-infrastructure 0.0.41 → 0.0.43

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.
@@ -8,6 +8,7 @@ const kit_log_1 = require("@xube/kit-log");
8
8
  const aws_cdk_lib_1 = require("aws-cdk-lib");
9
9
  const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
10
10
  const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb");
11
+ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
11
12
  const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
12
13
  const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
13
14
  const aws_lambda_nodejs_1 = require("aws-cdk-lib/aws-lambda-nodejs");
@@ -110,6 +111,11 @@ class WebhookManagement extends constructs_1.Construct {
110
111
  [kit_aws_hooks_1.WEBHOOK_TABLE_INVERTED_INDEX_NAME_ENV_VAR]: invertedIndexName,
111
112
  },
112
113
  });
114
+ this.table.grantReadData(this.handleStreams);
115
+ this.handleStreams.addToRolePolicy(new aws_iam_1.PolicyStatement({
116
+ actions: ["dynamodb:Query"],
117
+ resources: [this.table.tableArn + "*"],
118
+ }));
113
119
  for (const stream of props.streams) {
114
120
  this.handleStreams.addEventSource(new aws_lambda_event_sources_1.DynamoEventSource(stream, {
115
121
  startingPosition: aws_lambda_1.StartingPosition.TRIM_HORIZON,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-hooks-infrastructure",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
19
19
  "devDependencies": {
20
- "@xube/kit-build": "^0.0.41"
20
+ "@xube/kit-build": "^0.0.43"
21
21
  },
22
22
  "dependencies": {
23
- "@xube/kit-aws": "^0.0.41",
24
- "@xube/kit-aws-hooks": "^0.0.41",
25
- "@xube/kit-aws-infrastructure": "^0.0.41",
26
- "@xube/kit-constants": "^0.0.41",
27
- "@xube/kit-log": "^0.0.41",
23
+ "@xube/kit-aws": "^0.0.43",
24
+ "@xube/kit-aws-hooks": "^0.0.43",
25
+ "@xube/kit-aws-infrastructure": "^0.0.43",
26
+ "@xube/kit-constants": "^0.0.43",
27
+ "@xube/kit-log": "^0.0.43",
28
28
  "aws-cdk-lib": "^2.100.0",
29
29
  "aws-lambda": "^1.0.7",
30
30
  "constructs": "^10.3.0"
@@ -15,6 +15,7 @@ import {
15
15
  } from "aws-cdk-lib/aws-apigateway";
16
16
  import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
17
17
  import { AttributeType, ITable, Table } from "aws-cdk-lib/aws-dynamodb";
18
+ import { PolicyStatement } from "aws-cdk-lib/aws-iam";
18
19
  import { HttpMethod, StartingPosition } from "aws-cdk-lib/aws-lambda";
19
20
  import { DynamoEventSource } from "aws-cdk-lib/aws-lambda-event-sources";
20
21
  import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
@@ -182,6 +183,14 @@ export class WebhookManagement extends Construct {
182
183
  },
183
184
  });
184
185
 
186
+ this.table.grantReadData(this.handleStreams);
187
+ this.handleStreams.addToRolePolicy(
188
+ new PolicyStatement({
189
+ actions: ["dynamodb:Query"],
190
+ resources: [this.table.tableArn + "*"],
191
+ })
192
+ );
193
+
185
194
  for (const stream of props.streams) {
186
195
  this.handleStreams.addEventSource(
187
196
  new DynamoEventSource(stream, {