@gradientedge/cdk-utils 8.61.0 → 8.63.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 (28) hide show
  1. package/README.md +3 -5
  2. package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +2 -2
  3. package/dist/src/lib/construct/api-to-eventbridge-target/main.js +2 -2
  4. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +2 -2
  5. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +2 -2
  6. package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +3 -0
  7. package/dist/src/lib/construct/api-to-lambda-target/main.js +3 -0
  8. package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +2 -1
  9. package/dist/src/lib/construct/graphql-api-lambda/main.js +2 -1
  10. package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +2 -1
  11. package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +2 -1
  12. package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +1 -0
  13. package/dist/src/lib/construct/site-with-ecs-backend/main.js +1 -0
  14. package/dist/src/lib/construct/static-site/main.d.ts +1 -0
  15. package/dist/src/lib/construct/static-site/main.js +1 -0
  16. package/dist/src/lib/manager/aws/sfn-manager.d.ts +8 -0
  17. package/dist/src/lib/manager/aws/sfn-manager.js +26 -0
  18. package/dist/src/lib/types/aws/index.d.ts +7 -0
  19. package/package.json +12 -5
  20. package/src/lib/construct/api-to-eventbridge-target/main.ts +2 -2
  21. package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +2 -2
  22. package/src/lib/construct/api-to-lambda-target/main.ts +3 -0
  23. package/src/lib/construct/graphql-api-lambda/main.ts +2 -1
  24. package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +2 -1
  25. package/src/lib/construct/site-with-ecs-backend/main.ts +1 -0
  26. package/src/lib/construct/static-site/main.ts +1 -0
  27. package/src/lib/manager/aws/sfn-manager.ts +37 -0
  28. package/src/lib/types/aws/index.ts +8 -0
package/README.md CHANGED
@@ -1,6 +1,4 @@
1
- [![Gradient Edge][logo]](https://gradientedge.com)
2
-
3
- # Gradient Edge CDK Utils
1
+ # <img src="https://cdn.gradientedge.io/images/ge-logo-1200.png" width="175px" alt="Gradient Edge"> CDK Utils
4
2
 
5
3
  [![Release][release]][release-url]
6
4
  [![version][version]][version-url]
@@ -27,9 +25,9 @@
27
25
 
28
26
  ## Introduction
29
27
 
30
- Toolkit for working with the [AWS CDK][aws-cdk] Toolkit.
28
+ Toolkit for working with the [AWS CDK][aws-cdk].
31
29
 
32
- For more details, see our full [API documentation](https://gradientedge.github.io/cdk-utils/).
30
+ For more details, see the full [API documentation](https://gradientedge.github.io/cdk-utils/).
33
31
 
34
32
  ## Installation
35
33
 
@@ -8,7 +8,7 @@ import * as types from '../../types/aws';
8
8
  * @subcategory construct
9
9
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
10
10
  *
11
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTarget.jpg)
11
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
12
12
  *
13
13
  * @example
14
14
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -22,7 +22,7 @@ import * as types from '../../types/aws';
22
22
  * this.initResources()
23
23
  * }
24
24
  * }
25
- *
25
+ * @mixin
26
26
  */
27
27
  export declare class ApiToEventBridgeTarget extends CommonConstruct {
28
28
  props: types.ApiToEventBridgeTargetProps;
@@ -37,7 +37,7 @@ const helper = __importStar(require("../../helper"));
37
37
  * @subcategory construct
38
38
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
39
39
  *
40
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTarget.jpg)
40
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
41
41
  *
42
42
  * @example
43
43
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -51,7 +51,7 @@ const helper = __importStar(require("../../helper"));
51
51
  * this.initResources()
52
52
  * }
53
53
  * }
54
- *
54
+ * @mixin
55
55
  */
56
56
  class ApiToEventBridgeTarget extends common_1.CommonConstruct {
57
57
  props;
@@ -10,7 +10,7 @@ import * as types from '../../types';
10
10
  * @subcategory construct
11
11
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
12
12
  *
13
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
13
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
14
14
  *
15
15
  * @example
16
16
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -24,7 +24,7 @@ import * as types from '../../types';
24
24
  * this.initResources()
25
25
  * }
