@gradientedge/cdk-utils 6.4.0 → 6.7.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.
@@ -103,6 +103,8 @@ class LambdaManager {
103
103
  deadLetterQueue: deadLetterQueue,
104
104
  environment: {
105
105
  REGION: scope.props.region,
106
+ LAST_MODIFIED_TS: new Date().toISOString(),
107
+ STAGE: scope.props.stage,
106
108
  ...environment,
107
109
  },
108
110
  filesystem: accessPoint
@@ -1,9 +1,9 @@
1
+ import * as cdk from 'aws-cdk-lib';
1
2
  import * as apig from 'aws-cdk-lib/aws-apigateway';
2
3
  import * as iam from 'aws-cdk-lib/aws-iam';
3
4
  import * as lambda from 'aws-cdk-lib/aws-lambda';
4
5
  import * as logs from 'aws-cdk-lib/aws-logs';
5
6
  import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
6
- import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks';
7
7
  import * as common from '../../common';
8
8
  import * as types from '../../types';
9
9
  import { SfnStateMachineProps } from '../../types';
@@ -34,35 +34,42 @@ export declare class SfnManager {
34
34
  * @param {common.CommonConstruct} scope scope in which this resource is defined
35
35
  * @param {types.SfnSucceedProps} props
36
36
  */
37
- createSuccessStep(id: string, scope: common.CommonConstruct, props: types.SfnSucceedProps): sfn.Succeed;
37
+ createSuccessStep(id: string, scope: common.CommonConstruct, props: types.SfnSucceedProps): cdk.aws_stepfunctions.Succeed;
38
38
  /**
39
39
  * @summary Method to create a failure step
40
40
  * @param {string} id scoped id of the resource
41
41
  * @param {common.CommonConstruct} scope scope in which this resource is defined
42
42
  * @param {types.SfnFailProps} props
43
43
  */
44
- createFailStep(id: string, scope: common.CommonConstruct, props: types.SfnFailProps): sfn.Fail;
44
+ createFailStep(id: string, scope: common.CommonConstruct, props: types.SfnFailProps): cdk.aws_stepfunctions.Fail;
45
45
  /**
46
46
  * @summary Method to create a pass step
47
47
  * @param {string} id scoped id of the resource
48
48
  * @param {common.CommonConstruct} scope scope in which this resource is defined
49
49
  * @param {types.SfnPassProps} props
50
50
  */
51
- createPassStep(id: string, scope: common.CommonConstruct, props: types.SfnPassProps): sfn.Pass;
51
+ createPassStep(id: string, scope: common.CommonConstruct, props: types.SfnPassProps): cdk.aws_stepfunctions.Pass;
52
52
  /**
53
53
  * @summary Method to create a parallel step
54
54
  * @param {string} id scoped id of the resource
55
55
  * @param {common.CommonConstruct} scope scope in which this resource is defined
56
56
  * @param {types.SfnParallelProps} props
57
57
  */
58
- createParallelStep(id: string, scope: common.CommonConstruct, props: types.SfnParallelProps): sfn.Parallel;
58
+ createParallelStep(id: string, scope: common.CommonConstruct, props: types.SfnParallelProps): cdk.aws_stepfunctions.Parallel;
59
59
  /**
60
60
  * @summary Method to create a choice step
61
61
  * @param {string} id scoped id of the resource
62
62
  * @param {common.CommonConstruct} scope scope in which this resource is defined
63
63
  * @param {types.SfnChoiceProps} props
64
64
  */
65
- createChoiceStep(id: string, scope: common.CommonConstruct, props: types.SfnChoiceProps): sfn.Choice;
65
+ createChoiceStep(id: string, scope: common.CommonConstruct, props: types.SfnChoiceProps): cdk.aws_stepfunctions.Choice;
66
+ /**
67
+ * @summary Method to create a wait step
68
+ * @param {string} id scoped id of the resource
69
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
70
+ * @param {types.SfnWaitProps} props
71
+ */
72
+ createWaitStep(id: string, scope: common.CommonConstruct, props: types.SfnWaitProps): cdk.aws_stepfunctions.Wait;
66
73
  /**
67
74
  * @summary Method to create a lambda invoke step
68
75
  * @param {string} id scoped id of the resource
@@ -70,7 +77,7 @@ export declare class SfnManager {
70
77
  * @param {types.SfnLambdaInvokeProps} props
71
78
  * @param {lambda.IFunction} lambdaFunction
72
79
  */
73
- createLambdaStep(id: string, scope: common.CommonConstruct, props: types.SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction): tasks.LambdaInvoke;
80
+ createLambdaStep(id: string, scope: common.CommonConstruct, props: types.SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction): cdk.aws_stepfunctions_tasks.LambdaInvoke;
74
81
  /**
75
82
  * @summary Method to create a API Gateway invoke step
76
83
  * @param {string} id scoped id of the resource
@@ -78,7 +85,7 @@ export declare class SfnManager {
78
85
  * @param {types.SfnLambdaInvokeProps} props
79
86
  * @param {apig.IRestApi} api
80
87
  */
81
- createApiStep(id: string, scope: common.CommonConstruct, props: types.SfnCallApiGatewayRestApiEndpointProps, api: apig.IRestApi): tasks.CallApiGatewayRestApiEndpoint;
88
+ createApiStep(id: string, scope: common.CommonConstruct, props: types.SfnCallApiGatewayRestApiEndpointProps, api: apig.IRestApi): cdk.aws_stepfunctions_tasks.CallApiGatewayRestApiEndpoint;
82
89
  /**
83
90
  * @summary Method to create a state machine
84
91
  * @param {string} id scoped id of the resource
@@ -88,5 +95,5 @@ export declare class SfnManager {
88
95
  * @param {logs.ILogGroup} logGroup
89
96
  * @param {iam.IRole} role
90
97
  */
91
- createStateMachine(id: string, scope: common.CommonConstruct, props: SfnStateMachineProps, definition: sfn.IChainable, logGroup: logs.ILogGroup, role?: iam.IRole): sfn.StateMachine;
98
+ createStateMachine(id: string, scope: common.CommonConstruct, props: SfnStateMachineProps, definition: sfn.IChainable, logGroup: logs.ILogGroup, role?: iam.IRole): cdk.aws_stepfunctions.StateMachine;
92
99
  }
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.SfnManager = void 0;
27
+ const cdk = __importStar(require("aws-cdk-lib"));
27
28
  const sfn = __importStar(require("aws-cdk-lib/aws-stepfunctions"));
28
29
  const tasks = __importStar(require("aws-cdk-lib/aws-stepfunctions-tasks"));
29
30
  const utils = __importStar(require("../../utils"));
@@ -128,6 +129,21 @@ class SfnManager {
128
129
  },
129
130
  });
