@incloodsolutions/devkit 0.0.4 → 0.0.5

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 (182) hide show
  1. package/README.md +40 -10
  2. package/dist/aws-cdk/constructs/api-gateway-v2.cjs.map +1 -0
  3. package/dist/aws-cdk/{api-gateway-v2.d.cts → constructs/api-gateway-v2.d.cts} +2 -1
  4. package/dist/aws-cdk/{api-gateway-v2.d.ts → constructs/api-gateway-v2.d.ts} +2 -1
  5. package/dist/aws-cdk/constructs/api-gateway-v2.js.map +1 -0
  6. package/dist/aws-cdk/constructs/api-gateway-websocket.cjs.map +1 -0
  7. package/dist/aws-cdk/{api-gateway-websocket.d.cts → constructs/api-gateway-websocket.d.cts} +2 -1
  8. package/dist/aws-cdk/{api-gateway-websocket.d.ts → constructs/api-gateway-websocket.d.ts} +2 -1
  9. package/dist/aws-cdk/constructs/api-gateway-websocket.js.map +1 -0
  10. package/dist/aws-cdk/constructs/api-gateway.cjs.map +1 -0
  11. package/dist/aws-cdk/{api-gateway.d.cts → constructs/api-gateway.d.cts} +2 -1
  12. package/dist/aws-cdk/{api-gateway.d.ts → constructs/api-gateway.d.ts} +2 -1
  13. package/dist/aws-cdk/constructs/api-gateway.js.map +1 -0
  14. package/dist/aws-cdk/constructs/cloudfront.cjs.map +1 -0
  15. package/dist/aws-cdk/{cloudfront.d.cts → constructs/cloudfront.d.cts} +2 -1
  16. package/dist/aws-cdk/{cloudfront.d.ts → constructs/cloudfront.d.ts} +2 -1
  17. package/dist/aws-cdk/constructs/cloudfront.js.map +1 -0
  18. package/dist/aws-cdk/constructs/cloudwatch.cjs.map +1 -0
  19. package/dist/aws-cdk/{cloudwatch.d.cts → constructs/cloudwatch.d.cts} +2 -1
  20. package/dist/aws-cdk/{cloudwatch.d.ts → constructs/cloudwatch.d.ts} +2 -1
  21. package/dist/aws-cdk/constructs/cloudwatch.js.map +1 -0
  22. package/dist/aws-cdk/constructs/dynamo-db.cjs.map +1 -0
  23. package/dist/aws-cdk/{dynamo-db.d.cts → constructs/dynamo-db.d.cts} +2 -1
  24. package/dist/aws-cdk/{dynamo-db.d.ts → constructs/dynamo-db.d.ts} +2 -1
  25. package/dist/aws-cdk/constructs/dynamo-db.js.map +1 -0
  26. package/dist/aws-cdk/constructs/event-bridge.cjs.map +1 -0
  27. package/dist/aws-cdk/{event-bridge.d.cts → constructs/event-bridge.d.cts} +2 -1
  28. package/dist/aws-cdk/{event-bridge.d.ts → constructs/event-bridge.d.ts} +2 -1
  29. package/dist/aws-cdk/constructs/event-bridge.js.map +1 -0
  30. package/dist/aws-cdk/constructs/lambda-authorizer-v2.cjs.map +1 -0
  31. package/dist/aws-cdk/{lambda-authorizer-v2.d.cts → constructs/lambda-authorizer-v2.d.cts} +2 -1
  32. package/dist/aws-cdk/{lambda-authorizer-v2.d.ts → constructs/lambda-authorizer-v2.d.ts} +2 -1
  33. package/dist/aws-cdk/constructs/lambda-authorizer-v2.js.map +1 -0
  34. package/dist/aws-cdk/constructs/lambda-authorizer.cjs.map +1 -0
  35. package/dist/aws-cdk/{lambda-authorizer.d.cts → constructs/lambda-authorizer.d.cts} +2 -1
  36. package/dist/aws-cdk/{lambda-authorizer.d.ts → constructs/lambda-authorizer.d.ts} +2 -1
  37. package/dist/aws-cdk/constructs/lambda-authorizer.js.map +1 -0
  38. package/dist/aws-cdk/constructs/lambda-layer.cjs.map +1 -0
  39. package/dist/aws-cdk/{lambda-layer.d.cts → constructs/lambda-layer.d.cts} +2 -1
  40. package/dist/aws-cdk/{lambda-layer.d.ts → constructs/lambda-layer.d.ts} +2 -1
  41. package/dist/aws-cdk/constructs/lambda-layer.js.map +1 -0
  42. package/dist/aws-cdk/{lambda.cjs → constructs/lambda.cjs} +2 -2
  43. package/dist/aws-cdk/constructs/lambda.cjs.map +1 -0
  44. package/dist/aws-cdk/{lambda.d.cts → constructs/lambda.d.cts} +2 -1
  45. package/dist/aws-cdk/{lambda.d.ts → constructs/lambda.d.ts} +2 -1
  46. package/dist/aws-cdk/{lambda.js → constructs/lambda.js} +2 -2
  47. package/dist/aws-cdk/constructs/lambda.js.map +1 -0
  48. package/dist/aws-cdk/constructs/role-policy.cjs.map +1 -0
  49. package/dist/aws-cdk/{role-policy.d.cts → constructs/role-policy.d.cts} +2 -1
  50. package/dist/aws-cdk/{role-policy.d.ts → constructs/role-policy.d.ts} +2 -1
  51. package/dist/aws-cdk/constructs/role-policy.js.map +1 -0
  52. package/dist/aws-cdk/constructs/route53.cjs +79 -0
  53. package/dist/aws-cdk/constructs/route53.cjs.map +1 -0
  54. package/dist/aws-cdk/constructs/route53.d.cts +95 -0
  55. package/dist/aws-cdk/constructs/route53.d.ts +95 -0
  56. package/dist/aws-cdk/constructs/route53.js +77 -0
  57. package/dist/aws-cdk/constructs/route53.js.map +1 -0
  58. package/dist/aws-cdk/constructs/s3-deployment.cjs.map +1 -0
  59. package/dist/aws-cdk/{s3-deployment.d.cts → constructs/s3-deployment.d.cts} +2 -1
  60. package/dist/aws-cdk/{s3-deployment.d.ts → constructs/s3-deployment.d.ts} +2 -1
  61. package/dist/aws-cdk/constructs/s3-deployment.js.map +1 -0
  62. package/dist/aws-cdk/constructs/s3.cjs.map +1 -0
  63. package/dist/aws-cdk/{s3.d.cts → constructs/s3.d.cts} +2 -1
  64. package/dist/aws-cdk/{s3.d.ts → constructs/s3.d.ts} +2 -1
  65. package/dist/aws-cdk/constructs/s3.js.map +1 -0
  66. package/dist/aws-cdk/constructs/sns.cjs.map +1 -0
  67. package/dist/aws-cdk/{sns.d.cts → constructs/sns.d.cts} +2 -1
  68. package/dist/aws-cdk/{sns.d.ts → constructs/sns.d.ts} +2 -1
  69. package/dist/aws-cdk/constructs/sns.js.map +1 -0
  70. package/dist/aws-cdk/constructs/sqs.cjs.map +1 -0
  71. package/dist/aws-cdk/{sqs.d.cts → constructs/sqs.d.cts} +2 -1
  72. package/dist/aws-cdk/{sqs.d.ts → constructs/sqs.d.ts} +2 -1
  73. package/dist/aws-cdk/constructs/sqs.js.map +1 -0
  74. package/dist/aws-cdk/constructs/vpc.cjs.map +1 -0
  75. package/dist/aws-cdk/{vpc.d.cts → constructs/vpc.d.cts} +2 -1
  76. package/dist/aws-cdk/{vpc.d.ts → constructs/vpc.d.ts} +2 -1
  77. package/dist/aws-cdk/constructs/vpc.js.map +1 -0
  78. package/dist/aws-cdk/stacks/lambda-api.cjs +252 -0
  79. package/dist/aws-cdk/stacks/lambda-api.cjs.map +1 -0
  80. package/dist/aws-cdk/stacks/lambda-api.d.cts +16 -0
  81. package/dist/aws-cdk/stacks/lambda-api.d.ts +16 -0
  82. package/dist/aws-cdk/stacks/lambda-api.js +250 -0
  83. package/dist/aws-cdk/stacks/lambda-api.js.map +1 -0
  84. package/dist/aws-cdk/stacks/lambda-sns.cjs +211 -0
  85. package/dist/aws-cdk/stacks/lambda-sns.cjs.map +1 -0
  86. package/dist/aws-cdk/stacks/lambda-sns.d.cts +17 -0
  87. package/dist/aws-cdk/stacks/lambda-sns.d.ts +17 -0
  88. package/dist/aws-cdk/stacks/lambda-sns.js +209 -0
  89. package/dist/aws-cdk/stacks/lambda-sns.js.map +1 -0
  90. package/dist/aws-cdk/stacks/lambda-sqs.cjs +220 -0
  91. package/dist/aws-cdk/stacks/lambda-sqs.cjs.map +1 -0
  92. package/dist/aws-cdk/stacks/lambda-sqs.d.cts +18 -0
  93. package/dist/aws-cdk/stacks/lambda-sqs.d.ts +18 -0
  94. package/dist/aws-cdk/stacks/lambda-sqs.js +218 -0
  95. package/dist/aws-cdk/stacks/lambda-sqs.js.map +1 -0
  96. package/dist/aws-types.d.cts +14 -1
  97. package/dist/aws-types.d.ts +14 -1
  98. package/dist/aws.cjs +199 -2
  99. package/dist/aws.cjs.map +1 -1
  100. package/dist/aws.d.cts +25 -19
  101. package/dist/aws.d.ts +25 -19
  102. package/dist/aws.js +198 -5
  103. package/dist/aws.js.map +1 -1
  104. package/dist/index.cjs +199 -2
  105. package/dist/index.cjs.map +1 -1
  106. package/dist/index.d.cts +24 -18
  107. package/dist/index.d.ts +24 -18
  108. package/dist/index.js +198 -5
  109. package/dist/index.js.map +1 -1
  110. package/package.json +130 -152
  111. package/dist/aws-cdk/api-gateway-v2.cjs.map +0 -1
  112. package/dist/aws-cdk/api-gateway-v2.js.map +0 -1
  113. package/dist/aws-cdk/api-gateway-websocket.cjs.map +0 -1
  114. package/dist/aws-cdk/api-gateway-websocket.js.map +0 -1
  115. package/dist/aws-cdk/api-gateway.cjs.map +0 -1
  116. package/dist/aws-cdk/api-gateway.js.map +0 -1
  117. package/dist/aws-cdk/cloudfront.cjs.map +0 -1
  118. package/dist/aws-cdk/cloudfront.js.map +0 -1
  119. package/dist/aws-cdk/cloudwatch.cjs.map +0 -1
  120. package/dist/aws-cdk/cloudwatch.js.map +0 -1
  121. package/dist/aws-cdk/dynamo-db.cjs.map +0 -1
  122. package/dist/aws-cdk/dynamo-db.js.map +0 -1
  123. package/dist/aws-cdk/event-bridge.cjs.map +0 -1
  124. package/dist/aws-cdk/event-bridge.js.map +0 -1
  125. package/dist/aws-cdk/lambda-authorizer-v2.cjs.map +0 -1
  126. package/dist/aws-cdk/lambda-authorizer-v2.js.map +0 -1
  127. package/dist/aws-cdk/lambda-authorizer.cjs.map +0 -1
  128. package/dist/aws-cdk/lambda-authorizer.js.map +0 -1
  129. package/dist/aws-cdk/lambda-layer.cjs.map +0 -1
  130. package/dist/aws-cdk/lambda-layer.js.map +0 -1
  131. package/dist/aws-cdk/lambda.cjs.map +0 -1
  132. package/dist/aws-cdk/lambda.js.map +0 -1
  133. package/dist/aws-cdk/role-policy.cjs.map +0 -1
  134. package/dist/aws-cdk/role-policy.js.map +0 -1
  135. package/dist/aws-cdk/s3-deployment.cjs.map +0 -1
  136. package/dist/aws-cdk/s3-deployment.js.map +0 -1
  137. package/dist/aws-cdk/s3.cjs.map +0 -1
  138. package/dist/aws-cdk/s3.js.map +0 -1
  139. package/dist/aws-cdk/sns.cjs.map +0 -1
  140. package/dist/aws-cdk/sns.js.map +0 -1
  141. package/dist/aws-cdk/sqs.cjs.map +0 -1
  142. package/dist/aws-cdk/sqs.js.map +0 -1
  143. package/dist/aws-cdk/vpc.cjs.map +0 -1
  144. package/dist/aws-cdk/vpc.js.map +0 -1
  145. package/dist/aws-cdk.cjs +0 -905
  146. package/dist/aws-cdk.cjs.map +0 -1
  147. package/dist/aws-cdk.d.cts +0 -34
  148. package/dist/aws-cdk.d.ts +0 -34
  149. package/dist/aws-cdk.js +0 -887
  150. package/dist/aws-cdk.js.map +0 -1
  151. /package/dist/aws-cdk/{api-gateway-v2.cjs → constructs/api-gateway-v2.cjs} +0 -0
  152. /package/dist/aws-cdk/{api-gateway-v2.js → constructs/api-gateway-v2.js} +0 -0
  153. /package/dist/aws-cdk/{api-gateway-websocket.cjs → constructs/api-gateway-websocket.cjs} +0 -0
  154. /package/dist/aws-cdk/{api-gateway-websocket.js → constructs/api-gateway-websocket.js} +0 -0
  155. /package/dist/aws-cdk/{api-gateway.cjs → constructs/api-gateway.cjs} +0 -0
  156. /package/dist/aws-cdk/{api-gateway.js → constructs/api-gateway.js} +0 -0
  157. /package/dist/aws-cdk/{cloudfront.cjs → constructs/cloudfront.cjs} +0 -0
  158. /package/dist/aws-cdk/{cloudfront.js → constructs/cloudfront.js} +0 -0
  159. /package/dist/aws-cdk/{cloudwatch.cjs → constructs/cloudwatch.cjs} +0 -0
  160. /package/dist/aws-cdk/{cloudwatch.js → constructs/cloudwatch.js} +0 -0
  161. /package/dist/aws-cdk/{dynamo-db.cjs → constructs/dynamo-db.cjs} +0 -0
  162. /package/dist/aws-cdk/{dynamo-db.js → constructs/dynamo-db.js} +0 -0
  163. /package/dist/aws-cdk/{event-bridge.cjs → constructs/event-bridge.cjs} +0 -0
  164. /package/dist/aws-cdk/{event-bridge.js → constructs/event-bridge.js} +0 -0
  165. /package/dist/aws-cdk/{lambda-authorizer-v2.cjs → constructs/lambda-authorizer-v2.cjs} +0 -0
  166. /package/dist/aws-cdk/{lambda-authorizer-v2.js → constructs/lambda-authorizer-v2.js} +0 -0
  167. /package/dist/aws-cdk/{lambda-authorizer.cjs → constructs/lambda-authorizer.cjs} +0 -0
  168. /package/dist/aws-cdk/{lambda-authorizer.js → constructs/lambda-authorizer.js} +0 -0
  169. /package/dist/aws-cdk/{lambda-layer.cjs → constructs/lambda-layer.cjs} +0 -0
  170. /package/dist/aws-cdk/{lambda-layer.js → constructs/lambda-layer.js} +0 -0
  171. /package/dist/aws-cdk/{role-policy.cjs → constructs/role-policy.cjs} +0 -0
  172. /package/dist/aws-cdk/{role-policy.js → constructs/role-policy.js} +0 -0
  173. /package/dist/aws-cdk/{s3-deployment.cjs → constructs/s3-deployment.cjs} +0 -0
  174. /package/dist/aws-cdk/{s3-deployment.js → constructs/s3-deployment.js} +0 -0
  175. /package/dist/aws-cdk/{s3.cjs → constructs/s3.cjs} +0 -0
  176. /package/dist/aws-cdk/{s3.js → constructs/s3.js} +0 -0
  177. /package/dist/aws-cdk/{sns.cjs → constructs/sns.cjs} +0 -0
  178. /package/dist/aws-cdk/{sns.js → constructs/sns.js} +0 -0
  179. /package/dist/aws-cdk/{sqs.cjs → constructs/sqs.cjs} +0 -0
  180. /package/dist/aws-cdk/{sqs.js → constructs/sqs.js} +0 -0
  181. /package/dist/aws-cdk/{vpc.cjs → constructs/vpc.cjs} +0 -0
  182. /package/dist/aws-cdk/{vpc.js → constructs/vpc.js} +0 -0
