@incloodsolutions/devkit 0.0.2 → 0.0.4

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 (128) hide show
  1. package/README.md +150 -41
  2. package/dist/aws-cdk/api-gateway-v2.cjs +77 -0
  3. package/dist/aws-cdk/api-gateway-v2.cjs.map +1 -0
  4. package/dist/aws-cdk/api-gateway-v2.d.cts +55 -0
  5. package/dist/aws-cdk/api-gateway-v2.d.ts +55 -0
  6. package/dist/aws-cdk/api-gateway-v2.js +75 -0
  7. package/dist/aws-cdk/api-gateway-v2.js.map +1 -0
  8. package/dist/aws-cdk/api-gateway-websocket.cjs +77 -0
  9. package/dist/aws-cdk/api-gateway-websocket.cjs.map +1 -0
  10. package/dist/aws-cdk/api-gateway-websocket.d.cts +73 -0
  11. package/dist/aws-cdk/api-gateway-websocket.d.ts +73 -0
  12. package/dist/aws-cdk/api-gateway-websocket.js +75 -0
  13. package/dist/aws-cdk/api-gateway-websocket.js.map +1 -0
  14. package/dist/aws-cdk/api-gateway.cjs +98 -0
  15. package/dist/aws-cdk/api-gateway.cjs.map +1 -0
  16. package/dist/aws-cdk/api-gateway.d.cts +80 -0
  17. package/dist/aws-cdk/api-gateway.d.ts +80 -0
  18. package/dist/aws-cdk/api-gateway.js +96 -0
  19. package/dist/aws-cdk/api-gateway.js.map +1 -0
  20. package/dist/aws-cdk/cloudfront.cjs +68 -0
  21. package/dist/aws-cdk/cloudfront.cjs.map +1 -0
  22. package/dist/aws-cdk/cloudfront.d.cts +36 -0
  23. package/dist/aws-cdk/cloudfront.d.ts +36 -0
  24. package/dist/aws-cdk/cloudfront.js +66 -0
  25. package/dist/aws-cdk/cloudfront.js.map +1 -0
  26. package/dist/aws-cdk/cloudwatch.cjs +43 -0
  27. package/dist/aws-cdk/cloudwatch.cjs.map +1 -0
  28. package/dist/aws-cdk/cloudwatch.d.cts +36 -0
  29. package/dist/aws-cdk/cloudwatch.d.ts +36 -0
  30. package/dist/aws-cdk/cloudwatch.js +41 -0
  31. package/dist/aws-cdk/cloudwatch.js.map +1 -0
  32. package/dist/aws-cdk/dynamo-db.cjs +113 -0
  33. package/dist/aws-cdk/dynamo-db.cjs.map +1 -0
  34. package/dist/aws-cdk/dynamo-db.d.cts +53 -0
  35. package/dist/aws-cdk/dynamo-db.d.ts +53 -0
  36. package/dist/aws-cdk/dynamo-db.js +111 -0
  37. package/dist/aws-cdk/dynamo-db.js.map +1 -0
  38. package/dist/aws-cdk/event-bridge.cjs +47 -0
  39. package/dist/aws-cdk/event-bridge.cjs.map +1 -0
  40. package/dist/aws-cdk/event-bridge.d.cts +41 -0
  41. package/dist/aws-cdk/event-bridge.d.ts +41 -0
  42. package/dist/aws-cdk/event-bridge.js +45 -0
  43. package/dist/aws-cdk/event-bridge.js.map +1 -0
  44. package/dist/aws-cdk/lambda-authorizer-v2.cjs +50 -0
  45. package/dist/aws-cdk/lambda-authorizer-v2.cjs.map +1 -0
  46. package/dist/aws-cdk/lambda-authorizer-v2.d.cts +45 -0
  47. package/dist/aws-cdk/lambda-authorizer-v2.d.ts +45 -0
  48. package/dist/aws-cdk/lambda-authorizer-v2.js +48 -0
  49. package/dist/aws-cdk/lambda-authorizer-v2.js.map +1 -0
  50. package/dist/aws-cdk/lambda-authorizer.cjs +37 -0
  51. package/dist/aws-cdk/lambda-authorizer.cjs.map +1 -0
  52. package/dist/aws-cdk/lambda-authorizer.d.cts +44 -0
  53. package/dist/aws-cdk/lambda-authorizer.d.ts +44 -0
  54. package/dist/aws-cdk/lambda-authorizer.js +35 -0
  55. package/dist/aws-cdk/lambda-authorizer.js.map +1 -0
  56. package/dist/aws-cdk/lambda-layer.cjs +69 -0
  57. package/dist/aws-cdk/lambda-layer.cjs.map +1 -0
  58. package/dist/aws-cdk/lambda-layer.d.cts +52 -0
  59. package/dist/aws-cdk/lambda-layer.d.ts +52 -0
  60. package/dist/aws-cdk/lambda-layer.js +67 -0
  61. package/dist/aws-cdk/lambda-layer.js.map +1 -0
  62. package/dist/aws-cdk/lambda.cjs +82 -0
  63. package/dist/aws-cdk/lambda.cjs.map +1 -0
  64. package/dist/aws-cdk/lambda.d.cts +37 -0
  65. package/dist/aws-cdk/lambda.d.ts +37 -0
  66. package/dist/aws-cdk/lambda.js +80 -0
  67. package/dist/aws-cdk/lambda.js.map +1 -0
  68. package/dist/aws-cdk/role-policy.cjs +53 -0
  69. package/dist/aws-cdk/role-policy.cjs.map +1 -0
  70. package/dist/aws-cdk/role-policy.d.cts +44 -0
  71. package/dist/aws-cdk/role-policy.d.ts +44 -0
  72. package/dist/aws-cdk/role-policy.js +51 -0
  73. package/dist/aws-cdk/role-policy.js.map +1 -0
  74. package/dist/aws-cdk/s3-deployment.cjs +177 -0
  75. package/dist/aws-cdk/s3-deployment.cjs.map +1 -0
  76. package/dist/aws-cdk/s3-deployment.d.cts +72 -0
  77. package/dist/aws-cdk/s3-deployment.d.ts +72 -0
  78. package/dist/aws-cdk/s3-deployment.js +175 -0
  79. package/dist/aws-cdk/s3-deployment.js.map +1 -0
  80. package/dist/aws-cdk/s3.cjs +38 -0
  81. package/dist/aws-cdk/s3.cjs.map +1 -0
  82. package/dist/aws-cdk/s3.d.cts +36 -0
  83. package/dist/aws-cdk/s3.d.ts +36 -0
  84. package/dist/aws-cdk/s3.js +36 -0
  85. package/dist/aws-cdk/s3.js.map +1 -0
  86. package/dist/aws-cdk/sns.cjs +43 -0
  87. package/dist/aws-cdk/sns.cjs.map +1 -0
  88. package/dist/aws-cdk/sns.d.cts +45 -0
  89. package/dist/aws-cdk/sns.d.ts +45 -0
  90. package/dist/aws-cdk/sns.js +41 -0
  91. package/dist/aws-cdk/sns.js.map +1 -0
  92. package/dist/aws-cdk/sqs.cjs +55 -0
  93. package/dist/aws-cdk/sqs.cjs.map +1 -0
  94. package/dist/aws-cdk/sqs.d.cts +52 -0
  95. package/dist/aws-cdk/sqs.d.ts +52 -0
  96. package/dist/aws-cdk/sqs.js +53 -0
  97. package/dist/aws-cdk/sqs.js.map +1 -0
  98. package/dist/aws-cdk/vpc.cjs +33 -0
  99. package/dist/aws-cdk/vpc.cjs.map +1 -0
  100. package/dist/aws-cdk/vpc.d.cts +34 -0
  101. package/dist/aws-cdk/vpc.d.ts +34 -0
  102. package/dist/aws-cdk/vpc.js +31 -0
  103. package/dist/aws-cdk/vpc.js.map +1 -0
  104. package/dist/aws-cdk.cjs +905 -0
  105. package/dist/aws-cdk.cjs.map +1 -0
  106. package/dist/aws-cdk.d.cts +34 -0
  107. package/dist/aws-cdk.d.ts +34 -0
  108. package/dist/aws-cdk.js +887 -0
  109. package/dist/aws-cdk.js.map +1 -0
  110. package/dist/aws-types.cjs +4 -0
  111. package/dist/aws-types.cjs.map +1 -0
  112. package/dist/aws-types.d.cts +42 -0
  113. package/dist/aws-types.d.ts +42 -0
  114. package/dist/aws-types.js +3 -0
  115. package/dist/aws-types.js.map +1 -0
  116. package/dist/aws.cjs +905 -0
  117. package/dist/aws.cjs.map +1 -0
  118. package/dist/aws.d.cts +34 -0
  119. package/dist/aws.d.ts +34 -0
  120. package/dist/aws.js +887 -0
  121. package/dist/aws.js.map +1 -0
  122. package/dist/index.cjs +43 -19
  123. package/dist/index.cjs.map +1 -1
  124. package/dist/index.d.cts +34 -755
  125. package/dist/index.d.ts +34 -755
  126. package/dist/index.js +43 -19
  127. package/dist/index.js.map +1 -1
  128. package/package.json +181 -19
