@lambda-kata/cdk 0.1.3-rc.2 → 0.1.3-rc.21
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/out/dist/index.js +203 -57
- package/out/tsc/src/aws-layer-manager.d.ts +640 -0
- package/out/tsc/src/docker-runtime-detector.d.ts +168 -0
- package/out/tsc/src/ensure-node-runtime-layer.d.ts +42 -0
- package/out/tsc/src/index.d.ts +5 -0
- package/out/tsc/src/kata-wrapper.d.ts +27 -14
- package/out/tsc/src/logger.d.ts +88 -0
- package/out/tsc/src/nodejs-layer-manager.d.ts +547 -0
- package/package.json +8 -6
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Runtime-Aware Lambda Layer Management
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript-only orchestration for detecting Node.js Lambda
|
|
5
|
+
* runtime versions and managing corresponding Node.js Lambda Layers. The system
|
|
6
|
+
* automatically ensures the correct Node.js binaries are available at execution time
|
|
7
|
+
* by creating or reusing Lambda Layers that contain Node.js runtime binaries matching
|
|
8
|
+
* the exact versions used in AWS Lambda runtime images.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Detects exact Node.js versions from AWS Lambda Docker images
|
|
12
|
+
* - Creates minimal Lambda Layers with only Node.js binaries
|
|
13
|
+
* - Supports both x86_64 and arm64 architectures
|
|
14
|
+
* - Implements idempotent operations with layer reuse
|
|
15
|
+
* - Provides comprehensive error handling and logging
|
|
16
|
+
*
|
|
17
|
+
* @module nodejs-layer-manager
|
|
18
|
+
*/
|
|
19
|
+
import { LambdaClientConfig } from '@aws-sdk/client-lambda';
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for ensuring a Node.js runtime layer exists.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const options: EnsureNodeRuntimeLayerOptions = {
|
|
26
|
+
* runtimeName: 'nodejs20.x',
|
|
27
|
+
* architecture: 'x86_64',
|
|
28
|
+
* region: 'us-east-1',
|
|
29
|
+
* accountId: '123456789012'
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface EnsureNodeRuntimeLayerOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The AWS Lambda runtime name (e.g., "nodejs18.x", "nodejs20.x", "nodejs22.x").
|
|
36
|
+
* This determines which Node.js major version to use.
|
|
37
|
+
*/
|
|
38
|
+
runtimeName: string;
|
|
39
|
+
/**
|
|
40
|
+
* The target architecture for the Lambda function and layer.
|
|
41
|
+
* Must be either "x86_64" or "arm64".
|
|
42
|
+
*/
|
|
43
|
+
architecture: 'x86_64' | 'arm64';
|
|
44
|
+
/**
|
|
45
|
+
* The AWS region where the layer should be created or found.
|
|
46
|
+
*/
|
|
47
|
+
region: string;
|
|
48
|
+
/**
|
|
49
|
+
* The AWS account ID where the layer should be created or found.
|
|
50
|
+
*/
|
|
51
|
+
accountId: string;
|
|
52
|
+
/**
|
|
53
|
+
* Optional AWS SDK configuration for custom authentication, region, or endpoint settings.
|
|
54
|
+
* If not provided, the default AWS SDK configuration will be used.
|
|
55
|
+
*/
|
|
56
|
+
awsSdkConfig?: LambdaClientConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Optional logger for debugging and monitoring layer operations.
|
|
59
|
+
* If not provided, a no-op logger will be used.
|
|
60
|
+
*/
|
|
61
|
+
logger?: Logger;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result of ensuring a Node.js runtime layer exists.
|
|
65
|
+
*
|
|
66
|
+
* Contains all information about the layer that was created or found,
|
|
67
|
+
* including metadata for debugging and monitoring.
|
|
68
|
+
*/
|
|
69
|
+
export interface EnsureNodeRuntimeLayerResult {
|
|
70
|
+
/**
|
|
71
|
+
* The ARN of the Lambda Layer that contains the Node.js runtime.
|
|
72
|
+
* This ARN can be attached to Lambda functions.
|
|
73
|
+
*/
|
|
74
|
+
layerArn: string;
|
|
75
|
+
/**
|
|
76
|
+
* The name of the Lambda Layer.
|
|
77
|
+
* Follows the pattern: lambda-kata-nodejs-${runtimeName}-${architecture}
|
|
78
|
+
*/
|
|
79
|
+
layerName: string;
|
|
80
|
+
/**
|
|
81
|
+
* The original runtime name that was requested.
|
|
82
|
+
*/
|
|
83
|
+
runtimeName: string;
|
|
84
|
+
/**
|
|
85
|
+
* The exact Node.js version detected from the AWS Lambda runtime image.
|
|
86
|
+
* Format: semantic version string (e.g., "20.10.0")
|
|
87
|
+
*/
|
|
88
|
+
nodeVersion: string;
|
|
89
|
+
/**
|
|
90
|
+
* The architecture of the layer and Node.js binary.
|
|
91
|
+
*/
|
|
92
|
+
architecture: 'x86_64' | 'arm64';
|
|
93
|
+
/**
|
|
94
|
+
* Whether a new layer was created (true) or an existing layer was reused (false).
|
|
95
|
+
* Useful for monitoring and debugging layer management operations.
|
|
96
|
+
*/
|
|
97
|
+
created: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Information about a detected Node.js version from AWS Lambda runtime images.
|
|
101
|
+
*
|
|
102
|
+
* This interface represents the result of querying AWS Lambda Docker images
|
|
103
|
+
* to determine the exact Node.js version used by a specific runtime.
|
|
104
|
+
*/
|
|
105
|
+
export interface NodeVersionInfo {
|
|
106
|
+
/**
|
|
107
|
+
* The exact Node.js version string (e.g., "20.10.0").
|
|
108
|
+
* Extracted from `node --version` within the AWS Lambda runtime Docker image.
|
|
109
|
+
*/
|
|
110
|
+
version: string;
|
|
111
|
+
/**
|
|
112
|
+
* The original runtime name that was queried.
|
|
113
|
+
*/
|
|
114
|
+
runtimeName: string;
|
|
115
|
+
/**
|
|
116
|
+
* The Docker image that was used to detect the version.
|
|
117
|
+
* Format: public.ecr.aws/lambda/nodejs:{majorVersion}-{architecture}
|
|
118
|
+
*/
|
|
119
|
+
dockerImage: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Information about a Lambda Layer containing Node.js runtime.
|
|
123
|
+
*
|
|
124
|
+
* This interface represents metadata about existing or newly created
|
|
125
|
+
* Node.js Lambda Layers for compatibility checking and management.
|
|
126
|
+
*/
|
|
127
|
+
export interface LayerInfo {
|
|
128
|
+
/**
|
|
129
|
+
* The full ARN of the Lambda Layer version.
|
|
130
|
+
*/
|
|
131
|
+
arn: string;
|
|
132
|
+
/**
|
|
133
|
+
* The name of the Lambda Layer.
|
|
134
|
+
*/
|
|
135
|
+
name: string;
|
|
136
|
+
/**
|
|
137
|
+
* The version number of the Lambda Layer.
|
|
138
|
+
*/
|
|
139
|
+
version: number;
|
|
140
|
+
/**
|
|
141
|
+
* The Node.js version contained in this layer.
|
|
142
|
+
*/
|
|
143
|
+
nodeVersion: string;
|
|
144
|
+
/**
|
|
145
|
+
* The architecture this layer is compatible with.
|
|
146
|
+
*/
|
|
147
|
+
architecture: string;
|
|
148
|
+
/**
|
|
149
|
+
* When this layer version was created.
|
|
150
|
+
*/
|
|
151
|
+
createdDate: Date;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Options for searching existing Lambda Layers.
|
|
155
|
+
*
|
|
156
|
+
* Used internally by LayerManager to find compatible existing layers.
|
|
157
|
+
*/
|
|
158
|
+
export interface LayerSearchOptions {
|
|
159
|
+
/**
|
|
160
|
+
* The expected layer name to search for.
|
|
161
|
+
*/
|
|
162
|
+
layerName: string;
|
|
163
|
+
/**
|
|
164
|
+
* Requirements that the layer must meet to be considered compatible.
|
|
165
|
+
*/
|
|
166
|
+
requirements: LayerRequirements;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Requirements that a Lambda Layer must meet to be considered compatible.
|
|
170
|
+
*
|
|
171
|
+
* Used for validating whether an existing layer can be reused.
|
|
172
|
+
*/
|
|
173
|
+
export interface LayerRequirements {
|
|
174
|
+
/**
|
|
175
|
+
* The required Node.js version.
|
|
176
|
+
*/
|
|
177
|
+
nodeVersion: string;
|
|
178
|
+
/**
|
|
179
|
+
* The required architecture.
|
|
180
|
+
*/
|
|
181
|
+
architecture: string;
|
|
182
|
+
/**
|
|
183
|
+
* Maximum age for the layer to be considered fresh.
|
|
184
|
+
* Layers older than this may be recreated.
|
|
185
|
+
*/
|
|
186
|
+
maxAge?: number;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Options for creating a new Lambda Layer.
|
|
190
|
+
*
|
|
191
|
+
* Contains all information needed to build and publish a Node.js layer.
|
|
192
|
+
*/
|
|
193
|
+
export interface LayerCreationOptions {
|
|
194
|
+
/**
|
|
195
|
+
* The name for the new layer.
|
|
196
|
+
*/
|
|
197
|
+
layerName: string;
|
|
198
|
+
/**
|
|
199
|
+
* The Node.js version to include in the layer.
|
|
200
|
+
*/
|
|
201
|
+
nodeVersion: string;
|
|
202
|
+
/**
|
|
203
|
+
* The target architecture.
|
|
204
|
+
*/
|
|
205
|
+
architecture: 'x86_64' | 'arm64';
|
|
206
|
+
/**
|
|
207
|
+
* The AWS region where the layer should be created.
|
|
208
|
+
*/
|
|
209
|
+
region: string;
|
|
210
|
+
/**
|
|
211
|
+
* Optional description for the layer.
|
|
212
|
+
*/
|
|
213
|
+
description?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Logger interface for debugging and monitoring layer operations.
|
|
217
|
+
*
|
|
218
|
+
* Provides structured logging with different severity levels and optional metadata.
|
|
219
|
+
*/
|
|
220
|
+
export interface Logger {
|
|
221
|
+
/**
|
|
222
|
+
* Log debug information for detailed troubleshooting.
|
|
223
|
+
*/
|
|
224
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
225
|
+
/**
|
|
226
|
+
* Log informational messages about normal operations.
|
|
227
|
+
*/
|
|
228
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
229
|
+
/**
|
|
230
|
+
* Log warning messages about potential issues.
|
|
231
|
+
*/
|
|
232
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
233
|
+
/**
|
|
234
|
+
* Log error messages about failures and exceptions.
|
|
235
|
+
*/
|
|
236
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Interface for detecting Node.js versions from AWS Lambda runtime images.
|
|
240
|
+
*
|
|
241
|
+
* Implementations should use Docker to pull AWS Lambda runtime images
|
|
242
|
+
* and extract the exact Node.js version using `node --version`.
|
|
243
|
+
*/
|
|
244
|
+
export interface RuntimeDetector {
|
|
245
|
+
/**
|
|
246
|
+
* Detects the exact Node.js version for a given runtime and architecture.
|
|
247
|
+
*
|
|
248
|
+
* @param runtimeName - The AWS Lambda runtime (e.g., "nodejs20.x")
|
|
249
|
+
* @param architecture - The target architecture ("x86_64" or "arm64")
|
|
250
|
+
* @returns Promise resolving to Node.js version information
|
|
251
|
+
* @throws NodeRuntimeLayerError if detection fails
|
|
252
|
+
*/
|
|
253
|
+
detectNodeVersion(runtimeName: string, architecture: string): Promise<NodeVersionInfo>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Interface for managing Lambda Layers containing Node.js runtime.
|
|
257
|
+
*
|
|
258
|
+
* Implementations should handle layer creation, searching, and compatibility validation
|
|
259
|
+
* using AWS SDK v3 Lambda client operations.
|
|
260
|
+
*/
|
|
261
|
+
export interface LayerManager {
|
|
262
|
+
/**
|
|
263
|
+
* Searches for an existing compatible Node.js layer.
|
|
264
|
+
*
|
|
265
|
+
* @param options - Search criteria and requirements
|
|
266
|
+
* @returns Promise resolving to layer info if found, null otherwise
|
|
267
|
+
* @throws NodeRuntimeLayerError if search fails
|
|
268
|
+
*/
|
|
269
|
+
findExistingLayer(options: LayerSearchOptions): Promise<LayerInfo | null>;
|
|
270
|
+
/**
|
|
271
|
+
* Creates a new Node.js Lambda Layer.
|
|
272
|
+
*
|
|
273
|
+
* @param options - Layer creation configuration
|
|
274
|
+
* @returns Promise resolving to information about the created layer
|
|
275
|
+
* @throws NodeRuntimeLayerError if creation fails
|
|
276
|
+
*/
|
|
277
|
+
createNodeLayer(options: LayerCreationOptions): Promise<LayerInfo>;
|
|
278
|
+
/**
|
|
279
|
+
* Deploys a pre-built Node.js Lambda Layer from ZIP file.
|
|
280
|
+
*
|
|
281
|
+
* This method bypasses Docker binary extraction and deploys existing
|
|
282
|
+
* layer ZIP files directly to AWS Lambda. Handles large layers via S3.
|
|
283
|
+
*
|
|
284
|
+
* @param options - Deployment configuration
|
|
285
|
+
* @returns Promise resolving to deployment result
|
|
286
|
+
* @throws NodeRuntimeLayerError if deployment fails
|
|
287
|
+
*/
|
|
288
|
+
deployNodejsLayer(options: NodejsLayerDeploymentOptions): Promise<NodejsLayerDeploymentResult>;
|
|
289
|
+
/**
|
|
290
|
+
* Deploys Node.js layers for all supported architectures.
|
|
291
|
+
*
|
|
292
|
+
* Attempts to deploy layers for both arm64 and x86_64 architectures,
|
|
293
|
+
* continuing on individual failures to maximize successful deployments.
|
|
294
|
+
*
|
|
295
|
+
* @param options - Base deployment configuration (architecture will be overridden)
|
|
296
|
+
* @returns Promise resolving to multi-architecture deployment results
|
|
297
|
+
*/
|
|
298
|
+
deployAllArchitectures(options: Omit<NodejsLayerDeploymentOptions, 'architecture'>): Promise<MultiArchitectureDeploymentResult>;
|
|
299
|
+
/**
|
|
300
|
+
* Validates whether a layer meets the specified requirements.
|
|
301
|
+
*
|
|
302
|
+
* @param layer - The layer to validate
|
|
303
|
+
* @param requirements - The requirements to check against
|
|
304
|
+
* @returns true if the layer is compatible, false otherwise
|
|
305
|
+
*/
|
|
306
|
+
validateLayerCompatibility(layer: LayerInfo, requirements: LayerRequirements): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Gets the current circuit breaker state for monitoring and debugging.
|
|
309
|
+
*
|
|
310
|
+
* @returns Object containing circuit breaker state information
|
|
311
|
+
*/
|
|
312
|
+
getCircuitBreakerState(): {
|
|
313
|
+
state: string;
|
|
314
|
+
failureCount: number;
|
|
315
|
+
successCount: number;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Destroys the layer manager and cleans up resources.
|
|
319
|
+
*
|
|
320
|
+
* Should be called when the manager is no longer needed to prevent
|
|
321
|
+
* resource leaks.
|
|
322
|
+
*/
|
|
323
|
+
destroy(): void;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Error codes for Node.js runtime layer management operations.
|
|
327
|
+
*
|
|
328
|
+
* These codes provide structured error classification for different failure scenarios.
|
|
329
|
+
*/
|
|
330
|
+
export declare enum ErrorCodes {
|
|
331
|
+
/**
|
|
332
|
+
* Docker is not available or cannot be executed.
|
|
333
|
+
*/
|
|
334
|
+
DOCKER_UNAVAILABLE = "DOCKER_UNAVAILABLE",
|
|
335
|
+
/**
|
|
336
|
+
* The specified runtime is not supported.
|
|
337
|
+
*/
|
|
338
|
+
RUNTIME_UNSUPPORTED = "RUNTIME_UNSUPPORTED",
|
|
339
|
+
/**
|
|
340
|
+
* AWS API operation failed.
|
|
341
|
+
*/
|
|
342
|
+
AWS_API_ERROR = "AWS_API_ERROR",
|
|
343
|
+
/**
|
|
344
|
+
* Layer creation operation failed.
|
|
345
|
+
*/
|
|
346
|
+
LAYER_CREATION_FAILED = "LAYER_CREATION_FAILED",
|
|
347
|
+
/**
|
|
348
|
+
* The specified architecture is not supported.
|
|
349
|
+
*/
|
|
350
|
+
INVALID_ARCHITECTURE = "INVALID_ARCHITECTURE",
|
|
351
|
+
/**
|
|
352
|
+
* Node.js version detection failed.
|
|
353
|
+
*/
|
|
354
|
+
VERSION_DETECTION_FAILED = "VERSION_DETECTION_FAILED",
|
|
355
|
+
/**
|
|
356
|
+
* Layer size exceeds AWS limits.
|
|
357
|
+
*/
|
|
358
|
+
LAYER_SIZE_EXCEEDED = "LAYER_SIZE_EXCEEDED",
|
|
359
|
+
/**
|
|
360
|
+
* AWS account quota exceeded.
|
|
361
|
+
*/
|
|
362
|
+
QUOTA_EXCEEDED = "QUOTA_EXCEEDED",
|
|
363
|
+
/**
|
|
364
|
+
* Internal error or unexpected failure.
|
|
365
|
+
*/
|
|
366
|
+
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Specialized error class for Node.js runtime layer management operations.
|
|
370
|
+
*
|
|
371
|
+
* Provides structured error information with error codes, descriptive messages,
|
|
372
|
+
* and optional cause chaining for debugging.
|
|
373
|
+
*/
|
|
374
|
+
export declare class NodeRuntimeLayerError extends Error {
|
|
375
|
+
readonly code: ErrorCodes;
|
|
376
|
+
readonly cause?: Error | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* Creates a new NodeRuntimeLayerError.
|
|
379
|
+
*
|
|
380
|
+
* @param message - Human-readable error message
|
|
381
|
+
* @param code - Structured error code for programmatic handling
|
|
382
|
+
* @param cause - Optional underlying error that caused this error
|
|
383
|
+
*/
|
|
384
|
+
constructor(message: string, code: ErrorCodes, cause?: Error | undefined);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Cache entry for storing detected Node.js version information.
|
|
388
|
+
*
|
|
389
|
+
* Used internally to avoid repeated Docker operations for the same runtime.
|
|
390
|
+
*/
|
|
391
|
+
export interface VersionCacheEntry {
|
|
392
|
+
/**
|
|
393
|
+
* The detected Node.js version.
|
|
394
|
+
*/
|
|
395
|
+
version: string;
|
|
396
|
+
/**
|
|
397
|
+
* The runtime name that was queried.
|
|
398
|
+
*/
|
|
399
|
+
runtimeName: string;
|
|
400
|
+
/**
|
|
401
|
+
* The Docker image that was used.
|
|
402
|
+
*/
|
|
403
|
+
dockerImage: string;
|
|
404
|
+
/**
|
|
405
|
+
* When this entry was cached.
|
|
406
|
+
*/
|
|
407
|
+
cachedAt: Date;
|
|
408
|
+
/**
|
|
409
|
+
* Time-to-live in milliseconds.
|
|
410
|
+
*/
|
|
411
|
+
ttl: number;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Metadata for Lambda Layer creation and management.
|
|
415
|
+
*
|
|
416
|
+
* Contains information needed for AWS Lambda Layer operations.
|
|
417
|
+
*/
|
|
418
|
+
export interface LayerMetadata {
|
|
419
|
+
/**
|
|
420
|
+
* The name of the Lambda Layer.
|
|
421
|
+
*/
|
|
422
|
+
layerName: string;
|
|
423
|
+
/**
|
|
424
|
+
* Human-readable description of the layer.
|
|
425
|
+
*/
|
|
426
|
+
description: string;
|
|
427
|
+
/**
|
|
428
|
+
* Compatible Lambda runtimes.
|
|
429
|
+
* For Lambda Kata, this is typically ["python3.12"].
|
|
430
|
+
*/
|
|
431
|
+
compatibleRuntimes: string[];
|
|
432
|
+
/**
|
|
433
|
+
* Compatible architectures.
|
|
434
|
+
*/
|
|
435
|
+
compatibleArchitectures: string[];
|
|
436
|
+
/**
|
|
437
|
+
* Optional license information.
|
|
438
|
+
*/
|
|
439
|
+
licenseInfo?: string;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Configuration options for deploying pre-built Node.js Lambda Layers.
|
|
443
|
+
*
|
|
444
|
+
* Used to deploy existing layer ZIP files instead of creating layers from Docker images.
|
|
445
|
+
* This bypasses the binary extraction process that can fail with large Node.js binaries.
|
|
446
|
+
*/
|
|
447
|
+
export interface NodejsLayerDeploymentOptions {
|
|
448
|
+
/**
|
|
449
|
+
* The AWS region where the layer should be deployed.
|
|
450
|
+
*/
|
|
451
|
+
region: string;
|
|
452
|
+
/**
|
|
453
|
+
* Optional AWS profile name for authentication.
|
|
454
|
+
* If not provided, uses default AWS credentials.
|
|
455
|
+
*/
|
|
456
|
+
profile?: string;
|
|
457
|
+
/**
|
|
458
|
+
* The target architecture for deployment.
|
|
459
|
+
* If not specified, defaults to 'arm64'.
|
|
460
|
+
*/
|
|
461
|
+
architecture?: 'arm64' | 'x86_64';
|
|
462
|
+
/**
|
|
463
|
+
* Base directory to search for layer ZIP files.
|
|
464
|
+
* Defaults to current working directory.
|
|
465
|
+
*/
|
|
466
|
+
baseDirectory?: string;
|
|
467
|
+
/**
|
|
468
|
+
* Custom layer name override.
|
|
469
|
+
* If not provided, uses standard naming: nodejs-18-{architecture}
|
|
470
|
+
*/
|
|
471
|
+
layerName?: string;
|
|
472
|
+
/**
|
|
473
|
+
* Custom layer description.
|
|
474
|
+
* If not provided, generates standard description.
|
|
475
|
+
*/
|
|
476
|
+
description?: string;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Result of Node.js layer deployment operation.
|
|
480
|
+
*
|
|
481
|
+
* Contains information about the deployed layer and deployment metadata.
|
|
482
|
+
*/
|
|
483
|
+
export interface NodejsLayerDeploymentResult {
|
|
484
|
+
/**
|
|
485
|
+
* The full ARN of the deployed layer version.
|
|
486
|
+
*/
|
|
487
|
+
layerVersionArn: string;
|
|
488
|
+
/**
|
|
489
|
+
* The base ARN of the layer (without version).
|
|
490
|
+
*/
|
|
491
|
+
layerArn: string;
|
|
492
|
+
/**
|
|
493
|
+
* The name of the deployed layer.
|
|
494
|
+
*/
|
|
495
|
+
layerName: string;
|
|
496
|
+
/**
|
|
497
|
+
* The version number of the deployed layer.
|
|
498
|
+
*/
|
|
499
|
+
version: number;
|
|
500
|
+
/**
|
|
501
|
+
* The architecture of the deployed layer.
|
|
502
|
+
*/
|
|
503
|
+
architecture: 'arm64' | 'x86_64';
|
|
504
|
+
/**
|
|
505
|
+
* The size of the deployed layer ZIP file in bytes.
|
|
506
|
+
*/
|
|
507
|
+
layerSize: number;
|
|
508
|
+
/**
|
|
509
|
+
* The path to the ZIP file that was deployed.
|
|
510
|
+
*/
|
|
511
|
+
zipFilePath: string;
|
|
512
|
+
/**
|
|
513
|
+
* Whether the layer was uploaded via S3 (true) or direct upload (false).
|
|
514
|
+
*/
|
|
515
|
+
uploadedViaS3: boolean;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Result of deploying layers for all architectures.
|
|
519
|
+
*
|
|
520
|
+
* Contains deployment results for each architecture attempted.
|
|
521
|
+
*/
|
|
522
|
+
export interface MultiArchitectureDeploymentResult {
|
|
523
|
+
/**
|
|
524
|
+
* Deployment results by architecture.
|
|
525
|
+
* Key is architecture name, value is result or null if deployment failed.
|
|
526
|
+
*/
|
|
527
|
+
results: Record<'arm64' | 'x86_64', NodejsLayerDeploymentResult | null>;
|
|
528
|
+
/**
|
|
529
|
+
* Overall success status.
|
|
530
|
+
* True if at least one architecture deployed successfully.
|
|
531
|
+
*/
|
|
532
|
+
success: boolean;
|
|
533
|
+
/**
|
|
534
|
+
* Summary of successful deployments.
|
|
535
|
+
*/
|
|
536
|
+
successful: Array<{
|
|
537
|
+
architecture: 'arm64' | 'x86_64';
|
|
538
|
+
layerVersionArn: string;
|
|
539
|
+
}>;
|
|
540
|
+
/**
|
|
541
|
+
* Summary of failed deployments.
|
|
542
|
+
*/
|
|
543
|
+
failed: Array<{
|
|
544
|
+
architecture: 'arm64' | 'x86_64';
|
|
545
|
+
error: string;
|
|
546
|
+
}>;
|
|
547
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambda-kata/cdk",
|
|
3
|
-
"version": "0.1.3-rc.
|
|
3
|
+
"version": "0.1.3-rc.21",
|
|
4
4
|
"description": "AWS CDK integration for Lambda Kata - Node.js Lambdas running via Lambda Kata runtime",
|
|
5
5
|
"main": "out/dist/index.js",
|
|
6
6
|
"types": "out/tsc/src/index.d.ts",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"build:minify": "yarn run build:config && node dist/utils/build.js",
|
|
12
12
|
"build:config": "esbuild --bundle --platform=node utils/esbuild/esbuild.build.ts --outfile=dist/utils/build.js --external:esbuild",
|
|
13
13
|
"watch": "tsc -w",
|
|
14
|
-
"test": "jest",
|
|
15
|
-
"test:watch": "jest --watch",
|
|
14
|
+
"test": "npx jest --runInBand --colors --verbose --testTimeout=30000 --forceExit --detectOpenHandles",
|
|
15
|
+
"test:watch": "npx jest --watch --testTimeout=30000 --runInBand",
|
|
16
16
|
"lint": "eslint src/ test/ --ext .ts",
|
|
17
17
|
"clean": "rm -rf lib coverage",
|
|
18
18
|
"docs": "yarn run docs:md && yarn run docs:html",
|
|
19
19
|
"docs:md": "typedoc --options ./docs/docs.config/typedoc.md.json",
|
|
20
20
|
"docs:html": "typedoc --options ./docs/docs.config/typedoc.html.json",
|
|
21
|
-
"npm:publish": "npm publish --access public"
|
|
21
|
+
"npm:publish": "yarn run build && npm publish --access public"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"out/dist/**/*",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"python",
|
|
40
40
|
"serverless"
|
|
41
41
|
],
|
|
42
|
-
"author": "
|
|
42
|
+
"author": "Raman Marozau, raman@worktif.com",
|
|
43
43
|
"license": "Apache-2.0",
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
46
|
-
"url": "https://github.com/
|
|
46
|
+
"url": "https://github.com/lambda-kata/cdk.git"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=18.0.0"
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
"constructs": "^10.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"@aws-sdk/client-lambda": "^3.500.0",
|
|
57
|
+
"@aws-sdk/client-s3": "^3.500.0",
|
|
56
58
|
"@aws-sdk/client-sts": "^3.500.0",
|
|
57
59
|
"dotenv": "^17.2.3",
|
|
58
60
|
"reflect-metadata": "^0.2.2"
|