@digitraffic/common 2023.5.25-1 → 2023.5.31-2

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.
@@ -5,6 +5,9 @@ import { AuroraPostgresEngineVersion, DatabaseCluster, DatabaseClusterProps, IPa
5
5
  import { Construct } from "constructs";
6
6
  import { InfraStackConfiguration } from "./intra-stack-configuration";
7
7
  export interface DbConfiguration {
8
+ /** superuser username and password are fetched from this secret, using keys
9
+ * db.superuser and db.superuser.password
10
+ */
8
11
  readonly secretArn: string;
9
12
  readonly dbVersion: AuroraPostgresEngineVersion;
10
13
  readonly dbInstanceType: InstanceType;
@@ -12,6 +15,8 @@ export interface DbConfiguration {
12
15
  readonly instances: number;
13
16
  readonly customParameterGroup: boolean;
14
17
  readonly securityGroupId: string;
18
+ /** If this is not specified, import default vpc */
19
+ readonly vpc?: IVpc;
15
20
  readonly proxy: {
16
21
  readonly name?: string;
17
22
  readonly securityGroupId: string;
@@ -75,13 +75,18 @@ class DbStack extends aws_cdk_lib_1.Stack {
75
75
  },
76
76
  credentials: aws_rds_1.Credentials.fromPassword(secret.secretValueFromJson("db.superuser").unsafeUnwrap(), secret.secretValueFromJson("db.superuser.password")),
77
77
  parameterGroup,
78
+ storageEncrypted: true,
79
+ monitoringInterval: aws_cdk_lib_1.Duration.seconds(30),
78
80
  };
79
81
  }
80
82
  createAuroraCluster(isc, configuration) {
81
83
  const instanceName = isc.environmentName + "-db";
82
84
  const securityGroup = aws_ec2_1.SecurityGroup.fromSecurityGroupId(this, "securitygroup", configuration.securityGroupId);
83
85
  const parameterGroup = this.createParamaterGroup(configuration);
84
- const parameters = this.createClusterParameters(configuration, instanceName, (0, import_util_1.importVpc)(this, isc.environmentName), securityGroup, parameterGroup);
86
+ const vpc = configuration.vpc
87
+ ? configuration.vpc
88
+ : (0, import_util_1.importVpc)(this, isc.environmentName);
89
+ const parameters = this.createClusterParameters(configuration, instanceName, vpc, securityGroup, parameterGroup);
85
90
  // create cluster from the snapshot or from the scratch
86
91
  const cluster = configuration.snapshotIdentifier
87
92
  ? new aws_rds_1.DatabaseClusterFromSnapshot(this, instanceName, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2023.5.25-1",
3
+ "version": "2023.5.31-2",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,6 @@
26
26
  "constructs": "^10.2.17",
27
27
  "etag": "^1.8.1",
28
28
  "geojson-validation": "^1.0.2",
29
- "moment": "^2.29.4",
30
29
  "node-ttl": "^0.2.0",
31
30
  "pg-native": "^3.0.1",
32
31
  "pg-promise": "^11.0.0"
@@ -37,10 +36,10 @@
37
36
  "@types/geojson": "^7946.0.10",
38
37
  "@types/etag": "^1.8.1",
39
38
  "@types/jest": "^29.5.1",
40
- "@types/lodash": "^4.14.194",
39
+ "@types/lodash": "^4.14.195",
41
40
  "@types/node": "18.15.13",
42
41
  "@types/ramda": "~0.29.1",
43
- "@types/sinon": "10.0.14",
42
+ "@types/sinon": "10.0.15",
44
43
  "@typescript-eslint/eslint-plugin": "~5.59.5",
45
44
  "@typescript-eslint/parser": "^5.59.5",
46
45
  "aws-cdk-lib": "~2.78.0",
@@ -51,19 +50,20 @@
51
50
  "eslint": "~8.40.0",
52
51
  "eslint-config-prettier": "^8.8.0",
53
52
  "eslint-plugin-deprecation": "~1.4.1",
53
+ "etag": "^1.8.1",
54
54
  "geojson-validation": "^1.0.2",
55
55
  "husky": "^8.0.3",
56
56
  "jest": "^29.5.0",
57
57
  "jest-junit": "^16.0.0",
58
58
  "lint-staged": "^13.2.2",
59
- "moment": "^2.29.4",
59
+ "lodash": "^4.17.21",
60
60
  "node-ttl": "^0.2.0",
61
61
  "pg-native": "^3.0.1",
62
62
  "pg-promise": "^11.4.3",
63
63
  "prettier": "^2.8.8",
64
64
  "ramda": "~0.29.0",
65
- "rimraf": "^5.0.0",
66
- "sinon": "15.0.4",
65
+ "rimraf": "^5.0.1",
66
+ "sinon": "15.1.0",
67
67
  "ts-jest": "^29.1.0",
68
68
  "typescript": "~4.9.5",
69
69
  "velocityjs": "2.0.6"
@@ -75,9 +75,6 @@
75
75
  "lint-staged": {
76
76
  "*.{js,ts,css,md,yml,yaml,json}": "prettier --write"
77
77
  },
78
- "dependencies": {
79
- "lodash": "^4.17.21"
80
- },
81
78
  "scripts": {
82
79
  "build": "tsc",
83
80
  "lint": "eslint --cache .",
@@ -4,6 +4,7 @@ import {
4
4
  IVpc,
5
5
  SecurityGroup,
6
6
  SubnetType,
7
+ Vpc,
7
8
  } from "aws-cdk-lib/aws-ec2";
8
9
  import { ISecurityGroup } from "aws-cdk-lib/aws-ec2/lib/security-group";
9
10
  import {
@@ -24,6 +25,9 @@ import { InfraStackConfiguration } from "./intra-stack-configuration";
24
25
  import { exportValue, importVpc } from "../import-util";
25
26
 
26
27
  export interface DbConfiguration {
28
+ /** superuser username and password are fetched from this secret, using keys
29
+ * db.superuser and db.superuser.password
30
+ */
27
31
  readonly secretArn: string;
28
32
 
29
33
  readonly dbVersion: AuroraPostgresEngineVersion;
@@ -32,6 +36,8 @@ export interface DbConfiguration {
32
36
  readonly instances: number;
33
37
  readonly customParameterGroup: boolean;
34
38
  readonly securityGroupId: string;
39
+ /** If this is not specified, import default vpc */
40
+ readonly vpc?: IVpc;
35
41
 
36
42
  readonly proxy: {
37
43
  readonly name?: string;
@@ -163,6 +169,8 @@ export class DbStack extends Stack {
163
169
  secret.secretValueFromJson("db.superuser.password")
164
170
  ),
165
171
  parameterGroup,
172
+ storageEncrypted: true,
173
+ monitoringInterval: Duration.seconds(30),
166
174
  };
167
175
  }
168
176
 
@@ -177,10 +185,14 @@ export class DbStack extends Stack {
177
185
  configuration.securityGroupId
178
186
  );
179
187
  const parameterGroup = this.createParamaterGroup(configuration);
188
+ const vpc = configuration.vpc
189
+ ? configuration.vpc
190
+ : importVpc(this, isc.environmentName);
191
+
180
192
  const parameters = this.createClusterParameters(
181
193
  configuration,
182
194
  instanceName,
183
- importVpc(this, isc.environmentName),
195
+ vpc,
184
196
  securityGroup,
185
197
  parameterGroup
186
198
  );
@@ -35,6 +35,6 @@ export function dateFromIsoString(isoString: string): Date {
35
35
  return parsed;
36
36
  }
37
37
 
38
- function isValidDate(d: any) {
38
+ function isValidDate(d: unknown) {
39
39
  return d instanceof Date && !isNaN(d.getTime());
40
40
  }