@@ -0,0 +1,111 @@
1
+ import { Construct } from 'constructs';
2
+ import { CfnOutput } from 'aws-cdk-lib';
3
+ import { Table, BillingMode } from 'aws-cdk-lib/aws-dynamodb';
4
+ import { printLog } from '@incloodsolutions/toolkit';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var BaseDynamoDBConstruct = class _BaseDynamoDBConstruct extends Construct {
9
+ static {
10
+ __name(this, "BaseDynamoDBConstruct");
11
+ }
12
+ /** Newly created DynamoDB table (null if importing existing table) */
13
+ table;
14
+ /** Imported DynamoDB table reference (null if creating new table) */
15
+ existingTable;
16
+ /** Enables debug logging */
17
+ enableDebug = false;
18
+ /**
19
+ * @param scope Parent construct
20
+ * @param id Unique construct identifier
21
+ * @param props Configuration for table creation or import
22
+ */
23
+ constructor(scope, id, props) {
24
+ super(scope, id);
25
+ this.enableDebug = props?.enableDebug;
26
+ if (props.options?.fromExistingTableName) {
27
+ this.table = null;
28
+ this.existingTable = Table.fromTableName(
29
+ this,
30
+ `${id}-RefName`,
31
+ props.options.fromExistingTableName
32
+ );
33
+ if (this.enableDebug) {
34
+ printLog(
35
+ _BaseDynamoDBConstruct.name,
36
+ `Created Dynamo-DB table from existing using name ${props.options?.fromExistingTableName}`
37
+ );
38
+ }
39
+ } else if (props.options?.fromExistingTableArn) {
40
+ this.table = null;
41
+ this.existingTable = Table.fromTableArn(
42
+ this,
43
+ `${id}-RefArn`,
44
+ props.options.fromExistingTableArn
45
+ );
46
+ if (this.enableDebug) {
47
+ printLog(
48
+ _BaseDynamoDBConstruct.name,
49
+ `Created Dynamo-DB table from existing using ARN`
50
+ );
51
+ }
52
+ } else if (props.options?.fromExistingTableAttributes) {
53
+ this.table = null;
54
+ this.existingTable = Table.fromTableAttributes(
55
+ this,
56
+ `${id}-RefAttributes`,
57
+ props.options.fromExistingTableAttributes
58
+ );
59
+ if (this.enableDebug) {
60
+ printLog(
61
+ _BaseDynamoDBConstruct.name,
62
+ `Created Dynamo-DB table from existing attributes`
63
+ );
64
+ }
65
+ } else {
66
+ this.existingTable = null;
67
+ this.table = new Table(this, id, {
68
+ ...props.options?.tableOptions,
69
+ /**
70
+ * Billing mode defaults to PAY_PER_REQUEST if not provided
71
+ */
72
+ billingMode: props.options?.tableOptions?.billingMode || BillingMode.PAY_PER_REQUEST,
73
+ /**
74
+ * Deletion protection:
75
+ * - Uses explicit value if provided
76
+ * - Defaults to true in production stage
77
+ */
78
+ deletionProtection: props.options?.tableOptions?.deletionProtection === true || props.options?.tableOptions?.deletionProtection === false ? props.options.tableOptions.deletionProtection : props.stage === "production"
79
+ });
80
+ if (props.options?.globalSecondaryIndexes?.length) {
81
+ props.options.globalSecondaryIndexes.forEach((globalIndex) => {
82
+ this.table.addGlobalSecondaryIndex(globalIndex);
83
+ if (this.enableDebug) {
84
+ printLog(
85
+ _BaseDynamoDBConstruct.name,
86
+ `Added GSI: ${globalIndex.indexName}`
87
+ );
88
+ }
89
+ });
90
+ }
91
+ if (props.options?.localSecondaryIndexes?.length) {
92
+ props.options.localSecondaryIndexes.forEach((localIndex) => {
93
+ this.table.addLocalSecondaryIndex(localIndex);
94
+ if (this.enableDebug) {
95
+ printLog(
96
+ _BaseDynamoDBConstruct.name,
97
+ `Added LSI: ${localIndex.indexName}`
98
+ );
99
+ }
100
+ });
101
+ }
102
+ }
103
+ new CfnOutput(this, "DynamoDbArn", {
104
+ value: props.options?.fromExistingTableName || props.options?.fromExistingTableArn ? this.existingTable.tableArn : this.table.tableArn
105
+ });
106
+ }
107
+ };
108
+
109
+ export { BaseDynamoDBConstruct };
110
+ //# sourceMappingURL=dynamo-db.js.map
111
+ //# sourceMappingURL=dynamo-db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/dynamo-db-construct.ts"],"names":[],"mappings":"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","file":"dynamo-db.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport {\n\tBillingMode,\n\tGlobalSecondaryIndexProps,\n\tITable,\n\tLocalSecondaryIndexProps,\n\tTable,\n\tTableAttributes,\n\tTableProps,\n} from 'aws-cdk-lib/aws-dynamodb';\n\nimport { printLog } from '@incloodsolutions/toolkit';\n\nimport { IBaseCdkConstructProps, IBaseConstruct } from '../../types';\n\n/**\n * Props for BaseDynamoDBConstruct\n *\n * Provides configuration for:\n * - Creating a new DynamoDB table\n * - Importing an existing table (by name, ARN, or attributes)\n * - Defining Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI)\n */\ninterface IDynamoDBConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration for creating a new table */\n\t\treadonly tableOptions?: TableProps;\n\n\t\t/** Import an existing table by ARN */\n\t\treadonly fromExistingTableArn?: string;\n\n\t\t/** Import an existing table by name */\n\t\treadonly fromExistingTableName?: string;\n\n\t\t/** Import an existing table using attributes */\n\t\treadonly fromExistingTableAttributes?: TableAttributes;\n\n\t\t/** Global Secondary Index definitions */\n\t\treadonly globalSecondaryIndexes?: GlobalSecondaryIndexProps[];\n\n\t\t/** Local Secondary Index definitions */\n\t\treadonly localSecondaryIndexes?: LocalSecondaryIndexProps[];\n\t}>,\n\t'appName' | 'stackName'\n> {}\n\n/**\n * CDK construct for DynamoDB table management\n *\n * Responsibilities:\n * - Creates a new DynamoDB table or imports an existing one\n * - Applies default billing mode and deletion protection\n * - Attaches optional GSIs and LSIs\n * - Exposes table ARN as a CloudFormation output\n */\nexport class BaseDynamoDBConstruct extends Construct implements IBaseConstruct {\n\t/** Newly created DynamoDB table (null if importing existing table) */\n\treadonly table: Table;\n\n\t/** Imported DynamoDB table reference (null if creating new table) */\n\treadonly existingTable: ITable;\n\n\t/** Enables debug logging */\n\tenableDebug = false;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for table creation or import\n\t */\n\tconstructor(scope: Construct, id: string, props: IDynamoDBConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.enableDebug = props?.enableDebug;\n\n\t\t/**\n\t\t * Import table by name\n\t\t */\n\t\tif (props.options?.fromExistingTableName) {\n\t\t\tthis.table = null;\n\n\t\t\tthis.existingTable = Table.fromTableName(\n\t\t\t\tthis,\n\t\t\t\t`${id}-RefName`,\n\t\t\t\tprops.options.fromExistingTableName,\n\t\t\t);\n\n\t\t\tif (this.enableDebug) {\n\t\t\t\tprintLog(\n\t\t\t\t\tBaseDynamoDBConstruct.name,\n\t\t\t\t\t`Created Dynamo-DB table from existing using name ${props.options?.fromExistingTableName}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Import table by ARN\n\t\t\t */\n\t\t} else if (props.options?.fromExistingTableArn) {\n\t\t\tthis.table = null;\n\n\t\t\tthis.existingTable = Table.fromTableArn(\n\t\t\t\tthis,\n\t\t\t\t`${id}-RefArn`,\n\t\t\t\tprops.options.fromExistingTableArn,\n\t\t\t);\n\n\t\t\tif (this.enableDebug) {\n\t\t\t\tprintLog(\n\t\t\t\t\tBaseDynamoDBConstruct.name,\n\t\t\t\t\t`Created Dynamo-DB table from existing using ARN`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Import table using attributes\n\t\t\t */\n\t\t} else if (props.options?.fromExistingTableAttributes) {\n\t\t\tthis.table = null;\n\n\t\t\tthis.existingTable = Table.fromTableAttributes(\n\t\t\t\tthis,\n\t\t\t\t`${id}-RefAttributes`,\n\t\t\t\tprops.options.fromExistingTableAttributes,\n\t\t\t);\n\n\t\t\tif (this.enableDebug) {\n\t\t\t\tprintLog(\n\t\t\t\t\tBaseDynamoDBConstruct.name,\n\t\t\t\t\t`Created Dynamo-DB table from existing attributes`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Create new table\n\t\t\t */\n\t\t} else {\n\t\t\tthis.existingTable = null;\n\n\t\t\tthis.table = new Table(this, id, {\n\t\t\t\t...props.options?.tableOptions,\n\n\t\t\t\t/**\n\t\t\t\t * Billing mode defaults to PAY_PER_REQUEST if not provided\n\t\t\t\t */\n\t\t\t\tbillingMode:\n\t\t\t\t\tprops.options?.tableOptions?.billingMode ||\n\t\t\t\t\tBillingMode.PAY_PER_REQUEST,\n\n\t\t\t\t/**\n\t\t\t\t * Deletion protection:\n\t\t\t\t * - Uses explicit value if provided\n\t\t\t\t * - Defaults to true in production stage\n\t\t\t\t */\n\t\t\t\tdeletionProtection:\n\t\t\t\t\tprops.options?.tableOptions?.deletionProtection === true ||\n\t\t\t\t\tprops.options?.tableOptions?.deletionProtection === false\n\t\t\t\t\t\t? props.options.tableOptions.deletionProtection\n\t\t\t\t\t\t: props.stage === 'production',\n\t\t\t});\n\n\t\t\t/**\n\t\t\t * Attach Global Secondary Indexes (GSI)\n\t\t\t */\n\t\t\tif (props.options?.globalSecondaryIndexes?.length) {\n\t\t\t\tprops.options.globalSecondaryIndexes.forEach((globalIndex) => {\n\t\t\t\t\tthis.table.addGlobalSecondaryIndex(globalIndex);\n\n\t\t\t\t\tif (this.enableDebug) {\n\t\t\t\t\t\tprintLog(\n\t\t\t\t\t\t\tBaseDynamoDBConstruct.name,\n\t\t\t\t\t\t\t`Added GSI: ${globalIndex.indexName}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attach Local Secondary Indexes (LSI)\n\t\t\t */\n\t\t\tif (props.options?.localSecondaryIndexes?.length) {\n\t\t\t\tprops.options.localSecondaryIndexes.forEach((localIndex) => {\n\t\t\t\t\tthis.table.addLocalSecondaryIndex(localIndex);\n\n\t\t\t\t\tif (this.enableDebug) {\n\t\t\t\t\t\tprintLog(\n\t\t\t\t\t\t\tBaseDynamoDBConstruct.name,\n\t\t\t\t\t\t\t`Added LSI: ${localIndex.indexName}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the table ARN\n\t\t * Resolves to either created or imported table\n\t\t */\n\t\tnew CfnOutput(this, 'DynamoDbArn', {\n\t\t\tvalue:\n\t\t\t\tprops.options?.fromExistingTableName ||\n\t\t\t\tprops.options?.fromExistingTableArn\n\t\t\t\t\t? this.existingTable.tableArn\n\t\t\t\t\t: this.table.tableArn,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var constructs = require('constructs');
4
+ var awsCdkLib = require('aws-cdk-lib');
5
+ var awsEvents = require('aws-cdk-lib/aws-events');
6
+ var awsEventsTargets = require('aws-cdk-lib/aws-events-targets');
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var BaseEventBridgeConstruct = class extends constructs.Construct {
11
+ static {
12
+ __name(this, "BaseEventBridgeConstruct");
13
+ }
14
+ /** The created EventBridge rule instance */
15
+ eventSchedule;
16
+ /**
17
+ * @param scope Parent construct
18
+ * @param id Unique construct identifier
19
+ * @param props Configuration for rule and target functions
20
+ */
21
+ constructor(scope, id, props) {
22
+ super(scope, id);
23
+ this.eventSchedule = new awsEvents.Rule(this, id, {
24
+ ...props.options?.eventBridgeOptions,
25
+ /** Default description if not explicitly provided */
26
+ description: props?.options?.eventBridgeOptions?.description || "An Event-bridge rule"
27
+ });
28
+ if (props.options?.targetFunctions?.length) {
29
+ props.options.targetFunctions.forEach((targetFunction) => {
30
+ this.eventSchedule.addTarget(
31
+ /**
32
+ * Lambda target integration
33
+ */
34
+ new awsEventsTargets.LambdaFunction(targetFunction)
35
+ );
36
+ });
37
+ }
38
+ this.eventSchedule.applyRemovalPolicy(awsCdkLib.RemovalPolicy.DESTROY);
39
+ new awsCdkLib.CfnOutput(this, "EventBridgeArn", {
40
+ value: this.eventSchedule.ruleArn
41
+ });
42
+ }
43
+ };
44
+
45
+ exports.BaseEventBridgeConstruct = BaseEventBridgeConstruct;
46
+ //# sourceMappingURL=event-bridge.cjs.map
47
+ //# sourceMappingURL=event-bridge.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/event-bridge-construct.ts"],"names":["Construct","Rule","LambdaFunction","RemovalPolicy","CfnOutput"],"mappings":";;;;;;;;;AAmCO,IAAM,wBAAA,GAAN,cAAuCA,oBAAA,CAAU;AAAA,EAnCxD;AAmCwD,IAAA,MAAA,CAAA,IAAA,EAAA,0BAAA,CAAA;AAAA;AAAA;AAAA,EAE9C,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAmC;AAC5E,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,aAAA,GAAgB,IAAIC,cAAA,CAAK,IAAA,EAAM,EAAA,EAAI;AAAA,MACvC,GAAG,MAAM,OAAA,EAAS,kBAAA;AAAA;AAAA,MAGlB,WAAA,EACC,KAAA,EAAO,OAAA,EAAS,kBAAA,EAAoB,WAAA,IACpC;AAAA,KACD,CAAA;AAKD,IAAA,IAAI,KAAA,CAAM,OAAA,EAAS,eAAA,EAAiB,MAAA,EAAQ;AAC3C,MAAA,KAAA,CAAM,OAAA,CAAQ,eAAA,CAAgB,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACzD,QAAA,IAAA,CAAK,aAAA,CAAc,SAAA;AAAA;AAAA;AAAA;AAAA,UAIlB,IAAIC,gCAAe,cAAc;AAAA,SAClC;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,aAAA,CAAc,kBAAA,CAAmBC,uBAAA,CAAc,OAAO,CAAA;AAK3D,IAAA,IAAIC,mBAAA,CAAU,MAAM,gBAAA,EAAkB;AAAA,MACrC,KAAA,EAAO,KAAK,aAAA,CAAc;AAAA,KAC1B,CAAA;AAAA,EACF;AACD","file":"event-bridge.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Rule, RuleProps } from 'aws-cdk-lib/aws-events';\nimport { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseEventBridgeConstruct\n *\n * Provides configuration for:\n * - EventBridge rule creation\n * - Target Lambda functions\n */\ninterface IEventBridgeConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Lambda functions to be triggered by the rule */\n\t\treadonly targetFunctions: Function[];\n\n\t\t/** EventBridge rule configuration */\n\t\treadonly eventBridgeOptions: RuleProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for EventBridge rule\n *\n * Responsibilities:\n * - Creates an EventBridge rule with configurable options\n * - Attaches one or more Lambda targets\n * - Applies a removal policy\n * - Exposes the rule ARN as a CloudFormation output\n */\nexport class BaseEventBridgeConstruct extends Construct {\n\t/** The created EventBridge rule instance */\n\treadonly eventSchedule: Rule;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for rule and target functions\n\t */\n\tconstructor(scope: Construct, id: string, props: IEventBridgeConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.eventSchedule = new Rule(this, id, {\n\t\t\t...props.options?.eventBridgeOptions,\n\n\t\t\t/** Default description if not explicitly provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.eventBridgeOptions?.description ||\n\t\t\t\t'An Event-bridge rule',\n\t\t});\n\n\t\t/**\n\t\t * Attach Lambda targets to the rule\n\t\t */\n\t\tif (props.options?.targetFunctions?.length) {\n\t\t\tprops.options.targetFunctions.forEach((targetFunction) => {\n\t\t\t\tthis.eventSchedule.addTarget(\n\t\t\t\t\t/**\n\t\t\t\t\t * Lambda target integration\n\t\t\t\t\t */\n\t\t\t\t\tnew LambdaFunction(targetFunction),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.eventSchedule.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the rule ARN\n\t\t */\n\t\tnew CfnOutput(this, 'EventBridgeArn', {\n\t\t\tvalue: this.eventSchedule.ruleArn,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import { Construct } from 'constructs';
2
+ import { Function } from 'aws-cdk-lib/aws-lambda';
3
+ import { Rule, RuleProps } from 'aws-cdk-lib/aws-events';
4
+ import { IBaseCdkConstructProps } from '../aws-types.cjs';
5
+ import '@incloodsolutions/toolkit';
6
+
7
+ /**
8
+ * Props for BaseEventBridgeConstruct
9
+ *
10
+ * Provides configuration for:
11
+ * - EventBridge rule creation
12
+ * - Target Lambda functions
13
+ */
14
+ interface IEventBridgeConstructProps extends Omit<IBaseCdkConstructProps<{
15
+ /** Lambda functions to be triggered by the rule */
16
+ readonly targetFunctions: Function[];
17
+ /** EventBridge rule configuration */
18
+ readonly eventBridgeOptions: RuleProps;
19
+ }>, 'appName' | 'stage' | 'stackName'> {
20
+ }
21
+ /**
22
+ * CDK construct for EventBridge rule
23
+ *
24
+ * Responsibilities:
25
+ * - Creates an EventBridge rule with configurable options
26
+ * - Attaches one or more Lambda targets
27
+ * - Applies a removal policy
28
+ * - Exposes the rule ARN as a CloudFormation output
29
+ */
30
+ declare class BaseEventBridgeConstruct extends Construct {
31
+ /** The created EventBridge rule instance */
32
+ readonly eventSchedule: Rule;
33
+ /**
34
+ * @param scope Parent construct
35
+ * @param id Unique construct identifier
36
+ * @param props Configuration for rule and target functions
37
+ */
38
+ constructor(scope: Construct, id: string, props: IEventBridgeConstructProps);
39
+ }
40
+
41
+ export { BaseEventBridgeConstruct };
@@ -0,0 +1,41 @@
1
+ import { Construct } from 'constructs';
2
+ import { Function } from 'aws-cdk-lib/aws-lambda';
3
+ import { Rule, RuleProps } from 'aws-cdk-lib/aws-events';
4
+ import { IBaseCdkConstructProps } from '../aws-types.js';
5
+ import '@incloodsolutions/toolkit';
6
+
7
+ /**
8
+ * Props for BaseEventBridgeConstruct
9
+ *
10
+ * Provides configuration for:
11
+ * - EventBridge rule creation
12
+ * - Target Lambda functions
13
+ */
14
+ interface IEventBridgeConstructProps extends Omit<IBaseCdkConstructProps<{
15
+ /** Lambda functions to be triggered by the rule */
16
+ readonly targetFunctions: Function[];
17
+ /** EventBridge rule configuration */
18
+ readonly eventBridgeOptions: RuleProps;
19
+ }>, 'appName' | 'stage' | 'stackName'> {
20
+ }
21
+ /**
22
+ * CDK construct for EventBridge rule
23
+ *
24
+ * Responsibilities:
25
+ * - Creates an EventBridge rule with configurable options
26
+ * - Attaches one or more Lambda targets
27
+ * - Applies a removal policy
28
+ * - Exposes the rule ARN as a CloudFormation output
29
+ */
30
+ declare class BaseEventBridgeConstruct extends Construct {
31
+ /** The created EventBridge rule instance */
32
+ readonly eventSchedule: Rule;
33
+ /**
34
+ * @param scope Parent construct
35
+ * @param id Unique construct identifier
36
+ * @param props Configuration for rule and target functions
37
+ */
38
+ constructor(scope: Construct, id: string, props: IEventBridgeConstructProps);
39
+ }
40
+
41
+ export { BaseEventBridgeConstruct };
@@ -0,0 +1,45 @@
1
+ import { Construct } from 'constructs';
2
+ import { RemovalPolicy, CfnOutput } from 'aws-cdk-lib';
3
+ import { Rule } from 'aws-cdk-lib/aws-events';
4
+ import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var BaseEventBridgeConstruct = class extends Construct {
9
+ static {
10
+ __name(this, "BaseEventBridgeConstruct");
11
+ }
12
+ /** The created EventBridge rule instance */
13
+ eventSchedule;
14
+ /**
15
+ * @param scope Parent construct
16
+ * @param id Unique construct identifier
17
+ * @param props Configuration for rule and target functions
18
+ */
19
+ constructor(scope, id, props) {
20
+ super(scope, id);
21
+ this.eventSchedule = new Rule(this, id, {
22
+ ...props.options?.eventBridgeOptions,
23
+ /** Default description if not explicitly provided */
24
+ description: props?.options?.eventBridgeOptions?.description || "An Event-bridge rule"
25
+ });
26
+ if (props.options?.targetFunctions?.length) {
27
+ props.options.targetFunctions.forEach((targetFunction) => {
28
+ this.eventSchedule.addTarget(
29
+ /**
30
+ * Lambda target integration
31
+ */
32
+ new LambdaFunction(targetFunction)
33
+ );
34
+ });
35
+ }
36
+ this.eventSchedule.applyRemovalPolicy(RemovalPolicy.DESTROY);
37
+ new CfnOutput(this, "EventBridgeArn", {
38
+ value: this.eventSchedule.ruleArn
39
+ });
40
+ }
41
+ };
42
+
43
+ export { BaseEventBridgeConstruct };
44
+ //# sourceMappingURL=event-bridge.js.map
45
+ //# sourceMappingURL=event-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/event-bridge-construct.ts"],"names":[],"mappings":";;;;;;;AAmCO,IAAM,wBAAA,GAAN,cAAuC,SAAA,CAAU;AAAA,EAnCxD;AAmCwD,IAAA,MAAA,CAAA,IAAA,EAAA,0BAAA,CAAA;AAAA;AAAA;AAAA,EAE9C,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAmC;AAC5E,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,aAAA,GAAgB,IAAI,IAAA,CAAK,IAAA,EAAM,EAAA,EAAI;AAAA,MACvC,GAAG,MAAM,OAAA,EAAS,kBAAA;AAAA;AAAA,MAGlB,WAAA,EACC,KAAA,EAAO,OAAA,EAAS,kBAAA,EAAoB,WAAA,IACpC;AAAA,KACD,CAAA;AAKD,IAAA,IAAI,KAAA,CAAM,OAAA,EAAS,eAAA,EAAiB,MAAA,EAAQ;AAC3C,MAAA,KAAA,CAAM,OAAA,CAAQ,eAAA,CAAgB,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACzD,QAAA,IAAA,CAAK,aAAA,CAAc,SAAA;AAAA;AAAA;AAAA;AAAA,UAIlB,IAAI,eAAe,cAAc;AAAA,SAClC;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,aAAA,CAAc,kBAAA,CAAmB,aAAA,CAAc,OAAO,CAAA;AAK3D,IAAA,IAAI,SAAA,CAAU,MAAM,gBAAA,EAAkB;AAAA,MACrC,KAAA,EAAO,KAAK,aAAA,CAAc;AAAA,KAC1B,CAAA;AAAA,EACF;AACD","file":"event-bridge.js","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Rule, RuleProps } from 'aws-cdk-lib/aws-events';\nimport { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseEventBridgeConstruct\n *\n * Provides configuration for:\n * - EventBridge rule creation\n * - Target Lambda functions\n */\ninterface IEventBridgeConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Lambda functions to be triggered by the rule */\n\t\treadonly targetFunctions: Function[];\n\n\t\t/** EventBridge rule configuration */\n\t\treadonly eventBridgeOptions: RuleProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for EventBridge rule\n *\n * Responsibilities:\n * - Creates an EventBridge rule with configurable options\n * - Attaches one or more Lambda targets\n * - Applies a removal policy\n * - Exposes the rule ARN as a CloudFormation output\n */\nexport class BaseEventBridgeConstruct extends Construct {\n\t/** The created EventBridge rule instance */\n\treadonly eventSchedule: Rule;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for rule and target functions\n\t */\n\tconstructor(scope: Construct, id: string, props: IEventBridgeConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.eventSchedule = new Rule(this, id, {\n\t\t\t...props.options?.eventBridgeOptions,\n\n\t\t\t/** Default description if not explicitly provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.eventBridgeOptions?.description ||\n\t\t\t\t'An Event-bridge rule',\n\t\t});\n\n\t\t/**\n\t\t * Attach Lambda targets to the rule\n\t\t */\n\t\tif (props.options?.targetFunctions?.length) {\n\t\t\tprops.options.targetFunctions.forEach((targetFunction) => {\n\t\t\t\tthis.eventSchedule.addTarget(\n\t\t\t\t\t/**\n\t\t\t\t\t * Lambda target integration\n\t\t\t\t\t */\n\t\t\t\t\tnew LambdaFunction(targetFunction),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.eventSchedule.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the rule ARN\n\t\t */\n\t\tnew CfnOutput(this, 'EventBridgeArn', {\n\t\t\tvalue: this.eventSchedule.ruleArn,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var constructs = require('constructs');
4
+ var awsCdkLib = require('aws-cdk-lib');
5
+ var awsApigatewayv2Authorizers = require('aws-cdk-lib/aws-apigatewayv2-authorizers');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var BaseLambdaAuthoriserV2Construct = class extends constructs.Construct {
10
+ static {
11
+ __name(this, "BaseLambdaAuthoriserV2Construct");
12
+ }
13
+ /** The created HTTP Lambda Authorizer instance */
14
+ authoriser;
15
+ /**
16
+ * @param scope Parent construct
17
+ * @param id Unique construct identifier
18
+ * @param props Configuration for authorizer and handler function
19
+ */
20
+ constructor(scope, id, props) {
21
+ super(scope, id);
22
+ this.authoriser = new awsApigatewayv2Authorizers.HttpLambdaAuthorizer(id, props.handlerFunction, {
23
+ ...props?.options?.authorizerOptions,
24
+ /**
25
+ * Identity sources used to extract credentials from incoming requests
26
+ * Defaults to Cookie and Authorization headers
27
+ */
28
+ identitySource: [
29
+ "$request.header.Cookie",
30
+ "$request.header.Authorization",
31
+ ...props?.options?.authorizerOptions?.identitySource
32
+ ],
33
+ /**
34
+ * Supported response types for the authorizer
35
+ * Defaults to IAM and SIMPLE responses
36
+ */
37
+ responseTypes: props?.options?.authorizerOptions?.responseTypes || [
38
+ awsApigatewayv2Authorizers.HttpLambdaResponseType.IAM,
39
+ awsApigatewayv2Authorizers.HttpLambdaResponseType.SIMPLE
40
+ ]
41
+ });
42
+ new awsCdkLib.CfnOutput(this, "LambdaAuthorizerV2_ID", {
43
+ value: this.authoriser.authorizerId
44
+ });
45
+ }
46
+ };
47
+
48
+ exports.BaseLambdaAuthoriserV2Construct = BaseLambdaAuthoriserV2Construct;
49
+ //# sourceMappingURL=lambda-authorizer-v2.cjs.map
50
+ //# sourceMappingURL=lambda-authorizer-v2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/lambda-authorizer-v2-construct.ts"],"names":["Construct","HttpLambdaAuthorizer","HttpLambdaResponseType","CfnOutput"],"mappings":";;;;;;;;AA0CO,IAAM,+BAAA,GAAN,cAA8CA,oBAAA,CAAU;AAAA,EA1C/D;AA0C+D,IAAA,MAAA,CAAA,IAAA,EAAA,iCAAA,CAAA;AAAA;AAAA;AAAA,EAErD,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,UAAA,GAAa,IAAIC,+CAAA,CAAqB,EAAA,EAAI,MAAM,eAAA,EAAiB;AAAA,MACrE,GAAG,OAAO,OAAA,EAAS,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMnB,cAAA,EAAgB;AAAA,QACf,wBAAA;AAAA,QACA,+BAAA;AAAA,QACA,GAAG,KAAA,EAAO,OAAA,EAAS,iBAAA,EAAmB;AAAA,OACvC;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,aAAA,EAAe,KAAA,EAAO,OAAA,EAAS,iBAAA,EAAmB,aAAA,IAAiB;AAAA,QAClEC,iDAAA,CAAuB,GAAA;AAAA,QACvBA,iDAAA,CAAuB;AAAA;AACxB,KACA,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,uBAAA,EAAyB;AAAA,MAC5C,KAAA,EAAO,KAAK,UAAA,CAAW;AAAA,KACvB,CAAA;AAAA,EACF;AACD","file":"lambda-authorizer-v2.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport {\n\tHttpLambdaAuthorizer,\n\tHttpLambdaAuthorizerProps,\n\tHttpLambdaResponseType,\n} from 'aws-cdk-lib/aws-apigatewayv2-authorizers';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaAuthoriserV2Construct\n *\n * Provides configuration for:\n * - HTTP API Lambda authorizer (API Gateway v2)\n * - Authorizer behaviour and identity sources\n */\ninterface ILambdaAuthoriserV2ConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** HTTP Lambda authorizer configuration options */\n\t\treadonly authorizerOptions: HttpLambdaAuthorizerProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda function used as the authorizer handler\n\t *\n\t * This function is invoked to validate incoming HTTP requests\n\t */\n\treadonly handlerFunction: Function;\n}\n\n/**\n * CDK construct for Lambda Authorizer (API Gateway v2 - HTTP API)\n *\n * Responsibilities:\n * - Creates an HTTP Lambda authorizer\n * - Applies default identity sources (Cookie and Authorization headers)\n * - Supports multiple response types (IAM and SIMPLE by default)\n * - Exposes the authorizer ID as a CloudFormation output\n */\nexport class BaseLambdaAuthoriserV2Construct extends Construct {\n\t/** The created HTTP Lambda Authorizer instance */\n\treadonly authoriser: HttpLambdaAuthorizer;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for authorizer and handler function\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: ILambdaAuthoriserV2ConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.authoriser = new HttpLambdaAuthorizer(id, props.handlerFunction, {\n\t\t\t...props?.options?.authorizerOptions,\n\n\t\t\t/**\n\t\t\t * Identity sources used to extract credentials from incoming requests\n\t\t\t * Defaults to Cookie and Authorization headers\n\t\t\t */\n\t\t\tidentitySource: [\n\t\t\t\t'$request.header.Cookie',\n\t\t\t\t'$request.header.Authorization',\n\t\t\t\t...props?.options?.authorizerOptions?.identitySource,\n\t\t\t],\n\n\t\t\t/**\n\t\t\t * Supported response types for the authorizer\n\t\t\t * Defaults to IAM and SIMPLE responses\n\t\t\t */\n\t\t\tresponseTypes: props?.options?.authorizerOptions?.responseTypes || [\n\t\t\t\tHttpLambdaResponseType.IAM,\n\t\t\t\tHttpLambdaResponseType.SIMPLE,\n\t\t\t],\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the authorizer ID\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaAuthorizerV2_ID', {\n\t\t\tvalue: this.authoriser.authorizerId,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,45 @@
1
+ import { Construct } from 'constructs';
2
+ import { Function } from 'aws-cdk-lib/aws-lambda';
3
+ import { HttpLambdaAuthorizer, HttpLambdaAuthorizerProps } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
4
+ import { IBaseCdkConstructProps } from '../aws-types.cjs';
5
+ import '@incloodsolutions/toolkit';
6
+
7
+ /**
8
+ * Props for BaseLambdaAuthoriserV2Construct
9
+ *
10
+ * Provides configuration for:
11
+ * - HTTP API Lambda authorizer (API Gateway v2)
12
+ * - Authorizer behaviour and identity sources
13
+ */
14
+ interface ILambdaAuthoriserV2ConstructProps extends Omit<IBaseCdkConstructProps<{
15
+ /** HTTP Lambda authorizer configuration options */
16
+ readonly authorizerOptions: HttpLambdaAuthorizerProps;
17
+ }>, 'appName' | 'stage' | 'stackName'> {
18
+ /**
19
+ * Lambda function used as the authorizer handler
20
+ *
21
+ * This function is invoked to validate incoming HTTP requests
22
+ */
23
+ readonly handlerFunction: Function;
24
+ }
25
+ /**
26
+ * CDK construct for Lambda Authorizer (API Gateway v2 - HTTP API)
27
+ *
28
+ * Responsibilities:
29
+ * - Creates an HTTP Lambda authorizer
30
+ * - Applies default identity sources (Cookie and Authorization headers)
31
+ * - Supports multiple response types (IAM and SIMPLE by default)
32
+ * - Exposes the authorizer ID as a CloudFormation output
33
+ */
34
+ declare class BaseLambdaAuthoriserV2Construct extends Construct {
35
+ /** The created HTTP Lambda Authorizer instance */
36
+ readonly authoriser: HttpLambdaAuthorizer;
37
+ /**
38
+ * @param scope Parent construct
39
+ * @param id Unique construct identifier
40
+ * @param props Configuration for authorizer and handler function
41
+ */
42
+ constructor(scope: Construct, id: string, props: ILambdaAuthoriserV2ConstructProps);
43
+ }
44
+
45
+ export { BaseLambdaAuthoriserV2Construct };
@@ -0,0 +1,45 @@
1
+ import { Construct } from 'constructs';
2
+ import { Function } from 'aws-cdk-lib/aws-lambda';
3
+ import { HttpLambdaAuthorizer, HttpLambdaAuthorizerProps } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
4
+ import { IBaseCdkConstructProps } from '../aws-types.js';
5
+ import '@incloodsolutions/toolkit';
6
+
7
+ /**
8
+ * Props for BaseLambdaAuthoriserV2Construct
9
+ *
10
+ * Provides configuration for:
11
+ * - HTTP API Lambda authorizer (API Gateway v2)
12
+ * - Authorizer behaviour and identity sources
13
+ */
14
+ interface ILambdaAuthoriserV2ConstructProps extends Omit<IBaseCdkConstructProps<{
15
+ /** HTTP Lambda authorizer configuration options */
16
+ readonly authorizerOptions: HttpLambdaAuthorizerProps;
17
+ }>, 'appName' | 'stage' | 'stackName'> {
18
+ /**
19
+ * Lambda function used as the authorizer handler
20
+ *
21
+ * This function is invoked to validate incoming HTTP requests
22
+ */
23
+ readonly handlerFunction: Function;
24
+ }
25
+ /**
26
+ * CDK construct for Lambda Authorizer (API Gateway v2 - HTTP API)
27
+ *
28
+ * Responsibilities:
29
+ * - Creates an HTTP Lambda authorizer
30
+ * - Applies default identity sources (Cookie and Authorization headers)
31
+ * - Supports multiple response types (IAM and SIMPLE by default)
32
+ * - Exposes the authorizer ID as a CloudFormation output
33
+ */
34
+ declare class BaseLambdaAuthoriserV2Construct extends Construct {
35
+ /** The created HTTP Lambda Authorizer instance */
36
+ readonly authoriser: HttpLambdaAuthorizer;
37
+ /**
38
+ * @param scope Parent construct
39
+ * @param id Unique construct identifier
40
+ * @param props Configuration for authorizer and handler function
41
+ */
42
+ constructor(scope: Construct, id: string, props: ILambdaAuthoriserV2ConstructProps);
43
+ }
44
+
45
+ export { BaseLambdaAuthoriserV2Construct };
@@ -0,0 +1,48 @@
1
+ import { Construct } from 'constructs';
2
+ import { CfnOutput } from 'aws-cdk-lib';
3
+ import { HttpLambdaAuthorizer, HttpLambdaResponseType } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var BaseLambdaAuthoriserV2Construct = class extends Construct {
8
+ static {
9
+ __name(this, "BaseLambdaAuthoriserV2Construct");
10
+ }
11
+ /** The created HTTP Lambda Authorizer instance */
12
+ authoriser;
13
+ /**
14
+ * @param scope Parent construct
15
+ * @param id Unique construct identifier
16
+ * @param props Configuration for authorizer and handler function
17
+ */
18
+ constructor(scope, id, props) {
19
+ super(scope, id);
20
+ this.authoriser = new HttpLambdaAuthorizer(id, props.handlerFunction, {
21
+ ...props?.options?.authorizerOptions,
22
+ /**
23
+ * Identity sources used to extract credentials from incoming requests
24
+ * Defaults to Cookie and Authorization headers
25
+ */
26
+ identitySource: [
27
+ "$request.header.Cookie",
28
+ "$request.header.Authorization",
29
+ ...props?.options?.authorizerOptions?.identitySource
30
+ ],
31
+ /**
32
+ * Supported response types for the authorizer
33
+ * Defaults to IAM and SIMPLE responses
34
+ */
35
+ responseTypes: props?.options?.authorizerOptions?.responseTypes || [
36
+ HttpLambdaResponseType.IAM,
37
+ HttpLambdaResponseType.SIMPLE
38
+ ]
39
+ });
40
+ new CfnOutput(this, "LambdaAuthorizerV2_ID", {
41
+ value: this.authoriser.authorizerId
42
+ });
43
+ }
44
+ };
45
+
46
+ export { BaseLambdaAuthoriserV2Construct };
47
+ //# sourceMappingURL=lambda-authorizer-v2.js.map
48
+ //# sourceMappingURL=lambda-authorizer-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/lambda-authorizer-v2-construct.ts"],"names":[],"mappings":";;;;;;AA0CO,IAAM,+BAAA,GAAN,cAA8C,SAAA,CAAU;AAAA,EA1C/D;AA0C+D,IAAA,MAAA,CAAA,IAAA,EAAA,iCAAA,CAAA;AAAA;AAAA;AAAA,EAErD,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,UAAA,GAAa,IAAI,oBAAA,CAAqB,EAAA,EAAI,MAAM,eAAA,EAAiB;AAAA,MACrE,GAAG,OAAO,OAAA,EAAS,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMnB,cAAA,EAAgB;AAAA,QACf,wBAAA;AAAA,QACA,+BAAA;AAAA,QACA,GAAG,KAAA,EAAO,OAAA,EAAS,iBAAA,EAAmB;AAAA,OACvC;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,aAAA,EAAe,KAAA,EAAO,OAAA,EAAS,iBAAA,EAAmB,aAAA,IAAiB;AAAA,QAClE,sBAAA,CAAuB,GAAA;AAAA,QACvB,sBAAA,CAAuB;AAAA;AACxB,KACA,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,uBAAA,EAAyB;AAAA,MAC5C,KAAA,EAAO,KAAK,UAAA,CAAW;AAAA,KACvB,CAAA;AAAA,EACF;AACD","file":"lambda-authorizer-v2.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport {\n\tHttpLambdaAuthorizer,\n\tHttpLambdaAuthorizerProps,\n\tHttpLambdaResponseType,\n} from 'aws-cdk-lib/aws-apigatewayv2-authorizers';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaAuthoriserV2Construct\n *\n * Provides configuration for:\n * - HTTP API Lambda authorizer (API Gateway v2)\n * - Authorizer behaviour and identity sources\n */\ninterface ILambdaAuthoriserV2ConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** HTTP Lambda authorizer configuration options */\n\t\treadonly authorizerOptions: HttpLambdaAuthorizerProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda function used as the authorizer handler\n\t *\n\t * This function is invoked to validate incoming HTTP requests\n\t */\n\treadonly handlerFunction: Function;\n}\n\n/**\n * CDK construct for Lambda Authorizer (API Gateway v2 - HTTP API)\n *\n * Responsibilities:\n * - Creates an HTTP Lambda authorizer\n * - Applies default identity sources (Cookie and Authorization headers)\n * - Supports multiple response types (IAM and SIMPLE by default)\n * - Exposes the authorizer ID as a CloudFormation output\n */\nexport class BaseLambdaAuthoriserV2Construct extends Construct {\n\t/** The created HTTP Lambda Authorizer instance */\n\treadonly authoriser: HttpLambdaAuthorizer;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for authorizer and handler function\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: ILambdaAuthoriserV2ConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.authoriser = new HttpLambdaAuthorizer(id, props.handlerFunction, {\n\t\t\t...props?.options?.authorizerOptions,\n\n\t\t\t/**\n\t\t\t * Identity sources used to extract credentials from incoming requests\n\t\t\t * Defaults to Cookie and Authorization headers\n\t\t\t */\n\t\t\tidentitySource: [\n\t\t\t\t'$request.header.Cookie',\n\t\t\t\t'$request.header.Authorization',\n\t\t\t\t...props?.options?.authorizerOptions?.identitySource,\n\t\t\t],\n\n\t\t\t/**\n\t\t\t * Supported response types for the authorizer\n\t\t\t * Defaults to IAM and SIMPLE responses\n\t\t\t */\n\t\t\tresponseTypes: props?.options?.authorizerOptions?.responseTypes || [\n\t\t\t\tHttpLambdaResponseType.IAM,\n\t\t\t\tHttpLambdaResponseType.SIMPLE,\n\t\t\t],\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the authorizer ID\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaAuthorizerV2_ID', {\n\t\t\tvalue: this.authoriser.authorizerId,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var constructs = require('constructs');
4
+ var awsCdkLib = require('aws-cdk-lib');
5
+ var awsApigateway = require('aws-cdk-lib/aws-apigateway');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var BaseLambdaAuthoriserConstruct = class extends constructs.Construct {
10
+ static {
11
+ __name(this, "BaseLambdaAuthoriserConstruct");
12
+ }
13
+ /** The created Token Authorizer instance */
14
+ authoriser;
15
+ /**
16
+ * @param scope Parent construct
17
+ * @param id Unique construct identifier
18
+ * @param props Configuration for authorizer and handler function
19
+ */
20
+ constructor(scope, id, props) {
21
+ super(scope, id);
22
+ this.authoriser = new awsApigateway.TokenAuthorizer(this, id, {
23
+ ...props.options?.authorizerOptions,
24
+ /**
25
+ * Lambda handler responsible for request authorization
26
+ */
27
+ handler: props.handlerFunction
28
+ });
29
+ new awsCdkLib.CfnOutput(this, "LambdaAuthorizerArn", {
30
+ value: this.authoriser.authorizerArn
31
+ });
32
+ }
33
+ };
34
+
35
+ exports.BaseLambdaAuthoriserConstruct = BaseLambdaAuthoriserConstruct;
36
+ //# sourceMappingURL=lambda-authorizer.cjs.map
37
+ //# sourceMappingURL=lambda-authorizer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/aws/cdk/constructs/lambda-authorizer-construct.ts"],"names":["Construct","TokenAuthorizer","CfnOutput"],"mappings":";;;;;;;;AAwCO,IAAM,6BAAA,GAAN,cAA4CA,oBAAA,CAAU;AAAA,EAxC7D;AAwC6D,IAAA,MAAA,CAAA,IAAA,EAAA,+BAAA,CAAA;AAAA;AAAA;AAAA,EAEnD,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,UAAA,GAAa,IAAIC,6BAAA,CAAgB,IAAA,EAAM,EAAA,EAAI;AAAA,MAC/C,GAAG,MAAM,OAAA,EAAS,iBAAA;AAAA;AAAA;AAAA;AAAA,MAKlB,SAAS,KAAA,CAAM;AAAA,KACf,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,qBAAA,EAAuB;AAAA,MAC1C,KAAA,EAAO,KAAK,UAAA,CAAW;AAAA,KACvB,CAAA;AAAA,EACF;AACD","file":"lambda-authorizer.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport {\n\tTokenAuthorizer,\n\tTokenAuthorizerProps,\n} from 'aws-cdk-lib/aws-apigateway';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaAuthoriserConstruct\n *\n * Provides configuration for:\n * - Lambda token authorizer\n * - Authorizer behaviour and settings\n */\ninterface ILambdaAuthoriserConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Token authorizer configuration options */\n\t\treadonly authorizerOptions: TokenAuthorizerProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda function used as the authorizer handler\n\t *\n\t * This function is invoked to validate incoming requests\n\t */\n\treadonly handlerFunction: Function;\n}\n\n/**\n * CDK construct for Lambda Token Authorizer (API Gateway v1)\n *\n * Responsibilities:\n * - Creates a Token Authorizer backed by a Lambda function\n * - Applies optional configuration overrides\n * - Exposes the authorizer ARN as a CloudFormation output\n */\nexport class BaseLambdaAuthoriserConstruct extends Construct {\n\t/** The created Token Authorizer instance */\n\treadonly authoriser: TokenAuthorizer;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for authorizer and handler function\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: ILambdaAuthoriserConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.authoriser = new TokenAuthorizer(this, id, {\n\t\t\t...props.options?.authorizerOptions,\n\n\t\t\t/**\n\t\t\t * Lambda handler responsible for request authorization\n\t\t\t */\n\t\t\thandler: props.handlerFunction,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the authorizer ARN\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaAuthorizerArn', {\n\t\t\tvalue: this.authoriser.authorizerArn,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import { Construct } from 'constructs';
2
+ import { Function } from 'aws-cdk-lib/aws-lambda';
3
+ import { TokenAuthorizer, TokenAuthorizerProps } from 'aws-cdk-lib/aws-apigateway';
4
+ import { IBaseCdkConstructProps } from '../aws-types.cjs';
5
+ import '@incloodsolutions/toolkit';
6
+
7
+ /**
8
+ * Props for BaseLambdaAuthoriserConstruct
9
+ *
10
+ * Provides configuration for:
11
+ * - Lambda token authorizer
12
+ * - Authorizer behaviour and settings
13
+ */
14
+ interface ILambdaAuthoriserConstructProps extends Omit<IBaseCdkConstructProps<{
15
+ /** Token authorizer configuration options */
16
+ readonly authorizerOptions: TokenAuthorizerProps;
17
+ }>, 'appName' | 'stage' | 'stackName'> {
18
+ /**
19
+ * Lambda function used as the authorizer handler
20
+ *
21
+ * This function is invoked to validate incoming requests
22
+ */
23
+ readonly handlerFunction: Function;
24
+ }
25
+ /**
26
+ * CDK construct for Lambda Token Authorizer (API Gateway v1)
27
+ *
28
+ * Responsibilities:
29
+ * - Creates a Token Authorizer backed by a Lambda function
30
+ * - Applies optional configuration overrides
31
+ * - Exposes the authorizer ARN as a CloudFormation output
32
+ */
33
+ declare class BaseLambdaAuthoriserConstruct extends Construct {
34
+ /** The created Token Authorizer instance */
35
+ readonly authoriser: TokenAuthorizer;
36
+ /**
37
+ * @param scope Parent construct
38
+ * @param id Unique construct identifier
39
+ * @param props Configuration for authorizer and handler function
40
+ */
41
+ constructor(scope: Construct, id: string, props: ILambdaAuthoriserConstructProps);
42
+ }
43
+
44
+ export { BaseLambdaAuthoriserConstruct };