130
131
  }
132
+ /**
133
+ * @summary Method to create a wait 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.SfnWaitProps} props
137
+ */
138
+ createWaitStep(id, scope, props) {
139
+ return new sfn.Wait(scope, `${props.name}`, {
140
+ ...props,
141
+ ...{
142
+ comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
143
+ time: sfn.WaitTime.duration(cdk.Duration.seconds(props.delayInSeconds)),
144
+ },
145
+ });
146
+ }
131
147
  /**
132
148
  * @summary Method to create a lambda invoke step
133
149
  * @param {string} id scoped id of the resource
@@ -149,6 +149,14 @@ export interface SfnParallelProps extends sfn.ParallelProps {
149
149
  export interface SfnChoiceProps extends sfn.ChoiceProps {
150
150
  name: string;
151
151
  }
152
+ /**
153
+ * @category cdk-utils.step-functions-manager
154
+ * @subcategory Properties
155
+ */
156
+ export interface SfnWaitProps extends sfn.WaitProps {
157
+ name: string;
158
+ delayInSeconds: number;
159
+ }
152
160
  /**
153
161
  * @category cdk-utils.step-functions-manager
154
162
  * @subcategory Properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "6.4.0",
3
+ "version": "6.7.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -45,12 +45,12 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@types/lodash": "^4.14.182",
49
- "@types/node": "^18.7.6",
48
+ "@types/lodash": "^4.14.184",
49
+ "@types/node": "^18.7.9",
50
50
  "app-root-path": "^3.1.0",
51
- "aws-cdk-lib": "^2.37.1",
52
- "aws-sdk": "^2.1195.0",
53
- "constructs": "^10.1.77",
51
+ "aws-cdk-lib": "^2.38.1",
52
+ "aws-sdk": "^2.1199.0",
53
+ "constructs": "^10.1.83",
54
54
  "lodash": "^4.17.21",
55
55
  "moment": "^2.29.4",
56
56
  "nconf": "^0.12.0",
@@ -78,11 +78,11 @@
78
78
  "jsdoc": "^3.6.11",
79
79
  "jsdoc-babel": "^0.5.0",
80
80
  "jsdoc-mermaid": "^1.0.0",
81
- "lerna": "^5.4.2",
81
+ "lerna": "^5.4.3",
82
82
  "prettier": "^2.7.1",
83
- "prettier-plugin-organize-imports": "^3.0.3",
83
+ "prettier-plugin-organize-imports": "^3.1.0",
84
84
  "rimraf": "^3.0.2",
85
- "semantic-release": "^19.0.3",
85
+ "semantic-release": "^19.0.4",
86
86
  "ts-jest": "^28.0.8",
87
87
  "ts-node": "^10.9.1",
88
88
  "typescript": "4.7.4"
@@ -102,6 +102,8 @@ export class LambdaManager {
102
102
  deadLetterQueue: deadLetterQueue,
103
103
  environment: {
104
104
  REGION: scope.props.region,
105
+ LAST_MODIFIED_TS: new Date().toISOString(),
106
+ STAGE: scope.props.stage,
105
107
  ...environment,
106
108
  },
107
109
  filesystem: accessPoint
@@ -1,3 +1,4 @@
1
+ import * as cdk from 'aws-cdk-lib'
1
2
  import * as apig from 'aws-cdk-lib/aws-apigateway'
2
3
  import * as iam from 'aws-cdk-lib/aws-iam'
3
4
  import * as lambda from 'aws-cdk-lib/aws-lambda'
@@ -110,6 +111,22 @@ export class SfnManager {
110
111
  })
111
112
  }
112
113
 
114
+ /**
115
+ * @summary Method to create a wait step
116
+ * @param {string} id scoped id of the resource
117
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
118
+ * @param {types.SfnWaitProps} props
119
+ */
120
+ public createWaitStep(id: string, scope: common.CommonConstruct, props: types.SfnWaitProps) {
121
+ return new sfn.Wait(scope, `${props.name}`, {
122
+ ...props,
123
+ ...{
124
+ comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
125
+ time: sfn.WaitTime.duration(cdk.Duration.seconds(props.delayInSeconds)),
126
+ },
127
+ })
128
+ }
129
+
113
130
  /**
114
131
  * @summary Method to create a lambda invoke step
115
132
  * @param {string} id scoped id of the resource
@@ -160,6 +160,15 @@ export interface SfnChoiceProps extends sfn.ChoiceProps {
160
160
  name: string
161
161
  }
162
162
 
163
+ /**
164
+ * @category cdk-utils.step-functions-manager
165
+ * @subcategory Properties
166
+ */
167
+ export interface SfnWaitProps extends sfn.WaitProps {
168
+ name: string
169
+ delayInSeconds: number
170
+ }
171
+
163
172
  /**
164
173
  * @category cdk-utils.step-functions-manager
165
174
  * @subcategory Properties