@gradientedge/cdk-utils 8.102.0 → 8.104.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/index.d.ts +2 -0
- package/dist/src/lib/construct/application-configuration/index.js +18 -0
- package/dist/src/lib/construct/application-configuration/main.d.ts +23 -0
- package/dist/src/lib/construct/application-configuration/main.js +97 -0
- package/dist/src/lib/construct/application-configuration/types.d.ts +6 -0
- package/dist/src/lib/construct/application-configuration/types.js +2 -0
- package/dist/src/lib/construct/index.d.ts +1 -0
- package/dist/src/lib/construct/index.js +1 -0
- package/dist/src/lib/services/aws/step-function/main.js +2 -1
- package/package.json +2 -2
- package/src/lib/construct/application-configuration/index.ts +2 -0
- package/src/lib/construct/application-configuration/main.ts +97 -0
- package/src/lib/construct/application-configuration/types.ts +7 -0
- package/src/lib/construct/index.ts +1 -0
- package/src/lib/services/aws/step-function/main.ts +2 -1
|
@@ -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,23 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
}
|
|
97
|
+
exports.ApplicationConfiguration = ApplicationConfiguration;
|
|
@@ -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);
|
|
@@ -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,
|
|
@@ -424,7 +425,7 @@ class SfnManager {
|
|
|
424
425
|
if (!props)
|
|
425
426
|
throw `State Machine props undefined for ${id}`;
|
|
426
427
|
const stateMachine = new sfn.StateMachine(scope, `${id}`, {
|
|
427
|
-
definition,
|
|
428
|
+
definitionBody: aws_stepfunctions_1.DefinitionBody.fromChainable(definition),
|
|
428
429
|
logs: {
|
|
429
430
|
destination: logGroup,
|
|
430
431
|
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.104.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",
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
}
|
|
@@ -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'
|
|
@@ -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
|
{
|
|
@@ -510,7 +511,7 @@ export class SfnManager {
|
|
|
510
511
|
) {
|
|
511
512
|
if (!props) throw `State Machine props undefined for ${id}`
|
|
512
513
|
const stateMachine = new sfn.StateMachine(scope, `${id}`, {
|
|
513
|
-
definition,
|
|
514
|
+
definitionBody: DefinitionBody.fromChainable(definition),
|
|
514
515
|
logs: {
|
|
515
516
|
destination: logGroup,
|
|
516
517
|
includeExecutionData: props.logs?.includeExecutionData ?? true,
|