@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.
@@ -20,5 +20,4 @@ export declare class ApplicationConfiguration extends CommonConstruct {
20
20
  protected createAppConfigDeploymentStrategy(): void;
21
21
  protected createAppConfigDeployment(): void;
22
22
  resolveEnvironmentVariables(): any;
23
- protected aaa(): void;
24
23
  }
@@ -93,6 +93,5 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
93
93
  APP_CONFIG_ENVIRONMENT_ID: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
94
94
  };
95
95
  }
96
- aaa() { }
97
96
  }
98
97
  exports.ApplicationConfiguration = ApplicationConfiguration;
@@ -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.103.0",
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.60",
57
+ "constructs": "^10.2.61",
58
58
  "lodash": "^4.17.21",
59
59
  "moment": "^2.29.4",
60
60
  "nconf": "^0.12.0",
@@ -94,6 +94,4 @@ export class ApplicationConfiguration extends CommonConstruct {
94
94
  APP_CONFIG_ENVIRONMENT_ID: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
95
95
  }
96
96
  }
97
-
98
- protected aaa(): void {}
99
97
  }
@@ -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,