@gradientedge/cdk-utils 8.62.0 → 8.64.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/dist/src/lib/manager/aws/log-manager.js +2 -0
- package/dist/src/lib/manager/aws/sfn-manager.d.ts +8 -0
- package/dist/src/lib/manager/aws/sfn-manager.js +26 -0
- package/dist/src/lib/types/aws/index.d.ts +7 -0
- package/package.json +13 -11
- package/src/lib/manager/aws/log-manager.ts +2 -0
- package/src/lib/manager/aws/sfn-manager.ts +37 -0
- package/src/lib/types/aws/index.ts +8 -0
|
@@ -85,6 +85,7 @@ class LogManager {
|
|
|
85
85
|
if (!props)
|
|
86
86
|
throw `Logs props undefined for ${id}`;
|
|
87
87
|
const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
|
|
88
|
+
...props,
|
|
88
89
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
89
90
|
retentionInDays: props.retention,
|
|
90
91
|
});
|
|
@@ -106,6 +107,7 @@ class LogManager {
|
|
|
106
107
|
if (!props)
|
|
107
108
|
throw `Logs props undefined for ${id}`;
|
|
108
109
|
const logGroup = new logs.LogGroup(scope, `${id}`, {
|
|
110
|
+
...props,
|
|
109
111
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
110
112
|
retention: props.retention,
|
|
111
113
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
@@ -129,6 +129,14 @@ export declare class SfnManager {
|
|
|
129
129
|
* @param {apig.IRestApi} api
|
|
130
130
|
*/
|
|
131
131
|
createApiStep(id: string, scope: common.CommonConstruct, props: types.SfnCallApiGatewayRestApiEndpointProps, api: apig.IRestApi): cdk.aws_stepfunctions_tasks.CallApiGatewayRestApiEndpoint;
|
|
132
|
+
/**
|
|
133
|
+
* @summary Method to create a step function execution step
|
|
134
|
+
* @param {string} id scoped id of the resource
|
|
135
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
136
|
+
* @param {types.SfnStartExecutionProps} props props for the step
|
|
137
|
+
* @param {sfn.IStateMachine} stateMachine the state machine to execute
|
|
138
|
+
*/
|
|
139
|
+
createSfnExecutionStep(id: string, scope: common.CommonConstruct, props: types.SfnStartExecutionProps, stateMachine: sfn.IStateMachine): cdk.aws_stepfunctions_tasks.StepFunctionsStartExecution;
|
|
132
140
|
/**
|
|
133
141
|
* @summary Method to create a step function map state
|
|
134
142
|
* @param {string} id scoped id of the resource
|
|
@@ -28,6 +28,7 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
28
28
|
const sfn = __importStar(require("aws-cdk-lib/aws-stepfunctions"));
|
|
29
29
|
const tasks = __importStar(require("aws-cdk-lib/aws-stepfunctions-tasks"));
|
|
30
30
|
const utils = __importStar(require("../../utils"));
|
|
31
|
+
const uuid_1 = require("uuid");
|
|
31
32
|
const DEFAULT_RETRY_CONFIG = [
|
|
32
33
|
{
|
|
33
34
|
errors: ['States.ALL'],
|
|
@@ -380,6 +381,31 @@ class SfnManager {
|
|
|
380
381
|
}));
|
|
381
382
|
return step;
|
|
382
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* @summary Method to create a step function execution step
|
|
386
|
+
* @param {string} id scoped id of the resource
|
|
387
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
388
|
+
* @param {types.SfnStartExecutionProps} props props for the step
|
|
389
|
+
* @param {sfn.IStateMachine} stateMachine the state machine to execute
|
|
390
|
+
*/
|
|
391
|
+
createSfnExecutionStep(id, scope, props, stateMachine) {
|
|
392
|
+
const step = new tasks.StepFunctionsStartExecution(scope, `${id}`, {
|
|
393
|
+
...props,
|
|
394
|
+
associateWithParent: props.associateWithParent ?? true,
|
|
395
|
+
inputPath: props.inputPath,
|
|
396
|
+
name: props.name ?? (0, uuid_1.v4)(),
|
|
397
|
+
stateMachine: stateMachine,
|
|
398
|
+
});
|
|
399
|
+
let retries = props.retries;
|
|
400
|
+
if (!retries || retries.length === 0) {
|
|
401
|
+
retries = DEFAULT_RETRY_CONFIG;
|
|
402
|
+
}
|
|
403
|
+
retries.forEach(retry => step.addRetry({
|
|
404
|
+
...retry,
|
|
405
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
406
|
+
}));
|
|
407
|
+
return step;
|
|
408
|
+
}
|
|
383
409
|
/**
|
|
384
410
|
* @summary Method to create a step function map state
|
|
385
411
|
* @param {string} id scoped id of the resource
|
|
@@ -668,6 +668,13 @@ export interface RuleProps extends events.CfnRuleProps {
|
|
|
668
668
|
*/
|
|
669
669
|
export interface SfnMapProps extends sfn.MapProps {
|
|
670
670
|
}
|
|
671
|
+
/**
|
|
672
|
+
* @category cdk-utils.sfn-manager
|
|
673
|
+
* @subcategory Properties
|
|
674
|
+
*/
|
|
675
|
+
export interface SfnStartExecutionProps extends tasks.StepFunctionsStartExecutionProps {
|
|
676
|
+
retries?: SfnRetryProps[];
|
|
677
|
+
}
|
|
671
678
|
/**
|
|
672
679
|
}
|
|
673
680
|
* @category cdk-utils.event-manager
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.64.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -46,35 +46,37 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@aws-sdk/client-secrets-manager": "^3.338.0",
|
|
49
50
|
"@types/lodash": "^4.14.194",
|
|
50
|
-
"@types/node": "^20.2.
|
|
51
|
+
"@types/node": "^20.2.3",
|
|
52
|
+
"@types/uuid": "^9.0.1",
|
|
51
53
|
"app-root-path": "^3.1.0",
|
|
52
|
-
"aws-cdk-lib": "^2.
|
|
53
|
-
"
|
|
54
|
-
"constructs": "^10.2.27",
|
|
54
|
+
"aws-cdk-lib": "^2.80.0",
|
|
55
|
+
"constructs": "^10.2.31",
|
|
55
56
|
"lodash": "^4.17.21",
|
|
56
57
|
"moment": "^2.29.4",
|
|
57
58
|
"nconf": "^0.12.0",
|
|
58
59
|
"pluralize": "^8.0.0",
|
|
59
|
-
"ts-node": "^10.9.1"
|
|
60
|
+
"ts-node": "^10.9.1",
|
|
61
|
+
"uuid": "^9.0.0"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@babel/core": "^7.21.8",
|
|
63
65
|
"@babel/eslint-parser": "^7.21.8",
|
|
64
66
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
65
67
|
"@types/jest": "^29.5.1",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
67
|
-
"@typescript-eslint/parser": "^5.59.
|
|
68
|
-
"aws-cdk": "^2.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
69
|
+
"@typescript-eslint/parser": "^5.59.7",
|
|
70
|
+
"aws-cdk": "^2.80.0",
|
|
69
71
|
"better-docs": "^2.7.2",
|
|
70
72
|
"codecov": "^3.8.3",
|
|
71
73
|
"commitizen": "^4.3.0",
|
|
72
74
|
"docdash": "^2.0.1",
|
|
73
75
|
"dotenv": "^16.0.3",
|
|
74
|
-
"eslint": "^8.
|
|
76
|
+
"eslint": "^8.41.0",
|
|
75
77
|
"eslint-config-prettier": "^8.8.0",
|
|
76
78
|
"eslint-plugin-import": "^2.27.5",
|
|
77
|
-
"eslint-plugin-jsdoc": "^44.2.
|
|
79
|
+
"eslint-plugin-jsdoc": "^44.2.5",
|
|
78
80
|
"husky": "^8.0.3",
|
|
79
81
|
"jest": "^29.5.0",
|
|
80
82
|
"jest-extended": "^3.2.4",
|
|
@@ -70,6 +70,7 @@ export class LogManager {
|
|
|
70
70
|
if (!props) throw `Logs props undefined for ${id}`
|
|
71
71
|
|
|
72
72
|
const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
|
|
73
|
+
...props,
|
|
73
74
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
74
75
|
retentionInDays: props.retention,
|
|
75
76
|
})
|
|
@@ -95,6 +96,7 @@ export class LogManager {
|
|
|
95
96
|
if (!props) throw `Logs props undefined for ${id}`
|
|
96
97
|
|
|
97
98
|
const logGroup = new logs.LogGroup(scope, `${id}`, {
|
|
99
|
+
...props,
|
|
98
100
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
99
101
|
retention: props.retention,
|
|
100
102
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
@@ -11,6 +11,7 @@ import * as common from '../../common'
|
|
|
11
11
|
import * as types from '../../types'
|
|
12
12
|
import * as utils from '../../utils'
|
|
13
13
|
import { SfnMapProps } from '../../types'
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
14
15
|
|
|
15
16
|
const DEFAULT_RETRY_CONFIG = [
|
|
16
17
|
{
|
|
@@ -433,6 +434,42 @@ export class SfnManager {
|
|
|
433
434
|
return step
|
|
434
435
|
}
|
|
435
436
|
|
|
437
|
+
/**
|
|
438
|
+
* @summary Method to create a step function execution step
|
|
439
|
+
* @param {string} id scoped id of the resource
|
|
440
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
441
|
+
* @param {types.SfnStartExecutionProps} props props for the step
|
|
442
|
+
* @param {sfn.IStateMachine} stateMachine the state machine to execute
|
|
443
|
+
*/
|
|
444
|
+
public createSfnExecutionStep(
|
|
445
|
+
id: string,
|
|
446
|
+
scope: common.CommonConstruct,
|
|
447
|
+
props: types.SfnStartExecutionProps,
|
|
448
|
+
stateMachine: sfn.IStateMachine
|
|
449
|
+
) {
|
|
450
|
+
const step = new tasks.StepFunctionsStartExecution(scope, `${id}`, {
|
|
451
|
+
...props,
|
|
452
|
+
associateWithParent: props.associateWithParent ?? true,
|
|
453
|
+
inputPath: props.inputPath,
|
|
454
|
+
name: props.name ?? uuidv4(),
|
|
455
|
+
stateMachine: stateMachine,
|
|
456
|
+
})
|
|
457
|
+
|
|
458
|
+
let retries = props.retries
|
|
459
|
+
if (!retries || retries.length === 0) {
|
|
460
|
+
retries = DEFAULT_RETRY_CONFIG
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
retries.forEach(retry =>
|
|
464
|
+
step.addRetry({
|
|
465
|
+
...retry,
|
|
466
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
467
|
+
})
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
return step
|
|
471
|
+
}
|
|
472
|
+
|
|
436
473
|
/**
|
|
437
474
|
* @summary Method to create a step function map state
|
|
438
475
|
* @param {string} id scoped id of the resource
|
|
@@ -714,6 +714,14 @@ export interface RuleProps extends events.CfnRuleProps {
|
|
|
714
714
|
*/
|
|
715
715
|
export interface SfnMapProps extends sfn.MapProps {}
|
|
716
716
|
|
|
717
|
+
/**
|
|
718
|
+
* @category cdk-utils.sfn-manager
|
|
719
|
+
* @subcategory Properties
|
|
720
|
+
*/
|
|
721
|
+
export interface SfnStartExecutionProps extends tasks.StepFunctionsStartExecutionProps {
|
|
722
|
+
retries?: SfnRetryProps[]
|
|
723
|
+
}
|
|
724
|
+
|
|
717
725
|
/**
|
|
718
726
|
}
|
|
719
727
|
* @category cdk-utils.event-manager
|