@digitraffic/common 2023.3.21-2 → 2023.3.27-1

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.
@@ -1,7 +1,7 @@
1
1
  import { IntegrationResponse, LambdaIntegration } from "aws-cdk-lib/aws-apigateway";
2
2
  import { IFunction } from "aws-cdk-lib/aws-lambda";
3
3
  import { MediaType } from "../../types/mediatypes";
4
- declare type ParameterType = "path" | "querystring";
4
+ declare type ParameterType = "path" | "querystring" | "context";
5
5
  interface ApiParameter {
6
6
  type: ParameterType;
7
7
  name: string;
@@ -14,6 +14,7 @@ export declare class DigitrafficIntegration {
14
14
  constructor(lambda: IFunction, mediaType?: MediaType, sunset?: string);
15
15
  addPathParameter(...names: string[]): this;
16
16
  addQueryParameter(...names: string[]): this;
17
+ addContextParameter(...names: string[]): this;
17
18
  build(): LambdaIntegration;
18
19
  createRequestParameters(): Record<string, string>;
19
20
  createRequestTemplates(): Record<string, string>;
@@ -19,6 +19,10 @@ class DigitrafficIntegration {
19
19
  names.forEach((name) => this.parameters.push({ type: "querystring", name }));
20
20
  return this;
21
21
  }
22
+ addContextParameter(...names) {
23
+ names.forEach((name) => this.parameters.push({ type: "context", name }));
24
+ return this;
25
+ }
22
26
  build() {
23
27
  const integrationResponses = this.createResponses();
24
28
  return new aws_apigateway_1.LambdaIntegration(this.lambda, {
@@ -35,7 +39,10 @@ class DigitrafficIntegration {
35
39
  }
36
40
  createRequestParameters() {
37
41
  const requestParameters = {};
38
- this.parameters.forEach((parameter) => {
42
+ // filter out context parameters
43
+ this.parameters
44
+ .filter((parameter) => parameter.type !== "context")
45
+ .forEach((parameter) => {
39
46
  requestParameters[`integration.request.${parameter.type}.${parameter.name}`] = `method.request.${parameter.type}.${parameter.name}`;
40
47
  });
41
48
  return requestParameters;
@@ -43,7 +50,12 @@ class DigitrafficIntegration {
43
50
  createRequestTemplates() {
44
51
  const requestJson = {};
45
52
  this.parameters.forEach((parameter) => {
46
- requestJson[parameter.name] = `$util.escapeJavaScript($input.params('${parameter.name}'))`;
53
+ if (parameter.type === "context") {
54
+ requestJson[parameter.name] = `$util.parseJson($context.${parameter.name})`;
55
+ }
56
+ else {
57
+ requestJson[parameter.name] = `$util.escapeJavaScript($input.params('${parameter.name}'))`;
58
+ }
47
59
  });
48
60
  return {
49
61
  [mediatypes_1.MediaType.APPLICATION_JSON]: JSON.stringify(requestJson),
@@ -27,11 +27,18 @@ export declare const MessageModel: {
27
27
  schema: JsonSchema;
28
28
  };
29
29
  export declare const NotFoundResponse: string;
30
- export declare const BadRequestResponseTemplate: Record<string, string>;
31
- export declare const NotFoundResponseTemplate: Record<string, string>;
32
- export declare const XmlResponseTemplate: Record<string, string>;
33
- export declare const InternalServerErrorResponseTemplate: Record<string, string>;
34
- export declare function createResponses<T>(key: MediaType, value: T): Record<string, T>;
30
+ export declare const BadRequestResponseTemplate: {
31
+ "application/json": string;
32
+ };
33
+ export declare const NotFoundResponseTemplate: {
34
+ "application/json": string;
35
+ };
36
+ export declare const XmlResponseTemplate: {
37
+ "application/xml": string;
38
+ };
39
+ export declare const InternalServerErrorResponseTemplate: {
40
+ "application/json": string;
41
+ };
35
42
  export declare class DigitrafficMethodResponse {
36
43
  static response(statusCode: string, model: IModel, mediaType: MediaType, disableCors?: boolean, deprecation?: boolean): MethodResponse;
37
44
  static response200(model: IModel, mediaType?: MediaType): MethodResponse;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DigitrafficMethodResponse = exports.createResponses = exports.InternalServerErrorResponseTemplate = exports.XmlResponseTemplate = exports.NotFoundResponseTemplate = exports.BadRequestResponseTemplate = exports.NotFoundResponse = exports.MessageModel = exports.getDeprecatedDefaultLambdaResponse = exports.RESPONSE_DEFAULT_LAMBDA = void 0;
3
+ exports.DigitrafficMethodResponse = exports.InternalServerErrorResponseTemplate = exports.XmlResponseTemplate = exports.NotFoundResponseTemplate = exports.BadRequestResponseTemplate = exports.NotFoundResponse = exports.MessageModel = exports.getDeprecatedDefaultLambdaResponse = exports.RESPONSE_DEFAULT_LAMBDA = void 0;
4
4
  const mediatypes_1 = require("../../types/mediatypes");
5
5
  const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
6
6
  const date_utils_1 = require("../../../utils/date-utils");
@@ -68,20 +68,21 @@ const InternalServerErrorResponse = JSON.stringify({
68
68
  const BadRequestMessage = "Bad request";
69
69
  const BadRequestResponse = JSON.stringify({ message: BadRequestMessage });
70
70
  /// @deprecated
71
- exports.BadRequestResponseTemplate = createResponses(mediatypes_1.MediaType.APPLICATION_JSON, BadRequestResponse);
72
- /// @deprecated
73
- exports.NotFoundResponseTemplate = createResponses(mediatypes_1.MediaType.APPLICATION_JSON, exports.NotFoundResponse);
71
+ exports.BadRequestResponseTemplate = {
72
+ [mediatypes_1.MediaType.APPLICATION_JSON]: BadRequestResponse,
73
+ };
74
74
  /// @deprecated
75
- exports.XmlResponseTemplate = createResponses(mediatypes_1.MediaType.APPLICATION_XML, BODY_FROM_INPUT_PATH);
75
+ exports.NotFoundResponseTemplate = {
76
+ [mediatypes_1.MediaType.APPLICATION_JSON]: exports.NotFoundResponse,
77
+ };
76
78
  /// @deprecated
77
- exports.InternalServerErrorResponseTemplate = createResponses(mediatypes_1.MediaType.APPLICATION_JSON, InternalServerErrorResponse);
79
+ exports.XmlResponseTemplate = {
80
+ [mediatypes_1.MediaType.APPLICATION_XML]: BODY_FROM_INPUT_PATH,
81
+ };
78
82
  /// @deprecated
79
- function createResponses(key, value) {
80
- return {
81
- [key]: value,
82
- };
83
- }
84
- exports.createResponses = createResponses;
83
+ exports.InternalServerErrorResponseTemplate = {
84
+ [mediatypes_1.MediaType.APPLICATION_JSON]: InternalServerErrorResponse,
85
+ };
85
86
  class DigitrafficMethodResponse {
86
87
  static response(statusCode, model, mediaType, disableCors = false, deprecation = false) {
87
88
  return {
@@ -13,7 +13,9 @@ export declare const RESPONSE_CORS_INTEGRATION: {
13
13
  export declare const RESPONSE_404_NOT_FOUND: {
14
14
  statusCode: string;
15
15
  selectionPattern: string;
16
- responseTemplates: Record<string, string>;
16
+ responseTemplates: {
17
+ "application/json": string;
18
+ };
17
19
  };
18
20
  /**
19
21
  * @deprecated Use DigitrafficMethodResponse
@@ -4,27 +4,33 @@ exports.getResponse = exports.defaultIntegration = exports.methodResponse = expo
4
4
  const response_1 = require("./response");
5
5
  const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
6
6
  const errors_1 = require("../../types/errors");
7
+ /// @deprecated
7
8
  exports.RESPONSE_200_OK = {
8
9
  statusCode: "200",
9
10
  };
11
+ /// @deprecated
10
12
  exports.RESPONSE_400_BAD_REQUEST = {
11
13
  statusCode: "400",
12
14
  selectionPattern: errors_1.BAD_REQUEST_MESSAGE,
13
15
  responseTemplates: response_1.BadRequestResponseTemplate,
14
16
  };
17
+ /// @deprecated
15
18
  exports.RESPONSE_500_SERVER_ERROR = {
16
19
  statusCode: "500",
17
20
  selectionPattern: errors_1.ERROR_MESSAGE,
18
21
  responseTemplates: response_1.InternalServerErrorResponseTemplate,
19
22
  };
23
+ /// @deprecated
20
24
  const RESPONSE_XML = {
21
25
  responseTemplates: response_1.XmlResponseTemplate,
22
26
  };
27
+ /// @deprecated
23
28
  exports.RESPONSE_CORS_INTEGRATION = {
24
29
  responseParameters: {
25
30
  "method.response.header.Access-Control-Allow-Origin": "'*'",
26
31
  },
27
32
  };
33
+ /// @deprecated
28
34
  exports.RESPONSE_404_NOT_FOUND = {
29
35
  statusCode: "404",
30
36
  selectionPattern: errors_1.NOT_FOUND_MESSAGE,
@@ -36,7 +42,9 @@ exports.RESPONSE_404_NOT_FOUND = {
36
42
  function methodResponse(status, contentType, model, parameters) {
37
43
  return {
38
44
  statusCode: status,
39
- responseModels: (0, response_1.createResponses)(contentType, model),
45
+ responseModels: {
46
+ [contentType]: model,
47
+ },
40
48
  responseParameters: parameters ?? {},
41
49
  };
42
50
  }
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inDatabaseReadonly = exports.inDatabase = exports.inTransaction = exports.initDbConnection = exports.DatabaseEnvironmentKeys = void 0;
4
4
  const utils_1 = require("../utils/utils");
5
- const environment_1 = require("../aws/runtime/environment");
6
5
  var DatabaseEnvironmentKeys;
7
6
  (function (DatabaseEnvironmentKeys) {
8
7
  DatabaseEnvironmentKeys["DB_USER"] = "DB_USER";
@@ -57,10 +56,10 @@ function inDatabaseReadonly(fn) {
57
56
  }
58
57
  exports.inDatabaseReadonly = inDatabaseReadonly;
59
58
  async function doInDatabase(readonly, fn) {
60
- const db_application = (0, environment_1.envValue)(DatabaseEnvironmentKeys.DB_APPLICATION, "unknown-cdk-application");
59
+ const db_application = (0, utils_1.getEnvVariableOrElse)(DatabaseEnvironmentKeys.DB_APPLICATION, "unknown-cdk-application");
61
60
  const db_uri = readonly
62
- ? (0, environment_1.envValue)(DatabaseEnvironmentKeys.DB_RO_URI)
63
- : (0, environment_1.envValue)(DatabaseEnvironmentKeys.DB_URI);
61
+ ? (0, utils_1.getEnvVariable)(DatabaseEnvironmentKeys.DB_RO_URI)
62
+ : (0, utils_1.getEnvVariable)(DatabaseEnvironmentKeys.DB_URI);
64
63
  const db = initDbConnection((0, utils_1.getEnvVariable)(DatabaseEnvironmentKeys.DB_USER), (0, utils_1.getEnvVariable)(DatabaseEnvironmentKeys.DB_PASS), db_application, db_uri);
65
64
  try {
66
65
  // deallocate all prepared statements to allow for connection pooling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2023.3.21-2",
3
+ "version": "2023.3.27-1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,13 +17,13 @@
17
17
  "src/**/*.ts"
18
18
  ],
19
19
  "peerDependencies": {
20
- "@aws-cdk/aws-synthetics-alpha": "2.62.2-alpha.0",
20
+ "@aws-cdk/aws-synthetics-alpha": "2.70.0-alpha.0",
21
21
  "@types/geojson": "^7946.0.10",
22
- "aws-cdk-lib": "2.62.2",
23
- "aws-sdk": "^2.1304.0",
24
- "axios": "^1.2.6",
22
+ "aws-cdk-lib": "2.70.0",
23
+ "aws-sdk": "^2.1343.0",
24
+ "axios": "^1.3.4",
25
25
  "change-case": "^4.1.2",
26
- "constructs": "^10.1.235",
26
+ "constructs": "^10.1.292",
27
27
  "geojson-validation": "^1.0.2",
28
28
  "moment": "^2.29.4",
29
29
  "node-ttl": "^0.2.0",
@@ -31,36 +31,36 @@
31
31
  "pg-promise": "^10.12.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@aws-cdk/aws-synthetics-alpha": "2.62.2-alpha.0",
35
- "@types/aws-lambda": "^8.10.110",
34
+ "@aws-cdk/aws-synthetics-alpha": "2.70.0-alpha.0",
35
+ "@types/aws-lambda": "^8.10.114",
36
36
  "@types/geojson": "^7946.0.10",
37
- "@types/jest": "^29.2.5",
38
- "@types/node": "^18.13.0",
37
+ "@types/jest": "^29.5.0",
38
+ "@types/node": "^18.15.10",
39
39
  "@types/ramda": "^0.28.23",
40
40
  "@types/sinon": "^10.0.13",
41
- "@typescript-eslint/eslint-plugin": "^5.51.0",
42
- "@typescript-eslint/parser": "^5.51.0",
43
- "aws-cdk-lib": "2.62.2",
44
- "aws-sdk": "^2.1304.0",
45
- "axios": "^1.2.6",
41
+ "@typescript-eslint/eslint-plugin": "^5.56.0",
42
+ "@typescript-eslint/parser": "^5.56.0",
43
+ "aws-cdk-lib": "2.70.0",
44
+ "aws-sdk": "^2.1343.0",
45
+ "axios": "^1.3.4",
46
46
  "change-case": "^4.1.2",
47
- "constructs": "^10.1.222",
48
- "eslint": "~8.34.0",
49
- "eslint-config-prettier": "^8.6.0",
47
+ "constructs": "^10.1.292",
48
+ "eslint": "~8.36.0",
49
+ "eslint-config-prettier": "^8.8.0",
50
50
  "eslint-plugin-deprecation": "1.3.3",
51
51
  "geojson-validation": "^1.0.2",
52
52
  "husky": "^8.0.3",
53
- "jest": "^29.4.2",
53
+ "jest": "^29.5.0",
54
54
  "jest-junit": "^15.0.0",
55
- "lint-staged": "^13.1.1",
55
+ "lint-staged": "^13.2.0",
56
56
  "moment": "^2.29.4",
57
57
  "node-ttl": "^0.2.0",
58
58
  "pg-native": "^3.0.1",
59
59
  "pg-promise": "^10.12.0",
60
- "prettier": "^2.8.3",
60
+ "prettier": "^2.8.7",
61
61
  "ramda": "^0.28.0",
62
62
  "rimraf": "^4.1.0",
63
- "sinon": "^15.0.1",
63
+ "sinon": "^15.0.3",
64
64
  "ts-jest": "^29.0.5",
65
65
  "typescript": "~4.8.4"
66
66
  },
@@ -7,7 +7,7 @@ import { IFunction } from "aws-cdk-lib/aws-lambda";
7
7
  import { MediaType } from "../../types/mediatypes";
8
8
  import { DigitrafficIntegrationResponse } from "../../runtime/digitraffic-integration-response";
9
9
 
10
- type ParameterType = "path" | "querystring";
10
+ type ParameterType = "path" | "querystring" | "context";
11
11
 
12
12
  interface ApiParameter {
13
13
  type: ParameterType;
@@ -44,6 +44,14 @@ export class DigitrafficIntegration {
44
44
  return this;
45
45
  }
46
46
 
47
+ addContextParameter(...names: string[]): this {
48
+ names.forEach((name) =>
49
+ this.parameters.push({ type: "context", name })
50
+ );
51
+
52
+ return this;
53
+ }
54
+
47
55
  build(): LambdaIntegration {
48
56
  const integrationResponses = this.createResponses();
49
57
 
@@ -65,11 +73,14 @@ export class DigitrafficIntegration {
65
73
  createRequestParameters(): Record<string, string> {
66
74
  const requestParameters: Record<string, string> = {};
67
75
 
68
- this.parameters.forEach((parameter: ApiParameter) => {
69
- requestParameters[
70
- `integration.request.${parameter.type}.${parameter.name}`
71
- ] = `method.request.${parameter.type}.${parameter.name}`;
72
- });
76
+ // filter out context parameters
77
+ this.parameters
78
+ .filter((parameter) => parameter.type !== "context")
79
+ .forEach((parameter: ApiParameter) => {
80
+ requestParameters[
81
+ `integration.request.${parameter.type}.${parameter.name}`
82
+ ] = `method.request.${parameter.type}.${parameter.name}`;
83
+ });
73
84
 
74
85
  return requestParameters;
75
86
  }
@@ -78,9 +89,15 @@ export class DigitrafficIntegration {
78
89
  const requestJson: Record<string, string> = {};
79
90
 
80
91
  this.parameters.forEach((parameter: ApiParameter) => {
81
- requestJson[
82
- parameter.name
83
- ] = `$util.escapeJavaScript($input.params('${parameter.name}'))`;
92
+ if (parameter.type === "context") {
93
+ requestJson[
94
+ parameter.name
95
+ ] = `$util.parseJson($context.${parameter.name})`;
96
+ } else {
97
+ requestJson[
98
+ parameter.name
99
+ ] = `$util.escapeJavaScript($input.params('${parameter.name}'))`;
100
+ }
84
101
  });
85
102
 
86
103
  return {
@@ -1,7 +1,13 @@
1
- import {MediaType} from "../../types/mediatypes";
2
- import {JsonSchema, JsonSchemaType, JsonSchemaVersion, MethodResponse, Model,} from "aws-cdk-lib/aws-apigateway";
3
- import {IModel} from "aws-cdk-lib/aws-apigateway/lib/model";
4
- import {dateFromIsoString} from "../../../utils/date-utils";
1
+ import { MediaType } from "../../types/mediatypes";
2
+ import {
3
+ JsonSchema,
4
+ JsonSchemaType,
5
+ JsonSchemaVersion,
6
+ MethodResponse,
7
+ Model,
8
+ } from "aws-cdk-lib/aws-apigateway";
9
+ import { IModel } from "aws-cdk-lib/aws-apigateway/lib/model";
10
+ import { dateFromIsoString } from "../../../utils/date-utils";
5
11
 
6
12
  /**
7
13
  * This is velocity-script, that assumes the response to be LambdaResponse(status and body).
@@ -37,7 +43,9 @@ $util.base64Decode($inputRoot.body)
37
43
 
38
44
  export const getDeprecatedDefaultLambdaResponse = (sunset: string) => {
39
45
  const setDeprecationHeaders = `#set ($context.responseOverride.header.Deprecation = 'true')
40
- #set ($context.responseOverride.header.Sunset = '${dateFromIsoString(sunset).toUTCString()}')`;
46
+ #set ($context.responseOverride.header.Sunset = '${dateFromIsoString(
47
+ sunset
48
+ ).toUTCString()}')`;
41
49
  return RESPONSE_DEFAULT_LAMBDA.concat(setDeprecationHeaders);
42
50
  };
43
51
 
@@ -75,35 +83,21 @@ const BadRequestMessage = "Bad request";
75
83
  const BadRequestResponse = JSON.stringify({ message: BadRequestMessage });
76
84
 
77
85
  /// @deprecated
78
- export const BadRequestResponseTemplate = createResponses(
79
- MediaType.APPLICATION_JSON,
80
- BadRequestResponse
81
- );
82
- /// @deprecated
83
- export const NotFoundResponseTemplate = createResponses(
84
- MediaType.APPLICATION_JSON,
85
- NotFoundResponse
86
- );
86
+ export const BadRequestResponseTemplate = {
87
+ [MediaType.APPLICATION_JSON]: BadRequestResponse,
88
+ };
87
89
  /// @deprecated
88
- export const XmlResponseTemplate = createResponses(
89
- MediaType.APPLICATION_XML,
90
- BODY_FROM_INPUT_PATH
91
- );
90
+ export const NotFoundResponseTemplate = {
91
+ [MediaType.APPLICATION_JSON]: NotFoundResponse,
92
+ };
92
93
  /// @deprecated
93
- export const InternalServerErrorResponseTemplate = createResponses(
94
- MediaType.APPLICATION_JSON,
95
- InternalServerErrorResponse
96
- );
97
-
94
+ export const XmlResponseTemplate = {
95
+ [MediaType.APPLICATION_XML]: BODY_FROM_INPUT_PATH,
96
+ };
98
97
  /// @deprecated
99
- export function createResponses<T>(
100
- key: MediaType,
101
- value: T
102
- ): Record<string, T> {
103
- return {
104
- [key]: value,
105
- };
106
- }
98
+ export const InternalServerErrorResponseTemplate = {
99
+ [MediaType.APPLICATION_JSON]: InternalServerErrorResponse,
100
+ };
107
101
 
108
102
  export class DigitrafficMethodResponse {
109
103
  static response(
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  InternalServerErrorResponseTemplate,
3
- createResponses,
4
3
  XmlResponseTemplate,
5
4
  NotFoundResponseTemplate,
6
5
  BadRequestResponseTemplate,
@@ -20,32 +19,38 @@ import {
20
19
  } from "../../types/errors";
21
20
  import { MediaType } from "../../types/mediatypes";
22
21
 
22
+ /// @deprecated
23
23
  export const RESPONSE_200_OK: IntegrationResponse = {
24
24
  statusCode: "200",
25
25
  };
26
26
 
27
+ /// @deprecated
27
28
  export const RESPONSE_400_BAD_REQUEST: IntegrationResponse = {
28
29
  statusCode: "400",
29
30
  selectionPattern: BAD_REQUEST_MESSAGE,
30
31
  responseTemplates: BadRequestResponseTemplate,
31
32
  };
32
33
 
34
+ /// @deprecated
33
35
  export const RESPONSE_500_SERVER_ERROR: IntegrationResponse = {
34
36
  statusCode: "500",
35
37
  selectionPattern: ERROR_MESSAGE,
36
38
  responseTemplates: InternalServerErrorResponseTemplate,
37
39
  };
38
40
 
41
+ /// @deprecated
39
42
  const RESPONSE_XML = {
40
43
  responseTemplates: XmlResponseTemplate,
41
44
  };
42
45
 
46
+ /// @deprecated
43
47
  export const RESPONSE_CORS_INTEGRATION = {
44
48
  responseParameters: {
45
49
  "method.response.header.Access-Control-Allow-Origin": "'*'",
46
50
  },
47
51
  };
48
52
 
53
+ /// @deprecated
49
54
  export const RESPONSE_404_NOT_FOUND = {
50
55
  statusCode: "404",
51
56
  selectionPattern: NOT_FOUND_MESSAGE,
@@ -63,7 +68,9 @@ export function methodResponse(
63
68
  ): MethodResponse {
64
69
  return {
65
70
  statusCode: status,
66
- responseModels: createResponses(contentType, model),
71
+ responseModels: {
72
+ [contentType]: model,
73
+ },
67
74
  responseParameters: parameters ?? {},
68
75
  };
69
76
  }
@@ -1,6 +1,5 @@
1
1
  import { IDatabase, ITask } from "pg-promise";
2
- import { getEnvVariable } from "../utils/utils";
3
- import { envValue } from "../aws/runtime/environment";
2
+ import { getEnvVariable, getEnvVariableOrElse } from "../utils/utils";
4
3
 
5
4
  export enum DatabaseEnvironmentKeys {
6
5
  DB_USER = "DB_USER",
@@ -78,13 +77,13 @@ async function doInDatabase<T>(
78
77
  readonly: boolean,
79
78
  fn: (db: DTDatabase) => Promise<T>
80
79
  ): Promise<T> {
81
- const db_application = envValue(
80
+ const db_application = getEnvVariableOrElse(
82
81
  DatabaseEnvironmentKeys.DB_APPLICATION,
83
82
  "unknown-cdk-application"
84
83
  );
85
84
  const db_uri = readonly
86
- ? envValue(DatabaseEnvironmentKeys.DB_RO_URI)
87
- : envValue(DatabaseEnvironmentKeys.DB_URI);
85
+ ? getEnvVariable(DatabaseEnvironmentKeys.DB_RO_URI)
86
+ : getEnvVariable(DatabaseEnvironmentKeys.DB_URI);
88
87
 
89
88
  const db = initDbConnection(
90
89
  getEnvVariable(DatabaseEnvironmentKeys.DB_USER),