@gradientedge/cdk-utils 5.2.0 → 5.3.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/app/api-destined-function/layers/nodejs/node_modules/.yarn-integrity +1 -1
- package/app/api-destined-function/layers/nodejs/package.json +1 -1
- package/app/api-destined-function/node_modules/.yarn-integrity +1 -1
- package/app/api-destined-function/package.json +1 -1
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +2 -3
- package/dist/src/lib/manager/aws/cloudfront-manager.js +2 -1
- package/dist/src/lib/manager/aws/lambda-manager.d.ts +1 -0
- package/dist/src/lib/manager/aws/lambda-manager.js +3 -2
- package/package.json +13 -13
- package/src/lib/construct/api-to-eventbridge-target/main.ts +2 -3
- package/src/lib/manager/aws/cloudfront-manager.ts +2 -1
- package/src/lib/manager/aws/lambda-manager.ts +3 -2
|
@@ -351,7 +351,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
351
351
|
'application/json': [
|
|
352
352
|
'Action=Publish',
|
|
353
353
|
`TargetArn=$util.urlEncode('${this.apiDestinedRestApi.topic.topicArn}')`,
|
|
354
|
-
'Message=$input.body',
|
|
354
|
+
'Message=$util.urlEncode($input.body)',
|
|
355
355
|
'Version=2010-03-31',
|
|
356
356
|
].join('&'),
|
|
357
357
|
};
|
|
@@ -363,14 +363,13 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
363
363
|
createApiDestinedIntegrationResponse() {
|
|
364
364
|
if (!this.props.api.withResource)
|
|
365
365
|
return;
|
|
366
|
-
this.apiDestinedRestApi.integrationResponse = {
|
|
366
|
+
this.apiDestinedRestApi.integrationResponse = this.props.api.integrationResponse ?? {
|
|
367
367
|
...{
|
|
368
368
|
statusCode: '200',
|
|
369
369
|
responseTemplates: {
|
|
370
370
|
'application/json': JSON.stringify({ message: 'Payload Submitted' }),
|
|
371
371
|
},
|
|
372
372
|
},
|
|
373
|
-
...this.props.api.integrationResponse,
|
|
374
373
|
};
|
|
375
374
|
}
|
|
376
375
|
/**
|
|
@@ -29,6 +29,7 @@ const cloudfront = __importStar(require("aws-cdk-lib/aws-cloudfront"));
|
|
|
29
29
|
const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
|
|
30
30
|
const cr = __importStar(require("aws-cdk-lib/custom-resources"));
|
|
31
31
|
const utils = __importStar(require("../../utils"));
|
|
32
|
+
const lambda_manager_1 = require("./lambda-manager");
|
|
32
33
|
/**
|
|
33
34
|
* @stability stable
|
|
34
35
|
* @category cdk-utils.cloudfront-manager
|
|
@@ -233,7 +234,7 @@ class CloudFrontManager {
|
|
|
233
234
|
logRetention: props.logRetention,
|
|
234
235
|
memorySize: props.memorySize,
|
|
235
236
|
reservedConcurrentExecutions: props.reservedConcurrentExecutions,
|
|
236
|
-
runtime: props.runtime ??
|
|
237
|
+
runtime: props.runtime ?? lambda_manager_1.LambdaManager.NODEJS_RUNTIME,
|
|
237
238
|
securityGroups: securityGroups,
|
|
238
239
|
stackId: `${id}-stack-id-${scope.props.stage}`,
|
|
239
240
|
timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(1),
|
|
@@ -26,6 +26,7 @@ import * as types from '../../types';
|
|
|
26
26
|
* @see [CDK Lambda Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html}
|
|
27
27
|
*/
|
|
28
28
|
export declare class LambdaManager {
|
|
29
|
+
static NODEJS_RUNTIME: cdk.aws_lambda.Runtime;
|
|
29
30
|
/**
|
|
30
31
|
* @summary Method to create a lambda layer (nodejs)
|
|
31
32
|
* @param {string} id scoped id of the resource
|
|
@@ -50,6 +50,7 @@ const cloudfront_manager_1 = require("./cloudfront-manager");
|
|
|
50
50
|
* @see [CDK Lambda Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html}
|
|
51
51
|
*/
|
|
52
52
|
class LambdaManager {
|
|
53
|
+
static NODEJS_RUNTIME = lambda.Runtime.NODEJS_16_X;
|
|
53
54
|
/**
|
|
54
55
|
* @summary Method to create a lambda layer (nodejs)
|
|
55
56
|
* @param {string} id scoped id of the resource
|
|
@@ -58,7 +59,7 @@ class LambdaManager {
|
|
|
58
59
|
*/
|
|
59
60
|
createLambdaLayer(id, scope, code) {
|
|
60
61
|
const lambdaLayer = new lambda.LayerVersion(scope, `${id}`, {
|
|
61
|
-
compatibleRuntimes: [
|
|
62
|
+
compatibleRuntimes: [LambdaManager.NODEJS_RUNTIME],
|
|
62
63
|
code: code,
|
|
63
64
|
description: `${id}`,
|
|
64
65
|
layerVersionName: `${id}-${scope.props.stage}`,
|
|
@@ -92,7 +93,7 @@ class LambdaManager {
|
|
|
92
93
|
allowPublicSubnet: !!vpc,
|
|
93
94
|
functionName: functionName,
|
|
94
95
|
handler: handler || 'index.lambda_handler',
|
|
95
|
-
runtime:
|
|
96
|
+
runtime: LambdaManager.NODEJS_RUNTIME,
|
|
96
97
|
code: code,
|
|
97
98
|
environment: {
|
|
98
99
|
REGION: scope.props.region,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": "<
|
|
7
|
+
"node": ">=14.16.0 <17"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@types/lodash": "^4.14.182",
|
|
49
|
-
"@types/node": "^17.0.
|
|
49
|
+
"@types/node": "^17.0.33",
|
|
50
50
|
"app-root-path": "^3.0.0",
|
|
51
|
-
"aws-cdk-lib": "^2.
|
|
52
|
-
"aws-sdk": "^2.
|
|
53
|
-
"constructs": "^10.1.
|
|
51
|
+
"aws-cdk-lib": "^2.24.1",
|
|
52
|
+
"aws-sdk": "^2.1134.0",
|
|
53
|
+
"constructs": "^10.1.7",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"moment": "^2.29.3",
|
|
56
56
|
"nconf": "^0.12.0",
|
|
@@ -59,19 +59,19 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
62
|
-
"@types/jest": "^27.5.
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
64
|
-
"@typescript-eslint/parser": "^5.
|
|
62
|
+
"@types/jest": "^27.5.1",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
|
64
|
+
"@typescript-eslint/parser": "^5.23.0",
|
|
65
65
|
"aws-cdk": "*",
|
|
66
66
|
"babel-eslint": "^10.1.0",
|
|
67
67
|
"better-docs": "^2.7.2",
|
|
68
68
|
"codecov": "^3.8.3",
|
|
69
69
|
"commitizen": "^4.2.4",
|
|
70
|
-
"dotenv": "^16.0.
|
|
71
|
-
"eslint": "^8.
|
|
70
|
+
"dotenv": "^16.0.1",
|
|
71
|
+
"eslint": "^8.15.0",
|
|
72
72
|
"eslint-config-prettier": "^8.5.0",
|
|
73
73
|
"eslint-plugin-import": "^2.26.0",
|
|
74
|
-
"husky": "^
|
|
74
|
+
"husky": "^8.0.1",
|
|
75
75
|
"jest": "^28.1.0",
|
|
76
76
|
"jest-extended": "^2.0.0",
|
|
77
77
|
"jest-junit": "^13.2.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
84
84
|
"rimraf": "^3.0.2",
|
|
85
85
|
"semantic-release": "^19.0.2",
|
|
86
|
-
"ts-jest": "^28.0.
|
|
86
|
+
"ts-jest": "^28.0.2",
|
|
87
87
|
"ts-node": "^10.7.0",
|
|
88
88
|
"typescript": "4.6.4"
|
|
89
89
|
},
|
|
@@ -401,7 +401,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
401
401
|
'application/json': [
|
|
402
402
|
'Action=Publish',
|
|
403
403
|
`TargetArn=$util.urlEncode('${this.apiDestinedRestApi.topic.topicArn}')`,
|
|
404
|
-
'Message=$input.body',
|
|
404
|
+
'Message=$util.urlEncode($input.body)',
|
|
405
405
|
'Version=2010-03-31',
|
|
406
406
|
].join('&'),
|
|
407
407
|
}
|
|
@@ -413,14 +413,13 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
413
413
|
*/
|
|
414
414
|
protected createApiDestinedIntegrationResponse() {
|
|
415
415
|
if (!this.props.api.withResource) return
|
|
416
|
-
this.apiDestinedRestApi.integrationResponse = {
|
|
416
|
+
this.apiDestinedRestApi.integrationResponse = this.props.api.integrationResponse ?? {
|
|
417
417
|
...{
|
|
418
418
|
statusCode: '200',
|
|
419
419
|
responseTemplates: {
|
|
420
420
|
'application/json': JSON.stringify({ message: 'Payload Submitted' }),
|
|
421
421
|
},
|
|
422
422
|
},
|
|
423
|
-
...this.props.api.integrationResponse,
|
|
424
423
|
}
|
|
425
424
|
}
|
|
426
425
|
|
|
@@ -10,6 +10,7 @@ import * as cr from 'aws-cdk-lib/custom-resources'
|
|
|
10
10
|
import * as common from '../../common'
|
|
11
11
|
import * as types from '../../types'
|
|
12
12
|
import * as utils from '../../utils'
|
|
13
|
+
import { LambdaManager } from './lambda-manager'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @stability stable
|
|
@@ -263,7 +264,7 @@ export class CloudFrontManager {
|
|
|
263
264
|
logRetention: props.logRetention,
|
|
264
265
|
memorySize: props.memorySize,
|
|
265
266
|
reservedConcurrentExecutions: props.reservedConcurrentExecutions,
|
|
266
|
-
runtime: props.runtime ??
|
|
267
|
+
runtime: props.runtime ?? LambdaManager.NODEJS_RUNTIME,
|
|
267
268
|
securityGroups: securityGroups,
|
|
268
269
|
stackId: `${id}-stack-id-${scope.props.stage}`,
|
|
269
270
|
timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(1),
|
|
@@ -29,6 +29,7 @@ import { CloudFrontManager } from './cloudfront-manager'
|
|
|
29
29
|
* @see [CDK Lambda Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html}
|
|
30
30
|
*/
|
|
31
31
|
export class LambdaManager {
|
|
32
|
+
public static NODEJS_RUNTIME = lambda.Runtime.NODEJS_16_X
|
|
32
33
|
/**
|
|
33
34
|
* @summary Method to create a lambda layer (nodejs)
|
|
34
35
|
* @param {string} id scoped id of the resource
|
|
@@ -37,7 +38,7 @@ export class LambdaManager {
|
|
|
37
38
|
*/
|
|
38
39
|
public createLambdaLayer(id: string, scope: common.CommonConstruct, code: lambda.AssetCode) {
|
|
39
40
|
const lambdaLayer = new lambda.LayerVersion(scope, `${id}`, {
|
|
40
|
-
compatibleRuntimes: [
|
|
41
|
+
compatibleRuntimes: [LambdaManager.NODEJS_RUNTIME],
|
|
41
42
|
code: code,
|
|
42
43
|
description: `${id}`,
|
|
43
44
|
layerVersionName: `${id}-${scope.props.stage}`,
|
|
@@ -88,7 +89,7 @@ export class LambdaManager {
|
|
|
88
89
|
allowPublicSubnet: !!vpc,
|
|
89
90
|
functionName: functionName,
|
|
90
91
|
handler: handler || 'index.lambda_handler',
|
|
91
|
-
runtime:
|
|
92
|
+
runtime: LambdaManager.NODEJS_RUNTIME,
|
|
92
93
|
code: code,
|
|
93
94
|
environment: {
|
|
94
95
|
REGION: scope.props.region,
|