@sylvesterllc/aws-constructs 1.1.11 → 1.1.13
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/.github/workflows/publish.yml +58 -38
- package/__tests__/app-config.test.ts +32 -32
- package/__tests__/data/testConfig.ts +146 -146
- package/__tests__/mocks/ResourceMock.ts +9 -9
- package/__tests__/router.test.ts +194 -194
- package/dist/config/AppConfig.js +1 -1
- package/dist/config/Constants.js +1 -1
- package/dist/config/Environments.js +1 -1
- package/dist/config/MicroserviceAppConfig.js +1 -1
- package/dist/config/ServiceBundleConfig.js +1 -1
- package/dist/config/bishopConfig.js +1 -1
- package/dist/config/customConfigs/ApiAppConfig.js +1 -1
- package/dist/config/customConfigs/GlobalAppConfig.js +1 -1
- package/dist/config/customConfigs/IAppConfig.js +1 -1
- package/dist/config/customConfigs/ResourceAppConfig.js +1 -1
- package/dist/config/microServiceConfig.js +1 -1
- package/dist/config/types/LogDuration.js +1 -1
- package/dist/config/types/TsgAuthorizerProp.js +1 -1
- package/dist/config/types/TsgAuthorizerType.js +1 -1
- package/dist/config/types/TsgCdkConfigType.js +1 -1
- package/dist/config/types/TsgCognitoConfig.js +1 -1
- package/dist/config/types/TsgDnsConfig.js +1 -1
- package/dist/config/types/TsgDynamoDbProp.js +1 -1
- package/dist/config/types/TsgDynamoIndex.js +1 -1
- package/dist/config/types/TsgDynamoProp.js +1 -1
- package/dist/config/types/TsgDynamoTable.js +1 -1
- package/dist/config/types/TsgDynamoTableRef.js +1 -1
- package/dist/config/types/TsgEc2Prop.js +1 -1
- package/dist/config/types/TsgKeyPair.js +1 -1
- package/dist/config/types/TsgLambda.js +1 -1
- package/dist/config/types/TsgLambdaLayerProp.js +1 -1
- package/dist/config/types/TsgLambdaMap.js +1 -1
- package/dist/config/types/TsgLambdaName.js +1 -1
- package/dist/config/types/TsgLambdaNode.js +1 -1
- package/dist/config/types/TsgLambdaProp.js +1 -1
- package/dist/config/types/TsgLambdaProps.js +1 -1
- package/dist/config/types/TsgLambdaRoutable.js +1 -1
- package/dist/config/types/index.js +1 -1
- package/dist/constants/aws-service-principal-constants.d.ts +3 -0
- package/dist/constants/aws-service-principal-constants.js +7 -0
- package/dist/constructs/DynamoDbSingleTable.js +1 -1
- package/dist/constructs/MicroService.js +1 -1
- package/dist/constructs/index.d.ts +1 -0
- package/dist/constructs/index.js +4 -2
- package/dist/constructs/timer-job.d.ts +6 -0
- package/dist/constructs/timer-job.js +15 -0
- package/dist/helpers/logger.js +1 -1
- package/dist/helpers/util-helper.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +18 -4
- package/dist/interfaces/ApiLambdaResult.js +1 -1
- package/dist/interfaces/BaseResourceProps.js +1 -1
- package/dist/interfaces/CreateLambdaFunctionInput.js +1 -1
- package/dist/interfaces/MicroserviceProps.js +1 -1
- package/dist/interfaces/timer-job/index.d.ts +1 -0
- package/dist/interfaces/timer-job/index.js +18 -0
- package/dist/interfaces/timer-job/timer-job-props.d.ts +14 -0
- package/dist/interfaces/timer-job/timer-job-props.js +3 -0
- package/dist/resources/base/baseResource.js +1 -1
- package/dist/resources/base/tsgBaseResource.js +1 -1
- package/dist/resources/certificate/createCertificate.js +1 -1
- package/dist/resources/cognito/createCognito.js +1 -1
- package/dist/resources/cognito/createCognitoProps.js +1 -1
- package/dist/resources/customResource/createSeedDatabaseCustomResource.js +1 -1
- package/dist/resources/dynamodb/CreateDynamo.js +1 -1
- package/dist/resources/dynamodb/CreateDynamoSingleTableDesign.js +1 -1
- package/dist/resources/ec2/create-ec2-instance.js +3 -3
- package/dist/resources/ecr/CreateEcr.js +2 -2
- package/dist/resources/gateway/CreateApiAndAttachLambdas.js +1 -1
- package/dist/resources/gateway/createApi.js +1 -1
- package/dist/resources/gateway/createApiKey.js +1 -1
- package/dist/resources/helpers/createCommonLayer.js +1 -1
- package/dist/resources/helpers/createRoutes.js +1 -1
- package/dist/resources/index.js +1 -1
- package/dist/resources/lambda/create-basic-lambda.d.ts +3 -0
- package/dist/resources/lambda/create-basic-lambda.js +77 -0
- package/dist/resources/lambda/createLambda.js +1 -1
- package/dist/resources/lambda/lambdaHelper.js +1 -1
- package/dist/resources/lambda-authorizer/TsgJwtTokenAuthorizer.js +1 -1
- package/dist/resources/lambda-authorizer/TsgRequestAuthorizer.js +1 -1
- package/dist/resources/lambda-authorizer/createAuthorizerHelpers.js +1 -1
- package/dist/resources/lambda-layer/createLambdaLayer.js +1 -1
- package/dist/resources/layers/common/src/nodejs/api-response/responses.js +1 -1
- package/dist/resources/layers/common/src/nodejs/index.js +1 -1
- package/dist/resources/layers/common/src/nodejs/logger/IContext.js +1 -1
- package/dist/resources/layers/common/src/nodejs/logger/index.js +1 -1
- package/dist/resources/layers/common/src/nodejs/logger/logger.js +1 -1
- package/dist/resources/resources/iam/policyDocuments/cognitoPolicy.js +1 -1
- package/dist/resources/resources/iam/roles/createRole.js +1 -1
- package/dist/resources/route53/CreateZone.js +1 -1
- package/dist/resources/route53/create-zones.js +1 -1
- package/dist/resources/securityManager/index.js +1 -1
- package/jest.config.js +8 -8
- package/jest.config.ts.old +20 -20
- package/package.json +55 -56
- package/readme.md +147 -147
- package/src/config/AppConfig.ts +106 -106
- package/src/config/Constants.ts +26 -26
- package/src/config/Environments.ts +1 -1
- package/src/config/MicroserviceAppConfig.ts +8 -8
- package/src/config/ServiceBundleConfig.ts +17 -17
- package/src/config/bishopConfig.ts +82 -82
- package/src/config/customConfigs/ApiAppConfig.ts +5 -5
- package/src/config/customConfigs/GlobalAppConfig.ts +10 -10
- package/src/config/customConfigs/IAppConfig.ts +12 -12
- package/src/config/customConfigs/ResourceAppConfig.ts +15 -15
- package/src/config/microServiceConfig.ts +83 -83
- package/src/config/types/LogDuration.ts +7 -7
- package/src/config/types/TsgAuthorizerProp.ts +8 -8
- package/src/config/types/TsgAuthorizerType.ts +4 -4
- package/src/config/types/TsgCdkConfigType.ts +2 -2
- package/src/config/types/TsgCognitoConfig.ts +5 -5
- package/src/config/types/TsgDnsConfig.ts +10 -10
- package/src/config/types/TsgDynamoDbProp.ts +9 -9
- package/src/config/types/TsgDynamoIndex.ts +15 -15
- package/src/config/types/TsgDynamoProp.ts +16 -16
- package/src/config/types/TsgDynamoTable.ts +4 -4
- package/src/config/types/TsgDynamoTableRef.ts +3 -3
- package/src/config/types/TsgEc2Prop.ts +8 -8
- package/src/config/types/TsgKeyPair.ts +5 -5
- package/src/config/types/TsgLambda.ts +5 -5
- package/src/config/types/TsgLambdaLayerProp.ts +4 -4
- package/src/config/types/TsgLambdaMap.ts +3 -3
- package/src/config/types/TsgLambdaName.ts +3 -3
- package/src/config/types/TsgLambdaNode.ts +3 -3
- package/src/config/types/TsgLambdaProp.ts +19 -19
- package/src/config/types/TsgLambdaProps.ts +17 -17
- package/src/config/types/TsgLambdaRoutable.ts +8 -8
- package/src/config/types/index.ts +11 -11
- package/src/constants/aws-service-principal-constants.ts +3 -0
- package/src/constructs/DynamoDbSingleTable.ts +12 -12
- package/src/constructs/MicroService.ts +131 -132
- package/src/constructs/index.ts +4 -3
- package/src/constructs/timer-job.ts +17 -0
- package/src/helpers/logger.ts +12 -12
- package/src/helpers/util-helper.ts +19 -19
- package/src/index.ts +6 -5
- package/src/interfaces/ApiLambdaResult.ts +6 -6
- package/src/interfaces/BaseResourceProps.ts +6 -6
- package/src/interfaces/CreateLambdaFunctionInput.ts +10 -10
- package/src/interfaces/MicroserviceProps.ts +10 -10
- package/src/interfaces/timer-job/index.ts +1 -0
- package/src/interfaces/timer-job/timer-job-props.ts +17 -0
- package/src/resources/base/baseResource.ts +14 -14
- package/src/resources/base/tsgBaseResource.ts +21 -21
- package/src/resources/certificate/createCertificate.ts +57 -57
- package/src/resources/cognito/createCognito.ts +47 -47
- package/src/resources/cognito/createCognitoProps.ts +46 -46
- package/src/resources/customResource/createSeedDatabaseCustomResource.ts +36 -36
- package/src/resources/dynamodb/CreateDynamo.ts +110 -110
- package/src/resources/dynamodb/CreateDynamoSingleTableDesign.ts +111 -111
- package/src/resources/ec2/create-ec2-instance.ts +52 -52
- package/src/resources/ecr/CreateEcr.ts +57 -57
- package/src/resources/gateway/CreateApiAndAttachLambdas.ts +161 -161
- package/src/resources/gateway/createApi.ts +173 -173
- package/src/resources/gateway/createApiKey.ts +88 -88
- package/src/resources/helpers/createCommonLayer.ts +18 -18
- package/src/resources/helpers/createRoutes.ts +74 -74
- package/src/resources/index.ts +1 -1
- package/src/resources/lambda/create-basic-lambda.ts +104 -0
- package/src/resources/lambda/createLambda.ts +203 -200
- package/src/resources/lambda/lambdaHelper.ts +133 -133
- package/src/resources/lambda-authorizer/TsgJwtTokenAuthorizer.ts +107 -107
- package/src/resources/lambda-authorizer/TsgRequestAuthorizer.ts +44 -44
- package/src/resources/lambda-authorizer/createAuthorizerHelpers.ts +76 -76
- package/src/resources/lambda-layer/createLambdaLayer.ts +39 -39
- package/src/resources/layers/common/package.json +22 -22
- package/src/resources/layers/common/src/nodejs/api-response/responses.ts +41 -41
- package/src/resources/layers/common/src/nodejs/index.ts +3 -3
- package/src/resources/layers/common/src/nodejs/logger/IContext.ts +6 -6
- package/src/resources/layers/common/src/nodejs/logger/index.ts +1 -1
- package/src/resources/layers/common/src/nodejs/logger/logger.ts +10 -10
- package/src/resources/layers/common/tsconfig.json +7 -7
- package/src/resources/resources/iam/policyDocuments/cognitoPolicy.ts +54 -54
- package/src/resources/resources/iam/roles/createRole.ts +29 -29
- package/src/resources/route53/CreateZone.ts +61 -61
- package/src/resources/route53/create-zones.ts +40 -40
- package/src/resources/securityManager/index.ts +23 -23
- package/tsconfig.json +44 -42
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { AttributeType, BillingMode, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
-
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
3
|
-
import { CONSTANTS } from "./Constants";
|
|
4
|
-
import { IAppConfig } from "./customConfigs/IAppConfig";
|
|
5
|
-
|
|
6
|
-
export const config: IAppConfig = {
|
|
7
|
-
GLOBALS: {
|
|
8
|
-
name: `${process.env.APP_NAME}`,
|
|
9
|
-
accountNumber: process.env.CDK_DEFAULT_ACCOUNT || "",
|
|
10
|
-
region: process.env.CDK_DEFAULT_REGION || "us-east-1",
|
|
11
|
-
stackRuntime: Runtime.NODEJS_18_X,
|
|
12
|
-
},
|
|
13
|
-
API: {
|
|
14
|
-
Name: `${process.env.APP_NAME}-auth-api`,
|
|
15
|
-
Description: 'This is my new API',
|
|
16
|
-
DomainPrefix: 'my-custom-api'
|
|
17
|
-
},
|
|
18
|
-
RESOURCES: {
|
|
19
|
-
LAMBDA: [
|
|
20
|
-
{
|
|
21
|
-
name: `create-account`,
|
|
22
|
-
codePath: './lambda-functions/auth/createAccount.ts',
|
|
23
|
-
handler: 'main',
|
|
24
|
-
apiGateway: {
|
|
25
|
-
route: '/account/create-account',
|
|
26
|
-
method: 'post',
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: `change-password`,
|
|
32
|
-
codePath: './lambda-functions/auth/changePassword.ts',
|
|
33
|
-
handler: 'main',
|
|
34
|
-
apiGateway: {
|
|
35
|
-
route: '/account/change-password',
|
|
36
|
-
method: 'post',
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
DYNAMO: {
|
|
42
|
-
TABLES: [
|
|
43
|
-
{
|
|
44
|
-
tableName: `${CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.name}`,
|
|
45
|
-
primaryKey: {
|
|
46
|
-
name: 'id',
|
|
47
|
-
type: AttributeType.STRING,
|
|
48
|
-
},
|
|
49
|
-
billingMode: BillingMode.PAY_PER_REQUEST,
|
|
50
|
-
indexes: [
|
|
51
|
-
{
|
|
52
|
-
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.AuthHistoryTS.name,
|
|
53
|
-
partitionKey: {
|
|
54
|
-
name: 'createdTS',
|
|
55
|
-
type: AttributeType.NUMBER
|
|
56
|
-
},
|
|
57
|
-
projectionType: ProjectionType.ALL
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.Username.name,
|
|
61
|
-
partitionKey: {
|
|
62
|
-
name: 'username',
|
|
63
|
-
type: AttributeType.STRING
|
|
64
|
-
},
|
|
65
|
-
projectionType: ProjectionType.ALL
|
|
66
|
-
},
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
DNS: {
|
|
74
|
-
ZoneName: '',
|
|
75
|
-
ZoneId: '',
|
|
76
|
-
ZoneNameWithoutPeriod: 'not-used',
|
|
77
|
-
ZoneNameWithoutSuffix: 'not-used',
|
|
78
|
-
ZoneExist: true,
|
|
79
|
-
HostName: '',
|
|
80
|
-
FQDN: ''
|
|
81
|
-
|
|
82
|
-
}
|
|
1
|
+
import { AttributeType, BillingMode, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
3
|
+
import { CONSTANTS } from "./Constants";
|
|
4
|
+
import { IAppConfig } from "./customConfigs/IAppConfig";
|
|
5
|
+
|
|
6
|
+
export const config: IAppConfig = {
|
|
7
|
+
GLOBALS: {
|
|
8
|
+
name: `${process.env.APP_NAME}`,
|
|
9
|
+
accountNumber: process.env.CDK_DEFAULT_ACCOUNT || "",
|
|
10
|
+
region: process.env.CDK_DEFAULT_REGION || "us-east-1",
|
|
11
|
+
stackRuntime: Runtime.NODEJS_18_X,
|
|
12
|
+
},
|
|
13
|
+
API: {
|
|
14
|
+
Name: `${process.env.APP_NAME}-auth-api`,
|
|
15
|
+
Description: 'This is my new API',
|
|
16
|
+
DomainPrefix: 'my-custom-api'
|
|
17
|
+
},
|
|
18
|
+
RESOURCES: {
|
|
19
|
+
LAMBDA: [
|
|
20
|
+
{
|
|
21
|
+
name: `create-account`,
|
|
22
|
+
codePath: './lambda-functions/auth/createAccount.ts',
|
|
23
|
+
handler: 'main',
|
|
24
|
+
apiGateway: {
|
|
25
|
+
route: '/account/create-account',
|
|
26
|
+
method: 'post',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: `change-password`,
|
|
32
|
+
codePath: './lambda-functions/auth/changePassword.ts',
|
|
33
|
+
handler: 'main',
|
|
34
|
+
apiGateway: {
|
|
35
|
+
route: '/account/change-password',
|
|
36
|
+
method: 'post',
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
DYNAMO: {
|
|
42
|
+
TABLES: [
|
|
43
|
+
{
|
|
44
|
+
tableName: `${CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.name}`,
|
|
45
|
+
primaryKey: {
|
|
46
|
+
name: 'id',
|
|
47
|
+
type: AttributeType.STRING,
|
|
48
|
+
},
|
|
49
|
+
billingMode: BillingMode.PAY_PER_REQUEST,
|
|
50
|
+
indexes: [
|
|
51
|
+
{
|
|
52
|
+
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.AuthHistoryTS.name,
|
|
53
|
+
partitionKey: {
|
|
54
|
+
name: 'createdTS',
|
|
55
|
+
type: AttributeType.NUMBER
|
|
56
|
+
},
|
|
57
|
+
projectionType: ProjectionType.ALL
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.Username.name,
|
|
61
|
+
partitionKey: {
|
|
62
|
+
name: 'username',
|
|
63
|
+
type: AttributeType.STRING
|
|
64
|
+
},
|
|
65
|
+
projectionType: ProjectionType.ALL
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
DNS: {
|
|
74
|
+
ZoneName: '',
|
|
75
|
+
ZoneId: '',
|
|
76
|
+
ZoneNameWithoutPeriod: 'not-used',
|
|
77
|
+
ZoneNameWithoutSuffix: 'not-used',
|
|
78
|
+
ZoneExist: true,
|
|
79
|
+
HostName: '',
|
|
80
|
+
FQDN: ''
|
|
81
|
+
|
|
82
|
+
}
|
|
83
83
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface ApiAppConfig {
|
|
2
|
-
|
|
3
|
-
Name: string;
|
|
4
|
-
Description: string;
|
|
5
|
-
DomainPrefix?: string;
|
|
1
|
+
export interface ApiAppConfig {
|
|
2
|
+
|
|
3
|
+
Name: string;
|
|
4
|
+
Description: string;
|
|
5
|
+
DomainPrefix?: string;
|
|
6
6
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
2
|
-
import { Environment } from "../Environments";
|
|
3
|
-
export interface GlobalAppConfig {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
accountNumber: string;
|
|
8
|
-
region: string;
|
|
9
|
-
stackRuntime: Runtime;
|
|
10
|
-
prefix?: string;
|
|
1
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { Environment } from "../Environments";
|
|
3
|
+
export interface GlobalAppConfig {
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
name: string;
|
|
7
|
+
accountNumber: string;
|
|
8
|
+
region: string;
|
|
9
|
+
stackRuntime: Runtime;
|
|
10
|
+
prefix?: string;
|
|
11
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Environment } from "../Environments";
|
|
2
|
-
import { TsgDnsAppConfig } from "../types/TsgDnsConfig";
|
|
3
|
-
import { ApiAppConfig } from "./ApiAppConfig";
|
|
4
|
-
import { GlobalAppConfig } from "./GlobalAppConfig";
|
|
5
|
-
import { ResourceAppConfig } from "./ResourceAppConfig";
|
|
6
|
-
|
|
7
|
-
export interface IAppConfig {
|
|
8
|
-
|
|
9
|
-
GLOBALS: GlobalAppConfig;
|
|
10
|
-
API?: ApiAppConfig;
|
|
11
|
-
RESOURCES: ResourceAppConfig;
|
|
12
|
-
DNS?: TsgDnsAppConfig;
|
|
1
|
+
import { Environment } from "../Environments";
|
|
2
|
+
import { TsgDnsAppConfig } from "../types/TsgDnsConfig";
|
|
3
|
+
import { ApiAppConfig } from "./ApiAppConfig";
|
|
4
|
+
import { GlobalAppConfig } from "./GlobalAppConfig";
|
|
5
|
+
import { ResourceAppConfig } from "./ResourceAppConfig";
|
|
6
|
+
|
|
7
|
+
export interface IAppConfig {
|
|
8
|
+
|
|
9
|
+
GLOBALS: GlobalAppConfig;
|
|
10
|
+
API?: ApiAppConfig;
|
|
11
|
+
RESOURCES: ResourceAppConfig;
|
|
12
|
+
DNS?: TsgDnsAppConfig;
|
|
13
13
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TsgDynamoDbProp,
|
|
3
|
-
TsgLambdaProp,
|
|
4
|
-
} from "../types";
|
|
5
|
-
import { TsgAuthorizerProp } from "../types/TsgAuthorizerProp";
|
|
6
|
-
import { TsgEC2Prop } from "../types/TsgEc2Prop";
|
|
7
|
-
import { TsgLambdaLayerProp } from "../types/TsgLambdaLayerProp";
|
|
8
|
-
|
|
9
|
-
export interface ResourceAppConfig {
|
|
10
|
-
DYNAMO?: TsgDynamoDbProp;
|
|
11
|
-
LAMBDA_LAYERS?: TsgLambdaLayerProp[];
|
|
12
|
-
AUTHORIZER?: TsgAuthorizerProp;
|
|
13
|
-
LAMBDA: TsgLambdaProp[];
|
|
14
|
-
EC2?: TsgEC2Prop[];
|
|
15
|
-
|
|
1
|
+
import {
|
|
2
|
+
TsgDynamoDbProp,
|
|
3
|
+
TsgLambdaProp,
|
|
4
|
+
} from "../types";
|
|
5
|
+
import { TsgAuthorizerProp } from "../types/TsgAuthorizerProp";
|
|
6
|
+
import { TsgEC2Prop } from "../types/TsgEc2Prop";
|
|
7
|
+
import { TsgLambdaLayerProp } from "../types/TsgLambdaLayerProp";
|
|
8
|
+
|
|
9
|
+
export interface ResourceAppConfig {
|
|
10
|
+
DYNAMO?: TsgDynamoDbProp;
|
|
11
|
+
LAMBDA_LAYERS?: TsgLambdaLayerProp[];
|
|
12
|
+
AUTHORIZER?: TsgAuthorizerProp;
|
|
13
|
+
LAMBDA: TsgLambdaProp[];
|
|
14
|
+
EC2?: TsgEC2Prop[];
|
|
15
|
+
|
|
16
16
|
}
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { AttributeType, BillingMode, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
-
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
3
|
-
import { CONSTANTS } from "./Constants";
|
|
4
|
-
import { IAppConfig } from "./customConfigs/IAppConfig";
|
|
5
|
-
|
|
6
|
-
export const config: IAppConfig = {
|
|
7
|
-
GLOBALS: {
|
|
8
|
-
name: `${process.env.APP_NAME}`,
|
|
9
|
-
accountNumber: process.env.CDK_DEFAULT_ACCOUNT || "",
|
|
10
|
-
region: process.env.CDK_DEFAULT_REGION || "us-east-1",
|
|
11
|
-
stackRuntime: Runtime.NODEJS_22_X,
|
|
12
|
-
},
|
|
13
|
-
API: {
|
|
14
|
-
Name: `${process.env.APP_NAME}-auth-api`,
|
|
15
|
-
Description: 'This is my new API',
|
|
16
|
-
DomainPrefix: 'my-custom-api'
|
|
17
|
-
},
|
|
18
|
-
RESOURCES: {
|
|
19
|
-
LAMBDA: [
|
|
20
|
-
{
|
|
21
|
-
name: `create-account`,
|
|
22
|
-
codePath: './lambda-functions/auth/createAccount.ts',
|
|
23
|
-
handler: 'main',
|
|
24
|
-
apiGateway: {
|
|
25
|
-
route: '/account/create-account',
|
|
26
|
-
method: 'post',
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: `change-password`,
|
|
32
|
-
codePath: './lambda-functions/auth/changePassword.ts',
|
|
33
|
-
handler: 'main',
|
|
34
|
-
apiGateway: {
|
|
35
|
-
route: '/account/change-password',
|
|
36
|
-
method: 'post',
|
|
37
|
-
version: 2
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
DYNAMO: {
|
|
43
|
-
TABLES: [
|
|
44
|
-
{
|
|
45
|
-
tableName: `${CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.name}`,
|
|
46
|
-
primaryKey: {
|
|
47
|
-
name: 'id',
|
|
48
|
-
type: AttributeType.STRING,
|
|
49
|
-
},
|
|
50
|
-
billingMode: BillingMode.PAY_PER_REQUEST,
|
|
51
|
-
indexes: [
|
|
52
|
-
{
|
|
53
|
-
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.AuthHistoryTS.name,
|
|
54
|
-
partitionKey: {
|
|
55
|
-
name: 'createdTS',
|
|
56
|
-
type: AttributeType.NUMBER
|
|
57
|
-
},
|
|
58
|
-
projectionType: ProjectionType.ALL
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.Username.name,
|
|
62
|
-
partitionKey: {
|
|
63
|
-
name: 'username',
|
|
64
|
-
type: AttributeType.STRING
|
|
65
|
-
},
|
|
66
|
-
projectionType: ProjectionType.ALL
|
|
67
|
-
},
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
DNS: {
|
|
75
|
-
ZoneName: '',
|
|
76
|
-
ZoneId: '',
|
|
77
|
-
ZoneNameWithoutPeriod: 'not-used',
|
|
78
|
-
ZoneNameWithoutSuffix: 'not-used',
|
|
79
|
-
ZoneExist: true,
|
|
80
|
-
HostName: '',
|
|
81
|
-
FQDN: ''
|
|
82
|
-
|
|
83
|
-
}
|
|
1
|
+
import { AttributeType, BillingMode, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
3
|
+
import { CONSTANTS } from "./Constants";
|
|
4
|
+
import { IAppConfig } from "./customConfigs/IAppConfig";
|
|
5
|
+
|
|
6
|
+
export const config: IAppConfig = {
|
|
7
|
+
GLOBALS: {
|
|
8
|
+
name: `${process.env.APP_NAME}`,
|
|
9
|
+
accountNumber: process.env.CDK_DEFAULT_ACCOUNT || "",
|
|
10
|
+
region: process.env.CDK_DEFAULT_REGION || "us-east-1",
|
|
11
|
+
stackRuntime: Runtime.NODEJS_22_X,
|
|
12
|
+
},
|
|
13
|
+
API: {
|
|
14
|
+
Name: `${process.env.APP_NAME}-auth-api`,
|
|
15
|
+
Description: 'This is my new API',
|
|
16
|
+
DomainPrefix: 'my-custom-api'
|
|
17
|
+
},
|
|
18
|
+
RESOURCES: {
|
|
19
|
+
LAMBDA: [
|
|
20
|
+
{
|
|
21
|
+
name: `create-account`,
|
|
22
|
+
codePath: './lambda-functions/auth/createAccount.ts',
|
|
23
|
+
handler: 'main',
|
|
24
|
+
apiGateway: {
|
|
25
|
+
route: '/account/create-account',
|
|
26
|
+
method: 'post',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: `change-password`,
|
|
32
|
+
codePath: './lambda-functions/auth/changePassword.ts',
|
|
33
|
+
handler: 'main',
|
|
34
|
+
apiGateway: {
|
|
35
|
+
route: '/account/change-password',
|
|
36
|
+
method: 'post',
|
|
37
|
+
version: 2
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
DYNAMO: {
|
|
43
|
+
TABLES: [
|
|
44
|
+
{
|
|
45
|
+
tableName: `${CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.name}`,
|
|
46
|
+
primaryKey: {
|
|
47
|
+
name: 'id',
|
|
48
|
+
type: AttributeType.STRING,
|
|
49
|
+
},
|
|
50
|
+
billingMode: BillingMode.PAY_PER_REQUEST,
|
|
51
|
+
indexes: [
|
|
52
|
+
{
|
|
53
|
+
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.AuthHistoryTS.name,
|
|
54
|
+
partitionKey: {
|
|
55
|
+
name: 'createdTS',
|
|
56
|
+
type: AttributeType.NUMBER
|
|
57
|
+
},
|
|
58
|
+
projectionType: ProjectionType.ALL
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
indexName: CONSTANTS.DYNAMODB.TABLES.AUTH_HISTORY_TABLE.indexes.Username.name,
|
|
62
|
+
partitionKey: {
|
|
63
|
+
name: 'username',
|
|
64
|
+
type: AttributeType.STRING
|
|
65
|
+
},
|
|
66
|
+
projectionType: ProjectionType.ALL
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
},
|
|
74
|
+
DNS: {
|
|
75
|
+
ZoneName: '',
|
|
76
|
+
ZoneId: '',
|
|
77
|
+
ZoneNameWithoutPeriod: 'not-used',
|
|
78
|
+
ZoneNameWithoutSuffix: 'not-used',
|
|
79
|
+
ZoneExist: true,
|
|
80
|
+
HostName: '',
|
|
81
|
+
FQDN: ''
|
|
82
|
+
|
|
83
|
+
}
|
|
84
84
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export enum LogDuration {
|
|
2
|
-
ONE_DAY = 1,
|
|
3
|
-
ONE_WEEK = 7,
|
|
4
|
-
ONE_MONTH = 30,
|
|
5
|
-
ONE_YEAR = 365,
|
|
6
|
-
FIVE_YEARS = 1825,
|
|
7
|
-
FOREVER = 0
|
|
1
|
+
export enum LogDuration {
|
|
2
|
+
ONE_DAY = 1,
|
|
3
|
+
ONE_WEEK = 7,
|
|
4
|
+
ONE_MONTH = 30,
|
|
5
|
+
ONE_YEAR = 365,
|
|
6
|
+
FIVE_YEARS = 1825,
|
|
7
|
+
FOREVER = 0
|
|
8
8
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TsgAuthorizerType } from "./TsgAuthorizerType";
|
|
2
|
-
import { TsgLambdaProp } from "./TsgLambdaProp";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface TsgAuthorizerProp extends TsgLambdaProp {
|
|
6
|
-
|
|
7
|
-
type: TsgAuthorizerType;
|
|
8
|
-
headerName?: string;
|
|
1
|
+
import { TsgAuthorizerType } from "./TsgAuthorizerType";
|
|
2
|
+
import { TsgLambdaProp } from "./TsgLambdaProp";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface TsgAuthorizerProp extends TsgLambdaProp {
|
|
6
|
+
|
|
7
|
+
type: TsgAuthorizerType;
|
|
8
|
+
headerName?: string;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export enum TsgAuthorizerType {
|
|
2
|
-
|
|
3
|
-
REQUEST_AUTHORIZER = 1000,
|
|
4
|
-
TOKEN_AUTHORIZER = 2000,
|
|
1
|
+
export enum TsgAuthorizerType {
|
|
2
|
+
|
|
3
|
+
REQUEST_AUTHORIZER = 1000,
|
|
4
|
+
TOKEN_AUTHORIZER = 2000,
|
|
5
5
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type TsgCdkConfigType<T> = {
|
|
2
|
-
[name: string]: T;
|
|
1
|
+
export type TsgCdkConfigType<T> = {
|
|
2
|
+
[name: string]: T;
|
|
3
3
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface TsgCognitoConfig {
|
|
2
|
-
|
|
3
|
-
USER_POOL_ID: string;
|
|
4
|
-
CLIENT_ID: string;
|
|
5
|
-
POOL_ARN: string;
|
|
1
|
+
export interface TsgCognitoConfig {
|
|
2
|
+
|
|
3
|
+
USER_POOL_ID: string;
|
|
4
|
+
CLIENT_ID: string;
|
|
5
|
+
POOL_ARN: string;
|
|
6
6
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export interface TsgDnsAppConfig {
|
|
2
|
-
ZoneName: string;
|
|
3
|
-
ZoneNameWithoutSuffix: string;
|
|
4
|
-
ZoneNameWithoutPeriod: string;
|
|
5
|
-
HostName: string;
|
|
6
|
-
FQDN: string;
|
|
7
|
-
ZoneExist: boolean;
|
|
8
|
-
ZoneId?: string;
|
|
9
|
-
SubDomainName?: string;
|
|
10
|
-
SubDomainNameForApi?: string;
|
|
1
|
+
export interface TsgDnsAppConfig {
|
|
2
|
+
ZoneName: string;
|
|
3
|
+
ZoneNameWithoutSuffix: string;
|
|
4
|
+
ZoneNameWithoutPeriod: string;
|
|
5
|
+
HostName: string;
|
|
6
|
+
FQDN: string;
|
|
7
|
+
ZoneExist: boolean;
|
|
8
|
+
ZoneId?: string;
|
|
9
|
+
SubDomainName?: string;
|
|
10
|
+
SubDomainNameForApi?: string;
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TsgDynamoProp } from "./TsgDynamoProp";
|
|
2
|
-
import { TsgDynamoTableRef } from "./TsgDynamoTableRef";
|
|
3
|
-
import { TsgLambdaProp } from "./TsgLambdaProp";
|
|
4
|
-
|
|
5
|
-
export interface TsgDynamoDbProp {
|
|
6
|
-
TABLE_REFS?: TsgDynamoTableRef[];
|
|
7
|
-
TABLES?: TsgDynamoProp[];
|
|
8
|
-
USE_SEED_DATABASE?: boolean;
|
|
9
|
-
SEED_LAMBDA?: TsgLambdaProp;
|
|
1
|
+
import { TsgDynamoProp } from "./TsgDynamoProp";
|
|
2
|
+
import { TsgDynamoTableRef } from "./TsgDynamoTableRef";
|
|
3
|
+
import { TsgLambdaProp } from "./TsgLambdaProp";
|
|
4
|
+
|
|
5
|
+
export interface TsgDynamoDbProp {
|
|
6
|
+
TABLE_REFS?: TsgDynamoTableRef[];
|
|
7
|
+
TABLES?: TsgDynamoProp[];
|
|
8
|
+
USE_SEED_DATABASE?: boolean;
|
|
9
|
+
SEED_LAMBDA?: TsgLambdaProp;
|
|
10
10
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AttributeType, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
-
|
|
3
|
-
export interface TsgDynamoIndex {
|
|
4
|
-
|
|
5
|
-
indexName: string;
|
|
6
|
-
partitionKey: {
|
|
7
|
-
name: string;
|
|
8
|
-
type: AttributeType
|
|
9
|
-
},
|
|
10
|
-
sortKey?: {
|
|
11
|
-
name: string;
|
|
12
|
-
type: AttributeType
|
|
13
|
-
}
|
|
14
|
-
projectionType: ProjectionType;
|
|
15
|
-
|
|
1
|
+
import { AttributeType, ProjectionType } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
+
|
|
3
|
+
export interface TsgDynamoIndex {
|
|
4
|
+
|
|
5
|
+
indexName: string;
|
|
6
|
+
partitionKey: {
|
|
7
|
+
name: string;
|
|
8
|
+
type: AttributeType
|
|
9
|
+
},
|
|
10
|
+
sortKey?: {
|
|
11
|
+
name: string;
|
|
12
|
+
type: AttributeType
|
|
13
|
+
}
|
|
14
|
+
projectionType: ProjectionType;
|
|
15
|
+
|
|
16
16
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AttributeType, BillingMode } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
-
import { TsgDynamoIndex } from "./TsgDynamoIndex";
|
|
3
|
-
|
|
4
|
-
export interface TsgDynamoProp {
|
|
5
|
-
|
|
6
|
-
tableName: string;
|
|
7
|
-
primaryKey: {
|
|
8
|
-
name: string;
|
|
9
|
-
type: AttributeType;
|
|
10
|
-
},
|
|
11
|
-
sortKey?: {
|
|
12
|
-
name: string;
|
|
13
|
-
type: AttributeType;
|
|
14
|
-
},
|
|
15
|
-
billingMode: BillingMode;
|
|
16
|
-
indexes: TsgDynamoIndex[],
|
|
1
|
+
import { AttributeType, BillingMode } from "aws-cdk-lib/aws-dynamodb";
|
|
2
|
+
import { TsgDynamoIndex } from "./TsgDynamoIndex";
|
|
3
|
+
|
|
4
|
+
export interface TsgDynamoProp {
|
|
5
|
+
|
|
6
|
+
tableName: string;
|
|
7
|
+
primaryKey: {
|
|
8
|
+
name: string;
|
|
9
|
+
type: AttributeType;
|
|
10
|
+
},
|
|
11
|
+
sortKey?: {
|
|
12
|
+
name: string;
|
|
13
|
+
type: AttributeType;
|
|
14
|
+
},
|
|
15
|
+
billingMode: BillingMode;
|
|
16
|
+
indexes: TsgDynamoIndex[],
|
|
17
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TsgDynamoProp } from "./TsgDynamoProp";
|
|
2
|
-
|
|
3
|
-
export type TsgDynamoTable = {
|
|
4
|
-
[name: string]: TsgDynamoProp;
|
|
1
|
+
import { TsgDynamoProp } from "./TsgDynamoProp";
|
|
2
|
+
|
|
3
|
+
export type TsgDynamoTable = {
|
|
4
|
+
[name: string]: TsgDynamoProp;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TsgDynamoTableRef = {
|
|
2
|
-
tableName: string;
|
|
3
|
-
region?: string;
|
|
1
|
+
export type TsgDynamoTableRef = {
|
|
2
|
+
tableName: string;
|
|
3
|
+
region?: string;
|
|
4
4
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TsgKeyPair } from "./TsgKeyPair";
|
|
2
|
-
|
|
3
|
-
export interface TsgEC2Prop {
|
|
4
|
-
VpcId: string;
|
|
5
|
-
MachineImage: string;
|
|
6
|
-
Region: string;
|
|
7
|
-
KeyPair: TsgKeyPair;
|
|
8
|
-
|
|
1
|
+
import { TsgKeyPair } from "./TsgKeyPair";
|
|
2
|
+
|
|
3
|
+
export interface TsgEC2Prop {
|
|
4
|
+
VpcId: string;
|
|
5
|
+
MachineImage: string;
|
|
6
|
+
Region: string;
|
|
7
|
+
KeyPair: TsgKeyPair;
|
|
8
|
+
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface TsgKeyPair {
|
|
2
|
-
|
|
3
|
-
Name?: string;
|
|
4
|
-
PublicKey: string;
|
|
5
|
-
|
|
1
|
+
export interface TsgKeyPair {
|
|
2
|
+
|
|
3
|
+
Name?: string;
|
|
4
|
+
PublicKey: string;
|
|
5
|
+
|
|
6
6
|
}
|