@composurecdk/events 0.6.0

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 (50) hide show
  1. package/README.md +229 -0
  2. package/dist/defaults.d.ts +12 -0
  3. package/dist/defaults.d.ts.map +1 -0
  4. package/dist/defaults.js +11 -0
  5. package/dist/defaults.js.map +1 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +10 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/rule-alarm-config.d.ts +58 -0
  11. package/dist/rule-alarm-config.d.ts.map +1 -0
  12. package/dist/rule-alarm-config.js +2 -0
  13. package/dist/rule-alarm-config.js.map +1 -0
  14. package/dist/rule-alarm-defaults.d.ts +16 -0
  15. package/dist/rule-alarm-defaults.d.ts.map +1 -0
  16. package/dist/rule-alarm-defaults.js +38 -0
  17. package/dist/rule-alarm-defaults.js.map +1 -0
  18. package/dist/rule-alarms.d.ts +28 -0
  19. package/dist/rule-alarms.d.ts.map +1 -0
  20. package/dist/rule-alarms.js +107 -0
  21. package/dist/rule-alarms.js.map +1 -0
  22. package/dist/rule-builder.d.ts +143 -0
  23. package/dist/rule-builder.d.ts.map +1 -0
  24. package/dist/rule-builder.js +93 -0
  25. package/dist/rule-builder.js.map +1 -0
  26. package/dist/targets/cloud-watch-log-group-target.d.ts +16 -0
  27. package/dist/targets/cloud-watch-log-group-target.d.ts.map +1 -0
  28. package/dist/targets/cloud-watch-log-group-target.js +19 -0
  29. package/dist/targets/cloud-watch-log-group-target.js.map +1 -0
  30. package/dist/targets/event-bus-target.d.ts +16 -0
  31. package/dist/targets/event-bus-target.d.ts.map +1 -0
  32. package/dist/targets/event-bus-target.js +19 -0
  33. package/dist/targets/event-bus-target.js.map +1 -0
  34. package/dist/targets/lambda-target.d.ts +31 -0
  35. package/dist/targets/lambda-target.d.ts.map +1 -0
  36. package/dist/targets/lambda-target.js +33 -0
  37. package/dist/targets/lambda-target.js.map +1 -0
  38. package/dist/targets/sfn-state-machine-target.d.ts +16 -0
  39. package/dist/targets/sfn-state-machine-target.d.ts.map +1 -0
  40. package/dist/targets/sfn-state-machine-target.js +19 -0
  41. package/dist/targets/sfn-state-machine-target.js.map +1 -0
  42. package/dist/targets/sns-target.d.ts +17 -0
  43. package/dist/targets/sns-target.d.ts.map +1 -0
  44. package/dist/targets/sns-target.js +19 -0
  45. package/dist/targets/sns-target.js.map +1 -0
  46. package/dist/targets/sqs-target.d.ts +16 -0
  47. package/dist/targets/sqs-target.d.ts.map +1 -0
  48. package/dist/targets/sqs-target.js +18 -0
  49. package/dist/targets/sqs-target.js.map +1 -0
  50. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # @composurecdk/events
