@digitraffic/common 2024.8.16-1 → 2024.8.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.
- package/dist/{test/asserter.mjs → __test__/asserter.js} +3 -3
- package/dist/{test/db-testutils.d.mts → __test__/db-testutils.d.ts} +1 -1
- package/dist/{test/db-testutils.mjs → __test__/db-testutils.js} +4 -3
- package/dist/__test__/{dependencies.test.mjs → dependencies.test.js} +1 -1
- package/dist/__test__/{imports.test.mjs → imports.test.js} +79 -79
- package/dist/__test__/infra/{acl-builder.test.mjs → acl-builder.test.js} +4 -4
- package/dist/__test__/infra/api/{handler-factory.test.mjs → handler-factory.test.js} +3 -4
- package/dist/__test__/infra/api/{response.test.mjs → response.test.js} +3 -11
- package/dist/__test__/infra/api/{static-integration.test.mjs → static-integration.test.js} +3 -3
- package/dist/__test__/infra/{documentation.test.mjs → documentation.test.js} +2 -2
- package/dist/__test__/infra/{scheduler.test.mjs → scheduler.test.js} +2 -2
- package/dist/__test__/infra/{security-rule.test.mjs → security-rule.test.js} +2 -2
- package/dist/__test__/marine/{id_utils.test.mjs → id_utils.test.js} +3 -3
- package/dist/{test/mock-ky.mjs → __test__/mock-ky.js} +1 -1
- package/dist/__test__/promise/{promise.test.mjs → promise.test.js} +9 -13
- package/dist/__test__/runtime/{dt-logger.test.mjs → dt-logger.test.js} +7 -7
- package/dist/__test__/secrets/{secret-holder.test.mjs → secret-holder.test.js} +6 -4
- package/dist/__test__/secrets/{secret.test.mjs → secret.test.js} +4 -2
- package/dist/__test__/stack/{rest-apis.test.mjs → rest-apis.test.js} +4 -4
- package/dist/__test__/test/{mock-ky.test.mjs → mock-ky.test.js} +3 -3
- package/dist/{test/testutils.mjs → __test__/testutils.js} +1 -2
- package/dist/__test__/types/{lambda-response.test.mjs → lambda-response.test.js} +2 -2
- package/dist/__test__/utils/{date-utils.test.mjs → date-utils.test.js} +3 -3
- package/dist/__test__/utils/{geometry.test.mjs → geometry.test.js} +3 -3
- package/dist/__test__/utils/{logging.test.mjs → logging.test.js} +4 -4
- package/dist/__test__/utils/{utils.test.mjs → utils.test.js} +2 -3
- package/dist/aws/infra/{acl-builder.d.mts → acl-builder.d.ts} +15 -8
- package/dist/aws/infra/{acl-builder.mjs → acl-builder.js} +77 -55
- package/dist/aws/infra/api/{handler-factory.d.mts → handler-factory.d.ts} +4 -4
- package/dist/aws/infra/api/{handler-factory.mjs → handler-factory.js} +7 -5
- package/dist/aws/infra/api/{integration.d.mts → integration.d.ts} +3 -1
- package/dist/aws/infra/api/{integration.mjs → integration.js} +34 -13
- package/dist/aws/infra/api/{response.d.mts → response.d.ts} +2 -2
- package/dist/aws/infra/api/{response.mjs → response.js} +4 -4
- package/dist/aws/infra/api/{responses.d.mts → responses.d.ts} +3 -3
- package/dist/aws/infra/api/{responses.mjs → responses.js} +4 -6
- package/dist/aws/infra/api/{static-integration.d.mts → static-integration.d.ts} +2 -2
- package/dist/aws/infra/api/{static-integration.mjs → static-integration.js} +3 -3
- package/dist/aws/infra/canaries/canary-alarm.d.ts +6 -0
- package/dist/aws/infra/canaries/{canary-alarm.mjs → canary-alarm.js} +1 -3
- package/dist/aws/infra/canaries/{canary-keys.mjs → canary-keys.js} +1 -1
- package/dist/aws/infra/canaries/{canary-parameters.d.mts → canary-parameters.d.ts} +1 -1
- package/dist/aws/infra/canaries/canary-parameters.js +2 -0
- package/dist/aws/infra/canaries/{canary-role.d.mts → canary-role.d.ts} +1 -1
- package/dist/aws/infra/canaries/{canary-role.mjs → canary-role.js} +2 -5
- package/dist/aws/infra/canaries/{canary.d.mts → canary.d.ts} +4 -4
- package/dist/aws/infra/canaries/{canary.mjs → canary.js} +3 -4
- package/dist/aws/infra/canaries/{database-canary.d.mts → database-canary.d.ts} +4 -5
- package/dist/aws/infra/canaries/{database-canary.mjs → database-canary.js} +4 -11
- package/dist/aws/infra/canaries/{database-checker.d.mts → database-checker.d.ts} +5 -5
- package/dist/aws/infra/canaries/{database-checker.mjs → database-checker.js} +15 -12
- package/dist/aws/infra/canaries/{url-canary.d.mts → url-canary.d.ts} +5 -5
- package/dist/aws/infra/canaries/{url-canary.mjs → url-canary.js} +7 -12
- package/dist/aws/infra/canaries/{url-checker.d.mts → url-checker.d.ts} +2 -2
- package/dist/aws/infra/canaries/{url-checker.mjs → url-checker.js} +12 -21
- package/dist/aws/infra/{documentation.d.mts → documentation.d.ts} +2 -2
- package/dist/aws/infra/{documentation.mjs → documentation.js} +4 -3
- package/dist/aws/infra/{import-util.d.mts → import-util.d.ts} +2 -2
- package/dist/aws/infra/{import-util.mjs → import-util.js} +3 -3
- package/dist/aws/infra/{scheduler.d.mts → scheduler.d.ts} +2 -2
- package/dist/aws/infra/{scheduler.mjs → scheduler.js} +1 -3
- package/dist/aws/infra/{security-rule.d.mts → security-rule.d.ts} +1 -1
- package/dist/aws/infra/{security-rule.mjs → security-rule.js} +1 -2
- package/dist/aws/infra/{sqs-integration.d.mts → sqs-integration.d.ts} +3 -3
- package/dist/aws/infra/{sqs-integration.mjs → sqs-integration.js} +3 -7
- package/dist/aws/infra/{sqs-queue.d.mts → sqs-queue.d.ts} +1 -1
- package/dist/aws/infra/{sqs-queue.mjs → sqs-queue.js} +19 -19
- package/dist/aws/infra/stack/{lambda-configs.d.mts → lambda-configs.d.ts} +4 -4
- package/dist/aws/infra/stack/{lambda-configs.mjs → lambda-configs.js} +3 -7
- package/dist/aws/infra/stack/{monitoredfunction.d.mts → monitoredfunction.d.ts} +15 -15
- package/dist/aws/infra/stack/{monitoredfunction.mjs → monitoredfunction.js} +42 -43
- package/dist/aws/infra/stack/{parameters.mjs → parameters.js} +1 -1
- package/dist/aws/infra/stack/{rest_apis.d.mts → rest_apis.d.ts} +12 -6
- package/dist/aws/infra/stack/{rest_apis.mjs → rest_apis.js} +26 -24
- package/dist/aws/infra/stack/{stack-checking-aspect.mjs → stack-checking-aspect.js} +7 -2
- package/dist/aws/infra/stack/{stack.d.mts → stack.d.ts} +4 -4
- package/dist/aws/infra/stack/{stack.mjs → stack.js} +2 -5
- package/dist/aws/infra/stack/{subscription.d.mts → subscription.d.ts} +4 -4
- package/dist/aws/infra/stack/{subscription.mjs → subscription.js} +2 -6
- package/dist/aws/infra/stacks/{db-dns-stack.d.mts → db-dns-stack.d.ts} +1 -1
- package/dist/aws/infra/stacks/{db-dns-stack.mjs → db-dns-stack.js} +4 -4
- package/dist/aws/infra/stacks/{db-proxy-stack.d.mts → db-proxy-stack.d.ts} +2 -2
- package/dist/aws/infra/stacks/{db-proxy-stack.mjs → db-proxy-stack.js} +5 -6
- package/dist/aws/infra/stacks/{db-stack.d.mts → db-stack.d.ts} +4 -4
- package/dist/aws/infra/stacks/{db-stack.mjs → db-stack.js} +7 -10
- package/dist/aws/infra/stacks/intra-stack-configuration.js +2 -0
- package/dist/aws/infra/stacks/{network-stack.d.mts → network-stack.d.ts} +2 -2
- package/dist/aws/infra/stacks/{network-stack.mjs → network-stack.js} +4 -7
- package/dist/aws/infra/{usage-plans.d.mts → usage-plans.d.ts} +1 -1
- package/dist/aws/infra/{usage-plans.mjs → usage-plans.js} +1 -2
- package/dist/aws/runtime/{apikey.mjs → apikey.js} +1 -1
- package/dist/aws/runtime/{digitraffic-integration-response.d.mts → digitraffic-integration-response.d.ts} +1 -1
- package/dist/aws/runtime/{digitraffic-integration-response.mjs → digitraffic-integration-response.js} +4 -6
- package/dist/aws/runtime/{dt-logger-default.d.mts → dt-logger-default.d.ts} +2 -2
- package/dist/aws/runtime/{dt-logger-default.mjs → dt-logger-default.js} +2 -2
- package/dist/aws/runtime/{dt-logger.mjs → dt-logger.js} +9 -4
- package/dist/aws/runtime/{environment.mjs → environment.js} +2 -2
- package/dist/aws/runtime/{s3.d.mts → s3.d.ts} +1 -1
- package/dist/aws/runtime/{s3.mjs → s3.js} +3 -3
- package/dist/aws/runtime/secrets/{dbsecret.d.mts → dbsecret.d.ts} +1 -1
- package/dist/aws/runtime/secrets/{dbsecret.mjs → dbsecret.js} +6 -2
- package/dist/aws/runtime/secrets/proxy-holder.js +25 -0
- package/dist/aws/runtime/secrets/rds-holder.js +25 -0
- package/dist/aws/runtime/secrets/{secret-holder.d.mts → secret-holder.d.ts} +6 -5
- package/dist/aws/runtime/secrets/{secret-holder.mjs → secret-holder.js} +11 -12
- package/dist/aws/runtime/secrets/{secret.mjs → secret.js} +7 -3
- package/dist/aws/types/{errors.mjs → errors.js} +1 -1
- package/dist/aws/types/{lambda-response.mjs → lambda-response.js} +1 -1
- package/dist/aws/types/{mediatypes.mjs → mediatypes.js} +1 -1
- package/dist/aws/types/{model-with-reference.d.mts → model-with-reference.d.ts} +1 -1
- package/dist/aws/types/model-with-reference.js +2 -0
- package/dist/aws/types/proxytypes.js +2 -0
- package/dist/aws/types/tags.js +4 -0
- package/dist/database/{cached.d.mts → cached.d.ts} +1 -1
- package/dist/database/{cached.mjs → cached.js} +2 -4
- package/dist/database/{database.mjs → database.js} +4 -8
- package/dist/database/{last-updated.d.mts → last-updated.d.ts} +1 -1
- package/dist/database/{last-updated.mjs → last-updated.js} +3 -1
- package/dist/database/models.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/marine/{id_utils.mjs → id_utils.js} +2 -2
- package/dist/marine/rtz.js +2 -0
- package/dist/types/{async-timeout-error.mjs → async-timeout-error.js} +1 -1
- package/dist/types/aws-env.js +2 -0
- package/dist/types/either.js +2 -0
- package/dist/types/{http-error.mjs → http-error.js} +1 -1
- package/dist/types/{input-error.mjs → input-error.js} +1 -1
- package/dist/types/{language.mjs → language.js} +1 -1
- package/dist/types/{nullable.d.mts → nullable.d.ts} +1 -1
- package/dist/types/nullable.js +2 -0
- package/dist/types/{traffictype.mjs → traffictype.js} +1 -1
- package/dist/types/urn.js +2 -0
- package/dist/types/util-types.js +2 -0
- package/dist/types/{validator.mjs → validator.js} +1 -1
- package/dist/utils/{api-model.d.mts → api-model.d.ts} +6 -5
- package/dist/utils/{api-model.mjs → api-model.js} +14 -15
- package/dist/utils/{base64.mjs → base64.js} +3 -3
- package/dist/utils/{date-utils.mjs → date-utils.js} +1 -1
- package/dist/utils/{geojson-types.d.mts → geojson-types.d.ts} +2 -2
- package/dist/utils/{geojson-types.mjs → geojson-types.js} +1 -1
- package/dist/utils/{geometry.d.mts → geometry.d.ts} +4 -3
- package/dist/utils/{geometry.mjs → geometry.js} +7 -4
- package/dist/utils/{logging.d.mts → logging.d.ts} +1 -1
- package/dist/utils/{logging.mjs → logging.js} +5 -8
- package/dist/utils/{retry.mjs → retry.js} +6 -8
- package/dist/utils/{slack.mjs → slack.js} +3 -3
- package/dist/utils/{utils.d.mts → utils.d.ts} +2 -3
- package/dist/utils/{utils.mjs → utils.js} +9 -5
- package/package.json +132 -129
- package/dist/aws/infra/canaries/canary-alarm.d.mts +0 -6
- package/dist/aws/infra/canaries/canary-parameters.mjs +0 -2
- package/dist/aws/infra/stacks/intra-stack-configuration.mjs +0 -2
- package/dist/aws/runtime/secrets/proxy-holder.mjs +0 -25
- package/dist/aws/runtime/secrets/rds-holder.mjs +0 -25
- package/dist/aws/types/model-with-reference.mjs +0 -2
- package/dist/aws/types/proxytypes.mjs +0 -2
- package/dist/aws/types/tags.mjs +0 -4
- package/dist/database/models.mjs +0 -2
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -2
- package/dist/marine/rtz.mjs +0 -2
- package/dist/types/aws-env.mjs +0 -2
- package/dist/types/either.mjs +0 -2
- package/dist/types/nullable.mjs +0 -2
- package/dist/types/urn.mjs +0 -2
- package/dist/types/util-types.mjs +0 -2
- /package/dist/{test/asserter.d.mts → __test__/asserter.d.ts} +0 -0
- /package/dist/__test__/{dependencies.test.d.mts → dependencies.test.d.ts} +0 -0
- /package/dist/__test__/{imports.test.d.mts → imports.test.d.ts} +0 -0
- /package/dist/__test__/infra/{acl-builder.test.d.mts → acl-builder.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{handler-factory.test.d.mts → handler-factory.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{response.test.d.mts → response.test.d.ts} +0 -0
- /package/dist/__test__/infra/api/{static-integration.test.d.mts → static-integration.test.d.ts} +0 -0
- /package/dist/__test__/infra/{documentation.test.d.mts → documentation.test.d.ts} +0 -0
- /package/dist/__test__/infra/{scheduler.test.d.mts → scheduler.test.d.ts} +0 -0
- /package/dist/__test__/infra/{security-rule.test.d.mts → security-rule.test.d.ts} +0 -0
- /package/dist/__test__/marine/{id_utils.test.d.mts → id_utils.test.d.ts} +0 -0
- /package/dist/{test/mock-ky.d.mts → __test__/mock-ky.d.ts} +0 -0
- /package/dist/__test__/promise/{promise.test.d.mts → promise.test.d.ts} +0 -0
- /package/dist/__test__/runtime/{dt-logger.test.d.mts → dt-logger.test.d.ts} +0 -0
- /package/dist/__test__/secrets/{secret-holder.test.d.mts → secret-holder.test.d.ts} +0 -0
- /package/dist/__test__/secrets/{secret.test.d.mts → secret.test.d.ts} +0 -0
- /package/dist/__test__/stack/{rest-apis.test.d.mts → rest-apis.test.d.ts} +0 -0
- /package/dist/__test__/test/{mock-ky.test.d.mts → mock-ky.test.d.ts} +0 -0
- /package/dist/{test/testutils.d.mts → __test__/testutils.d.ts} +0 -0
- /package/dist/__test__/types/{lambda-response.test.d.mts → lambda-response.test.d.ts} +0 -0
- /package/dist/__test__/utils/{date-utils.test.d.mts → date-utils.test.d.ts} +0 -0
- /package/dist/__test__/utils/{geometry.test.d.mts → geometry.test.d.ts} +0 -0
- /package/dist/__test__/utils/{logging.test.d.mts → logging.test.d.ts} +0 -0
- /package/dist/__test__/utils/{utils.test.d.mts → utils.test.d.ts} +0 -0
- /package/dist/aws/infra/canaries/{canary-keys.d.mts → canary-keys.d.ts} +0 -0
- /package/dist/aws/infra/stack/{parameters.d.mts → parameters.d.ts} +0 -0
- /package/dist/aws/infra/stack/{stack-checking-aspect.d.mts → stack-checking-aspect.d.ts} +0 -0
- /package/dist/aws/infra/stacks/{intra-stack-configuration.d.mts → intra-stack-configuration.d.ts} +0 -0
- /package/dist/aws/runtime/{apikey.d.mts → apikey.d.ts} +0 -0
- /package/dist/aws/runtime/{dt-logger.d.mts → dt-logger.d.ts} +0 -0
- /package/dist/aws/runtime/{environment.d.mts → environment.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{proxy-holder.d.mts → proxy-holder.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{rds-holder.d.mts → rds-holder.d.ts} +0 -0
- /package/dist/aws/runtime/secrets/{secret.d.mts → secret.d.ts} +0 -0
- /package/dist/aws/types/{errors.d.mts → errors.d.ts} +0 -0
- /package/dist/aws/types/{lambda-response.d.mts → lambda-response.d.ts} +0 -0
- /package/dist/aws/types/{mediatypes.d.mts → mediatypes.d.ts} +0 -0
- /package/dist/aws/types/{proxytypes.d.mts → proxytypes.d.ts} +0 -0
- /package/dist/aws/types/{tags.d.mts → tags.d.ts} +0 -0
- /package/dist/database/{database.d.mts → database.d.ts} +0 -0
- /package/dist/database/{models.d.mts → models.d.ts} +0 -0
- /package/dist/marine/{id_utils.d.mts → id_utils.d.ts} +0 -0
- /package/dist/marine/{rtz.d.mts → rtz.d.ts} +0 -0
- /package/dist/types/{async-timeout-error.d.mts → async-timeout-error.d.ts} +0 -0
- /package/dist/types/{aws-env.d.mts → aws-env.d.ts} +0 -0
- /package/dist/types/{either.d.mts → either.d.ts} +0 -0
- /package/dist/types/{http-error.d.mts → http-error.d.ts} +0 -0
- /package/dist/types/{input-error.d.mts → input-error.d.ts} +0 -0
- /package/dist/types/{language.d.mts → language.d.ts} +0 -0
- /package/dist/types/{traffictype.d.mts → traffictype.d.ts} +0 -0
- /package/dist/types/{urn.d.mts → urn.d.ts} +0 -0
- /package/dist/types/{util-types.d.mts → util-types.d.ts} +0 -0
- /package/dist/types/{validator.d.mts → validator.d.ts} +0 -0
- /package/dist/utils/{base64.d.mts → base64.d.ts} +0 -0
- /package/dist/utils/{date-utils.d.mts → date-utils.d.ts} +0 -0
- /package/dist/utils/{retry.d.mts → retry.d.ts} +0 -0
- /package/dist/utils/{slack.d.mts → slack.d.ts} +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Stack } from "aws-cdk-lib";
|
2
2
|
import { type Construct } from "constructs";
|
3
|
-
import type { InfraStackConfiguration } from "./intra-stack-configuration.
|
3
|
+
import type { InfraStackConfiguration } from "./intra-stack-configuration.js";
|
4
4
|
/**
|
5
5
|
* Creates a dns local zone and creates records for cluster endpoints and proxy endpoints.
|
6
6
|
*
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib";
|
2
2
|
import {} from "constructs";
|
3
|
-
import { PrivateHostedZone, RecordSet, RecordTarget, RecordType
|
4
|
-
import { importVpc } from "../import-util.
|
5
|
-
import { getParameterValue } from "../stack/parameters.
|
3
|
+
import { PrivateHostedZone, RecordSet, RecordTarget, RecordType } from "aws-cdk-lib/aws-route53";
|
4
|
+
import { importVpc } from "../import-util.js";
|
5
|
+
import { getParameterValue } from "../stack/parameters.js";
|
6
6
|
const DEFAULT_RECORD_TTL = Duration.seconds(30);
|
7
7
|
/**
|
8
8
|
* Creates a dns local zone and creates records for cluster endpoints and proxy endpoints.
|
@@ -58,4 +58,4 @@ export class DbDnsStack extends Stack {
|
|
58
58
|
});
|
59
59
|
}
|
60
60
|
}
|
61
|
-
//# sourceMappingURL=db-dns-stack.
|
61
|
+
//# sourceMappingURL=db-dns-stack.js.map
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { CfnDBProxyEndpoint, DatabaseProxy } from "aws-cdk-lib/aws-rds";
|
2
2
|
import { type ISecret } from "aws-cdk-lib/aws-secretsmanager";
|
3
3
|
import { type IVpc } from "aws-cdk-lib/aws-ec2";
|
4
|
-
import type { InfraStackConfiguration } from "./intra-stack-configuration.
|
4
|
+
import type { InfraStackConfiguration } from "./intra-stack-configuration.js";
|
5
5
|
import { Stack } from "aws-cdk-lib/core";
|
6
|
-
import { Construct } from "constructs/lib/construct.js";
|
6
|
+
import type { Construct } from "constructs/lib/construct.js";
|
7
7
|
export interface ProxyConfiguration {
|
8
8
|
readonly secretArn: string;
|
9
9
|
readonly name?: string;
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import { CfnDBProxyEndpoint, DatabaseCluster, DatabaseClusterEngine, DatabaseProxy, ProxyTarget, } from "aws-cdk-lib/aws-rds";
|
2
2
|
import { Secret } from "aws-cdk-lib/aws-secretsmanager";
|
3
3
|
import { SecurityGroup } from "aws-cdk-lib/aws-ec2";
|
4
|
-
import { DbStack } from "./db-stack.
|
5
|
-
import { exportValue, importVpc } from "../import-util.
|
6
|
-
import { createParameter } from "../stack/parameters.
|
7
|
-
import {
|
8
|
-
import { Construct } from "constructs/lib/construct.js";
|
4
|
+
import { DbStack } from "./db-stack.js";
|
5
|
+
import { exportValue, importVpc } from "../import-util.js";
|
6
|
+
import { createParameter } from "../stack/parameters.js";
|
7
|
+
import { Duration, Stack } from "aws-cdk-lib/core";
|
9
8
|
/**
|
10
9
|
* A stack that creates a Database proxy.
|
11
10
|
*/
|
@@ -72,4 +71,4 @@ export class DbProxyStack extends Stack {
|
|
72
71
|
});
|
73
72
|
}
|
74
73
|
}
|
75
|
-
//# sourceMappingURL=db-proxy-stack.
|
74
|
+
//# sourceMappingURL=db-proxy-stack.js.map
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { InstanceType, type
|
2
|
-
import { AuroraPostgresEngineVersion, DatabaseCluster, type DatabaseClusterProps, type IParameterGroup } from "aws-cdk-lib/aws-rds";
|
3
|
-
import { Construct } from "constructs/lib/construct.js";
|
4
|
-
import type { InfraStackConfiguration } from "./intra-stack-configuration.
|
1
|
+
import { type InstanceType, type ISecurityGroup, type IVpc } from "aws-cdk-lib/aws-ec2";
|
2
|
+
import { type AuroraPostgresEngineVersion, DatabaseCluster, type DatabaseClusterProps, type IParameterGroup } from "aws-cdk-lib/aws-rds";
|
3
|
+
import type { Construct } from "constructs/lib/construct.js";
|
4
|
+
import type { InfraStackConfiguration } from "./intra-stack-configuration.js";
|
5
5
|
import { Stack } from "aws-cdk-lib/core";
|
6
6
|
export interface DbConfiguration {
|
7
7
|
readonly cluster?: ClusterConfiguration;
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { Construct } from "constructs/lib/construct.js";
|
1
|
+
import { SecurityGroup, SubnetType, } from "aws-cdk-lib/aws-ec2";
|
2
|
+
import { CfnDBInstance, Credentials, DatabaseCluster, DatabaseClusterEngine, DatabaseClusterFromSnapshot, InstanceUpdateBehaviour, ParameterGroup, } from "aws-cdk-lib/aws-rds";
|
4
3
|
import { Secret } from "aws-cdk-lib/aws-secretsmanager";
|
5
|
-
import { exportValue, importVpc } from "../import-util.
|
4
|
+
import { exportValue, importVpc } from "../import-util.js";
|
6
5
|
import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib/core";
|
7
|
-
import { createParameter } from "../stack/parameters.
|
6
|
+
import { createParameter } from "../stack/parameters.js";
|
8
7
|
/**
|
9
8
|
* Stack that creates DatabaseCluster.
|
10
9
|
*
|
@@ -102,11 +101,9 @@ export class DbStack extends Stack {
|
|
102
101
|
createAuroraCluster(isc, configuration, clusterConfiguration, parameterGroups) {
|
103
102
|
const instanceName = isc.environmentName + "-db";
|
104
103
|
const securityGroup = SecurityGroup.fromSecurityGroupId(this, "securitygroup", clusterConfiguration.securityGroupId);
|
105
|
-
const vpc = configuration.vpc
|
106
|
-
? configuration.vpc
|
107
|
-
: importVpc(this, isc.environmentName);
|
104
|
+
const vpc = configuration.vpc ? configuration.vpc : importVpc(this, isc.environmentName);
|
108
105
|
if (parameterGroups[0] === undefined) {
|
109
|
-
throw Error(
|
106
|
+
throw Error("ParameterGroups should not be empty");
|
110
107
|
}
|
111
108
|
const parameters = this.createClusterParameters(configuration.secretArn, clusterConfiguration, instanceName, vpc, securityGroup, parameterGroups[0]);
|
112
109
|
// create cluster from the snapshot or from the scratch
|
@@ -127,4 +124,4 @@ export class DbStack extends Stack {
|
|
127
124
|
return cluster;
|
128
125
|
}
|
129
126
|
}
|
130
|
-
//# sourceMappingURL=db-stack.
|
127
|
+
//# sourceMappingURL=db-stack.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type IVpc, Vpc } from "aws-cdk-lib/aws-ec2";
|
2
|
-
import type { InfraStackConfiguration } from "./intra-stack-configuration.
|
2
|
+
import type { InfraStackConfiguration } from "./intra-stack-configuration.js";
|
3
3
|
import { Stack } from "aws-cdk-lib/core";
|
4
|
-
import { Construct } from "constructs/lib/construct.js";
|
4
|
+
import type { Construct } from "constructs/lib/construct.js";
|
5
5
|
export interface NetworkConfiguration {
|
6
6
|
readonly vpcName: string;
|
7
7
|
readonly cidr: string;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { IpAddresses, SubnetType, Vpc } from "aws-cdk-lib/aws-ec2";
|
2
|
-
import { exportValue } from "../import-util.
|
2
|
+
import { exportValue } from "../import-util.js";
|
3
3
|
import { Stack } from "aws-cdk-lib/core";
|
4
|
-
import { Construct } from "constructs/lib/construct.js";
|
5
4
|
export class NetworkStack extends Stack {
|
6
5
|
vpc;
|
7
6
|
constructor(scope, id, isc, configuration) {
|
@@ -13,7 +12,7 @@ export class NetworkStack extends Stack {
|
|
13
12
|
this.vpc.publicSubnets[1] === undefined ||
|
14
13
|
this.vpc.privateSubnets[0] === undefined ||
|
15
14
|
this.vpc.privateSubnets[1] === undefined) {
|
16
|
-
throw Error(
|
15
|
+
throw Error("Subnets are not set correctly");
|
17
16
|
}
|
18
17
|
exportValue(this, isc.environmentName, "VPCID", this.vpc.vpcId);
|
19
18
|
exportValue(this, isc.environmentName, "digitrafficpublicASubnet", this.vpc.publicSubnets[0].subnetId);
|
@@ -24,9 +23,7 @@ export class NetworkStack extends Stack {
|
|
24
23
|
createVpc(configuration) {
|
25
24
|
return new Vpc(this, "DigitrafficVPC", {
|
26
25
|
vpcName: configuration.vpcName,
|
27
|
-
availabilityZones: Stack.of(this)
|
28
|
-
.availabilityZones.sort()
|
29
|
-
.slice(0, 2), // take two first azs
|
26
|
+
availabilityZones: Stack.of(this).availabilityZones.sort().slice(0, 2), // take two first azs
|
30
27
|
enableDnsHostnames: true,
|
31
28
|
enableDnsSupport: true,
|
32
29
|
ipAddresses: IpAddresses.cidr(configuration.cidr),
|
@@ -45,4 +42,4 @@ export class NetworkStack extends Stack {
|
|
45
42
|
});
|
46
43
|
}
|
47
44
|
}
|
48
|
-
//# sourceMappingURL=network-stack.
|
45
|
+
//# sourceMappingURL=network-stack.js.map
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { RestApi } from "aws-cdk-lib/aws-apigateway";
|
2
1
|
/**
|
3
2
|
* Creates an usage plan for a REST API with a single API key
|
4
3
|
* @param api The REST API
|
@@ -36,4 +35,4 @@ export function createDefaultUsagePlan(api, apiName, value) {
|
|
36
35
|
plan.addApiKey(apiKey);
|
37
36
|
return apiKey;
|
38
37
|
}
|
39
|
-
//# sourceMappingURL=usage-plans.
|
38
|
+
//# sourceMappingURL=usage-plans.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { IntegrationResponse } from "aws-cdk-lib/aws-apigateway";
|
2
|
-
import { MediaType } from "../types/mediatypes.
|
2
|
+
import { MediaType } from "../types/mediatypes.js";
|
3
3
|
export declare abstract class DigitrafficIntegrationResponse {
|
4
4
|
static ok(mediaType: MediaType, sunset?: string): IntegrationResponse;
|
5
5
|
static badRequest(mediaType?: MediaType): IntegrationResponse;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { MediaType } from "../types/mediatypes.
|
2
|
-
import { getDeprecatedDefaultLambdaResponse, RESPONSE_DEFAULT_LAMBDA
|
1
|
+
import { MediaType } from "../types/mediatypes.js";
|
2
|
+
import { getDeprecatedDefaultLambdaResponse, RESPONSE_DEFAULT_LAMBDA } from "../infra/api/response.js";
|
3
3
|
export class DigitrafficIntegrationResponse {
|
4
4
|
static ok(mediaType, sunset) {
|
5
5
|
return this.create("200", mediaType, sunset);
|
@@ -14,11 +14,9 @@ export class DigitrafficIntegrationResponse {
|
|
14
14
|
return {
|
15
15
|
statusCode,
|
16
16
|
responseTemplates: {
|
17
|
-
[mediaType]: sunset
|
18
|
-
? getDeprecatedDefaultLambdaResponse(sunset)
|
19
|
-
: RESPONSE_DEFAULT_LAMBDA,
|
17
|
+
[mediaType]: sunset ? getDeprecatedDefaultLambdaResponse(sunset) : RESPONSE_DEFAULT_LAMBDA,
|
20
18
|
},
|
21
19
|
};
|
22
20
|
}
|
23
21
|
}
|
24
|
-
//# sourceMappingURL=digitraffic-integration-response.
|
22
|
+
//# sourceMappingURL=digitraffic-integration-response.js.map
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { DtLogger } from "./dt-logger.
|
1
|
+
import { DtLogger } from "./dt-logger.js";
|
2
2
|
/**
|
3
3
|
* You can use this for method name definition to match DtLogger LoggableType.method parameter.
|
4
4
|
*/
|
5
|
-
export type { LoggerMethodType } from "./dt-logger.
|
5
|
+
export type { LoggerMethodType } from "./dt-logger.js";
|
6
6
|
/**
|
7
7
|
* You can use this for your logging needs or create one locally and configure it as you wish.
|
8
8
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { DtLogger } from "./dt-logger.
|
1
|
+
import { DtLogger } from "./dt-logger.js";
|
2
2
|
/**
|
3
3
|
* You can use this for your logging needs or create one locally and configure it as you wish.
|
4
4
|
*/
|
5
5
|
export const logger = new DtLogger();
|
6
|
-
//# sourceMappingURL=dt-logger-default.
|
6
|
+
//# sourceMappingURL=dt-logger-default.js.map
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { lowerFirst, mapKeys } from "lodash-es";
|
2
|
+
import { getEnvVariableOrElse } from "../../utils/utils.js";
|
2
3
|
/**
|
3
4
|
* Helper class for json-logging.
|
4
5
|
*
|
@@ -18,8 +19,9 @@ export class DtLogger {
|
|
18
19
|
* @param {LoggerConfiguration?} [config] - Accepts configuration options @see {@link LoggerConfiguration}
|
19
20
|
*/
|
20
21
|
constructor(config) {
|
21
|
-
this.lambdaName =
|
22
|
-
|
22
|
+
this.lambdaName =
|
23
|
+
config?.lambdaName ?? getEnvVariableOrElse("AWS_LAMBDA_FUNCTION_NAME", "unknown lambda name");
|
24
|
+
this.runtime = config?.runTime ?? getEnvVariableOrElse("AWS_EXECUTION_ENV", "unknown runtime");
|
23
25
|
this.writeStream = config?.writeStream ?? process.stdout;
|
24
26
|
}
|
25
27
|
/**
|
@@ -96,7 +98,10 @@ export class DtLogger {
|
|
96
98
|
this.writeStream.write(JSON.stringify(logMessage) + "\n");
|
97
99
|
}
|
98
100
|
}
|
101
|
+
/**
|
102
|
+
* Removes given prefixes from the keys of the object.
|
103
|
+
*/
|
99
104
|
function removePrefix(prefix, loggable) {
|
100
105
|
return mapKeys(loggable, (_index, key) => key.startsWith(prefix) ? lowerFirst(key.replace(prefix, "")) : key);
|
101
106
|
}
|
102
|
-
//# sourceMappingURL=dt-logger.
|
107
|
+
//# sourceMappingURL=dt-logger.js.map
|
@@ -9,7 +9,7 @@ export var EnvKeys;
|
|
9
9
|
*/
|
10
10
|
export function envValue(key, defaultValue) {
|
11
11
|
const value = process.env[key];
|
12
|
-
if (value
|
12
|
+
if (value === null || value === undefined) {
|
13
13
|
if (defaultValue) {
|
14
14
|
return defaultValue;
|
15
15
|
}
|
@@ -17,4 +17,4 @@ export function envValue(key, defaultValue) {
|
|
17
17
|
}
|
18
18
|
return value;
|
19
19
|
}
|
20
|
-
//# sourceMappingURL=environment.
|
20
|
+
//# sourceMappingURL=environment.js.map
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { ObjectCannedACL } from "@aws-sdk/client-s3";
|
2
|
-
import { S3Client } from "@aws-sdk/client-s3";
|
2
|
+
import { type S3Client } from "@aws-sdk/client-s3";
|
3
3
|
import { type NodeJsRuntimeStreamingBlobPayloadInputTypes } from "@smithy/types";
|
4
4
|
export declare function uploadToS3(s3: S3Client, bucketName: string, body: NodeJsRuntimeStreamingBlobPayloadInputTypes, objectName: string, cannedAcl?: ObjectCannedACL, contentType?: string): Promise<void>;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { PutObjectCommand
|
1
|
+
import { PutObjectCommand } from "@aws-sdk/client-s3";
|
2
2
|
import {} from "@smithy/types";
|
3
|
-
import { logger } from "./dt-logger-default.
|
3
|
+
import { logger } from "./dt-logger-default.js";
|
4
4
|
export async function uploadToS3(s3, bucketName, body, objectName, cannedAcl, contentType) {
|
5
5
|
const command = new PutObjectCommand({
|
6
6
|
Bucket: bucketName,
|
@@ -19,4 +19,4 @@ export async function uploadToS3(s3, bucketName, body, objectName, cannedAcl, co
|
|
19
19
|
});
|
20
20
|
}
|
21
21
|
}
|
22
|
-
//# sourceMappingURL=s3.
|
22
|
+
//# sourceMappingURL=s3.js.map
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { logger } from "../dt-logger-default.js";
|
1
2
|
export var RdsProxySecretKey;
|
2
3
|
(function (RdsProxySecretKey) {
|
3
4
|
RdsProxySecretKey["username"] = "username";
|
@@ -15,8 +16,11 @@ export var RdsSecretKey;
|
|
15
16
|
export function checkExpectedSecretKeys(keys, secret) {
|
16
17
|
const missingKeys = keys.filter((key) => !(key in secret));
|
17
18
|
if (missingKeys.length) {
|
18
|
-
|
19
|
+
logger.error({
|
20
|
+
method: "dbsecret.checkExpectedSecretKeys",
|
21
|
+
message: `secret didn't contain the key(s) ${missingKeys.toString()}`,
|
22
|
+
});
|
19
23
|
throw new Error("Expected keys were not found");
|
20
24
|
}
|
21
25
|
}
|
22
|
-
//# sourceMappingURL=dbsecret.
|
26
|
+
//# sourceMappingURL=dbsecret.js.map
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { SecretHolder } from "./secret-holder.js";
|
2
|
+
import { RdsProxySecretKey } from "./dbsecret.js";
|
3
|
+
import { getEnvVariable, setEnvVariable } from "../../../utils/utils.js";
|
4
|
+
import { DatabaseEnvironmentKeys } from "../../../database/database.js";
|
5
|
+
const RDS_PROXY_SECRET_KEYS = Object.values(RdsProxySecretKey);
|
6
|
+
/**
|
7
|
+
* Holds credentials for RDS Proxy access.
|
8
|
+
*/
|
9
|
+
export class ProxyHolder {
|
10
|
+
secretHolder;
|
11
|
+
constructor(secretId) {
|
12
|
+
this.secretHolder = new SecretHolder(secretId, "", RDS_PROXY_SECRET_KEYS);
|
13
|
+
}
|
14
|
+
static create() {
|
15
|
+
return new ProxyHolder(getEnvVariable("SECRET_ID"));
|
16
|
+
}
|
17
|
+
async setCredentials() {
|
18
|
+
const secret = await this.secretHolder.get();
|
19
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_USER, secret.username);
|
20
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_PASS, secret.password);
|
21
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_URI, secret.proxy_host);
|
22
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_RO_URI, secret.proxy_ro_host);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
//# sourceMappingURL=proxy-holder.js.map
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { SecretHolder } from "./secret-holder.js";
|
2
|
+
import { RdsSecretKey } from "./dbsecret.js";
|
3
|
+
import { getEnvVariable, setEnvVariable } from "../../../utils/utils.js";
|
4
|
+
import { DatabaseEnvironmentKeys } from "../../../database/database.js";
|
5
|
+
const RDS_SECRET_KEYS = Object.values(RdsSecretKey);
|
6
|
+
/**
|
7
|
+
* Holds credentials for RDS access.
|
8
|
+
*/
|
9
|
+
export class RdsHolder {
|
10
|
+
secretHolder;
|
11
|
+
constructor(secretId) {
|
12
|
+
this.secretHolder = new SecretHolder(secretId, "", RDS_SECRET_KEYS);
|
13
|
+
}
|
14
|
+
static create() {
|
15
|
+
return new RdsHolder(getEnvVariable("SECRET_ID"));
|
16
|
+
}
|
17
|
+
async setCredentials() {
|
18
|
+
const secret = await this.secretHolder.get();
|
19
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_USER, secret.username);
|
20
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_PASS, secret.password);
|
21
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_URI, secret.host);
|
22
|
+
setEnvVariable(DatabaseEnvironmentKeys.DB_RO_URI, secret.ro_host);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
//# sourceMappingURL=rds-holder.js.map
|
@@ -1,4 +1,7 @@
|
|
1
|
-
import { type GenericSecret } from "./secret.
|
1
|
+
import { type GenericSecret } from "./secret.js";
|
2
|
+
declare const DEFAULT_CONFIGURATION: {
|
3
|
+
readonly ttl: number;
|
4
|
+
};
|
2
5
|
/**
|
3
6
|
* Utility class for getting secrets from Secret Manager.
|
4
7
|
* Supports prefix for secrets, checking of expected keys and ttl-configuration.
|
@@ -9,19 +12,17 @@ import { type GenericSecret } from "./secret.mjs";
|
|
9
12
|
*
|
10
13
|
* If you want secret manager to get values from different region than the lambda runtime is running, you can override this by
|
11
14
|
* setting the region with utils setSecretOverideAwsRegionEnv method.
|
12
|
-
*
|
13
15
|
*/
|
14
16
|
export declare class SecretHolder<Secret extends GenericSecret> {
|
15
17
|
private readonly secretId;
|
16
18
|
private readonly prefix;
|
17
19
|
private readonly expectedKeys;
|
18
20
|
private readonly secretCache;
|
19
|
-
constructor(secretId: string, prefix?: string, expectedKeys?: string[], configuration?:
|
20
|
-
ttl: number;
|
21
|
-
});
|
21
|
+
constructor(secretId: string, prefix?: string, expectedKeys?: string[], configuration?: typeof DEFAULT_CONFIGURATION);
|
22
22
|
private initSecret;
|
23
23
|
static create<S extends GenericSecret>(prefix?: string, expectedKeys?: string[]): SecretHolder<S>;
|
24
24
|
get(): Promise<Secret>;
|
25
25
|
private parseSecret;
|
26
26
|
private getSecret;
|
27
27
|
}
|
28
|
+
export {};
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { getSecret } from "./secret.
|
2
|
-
import { checkExpectedSecretKeys } from "./dbsecret.
|
3
|
-
import { getEnvVariable } from "../../../utils/utils.
|
4
|
-
import { logger } from "../dt-logger-default.
|
1
|
+
import { getSecret } from "./secret.js";
|
2
|
+
import { checkExpectedSecretKeys } from "./dbsecret.js";
|
3
|
+
import { getEnvVariable } from "../../../utils/utils.js";
|
4
|
+
import { logger } from "../dt-logger-default.js";
|
5
5
|
import NodeTtl from "node-ttl";
|
6
6
|
const DEFAULT_PREFIX = "";
|
7
7
|
const DEFAULT_SECRET_KEY = "SECRET";
|
@@ -18,7 +18,6 @@ const DEFAULT_CONFIGURATION = {
|
|
18
18
|
*
|
19
19
|
* If you want secret manager to get values from different region than the lambda runtime is running, you can override this by
|
20
20
|
* setting the region with utils setSecretOverideAwsRegionEnv method.
|
21
|
-
*
|
22
21
|
*/
|
23
22
|
export class SecretHolder {
|
24
23
|
secretId;
|
@@ -29,7 +28,6 @@ export class SecretHolder {
|
|
29
28
|
this.secretId = secretId;
|
30
29
|
this.prefix = prefix;
|
31
30
|
this.expectedKeys = expectedKeys;
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
33
31
|
this.secretCache = new NodeTtl(configuration);
|
34
32
|
}
|
35
33
|
async initSecret() {
|
@@ -38,7 +36,6 @@ export class SecretHolder {
|
|
38
36
|
method: "SecretHolder.initSecret",
|
39
37
|
message: "Refreshing secret " + this.secretId,
|
40
38
|
});
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
42
39
|
this.secretCache.push(DEFAULT_SECRET_KEY, secretValue);
|
43
40
|
}
|
44
41
|
static create(prefix = DEFAULT_PREFIX, expectedKeys = []) {
|
@@ -46,9 +43,7 @@ export class SecretHolder {
|
|
46
43
|
}
|
47
44
|
async get() {
|
48
45
|
const secret = await this.getSecret();
|
49
|
-
const parsedSecret = this.prefix === DEFAULT_PREFIX
|
50
|
-
? secret
|
51
|
-
: this.parseSecret(secret, `${this.prefix}.`);
|
46
|
+
const parsedSecret = this.prefix === DEFAULT_PREFIX ? secret : this.parseSecret(secret, `${this.prefix}.`);
|
52
47
|
if (this.expectedKeys.length > 0) {
|
53
48
|
checkExpectedSecretKeys(this.expectedKeys, parsedSecret);
|
54
49
|
}
|
@@ -60,6 +55,10 @@ export class SecretHolder {
|
|
60
55
|
for (const key in secret) {
|
61
56
|
if (key.startsWith(prefix)) {
|
62
57
|
const withoutPrefix = key.substring(skip);
|
58
|
+
// skip undefined values
|
59
|
+
if (!secret[key]) {
|
60
|
+
continue;
|
61
|
+
}
|
63
62
|
parsed[withoutPrefix] = secret[key];
|
64
63
|
}
|
65
64
|
}
|
@@ -70,7 +69,7 @@ export class SecretHolder {
|
|
70
69
|
if (!secret) {
|
71
70
|
await this.initSecret();
|
72
71
|
}
|
73
|
-
return secret ??
|
72
|
+
return secret ?? this.secretCache.get(DEFAULT_SECRET_KEY);
|
74
73
|
}
|
75
74
|
}
|
76
|
-
//# sourceMappingURL=secret-holder.
|
75
|
+
//# sourceMappingURL=secret-holder.js.map
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SecretsManager } from "@aws-sdk/client-secrets-manager";
|
2
|
-
import { getEnvVariable, getEnvVariableOrElse, getEnvVariableSafe } from "../../../utils/utils.
|
3
|
-
import { EnvKeys } from "../environment.
|
2
|
+
import { getEnvVariable, getEnvVariableOrElse, getEnvVariableSafe } from "../../../utils/utils.js";
|
3
|
+
import { EnvKeys } from "../environment.js";
|
4
4
|
// SECRET_OVERRIDE_AWS_REGION might not have been set before import of
|
5
5
|
// secret, so we need to lazy initialize SecretsManager
|
6
6
|
let smClient;
|
@@ -32,6 +32,10 @@ function parseSecret(secret, prefix) {
|
|
32
32
|
for (const key in secret) {
|
33
33
|
if (key.startsWith(prefix)) {
|
34
34
|
const withoutPrefix = key.substring(skip);
|
35
|
+
// skip undefined values
|
36
|
+
if (!secret[key]) {
|
37
|
+
continue;
|
38
|
+
}
|
35
39
|
parsed[withoutPrefix] = secret[key];
|
36
40
|
}
|
37
41
|
}
|
@@ -54,4 +58,4 @@ export async function getFromEnvOrSecret(key, secretId) {
|
|
54
58
|
}
|
55
59
|
throw new Error(`Cannot get value with key ${key} from env or secret`);
|
56
60
|
}
|
57
|
-
//# sourceMappingURL=secret.
|
61
|
+
//# sourceMappingURL=secret.js.map
|
@@ -32,10 +32,8 @@ export function getJsonFromCache(db, cacheKey) {
|
|
32
32
|
.then((value) => value?.content ?? undefined);
|
33
33
|
}
|
34
34
|
export async function getFromCache(db, cacheKey) {
|
35
|
-
return db
|
36
|
-
.oneOrNone(PS_GET_CACHE_VALUE, [cacheKey])
|
37
|
-
.then((result) => {
|
35
|
+
return db.oneOrNone(PS_GET_CACHE_VALUE, [cacheKey]).then((result) => {
|
38
36
|
return result ?? undefined;
|
39
37
|
});
|
40
38
|
}
|
41
|
-
//# sourceMappingURL=cached.
|
39
|
+
//# sourceMappingURL=cached.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {} from "pg-promise";
|
2
|
-
import { getEnvVariable, getEnvVariableOrElse } from "../utils/utils.
|
3
|
-
import { logger } from "../aws/runtime/dt-logger-default.
|
4
|
-
import { logException } from "../utils/logging.
|
2
|
+
import { getEnvVariable, getEnvVariableOrElse } from "../utils/utils.js";
|
3
|
+
import { logger } from "../aws/runtime/dt-logger-default.js";
|
4
|
+
import { logException } from "../utils/logging.js";
|
5
5
|
export var DatabaseEnvironmentKeys;
|
6
6
|
(function (DatabaseEnvironmentKeys) {
|
7
7
|
DatabaseEnvironmentKeys["DB_USER"] = "DB_USER";
|
@@ -13,15 +13,12 @@ export var DatabaseEnvironmentKeys;
|
|
13
13
|
import pgpImport from "pg-promise";
|
14
14
|
const pgp = pgpImport();
|
15
15
|
// convert numeric types to number instead of string
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
17
16
|
pgp.pg.types.setTypeParser(pgp.pg.types.builtins.INT8, (value) => {
|
18
17
|
return parseInt(value);
|
19
18
|
});
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
21
19
|
pgp.pg.types.setTypeParser(pgp.pg.types.builtins.FLOAT8, (value) => {
|
22
20
|
return parseFloat(value);
|
23
21
|
});
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
25
22
|
pgp.pg.types.setTypeParser(pgp.pg.types.builtins.NUMERIC, (value) => {
|
26
23
|
return parseFloat(value);
|
27
24
|
});
|
@@ -39,7 +36,6 @@ pgp.pg.types.setTypeParser(pgp.pg.types.builtins.NUMERIC, (value) => {
|
|
39
36
|
*/
|
40
37
|
export function initDbConnection(username, password, applicationName, url, options) {
|
41
38
|
const finalUrl = `postgresql://${username}:${password}@${url}?application_name=${applicationName}`;
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
43
39
|
return pgp(finalUrl, options);
|
44
40
|
}
|
45
41
|
export function inTransaction(fn) {
|
@@ -71,4 +67,4 @@ async function doInDatabase(readonly, fn) {
|
|
71
67
|
await db.$pool.end();
|
72
68
|
}
|
73
69
|
}
|
74
|
-
//# sourceMappingURL=database.
|
70
|
+
//# sourceMappingURL=database.js.map
|