@gradientedge/cdk-utils 8.103.0 → 8.105.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/construct/application-configuration/main.d.ts +0 -1
- package/dist/src/lib/construct/application-configuration/main.js +0 -1
- package/dist/src/lib/services/aws/step-function/main.d.ts +9 -0
- package/dist/src/lib/services/aws/step-function/main.js +32 -1
- package/package.json +2 -2
- package/src/lib/construct/application-configuration/main.ts +0 -2
- package/src/lib/services/aws/step-function/main.ts +42 -1
|
@@ -117,6 +117,15 @@ export declare class SfnManager {
|
|
|
117
117
|
* @param lambdaFunction
|
|
118
118
|
*/
|
|
119
119
|
createLambdaStep(id: string, scope: CommonConstruct, props: SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction): cdk.aws_stepfunctions_tasks.LambdaInvoke;
|
|
120
|
+
/**
|
|
121
|
+
* @summary Method to create a lambda invoke step
|
|
122
|
+
* @param id scoped id of the resource
|
|
123
|
+
* @param scope scope in which this resource is defined
|
|
124
|
+
* @param props
|
|
125
|
+
* @param lambdaFunction
|
|
126
|
+
* @param skipExecution
|
|
127
|
+
*/
|
|
128
|
+
createSkippableLambdaStep(id: string, scope: CommonConstruct, props: SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction, skipExecution?: boolean): cdk.aws_stepfunctions.Pass | cdk.aws_stepfunctions_tasks.LambdaInvoke;
|
|
120
129
|
/**
|
|
121
130
|
* @summary Method to create a API Gateway invoke step
|
|
122
131
|
* @param id scoped id of the resource
|
|
@@ -29,6 +29,7 @@ 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
31
|
const uuid_1 = require("uuid");
|
|
32
|
+
const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions");
|
|
32
33
|
const DEFAULT_RETRY_CONFIG = [
|
|
33
34
|
{
|
|
34
35
|
backoffRate: 2,
|
|
@@ -349,6 +350,36 @@ class SfnManager {
|
|
|
349
350
|
}));
|
|
350
351
|
return step;
|
|
351
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* @summary Method to create a lambda invoke step
|
|
355
|
+
* @param id scoped id of the resource
|
|
356
|
+
* @param scope scope in which this resource is defined
|
|
357
|
+
* @param props
|
|
358
|
+
* @param lambdaFunction
|
|
359
|
+
* @param skipExecution
|
|
360
|
+
*/
|
|
361
|
+
createSkippableLambdaStep(id, scope, props, lambdaFunction, skipExecution) {
|
|
362
|
+
if (!props)
|
|
363
|
+
throw `Step props undefined for ${id}`;
|
|
364
|
+
if (skipExecution)
|
|
365
|
+
return this.createPassStep(id, scope, { name: props.name, comment: props.comment });
|
|
366
|
+
const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
|
|
367
|
+
...props,
|
|
368
|
+
...{
|
|
369
|
+
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
370
|
+
lambdaFunction,
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
let retries = props.retries;
|
|
374
|
+
if (!retries || retries.length === 0) {
|
|
375
|
+
retries = DEFAULT_RETRY_CONFIG;
|
|
376
|
+
}
|
|
377
|
+
retries.forEach(retry => step.addRetry({
|
|
378
|
+
...retry,
|
|
379
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
380
|
+
}));
|
|
381
|
+
return step;
|
|
382
|
+
}
|
|
352
383
|
/**
|
|
353
384
|
* @summary Method to create a API Gateway invoke step
|
|
354
385
|
* @param id scoped id of the resource
|
|
@@ -424,7 +455,7 @@ class SfnManager {
|
|
|
424
455
|
if (!props)
|
|
425
456
|
throw `State Machine props undefined for ${id}`;
|
|
426
457
|
const stateMachine = new sfn.StateMachine(scope, `${id}`, {
|
|
427
|
-
definition,
|
|
458
|
+
definitionBody: aws_stepfunctions_1.DefinitionBody.fromChainable(definition),
|
|
428
459
|
logs: {
|
|
429
460
|
destination: logGroup,
|
|
430
461
|
includeExecutionData: props.logs?.includeExecutionData ?? true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.105.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/uuid": "^9.0.2",
|
|
55
55
|
"app-root-path": "^3.1.0",
|
|
56
56
|
"aws-cdk-lib": "^2.85.0",
|
|
57
|
-
"constructs": "^10.2.
|
|
57
|
+
"constructs": "^10.2.61",
|
|
58
58
|
"lodash": "^4.17.21",
|
|
59
59
|
"moment": "^2.29.4",
|
|
60
60
|
"nconf": "^0.12.0",
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
SfnSucceedProps,
|
|
28
28
|
SfnWaitProps,
|
|
29
29
|
} from './types'
|
|
30
|
+
import { DefinitionBody } from 'aws-cdk-lib/aws-stepfunctions'
|
|
30
31
|
|
|
31
32
|
const DEFAULT_RETRY_CONFIG = [
|
|
32
33
|
{
|
|
@@ -407,6 +408,46 @@ export class SfnManager {
|
|
|
407
408
|
return step
|
|
408
409
|
}
|
|
409
410
|
|
|
411
|
+
/**
|
|
412
|
+
* @summary Method to create a lambda invoke step
|
|
413
|
+
* @param id scoped id of the resource
|
|
414
|
+
* @param scope scope in which this resource is defined
|
|
415
|
+
* @param props
|
|
416
|
+
* @param lambdaFunction
|
|
417
|
+
* @param skipExecution
|
|
418
|
+
*/
|
|
419
|
+
public createSkippableLambdaStep(
|
|
420
|
+
id: string,
|
|
421
|
+
scope: CommonConstruct,
|
|
422
|
+
props: SfnLambdaInvokeProps,
|
|
423
|
+
lambdaFunction: lambda.IFunction,
|
|
424
|
+
skipExecution?: boolean
|
|
425
|
+
) {
|
|
426
|
+
if (!props) throw `Step props undefined for ${id}`
|
|
427
|
+
if (skipExecution) return this.createPassStep(id, scope, { name: props.name, comment: props.comment })
|
|
428
|
+
const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
|
|
429
|
+
...props,
|
|
430
|
+
...{
|
|
431
|
+
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
432
|
+
lambdaFunction,
|
|
433
|
+
},
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
let retries = props.retries
|
|
437
|
+
if (!retries || retries.length === 0) {
|
|
438
|
+
retries = DEFAULT_RETRY_CONFIG
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
retries.forEach(retry =>
|
|
442
|
+
step.addRetry({
|
|
443
|
+
...retry,
|
|
444
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
445
|
+
})
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
return step
|
|
449
|
+
}
|
|
450
|
+
|
|
410
451
|
/**
|
|
411
452
|
* @summary Method to create a API Gateway invoke step
|
|
412
453
|
* @param id scoped id of the resource
|
|
@@ -510,7 +551,7 @@ export class SfnManager {
|
|
|
510
551
|
) {
|
|
511
552
|
if (!props) throw `State Machine props undefined for ${id}`
|
|
512
553
|
const stateMachine = new sfn.StateMachine(scope, `${id}`, {
|
|
513
|
-
definition,
|
|
554
|
+
definitionBody: DefinitionBody.fromChainable(definition),
|
|
514
555
|
logs: {
|
|
515
556
|
destination: logGroup,
|
|
516
557
|
includeExecutionData: props.logs?.includeExecutionData ?? true,
|