@xube/kit-aws-hooks-infrastructure 0.0.31 → 0.0.33

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.
@@ -1,13 +1,12 @@
1
1
  import { CorsOptions, IAuthorizer, IDomainName, RestApi } from "aws-cdk-lib/aws-apigateway";
2
2
  import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
3
- import { ITable } from "aws-cdk-lib/aws-dynamodb";
3
+ import { Table } from "aws-cdk-lib/aws-dynamodb";
4
4
  import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
5
5
  import { Construct } from "constructs";
6
6
  export declare const ADD_WEBHOOK_ENDPOINTS_FUNCTION_NAME = "add-webhook-endpoints";
7
7
  export declare const REMOVE_WEBHOOK_ENDPOINTS_FUNCTION_NAME = "remove-webhook-endpoints";
8
8
  export declare const GET_WEBHOOK_ENDPOINTS_FUNCTION_NAME = "get-webhook-endpoints";
9
9
  export interface WebhookManagementProps {
10
- table?: ITable;
11
10
  name?: string;
12
11
  domainName?: IDomainName;
13
12
  certificate?: ICertificate;
@@ -17,7 +16,7 @@ export interface WebhookManagementProps {
17
16
  corsOptions?: CorsOptions;
18
17
  }
19
18
  export declare class WebhookManagement extends Construct {
20
- table: ITable;
19
+ table: Table;
21
20
  addWebhookEndpoints: NodejsFunction;
22
21
  removeWebhookEndpoint: NodejsFunction;
23
22
  getWebhookEndpoints: NodejsFunction;
@@ -21,19 +21,28 @@ class WebhookManagement extends constructs_1.Construct {
21
21
  webhookAPI;
22
22
  constructor(scope, id, props) {
23
23
  super(scope, id);
24
- this.table =
25
- props.table ??
26
- new aws_dynamodb_1.Table(scope, id + "-table", {
27
- tableName: (props.name ?? `webhook-management`) + "-table",
28
- partitionKey: {
29
- name: kit_aws_2.PARTITION_KEY,
30
- type: aws_dynamodb_1.AttributeType.STRING,
31
- },
32
- sortKey: {
33
- name: kit_aws_1.SORT_KEY,
34
- type: aws_dynamodb_1.AttributeType.STRING,
35
- },
36
- });
24
+ this.table = new aws_dynamodb_1.Table(scope, id + "-table", {
25
+ tableName: (props.name ?? `webhook-management`) + "-table",
26
+ partitionKey: {
27
+ name: kit_aws_2.PARTITION_KEY,
28
+ type: aws_dynamodb_1.AttributeType.STRING,
29
+ },
30
+ sortKey: {
31
+ name: kit_aws_1.SORT_KEY,
32
+ type: aws_dynamodb_1.AttributeType.STRING,
33
+ },
34
+ });
35
+ this.table.addGlobalSecondaryIndex({
36
+ indexName: (props.name ?? `webhook-management`) + "-inverted-table",
37
+ partitionKey: {
38
+ name: kit_aws_1.SORT_KEY,
39
+ type: aws_dynamodb_1.AttributeType.STRING,
40
+ },
41
+ sortKey: {
42
+ name: kit_aws_2.PARTITION_KEY,
43
+ type: aws_dynamodb_1.AttributeType.STRING,
44
+ },
45
+ });
37
46
  kit_log_1.XubeLog.getInstance().log(__dirname);
38
47
  kit_log_1.XubeLog.getInstance().log((0, path_1.join)(__dirname, "functions", exports.ADD_WEBHOOK_ENDPOINTS_FUNCTION_NAME + ".ts"));
39
48
  this.addWebhookEndpoints = new aws_lambda_nodejs_1.NodejsFunction(this, id + "-add-hooks-function", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-hooks-infrastructure",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
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.31"
20
+ "@xube/kit-build": "^0.0.33"
21
21
  },
22
22
  "dependencies": {
23
- "@xube/kit-aws": "^0.0.31",
24
- "@xube/kit-aws-hooks": "^0.0.31",
25
- "@xube/kit-aws-infrastructure": "^0.0.31",
26
- "@xube/kit-constants": "^0.0.31",
27
- "@xube/kit-log": "^0.0.31",
23
+ "@xube/kit-aws": "^0.0.33",
24
+ "@xube/kit-aws-hooks": "^0.0.33",
25
+ "@xube/kit-aws-infrastructure": "^0.0.33",
26
+ "@xube/kit-constants": "^0.0.33",
27
+ "@xube/kit-log": "^0.0.33",
28
28
  "aws-cdk-lib": "^2.100.0",
29
29
  "aws-lambda": "^1.0.7",
30
30
  "constructs": "^10.3.0"
@@ -22,7 +22,6 @@ export const REMOVE_WEBHOOK_ENDPOINTS_FUNCTION_NAME =
22
22
  export const GET_WEBHOOK_ENDPOINTS_FUNCTION_NAME = "get-webhook-endpoints";
23
23
 
24
24
  export interface WebhookManagementProps {
25
- table?: ITable;
26
25
  name?: string;
27
26
  domainName?: IDomainName;
28
27
  certificate?: ICertificate;
@@ -33,7 +32,7 @@ export interface WebhookManagementProps {
33
32
  }
34
33
 
35
34
  export class WebhookManagement extends Construct {
36
- table: ITable;
35
+ table: Table;
37
36
  addWebhookEndpoints: NodejsFunction;
38
37
  removeWebhookEndpoint: NodejsFunction;
39
38
  getWebhookEndpoints: NodejsFunction;
@@ -43,19 +42,29 @@ export class WebhookManagement extends Construct {
43
42
  constructor(scope: Construct, id: string, props: WebhookManagementProps) {
44
43
  super(scope, id);
45
44
 
46
- this.table =
47
- props.table ??
48
- new Table(scope, id + "-table", {
49
- tableName: (props.name ?? `webhook-management`) + "-table",
50
- partitionKey: {
51
- name: PARTITION_KEY,
52
- type: AttributeType.STRING,
53
- },
54
- sortKey: {
55
- name: SORT_KEY,
56
- type: AttributeType.STRING,
57
- },
58
- });
45
+ this.table = new Table(scope, id + "-table", {
46
+ tableName: (props.name ?? `webhook-management`) + "-table",
47
+ partitionKey: {
48
+ name: PARTITION_KEY,
49
+ type: AttributeType.STRING,
50
+ },
51
+ sortKey: {
52
+ name: SORT_KEY,
53
+ type: AttributeType.STRING,
54
+ },
55
+ });
56
+
57
+ this.table.addGlobalSecondaryIndex({
58
+ indexName: (props.name ?? `webhook-management`) + "-inverted-table",
59
+ partitionKey: {
60
+ name: SORT_KEY,
61
+ type: AttributeType.STRING,
62
+ },
63
+ sortKey: {
64
+ name: PARTITION_KEY,
65
+ type: AttributeType.STRING,
66
+ },
67
+ });
59
68
 
60
69
  XubeLog.getInstance().log(__dirname);
61
70
  XubeLog.getInstance().log(
@@ -135,7 +144,7 @@ export class WebhookManagement extends Construct {
135
144
  this.addWebhookEndpoints
136
145
  );
137
146
 
138
- this.table.grantWriteData(this.removeWebhookEndpoint)
147
+ this.table.grantWriteData(this.removeWebhookEndpoint);
139
148
  const removeWebhookEndpointsTarget = new LambdaIntegration(
140
149
  this.removeWebhookEndpoint
141
150
  );