package/README.md CHANGED
@@ -50,20 +50,26 @@ The created resource is exposed as a public readonly field (`.function`, `.api`,
50
50
  ## Modular imports (tree-shaking)
51
51
 
52
52
  **There is no package-root import.** `import ... from '@incloodsolutions/devkit'` does not
53
- resolve — you must import a specific subpath. Every construct is published as its own
54
- subpath, so a stack that uses one construct does not bundle the code for all seventeen:
53
+ resolve — you must import a specific subpath. Every construct and every stack is published
54
+ as its own subpath, so using one does not bundle the other seventeen constructs or the
55
+ other two stacks. **There is also no "all constructs" or "all stacks" barrel** —
56
+ `.../aws-cdk`, `.../aws-cdk/constructs`, and `.../aws-cdk/stacks` do not resolve, on
57
+ purpose: each would silently re-bundle every construct or every stack the moment anyone
58
+ imported it. `.../aws` is the one deliberate exception — the "just give me everything"
59
+ escape hatch, documented as non-treeshaking.
55
60
 
56
61
  ```typescript
57
- import { BaseLambdaConstruct } from '@incloodsolutions/devkit/aws-cdk/lambda';
58
- import { BaseDynamoDBConstruct } from '@incloodsolutions/devkit/aws-cdk/dynamo-db';
62
+ import { BaseLambdaConstruct } from '@incloodsolutions/devkit/aws-cdk/constructs/lambda';
63
+ import { BaseDynamoDBConstruct } from '@incloodsolutions/devkit/aws-cdk/constructs/dynamo-db';
59
64
  import type { IBaseCdkConstructProps } from '@incloodsolutions/devkit/aws-types';
60
65
  ```
61
66
 
62
67
  | Subpath | Contents |
63
68
  | ------- | -------- |
64
- | `.../aws` · `.../aws-cdk` | all `Base*` constructs |
65
- | `.../aws-cdk/<name>` | one construct — `api-gateway`, `api-gateway-v2`, `api-gateway-websocket`, `cloudfront`, `cloudwatch`, `dynamo-db`, `event-bridge`, `lambda`, `lambda-authorizer`, `lambda-authorizer-v2`, `lambda-layer`, `role-policy`, `s3`, `s3-deployment`, `sns`, `sqs`, `vpc` |
66
- | `.../aws-types` | `IBaseConstruct`, `IBaseCdkConstructProps` |
69
+ | `.../aws` | everything: all `Base*` constructs and stacks + shared types (does not tree-shake) |
70
+ | `.../aws-cdk/constructs/<name>` | one construct — `api-gateway`, `api-gateway-v2`, `api-gateway-websocket`, `cloudfront`, `cloudwatch`, `dynamo-db`, `event-bridge`, `lambda`, `lambda-authorizer`, `lambda-authorizer-v2`, `lambda-layer`, `role-policy`, `route53`, `s3`, `s3-deployment`, `sns`, `sqs`, `vpc` |
71
+ | `.../aws-cdk/stacks/<name>` | one stack — `lambda-api`, `lambda-sns`, `lambda-sqs` |
72
+ | `.../aws-types` | `IBaseConstruct`, `IBaseCdkConstructProps`, `IBaseStackProps` |
67
73
 
68
74
  Every subpath resolves ESM (`import`), CommonJS (`require`), and its own `.d.ts`.
69
75
  `aws-cdk-lib` and `constructs` stay external in every bundle.
@@ -89,6 +95,29 @@ Every subpath resolves ESM (`import`), CommonJS (`require`), and its own `.d.ts`
89
95
  | `BaseEventBridgeConstruct` | `aws-events.Rule` | Rule with a Lambda target. |
90
96
  | `BaseVpcConstruct` | `aws-ec2.Vpc` | VPC with defaults. |
91
97
  | `BaseRolePolicyConstruct` | `aws-iam.Role` + `PolicyStatement` / `ManagedPolicy` | IAM role and policy helper. |
98
+ | `BaseRoute53Construct` | `aws-route53.HostedZone` + `ARecord` / `AaaaRecord` / `CnameRecord` / `TxtRecord` | Create, import (`fromExistingHostedZoneAttributes`), or look up (`fromLookupOptions`) a hosted zone — exactly one required. Optional `aRecords` / `aaaaRecords` / `cnameRecords` / `txtRecords` arrays attach records to it. Exposes `.hostedZone`. |
99
+
100
+ ## Stacks
101
+
102
+ Ready-made `Stack` subclasses that wire a few constructs together. Props are based on
103
+ `IBaseStackProps<TStackOptions>` — a regular CDK `StackProps` plus a required
104
+ `stackOptions` bag (`stage`, `enableDebug`, and the stack's own options).
105
+
106
+ | Stack | Source file | Wires together |
107
+ | ----- | ----------- | --------------- |
108
+ | `BaseLambdaApiStack` | `lambda-api-stack.ts` | `BaseLambdaConstruct` (+ optional imported layer) behind `BaseApiGatewayV2Construct` (`/{proxy+}`, any method). |
109
+ | `BaseLambdaSnsStack` | `lambda-sns-stack.ts` | `BaseLambdaConstruct` subscribed to a `BaseSnsConstruct` topic. |
110
+ | `BaseLambdaSqsStack` | `lambda-sqs-stack.ts` | `BaseLambdaConstruct` as the target of a `BaseSqsConstruct` queue. |
111
+
112
+ ```typescript
113
+ import { App } from 'aws-cdk-lib';
114
+ import { BaseLambdaApiStack } from '@incloodsolutions/devkit/aws-cdk/stacks/lambda-api';
115
+
116
+ const app = new App();
117
+ new BaseLambdaApiStack(app, 'OrdersApi', {
118
+ stackOptions: { stage: 'production' },
119
+ });
120
+ ```
92
121
 
93
122
  ## Types
94
123
 
@@ -96,15 +125,16 @@ Every subpath resolves ESM (`import`), CommonJS (`require`), and its own `.d.ts`
96
125
  | ------ | ------- |
97
126
  | `IBaseConstruct` | extends `IBaseEnableDebug`. |
98
127
  | `IBaseCdkConstructProps<TOptions>` | shared construct props (see above). |
128
+ | `IBaseStackProps<TStackOptions>` | shared stack props: CDK `StackProps` + a required `stackOptions: { stage?; enableDebug? } & TStackOptions`. |
99
129
 
100
130
  ## Usage
101
131
 
102
132
  ```typescript
103
133
  import { Stack, StackProps } from 'aws-cdk-lib';
104
134
  import { Construct } from 'constructs';
105
- import { BaseLambdaConstruct } from '@incloodsolutions/devkit/aws-cdk/lambda';
106
- import { BaseApiGatewayV2Construct } from '@incloodsolutions/devkit/aws-cdk/api-gateway-v2';
107
- import { BaseDynamoDBConstruct } from '@incloodsolutions/devkit/aws-cdk/dynamo-db';
135
+ import { BaseLambdaConstruct } from '@incloodsolutions/devkit/aws-cdk/constructs/lambda';
136
+ import { BaseApiGatewayV2Construct } from '@incloodsolutions/devkit/aws-cdk/constructs/api-gateway-v2';
137
+ import { BaseDynamoDBConstruct } from '@incloodsolutions/devkit/aws-cdk/constructs/dynamo-db';
108
138
 
109
139
  export class ApiStack extends Stack {
110
140
  constructor(scope: Construct, id: string, props?: StackProps) {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-v2-construct.ts"],"names":["Construct","HttpApi","CorsHttpMethod","CustomException","HttpLambdaIntegration","RemovalPolicy","CfnOutput"],"mappings":";;;;;;;;;;AAsDO,IAAM,yBAAA,GAAN,cACEA,oBAAA,CAET;AAAA,EAzDA;AAyDA,IAAA,MAAA,CAAA,IAAA,EAAA,2BAAA,CAAA;AAAA;AAAA;AAAA,EAEU,GAAA;AAAA;AAAA,EAGT,WAAA,GAAc,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OA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AAU,WAAW;AAAA,WACxC,CAAA;AAAA,QACtB,CAAC,CAAA;AAAA,MACF,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,GAAA,CAAI,kBAAA,CAAmBC,uBAAA,CAAc,OAAO,CAAA;AAKjD,IAAA,IAAIC,mBAAA,CAAU,MAAM,cAAA,EAAgB;AAAA,MACnC,KAAA,EAAO,KAAK,GAAA,CAAI;AAAA,KAChB,CAAA;AAAA,EACF;AACD","file":"api-gateway-v2.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { HttpLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';\nimport {\n\tAddRoutesOptions,\n\tCorsHttpMethod,\n\tHttpApi,\n\tHttpApiProps,\n} from 'aws-cdk-lib/aws-apigatewayv2';\n\nimport { CustomException } from '@incloodsolutions/toolkit';\nimport { IBaseCdkConstructProps, IBaseConstruct } from '../../types';\n\n/**\n * Properties for configuring the API Gateway v2 construct\n *\n * Extends base CDK construct props and provides configuration for:\n * - HTTP API (Api Gateway v2)\n * - Route definitions\n * - Lambda handlers\n */\ninterface IApiGatewayV2ConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** HTTP API configuration options */\n\t\treadonly gatewayOptions: HttpApiProps;\n\n\t\t/** Route definitions passed directly to `addRoutes` */\n\t\treadonly routeOptions: Partial<AddRoutesOptions>[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda functions used as route handlers\n\t *\n\t * Note:\n\t * Each handler is paired with each route during route creation\n\t */\n\treadonly handlerFunctions: Function[];\n}\n\n/**\n * CDK construct for creating an API Gateway v2 (HTTP API)\n *\n * Responsibilities:\n * - Creates an HTTP API with optional custom configuration\n * - Applies default CORS configuration when not provided\n * - Attaches routes with Lambda integrations\n * - Exposes API URL as a CloudFormation output\n *\n * Behaviour:\n * - Each route is registered for every provided handler function\n * - Throws if no handler functions are supplied\n */\nexport class BaseApiGatewayV2Construct\n\textends Construct\n\timplements IBaseConstruct\n{\n\t/** The created HTTP API instance */\n\treadonly api: HttpApi;\n\n\t/** Enables debug logging (if used externally) */\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 API, routes, and handlers\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IApiGatewayV2ConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.enableDebug = props.enableDebug;\n\n\t\tthis.api = new HttpApi(this, id, {\n\t\t\t...props?.options?.gatewayOptions,\n\n\t\t\t/** Default API description if not provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.gatewayOptions?.description ||\n\t\t\t\t'This is an Http API using CDK',\n\n\t\t\t/**\n\t\t\t * CORS configuration\n\t\t\t * Falls back to allowing all methods and standard headers if not explicitly defined\n\t\t\t */\n\t\t\tcorsPreflight: {\n\t\t\t\t...props.options?.gatewayOptions?.corsPreflight,\n\n\t\t\t\t/** Allow all HTTP methods by default */\n\t\t\t\tallowMethods:\n\t\t\t\t\tprops.options?.gatewayOptions?.corsPreflight?.allowMethods ||\n\t\t\t\t\tObject.values(CorsHttpMethod),\n\n\t\t\t\t/** Merge default headers with user-defined headers */\n\t\t\t\tallowHeaders: [\n\t\t\t\t\t'Content-Type',\n\t\t\t\t\t'Accept',\n\t\t\t\t\t'X-Amz-Date',\n\t\t\t\t\t'Authorization',\n\t\t\t\t\t'X-Api-Key',\n\t\t\t\t\t'X-Amz-Security-Token',\n\t\t\t\t\t'X-Amz-User-Agent',\n\t\t\t\t\t...(props.options?.gatewayOptions?.corsPreflight?.allowHeaders || []),\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * Ensure at least one handler function is provided\n\t\t */\n\t\tif (!props?.handlerFunctions?.length) {\n\t\t\tthrow new CustomException('Construct requires atleast one function');\n\t\t}\n\n\t\t/**\n\t\t * Register routes with Lambda integrations\n\t\t */\n\t\tif (props?.options?.routeOptions?.length) {\n\t\t\tprops.handlerFunctions.forEach((handlerFunc) => {\n\t\t\t\tprops?.options?.routeOptions.forEach((route) => {\n\t\t\t\t\tthis.api.addRoutes({\n\t\t\t\t\t\t...route,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Lambda integration for each route\n\t\t\t\t\t\t */\n\t\t\t\t\t\tintegration: new HttpLambdaIntegration('routes', handlerFunc),\n\t\t\t\t\t} as AddRoutesOptions);\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.api.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the API base URL\n\t\t */\n\t\tnew CfnOutput(this, 'ApiGatewayV2', {\n\t\t\tvalue: this.api.url,\n\t\t});\n\t}\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpApi, HttpApiProps, AddRoutesOptions } from 'aws-cdk-lib/aws-apigatewayv2';
4
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.cjs';
4
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.cjs';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Properties for configuring the API Gateway v2 construct
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpApi, HttpApiProps, AddRoutesOptions } from 'aws-cdk-lib/aws-apigatewayv2';
4
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.js';
4
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.js';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Properties for configuring the API Gateway v2 construct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-v2-construct.ts"],"names":[],"mappings":";;;;;;;;AAsDO,IAAM,yBAAA,GAAN,cACE,SAAA,CAET;AAAA,EAzDA;AAyDA,IAAA,MAAA,CAAA,IAAA,EAAA,2BAAA,CAAA;AAAA;AAAA;AAAA,EAEU,GAAA;AAAA;AAAA,EAGT,WAAA,GAAc,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,cAAc,KAAA,CAAM,WAAA;AAEzB,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,OAAA,CAAQ,IAAA,EAAM,EAAA,EAAI;AAAA,MAChC,GAAG,OAAO,OAAA,EAAS,cAAA;AAAA;AAAA,MAGnB,WAAA,EACC,KAAA,EAAO,OAAA,EAAS,cAAA,EAAgB,WAAA,IAChC,+BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMD,aAAA,EAAe;AAAA,QACd,GAAG,KAAA,CAAM,OAAA,EAAS,cAAA,EAAgB,aAAA;AAAA;AAAA,QAGlC,YAAA,EACC,MAAM,OAAA,EAAS,cAAA,EAAgB,eAAe,YAAA,IAC9C,MAAA,CAAO,OAAO,cAAc,CAAA;AAAA;AAAA,QAG7B,YAAA,EAAc;AAAA,UACb,cAAA;AAAA,UACA,QAAA;AAAA,UACA,YAAA;AAAA,UACA,eAAA;AAAA,UACA,WAAA;AAAA,UACA,sBAAA;AAAA,UACA,kBAAA;AAAA,UACA,GAAI,KAAA,CAAM,OAAA,EAAS,cAAA,EAAgB,aAAA,EAAe,gBAAgB;AAAC;AACpE;AACD,KACA,CAAA;AAKD,IAAA,IAAI,CAAC,KAAA,EAAO,gBAAA,EAAkB,MAAA,EAAQ;AACrC,MAAA,MAAM,IAAI,gBAAgB,yCAAyC,CAAA;AAAA,IACpE;AAKA,IAAA,IAAI,KAAA,EAAO,OAAA,EAAS,YAAA,EAAc,MAAA,EAAQ;AACzC,MAAA,KAAA,CAAM,gBAAA,CAAiB,OAAA,CAAQ,CAAC,WAAA,KAAgB;AAC/C,QAAA,KAAA,EAAO,OAAA,EAAS,YAAA,CAAa,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC/C,UAAA,IAAA,CAAK,IAAI,SAAA,CAAU;AAAA,YAClB,GAAG,KAAA;AAAA;AAAA;AAAA;AAAA,YAKH,WAAA,EAAa,IAAI,qBAAA,CAAsB,QAAA,EAAU,WAAW;AAAA,WACxC,CAAA;AAAA,QACtB,CAAC,CAAA;AAAA,MACF,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,GAAA,CAAI,kBAAA,CAAmB,aAAA,CAAc,OAAO,CAAA;AAKjD,IAAA,IAAI,SAAA,CAAU,MAAM,cAAA,EAAgB;AAAA,MACnC,KAAA,EAAO,KAAK,GAAA,CAAI;AAAA,KAChB,CAAA;AAAA,EACF;AACD","file":"api-gateway-v2.js","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { HttpLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';\nimport {\n\tAddRoutesOptions,\n\tCorsHttpMethod,\n\tHttpApi,\n\tHttpApiProps,\n} from 'aws-cdk-lib/aws-apigatewayv2';\n\nimport { CustomException } from '@incloodsolutions/toolkit';\nimport { IBaseCdkConstructProps, IBaseConstruct } from '../../types';\n\n/**\n * Properties for configuring the API Gateway v2 construct\n *\n * Extends base CDK construct props and provides configuration for:\n * - HTTP API (Api Gateway v2)\n * - Route definitions\n * - Lambda handlers\n */\ninterface IApiGatewayV2ConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** HTTP API configuration options */\n\t\treadonly gatewayOptions: HttpApiProps;\n\n\t\t/** Route definitions passed directly to `addRoutes` */\n\t\treadonly routeOptions: Partial<AddRoutesOptions>[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda functions used as route handlers\n\t *\n\t * Note:\n\t * Each handler is paired with each route during route creation\n\t */\n\treadonly handlerFunctions: Function[];\n}\n\n/**\n * CDK construct for creating an API Gateway v2 (HTTP API)\n *\n * Responsibilities:\n * - Creates an HTTP API with optional custom configuration\n * - Applies default CORS configuration when not provided\n * - Attaches routes with Lambda integrations\n * - Exposes API URL as a CloudFormation output\n *\n * Behaviour:\n * - Each route is registered for every provided handler function\n * - Throws if no handler functions are supplied\n */\nexport class BaseApiGatewayV2Construct\n\textends Construct\n\timplements IBaseConstruct\n{\n\t/** The created HTTP API instance */\n\treadonly api: HttpApi;\n\n\t/** Enables debug logging (if used externally) */\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 API, routes, and handlers\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IApiGatewayV2ConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.enableDebug = props.enableDebug;\n\n\t\tthis.api = new HttpApi(this, id, {\n\t\t\t...props?.options?.gatewayOptions,\n\n\t\t\t/** Default API description if not provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.gatewayOptions?.description ||\n\t\t\t\t'This is an Http API using CDK',\n\n\t\t\t/**\n\t\t\t * CORS configuration\n\t\t\t * Falls back to allowing all methods and standard headers if not explicitly defined\n\t\t\t */\n\t\t\tcorsPreflight: {\n\t\t\t\t...props.options?.gatewayOptions?.corsPreflight,\n\n\t\t\t\t/** Allow all HTTP methods by default */\n\t\t\t\tallowMethods:\n\t\t\t\t\tprops.options?.gatewayOptions?.corsPreflight?.allowMethods ||\n\t\t\t\t\tObject.values(CorsHttpMethod),\n\n\t\t\t\t/** Merge default headers with user-defined headers */\n\t\t\t\tallowHeaders: [\n\t\t\t\t\t'Content-Type',\n\t\t\t\t\t'Accept',\n\t\t\t\t\t'X-Amz-Date',\n\t\t\t\t\t'Authorization',\n\t\t\t\t\t'X-Api-Key',\n\t\t\t\t\t'X-Amz-Security-Token',\n\t\t\t\t\t'X-Amz-User-Agent',\n\t\t\t\t\t...(props.options?.gatewayOptions?.corsPreflight?.allowHeaders || []),\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * Ensure at least one handler function is provided\n\t\t */\n\t\tif (!props?.handlerFunctions?.length) {\n\t\t\tthrow new CustomException('Construct requires atleast one function');\n\t\t}\n\n\t\t/**\n\t\t * Register routes with Lambda integrations\n\t\t */\n\t\tif (props?.options?.routeOptions?.length) {\n\t\t\tprops.handlerFunctions.forEach((handlerFunc) => {\n\t\t\t\tprops?.options?.routeOptions.forEach((route) => {\n\t\t\t\t\tthis.api.addRoutes({\n\t\t\t\t\t\t...route,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Lambda integration for each route\n\t\t\t\t\t\t */\n\t\t\t\t\t\tintegration: new HttpLambdaIntegration('routes', handlerFunc),\n\t\t\t\t\t} as AddRoutesOptions);\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.api.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the API base URL\n\t\t */\n\t\tnew CfnOutput(this, 'ApiGatewayV2', {\n\t\t\tvalue: this.api.url,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-websocket-construct.ts"],"names":["Construct","WebSocketApi","WebSocketLambdaIntegration","WebSocketStage","CfnOutput"],"mappings":";;;;;;;;;AA6EO,IAAM,gCAAA,GAAN,cAA+CA,oBAAA,CAAU;AAAA,EA7EhE;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AA;AAMD,IAAA,MAAM,iBAAiB,IAAIC,8BAAA,CAAe,IAAA,EAAM,CAAA,EAAG,EAAE,CAAA,MAAA,CAAA,EAAU;AAAA,MAC9D,GAAG,MAAM,OAAA,EAAS,qBAAA;AAAA,MAClB,cAAc,IAAA,CAAK,SAAA;AAAA,MACnB,UAAA,EAAY;AAAA,KACZ,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,cAAA,EAAgB;AAAA,MACnC,OAAO,cAAA,CAAe;AAAA,KACtB,CAAA;AAAA,EACF;AACD","file":"api-gateway-websocket.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { WebSocketLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';\nimport {\n\tWebSocketApi,\n\tWebSocketApiProps,\n\tWebSocketRouteOptions,\n\tWebSocketStage,\n\tWebSocketStageProps,\n} from 'aws-cdk-lib/aws-apigatewayv2';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseApiGatewayWebSocketConstruct\n *\n * Provides configuration for:\n * - WebSocket API (API Gateway v2)\n * - WebSocket stage\n * - Route handlers for lifecycle events\n */\ninterface IApiGatewayWebsocketConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** WebSocket API configuration options */\n\t\treadonly webSocketApiOptions: WebSocketApiProps;\n\n\t\t/** WebSocket stage configuration options */\n\t\treadonly webSocketStageOptions: WebSocketStageProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda handlers mapped to WebSocket lifecycle routes\n\t *\n\t * Includes:\n\t * - $connect\n\t * - $disconnect\n\t * - $default\n\t * - custom message route\n\t */\n\treadonly handlers: {\n\t\t/** Handler for connection establishment ($connect) */\n\t\treadonly connect: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for unmatched routes ($default) */\n\t\treadonly default: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for custom message route (e.g. 'notifications') */\n\t\treadonly message: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for disconnection events ($disconnect) */\n\t\treadonly disconnect: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\t};\n}\n\n/**\n * CDK construct for WebSocket API Gateway\n *\n * Responsibilities:\n * - Creates a WebSocket API with lifecycle route integrations\n * - Registers a custom message route\n * - Deploys a stage with auto-deploy enabled\n * - Exposes WebSocket endpoint URL as a CloudFormation output\n */\nexport class BaseApiGatewayWebSocketConstruct extends Construct {\n\t/** The created WebSocket API instance */\n\treadonly socketApi: WebSocketApi;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for API, stage, and route handlers\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IApiGatewayWebsocketConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.socketApi = new WebSocketApi(this, id, {\n\t\t\t...props.options.webSocketApiOptions,\n\n\t\t\t/**\n\t\t\t * Route for connection establishment ($connect)\n\t\t\t */\n\t\t\tconnectRouteOptions: {\n\t\t\t\t...props.handlers.connect?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'connectIntegration',\n\t\t\t\t\tprops.handlers.connect.function,\n\t\t\t\t),\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Route for disconnection events ($disconnect)\n\t\t\t */\n\t\t\tdisconnectRouteOptions: {\n\t\t\t\t...props.handlers.disconnect?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'disconnectIntegration',\n\t\t\t\t\tprops.handlers.disconnect.function,\n\t\t\t\t),\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Default route for unmatched messages ($default)\n\t\t\t */\n\t\t\tdefaultRouteOptions: {\n\t\t\t\t...props.handlers.default?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'defaultIntegration',\n\t\t\t\t\tprops.handlers.default.function,\n\t\t\t\t),\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * Custom message route (e.g. \"notifications\")\n\t\t */\n\t\tthis.socketApi.addRoute('notifications', {\n\t\t\t...props.handlers.message?.option,\n\n\t\t\t/** Lambda integration for message handling */\n\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t'routes',\n\t\t\t\tprops.handlers.message.function,\n\t\t\t),\n\t\t});\n\n\t\t/**\n\t\t * WebSocket stage deployment\n\t\t * Auto-deploy ensures changes are immediately available\n\t\t */\n\t\tconst webSocketStage = new WebSocketStage(this, `${id}_stage`, {\n\t\t\t...props.options?.webSocketStageOptions,\n\t\t\twebSocketApi: this.socketApi,\n\t\t\tautoDeploy: true,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing WebSocket endpoint URL\n\t\t */\n\t\tnew CfnOutput(this, 'WebSocketURL', {\n\t\t\tvalue: webSocketStage.url,\n\t\t});\n\t}\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { WebSocketApi, WebSocketApiProps, WebSocketStageProps, WebSocketRouteOptions } from 'aws-cdk-lib/aws-apigatewayv2';
4
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseApiGatewayWebSocketConstruct
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { WebSocketApi, WebSocketApiProps, WebSocketStageProps, WebSocketRouteOptions } from 'aws-cdk-lib/aws-apigatewayv2';
4
- import { IBaseCdkConstructProps } from '../aws-types.js';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseApiGatewayWebSocketConstruct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-websocket-construct.ts"],"names":[],"mappings":";;;;;;;AA6EO,IAAM,gCAAA,GAAN,cAA+C,SAAA,CAAU;AAAA,EA7EhE;AA6EgE,IAAA,MAAA,CAAA,IAAA,EAAA,kCAAA,CAAA;AAAA;AAAA;AAAA,EAEtD,SAAA;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,SAAA,GAAY,IAAI,YAAA,CAAa,IAAA,EAAM,EAAA,EAAI;AAAA,MAC3C,GAAG,MAAM,OAAA,CAAQ,mBAAA;AAAA;AAAA;AAAA;AAAA,MAKjB,mBAAA,EAAqB;AAAA,QACpB,GAAG,KAAA,CAAM,QAAA,CAAS,OAAA,EAAS,MAAA;AAAA,QAC3B,aAAa,IAAI,0BAAA;AAAA,UAChB,oBAAA;AAAA,UACA,KAAA,CAAM,SAAS,OAAA,CAAQ;AAAA;AACxB,OACD;AAAA;AAAA;AAAA;AAAA,MAKA,sBAAA,EAAwB;AAAA,QACvB,GAAG,KAAA,CAAM,QAAA,CAAS,UAAA,EAAY,MAAA;AAAA,QAC9B,aAAa,IAAI,0BAAA;AAAA,UAChB,uBAAA;AAAA,UACA,KAAA,CAAM,SAAS,UAAA,CAAW;AAAA;AAC3B,OACD;AAAA;AAAA;AAAA;AAAA,MAKA,mBAAA,EAAqB;AAAA,QACpB,GAAG,KAAA,CAAM,QAAA,CAAS,OAAA,EAAS,MAAA;AAAA,QAC3B,aAAa,IAAI,0BAAA;AAAA,UAChB,oBAAA;AAAA,UACA,KAAA,CAAM,SAAS,OAAA,CAAQ;AAAA;AACxB;AACD,KACA,CAAA;AAKD,IAAA,IAAA,CAAK,SAAA,CAAU,SAAS,eAAA,EAAiB;AAAA,MACxC,GAAG,KAAA,CAAM,QAAA,CAAS,OAAA,EAAS,MAAA;AAAA;AAAA,MAG3B,aAAa,IAAI,0BAAA;AAAA,QAChB,QAAA;AAAA,QACA,KAAA,CAAM,SAAS,OAAA,CAAQ;AAAA;AACxB,KACA,CAAA;AAMD,IAAA,MAAM,iBAAiB,IAAI,cAAA,CAAe,IAAA,EAAM,CAAA,EAAG,EAAE,CAAA,MAAA,CAAA,EAAU;AAAA,MAC9D,GAAG,MAAM,OAAA,EAAS,qBAAA;AAAA,MAClB,cAAc,IAAA,CAAK,SAAA;AAAA,MACnB,UAAA,EAAY;AAAA,KACZ,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,cAAA,EAAgB;AAAA,MACnC,OAAO,cAAA,CAAe;AAAA,KACtB,CAAA;AAAA,EACF;AACD","file":"api-gateway-websocket.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { WebSocketLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';\nimport {\n\tWebSocketApi,\n\tWebSocketApiProps,\n\tWebSocketRouteOptions,\n\tWebSocketStage,\n\tWebSocketStageProps,\n} from 'aws-cdk-lib/aws-apigatewayv2';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseApiGatewayWebSocketConstruct\n *\n * Provides configuration for:\n * - WebSocket API (API Gateway v2)\n * - WebSocket stage\n * - Route handlers for lifecycle events\n */\ninterface IApiGatewayWebsocketConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** WebSocket API configuration options */\n\t\treadonly webSocketApiOptions: WebSocketApiProps;\n\n\t\t/** WebSocket stage configuration options */\n\t\treadonly webSocketStageOptions: WebSocketStageProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda handlers mapped to WebSocket lifecycle routes\n\t *\n\t * Includes:\n\t * - $connect\n\t * - $disconnect\n\t * - $default\n\t * - custom message route\n\t */\n\treadonly handlers: {\n\t\t/** Handler for connection establishment ($connect) */\n\t\treadonly connect: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for unmatched routes ($default) */\n\t\treadonly default: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for custom message route (e.g. 'notifications') */\n\t\treadonly message: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\n\t\t/** Handler for disconnection events ($disconnect) */\n\t\treadonly disconnect: {\n\t\t\toption: WebSocketRouteOptions;\n\t\t\tfunction: Function;\n\t\t};\n\t};\n}\n\n/**\n * CDK construct for WebSocket API Gateway\n *\n * Responsibilities:\n * - Creates a WebSocket API with lifecycle route integrations\n * - Registers a custom message route\n * - Deploys a stage with auto-deploy enabled\n * - Exposes WebSocket endpoint URL as a CloudFormation output\n */\nexport class BaseApiGatewayWebSocketConstruct extends Construct {\n\t/** The created WebSocket API instance */\n\treadonly socketApi: WebSocketApi;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for API, stage, and route handlers\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IApiGatewayWebsocketConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.socketApi = new WebSocketApi(this, id, {\n\t\t\t...props.options.webSocketApiOptions,\n\n\t\t\t/**\n\t\t\t * Route for connection establishment ($connect)\n\t\t\t */\n\t\t\tconnectRouteOptions: {\n\t\t\t\t...props.handlers.connect?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'connectIntegration',\n\t\t\t\t\tprops.handlers.connect.function,\n\t\t\t\t),\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Route for disconnection events ($disconnect)\n\t\t\t */\n\t\t\tdisconnectRouteOptions: {\n\t\t\t\t...props.handlers.disconnect?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'disconnectIntegration',\n\t\t\t\t\tprops.handlers.disconnect.function,\n\t\t\t\t),\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Default route for unmatched messages ($default)\n\t\t\t */\n\t\t\tdefaultRouteOptions: {\n\t\t\t\t...props.handlers.default?.option,\n\t\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t\t'defaultIntegration',\n\t\t\t\t\tprops.handlers.default.function,\n\t\t\t\t),\n\t\t\t},\n\t\t});\n\n\t\t/**\n\t\t * Custom message route (e.g. \"notifications\")\n\t\t */\n\t\tthis.socketApi.addRoute('notifications', {\n\t\t\t...props.handlers.message?.option,\n\n\t\t\t/** Lambda integration for message handling */\n\t\t\tintegration: new WebSocketLambdaIntegration(\n\t\t\t\t'routes',\n\t\t\t\tprops.handlers.message.function,\n\t\t\t),\n\t\t});\n\n\t\t/**\n\t\t * WebSocket stage deployment\n\t\t * Auto-deploy ensures changes are immediately available\n\t\t */\n\t\tconst webSocketStage = new WebSocketStage(this, `${id}_stage`, {\n\t\t\t...props.options?.webSocketStageOptions,\n\t\t\twebSocketApi: this.socketApi,\n\t\t\tautoDeploy: true,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing WebSocket endpoint URL\n\t\t */\n\t\tnew CfnOutput(this, 'WebSocketURL', {\n\t\t\tvalue: webSocketStage.url,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-construct.ts"],"names":["Construct","RestApi","Cors","Size","LambdaIntegration","RemovalPolicy","CfnOutput","printLog"],"mappings":";;;;;;;;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B,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI,WAAW,CAAA;AAAA,SAC9C;AAAA,MACD;AAAA,IACD,CAAC,CAAA;AAAA,EACF;AACD","file":"api-gateway.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { HttpMethod } from 'aws-cdk-lib/aws-apigatewayv2';\nimport { CfnOutput, RemovalPolicy, Size } from 'aws-cdk-lib';\nimport {\n\tCors,\n\tIResource,\n\tLambdaIntegration,\n\tRestApi,\n\tRestApiProps,\n} from 'aws-cdk-lib/aws-apigateway';\n\nimport { printLog } from '@incloodsolutions/toolkit';\n\nimport { IBaseCdkConstructProps, IBaseConstruct } from '../../types';\n\n/**\n * Route definition for API Gateway resources\n *\n * Supports hierarchical route structures using `children`\n */\ninterface IRouteOption {\n\t/** Path segment (e.g. 'users', 'orders') */\n\tname: string;\n\n\t/** HTTP method for the route */\n\tmethod: `${HttpMethod}`;\n\n\t/** Nested routes under this path */\n\tchildren?: IRouteOption[];\n}\n\n/**\n * Props for BaseApiGatewayConstruct\n *\n * Provides configuration for:\n * - REST API (API Gateway v1)\n * - Route definitions\n * - Lambda handler\n */\ninterface IApiGatewayConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** REST API configuration options */\n\t\treadonly gatewayOptions: RestApiProps;\n\n\t\t/** Route definitions used to build API resources */\n\t\treadonly routeOptions: IRouteOption[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda function handling all API routes\n\t *\n\t * Note:\n\t * A single Lambda integration is reused across all routes\n\t */\n\treadonly handlerFunction: Function;\n}\n\n/**\n * CDK construct for REST API Gateway with Lambda integration\n *\n * Responsibilities:\n * - Creates a REST API with configurable options\n * - Applies default CORS and compression settings when not provided\n * - Recursively builds API resources from route definitions\n * - Exposes API base URL as a CloudFormation output\n */\nexport class BaseApiGatewayConstruct\n\textends Construct\n\timplements IBaseConstruct\n{\n\t/** The created REST API instance */\n\treadonly api: RestApi;\n\n\t/** Enables debug logging for route creation */\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 API, routes, and Lambda handler\n\t */\n\tconstructor(scope: Construct, id: string, props: IApiGatewayConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.enableDebug = props.enableDebug;\n\n\t\tthis.api = new RestApi(this, id, {\n\t\t\t...props?.options?.gatewayOptions,\n\n\t\t\t/** Default API description if not provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.gatewayOptions?.description ||\n\t\t\t\t'This is a REST API using CDK',\n\n\t\t\t/**\n\t\t\t * CORS configuration\n\t\t\t * Falls back to allowing all origins, methods, and standard headers\n\t\t\t */\n\t\t\tdefaultCorsPreflightOptions: {\n\t\t\t\t...props?.options?.gatewayOptions?.defaultCorsPreflightOptions,\n\n\t\t\t\t/** Allow all origins by default */\n\t\t\t\tallowOrigins:\n\t\t\t\t\tprops?.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowOrigins || Cors.ALL_ORIGINS,\n\n\t\t\t\t/** Allow all HTTP methods by default */\n\t\t\t\tallowMethods:\n\t\t\t\t\tprops?.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowMethods || Cors.ALL_METHODS,\n\n\t\t\t\t/** Merge default headers with user-defined headers */\n\t\t\t\tallowHeaders: [\n\t\t\t\t\t...props.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowHeaders,\n\t\t\t\t\t'Content-Type',\n\t\t\t\t\t'Accept',\n\t\t\t\t\t'X-Amz-Date',\n\t\t\t\t\t'Authorization',\n\t\t\t\t\t'X-Api-Key',\n\t\t\t\t\t'X-Amz-Security-Token',\n\t\t\t\t\t'X-Amz-User-Agent',\n\t\t\t\t],\n\t\t\t},\n\n\t\t\t/** Minimum payload size (in bytes) before compression is applied */\n\t\t\tminCompressionSize:\n\t\t\t\tprops?.options?.gatewayOptions?.minCompressionSize || Size.bytes(1),\n\t\t});\n\n\t\t/**\n\t\t * Register routes if provided\n\t\t */\n\t\tif (props?.options?.routeOptions?.length && props?.handlerFunction) {\n\t\t\tconst integration = new LambdaIntegration(props.handlerFunction);\n\n\t\t\t/**\n\t\t\t * Attach routes recursively starting from API root\n\t\t\t */\n\t\t\tthis.addRoutes(this.api.root, props.options.routeOptions, integration);\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.api.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing API base URL\n\t\t */\n\t\tnew CfnOutput(this, 'ApiGateway', {\n\t\t\tvalue: this.api.url,\n\t\t});\n\t}\n\n\t/**\n\t * Recursively attaches routes to the API Gateway\n\t *\n\t * Behaviour:\n\t * - Creates a resource for each route segment\n\t * - Attaches method + Lambda integration\n\t * - Traverses child routes for nested paths\n\t *\n\t * @param parent Parent API resource\n\t * @param routes Route definitions\n\t * @param integration Lambda integration applied to each route\n\t * @param previousPath Accumulated path (used for debug logging)\n\t * @private\n\t */\n\tprivate addRoutes(\n\t\tparent: IResource,\n\t\troutes: IRouteOption[],\n\t\tintegration: LambdaIntegration,\n\t\tpreviousPath?: string,\n\t) {\n\t\troutes.forEach((route) => {\n\t\t\tconst currentPath = `${previousPath || ''}/${route.name}`;\n\n\t\t\tconst resource = parent.addResource(route.name);\n\n\t\t\t/** Attach HTTP method with Lambda integration */\n\t\t\tresource.addMethod(route.method, integration);\n\n\t\t\t/** Recursively process child routes */\n\t\t\tif (route?.children.length) {\n\t\t\t\tthis.addRoutes(resource, route.children, integration, currentPath);\n\t\t\t}\n\n\t\t\t/** Optional debug logging */\n\t\t\tif (this.enableDebug) {\n\t\t\t\tprintLog(\n\t\t\t\t\tBaseApiGatewayConstruct.name,\n\t\t\t\t\t`Route created: ${route.method} ${currentPath}`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
@@ -2,8 +2,9 @@ import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpMethod } from 'aws-cdk-lib/aws-apigatewayv2';
4
4
  import { RestApi, RestApiProps } from 'aws-cdk-lib/aws-apigateway';
5
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.cjs';
5
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.cjs';
6
6
  import '@incloodsolutions/toolkit';
7
+ import 'aws-cdk-lib';
7
8
 
8
9
  /**
9
10
  * Route definition for API Gateway resources
@@ -2,8 +2,9 @@ import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpMethod } from 'aws-cdk-lib/aws-apigatewayv2';
4
4
  import { RestApi, RestApiProps } from 'aws-cdk-lib/aws-apigateway';
5
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.js';
5
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.js';
6
6
  import '@incloodsolutions/toolkit';
7
+ import 'aws-cdk-lib';
7
8
 
8
9
  /**
9
10
  * Route definition for API Gateway resources
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/api-gateway-construct.ts"],"names":[],"mappings":";;;;;;;AAoEO,IAAM,uBAAA,GAAN,MAAM,wBAAA,SACJ,SAAA,CAET;AAAA,EAvEA;AAuEA,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAEU,GAAA;AAAA;AAAA,EAGT,WAAA,GAAc,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAkC;AAC3E,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,cAAc,KAAA,CAAM,WAAA;AAEzB,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,OAAA,CAAQ,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KAAA,EAAO,KAAK,GAAA,CAAI;AAAA,KAChB,CAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBQ,SAAA,CACP,MAAA,EACA,MAAA,EACA,WAAA,EACA,YAAA,EACC;AACD,IAAA,MAAA,CAAO,OAAA,CAAQ,CAAC,KAAA,KAAU;AACzB,MAAA,MAAM,cAAc,CAAA,EAAG,YAAA,IAAgB,EAAE,CAAA,CAAA,EAAI,MAAM,IAAI,CAAA,CAAA;AAEvD,MAAA,MAAM,QAAA,GAAW,MAAA,CAAO,WAAA,CAAY,KAAA,CAAM,IAAI,CAAA;AAG9C,MAAA,QAAA,CAAS,SAAA,CAAU,KAAA,CAAM,MAAA,EAAQ,WAAW,CAAA;AAG5C,MAAA,IAAI,KAAA,EAAO,SAAS,MAAA,EAAQ;AAC3B,QAAA,IAAA,CAAK,SAAA,CAAU,QAAA,EAAU,KAAA,CAAM,QAAA,EAAU,aAAa,WAAW,CAAA;AAAA,MAClE;AAGA,MAAA,IAAI,KAAK,WAAA,EAAa;AACrB,QAAA,QAAA;AAAA,UACC,wBAAA,CAAwB,IAAA;AAAA,UACxB,CAAA,eAAA,EAAkB,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI,WAAW,CAAA;AAAA,SAC9C;AAAA,MACD;AAAA,IACD,CAAC,CAAA;AAAA,EACF;AACD","file":"api-gateway.js","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { HttpMethod } from 'aws-cdk-lib/aws-apigatewayv2';\nimport { CfnOutput, RemovalPolicy, Size } from 'aws-cdk-lib';\nimport {\n\tCors,\n\tIResource,\n\tLambdaIntegration,\n\tRestApi,\n\tRestApiProps,\n} from 'aws-cdk-lib/aws-apigateway';\n\nimport { printLog } from '@incloodsolutions/toolkit';\n\nimport { IBaseCdkConstructProps, IBaseConstruct } from '../../types';\n\n/**\n * Route definition for API Gateway resources\n *\n * Supports hierarchical route structures using `children`\n */\ninterface IRouteOption {\n\t/** Path segment (e.g. 'users', 'orders') */\n\tname: string;\n\n\t/** HTTP method for the route */\n\tmethod: `${HttpMethod}`;\n\n\t/** Nested routes under this path */\n\tchildren?: IRouteOption[];\n}\n\n/**\n * Props for BaseApiGatewayConstruct\n *\n * Provides configuration for:\n * - REST API (API Gateway v1)\n * - Route definitions\n * - Lambda handler\n */\ninterface IApiGatewayConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** REST API configuration options */\n\t\treadonly gatewayOptions: RestApiProps;\n\n\t\t/** Route definitions used to build API resources */\n\t\treadonly routeOptions: IRouteOption[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda function handling all API routes\n\t *\n\t * Note:\n\t * A single Lambda integration is reused across all routes\n\t */\n\treadonly handlerFunction: Function;\n}\n\n/**\n * CDK construct for REST API Gateway with Lambda integration\n *\n * Responsibilities:\n * - Creates a REST API with configurable options\n * - Applies default CORS and compression settings when not provided\n * - Recursively builds API resources from route definitions\n * - Exposes API base URL as a CloudFormation output\n */\nexport class BaseApiGatewayConstruct\n\textends Construct\n\timplements IBaseConstruct\n{\n\t/** The created REST API instance */\n\treadonly api: RestApi;\n\n\t/** Enables debug logging for route creation */\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 API, routes, and Lambda handler\n\t */\n\tconstructor(scope: Construct, id: string, props: IApiGatewayConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.enableDebug = props.enableDebug;\n\n\t\tthis.api = new RestApi(this, id, {\n\t\t\t...props?.options?.gatewayOptions,\n\n\t\t\t/** Default API description if not provided */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.gatewayOptions?.description ||\n\t\t\t\t'This is a REST API using CDK',\n\n\t\t\t/**\n\t\t\t * CORS configuration\n\t\t\t * Falls back to allowing all origins, methods, and standard headers\n\t\t\t */\n\t\t\tdefaultCorsPreflightOptions: {\n\t\t\t\t...props?.options?.gatewayOptions?.defaultCorsPreflightOptions,\n\n\t\t\t\t/** Allow all origins by default */\n\t\t\t\tallowOrigins:\n\t\t\t\t\tprops?.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowOrigins || Cors.ALL_ORIGINS,\n\n\t\t\t\t/** Allow all HTTP methods by default */\n\t\t\t\tallowMethods:\n\t\t\t\t\tprops?.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowMethods || Cors.ALL_METHODS,\n\n\t\t\t\t/** Merge default headers with user-defined headers */\n\t\t\t\tallowHeaders: [\n\t\t\t\t\t...props.options?.gatewayOptions?.defaultCorsPreflightOptions\n\t\t\t\t\t\t?.allowHeaders,\n\t\t\t\t\t'Content-Type',\n\t\t\t\t\t'Accept',\n\t\t\t\t\t'X-Amz-Date',\n\t\t\t\t\t'Authorization',\n\t\t\t\t\t'X-Api-Key',\n\t\t\t\t\t'X-Amz-Security-Token',\n\t\t\t\t\t'X-Amz-User-Agent',\n\t\t\t\t],\n\t\t\t},\n\n\t\t\t/** Minimum payload size (in bytes) before compression is applied */\n\t\t\tminCompressionSize:\n\t\t\t\tprops?.options?.gatewayOptions?.minCompressionSize || Size.bytes(1),\n\t\t});\n\n\t\t/**\n\t\t * Register routes if provided\n\t\t */\n\t\tif (props?.options?.routeOptions?.length && props?.handlerFunction) {\n\t\t\tconst integration = new LambdaIntegration(props.handlerFunction);\n\n\t\t\t/**\n\t\t\t * Attach routes recursively starting from API root\n\t\t\t */\n\t\t\tthis.addRoutes(this.api.root, props.options.routeOptions, integration);\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.api.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing API base URL\n\t\t */\n\t\tnew CfnOutput(this, 'ApiGateway', {\n\t\t\tvalue: this.api.url,\n\t\t});\n\t}\n\n\t/**\n\t * Recursively attaches routes to the API Gateway\n\t *\n\t * Behaviour:\n\t * - Creates a resource for each route segment\n\t * - Attaches method + Lambda integration\n\t * - Traverses child routes for nested paths\n\t *\n\t * @param parent Parent API resource\n\t * @param routes Route definitions\n\t * @param integration Lambda integration applied to each route\n\t * @param previousPath Accumulated path (used for debug logging)\n\t * @private\n\t */\n\tprivate addRoutes(\n\t\tparent: IResource,\n\t\troutes: IRouteOption[],\n\t\tintegration: LambdaIntegration,\n\t\tpreviousPath?: string,\n\t) {\n\t\troutes.forEach((route) => {\n\t\t\tconst currentPath = `${previousPath || ''}/${route.name}`;\n\n\t\t\tconst resource = parent.addResource(route.name);\n\n\t\t\t/** Attach HTTP method with Lambda integration */\n\t\t\tresource.addMethod(route.method, integration);\n\n\t\t\t/** Recursively process child routes */\n\t\t\tif (route?.children.length) {\n\t\t\t\tthis.addRoutes(resource, route.children, integration, currentPath);\n\t\t\t}\n\n\t\t\t/** Optional debug logging */\n\t\t\tif (this.enableDebug) {\n\t\t\t\tprintLog(\n\t\t\t\t\tBaseApiGatewayConstruct.name,\n\t\t\t\t\t`Route created: ${route.method} ${currentPath}`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/cloudfront-construct.ts"],"names":["Construct","Distribution","ViewerProtocolPolicy","Duration"],"mappings":";;;;;;;;AAgCO,IAAM,uBAAA,GAAN,cAAsCA,oBAAA,CAAU;AAAA,EAhCvD;AAgCuD,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAkC;AAC3E,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,YAAA,GAAe,IAAIC,0BAAA,CAAa,IAAA,EAAM,EAAA,EAAI;AAAA,MAC9C,GAAG,MAAM,OAAA,EAAS,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,eAAA,EAAiB;AAAA,QAChB,GAAG,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,eAAA;AAAA,QACrC,sBACC,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,eAAA,EAC/B,wBAAwBC,kCAAA,CAAqB;AAAA,OAClD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,cAAA,EAAgB;AAAA,QACf,GAAI,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,kBAAkB,EAAC;AAAA;AAAA,QAGzD;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAKC,kBAAA,CAAS,IAAA,CAAK,CAAC;AAAA,SACrB;AAAA;AAAA,QAGA;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAKA,kBAAA,CAAS,IAAA,CAAK,CAAC;AAAA,SACrB;AAAA;AAAA,QAGA;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAKA,kBAAA,CAAS,IAAA,CAAK,CAAC;AAAA;AACrB;AACD,KACA,CAAA;AAAA,EACF;AACD","file":"cloudfront.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { Duration } from 'aws-cdk-lib';\nimport {\n\tDistribution,\n\tDistributionProps,\n\tViewerProtocolPolicy,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudfrontConstruct\n *\n * Provides configuration for creating a CloudFront distribution\n * with optional overrides for default behaviour and error handling.\n */\ninterface ICloudfrontConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial configuration for the CloudFront distribution */\n\t\treadonly cloudfrontOptions: Partial<DistributionProps>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudFront distribution\n *\n * Responsibilities:\n * - Creates a CloudFront distribution with configurable options\n * - Enforces HTTPS redirection by default\n * - Adds fallback error responses for SPA routing (400, 403, 404 → index.html)\n */\nexport class BaseCloudfrontConstruct extends Construct {\n\t/** The created CloudFront distribution instance */\n\treadonly distribution: Distribution;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for CloudFront distribution\n\t */\n\tconstructor(scope: Construct, id: string, props: ICloudfrontConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.distribution = new Distribution(this, id, {\n\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t/**\n\t\t\t * Default behaviour configuration\n\t\t\t * Enforces HTTPS if not explicitly defined\n\t\t\t */\n\t\t\tdefaultBehavior: {\n\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\tviewerProtocolPolicy:\n\t\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior\n\t\t\t\t\t\t?.viewerProtocolPolicy || ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Error response configuration\n\t\t\t *\n\t\t\t * Adds SPA-friendly fallbacks:\n\t\t\t * - 400, 403, 404 responses are redirected to index.html\n\t\t\t */\n\t\t\terrorResponses: [\n\t\t\t\t...(props.options?.cloudfrontOptions?.errorResponses || []),\n\n\t\t\t\t/** Handle 400 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 400,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 403 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 403,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 404 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 404,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t}\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Distribution, DistributionProps } from 'aws-cdk-lib/aws-cloudfront';
3
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
3
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseCloudfrontConstruct
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Distribution, DistributionProps } from 'aws-cdk-lib/aws-cloudfront';
3
- import { IBaseCdkConstructProps } from '../aws-types.js';
3
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseCloudfrontConstruct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/cloudfront-construct.ts"],"names":[],"mappings":";;;;;;AAgCO,IAAM,uBAAA,GAAN,cAAsC,SAAA,CAAU;AAAA,EAhCvD;AAgCuD,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAkC;AAC3E,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,YAAA,GAAe,IAAI,YAAA,CAAa,IAAA,EAAM,EAAA,EAAI;AAAA,MAC9C,GAAG,MAAM,OAAA,EAAS,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,eAAA,EAAiB;AAAA,QAChB,GAAG,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,eAAA;AAAA,QACrC,sBACC,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,eAAA,EAC/B,wBAAwB,oBAAA,CAAqB;AAAA,OAClD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,cAAA,EAAgB;AAAA,QACf,GAAI,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,kBAAkB,EAAC;AAAA;AAAA,QAGzD;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAK,QAAA,CAAS,IAAA,CAAK,CAAC;AAAA,SACrB;AAAA;AAAA,QAGA;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAK,QAAA,CAAS,IAAA,CAAK,CAAC;AAAA,SACrB;AAAA;AAAA,QAGA;AAAA,UACC,UAAA,EAAY,GAAA;AAAA,UACZ,kBAAA,EAAoB,GAAA;AAAA,UACpB,gBAAA,EAAkB,aAAA;AAAA,UAClB,GAAA,EAAK,QAAA,CAAS,IAAA,CAAK,CAAC;AAAA;AACrB;AACD,KACA,CAAA;AAAA,EACF;AACD","file":"cloudfront.js","sourcesContent":["import { Construct } from 'constructs';\nimport { Duration } from 'aws-cdk-lib';\nimport {\n\tDistribution,\n\tDistributionProps,\n\tViewerProtocolPolicy,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudfrontConstruct\n *\n * Provides configuration for creating a CloudFront distribution\n * with optional overrides for default behaviour and error handling.\n */\ninterface ICloudfrontConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial configuration for the CloudFront distribution */\n\t\treadonly cloudfrontOptions: Partial<DistributionProps>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudFront distribution\n *\n * Responsibilities:\n * - Creates a CloudFront distribution with configurable options\n * - Enforces HTTPS redirection by default\n * - Adds fallback error responses for SPA routing (400, 403, 404 → index.html)\n */\nexport class BaseCloudfrontConstruct extends Construct {\n\t/** The created CloudFront distribution instance */\n\treadonly distribution: Distribution;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for CloudFront distribution\n\t */\n\tconstructor(scope: Construct, id: string, props: ICloudfrontConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.distribution = new Distribution(this, id, {\n\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t/**\n\t\t\t * Default behaviour configuration\n\t\t\t * Enforces HTTPS if not explicitly defined\n\t\t\t */\n\t\t\tdefaultBehavior: {\n\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\tviewerProtocolPolicy:\n\t\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior\n\t\t\t\t\t\t?.viewerProtocolPolicy || ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Error response configuration\n\t\t\t *\n\t\t\t * Adds SPA-friendly fallbacks:\n\t\t\t * - 400, 403, 404 responses are redirected to index.html\n\t\t\t */\n\t\t\terrorResponses: [\n\t\t\t\t...(props.options?.cloudfrontOptions?.errorResponses || []),\n\n\t\t\t\t/** Handle 400 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 400,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 403 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 403,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 404 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 404,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/cloudwatch-construct.ts"],"names":["Construct","LogGroup","RemovalPolicy","RetentionDays","CfnOutput"],"mappings":";;;;;;;;AA4BO,IAAM,+BAAA,GAAN,cAA8CA,oBAAA,CAAU;AAAA,EA5B/D;AA4B+D,IAAA,MAAA,CAAA,IAAA,EAAA,iCAAA,CAAA;AAAA;AAAA;AAAA,EAErD,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAgC;AACzE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,QAAA,GAAW,IAAIC,gBAAA,CAAS,IAAA,EAAM,EAAA,EAAI;AAAA,MACtC,GAAG,MAAM,OAAA,EAAS,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,aAAA,EACC,KAAA,EAAO,OAAA,EAAS,eAAA,EAAiB,iBAAiBC,uBAAA,CAAc,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMjE,SAAA,EACC,KAAA,EAAO,OAAA,EAAS,eAAA,EAAiB,aAAaC,qBAAA,CAAc;AAAA,KAC7D,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,eAAA,EAAiB;AAAA,MACpC,KAAA,EAAO,KAAK,QAAA,CAAS;AAAA,KACrB,CAAA;AAAA,EACF;AACD","file":"cloudwatch.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { LogGroup, LogGroupProps, RetentionDays } from 'aws-cdk-lib/aws-logs';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudwatchLogGroupConstruct\n *\n * Provides configuration for creating a CloudWatch Log Group\n * with optional overrides for retention and removal policy.\n */\ninterface ILogGroupConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Log Group configuration options */\n\t\treadonly logGroupOptions: LogGroupProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudWatch Log Group\n *\n * Responsibilities:\n * - Creates a log group with configurable options\n * - Applies default removal policy and retention if not provided\n * - Exposes the log group ARN as a CloudFormation output\n */\nexport class BaseCloudwatchLogGroupConstruct extends Construct {\n\t/** The created CloudWatch Log Group instance */\n\treadonly logGroup: LogGroup;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for the log group\n\t */\n\tconstructor(scope: Construct, id: string, props: ILogGroupConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.logGroup = new LogGroup(this, id, {\n\t\t\t...props.options?.logGroupOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the log group\n\t\t\t * Defaults to DESTROY when not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops?.options?.logGroupOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\n\t\t\t/**\n\t\t\t * Log retention period\n\t\t\t * Defaults to INFINITE when not explicitly defined\n\t\t\t */\n\t\t\tretention:\n\t\t\t\tprops?.options?.logGroupOptions?.retention || RetentionDays.INFINITE,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the Log Group ARN\n\t\t */\n\t\tnew CfnOutput(this, 'CloudwatchArn', {\n\t\t\tvalue: this.logGroup.logGroupArn,\n\t\t});\n\t}\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { LogGroup, LogGroupProps } from 'aws-cdk-lib/aws-logs';
3
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
3
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseCloudwatchLogGroupConstruct
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { LogGroup, LogGroupProps } from 'aws-cdk-lib/aws-logs';
3
- import { IBaseCdkConstructProps } from '../aws-types.js';
3
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseCloudwatchLogGroupConstruct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/cloudwatch-construct.ts"],"names":[],"mappings":";;;;;;AA4BO,IAAM,+BAAA,GAAN,cAA8C,SAAA,CAAU;AAAA,EA5B/D;AA4B+D,IAAA,MAAA,CAAA,IAAA,EAAA,iCAAA,CAAA;AAAA;AAAA;AAAA,EAErD,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAgC;AACzE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,QAAA,CAAS,IAAA,EAAM,EAAA,EAAI;AAAA,MACtC,GAAG,MAAM,OAAA,EAAS,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,aAAA,EACC,KAAA,EAAO,OAAA,EAAS,eAAA,EAAiB,iBAAiB,aAAA,CAAc,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMjE,SAAA,EACC,KAAA,EAAO,OAAA,EAAS,eAAA,EAAiB,aAAa,aAAA,CAAc;AAAA,KAC7D,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,eAAA,EAAiB;AAAA,MACpC,KAAA,EAAO,KAAK,QAAA,CAAS;AAAA,KACrB,CAAA;AAAA,EACF;AACD","file":"cloudwatch.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { LogGroup, LogGroupProps, RetentionDays } from 'aws-cdk-lib/aws-logs';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudwatchLogGroupConstruct\n *\n * Provides configuration for creating a CloudWatch Log Group\n * with optional overrides for retention and removal policy.\n */\ninterface ILogGroupConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Log Group configuration options */\n\t\treadonly logGroupOptions: LogGroupProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudWatch Log Group\n *\n * Responsibilities:\n * - Creates a log group with configurable options\n * - Applies default removal policy and retention if not provided\n * - Exposes the log group ARN as a CloudFormation output\n */\nexport class BaseCloudwatchLogGroupConstruct extends Construct {\n\t/** The created CloudWatch Log Group instance */\n\treadonly logGroup: LogGroup;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for the log group\n\t */\n\tconstructor(scope: Construct, id: string, props: ILogGroupConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.logGroup = new LogGroup(this, id, {\n\t\t\t...props.options?.logGroupOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the log group\n\t\t\t * Defaults to DESTROY when not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops?.options?.logGroupOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\n\t\t\t/**\n\t\t\t * Log retention period\n\t\t\t * Defaults to INFINITE when not explicitly defined\n\t\t\t */\n\t\t\tretention:\n\t\t\t\tprops?.options?.logGroupOptions?.retention || RetentionDays.INFINITE,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the Log Group ARN\n\t\t */\n\t\tnew CfnOutput(this, 'CloudwatchArn', {\n\t\t\tvalue: this.logGroup.logGroupArn,\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/dynamo-db-construct.ts"],"names":["Construct","Table","printLog","BillingMode","CfnOutput"],"mappings":";;;;;;;;;AAwDO,IAAM,qBAAA,GAAN,MAAM,sBAAA,SAA8BA,oBAAA,CAAoC;AAAA,EAxD/E;AAwD+E,IAAA,MAAA,CAAA,IAAA,EAAA,uBAAA,CAAA;AAAA;AAAA;AAAA,EAErE,KAAA;AAAA;AAAA,EAGA,aAAA;AAAA;AAAA,EAGT,WAAA,GAAc,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAgC;AACzE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,cAAc,KAAA,EAAO,WAAA;AAK1B,IAAA,IAAI,KAAA,CAAM,SAAS,qBAAA,EAAuB;AACzC,MAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAEb,MAAA,IAAA,CAAK,gBAAgBC,iBAAA,CAAM,aAAA;AAAA,QAC1B,IAAA;AAAA,QACA,GAAG,EAAE,CAAA,QAAA,CAAA;AAAA,QACL,MAAM,OAAA,CAAQ;AAAA,OACf;AAEA,MAAA,IAAI,KAAK,WAAA,EAAa;AACrB,QAAAC,gBAAA;AAAA,UACC,sBAAA,CAAsB,IAAA;AAAA,UACtB,CAAA,iDAAA,EAAoD,KAAA,CAAM,OAAA,EAAS,qBAAqB,CAAA;AAAA,SACzF;AAAA,MACD;AAA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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"]}
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Table, ITable, TableProps, TableAttributes, GlobalSecondaryIndexProps, LocalSecondaryIndexProps } from 'aws-cdk-lib/aws-dynamodb';
3
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.cjs';
3
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.cjs';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseDynamoDBConstruct
@@ -1,7 +1,8 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Table, ITable, TableProps, TableAttributes, GlobalSecondaryIndexProps, LocalSecondaryIndexProps } from 'aws-cdk-lib/aws-dynamodb';
3
- import { IBaseConstruct, IBaseCdkConstructProps } from '../aws-types.js';
3
+ import { IBaseConstruct, IBaseCdkConstructProps } from '../../aws-types.js';
4
4
  import '@incloodsolutions/toolkit';
5
+ import 'aws-cdk-lib';
5
6
 
6
7
  /**
7
8
  * Props for BaseDynamoDBConstruct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/dynamo-db-construct.ts"],"names":[],"mappings":";;;;;;;AAwDO,IAAM,qBAAA,GAAN,MAAM,sBAAA,SAA8B,SAAA,CAAoC;AAAA,EAxD/E;AAwD+E,IAAA,MAAA,CAAA,IAAA,EAAA,uBAAA,CAAA;AAAA;AAAA;AAAA,EAErE,KAAA;AAAA;AAAA,EAGA,aAAA;AAAA;AAAA,EAGT,WAAA,GAAc,KAAA;AAAA;AAAA;AAAA;AAAA;AA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A,KAAe;AAC3D,UAAA,IAAA,CAAK,KAAA,CAAM,uBAAuB,UAAU,CAAA;AAE5C,UAAA,IAAI,KAAK,WAAA,EAAa;AACrB,YAAA,QAAA;AAAA,cACC,sBAAA,CAAsB,IAAA;AAAA,cACtB,CAAA,WAAA,EAAc,WAAW,SAAS,CAAA;AAAA,aACnC;AAAA,UACD;AAAA,QACD,CAAC,CAAA;AAAA,MACF;AAAA,IACD;AAMA,IAAA,IAAI,SAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EACC,KAAA,CAAM,OAAA,EAAS,qBAAA,IACf,KAAA,CAAM,OAAA,EAAS,oBAAA,GACZ,IAAA,CAAK,aAAA,CAAc,QAAA,GACnB,IAAA,CAAK,KAAA,CAAM;AAAA,KACf,CAAA;AAAA,EACF;AACD","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 @@
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"]}
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { Rule, RuleProps } from 'aws-cdk-lib/aws-events';
4
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseEventBridgeConstruct
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { Rule, RuleProps } from 'aws-cdk-lib/aws-events';
4
- import { IBaseCdkConstructProps } from '../aws-types.js';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseEventBridgeConstruct
@@ -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 @@
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"]}
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpLambdaAuthorizer, HttpLambdaAuthorizerProps } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
4
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseLambdaAuthoriserV2Construct
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { HttpLambdaAuthorizer, HttpLambdaAuthorizerProps } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
4
- import { IBaseCdkConstructProps } from '../aws-types.js';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseLambdaAuthoriserV2Construct
@@ -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 @@
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"]}
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { TokenAuthorizer, TokenAuthorizerProps } from 'aws-cdk-lib/aws-apigateway';
4
- import { IBaseCdkConstructProps } from '../aws-types.cjs';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.cjs';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseLambdaAuthoriserConstruct
@@ -1,8 +1,9 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { Function } from 'aws-cdk-lib/aws-lambda';
3
3
  import { TokenAuthorizer, TokenAuthorizerProps } from 'aws-cdk-lib/aws-apigateway';
4
- import { IBaseCdkConstructProps } from '../aws-types.js';
4
+ import { IBaseCdkConstructProps } from '../../aws-types.js';
5
5
  import '@incloodsolutions/toolkit';
6
+ import 'aws-cdk-lib';
6
7
 
7
8
  /**
8
9
  * Props for BaseLambdaAuthoriserConstruct
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aws/cdk/constructs/lambda-authorizer-construct.ts"],"names":[],"mappings":";;;;;;AAwCO,IAAM,6BAAA,GAAN,cAA4C,SAAA,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,IAAI,eAAA,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,IAAI,SAAA,CAAU,MAAM,qBAAA,EAAuB;AAAA,MAC1C,KAAA,EAAO,KAAK,UAAA,CAAW;AAAA,KACvB,CAAA;AAAA,EACF;AACD","file":"lambda-authorizer.js","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 @@
1
+ {"version":3,"sources":["../../../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,MAAA,EAAQA,uBAAa,MAAM,CAAA;AAAA;AAAA;AAAA;AAAA,QAKlE,kBAAA,EAAoB;AAAA,UACnBC,iBAAA,CAAQ,WAAA;AAAA,UACRA,iBAAA,CAAQ,WAAA;AAAA,UACRA,iBAAA,CAAQ;AAAA;AACT,OACqB,CAAA;AAAA,IACvB;AAMA,IAAA,IAAIC,mBAAA,CAAU,MAAM,gBAAA,EAAkB;AAAA,MACrC,KAAA,EACC,KAAA,CAAM,OAAA,EAAS,oBAAA,IACf,KAAA,CAAM,OAAA,EAAS,0BAAA,GACZ,IAAA,CAAK,aAAA,CAAc,eAAA,GACnB,IAAA,CAAK,KAAA,CAAM;AAAA,KACf,CAAA;AAAA,EACF;AACD","file":"lambda-layer.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport {\n\tArchitecture,\n\tCode,\n\tILayerVersion,\n\tLayerVersion,\n\tLayerVersionProps,\n\tRuntime,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaLayerConstruct\n *\n * Provides configuration for:\n * - Creating a new Lambda Layer\n * - Importing an existing layer by ARN or attributes\n */\ninterface ILambdaLayerConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/**\n\t\t * Configuration for creating a new Lambda layer\n\t\t *\n\t\t * Note:\n\t\t * - `layerVersionName` is required\n\t\t * - `compatibleArchitectures` is managed internally\n\t\t */\n\t\treadonly layerOptions?: Partial<\n\t\t\tOmit<LayerVersionProps, 'layerVersionName' | 'compatibleArchitectures'>\n\t\t> &\n\t\t\tRequired<Pick<LayerVersionProps, 'layerVersionName'>>;\n\n\t\t/** Import an existing layer by ARN */\n\t\treadonly fromExistingLayerArn?: string;\n\n\t\t/** Import an existing layer using attributes */\n\t\treadonly fromExistingLayerAttribute?: {\n\t\t\treadonly layerVersionArn: string;\n\t\t\treadonly compatibleRuntimes?: Runtime[];\n\t\t};\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for Lambda Layer\n *\n * Responsibilities:\n * - Creates a new Lambda layer or imports an existing one\n * - Applies default runtime and architecture compatibility\n * - Exposes the layer ARN as a CloudFormation output\n */\nexport class BaseLambdaLayerConstruct extends Construct {\n\t/** Newly created Lambda Layer (null if importing existing layer) */\n\treadonly layer: LayerVersion;\n\n\t/** Imported Lambda Layer reference (null if creating new layer) */\n\treadonly existingLayer: ILayerVersion;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for layer creation or import\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops?: ILambdaLayerConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Import layer by ARN\n\t\t */\n\t\tif (props?.options?.fromExistingLayerArn) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionArn(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Arn`,\n\t\t\t\tprops?.options?.fromExistingLayerArn,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Import layer using attributes\n\t\t\t */\n\t\t} else if (props?.options?.fromExistingLayerAttribute) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionAttributes(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Attribute`,\n\t\t\t\tprops?.options?.fromExistingLayerAttribute,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Create new Lambda layer\n\t\t\t */\n\t\t} else {\n\t\t\tthis.layer = new LayerVersion(this, id, {\n\t\t\t\t...props.options?.layerOptions,\n\n\t\t\t\t/**\n\t\t\t\t * Default layer code asset\n\t\t\t\t */\n\t\t\t\tcode:\n\t\t\t\t\tprops?.options?.layerOptions?.code || Code.fromAsset('./dist-layer'),\n\n\t\t\t\t/**\n\t\t\t\t * Layer description\n\t\t\t\t */\n\t\t\t\tdescription:\n\t\t\t\t\tprops?.options?.layerOptions?.description ||\n\t\t\t\t\t'Lambda Layer written in NodeJS, NestJS, NodeJS-express, serverless-express',\n\n\t\t\t\t/**\n\t\t\t\t * Supported CPU architectures\n\t\t\t\t */\n\t\t\t\tcompatibleArchitectures: [Architecture.ARM_64, Architecture.X86_64],\n\n\t\t\t\t/**\n\t\t\t\t * Supported runtimes\n\t\t\t\t */\n\t\t\t\tcompatibleRuntimes: [\n\t\t\t\t\tRuntime.NODEJS_22_X,\n\t\t\t\t\tRuntime.NODEJS_24_X,\n\t\t\t\t\tRuntime.NODEJS_LATEST,\n\t\t\t\t],\n\t\t\t} as LayerVersionProps);\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the layer ARN\n\t\t * Resolves to either created or imported layer\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaLayerArn', {\n\t\t\tvalue:\n\t\t\t\tprops.options?.fromExistingLayerArn ||\n\t\t\t\tprops.options?.fromExistingLayerAttribute\n\t\t\t\t\t? this.existingLayer.layerVersionArn\n\t\t\t\t\t: this.layer.layerVersionArn,\n\t\t});\n\t}\n}\n"]}