@beesolve/cdk-constructs 0.1.5 → 0.1.6

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.
package/dist/index.d.ts CHANGED
@@ -155,35 +155,18 @@ declare class CloudFrontAccessLoggingSettings extends Construct {
155
155
  readonly cloudFrontLoggingSettings: Pick<DistributionProps, "logBucket" | "logFilePrefix" | "enableLogging" | "logIncludesCookies">;
156
156
  constructor(scope: Construct, id: string, props: CloudFrontAccessLoggingSettingsProps);
157
157
  }
158
- import { Duration } from "aws-cdk-lib";
159
158
  import { Function } from "aws-cdk-lib/aws-lambda";
160
- import { Queue } from "aws-cdk-lib/aws-sqs";
161
- import { Construct as Construct2 } from "constructs";
162
- declare class EmailAlarms extends Construct2 {
163
- private emailSubscription;
164
- constructor(scope: Construct2, id: string, props: {
165
- readonly emailAddress: string;
166
- });
167
- readonly reportLambdaErrors: (handler: Function) => void;
168
- readonly reportSqsErrors: (props: {
169
- readonly queue: Queue;
170
- readonly dlq: Queue;
171
- readonly noMessagesPeriod?: Duration;
172
- readonly noConsumersPeriod?: Duration;
173
- }) => void;
174
- }
175
- import { Function as Function2 } from "aws-cdk-lib/aws-lambda";
176
159
  import { SqsEventSourceProps } from "aws-cdk-lib/aws-lambda-event-sources";
177
- import { Queue as Queue2, QueueProps } from "aws-cdk-lib/aws-sqs";
178
- import { Construct as Construct3 } from "constructs";
160
+ import { Queue, QueueProps } from "aws-cdk-lib/aws-sqs";
161
+ import { Construct as Construct2 } from "constructs";
179
162
  interface SqsWithDlqProps {
180
163
  readonly queue?: QueueProps;
181
164
  readonly dlq?: Partial<Omit<QueueProps, "fifo" | "contentBasedDeduplication" | "deduplicationScope">>;
182
165
  }