26
26
  * }
27
- *
27
+ * @mixin
28
28
  */
29
29
  export declare class ApiToEventBridgeTargetWithSns extends CommonConstruct {
30
30
  props: types.ApiToEventBridgeTargetProps;
@@ -41,7 +41,7 @@ const api_destined_lambda_1 = require("./api-destined-lambda");
41
41
  * @subcategory construct
42
42
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
43
43
  *
44
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
44
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
45
45
  *
46
46
  * @example
47
47
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -55,7 +55,7 @@ const api_destined_lambda_1 = require("./api-destined-lambda");
55
55
  * this.initResources()
56
56
  * }
57
57
  * }
58
- *
58
+ * @mixin
59
59
  */
60
60
  class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
61
61
  props;
@@ -2,6 +2,9 @@ import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
2
2
  import { Construct } from 'constructs';
3
3
  import { CommonConstruct } from '../../common';
4
4
  import * as types from '../../types/aws';
5
+ /**
6
+ * @mixin
7
+ */
5
8
  export declare class ApiToLambdaTarget extends CommonConstruct {
6
9
  props: types.ApiToLambdaTargetProps;
7
10
  id: string;
@@ -30,6 +30,9 @@ const iam = __importStar(require("aws-cdk-lib/aws-iam"));
30
30
  const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
31
31
  const common_1 = require("../../common");
32
32
  const helper = __importStar(require("../../helper"));
33
+ /**
34
+ * @mixin
35
+ */
33
36
  class ApiToLambdaTarget extends common_1.CommonConstruct {
34
37
  props;
35
38
  id;
@@ -13,7 +13,7 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from '../../types'
13
13
  * @subcategory construct
14
14
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda
15
15
  *
16
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
16
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
17
17
  *
18
18
  * @example
19
19
  * import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
@@ -27,6 +27,7 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from '../../types'
27
27
  * this.initResources()
28
28
  * }
29
29
  * }
30
+ * @mixin
30
31
  */
31
32
  export declare class GraphQLApiLambda extends CommonConstruct {
32
33
  props: GraphQlApiLambdaProps;
@@ -33,7 +33,7 @@ const common_1 = require("../../common");
33
33
  * @subcategory construct
34
34
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda
35
35
  *
36
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
36
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
37
37
  *
38
38
  * @example
39
39
  * import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
@@ -47,6 +47,7 @@ const common_1 = require("../../common");
47
47
  * this.initResources()
48
48
  * }
49
49
  * }
50
+ * @mixin
50
51
  */
51
52
  class GraphQLApiLambda extends common_1.CommonConstruct {
52
53
  /* graphql restApi props */
@@ -9,7 +9,7 @@ import { GraphQlApiLambdaWithCacheProps } from '../../types';
9
9
  * @subcategory construct
10
10
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda with Caching
11
11
  *
12
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
12
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
13
13
  *
14
14
  * @example
15
15
  * import { GraphQlApiLambdaWithCacheProps } '@gradientedge/cdk-utils'
@@ -23,6 +23,7 @@ import { GraphQlApiLambdaWithCacheProps } from '../../types';
23
23
  * this.initResources()
24
24
  * }
25
25
  * }
26
+ * @mixin
26
27
  */
27
28
  export declare class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
28
29
  props: GraphQlApiLambdaWithCacheProps;
@@ -35,7 +35,7 @@ const utils = __importStar(require("../../utils"));
35
35
  * @subcategory construct
36
36
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda with Caching
37
37
  *
38
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
38
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
39
39
  *
40
40
  * @example
41
41
  * import { GraphQlApiLambdaWithCacheProps } '@gradientedge/cdk-utils'
@@ -49,6 +49,7 @@ const utils = __importStar(require("../../utils"));
49
49
  * this.initResources()
50
50
  * }
51
51
  * }
52
+ * @mixin
52
53
  */
53
54
  class GraphQLApiLambdaWithCache extends __1.GraphQLApiLambda {
54
55
  /* graphql restApi props */
@@ -30,6 +30,7 @@ import { SiteWithEcsBackendProps } from '../../types';
30
30
  * this.initResources()
31
31
  * }