2
+
3
+ EventBridge rule builder for [ComposureCDK](../../README.md).
4
+
5
+ This package provides a fluent builder for EventBridge rules with secure, AWS-recommended defaults. It wraps the CDK [Rule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Rule.html) construct — refer to the CDK documentation for the full set of configurable properties.
6
+
7
+ ## Rule Builder
8
+
9
+ ```ts
10
+ import { createRuleBuilder } from "@composurecdk/events";
11
+ import { Schedule } from "aws-cdk-lib/aws-events";
12
+ import { Duration } from "aws-cdk-lib";
13
+
14
+ const rule = createRuleBuilder()
15
+ .schedule(Schedule.rate(Duration.minutes(15)))
16
+ .description("Idle stopper")
17
+ .build(stack, "IdleStopperSchedule");
18
+ ```
19
+
20
+ Every [RuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.RuleProps.html) property is available as a fluent setter on the builder. The builder requires at least one of `schedule` or `eventPattern` to be set — an EventBridge rule with neither is inert.
21
+
22
+ `Schedule` and `Match` (used for event-pattern matching) are imported directly from `aws-cdk-lib/aws-events` — this package does not re-export them, matching the convention used elsewhere in the library (e.g. `Runtime` from `aws-cdk-lib/aws-lambda`).
23
+
24
+ ### Cross-component event bus
25
+
26
+ The `eventBus` property accepts a `Resolvable<IEventBus>` so the rule can attach to a custom bus built by another component:
27
+
28
+ ```ts
29
+ import { compose, ref } from "@composurecdk/core";
30
+
31
+ compose(
32
+ {
33
+ bus: customEventBus,
34
+ rule: createRuleBuilder()
35
+ .eventBus(ref("bus", (r) => r.eventBus))
36
+ .eventPattern({ source: ["my.app"] }),
37
+ },
38
+ { bus: [], rule: ["bus"] },
39
+ );
40
+ ```
41
+
42
+ When omitted, the rule attaches to the account default bus, matching CDK's `RuleProps.eventBus` default.
43
+
44
+ ## Recommended Alarms
45
+
46
+ The builder creates [AWS-recommended CloudWatch alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge) by default. No alarm actions are configured — access alarms from the build result, or use the `alarmActionsPolicy` from `@composurecdk/cloudwatch` to wire them to an SNS topic in one place.
47
+
48
+ | Alarm | Metric | Default threshold | Created when |
49
+ | -------------------------------- | ------------------------------------------- | ----------------- | ------------ |
50
+ | `failedInvocations` | FailedInvocations (Sum, 1 min) | > 0 | Always |
51
+ | `throttledRules` | ThrottledRules (Sum, 1 min) | > 0 | Always |
52
+ | `invocationsSentToDlq` | InvocationsSentToDlq (Sum, 1 min) | > 0 | Always[^dlq] |
53
+ | `invocationsFailedToBeSentToDlq` | InvocationsFailedToBeSentToDlq (Sum, 1 min) | > 0 | Always[^dlq] |
54
+
55
+ [^dlq]: The DLQ metrics only emit data when at least one target on the rule has a `deadLetterQueue` configured and EventBridge attempts redrive. `TreatMissingData` defaults to `notBreaching`, so the alarm stays quiet on rules without DLQs. Attach a DLQ via the matching target helper's `deadLetterQueue` option — see [Cross-component DLQ wiring](#cross-component-dlq-wiring) below, and the [EventBridge DLQ docs](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html).
56
+
57
+ The defaults are exported as `RULE_ALARM_DEFAULTS` for visibility and testing:
58
+
59
+ ```ts
60
+ import { RULE_ALARM_DEFAULTS } from "@composurecdk/events";
61
+ ```
62
+
63
+ ### Customizing thresholds
64
+
65
+ Override individual alarm properties via `recommendedAlarms`. Unspecified fields keep their defaults.
66
+
67
+ ```ts
68
+ const rule = createRuleBuilder()
69
+ .eventPattern({ source: ["my.app"] })
70
+ .recommendedAlarms({
71
+ failedInvocations: { threshold: 5, evaluationPeriods: 3 },
72
+ });
73
+ ```
74
+
75
+ ### Disabling alarms
76
+
77
+ Disable all recommended alarms:
78
+
79
+ ```ts
80
+ builder.recommendedAlarms(false);
81
+ // or
82
+ builder.recommendedAlarms({ enabled: false });
83
+ ```
84
+
85
+ Disable individual alarms:
86
+
87
+ ```ts
88
+ builder.recommendedAlarms({ throttledRules: false });
89
+ ```
90
+
91
+ ### Custom alarms
92
+
93
+ Add custom alarms alongside the recommended ones via `addAlarm`. The callback receives an `AlarmDefinitionBuilder` typed to `IRule`, so the metric factory has access to the rule's properties. The Serverless Lens flags `RetryInvocationAttempts` as an early indicator of an undersized target — a good candidate for `addAlarm`:
94
+
95
+ ```ts
96
+ import { Metric } from "aws-cdk-lib/aws-cloudwatch";
97
+ import { Duration } from "aws-cdk-lib";
98
+
99
+ createRuleBuilder()
100
+ .eventPattern({ source: ["my.app"] })
101
+ .addAlarm("retryAttempts", (alarm) =>
102
+ alarm
103
+ .metric(
104
+ (rule) =>
105
+ new Metric({
106
+ namespace: "AWS/Events",
107
+ metricName: "RetryInvocationAttempts",
108
+ dimensionsMap: { RuleName: rule.ruleName },
109
+ statistic: "Sum",
110
+ period: Duration.minutes(1),
111
+ }),
112
+ )
113
+ .threshold(10)
114
+ .greaterThan()
115
+ .description("Target is being undersized; retries are climbing."),
116
+ );
117
+ ```
118
+
119
+ ### Applying alarm actions
120
+
121
+ Alarms are returned in the build result as `Record<string, Alarm>`:
122
+
123
+ ```ts
124
+ const result = rule.build(stack, "MyRule");
125
+
126
+ for (const alarm of Object.values(result.alarms)) {
127
+ alarm.addAlarmAction(new SnsAction(alertTopic));
128
+ }
129
+ ```
130
+
131
+ Or apply them stack-wide via `alarmActionsPolicy(stack, { defaults: { alarmActions: [new SnsAction(alertTopic)] } })` from `@composurecdk/cloudwatch` — same pattern used by the rest of the library, so a single SNS topic can fan out to function and rule alarms together.
132
+
133
+ ## Adding Targets
134
+
135
+ Targets are registered via `addTarget(key, target)`, where `target` is a CDK [`IRuleTarget`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IRuleTarget.html) (or a `Resolvable<IRuleTarget>` for cross-component wiring). Each target is exposed on `result.targets` under its key.
136
+
137
+ ```ts
138
+ import { createRuleBuilder } from "@composurecdk/events";
139
+ import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
140
+
141
+ const result = createRuleBuilder()
142
+ .schedule(Schedule.rate(Duration.minutes(15)))
143
+ .addTarget("stopper", new LambdaFunction(idleStopperFn))
144
+ .build(stack, "IdleStopperSchedule");
145
+
146
+ result.targets.stopper; // IRuleTarget
147
+ ```
148
+
149
+ For cross-component wiring inside a [`compose`](../core/README.md) system, pass a `ref` and use the matching target helper from this package (see [Target Helpers](#target-helpers) below):
150
+
151
+ ```ts
152
+ import { compose, ref } from "@composurecdk/core";
153
+ import { createRuleBuilder, lambdaTarget } from "@composurecdk/events";
154
+ import { createFunctionBuilder, type FunctionBuilderResult } from "@composurecdk/lambda";
155
+
156
+ const system = compose(
157
+ {
158
+ stopper: createFunctionBuilder()./* ... */,
159
+ idleStopperSchedule: createRuleBuilder()
160
+ .schedule(Schedule.rate(Duration.minutes(15)))
161
+ .addTarget(
162
+ "stopper",
163
+ lambdaTarget(ref("stopper", (r: FunctionBuilderResult) => r.function)),
164
+ ),
165
+ },
166
+ { stopper: [], idleStopperSchedule: ["stopper"] },
167
+ );
168
+ ```
169
+
170
+ ## Target Helpers
171
+
172
+ This package ships small free-function helpers that wrap the corresponding [`aws-events-targets`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets-readme.html) constructs and accept a `Resolvable<I*>` for the underlying resource. Use them inside `addTarget` instead of constructing the CDK target classes directly — they make cross-component wiring with `ref(...)` work without an `afterBuild` hook.
173
+
174
+ | Helper | Wraps | Underlying resource |
175
+ | -------------------------- | -------------------- | ------------------- |
176
+ | `lambdaTarget` | `LambdaFunction` | `IFunction` |
177
+ | `sqsTarget` | `SqsQueue` | `IQueue` |
178
+ | `snsTarget` | `SnsTopic` | `ITopic` |
179
+ | `sfnStateMachineTarget` | `SfnStateMachine` | `IStateMachine` |
180
+ | `eventBusTarget` | `EventBus` | `IEventBus` |
181
+ | `cloudWatchLogGroupTarget` | `CloudWatchLogGroup` | `ILogGroup` |
182
+
183
+ The second argument is the matching CDK target props type (`LambdaFunctionProps`, `SqsQueueProps`, …) — refer to the CDK docs for available options. Common ones include `deadLetterQueue` (concrete `IQueue`), `retryAttempts`, `maxEventAge`, and target-specific input transforms (`event` / `input` / `message`).
184
+
185
+ Other CDK target types (API Gateway, ECS task, Batch job, Kinesis, Firehose, AppSync, …) are not yet wrapped — pass them inline as a regular `IRuleTarget` until a wrapper helper lands.
186
+
187
+ ```ts
188
+ import { compose, ref } from "@composurecdk/core";
189
+ import {
190
+ createRuleBuilder,
191
+ lambdaTarget,
192
+ sqsTarget,
193
+ } from "@composurecdk/events";
194
+ import {
195
+ createFunctionBuilder,
196
+ type FunctionBuilderResult,
197
+ } from "@composurecdk/lambda";
198
+
199
+ compose(
200
+ {
201
+ handler: createFunctionBuilder()./* ... */,
202
+ rule: createRuleBuilder()
203
+ .eventPattern({ source: ["aws.s3"], detailType: ["Object Created"] })
204
+ .addTarget(
205
+ "primary",
206
+ lambdaTarget(ref("handler", (r: FunctionBuilderResult) => r.function), {
207
+ retryAttempts: 2,
208
+ }),
209
+ ),
210
+ },
211
+ { handler: [], rule: ["handler"] },
212
+ );
213
+ ```
214
+
215
+ ### Cross-component DLQ wiring
216
+
217
+ Each helper takes a single `Resolvable` for its primary resource. Secondary props such as `deadLetterQueue` accept the concrete CDK type (`IQueue` for most targets). When the DLQ is also a sibling-component output, construct the helper inside `ref().map()` and have the dependency component expose both the resource and the queue:
218
+
219
+ ```ts
220
+ .addTarget(
221
+ "stopper",
222
+ ref<{ fn: IFunction; dlq: IQueue }>(
223
+ "stopperBundle",
224
+ (b) => lambdaTarget(b.fn, { deadLetterQueue: b.dlq }),
225
+ ),
226
+ )
227
+ ```
228
+
229
+ A dedicated DLQ component (`createQueueBuilder`-style) — and helpers that accept `Resolvable<IQueue>` for the DLQ directly — are out of scope for this PR; track as a follow-up if a use case emerges.
@@ -0,0 +1,12 @@
1
+ import type { RuleProps } from "aws-cdk-lib/aws-events";
2
+ /**
3
+ * Defaults applied to every EventBridge rule built with
4
+ * {@link createRuleBuilder}.
5
+ *
6
+ * Intentionally empty: the L2 {@link RuleProps} defaults already align with
7
+ * AWS recommendations (`enabled: true`, default account event bus). No
8
+ * additional secure default exists at this layer — DLQs are caller-owned and
9
+ * configured per target, not on the rule itself.
10
+ */
11
+ export declare const RULE_DEFAULTS: Partial<RuleProps>;
12
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,SAAS,CAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Defaults applied to every EventBridge rule built with
3
+ * {@link createRuleBuilder}.
4
+ *
5
+ * Intentionally empty: the L2 {@link RuleProps} defaults already align with
6
+ * AWS recommendations (`enabled: true`, default account event bus). No
7
+ * additional secure default exists at this layer — DLQs are caller-owned and
8
+ * configured per target, not on the rule itself.
9
+ */
10
+ export const RULE_DEFAULTS = {};
11
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAuB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { createRuleBuilder, type IRuleBuilder, type RuleBuilderProps, type RuleBuilderResult, } from "./rule-builder.js";
2
+ export { RULE_DEFAULTS } from "./defaults.js";
3
+ export { type RuleAlarmConfig } from "./rule-alarm-config.js";
4
+ export { RULE_ALARM_DEFAULTS } from "./rule-alarm-defaults.js";
5
+ export { lambdaTarget } from "./targets/lambda-target.js";
6
+ export { sqsTarget } from "./targets/sqs-target.js";
7
+ export { snsTarget } from "./targets/sns-target.js";
8
+ export { sfnStateMachineTarget } from "./targets/sfn-state-machine-target.js";
9
+ export { eventBusTarget } from "./targets/event-bus-target.js";
10
+ export { cloudWatchLogGroupTarget } from "./targets/cloud-watch-log-group-target.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { createRuleBuilder, } from "./rule-builder.js";
2
+ export { RULE_DEFAULTS } from "./defaults.js";
3
+ export { RULE_ALARM_DEFAULTS } from "./rule-alarm-defaults.js";
4
+ export { lambdaTarget } from "./targets/lambda-target.js";
5
+ export { sqsTarget } from "./targets/sqs-target.js";
6
+ export { snsTarget } from "./targets/sns-target.js";
7
+ export { sfnStateMachineTarget } from "./targets/sfn-state-machine-target.js";
8
+ export { eventBusTarget } from "./targets/event-bus-target.js";
9
+ export { cloudWatchLogGroupTarget } from "./targets/cloud-watch-log-group-target.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAIlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { AlarmConfig } from "@composurecdk/cloudwatch";
2
+ /**
3
+ * Controls which recommended alarms are created for an EventBridge rule.
4
+ * All applicable alarms are enabled by default with AWS-recommended thresholds.
5
+ * Set individual alarms to `false` to disable them, or provide an
6
+ * {@link AlarmConfig} to tune thresholds.
7
+ *
8
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
9
+ * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-monitoring-events-best-practices.html
10
+ */
11
+ export interface RuleAlarmConfig {
12
+ /**
13
+ * Master switch: set to `false` to disable all recommended alarms.
14
+ * Individual alarms can also be disabled via their own entry.
15
+ * @default true
16
+ */
17
+ enabled?: boolean;
18
+ /**
19
+ * Alarm when EventBridge fails to deliver matched events to a target.
20
+ *
21
+ * Metric: `AWS/Events FailedInvocations`, statistic Sum, period 1 minute.
22
+ * Default threshold: > 0 failures.
23
+ *
24
+ * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-monitoring-events-best-practices.html
25
+ */
26
+ failedInvocations?: AlarmConfig | false;
27
+ /**
28
+ * Alarm when invocations are throttled (e.g. by service-side concurrency
29
+ * limits or quota).
30
+ *
31
+ * Metric: `AWS/Events ThrottledRules`, statistic Sum, period 1 minute.
32
+ * Default threshold: > 0 throttles.
33
+ */
34
+ throttledRules?: AlarmConfig | false;
35
+ /**
36
+ * Alarm when events that could not be delivered are sent to a target's
37
+ * dead-letter queue. Only emits data when at least one target has a DLQ
38
+ * attached and EventBridge attempts redrive; {@link TreatMissingData.NOT_BREACHING}
39
+ * keeps it quiet otherwise.
40
+ *
41
+ * Metric: `AWS/Events InvocationsSentToDlq`, statistic Sum, period 1 minute.
42
+ * Default threshold: > 0 redrives.
43
+ *
44
+ * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html
45
+ */
46
+ invocationsSentToDlq?: AlarmConfig | false;
47
+ /**
48
+ * Alarm when events could not even be delivered to a dead-letter queue.
49
+ * Indicates a misconfiguration (e.g. missing EventBridge permission on
50
+ * the DLQ) that results in event loss.
51
+ *
52
+ * Metric: `AWS/Events InvocationsFailedToBeSentToDlq`, statistic Sum,
53
+ * period 1 minute.
54
+ * Default threshold: > 0 failed redrives.
55
+ */
56
+ invocationsFailedToBeSentToDlq?: AlarmConfig | false;
57
+ }
58
+ //# sourceMappingURL=rule-alarm-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarm-config.d.ts","sourceRoot":"","sources":["../src/rule-alarm-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAExC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAErC;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAE3C;;;;;;;;OAQG;IACH,8BAA8B,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;CACtD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rule-alarm-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarm-config.js","sourceRoot":"","sources":["../src/rule-alarm-config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { AlarmConfigDefaults } from "@composurecdk/cloudwatch";
2
+ interface RuleAlarmDefaults {
3
+ enabled: true;
4
+ failedInvocations: AlarmConfigDefaults;
5
+ throttledRules: AlarmConfigDefaults;
6
+ invocationsSentToDlq: AlarmConfigDefaults;
7
+ invocationsFailedToBeSentToDlq: AlarmConfigDefaults;
8
+ }
9
+ /**
10
+ * AWS-recommended default alarm configuration for EventBridge rules.
11
+ *
12
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
13
+ */
14
+ export declare const RULE_ALARM_DEFAULTS: RuleAlarmDefaults;
15
+ export {};
16
+ //# sourceMappingURL=rule-alarm-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarm-defaults.d.ts","sourceRoot":"","sources":["../src/rule-alarm-defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,UAAU,iBAAiB;IACzB,OAAO,EAAE,IAAI,CAAC;IACd,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,cAAc,EAAE,mBAAmB,CAAC;IACpC,oBAAoB,EAAE,mBAAmB,CAAC;IAC1C,8BAA8B,EAAE,mBAAmB,CAAC;CACrD;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAkCjC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { TreatMissingData } from "aws-cdk-lib/aws-cloudwatch";
2
+ /**
3
+ * AWS-recommended default alarm configuration for EventBridge rules.
4
+ *
5
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
6
+ */
7
+ export const RULE_ALARM_DEFAULTS = {
8
+ enabled: true,
9
+ /** Any failure to deliver a matched event is worth investigating; threshold 0. */
10
+ failedInvocations: {
11
+ threshold: 0,
12
+ evaluationPeriods: 1,
13
+ datapointsToAlarm: 1,
14
+ treatMissingData: TreatMissingData.NOT_BREACHING,
15
+ },
16
+ /** Any throttling indicates a quota or downstream-concurrency problem; threshold 0. */
17
+ throttledRules: {
18
+ threshold: 0,
19
+ evaluationPeriods: 1,
20
+ datapointsToAlarm: 1,
21
+ treatMissingData: TreatMissingData.NOT_BREACHING,
22
+ },
23
+ /** Any redrive to a target DLQ indicates a delivery failure worth investigating; threshold 0. */
24
+ invocationsSentToDlq: {
25
+ threshold: 0,
26
+ evaluationPeriods: 1,
27
+ datapointsToAlarm: 1,
28
+ treatMissingData: TreatMissingData.NOT_BREACHING,
29
+ },
30
+ /** Any failure to redrive to a DLQ means event loss; threshold 0. */
31
+ invocationsFailedToBeSentToDlq: {
32
+ threshold: 0,
33
+ evaluationPeriods: 1,
34
+ datapointsToAlarm: 1,
35
+ treatMissingData: TreatMissingData.NOT_BREACHING,
36
+ },
37
+ };
38
+ //# sourceMappingURL=rule-alarm-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarm-defaults.js","sourceRoot":"","sources":["../src/rule-alarm-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAW9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,OAAO,EAAE,IAAI;IAEb,kFAAkF;IAClF,iBAAiB,EAAE;QACjB,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED,uFAAuF;IACvF,cAAc,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED,iGAAiG;IACjG,oBAAoB,EAAE;QACpB,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED,qEAAqE;IACrE,8BAA8B,EAAE;QAC9B,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;CACF,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
2
+ import type { IRule } from "aws-cdk-lib/aws-events";
3
+ import type { IConstruct } from "constructs";
4
+ import type { AlarmDefinition } from "@composurecdk/cloudwatch";
5
+ import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
6
+ import type { RuleAlarmConfig } from "./rule-alarm-config.js";
7
+ /**
8
+ * Resolves the recommended alarm configuration into fully-resolved
9
+ * {@link AlarmDefinition}s for an EventBridge rule.
10
+ *
11
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
12
+ */
13
+ export declare function resolveRuleAlarmDefinitions(rule: IRule, config: RuleAlarmConfig | undefined): AlarmDefinition[];
14
+ /**
15
+ * Creates AWS-recommended CloudWatch alarms for an EventBridge rule,
16
+ * merging recommended definitions with any custom alarm builders.
17
+ *
18
+ * @param scope - CDK construct scope for creating alarm constructs.
19
+ * @param id - Base identifier for alarm construct ids.
20
+ * @param rule - The EventBridge rule to create alarms for.
21
+ * @param config - User-provided alarm configuration, or `false` to disable all.
22
+ * @param customAlarms - Custom alarm builders added via `addAlarm()`.
23
+ * @returns A record mapping alarm keys to their created Alarm constructs.
24
+ *
25
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
26
+ */
27
+ export declare function createRuleAlarms(scope: IConstruct, id: string, rule: IRule, config: RuleAlarmConfig | false | undefined, customAlarms?: AlarmDefinitionBuilder<IRule>[]): Record<string, Alarm>;
28
+ //# sourceMappingURL=rule-alarms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarms.d.ts","sourceRoot":"","sources":["../src/rule-alarms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAA8B,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAoC,MAAM,0BAA0B,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAgB9D;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,eAAe,GAAG,SAAS,GAClC,eAAe,EAAE,CA2EnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,eAAe,GAAG,KAAK,GAAG,SAAS,EAC3C,YAAY,GAAE,sBAAsB,CAAC,KAAK,CAAC,EAAO,GACjD,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAUvB"}
@@ -0,0 +1,107 @@
1
+ import { Duration } from "aws-cdk-lib";
2
+ import { ComparisonOperator, Metric } from "aws-cdk-lib/aws-cloudwatch";
3
+ import { createAlarms, resolveAlarmConfig } from "@composurecdk/cloudwatch";
4
+ import { RULE_ALARM_DEFAULTS } from "./rule-alarm-defaults.js";
5
+ const METRIC_PERIOD = Duration.minutes(1);
6
+ const METRIC_PERIOD_LABEL = `${String(METRIC_PERIOD.toMinutes())} minute`;
7
+ function ruleMetric(rule, metricName) {
8
+ return new Metric({
9
+ namespace: "AWS/Events",
10
+ metricName,
11
+ dimensionsMap: { RuleName: rule.ruleName },
12
+ statistic: "Sum",
13
+ period: METRIC_PERIOD,
14
+ });
15
+ }
16
+ /**
17
+ * Resolves the recommended alarm configuration into fully-resolved
18
+ * {@link AlarmDefinition}s for an EventBridge rule.
19
+ *
20
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
21
+ */
22
+ export function resolveRuleAlarmDefinitions(rule, config) {
23
+ if (config?.enabled === false)
24
+ return [];
25
+ const definitions = [];
26
+ if (config?.failedInvocations !== false) {
27
+ const cfg = resolveAlarmConfig(config?.failedInvocations, RULE_ALARM_DEFAULTS.failedInvocations);
28
+ definitions.push({
29
+ key: "failedInvocations",
30
+ alarmName: cfg.alarmName,
31
+ metric: ruleMetric(rule, "FailedInvocations"),
32
+ threshold: cfg.threshold,
33
+ comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
34
+ evaluationPeriods: cfg.evaluationPeriods,
35
+ datapointsToAlarm: cfg.datapointsToAlarm,
36
+ treatMissingData: cfg.treatMissingData,
37
+ description: `EventBridge rule is failing to invoke targets. Threshold: > ${String(cfg.threshold)} failures in ${METRIC_PERIOD_LABEL}.`,
38
+ });
39
+ }
40
+ if (config?.throttledRules !== false) {
41
+ const cfg = resolveAlarmConfig(config?.throttledRules, RULE_ALARM_DEFAULTS.throttledRules);
42
+ definitions.push({
43
+ key: "throttledRules",
44
+ alarmName: cfg.alarmName,
45
+ metric: ruleMetric(rule, "ThrottledRules"),
46
+ threshold: cfg.threshold,
47
+ comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
48
+ evaluationPeriods: cfg.evaluationPeriods,
49
+ datapointsToAlarm: cfg.datapointsToAlarm,
50
+ treatMissingData: cfg.treatMissingData,
51
+ description: `EventBridge rule is being throttled, indicating quota or downstream concurrency limits. Threshold: > ${String(cfg.threshold)} throttles in ${METRIC_PERIOD_LABEL}.`,
52
+ });
53
+ }
54
+ if (config?.invocationsSentToDlq !== false) {
55
+ const cfg = resolveAlarmConfig(config?.invocationsSentToDlq, RULE_ALARM_DEFAULTS.invocationsSentToDlq);
56
+ definitions.push({
57
+ key: "invocationsSentToDlq",
58
+ alarmName: cfg.alarmName,
59
+ metric: ruleMetric(rule, "InvocationsSentToDlq"),
60
+ threshold: cfg.threshold,
61
+ comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
62
+ evaluationPeriods: cfg.evaluationPeriods,
63
+ datapointsToAlarm: cfg.datapointsToAlarm,
64
+ treatMissingData: cfg.treatMissingData,
65
+ description: `EventBridge rule is redriving events to a target dead-letter queue. Threshold: > ${String(cfg.threshold)} redrives in ${METRIC_PERIOD_LABEL}.`,
66
+ });
67
+ }
68
+ if (config?.invocationsFailedToBeSentToDlq !== false) {
69
+ const cfg = resolveAlarmConfig(config?.invocationsFailedToBeSentToDlq, RULE_ALARM_DEFAULTS.invocationsFailedToBeSentToDlq);
70
+ definitions.push({
71
+ key: "invocationsFailedToBeSentToDlq",
72
+ alarmName: cfg.alarmName,
73
+ metric: ruleMetric(rule, "InvocationsFailedToBeSentToDlq"),
74
+ threshold: cfg.threshold,
75
+ comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
76
+ evaluationPeriods: cfg.evaluationPeriods,
77
+ datapointsToAlarm: cfg.datapointsToAlarm,
78
+ treatMissingData: cfg.treatMissingData,
79
+ description: `EventBridge rule failed to redrive an event to a target dead-letter queue; events may be lost. Threshold: > ${String(cfg.threshold)} failed redrives in ${METRIC_PERIOD_LABEL}.`,
80
+ });
81
+ }
82
+ return definitions;
83
+ }
84
+ /**
85
+ * Creates AWS-recommended CloudWatch alarms for an EventBridge rule,
86
+ * merging recommended definitions with any custom alarm builders.
87
+ *
88
+ * @param scope - CDK construct scope for creating alarm constructs.
89
+ * @param id - Base identifier for alarm construct ids.
90
+ * @param rule - The EventBridge rule to create alarms for.
91
+ * @param config - User-provided alarm configuration, or `false` to disable all.
92
+ * @param customAlarms - Custom alarm builders added via `addAlarm()`.
93
+ * @returns A record mapping alarm keys to their created Alarm constructs.
94
+ *
95
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
96
+ */
97
+ export function createRuleAlarms(scope, id, rule, config, customAlarms = []) {
98
+ if (config === false)
99
+ return {};
100
+ const enabled = config?.enabled ?? RULE_ALARM_DEFAULTS.enabled;
101
+ if (!enabled)
102
+ return {};
103
+ const recommended = resolveRuleAlarmDefinitions(rule, config);
104
+ const custom = customAlarms.map((b) => b.resolve(rule));
105
+ return createAlarms(scope, id, [...recommended, ...custom]);
106
+ }
107
+ //# sourceMappingURL=rule-alarms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-alarms.js","sourceRoot":"","sources":["../src/rule-alarms.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,143 @@
1
+ import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
2
+ import { type IEventBus, type IRule, type IRuleTarget, Rule, type RuleProps } from "aws-cdk-lib/aws-events";
3
+ import { type IConstruct } from "constructs";
4
+ import { COPY_STATE, type IBuilder, type Lifecycle, type Resolvable } from "@composurecdk/core";
5
+ import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
6
+ import type { RuleAlarmConfig } from "./rule-alarm-config.js";
7
+ /**
8
+ * Configuration properties for the EventBridge rule builder.
9
+ *
10
+ * Extends the CDK {@link RuleProps} but accepts a {@link Resolvable} for
11
+ * `eventBus` so the rule can be wired to a sibling component (or a custom
12
+ * event bus built elsewhere) via {@link ref} inside a {@link compose}d
13
+ * system. `targets` is excluded — use {@link IRuleBuilder.addTarget} so each
14
+ * target can carry its own `Resolvable` and be exposed in the build result.
15
+ */
16
+ export interface RuleBuilderProps extends Omit<RuleProps, "targets" | "eventBus"> {
17
+ /**
18
+ * The event bus the rule listens on. Accepts a concrete {@link IEventBus} or
19
+ * a {@link Ref} to another component's output. When omitted, the rule
20
+ * attaches to the account default bus, matching CDK's `RuleProps.eventBus`
21
+ * default.
22
+ */
23
+ eventBus?: Resolvable<IEventBus>;
24
+ /**
25
+ * Configuration for AWS-recommended CloudWatch alarms.
26
+ *
27
+ * By default, the builder creates recommended alarms with sensible
28
+ * thresholds for every applicable metric. Individual alarms can be
29
+ * customized or disabled. Set to `false` to disable all alarms.
30
+ *
31
+ * No alarm actions are configured by default since notification methods
32
+ * are user-specific. Access alarms from the build result or apply them
33
+ * via the {@link alarmActionsPolicy} from `@composurecdk/cloudwatch`.
34
+ *
35
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#EventBridge
36
+ */
37
+ recommendedAlarms?: RuleAlarmConfig | false;
38
+ }
39
+ /**
40
+ * The build output of an {@link IRuleBuilder}. Contains the CDK constructs
41
+ * created during {@link Lifecycle.build}, keyed by role.
42
+ */
43
+ export interface RuleBuilderResult {
44
+ /** The EventBridge rule construct created by the builder. */
45
+ rule: Rule;
46
+ /**
47
+ * CloudWatch alarms created for the rule, keyed by alarm key.
48
+ *
49
+ * Includes both AWS-recommended alarms and any custom alarms added via
50
+ * {@link IRuleBuilder.addAlarm}. No alarm actions are configured —
51
+ * apply them via the result or an {@link alarmActionsPolicy}.
52
+ */
53
+ alarms: Record<string, Alarm>;
54
+ /**
55
+ * Resolved {@link IRuleTarget}s registered via
56
+ * {@link IRuleBuilder.addTarget}, keyed by the key passed to that call.
57
+ *
58
+ * Always present — `{}` when no targets were added.
59
+ */
60
+ targets: Record<string, IRuleTarget>;
61
+ }
62
+ /**
63
+ * A fluent builder for configuring and creating an AWS EventBridge rule.
64
+ *
65
+ * Each configuration property from the CDK {@link RuleProps} is exposed as
66
+ * an overloaded method: call with a value to set it (returns the builder for
67
+ * chaining), or call with no arguments to read the current value.
68
+ *
69
+ * The builder implements {@link Lifecycle}, so it can be used directly as a
70
+ * component in a {@link compose | composed system}. When built, it creates an
71
+ * EventBridge rule with the configured properties and returns a
72
+ * {@link RuleBuilderResult}.
73
+ *
74
+ * Targets are registered via {@link addTarget} and accept a
75
+ * {@link Resolvable}, so cross-component wiring (a sibling Lambda, queue,
76
+ * topic, …) flows through the same {@link Ref} machinery as everything else.
77
+ *
78
+ * @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Rule.html
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { Schedule } from "aws-cdk-lib/aws-events";
83
+ * import { Duration } from "aws-cdk-lib";
84
+ *
85
+ * const rule = createRuleBuilder()
86
+ * .schedule(Schedule.rate(Duration.minutes(15)))
87
+ * .description("Idle stopper")
88
+ * .addTarget("stopper", lambdaTarget(idleStopperFn));
89
+ * ```
90
+ */
91
+ export type IRuleBuilder = IBuilder<RuleBuilderProps, RuleBuilder>;
92
+ declare class RuleBuilder implements Lifecycle<RuleBuilderResult> {
93
+ #private;
94
+ props: Partial<RuleBuilderProps>;
95
+ /**
96
+ * Register a custom CloudWatch alarm on the rule. The configure callback
97
+ * receives an {@link AlarmDefinitionBuilder} typed to {@link IRule} so the
98
+ * metric factory has access to the rule's properties.
99
+ */
100
+ addAlarm(key: string, configure: (alarm: AlarmDefinitionBuilder<IRule>) => AlarmDefinitionBuilder<IRule>): this;
101
+ /**
102
+ * Register a target to be attached to the rule at build time.
103
+ *
104
+ * Accepts any concrete {@link IRuleTarget} (the lightweight helpers in
105
+ * `./targets/` produce these) or a {@link Resolvable} so targets that wire
106
+ * cross-component references can be declared at configuration time. The
107
+ * resolved target is exposed on {@link RuleBuilderResult.targets} under
108
+ * `key`.
109
+ */
110
+ addTarget(key: string, target: Resolvable<IRuleTarget>): this;
111
+ build(scope: IConstruct, id: string, context?: Record<string, object>): RuleBuilderResult;
112
+ /** Deep-clones accumulator state so `.copy()` produces an independent builder. */
113
+ [COPY_STATE](next: RuleBuilder): void;
114
+ }
115
+ /**
116
+ * Creates a new {@link IRuleBuilder} for configuring an AWS EventBridge rule.
117
+ *
118
+ * This is the entry point for defining an EventBridge rule component. The
119
+ * returned builder exposes every {@link RuleBuilderProps} property as a
120
+ * fluent setter/getter and implements {@link Lifecycle} for use with
121
+ * {@link compose}.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * import { compose, ref } from "@composurecdk/core";
126
+ * import { createRuleBuilder, lambdaTarget } from "@composurecdk/events";
127
+ * import { Schedule } from "aws-cdk-lib/aws-events";
128
+ * import { Duration } from "aws-cdk-lib";
129
+ *
130
+ * const system = compose(
131
+ * {
132
+ * stopper: createFunctionBuilder()...,
133
+ * idleStopperSchedule: createRuleBuilder()
134
+ * .schedule(Schedule.rate(Duration.minutes(15)))
135
+ * .addTarget("stopper", lambdaTarget(ref("stopper", (r) => r.function))),
136
+ * },
137
+ * { stopper: [], idleStopperSchedule: ["stopper"] },
138
+ * );
139
+ * ```
140
+ */
141
+ export declare function createRuleBuilder(): IRuleBuilder;
142
+ export {};
143
+ //# sourceMappingURL=rule-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-builder.d.ts","sourceRoot":"","sources":["../src/rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAEL,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,SAAS,EAEd,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/E;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAEjC;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC;CAC7C;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,IAAI,EAAE,IAAI,CAAC;IAEX;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE9B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AAOnE,cAAM,WAAY,YAAW,SAAS,CAAC,iBAAiB,CAAC;;IACvD,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAM;IAItC;;;;OAIG;IACH,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,KAAK,sBAAsB,CAAC,KAAK,CAAC,GACjF,IAAI;IAKP;;;;;;;;OAQG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;IAU7D,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,iBAAiB;IA+BzF,kFAAkF;IAClF,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;CAItC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAGhD"}
@@ -0,0 +1,93 @@
1
+ import { Rule, } from "aws-cdk-lib/aws-events";
2
+ import { Builder, COPY_STATE, resolve, } from "@composurecdk/core";
3
+ import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
4
+ import { RULE_DEFAULTS } from "./defaults.js";
5
+ import { createRuleAlarms } from "./rule-alarms.js";
6
+ class RuleBuilder {
7
+ props = {};
8
+ #customAlarms = [];
9
+ #targets = [];
10
+ /**
11
+ * Register a custom CloudWatch alarm on the rule. The configure callback
12
+ * receives an {@link AlarmDefinitionBuilder} typed to {@link IRule} so the
13
+ * metric factory has access to the rule's properties.
14
+ */
15
+ addAlarm(key, configure) {
16
+ this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
17
+ return this;
18
+ }
19
+ /**
20
+ * Register a target to be attached to the rule at build time.
21
+ *
22
+ * Accepts any concrete {@link IRuleTarget} (the lightweight helpers in
23
+ * `./targets/` produce these) or a {@link Resolvable} so targets that wire
24
+ * cross-component references can be declared at configuration time. The
25
+ * resolved target is exposed on {@link RuleBuilderResult.targets} under
26
+ * `key`.
27
+ */
28
+ addTarget(key, target) {
29
+ if (this.#targets.some((t) => t.key === key)) {
30
+ throw new Error(`RuleBuilder.addTarget: duplicate key "${key}". Each target must use a unique key.`);
31
+ }
32
+ this.#targets.push({ key, target });
33
+ return this;
34
+ }
35
+ build(scope, id, context) {
36
+ const ctx = context ?? {};
37
+ const { eventBus, recommendedAlarms: alarmConfig, ...rest } = this.props;
38
+ if (rest.schedule === undefined && rest.eventPattern === undefined) {
39
+ throw new Error(`RuleBuilder "${id}": at least one of .schedule(...) or .eventPattern(...) must be set. ` +
40
+ "An EventBridge rule with neither is inert and never matches.");
41
+ }
42
+ const mergedProps = {
43
+ ...RULE_DEFAULTS,
44
+ ...rest,
45
+ ...(eventBus !== undefined && { eventBus: resolve(eventBus, ctx) }),
46
+ };
47
+ const rule = new Rule(scope, id, mergedProps);
48
+ const targets = {};
49
+ for (const entry of this.#targets) {
50
+ const resolved = resolve(entry.target, ctx);
51
+ rule.addTarget(resolved);
52
+ targets[entry.key] = resolved;
53
+ }
54
+ const alarms = createRuleAlarms(scope, id, rule, alarmConfig, this.#customAlarms);
55
+ return { rule, alarms, targets };
56
+ }
57
+ /** Deep-clones accumulator state so `.copy()` produces an independent builder. */
58
+ [COPY_STATE](next) {
59
+ next.#targets.push(...this.#targets);
60
+ next.#customAlarms.push(...this.#customAlarms);
61
+ }
62
+ }
63
+ /**
64
+ * Creates a new {@link IRuleBuilder} for configuring an AWS EventBridge rule.
65
+ *
66
+ * This is the entry point for defining an EventBridge rule component. The
67
+ * returned builder exposes every {@link RuleBuilderProps} property as a
68
+ * fluent setter/getter and implements {@link Lifecycle} for use with
69
+ * {@link compose}.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { compose, ref } from "@composurecdk/core";
74
+ * import { createRuleBuilder, lambdaTarget } from "@composurecdk/events";
75
+ * import { Schedule } from "aws-cdk-lib/aws-events";
76
+ * import { Duration } from "aws-cdk-lib";
77
+ *
78
+ * const system = compose(
79
+ * {
80
+ * stopper: createFunctionBuilder()...,
81
+ * idleStopperSchedule: createRuleBuilder()
82
+ * .schedule(Schedule.rate(Duration.minutes(15)))
83
+ * .addTarget("stopper", lambdaTarget(ref("stopper", (r) => r.function))),
84
+ * },
85
+ * { stopper: [], idleStopperSchedule: ["stopper"] },
86
+ * );
87
+ * ```
88
+ */
89
+ export function createRuleBuilder() {
90
+ // eslint-disable-next-line composurecdk/builder-must-be-tagged -- AWS::Events::Rule has no Tags property
91
+ return Builder(RuleBuilder);
92
+ }
93
+ //# sourceMappingURL=rule-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-builder.js","sourceRoot":"","sources":["../src/rule-builder.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import type { IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type LogGroupProps } from "aws-cdk-lib/aws-events-targets";
3
+ import type { ILogGroup } from "aws-cdk-lib/aws-logs";
4
+ import { type Resolvable } from "@composurecdk/core";
5
+ /**
6
+ * Wraps a CloudWatch log group as an EventBridge {@link IRuleTarget},
7
+ * deferring resolution if the log group is a {@link Ref} to a sibling
8
+ * component's output.
9
+ *
10
+ * Mirrors the {@link CloudWatchLogGroup} target from `aws-events-targets`,
11
+ * useful for audit / debug logging. `props` accepts
12
+ * {@link LogGroupProps.logEvent} (preferred over the deprecated `event`)
13
+ * to control the log payload, plus the inherited DLQ/retry options.
14
+ */
15
+ export declare function cloudWatchLogGroupTarget(logGroup: Resolvable<ILogGroup>, props?: LogGroupProps): Resolvable<IRuleTarget>;
16
+ //# sourceMappingURL=cloud-watch-log-group-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-watch-log-group-target.d.ts","sourceRoot":"","sources":["../../src/targets/cloud-watch-log-group-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,EAC/B,KAAK,CAAC,EAAE,aAAa,GACpB,UAAU,CAAC,WAAW,CAAC,CAKzB"}
@@ -0,0 +1,19 @@
1
+ import { CloudWatchLogGroup } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps a CloudWatch log group as an EventBridge {@link IRuleTarget},
5
+ * deferring resolution if the log group is a {@link Ref} to a sibling
6
+ * component's output.
7
+ *
8
+ * Mirrors the {@link CloudWatchLogGroup} target from `aws-events-targets`,
9
+ * useful for audit / debug logging. `props` accepts
10
+ * {@link LogGroupProps.logEvent} (preferred over the deprecated `event`)
11
+ * to control the log payload, plus the inherited DLQ/retry options.
12
+ */
13
+ export function cloudWatchLogGroupTarget(logGroup, props) {
14
+ if (isRef(logGroup)) {
15
+ return logGroup.map((resolved) => new CloudWatchLogGroup(resolved, props));
16
+ }
17
+ return new CloudWatchLogGroup(logGroup, props);
18
+ }
19
+ //# sourceMappingURL=cloud-watch-log-group-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-watch-log-group-target.js","sourceRoot":"","sources":["../../src/targets/cloud-watch-log-group-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gCAAgC,CAAC;AAExF,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAA+B,EAC/B,KAAqB;IAErB,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpB,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { IEventBus, IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type EventBusProps } from "aws-cdk-lib/aws-events-targets";
3
+ import { type Resolvable } from "@composurecdk/core";
4
+ /**
5
+ * Wraps an EventBridge bus as an {@link IRuleTarget}, deferring resolution
6
+ * if the bus is a {@link Ref} to a sibling component's output.
7
+ *
8
+ * Mirrors the {@link EventBusTarget} target from `aws-events-targets` —
9
+ * useful for cross-bus or cross-account routing. `props` accepts
10
+ * {@link EventBusProps.role} (otherwise CDK creates one) and a per-target
11
+ * `deadLetterQueue`. Note: bus targets do **not** support retry policy
12
+ * configuration, per CDK's {@link EventBusProps} (it intentionally does not
13
+ * extend the retry base).
14
+ */
15
+ export declare function eventBusTarget(bus: Resolvable<IEventBus>, props?: EventBusProps): Resolvable<IRuleTarget>;
16
+ //# sourceMappingURL=event-bus-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus-target.d.ts","sourceRoot":"","sources":["../../src/targets/event-bus-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,UAAU,CAAC,SAAS,CAAC,EAC1B,KAAK,CAAC,EAAE,aAAa,GACpB,UAAU,CAAC,WAAW,CAAC,CAGzB"}
@@ -0,0 +1,19 @@
1
+ import { EventBus as EventBusTarget } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps an EventBridge bus as an {@link IRuleTarget}, deferring resolution
5
+ * if the bus is a {@link Ref} to a sibling component's output.
6
+ *
7
+ * Mirrors the {@link EventBusTarget} target from `aws-events-targets` —
8
+ * useful for cross-bus or cross-account routing. `props` accepts
9
+ * {@link EventBusProps.role} (otherwise CDK creates one) and a per-target
10
+ * `deadLetterQueue`. Note: bus targets do **not** support retry policy
11
+ * configuration, per CDK's {@link EventBusProps} (it intentionally does not
12
+ * extend the retry base).
13
+ */
14
+ export function eventBusTarget(bus, props) {
15
+ if (isRef(bus))
16
+ return bus.map((resolved) => new EventBusTarget(resolved, props));
17
+ return new EventBusTarget(bus, props);
18
+ }
19
+ //# sourceMappingURL=event-bus-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus-target.js","sourceRoot":"","sources":["../../src/targets/event-bus-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAsB,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,GAA0B,EAC1B,KAAqB;IAErB,IAAI,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAClF,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type LambdaFunctionProps } from "aws-cdk-lib/aws-events-targets";
3
+ import type { IFunction } from "aws-cdk-lib/aws-lambda";
4
+ import { type Resolvable } from "@composurecdk/core";
5
+ /**
6
+ * Wraps a Lambda function as an EventBridge {@link IRuleTarget}, deferring
7
+ * resolution if the function is a {@link Ref} to a sibling component's
8
+ * output.
9
+ *
10
+ * Mirrors the {@link LambdaFunction} target from `aws-events-targets` —
11
+ * `props` accepts the same options ({@link LambdaFunctionProps.event} for
12
+ * input transformation, plus `deadLetterQueue`, `maxEventAge`,
13
+ * `retryAttempts` from {@link LambdaFunctionProps}'s base).
14
+ *
15
+ * Cross-component DLQ wiring (where the queue is built by another component)
16
+ * is supported by composing through `ref().map()` instead of passing the
17
+ * queue here directly:
18
+ *
19
+ * ```ts
20
+ * .addTarget(
21
+ * "stopper",
22
+ * ref<StopperBundle>("stopperBundle", b =>
23
+ * lambdaTarget(b.fn, { deadLetterQueue: b.dlq }),
24
+ * ),
25
+ * )
26
+ * ```
27
+ *
28
+ * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html
29
+ */
30
+ export declare function lambdaTarget(fn: Resolvable<IFunction>, props?: LambdaFunctionProps): Resolvable<IRuleTarget>;
31
+ //# sourceMappingURL=lambda-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lambda-target.d.ts","sourceRoot":"","sources":["../../src/targets/lambda-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC,EACzB,KAAK,CAAC,EAAE,mBAAmB,GAC1B,UAAU,CAAC,WAAW,CAAC,CAGzB"}
@@ -0,0 +1,33 @@
1
+ import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps a Lambda function as an EventBridge {@link IRuleTarget}, deferring
5
+ * resolution if the function is a {@link Ref} to a sibling component's
6
+ * output.
7
+ *
8
+ * Mirrors the {@link LambdaFunction} target from `aws-events-targets` —
9
+ * `props` accepts the same options ({@link LambdaFunctionProps.event} for
10
+ * input transformation, plus `deadLetterQueue`, `maxEventAge`,
11
+ * `retryAttempts` from {@link LambdaFunctionProps}'s base).
12
+ *
13
+ * Cross-component DLQ wiring (where the queue is built by another component)
14
+ * is supported by composing through `ref().map()` instead of passing the
15
+ * queue here directly:
16
+ *
17
+ * ```ts
18
+ * .addTarget(
19
+ * "stopper",
20
+ * ref<StopperBundle>("stopperBundle", b =>
21
+ * lambdaTarget(b.fn, { deadLetterQueue: b.dlq }),
22
+ * ),
23
+ * )
24
+ * ```
25
+ *
26
+ * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html
27
+ */
28
+ export function lambdaTarget(fn, props) {
29
+ if (isRef(fn))
30
+ return fn.map((resolved) => new LambdaFunction(resolved, props));
31
+ return new LambdaFunction(fn, props);
32
+ }
33
+ //# sourceMappingURL=lambda-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lambda-target.js","sourceRoot":"","sources":["../../src/targets/lambda-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA4B,MAAM,gCAAgC,CAAC;AAE1F,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAyB,EACzB,KAA2B;IAE3B,IAAI,KAAK,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAChF,OAAO,IAAI,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type SfnStateMachineProps } from "aws-cdk-lib/aws-events-targets";
3
+ import type { IStateMachine } from "aws-cdk-lib/aws-stepfunctions";
4
+ import { type Resolvable } from "@composurecdk/core";
5
+ /**
6
+ * Wraps a Step Functions state machine as an EventBridge
7
+ * {@link IRuleTarget}, deferring resolution if the state machine is a
8
+ * {@link Ref} to a sibling component's output.
9
+ *
10
+ * Mirrors the {@link SfnStateMachine} target from `aws-events-targets` —
11
+ * `props` accepts {@link SfnStateMachineProps.input} for input
12
+ * transformation, an explicit `role` (otherwise CDK creates one), plus the
13
+ * inherited DLQ/retry options.
14
+ */
15
+ export declare function sfnStateMachineTarget(stateMachine: Resolvable<IStateMachine>, props?: SfnStateMachineProps): Resolvable<IRuleTarget>;
16
+ //# sourceMappingURL=sfn-state-machine-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfn-state-machine-target.d.ts","sourceRoot":"","sources":["../../src/targets/sfn-state-machine-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,UAAU,CAAC,aAAa,CAAC,EACvC,KAAK,CAAC,EAAE,oBAAoB,GAC3B,UAAU,CAAC,WAAW,CAAC,CAKzB"}
@@ -0,0 +1,19 @@
1
+ import { SfnStateMachine } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps a Step Functions state machine as an EventBridge
5
+ * {@link IRuleTarget}, deferring resolution if the state machine is a
6
+ * {@link Ref} to a sibling component's output.
7
+ *
8
+ * Mirrors the {@link SfnStateMachine} target from `aws-events-targets` —
9
+ * `props` accepts {@link SfnStateMachineProps.input} for input
10
+ * transformation, an explicit `role` (otherwise CDK creates one), plus the
11
+ * inherited DLQ/retry options.
12
+ */
13
+ export function sfnStateMachineTarget(stateMachine, props) {
14
+ if (isRef(stateMachine)) {
15
+ return stateMachine.map((resolved) => new SfnStateMachine(resolved, props));
16
+ }
17
+ return new SfnStateMachine(stateMachine, props);
18
+ }
19
+ //# sourceMappingURL=sfn-state-machine-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfn-state-machine-target.js","sourceRoot":"","sources":["../../src/targets/sfn-state-machine-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA6B,MAAM,gCAAgC,CAAC;AAE5F,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAuC,EACvC,KAA4B;IAE5B,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;QACxB,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,IAAI,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type SnsTopicProps } from "aws-cdk-lib/aws-events-targets";
3
+ import type { ITopic } from "aws-cdk-lib/aws-sns";
4
+ import { type Resolvable } from "@composurecdk/core";
5
+ /**
6
+ * Wraps an SNS topic as an EventBridge {@link IRuleTarget}, deferring
7
+ * resolution if the topic is a {@link Ref} to a sibling component's output.
8
+ *
9
+ * Mirrors the {@link SnsTopic} target from `aws-events-targets` — `props`
10
+ * accepts {@link SnsTopicProps.message} for input transformation, and the
11
+ * IAM `role` / `authorizeUsingRole` options for cross-account publishing.
12
+ *
13
+ * Note: SNS targets do not accept a per-target DLQ
14
+ * ({@link SnsTopicProps} does not extend the retry/DLQ base type).
15
+ */
16
+ export declare function snsTarget(topic: Resolvable<ITopic>, props?: SnsTopicProps): Resolvable<IRuleTarget>;
17
+ //# sourceMappingURL=sns-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns-target.d.ts","sourceRoot":"","sources":["../../src/targets/sns-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EACzB,KAAK,CAAC,EAAE,aAAa,GACpB,UAAU,CAAC,WAAW,CAAC,CAGzB"}
@@ -0,0 +1,19 @@
1
+ import { SnsTopic } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps an SNS topic as an EventBridge {@link IRuleTarget}, deferring
5
+ * resolution if the topic is a {@link Ref} to a sibling component's output.
6
+ *
7
+ * Mirrors the {@link SnsTopic} target from `aws-events-targets` — `props`
8
+ * accepts {@link SnsTopicProps.message} for input transformation, and the
9
+ * IAM `role` / `authorizeUsingRole` options for cross-account publishing.
10
+ *
11
+ * Note: SNS targets do not accept a per-target DLQ
12
+ * ({@link SnsTopicProps} does not extend the retry/DLQ base type).
13
+ */
14
+ export function snsTarget(topic, props) {
15
+ if (isRef(topic))
16
+ return topic.map((resolved) => new SnsTopic(resolved, props));
17
+ return new SnsTopic(topic, props);
18
+ }
19
+ //# sourceMappingURL=sns-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns-target.js","sourceRoot":"","sources":["../../src/targets/sns-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAsB,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,KAAyB,EACzB,KAAqB;IAErB,IAAI,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAChF,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { IRuleTarget } from "aws-cdk-lib/aws-events";
2
+ import { type SqsQueueProps } from "aws-cdk-lib/aws-events-targets";
3
+ import type { IQueue } from "aws-cdk-lib/aws-sqs";
4
+ import { type Resolvable } from "@composurecdk/core";
5
+ /**
6
+ * Wraps an SQS queue as an EventBridge {@link IRuleTarget}, deferring
7
+ * resolution if the queue is a {@link Ref} to a sibling component's output.
8
+ *
9
+ * Mirrors the {@link SqsQueue} target from `aws-events-targets` — `props`
10
+ * accepts {@link SqsQueueProps.message} for input transformation,
11
+ * {@link SqsQueueProps.messageGroupId} (required for FIFO targets), plus the
12
+ * `deadLetterQueue` / `maxEventAge` / `retryAttempts` reliability options
13
+ * from the inherited base.
14
+ */
15
+ export declare function sqsTarget(queue: Resolvable<IQueue>, props?: SqsQueueProps): Resolvable<IRuleTarget>;
16
+ //# sourceMappingURL=sqs-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqs-target.d.ts","sourceRoot":"","sources":["../../src/targets/sqs-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EACzB,KAAK,CAAC,EAAE,aAAa,GACpB,UAAU,CAAC,WAAW,CAAC,CAGzB"}
@@ -0,0 +1,18 @@
1
+ import { SqsQueue } from "aws-cdk-lib/aws-events-targets";
2
+ import { isRef } from "@composurecdk/core";
3
+ /**
4
+ * Wraps an SQS queue as an EventBridge {@link IRuleTarget}, deferring
5
+ * resolution if the queue is a {@link Ref} to a sibling component's output.
6
+ *
7
+ * Mirrors the {@link SqsQueue} target from `aws-events-targets` — `props`
8
+ * accepts {@link SqsQueueProps.message} for input transformation,
9
+ * {@link SqsQueueProps.messageGroupId} (required for FIFO targets), plus the
10
+ * `deadLetterQueue` / `maxEventAge` / `retryAttempts` reliability options
11
+ * from the inherited base.
12
+ */
13
+ export function sqsTarget(queue, props) {
14
+ if (isRef(queue))
15
+ return queue.map((resolved) => new SqsQueue(resolved, props));
16
+ return new SqsQueue(queue, props);
17
+ }
18
+ //# sourceMappingURL=sqs-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqs-target.js","sourceRoot":"","sources":["../../src/targets/sqs-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAsB,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,KAAyB,EACzB,KAAqB;IAErB,IAAI,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAChF,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@composurecdk/events",
3
+ "version": "0.6.0",
4
+ "description": "Composable EventBridge rule builder with well-architected defaults",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/laazyj/composureCDK",
8
+ "directory": "packages/events"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "clean": "rm -rf dist",
25
+ "build": "tsc -p tsconfig.build.json",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest"
29
+ },
30
+ "keywords": [],
31
+ "author": "Jason Duffett (https://github.com/laazyj)",
32
+ "license": "MIT",
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "type": "module",
37
+ "peerDependencies": {
38
+ "@composurecdk/cloudwatch": "^0.6.0",
39
+ "@composurecdk/core": "^0.6.0",
40
+ "aws-cdk-lib": "^2.0.0",
41
+ "constructs": "^10.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^25.6.0",
45
+ "aws-cdk-lib": "^2.250.0",
46
+ "constructs": "^10.6.0",
47
+ "typescript": "^6.0.3",
48
+ "vitest": "^4.1.4"
49
+ }
50
+ }