@gradientedge/cdk-utils 8.122.0 → 8.123.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 (59) hide show
  1. package/dist/src/lib/aws/common/stack.js +5 -7
  2. package/dist/src/lib/aws/construct/api-to-any-target/main.js +24 -26
  3. package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +85 -103
  4. package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +94 -120
  5. package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +8 -10
  6. package/dist/src/lib/aws/construct/graphql-api-lambda/main.js +7 -3
  7. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/main.js +5 -1
  8. package/dist/src/lib/aws/construct/lambda-with-iam-access/main.js +5 -1
  9. package/dist/src/lib/aws/construct/rest-api-lambda/main.js +7 -3
  10. package/dist/src/lib/aws/construct/rest-api-lambda-with-cache/main.js +5 -1
  11. package/dist/src/lib/aws/construct/site-with-ecs-backend/main.js +8 -6
  12. package/dist/src/lib/aws/construct/static-asset-deployment/main.js +5 -1
  13. package/dist/src/lib/aws/services/api-gateway/main.js +18 -10
  14. package/dist/src/lib/aws/services/cloudfront/main.js +11 -7
  15. package/dist/src/lib/aws/services/cloudwatch/logs.js +8 -4
  16. package/dist/src/lib/aws/services/cloudwatch/main.js +36 -78
  17. package/dist/src/lib/aws/services/dynamodb/main.js +6 -2
  18. package/dist/src/lib/aws/services/elastic-container-service/main.js +8 -4
  19. package/dist/src/lib/aws/services/elastic-file-system/main.js +5 -1
  20. package/dist/src/lib/aws/services/elasticache/main.js +6 -2
  21. package/dist/src/lib/aws/services/eventbridge/main.js +8 -4
  22. package/dist/src/lib/aws/services/lambda/main.js +7 -3
  23. package/dist/src/lib/aws/services/simple-notification-service/main.js +6 -2
  24. package/dist/src/lib/aws/services/simple-queue-service/main.js +6 -2
  25. package/dist/src/lib/aws/services/simple-storage-service/main.js +8 -4
  26. package/dist/src/lib/aws/services/step-function/main.js +52 -32
  27. package/dist/src/lib/aws/services/virtual-private-cloud/main.js +8 -4
  28. package/dist/src/lib/azure/common/stack.js +5 -7
  29. package/dist/src/lib/common/index.js +7 -3
  30. package/package.json +8 -8
  31. package/src/lib/aws/common/stack.ts +5 -7
  32. package/src/lib/aws/construct/api-to-any-target/main.ts +25 -27
  33. package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +85 -103
  34. package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +94 -120
  35. package/src/lib/aws/construct/api-to-lambda-target/main.ts +8 -10
  36. package/src/lib/aws/construct/graphql-api-lambda/main.ts +4 -3
  37. package/src/lib/aws/construct/graphql-api-lambda-with-cache/main.ts +2 -1
  38. package/src/lib/aws/construct/lambda-with-iam-access/main.ts +2 -1
  39. package/src/lib/aws/construct/rest-api-lambda/main.ts +4 -3
  40. package/src/lib/aws/construct/rest-api-lambda-with-cache/main.ts +2 -1
  41. package/src/lib/aws/construct/site-with-ecs-backend/main.ts +8 -9
  42. package/src/lib/aws/construct/static-asset-deployment/main.ts +2 -1
  43. package/src/lib/aws/services/api-gateway/main.ts +9 -6
  44. package/src/lib/aws/services/cloudfront/main.ts +8 -7
  45. package/src/lib/aws/services/cloudwatch/logs.ts +6 -5
  46. package/src/lib/aws/services/cloudwatch/main.ts +35 -81
  47. package/src/lib/aws/services/dynamodb/main.ts +3 -2
  48. package/src/lib/aws/services/elastic-container-service/main.ts +5 -4
  49. package/src/lib/aws/services/elastic-file-system/main.ts +2 -1
  50. package/src/lib/aws/services/elasticache/main.ts +3 -2
  51. package/src/lib/aws/services/eventbridge/main.ts +5 -4
  52. package/src/lib/aws/services/lambda/main.ts +4 -3
  53. package/src/lib/aws/services/simple-notification-service/main.ts +3 -2
  54. package/src/lib/aws/services/simple-queue-service/main.ts +3 -2
  55. package/src/lib/aws/services/simple-storage-service/main.ts +5 -4
  56. package/src/lib/aws/services/step-function/main.ts +17 -16
  57. package/src/lib/aws/services/virtual-private-cloud/main.ts +5 -4
  58. package/src/lib/azure/common/stack.ts +7 -9
  59. package/src/lib/common/index.ts +5 -3