32
32
  * }
33
+ * @mixin
33
34
  */
34
35
  export declare class SiteWithEcsBackend extends CommonConstruct {
35
36
  props: SiteWithEcsBackendProps;
@@ -49,6 +49,7 @@ const common_1 = require("../../common");
49
49
  * this.initResources()
50
50
  * }
51
51
  * }
52
+ * @mixin
52
53
  */
53
54
  class SiteWithEcsBackend extends common_1.CommonConstruct {
54
55
  /* site properties */
@@ -24,6 +24,7 @@ import { StaticSiteProps } from '../../types';
24
24
  * this.initResources()
25
25
  * }
26
26
  * }
27
+ * @mixin
27
28
  */
28
29
  export declare class StaticSite extends CommonConstruct {
29
30
  props: StaticSiteProps;
@@ -45,6 +45,7 @@ const common_1 = require("../../common");
45
45
  * this.initResources()
46
46
  * }
47
47
  * }
48
+ * @mixin
48
49
  */
49
50
  class StaticSite extends common_1.CommonConstruct {
50
51
  /* static site properties */
@@ -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.61.0",
3
+ "version": "8.63.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -30,14 +30,15 @@
30
30
  "build:production": "rimraf dist/ && npx tsc -p tsconfig.prd.json && pnpm -r build",
31
31
  "ci": "pnpm install --frozen-lockfile && pnpm build && pnpm validate && pnpm run docs",
32
32
  "cz": "npx cz",
33
- "docs": "npx rimraf api-docs && npx jsdoc --pedantic -c jsdoc.json .",
33
+ "override:plugin:docs": "cp theme/type-converter.js node_modules/better-docs/typescript",
34
+ "docs": "npx rimraf api-docs && pnpm override:plugin:docs && npx jsdoc --pedantic -c jsdoc.json .",
34
35
  "lint": "pnpm prettify && eslint **/*.ts --cache --max-warnings=0",
35
36
  "fix": "pnpm prettify && eslint --fix **/*.ts",
36
37
  "prettier": "npx prettier --cache --check \"**/*.{ts,json,md}\"",
37
38
  "prettify": "npx prettier --cache --write \"**/*.{ts,json,md}\"",
38
39
  "test": "npx rimraf coverage && npx jest --ci --maxWorkers=100%",
39
40
  "update:deps": "ncu -u --deep --reject react,react-dom",
40
- "validate": "pnpm prettier && pnpm test"
41
+ "validate": "pnpm prettier && pnpm lint && pnpm test"
41
42
  },
42
43
  "husky": {
43
44
  "hooks": {
@@ -45,17 +46,19 @@
45
46
  }
46
47
  },
47
48
  "dependencies": {
49
+ "@aws-sdk/client-secrets-manager": "^3.334.0",
48
50
  "@types/lodash": "^4.14.194",
49
51
  "@types/node": "^20.2.0",
52
+ "@types/uuid": "^9.0.1",
50
53
  "app-root-path": "^3.1.0",
51
54
  "aws-cdk-lib": "^2.79.1",
52
- "@aws-sdk/client-secrets-manager": "^3.334.0",
53
55
  "constructs": "^10.2.27",
54
56
  "lodash": "^4.17.21",
55
57
  "moment": "^2.29.4",
56
58
  "nconf": "^0.12.0",
57
59
  "pluralize": "^8.0.0",
58
- "ts-node": "^10.9.1"
60
+ "ts-node": "^10.9.1",
61
+ "uuid": "^9.0.0"
59
62
  },
