@gradientedge/cdk-utils 8.101.0 → 8.103.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/README.md CHANGED
@@ -62,7 +62,7 @@ pnpm add @gradientedge/cdk-utils
62
62
  [aws-cdk]: https://docs.aws.amazon.com/cdk/latest/guide/home.html
63
63
  [aws-cli-badge]: https://img.shields.io/badge/aws--cli-2.3.4-777BB4?logo=amazon-aws
64
64
  [aws-cli-url]: https://aws.amazon.com/cli/
65
- [builds]: https://img.shields.io/github/workflow/status/gradientedge/cdk-utils/CI-Pipeline/main
65
+ [builds]: https://img.shields.io/github/actions/workflow/status/gradientedge/cdk-utils/ci.yml?branch=main
66
66
  [builds-url]: https://github.com/gradientedge/cdk-utils/actions
67
67
  [cdk-badge]: https://img.shields.io/github/package-json/dependency-version/gradientedge/cdk-utils/aws-cdk-lib
68
68
  [cdk-url]: https://aws.amazon.com/cdk/
@@ -0,0 +1,2 @@
1
+ export * from './main';
2
+ export * from './types';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./main"), exports);
18
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,24 @@
1
+ import { Construct } from 'constructs';
2
+ import * as appconfig from 'aws-cdk-lib/aws-appconfig';
3
+ import { ApplicationConfigurationProps } from './types';
4
+ import { CommonConstruct } from '../../common';
5
+ export declare class ApplicationConfiguration extends CommonConstruct {
6
+ props: ApplicationConfigurationProps;
7
+ id: string;
8
+ appConfigApplication: appconfig.CfnApplication;
9
+ appConfigEnvironment: appconfig.CfnEnvironment;
10
+ appConfigProfile: appconfig.CfnConfigurationProfile;
11
+ appConfigVersion: appconfig.CfnHostedConfigurationVersion;
12
+ appConfigDeploymentStrategy: appconfig.CfnDeploymentStrategy;
13
+ constructor(parent: Construct, id: string, props: ApplicationConfigurationProps);
14
+ initResources(): void;
15
+ protected createConfiguration(): void;
16
+ protected createAppConfigApplication(): void;
17
+ protected createAppConfigEnvironment(): void;
18
+ protected createAppConfigProfile(): void;
19
+ protected createAppConfigVersion(): void;
20
+ protected createAppConfigDeploymentStrategy(): void;
21
+ protected createAppConfigDeployment(): void;
22
+ resolveEnvironmentVariables(): any;
23
+ protected aaa(): void;
24
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ApplicationConfiguration = void 0;
27
+ const cdk = __importStar(require("aws-cdk-lib"));
28
+ const appconfig = __importStar(require("aws-cdk-lib/aws-appconfig"));
29
+ const common_1 = require("../../common");
30
+ class ApplicationConfiguration extends common_1.CommonConstruct {
31
+ props;
32
+ id;
33
+ appConfigApplication;
34
+ appConfigEnvironment;
35
+ appConfigProfile;
36
+ appConfigVersion;
37
+ appConfigDeploymentStrategy;
38
+ constructor(parent, id, props) {
39
+ super(parent, id, props);
40
+ this.props = props;
41
+ this.id = id;
42
+ }
43
+ initResources() {
44
+ this.createConfiguration();
45
+ this.resolveEnvironmentVariables();
46
+ }
47
+ createConfiguration() {
48
+ this.createAppConfigApplication();
49
+ this.createAppConfigEnvironment();
50
+ this.createAppConfigProfile();
51
+ this.createAppConfigVersion();
52
+ this.createAppConfigDeploymentStrategy();
53
+ this.createAppConfigDeployment();
54
+ }
55
+ createAppConfigApplication() {
56
+ this.appConfigApplication = this.appConfigManager.createApplication(`${this.id}-ac-application`, this, this.props.appConfig);
57
+ }
58
+ createAppConfigEnvironment() {
59
+ this.appConfigEnvironment = this.appConfigManager.createEnvironment(`${this.id}-ac-environment`, this, cdk.Fn.ref(this.appConfigApplication.logicalId), this.props.appConfig);
60
+ }
61
+ createAppConfigProfile() {
62
+ this.appConfigProfile = this.appConfigManager.createConfigurationProfile(`${this.id}-ac-profile`, this, cdk.Fn.ref(this.appConfigApplication.logicalId), this.props.appConfig);
63
+ }
64
+ createAppConfigVersion() {
65
+ this.appConfigVersion = new appconfig.CfnHostedConfigurationVersion(this, `${this.id}-ac-configuration`, {
66
+ applicationId: cdk.Fn.ref(this.appConfigApplication.logicalId),
67
+ configurationProfileId: cdk.Fn.ref(this.appConfigProfile.logicalId),
68
+ content: JSON.stringify(this.props.appConfigContent),
69
+ contentType: 'application/json',
70
+ });
71
+ }
72
+ createAppConfigDeploymentStrategy() {
73
+ this.appConfigDeploymentStrategy = new appconfig.CfnDeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
74
+ deploymentDurationInMinutes: this.props.appConfig.deploymentStrategy.deploymentDurationInMinutes,
75
+ growthFactor: this.props.appConfig.deploymentStrategy.growthFactor,
76
+ name: this.props.appConfig.deploymentStrategy.name,
77
+ replicateTo: this.props.appConfig.deploymentStrategy.replicateTo,
78
+ });
79
+ }
80
+ createAppConfigDeployment() {
81
+ new appconfig.CfnDeployment(this, `${this.id}-app-config-deployment`, {
82
+ applicationId: cdk.Fn.ref(this.appConfigApplication.logicalId),
83
+ configurationProfileId: cdk.Fn.ref(this.appConfigProfile.logicalId),
84
+ configurationVersion: cdk.Fn.ref(this.appConfigVersion.logicalId),
85
+ deploymentStrategyId: cdk.Fn.ref(this.appConfigDeploymentStrategy.logicalId),
86
+ environmentId: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
87
+ });
88
+ }
89
+ resolveEnvironmentVariables() {
90
+ return {
91
+ APP_CONFIG_APPLICATION_ID: cdk.Fn.ref(this.appConfigApplication.logicalId),
92
+ APP_CONFIG_CONFIGURATION_PROFILE_ID: cdk.Fn.ref(this.appConfigProfile.logicalId),
93
+ APP_CONFIG_ENVIRONMENT_ID: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
94
+ };
95
+ }
96
+ aaa() { }
97
+ }
98
+ exports.ApplicationConfiguration = ApplicationConfiguration;
@@ -0,0 +1,6 @@
1
+ import { CommonStackProps } from '../../common';
2
+ import { AppConfigProps } from '../../services';
3
+ export interface ApplicationConfigurationProps extends CommonStackProps {
4
+ appConfig: AppConfigProps;
5
+ appConfigContent: any;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,7 @@
1
1
  export * from './api-to-eventbridge-target';
2
2
  export * from './api-to-eventbridge-target-with-sns';
3
3
  export * from './api-to-lambda-target';
4
+ export * from './application-configuration';
4
5
  export * from './graphql-api-lambda';
5
6
  export * from './graphql-api-lambda-with-cache';
6
7
  export * from './lambda-with-iam-access';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api-to-eventbridge-target"), exports);
18
18
  __exportStar(require("./api-to-eventbridge-target-with-sns"), exports);
19
19
  __exportStar(require("./api-to-lambda-target"), exports);
20
+ __exportStar(require("./application-configuration"), exports);
20
21
  __exportStar(require("./graphql-api-lambda"), exports);
21
22
  __exportStar(require("./graphql-api-lambda-with-cache"), exports);
22
23
  __exportStar(require("./lambda-with-iam-access"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.101.0",
3
+ "version": "8.103.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,15 +46,15 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@aws-sdk/client-secrets-manager": "^3.357.0",
50
- "@aws-sdk/credential-providers": "^3.357.0",
49
+ "@aws-sdk/client-secrets-manager": "^3.360.0",
50
+ "@aws-sdk/credential-providers": "^3.360.0",
51
51
  "@aws-sdk/types": "^3.357.0",
52
52
  "@types/lodash": "^4.14.195",
53
- "@types/node": "^20.3.1",
53
+ "@types/node": "^20.3.2",
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.56",
57
+ "constructs": "^10.2.60",
58
58
  "lodash": "^4.17.21",
59
59
  "moment": "^2.29.4",
60
60
  "nconf": "^0.12.0",
@@ -67,8 +67,8 @@
67
67
  "@babel/eslint-parser": "^7.22.5",
68
68
  "@babel/plugin-proposal-class-properties": "^7.18.6",
69
69
  "@types/jest": "^29.5.2",
70
- "@typescript-eslint/eslint-plugin": "^5.60.0",
71
- "@typescript-eslint/parser": "^5.60.0",
70
+ "@typescript-eslint/eslint-plugin": "^5.60.1",
71
+ "@typescript-eslint/parser": "^5.60.1",
72
72
  "aws-cdk": "^2.85.0",
73
73
  "better-docs": "^2.7.2",
74
74
  "codecov": "^3.8.3",
@@ -78,7 +78,7 @@
78
78
  "eslint": "^8.43.0",
79
79
  "eslint-config-prettier": "^8.8.0",
80
80
  "eslint-plugin-import": "^2.27.5",
81
- "eslint-plugin-jsdoc": "^46.2.6",
81
+ "eslint-plugin-jsdoc": "^46.3.0",
82
82
  "husky": "^8.0.3",
83
83
  "jest": "^29.5.0",
84
84
  "jest-extended": "^4.0.0",
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,99 @@
1
+ import { Construct } from 'constructs'
2
+ import * as cdk from 'aws-cdk-lib'
3
+ import * as appconfig from 'aws-cdk-lib/aws-appconfig'
4
+ import { ApplicationConfigurationProps } from './types'
5
+ import { CommonConstruct } from '../../common'
6
+
7
+ export class ApplicationConfiguration extends CommonConstruct {
8
+ props: ApplicationConfigurationProps
9
+ id: string
10
+ appConfigApplication: appconfig.CfnApplication
11
+ appConfigEnvironment: appconfig.CfnEnvironment
12
+ appConfigProfile: appconfig.CfnConfigurationProfile
13
+ appConfigVersion: appconfig.CfnHostedConfigurationVersion
14
+ appConfigDeploymentStrategy: appconfig.CfnDeploymentStrategy
15
+
16
+ constructor(parent: Construct, id: string, props: ApplicationConfigurationProps) {
17
+ super(parent, id, props)
18
+ this.props = props
19
+ this.id = id
20
+ }
21
+
22
+ initResources() {
23
+ this.createConfiguration()
24
+ this.resolveEnvironmentVariables()
25
+ }
26
+
27
+ protected createConfiguration() {
28
+ this.createAppConfigApplication()
29
+ this.createAppConfigEnvironment()
30
+ this.createAppConfigProfile()
31
+ this.createAppConfigVersion()
32
+ this.createAppConfigDeploymentStrategy()
33
+ this.createAppConfigDeployment()
34
+ }
35
+
36
+ protected createAppConfigApplication() {
37
+ this.appConfigApplication = this.appConfigManager.createApplication(
38
+ `${this.id}-ac-application`,
39
+ this,
40
+ this.props.appConfig
41
+ )
42
+ }
43
+
44
+ protected createAppConfigEnvironment() {
45
+ this.appConfigEnvironment = this.appConfigManager.createEnvironment(
46
+ `${this.id}-ac-environment`,
47
+ this,
48
+ cdk.Fn.ref(this.appConfigApplication.logicalId),
49
+ this.props.appConfig
50
+ )
51
+ }
52
+
53
+ protected createAppConfigProfile() {
54
+ this.appConfigProfile = this.appConfigManager.createConfigurationProfile(
55
+ `${this.id}-ac-profile`,
56
+ this,
57
+ cdk.Fn.ref(this.appConfigApplication.logicalId),
58
+ this.props.appConfig
59
+ )
60
+ }
61
+
62
+ protected createAppConfigVersion() {
63
+ this.appConfigVersion = new appconfig.CfnHostedConfigurationVersion(this, `${this.id}-ac-configuration`, {
64
+ applicationId: cdk.Fn.ref(this.appConfigApplication.logicalId),
65
+ configurationProfileId: cdk.Fn.ref(this.appConfigProfile.logicalId),
66
+ content: JSON.stringify(this.props.appConfigContent),
67
+ contentType: 'application/json',
68
+ })
69
+ }
70
+
71
+ protected createAppConfigDeploymentStrategy() {
72
+ this.appConfigDeploymentStrategy = new appconfig.CfnDeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
73
+ deploymentDurationInMinutes: this.props.appConfig.deploymentStrategy.deploymentDurationInMinutes,
74
+ growthFactor: this.props.appConfig.deploymentStrategy.growthFactor,
75
+ name: this.props.appConfig.deploymentStrategy.name,
76
+ replicateTo: this.props.appConfig.deploymentStrategy.replicateTo,
77
+ })
78
+ }
79
+
80
+ protected createAppConfigDeployment() {
81
+ new appconfig.CfnDeployment(this, `${this.id}-app-config-deployment`, {
82
+ applicationId: cdk.Fn.ref(this.appConfigApplication.logicalId),
83
+ configurationProfileId: cdk.Fn.ref(this.appConfigProfile.logicalId),
84
+ configurationVersion: cdk.Fn.ref(this.appConfigVersion.logicalId),
85
+ deploymentStrategyId: cdk.Fn.ref(this.appConfigDeploymentStrategy.logicalId),
86
+ environmentId: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
87
+ })
88
+ }
89
+
90
+ public resolveEnvironmentVariables(): any {
91
+ return {
92
+ APP_CONFIG_APPLICATION_ID: cdk.Fn.ref(this.appConfigApplication.logicalId),
93
+ APP_CONFIG_CONFIGURATION_PROFILE_ID: cdk.Fn.ref(this.appConfigProfile.logicalId),
94
+ APP_CONFIG_ENVIRONMENT_ID: cdk.Fn.ref(this.appConfigEnvironment.logicalId),
95
+ }
96
+ }
97
+
98
+ protected aaa(): void {}
99
+ }
@@ -0,0 +1,7 @@
1
+ import { CommonStackProps } from '../../common'
2
+ import { AppConfigProps } from '../../services'
3
+
4
+ export interface ApplicationConfigurationProps extends CommonStackProps {
5
+ appConfig: AppConfigProps
6
+ appConfigContent: any
7
+ }
@@ -1,6 +1,7 @@
1
1
  export * from './api-to-eventbridge-target'
2
2
  export * from './api-to-eventbridge-target-with-sns'
3
3
  export * from './api-to-lambda-target'
4
+ export * from './application-configuration'
4
5
  export * from './graphql-api-lambda'
5
6
  export * from './graphql-api-lambda-with-cache'
6
7
  export * from './lambda-with-iam-access'