@composurecdk/lambda 0.7.0 → 0.8.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.
- package/README.md +138 -6
- package/dist/{alarm-config.d.ts → commonjs/alarm-config.d.ts} +30 -0
- package/dist/commonjs/alarm-config.d.ts.map +1 -0
- package/dist/commonjs/alarm-config.js +3 -0
- package/dist/{alarm-config.js.map → commonjs/alarm-config.js.map} +1 -1
- package/dist/{alarm-defaults.d.ts → commonjs/alarm-defaults.d.ts} +2 -0
- package/dist/commonjs/alarm-defaults.d.ts.map +1 -0
- package/dist/commonjs/alarm-defaults.js +61 -0
- package/dist/commonjs/alarm-defaults.js.map +1 -0
- package/dist/commonjs/defaults.d.ts.map +1 -0
- package/dist/commonjs/defaults.js +23 -0
- package/dist/commonjs/defaults.js.map +1 -0
- package/dist/commonjs/event-sources/composure-event-source.d.ts +76 -0
- package/dist/commonjs/event-sources/composure-event-source.d.ts.map +1 -0
- package/dist/commonjs/event-sources/composure-event-source.js +36 -0
- package/dist/commonjs/event-sources/composure-event-source.js.map +1 -0
- package/dist/commonjs/event-sources/sqs-event-source.d.ts +54 -0
- package/dist/commonjs/event-sources/sqs-event-source.d.ts.map +1 -0
- package/dist/commonjs/event-sources/sqs-event-source.js +80 -0
- package/dist/commonjs/event-sources/sqs-event-source.js.map +1 -0
- package/dist/{function-alarms.d.ts → commonjs/function-alarms.d.ts} +5 -2
- package/dist/commonjs/function-alarms.d.ts.map +1 -0
- package/dist/commonjs/function-alarms.js +191 -0
- package/dist/commonjs/function-alarms.js.map +1 -0
- package/dist/commonjs/function-builder.d.ts +252 -0
- package/dist/commonjs/function-builder.d.ts.map +1 -0
- package/dist/commonjs/function-builder.js +233 -0
- package/dist/commonjs/function-builder.js.map +1 -0
- package/dist/{index.d.ts → commonjs/index.d.ts} +2 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/esm/alarm-config.d.ts +114 -0
- package/dist/esm/alarm-config.d.ts.map +1 -0
- package/dist/esm/alarm-config.js.map +1 -0
- package/dist/esm/alarm-defaults.d.ts +19 -0
- package/dist/esm/alarm-defaults.d.ts.map +1 -0
- package/dist/{alarm-defaults.js → esm/alarm-defaults.js} +14 -0
- package/dist/esm/alarm-defaults.js.map +1 -0
- package/dist/esm/defaults.d.ts +8 -0
- package/dist/esm/defaults.d.ts.map +1 -0
- package/dist/esm/defaults.js.map +1 -0
- package/dist/esm/event-sources/composure-event-source.d.ts +76 -0
- package/dist/esm/event-sources/composure-event-source.d.ts.map +1 -0
- package/dist/esm/event-sources/composure-event-source.js +31 -0
- package/dist/esm/event-sources/composure-event-source.js.map +1 -0
- package/dist/esm/event-sources/sqs-event-source.d.ts +54 -0
- package/dist/esm/event-sources/sqs-event-source.d.ts.map +1 -0
- package/dist/esm/event-sources/sqs-event-source.js +76 -0
- package/dist/esm/event-sources/sqs-event-source.js.map +1 -0
- package/dist/esm/function-alarms.d.ts +31 -0
- package/dist/esm/function-alarms.d.ts.map +1 -0
- package/dist/{function-alarms.js → esm/function-alarms.js} +69 -4
- package/dist/esm/function-alarms.js.map +1 -0
- package/dist/esm/function-builder.d.ts +252 -0
- package/dist/esm/function-builder.d.ts.map +1 -0
- package/dist/esm/function-builder.js +230 -0
- package/dist/esm/function-builder.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/{index.js → esm/index.js} +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +38 -18
- package/dist/alarm-config.d.ts.map +0 -1
- package/dist/alarm-defaults.d.ts.map +0 -1
- package/dist/alarm-defaults.js.map +0 -1
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js.map +0 -1
- package/dist/function-alarms.d.ts.map +0 -1
- package/dist/function-alarms.js.map +0 -1
- package/dist/function-builder.d.ts +0 -140
- package/dist/function-builder.d.ts.map +0 -1
- package/dist/function-builder.js +0 -67
- package/dist/function-builder.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{defaults.d.ts → commonjs/defaults.d.ts} +0 -0
- /package/dist/{alarm-config.js → esm/alarm-config.js} +0 -0
- /package/dist/{defaults.js → esm/defaults.js} +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { ManagedPolicy } from "aws-cdk-lib/aws-iam";
|
|
2
|
+
import { Function as LambdaFunction, } from "aws-cdk-lib/aws-lambda";
|
|
3
|
+
import { COPY_STATE, resolve } from "@composurecdk/core";
|
|
4
|
+
import { taggedBuilder } from "@composurecdk/cloudformation";
|
|
5
|
+
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
6
|
+
import { createServiceRoleBuilder, createStatementBuilder, } from "@composurecdk/iam";
|
|
7
|
+
import { createLogGroupBuilder } from "@composurecdk/logs";
|
|
8
|
+
import { createFunctionAlarms } from "./function-alarms.js";
|
|
9
|
+
import { FUNCTION_DEFAULTS } from "./defaults.js";
|
|
10
|
+
import { EVENT_SOURCE_MAPPING_ID_READERS, isComposureEventSource, } from "./event-sources/composure-event-source.js";
|
|
11
|
+
const LOGS_WRITER_POLICY_NAME = "LogsWriter";
|
|
12
|
+
class FunctionBuilder {
|
|
13
|
+
props = {};
|
|
14
|
+
#customAlarms = [];
|
|
15
|
+
#eventSources = [];
|
|
16
|
+
#configureRole;
|
|
17
|
+
#useCdkAutoRole = false;
|
|
18
|
+
addAlarm(key, configure) {
|
|
19
|
+
this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register an event source to be attached to the function at build time.
|
|
24
|
+
*
|
|
25
|
+
* A Lambda function can have many event sources of mixed types, so this
|
|
26
|
+
* hook is repeatable and typed to the common {@link IEventSource}. Pass a
|
|
27
|
+
* {@link ComposureEventSource} from a ComposureCDK factory (e.g. {@link sqsEventSource})
|
|
28
|
+
* or a bare concrete {@link IEventSource}.
|
|
29
|
+
*
|
|
30
|
+
* At build time the source is resolved and attached *after* the function
|
|
31
|
+
* (and its least-privilege execution role) exist, so the `source.bind(fn)`
|
|
32
|
+
* that `addEventSource` performs grants the consume permission onto the
|
|
33
|
+
* builder's role. The resolved source is exposed on
|
|
34
|
+
* {@link FunctionBuilderResult.eventSources} under `key`.
|
|
35
|
+
*
|
|
36
|
+
* Sources built by a recognised factory also enable contextual alarms —
|
|
37
|
+
* see {@link FunctionBuilderProps.recommendedAlarms}.
|
|
38
|
+
*
|
|
39
|
+
* @throws If `key` was already used by a previous `addEventSource` call.
|
|
40
|
+
*/
|
|
41
|
+
addEventSource(key, source) {
|
|
42
|
+
if (this.#eventSources.some((e) => e.key === key)) {
|
|
43
|
+
throw new Error(`FunctionBuilder.addEventSource: duplicate key "${key}". Each event source must use a unique key.`);
|
|
44
|
+
}
|
|
45
|
+
this.#eventSources.push({ key, source });
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Extend the default execution-role builder with additional configuration
|
|
50
|
+
* (inline policies, managed-policy attachments, description, etc.).
|
|
51
|
+
*
|
|
52
|
+
* The callback receives the internal {@link IRoleBuilder} that the function
|
|
53
|
+
* builder will use to construct the role. Calling `configureRole` more than
|
|
54
|
+
* once replaces the previous callback. The default `LogsWriter` inline
|
|
55
|
+
* policy is added before the callback runs; supplying another inline
|
|
56
|
+
* policy with the name `LogsWriter` throws at build time.
|
|
57
|
+
*
|
|
58
|
+
* Mutually exclusive with {@link role} and {@link useCdkAutoRole}.
|
|
59
|
+
*/
|
|
60
|
+
configureRole(fn) {
|
|
61
|
+
this.#configureRole = fn;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Opt back into CDK's auto-created execution role attached to the
|
|
66
|
+
* `AWSLambdaBasicExecutionRole` managed policy.
|
|
67
|
+
*
|
|
68
|
+
* **Not the recommended path.** The default builder-created role grants
|
|
69
|
+
* `logs:CreateLogStream` and `logs:PutLogEvents` scoped to the function's
|
|
70
|
+
* own log group; CDK's auto-role grants those actions on `*` and also
|
|
71
|
+
* permits `logs:CreateLogGroup` arbitrarily. Use this escape hatch only
|
|
72
|
+
* when matching an existing stack's logical IDs during a phased migration
|
|
73
|
+
* or when the wildcard log surface is a deliberate trade-off.
|
|
74
|
+
*
|
|
75
|
+
* Mutually exclusive with {@link role} and {@link configureRole}.
|
|
76
|
+
*/
|
|
77
|
+
useCdkAutoRole() {
|
|
78
|
+
this.#useCdkAutoRole = true;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/** @internal — see ADR-0005. */
|
|
82
|
+
[COPY_STATE](target) {
|
|
83
|
+
target.#customAlarms.push(...this.#customAlarms);
|
|
84
|
+
target.#eventSources.push(...this.#eventSources);
|
|
85
|
+
target.#configureRole = this.#configureRole;
|
|
86
|
+
target.#useCdkAutoRole = this.#useCdkAutoRole;
|
|
87
|
+
}
|
|
88
|
+
build(scope, id, context = {}) {
|
|
89
|
+
const { role: roleResolvable, recommendedAlarms: alarmConfig, ...functionProps } = this.props;
|
|
90
|
+
const seamCount = (roleResolvable !== undefined ? 1 : 0) +
|
|
91
|
+
(this.#configureRole !== undefined ? 1 : 0) +
|
|
92
|
+
(this.#useCdkAutoRole ? 1 : 0);
|
|
93
|
+
if (seamCount > 1) {
|
|
94
|
+
throw new Error(`FunctionBuilder "${id}": .role(), .configureRole(), and .useCdkAutoRole() are mutually exclusive`);
|
|
95
|
+
}
|
|
96
|
+
let logGroup;
|
|
97
|
+
let logGroupProps = {};
|
|
98
|
+
if (!this.props.logGroup) {
|
|
99
|
+
logGroup = createLogGroupBuilder().build(scope, `${id}LogGroup`).logGroup;
|
|
100
|
+
logGroupProps = { logGroup };
|
|
101
|
+
}
|
|
102
|
+
let role;
|
|
103
|
+
if (roleResolvable !== undefined) {
|
|
104
|
+
role = resolve(roleResolvable, context);
|
|
105
|
+
}
|
|
106
|
+
else if (!this.#useCdkAutoRole) {
|
|
107
|
+
role = this.#buildDefaultRole(scope, id, context, (logGroup ?? this.props.logGroup));
|
|
108
|
+
}
|
|
109
|
+
const mergedProps = {
|
|
110
|
+
...FUNCTION_DEFAULTS,
|
|
111
|
+
...logGroupProps,
|
|
112
|
+
...functionProps,
|
|
113
|
+
...(role ? { role } : {}),
|
|
114
|
+
};
|
|
115
|
+
const fn = new LambdaFunction(scope, id, mergedProps);
|
|
116
|
+
const eventSources = {};
|
|
117
|
+
const attachedEventSources = [];
|
|
118
|
+
for (const entry of this.#eventSources) {
|
|
119
|
+
const outer = resolve(entry.source, context);
|
|
120
|
+
let kind = "unknown";
|
|
121
|
+
let eventSource;
|
|
122
|
+
if (isComposureEventSource(outer)) {
|
|
123
|
+
kind = outer.kind;
|
|
124
|
+
eventSource = resolve(outer.source, context);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
eventSource = outer;
|
|
128
|
+
}
|
|
129
|
+
// Attach after the function exists so the `source.bind(fn)` that
|
|
130
|
+
// `addEventSource` performs grants the consume permission onto the
|
|
131
|
+
// builder's least-privilege role; the mapping UUID is only readable
|
|
132
|
+
// once bound.
|
|
133
|
+
fn.addEventSource(eventSource);
|
|
134
|
+
eventSources[entry.key] = eventSource;
|
|
135
|
+
attachedEventSources.push({
|
|
136
|
+
key: entry.key,
|
|
137
|
+
kind,
|
|
138
|
+
eventSourceMappingId: EVENT_SOURCE_MAPPING_ID_READERS[kind]?.(eventSource),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const alarms = createFunctionAlarms(scope, id, fn, alarmConfig, mergedProps, attachedEventSources, this.#customAlarms);
|
|
142
|
+
const resolvedRole = role ?? fn.role;
|
|
143
|
+
if (!resolvedRole) {
|
|
144
|
+
throw new Error(`FunctionBuilder "${id}": Lambda function has no execution role.`);
|
|
145
|
+
}
|
|
146
|
+
return { function: fn, role: resolvedRole, logGroup, alarms, eventSources };
|
|
147
|
+
}
|
|
148
|
+
#buildDefaultRole(scope, id, context, logGroup) {
|
|
149
|
+
if (!logGroup) {
|
|
150
|
+
throw new Error(`FunctionBuilder "${id}": cannot build the default execution role without a log group.`);
|
|
151
|
+
}
|
|
152
|
+
const logGroupArn = logGroup.logGroupArn;
|
|
153
|
+
const roleBuilder = createServiceRoleBuilder("lambda.amazonaws.com").addInlinePolicyStatements(LOGS_WRITER_POLICY_NAME, [
|
|
154
|
+
createStatementBuilder()
|
|
155
|
+
.allow()
|
|
156
|
+
.actions(["logs:CreateLogStream", "logs:PutLogEvents"])
|
|
157
|
+
.resources([logGroupArn, `${logGroupArn}:log-stream:*`]),
|
|
158
|
+
]);
|
|
159
|
+
// CDK attaches AWSLambdaVPCAccessExecutionRole only when it constructs
|
|
160
|
+
// the role itself; when we supply the role we must add it ourselves.
|
|
161
|
+
if (this.props.vpc) {
|
|
162
|
+
roleBuilder.managedPolicies([
|
|
163
|
+
...(roleBuilder.managedPolicies() ?? []),
|
|
164
|
+
ManagedPolicy.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole"),
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
if (this.#configureRole) {
|
|
168
|
+
this.#configureRole(guardLogsWriter(roleBuilder, id));
|
|
169
|
+
}
|
|
170
|
+
return roleBuilder.build(scope, `${id}ExecutionRole`, context).role;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Creates a new {@link IFunctionBuilder} for configuring an AWS Lambda function.
|
|
175
|
+
*
|
|
176
|
+
* This is the entry point for defining a Lambda function component. The returned
|
|
177
|
+
* builder exposes every {@link FunctionBuilderProps} property as a fluent setter/getter
|
|
178
|
+
* and implements {@link Lifecycle} for use with {@link compose}.
|
|
179
|
+
*
|
|
180
|
+
* @returns A fluent builder for an AWS Lambda function.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const handler = createFunctionBuilder()
|
|
185
|
+
* .runtime(Runtime.NODEJS_22_X)
|
|
186
|
+
* .handler("index.handler")
|
|
187
|
+
* .code(Code.fromAsset("lambda"))
|
|
188
|
+
* .timeout(Duration.seconds(30));
|
|
189
|
+
*
|
|
190
|
+
* // Use standalone:
|
|
191
|
+
* const result = handler.build(stack, "MyFunction");
|
|
192
|
+
*
|
|
193
|
+
* // Or compose into a system:
|
|
194
|
+
* const system = compose(
|
|
195
|
+
* { handler, table: createTableBuilder() },
|
|
196
|
+
* { handler: ["table"], table: [] },
|
|
197
|
+
* );
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export function createFunctionBuilder() {
|
|
201
|
+
return taggedBuilder(FunctionBuilder);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Wraps a role builder so a user configurator that calls
|
|
205
|
+
* `addInlinePolicyStatements("LogsWriter", ...)` fails loudly. RoleBuilder
|
|
206
|
+
* stores inline policies in an internal array and the resulting record uses
|
|
207
|
+
* the policy name as a key — a duplicate `LogsWriter` would silently
|
|
208
|
+
* overwrite the scoped log policy and re-introduce wildcard log access.
|
|
209
|
+
*/
|
|
210
|
+
function guardLogsWriter(rb, functionId) {
|
|
211
|
+
const original = rb.addInlinePolicyStatements.bind(rb);
|
|
212
|
+
return new Proxy(rb, {
|
|
213
|
+
get(target, prop, receiver) {
|
|
214
|
+
if (prop === "addInlinePolicyStatements") {
|
|
215
|
+
const guarded = (name, statements) => {
|
|
216
|
+
if (name === LOGS_WRITER_POLICY_NAME) {
|
|
217
|
+
throw new Error(`FunctionBuilder "${functionId}": cannot add an inline policy named ` +
|
|
218
|
+
`"${LOGS_WRITER_POLICY_NAME}" via .configureRole — the builder already ` +
|
|
219
|
+
`attaches one scoped to the function's log group. Use a different ` +
|
|
220
|
+
`name or call .role(...) to take full control of the role.`);
|
|
221
|
+
}
|
|
222
|
+
return original(name, statements);
|
|
223
|
+
};
|
|
224
|
+
return guarded;
|
|
225
|
+
}
|
|
226
|
+
return Reflect.get(target, prop, receiver);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=function-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-builder.js","sourceRoot":"","sources":["../../src/function-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,QAAQ,IAAI,cAAc,GAG3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAkB,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAuB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAGL,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,uBAAuB,GAAG,YAAY,CAAC;AA2K7C,MAAM,eAAe;IACnB,KAAK,GAAkC,EAAE,CAAC;IACjC,aAAa,GAA6C,EAAE,CAAC;IAC7D,aAAa,GAAuB,EAAE,CAAC;IAChD,cAAc,CAAiC;IAC/C,eAAe,GAAG,KAAK,CAAC;IAExB,QAAQ,CACN,GAAW,EACX,SAE2C;QAE3C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,sBAAsB,CAAiB,GAAG,CAAC,CAAC,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,cAAc,CA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CAAC,EAAE,CAAC,CAAC;IACvD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE;QACnB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,IAAI,IAAI,KAAK,2BAA2B,EAAE,CAAC;gBACzC,MAAM,OAAO,GAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE;oBACpD,IAAI,IAAI,KAAK,uBAAuB,EAAE,CAAC;wBACrC,MAAM,IAAI,KAAK,CACb,oBAAoB,UAAU,uCAAuC;4BACnE,IAAI,uBAAuB,6CAA6C;4BACxE,mEAAmE;4BACnE,2DAA2D,CAC9D,CAAC;oBACJ,CAAC;oBACD,OAAO,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBACpC,CAAC,CAAC;gBACF,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAY,CAAC;QACxD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createFunctionBuilder, type FunctionBuilderProps, type FunctionBuilderResult, type IFunctionBuilder, } from "./function-builder.js";
|
|
2
|
+
export { FUNCTION_DEFAULTS } from "./defaults.js";
|
|
3
|
+
export { type FunctionAlarmConfig, type PercentageAlarmConfig } from "./alarm-config.js";
|
|
4
|
+
export { FUNCTION_ALARM_DEFAULTS } from "./alarm-defaults.js";
|
|
5
|
+
export { type ComposureEventSource, type EventSourceKind, } from "./event-sources/composure-event-source.js";
|
|
6
|
+
export { sqsEventSource, DEFAULT_SQS_EVENT_SOURCE_PROPS, } from "./event-sources/sqs-event-source.js";
|
|
7
|
+
//# 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,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,cAAc,EACd,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createFunctionBuilder, } from "./function-builder.js";
|
|
2
2
|
export { FUNCTION_DEFAULTS } from "./defaults.js";
|
|
3
3
|
export { FUNCTION_ALARM_DEFAULTS } from "./alarm-defaults.js";
|
|
4
|
+
export { sqsEventSource, DEFAULT_SQS_EVENT_SOURCE_PROPS, } from "./event-sources/sqs-event-source.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAItB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAK9D,OAAO,EACL,cAAc,EACd,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composurecdk/lambda",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Composable Lambda function builder with well-architected defaults",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/laazyj/composureCDK",
|
|
8
8
|
"directory": "packages/lambda"
|
|
9
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
10
|
"files": [
|
|
19
11
|
"dist",
|
|
20
12
|
"README.md",
|
|
21
13
|
"LICENSE"
|
|
22
14
|
],
|
|
23
15
|
"scripts": {
|
|
24
|
-
"clean": "rm -rf dist",
|
|
25
|
-
"build": "
|
|
16
|
+
"clean": "rm -rf dist .tshy .tshy-build",
|
|
17
|
+
"build": "tshy",
|
|
26
18
|
"typecheck": "tsc --noEmit",
|
|
19
|
+
"check:exports": "attw --pack . --profile node16 && publint",
|
|
27
20
|
"test": "vitest run --passWithNoTests",
|
|
28
21
|
"test:watch": "vitest"
|
|
29
22
|
},
|
|
@@ -34,19 +27,46 @@
|
|
|
34
27
|
"access": "public"
|
|
35
28
|
},
|
|
36
29
|
"type": "module",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20"
|
|
32
|
+
},
|
|
33
|
+
"tshy": {
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
".": "./src/index.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
37
39
|
"peerDependencies": {
|
|
38
|
-
"@composurecdk/cloudformation": "^0.
|
|
39
|
-
"@composurecdk/cloudwatch": "^0.
|
|
40
|
-
"@composurecdk/core": "^0.
|
|
41
|
-
"@composurecdk/
|
|
40
|
+
"@composurecdk/cloudformation": "^0.8.0",
|
|
41
|
+
"@composurecdk/cloudwatch": "^0.8.0",
|
|
42
|
+
"@composurecdk/core": "^0.8.0",
|
|
43
|
+
"@composurecdk/iam": "^0.8.0",
|
|
44
|
+
"@composurecdk/logs": "^0.8.0",
|
|
42
45
|
"aws-cdk-lib": "^2.0.0",
|
|
43
46
|
"constructs": "^10.0.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
49
|
+
"@composurecdk/iam": "^0.8.0",
|
|
50
|
+
"@types/node": "^25.6.2",
|
|
51
|
+
"aws-cdk-lib": "^2.253.1",
|
|
48
52
|
"constructs": "^10.6.0",
|
|
49
53
|
"typescript": "^6.0.3",
|
|
50
54
|
"vitest": "^4.1.4"
|
|
51
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"exports": {
|
|
57
|
+
"./package.json": "./package.json",
|
|
58
|
+
".": {
|
|
59
|
+
"import": {
|
|
60
|
+
"types": "./dist/esm/index.d.ts",
|
|
61
|
+
"default": "./dist/esm/index.js"
|
|
62
|
+
},
|
|
63
|
+
"require": {
|
|
64
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
65
|
+
"default": "./dist/commonjs/index.js"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"main": "./dist/commonjs/index.js",
|
|
70
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
71
|
+
"module": "./dist/esm/index.js"
|
|
52
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alarm-config.d.ts","sourceRoot":"","sources":["../src/alarm-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG;IACnE;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC;AAE/F;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAE7B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,qBAAqB,GAAG,KAAK,CAAC;IAEzC;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,KAAK,CAAC;CACtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alarm-defaults.d.ts","sourceRoot":"","sources":["../src/alarm-defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,UAAU,qBAAqB;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,EAAE,6BAA6B,CAAC;IACxC,oBAAoB,EAAE,6BAA6B,CAAC;CACrD;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAwCrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alarm-defaults.js","sourceRoot":"","sources":["../src/alarm-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAY9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA0B;IAC5D,OAAO,EAAE,IAAI;IAEb,qDAAqD;IACrD,MAAM,EAAE;QACN,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED,6DAA6D;IAC7D,SAAS,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED;;;OAGG;IACH,QAAQ,EAAE;QACR,gBAAgB,EAAE,GAAG;QACrB,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;IAED;;;OAGG;IACH,oBAAoB,EAAE;QACpB,gBAAgB,EAAE,GAAG;QACrB,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;KACjD;CACF,CAAC"}
|
package/dist/defaults.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,aAAa,CAapD,CAAC"}
|
package/dist/defaults.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC,MAAM;IAEvB;;;;OAIG;IACH,aAAa,EAAE,aAAa,CAAC,IAAI;CAClC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-alarms.d.ts","sourceRoot":"","sources":["../src/function-alarms.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EAIX,MAAM,4BAA4B,CA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AAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,WAAW,GAAG,+BAA+B,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAEtD,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAUD;;;GAGG;AACH,SAAS,4BAA4B,CACnC,UAA6C,EAC7C,QAAuC;IAEvC,MAAM,gBAAgB,GAAG,UAAU,EAAE,gBAAgB,IAAI,QAAQ,CAAC,gBAAgB,CAAC;IAEnF,IAAI,gBAAgB,IAAI,CAAC,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,yEAAyE,MAAM,CAAC,gBAAgB,CAAC,GAAG,CACrG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,UAAU,EAAE,SAAS;QAChC,gBAAgB;QAChB,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;QAC9E,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;QAC9E,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,IAAI,QAAQ,CAAC,gBAAgB;KAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
|
|
2
|
-
import { Function as LambdaFunction, type FunctionProps } from "aws-cdk-lib/aws-lambda";
|
|
3
|
-
import type { LogGroup } from "aws-cdk-lib/aws-logs";
|
|
4
|
-
import { type IConstruct } from "constructs";
|
|
5
|
-
import { COPY_STATE, type Lifecycle } from "@composurecdk/core";
|
|
6
|
-
import { type ITaggedBuilder } from "@composurecdk/cloudformation";
|
|
7
|
-
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
8
|
-
import type { FunctionAlarmConfig } from "./alarm-config.js";
|
|
9
|
-
/**
|
|
10
|
-
* Configuration properties for the Lambda function builder.
|
|
11
|
-
*
|
|
12
|
-
* Extends the CDK {@link FunctionProps} with additional builder-specific options.
|
|
13
|
-
*/
|
|
14
|
-
export interface FunctionBuilderProps extends FunctionProps {
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for AWS-recommended CloudWatch alarms.
|
|
17
|
-
*
|
|
18
|
-
* By default, the builder creates recommended alarms with sensible
|
|
19
|
-
* thresholds for every applicable metric. Individual alarms can be
|
|
20
|
-
* customized or disabled. Set to `false` to disable all alarms.
|
|
21
|
-
*
|
|
22
|
-
* No alarm actions are configured by default since notification
|
|
23
|
-
* methods are user-specific. Access alarms from the build result
|
|
24
|
-
* or use an `afterBuild` hook to apply actions.
|
|
25
|
-
*
|
|
26
|
-
* Contextual alarms (duration, concurrentExecutions) are only created
|
|
27
|
-
* when the corresponding function configuration is present.
|
|
28
|
-
*
|
|
29
|
-
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#Lambda
|
|
30
|
-
*/
|
|
31
|
-
recommendedAlarms?: FunctionAlarmConfig | false;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* The build output of a {@link IFunctionBuilder}. Contains the CDK constructs
|
|
35
|
-
* created during {@link Lifecycle.build}, keyed by role.
|
|
36
|
-
*/
|
|
37
|
-
export interface FunctionBuilderResult {
|
|
38
|
-
/** The Lambda function construct created by the builder. */
|
|
39
|
-
function: LambdaFunction;
|
|
40
|
-
/**
|
|
41
|
-
* The CloudWatch LogGroup created for the function, or `undefined` if
|
|
42
|
-
* the user provided their own via the `logGroup` property.
|
|
43
|
-
*
|
|
44
|
-
* By default the builder creates a managed LogGroup using
|
|
45
|
-
* {@link createLogGroupBuilder} with well-architected defaults (retention
|
|
46
|
-
* policy, removal policy). This follows AWS CDK guidance to create a
|
|
47
|
-
* `LogGroup` explicitly rather than relying on the auto-created default,
|
|
48
|
-
* which cannot be configured via CDK.
|
|
49
|
-
*
|
|
50
|
-
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html
|
|
51
|
-
* @see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-loggroups.html
|
|
52
|
-
*/
|
|
53
|
-
logGroup?: LogGroup;
|
|
54
|
-
/**
|
|
55
|
-
* CloudWatch alarms created for the function, keyed by alarm name.
|
|
56
|
-
*
|
|
57
|
-
* Includes both AWS-recommended alarms and any custom alarms added
|
|
58
|
-
* via {@link IFunctionBuilder.addAlarm}. Access individual alarms
|
|
59
|
-
* by key (e.g., `result.alarms.errors`).
|
|
60
|
-
*
|
|
61
|
-
* No alarm actions are configured — apply them via the result or an
|
|
62
|
-
* `afterBuild` hook.
|
|
63
|
-
*
|
|
64
|
-
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html#Lambda
|
|
65
|
-
*/
|
|
66
|
-
alarms: Record<string, Alarm>;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* A fluent builder for configuring and creating an AWS Lambda function.
|
|
70
|
-
*
|
|
71
|
-
* Each configuration property from the CDK {@link FunctionProps} is exposed
|
|
72
|
-
* as an overloaded method: call with a value to set it (returns the builder
|
|
73
|
-
* for chaining), or call with no arguments to read the current value.
|
|
74
|
-
*
|
|
75
|
-
* The builder implements {@link Lifecycle}, so it can be used directly as a
|
|
76
|
-
* component in a {@link compose | composed system}. When built, it creates
|
|
77
|
-
* a Lambda function with the configured properties and returns a
|
|
78
|
-
* {@link FunctionBuilderResult}.
|
|
79
|
-
*
|
|
80
|
-
* Unless a user-supplied `logGroup` is provided, the builder automatically
|
|
81
|
-
* creates a managed CloudWatch LogGroup via {@link createLogGroupBuilder}
|
|
82
|
-
* with well-architected defaults (retention, removal policy) and wires it
|
|
83
|
-
* to the function. This ensures full control over log lifecycle and follows
|
|
84
|
-
* AWS CDK guidance to create a LogGroup explicitly.
|
|
85
|
-
*
|
|
86
|
-
* The builder also creates AWS-recommended CloudWatch alarms by default.
|
|
87
|
-
* Alarms can be customized or disabled via the `recommendedAlarms` property.
|
|
88
|
-
* Custom alarms can be added via the {@link addAlarm} method.
|
|
89
|
-
*
|
|
90
|
-
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```ts
|
|
94
|
-
* const handler = createFunctionBuilder()
|
|
95
|
-
* .runtime(Runtime.NODEJS_22_X)
|
|
96
|
-
* .handler("index.handler")
|
|
97
|
-
* .code(Code.fromAsset("lambda"))
|
|
98
|
-
* .memorySize(256)
|
|
99
|
-
* .timeout(Duration.seconds(30));
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
export type IFunctionBuilder = ITaggedBuilder<FunctionBuilderProps, FunctionBuilder>;
|
|
103
|
-
declare class FunctionBuilder implements Lifecycle<FunctionBuilderResult> {
|
|
104
|
-
#private;
|
|
105
|
-
props: Partial<FunctionBuilderProps>;
|
|
106
|
-
addAlarm(key: string, configure: (alarm: AlarmDefinitionBuilder<LambdaFunction>) => AlarmDefinitionBuilder<LambdaFunction>): this;
|
|
107
|
-
/** @internal — see ADR-0005. */
|
|
108
|
-
[COPY_STATE](target: FunctionBuilder): void;
|
|
109
|
-
build(scope: IConstruct, id: string): FunctionBuilderResult;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Creates a new {@link IFunctionBuilder} for configuring an AWS Lambda function.
|
|
113
|
-
*
|
|
114
|
-
* This is the entry point for defining a Lambda function component. The returned
|
|
115
|
-
* builder exposes every {@link FunctionBuilderProps} property as a fluent setter/getter
|
|
116
|
-
* and implements {@link Lifecycle} for use with {@link compose}.
|
|
117
|
-
*
|
|
118
|
-
* @returns A fluent builder for an AWS Lambda function.
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```ts
|
|
122
|
-
* const handler = createFunctionBuilder()
|
|
123
|
-
* .runtime(Runtime.NODEJS_22_X)
|
|
124
|
-
* .handler("index.handler")
|
|
125
|
-
* .code(Code.fromAsset("lambda"))
|
|
126
|
-
* .timeout(Duration.seconds(30));
|
|
127
|
-
*
|
|
128
|
-
* // Use standalone:
|
|
129
|
-
* const result = handler.build(stack, "MyFunction");
|
|
130
|
-
*
|
|
131
|
-
* // Or compose into a system:
|
|
132
|
-
* const system = compose(
|
|
133
|
-
* { handler, table: createTableBuilder() },
|
|
134
|
-
* { handler: ["table"], table: [] },
|
|
135
|
-
* );
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
export declare function createFunctionBuilder(): IFunctionBuilder;
|
|
139
|
-
export {};
|
|
140
|
-
//# sourceMappingURL=function-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-builder.d.ts","sourceRoot":"","sources":["../src/function-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI7D;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;CACjD;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,QAAQ,EAAE,cAAc,CAAC;IAEzB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;AAErF,cAAM,eAAgB,YAAW,SAAS,CAAC,qBAAqB,CAAC;;IAC/D,KAAK,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;IAG1C,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,CACT,KAAK,EAAE,sBAAsB,CAAC,cAAc,CAAC,KAC1C,sBAAsB,CAAC,cAAc,CAAC,GAC1C,IAAI;IAKP,gCAAgC;IAChC,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAI3C,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,qBAAqB;CA8B5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAExD"}
|
package/dist/function-builder.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Function as LambdaFunction } from "aws-cdk-lib/aws-lambda";
|
|
2
|
-
import { COPY_STATE } from "@composurecdk/core";
|
|
3
|
-
import { taggedBuilder } from "@composurecdk/cloudformation";
|
|
4
|
-
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
5
|
-
import { createLogGroupBuilder } from "@composurecdk/logs";
|
|
6
|
-
import { createFunctionAlarms } from "./function-alarms.js";
|
|
7
|
-
import { FUNCTION_DEFAULTS } from "./defaults.js";
|
|
8
|
-
class FunctionBuilder {
|
|
9
|
-
props = {};
|
|
10
|
-
#customAlarms = [];
|
|
11
|
-
addAlarm(key, configure) {
|
|
12
|
-
this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
/** @internal — see ADR-0005. */
|
|
16
|
-
[COPY_STATE](target) {
|
|
17
|
-
target.#customAlarms.push(...this.#customAlarms);
|
|
18
|
-
}
|
|
19
|
-
build(scope, id) {
|
|
20
|
-
let logGroup;
|
|
21
|
-
let logGroupProps = {};
|
|
22
|
-
if (!this.props.logGroup) {
|
|
23
|
-
logGroup = createLogGroupBuilder().build(scope, `${id}LogGroup`).logGroup;
|
|
24
|
-
logGroupProps = { logGroup };
|
|
25
|
-
}
|
|
26
|
-
const { recommendedAlarms: alarmConfig, ...functionProps } = this.props;
|
|
27
|
-
const mergedProps = {
|
|
28
|
-
...FUNCTION_DEFAULTS,
|
|
29
|
-
...logGroupProps,
|
|
30
|
-
...functionProps,
|
|
31
|
-
};
|
|
32
|
-
const fn = new LambdaFunction(scope, id, mergedProps);
|
|
33
|
-
const alarms = createFunctionAlarms(scope, id, fn, alarmConfig, mergedProps, this.#customAlarms);
|
|
34
|
-
return { function: fn, logGroup, alarms };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new {@link IFunctionBuilder} for configuring an AWS Lambda function.
|
|
39
|
-
*
|
|
40
|
-
* This is the entry point for defining a Lambda function component. The returned
|
|
41
|
-
* builder exposes every {@link FunctionBuilderProps} property as a fluent setter/getter
|
|
42
|
-
* and implements {@link Lifecycle} for use with {@link compose}.
|
|
43
|
-
*
|
|
44
|
-
* @returns A fluent builder for an AWS Lambda function.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const handler = createFunctionBuilder()
|
|
49
|
-
* .runtime(Runtime.NODEJS_22_X)
|
|
50
|
-
* .handler("index.handler")
|
|
51
|
-
* .code(Code.fromAsset("lambda"))
|
|
52
|
-
* .timeout(Duration.seconds(30));
|
|
53
|
-
*
|
|
54
|
-
* // Use standalone:
|
|
55
|
-
* const result = handler.build(stack, "MyFunction");
|
|
56
|
-
*
|
|
57
|
-
* // Or compose into a system:
|
|
58
|
-
* const system = compose(
|
|
59
|
-
* { handler, table: createTableBuilder() },
|
|
60
|
-
* { handler: ["table"], table: [] },
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export function createFunctionBuilder() {
|
|
65
|
-
return taggedBuilder(FunctionBuilder);
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=function-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-builder.js","sourceRoot":"","sources":["../src/function-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAuB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAqGlD,MAAM,eAAe;IACnB,KAAK,GAAkC,EAAE,CAAC;IACjC,aAAa,GAA6C,EAAE,CAAC;IAEtE,QAAQ,CACN,GAAW,EACX,SAE2C;QAE3C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,s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ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAItB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|