@@ -3,9 +3,10 @@ import { CommonAzureConstruct } from './construct'
3
3
  import { CommonAzureStackProps } from './types'
4
4
 
5
5
  import appRoot from 'app-root-path'
6
- import { App, TerraformStack } from 'cdktf'
7
- import { isDevStage } from '../../common'
6
+ import { TerraformStack } from 'cdktf'
8
7
  import { Construct } from 'constructs'
8
+ import _ from 'lodash'
9
+ import { isDevStage } from '../../common'
9
10
 
10
11
  /**
11
12
  * @classdesc Common stack to use as a base for all higher level constructs.
@@ -70,7 +71,7 @@ export class CommonAzureStack extends TerraformStack {
70
71
  return
71
72
  }
72
73
 
73
- extraContexts.forEach((context: string) => {
74
+ _.forEach(extraContexts, (context: string) => {
74
75
  const extraContextPath = `${appRoot.path}/${context}`
75
76
 
76
77
  /* scenario where extra context is configured in cdk.json but absent in file system */
@@ -84,7 +85,7 @@ export class CommonAzureStack extends TerraformStack {
84
85
  const extraContextProps = JSON.parse(extraContextPropsBuffer.toString('utf-8'))
85
86
 
86
87
  /* set each of the property into the cdk node context */
87
- Object.keys(extraContextProps).forEach((propKey: any) => {
88
+ _.keys(extraContextProps).forEach((propKey: any) => {
88
89
  this.node.setContext(propKey, extraContextProps[propKey])
89
90
  })
90
91
  })
@@ -120,13 +121,10 @@ export class CommonAzureStack extends TerraformStack {
120
121
  const stageContextProps = JSON.parse(stageContextPropsBuffer.toString('utf-8'))
121
122
 
122
123
  /* set each of the property into the cdk node context */
123
- Object.keys(stageContextProps).forEach((propKey: any) => {
124
+ _.keys(stageContextProps).forEach((propKey: any) => {
124
125
  /* handle object, array properties */
125
126
  if (typeof stageContextProps[propKey] === 'object' && !Array.isArray(stageContextProps[propKey])) {
126
- this.node.setContext(propKey, {
127
- ...this.node.tryGetContext(propKey),
128
- ...stageContextProps[propKey],
129
- })
127
+ this.node.setContext(propKey, _.merge(this.node.tryGetContext(propKey), stageContextProps[propKey]))
130
128
  } else {
131
129
  /* handle all other primitive properties */
132
130
  this.node.setContext(propKey, stageContextProps[propKey])
@@ -1,15 +1,17 @@
1
+ import _ from 'lodash'
2
+
1
3
  export * from './construct'
2
4
  export * from './stack'
3
5
  export * from './types'
4
6
  export * from './utils'
5
7
 
6
8
  export const applyMixins = (derivedCtor: any, constructors: any[]) => {
7
- constructors.forEach(baseCtor => {
8
- Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
9
+ _.forEach(constructors, baseConstructor => {
10
+ Object.getOwnPropertyNames(baseConstructor.prototype).forEach(name => {
9
11
  Object.defineProperty(
10
12
  derivedCtor.prototype,
11
13
  name,
12
- Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null)
14
+ Object.getOwnPropertyDescriptor(baseConstructor.prototype, name) || Object.create(null)
13
15
  )
14
16
  })
15
17
  })