60
63
  "devDependencies": {
61
64
  "@babel/core": "^7.21.8",
@@ -68,10 +71,12 @@
68
71
  "better-docs": "^2.7.2",
69
72
  "codecov": "^3.8.3",
70
73
  "commitizen": "^4.3.0",
74
+ "docdash": "^2.0.1",
71
75
  "dotenv": "^16.0.3",
72
76
  "eslint": "^8.40.0",
73
77
  "eslint-config-prettier": "^8.8.0",
74
78
  "eslint-plugin-import": "^2.27.5",
79
+ "eslint-plugin-jsdoc": "^44.2.4",
75
80
  "husky": "^8.0.3",
76
81
  "jest": "^29.5.0",
77
82
  "jest-extended": "^3.2.4",
@@ -79,6 +84,8 @@
79
84
  "jsdoc": "^4.0.2",
80
85
  "jsdoc-babel": "^0.5.0",
81
86
  "jsdoc-mermaid": "^1.0.0",
87
+ "jsdoc-to-markdown": "^8.0.0",
88
+ "jsdoc-plugin-typescript": "^2.2.1",
82
89
  "prettier": "^2.8.8",
83
90
  "prettier-plugin-organize-imports": "^3.2.2",
84
91
  "rimraf": "^5.0.1",
@@ -15,7 +15,7 @@ import * as types from '../../types/aws'
15
15
  * @subcategory construct
16
16
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
17
17
  *
18
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTarget.jpg)
18
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
19
19
  *
20
20
  * @example
21
21
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -29,7 +29,7 @@ import * as types from '../../types/aws'
29
29
  * this.initResources()
30
30
  * }
31
31
  * }
32
- *
32
+ * @mixin
33
33
  */
34
34
  export class ApiToEventBridgeTarget extends CommonConstruct {
35
35
  props: types.ApiToEventBridgeTargetProps
@@ -20,7 +20,7 @@ import { ApiDestinedLambda } from './api-destined-lambda'
20
20
  * @subcategory construct
21
21
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
22
22
  *
23
- * <b>Architecture</b> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
23
+ * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
24
24
  *
25
25
  * @example
26
26
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
@@ -34,7 +34,7 @@ import { ApiDestinedLambda } from './api-destined-lambda'
34
34
  * this.initResources()
35
35
  * }
36
36
  * }
37
- *
37
+ * @mixin
38
38
  */
39
39
  export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
40
40
  props: types.ApiToEventBridgeTargetProps
@@ -8,6 +8,9 @@ import { CommonConstruct } from '../../common'
8
8
  import * as helper from '../../helper'
9
9
  import * as types from '../../types/aws'
10
10
 
11
+ /**
12
+ * @mixin
13
+ */
11
14
  export class ApiToLambdaTarget extends CommonConstruct {
12
15
  props: types.ApiToLambdaTargetProps
13
16
  id: string
@@ -14,7 +14,7 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from '../../types'
14
14
  * @subcategory construct
15
15
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda
16
16
  *
17
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
17
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
18
18
  *
19
19
  * @example
20
20
  * import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
@@ -28,6 +28,7 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from '../../types'
28
28
  * this.initResources()
29
29
  * }
30
30
  * }
31
+ * @mixin
31
32
  */
32
33
  export class GraphQLApiLambda extends CommonConstruct {
33
34
  /* graphql restApi props */
@@ -13,7 +13,7 @@ import * as utils from '../../utils'
13
13
  * @subcategory construct
14
14
  * @classdesc Provides a construct to create and deploy a Graphql API as Lambda with Caching
15
15
  *
16
- * <b>Architecture</b> ![Architecture](./GraphQLApiLambda.jpg)
16
+ * <b>Architecture</b><br/> ![Architecture](./GraphQLApiLambda.jpg)
17
17
  *
18
18
  * @example
19
19
  * import { GraphQlApiLambdaWithCacheProps } '@gradientedge/cdk-utils'
@@ -27,6 +27,7 @@ import * as utils from '../../utils'
27
27
  * this.initResources()
28
28
  * }
29
29
  * }
30
+ * @mixin
30
31
  */
31
32
  export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
32
33
  /* graphql restApi props */
@@ -33,6 +33,7 @@ import { SiteWithEcsBackendProps } from '../../types'
33
33
  * this.initResources()
34
34
  * }
35
35
  * }
36
+ * @mixin
36
37
  */
37
38
  export class SiteWithEcsBackend extends CommonConstruct {
38
39
  /* site properties */
@@ -25,6 +25,7 @@ import { StaticSiteProps } from '../../types'
25
25
  * this.initResources()
26
26
  * }
27
27
  * }
28
+ * @mixin
28
29
  */
29
30
  export class StaticSite extends CommonConstruct {
30
31
  /* static site properties */
@@ -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