183
- declare class SqsWithDlq extends Construct3 {
184
- readonly queue: Queue2;
185
- readonly dlq: Queue2;
186
- constructor(scope: Construct3, id: string, props?: SqsWithDlqProps);
166
+ declare class SqsWithDlq extends Construct2 {
167
+ readonly queue: Queue;
168
+ readonly dlq: Queue;
169
+ constructor(scope: Construct2, id: string, props?: SqsWithDlqProps);
187
170
  /**
188
171
  * Uses the queue as an input for the given lambda function.
189
172
  *
@@ -195,7 +178,7 @@ interface SqsWithDlqLambdaInputProps extends SqsWithDlqProps {
195
178
  /**
196
179
  * Lambda function used to handle the SQS messages.
197
180
  */
198
- readonly lambda: Function2;
181
+ readonly lambda: Function;
199
182
  /**
200
183
  * SQS message batching configuration.
201
184
  */
@@ -210,10 +193,10 @@ interface SqsWithDlqLambdaInputProps extends SqsWithDlqProps {
210
193
  readonly disabled?: boolean;
211
194
  }
212
195
  type BatchingConfig = Pick<SqsEventSourceProps, "batchSize" | "maxBatchingWindow" | "reportBatchItemFailures" | "maxConcurrency">;
213
- import { Architecture, Function as Function3, LoggingFormat, Runtime } from "aws-cdk-lib/aws-lambda";
196
+ import { Architecture, Function as Function2, LoggingFormat, Runtime } from "aws-cdk-lib/aws-lambda";
214
197
  import { NodejsFunctionProps } from "aws-cdk-lib/aws-lambda-nodejs";
215
198
  import { LogGroupProps } from "aws-cdk-lib/aws-logs";
216
- import { Construct as Construct4 } from "constructs";
199
+ import { Construct as Construct3 } from "constructs";
217
200
  type Nodejs24FunctionProps = Omit<NodejsFunctionProps, "runtime" | "architecture" | "logGroup" | "entry" | "handler" | "code" | "bundling" | "awsSdkConnectionReuse"> & {
218
201
  entry: `${string}.ts`;
219
202
  logGroupProps?: LogGroupProps;
@@ -237,8 +220,8 @@ type Nodejs24FunctionProps = Omit<NodejsFunctionProps, "runtime" | "architecture
237
220
  * Entry file is being transpiled by `esbuild` to ESM format compatible with Node.js 24.
238
221
  *
239
222
  */
240
- declare class Nodejs24Function extends Function3 {
241
- constructor(scope: Construct4, id: string, props: Nodejs24FunctionProps);
223
+ declare class Nodejs24Function extends Function2 {
224
+ constructor(scope: Construct3, id: string, props: Nodejs24FunctionProps);
242
225
  }
243
226
  declare function getRevision(enforceGit: boolean): string;
244
- export { getRevision, SqsWithDlqProps, SqsWithDlqLambdaInputProps, SqsWithDlq, Nodejs24FunctionProps, Nodejs24Function, EmailAlarms, CloudFrontAccessLoggingSettingsProps, CloudFrontAccessLoggingSettings };
227
+ export { getRevision, SqsWithDlqProps, SqsWithDlqLambdaInputProps, SqsWithDlq, Nodejs24FunctionProps, Nodejs24Function, CloudFrontAccessLoggingSettingsProps, CloudFrontAccessLoggingSettings };
package/dist/index.js CHANGED
@@ -112,91 +112,15 @@ class CloudFrontAccessLoggingSettings extends Construct {
112
112
  };
113
113
  }
114
114
  }
115
- // packages/cdk-constructs/src/emailAlarms.ts
116
- import {
117
- Alarm,
118
- ComparisonOperator,
119
- TreatMissingData
120
- } from "aws-cdk-lib/aws-cloudwatch";
121
- import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
122
- import { Topic } from "aws-cdk-lib/aws-sns";
123
- import { EmailSubscription } from "aws-cdk-lib/aws-sns-subscriptions";
124
- import { Construct as Construct2 } from "constructs";
125
-
126
- class EmailAlarms extends Construct2 {
127
- emailSubscription;
128
- constructor(scope, id, props) {
129
- super(scope, id);
130
- this.emailSubscription = new EmailSubscription(props.emailAddress);
131
- }
132
- reportLambdaErrors = (handler) => {
133
- const topic = new Topic(handler, "ErrorAlarmTopic");
134
- topic.addSubscription(this.emailSubscription);
135
- const alarm = new Alarm(handler, `ErrorAlarm`, {
136
- metric: handler.metricErrors(),
137
- threshold: 1,
138
- evaluationPeriods: 1,
139
- comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
140
- treatMissingData: TreatMissingData.IGNORE
141
- });
142
- alarm.addOkAction(new SnsAction(topic));
143
- alarm.addAlarmAction(new SnsAction(topic));
144
- };
145
- reportSqsErrors = (props) => {
146
- const dlqTopic = new Topic(props.dlq, "DlqAlarmTopic");
147
- dlqTopic.addSubscription(this.emailSubscription);
148
- const dlqAlarm = new Alarm(this, "DlqAlarm", {
149
- alarmDescription: `DLQ for ${props.queue.queueName} is not empty.`,
150
- metric: props.dlq.metricApproximateNumberOfMessagesVisible(),
151
- threshold: 1,
152
- evaluationPeriods: 1,
153
- comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
154
- treatMissingData: TreatMissingData.IGNORE
155
- });
156
- dlqAlarm.addAlarmAction(new SnsAction(dlqTopic));
157
- if (props.noMessagesPeriod || props.noConsumersPeriod) {
158
- const queueTopic = new Topic(props.queue, "QueueAlarmTopic");
159
- queueTopic.addSubscription(this.emailSubscription);
160
- if (props.noMessagesPeriod) {
161
- const noMessages = new Alarm(this, "NoMessagesAlarm", {
162
- alarmDescription: `Queue received no messages for ${props.noMessagesPeriod.toHumanString()}.`,
163
- metric: props.queue.metric("NumberOfMessagesSent", {
164
- statistic: "Sum",
165
- period: props.noMessagesPeriod
166
- }),
167
- threshold: 0,
168
- evaluationPeriods: 1,
169
- comparisonOperator: ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD,
170
- treatMissingData: TreatMissingData.BREACHING
171
- });
172
- noMessages.addAlarmAction(new SnsAction(queueTopic));
173
- }
174
- if (props.noConsumersPeriod) {
175
- const noConsumers = new Alarm(this, "NoConsumersAlarm", {
176
- alarmDescription: `Queue had no consumers for ${props.noConsumersPeriod.toHumanString()}.`,
177
- metric: props.queue.metric("NumberOfMessagesReceived", {
178
- statistic: "Sum",
179
- period: props.noConsumersPeriod
180
- }),
181
- threshold: 0,
182
- evaluationPeriods: 1,
183
- comparisonOperator: ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD,
184
- treatMissingData: TreatMissingData.BREACHING
185
- });
186
- noConsumers.addAlarmAction(new SnsAction(queueTopic));
187
- }
188
- }
189
- };
190
- }
191
115
  // packages/cdk-constructs/src/sqsWithDlq.ts
192
116
  import { Duration } from "aws-cdk-lib";
193
117
  import {
194
118
  SqsEventSource
195
119
  } from "aws-cdk-lib/aws-lambda-event-sources";
196
120
  import { Queue, QueueEncryption } from "aws-cdk-lib/aws-sqs";
197
- import { Construct as Construct3 } from "constructs";
121
+ import { Construct as Construct2 } from "constructs";
198
122
 
199
- class SqsWithDlq extends Construct3 {
123
+ class SqsWithDlq extends Construct2 {
200
124
  queue;
201
125
  dlq;
202
126
  constructor(scope, id, props = {}) {
@@ -359,6 +283,5 @@ export {
359
283
  getRevision,
360
284
  SqsWithDlq,
361
285
  Nodejs24Function,
362
- EmailAlarms,
363
286
  CloudFrontAccessLoggingSettings
364
287
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beesolve/cdk-constructs",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/beesolve/packages/tree/main/packages/cdk-constructs#readme",
6
6
  "license": "MIT",