@digitraffic/common 2024.1.10-1 → 2024.1.23-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/aws/infra/api/{handler-factory.d.ts → handler-factory.d.mts} +2 -2
- package/dist/aws/infra/api/{handler-factory.js → handler-factory.mjs} +5 -10
- package/dist/aws/infra/api/{integration.d.ts → integration.d.mts} +1 -1
- package/dist/aws/infra/api/{integration.js → integration.mjs} +10 -14
- package/dist/aws/infra/api/{response.d.ts → response.d.mts} +2 -3
- package/dist/aws/infra/api/{response.js → response.mjs} +26 -31
- package/dist/aws/infra/api/{responses.d.ts → responses.d.mts} +2 -3
- package/dist/aws/infra/api/responses.mjs +78 -0
- package/dist/aws/infra/api/{static-integration.d.ts → static-integration.d.mts} +1 -1
- package/dist/aws/infra/api/{static-integration.js → static-integration.mjs} +8 -12
- package/dist/aws/infra/canaries/{canary-alarm.d.ts → canary-alarm.d.mts} +1 -1
- package/dist/aws/infra/canaries/canary-alarm.mjs +20 -0
- package/dist/aws/infra/canaries/canary-keys.mjs +4 -0
- package/dist/aws/infra/canaries/canary-parameters.mjs +2 -0
- package/dist/aws/infra/canaries/{canary-role.js → canary-role.mjs} +9 -13
- package/dist/aws/infra/canaries/{canary.d.ts → canary.d.mts} +2 -2
- package/dist/aws/infra/canaries/canary.mjs +26 -0
- package/dist/aws/infra/canaries/{database-canary.d.ts → database-canary.d.mts} +3 -3
- package/dist/aws/infra/canaries/{database-canary.js → database-canary.mjs} +9 -13
- package/dist/aws/infra/canaries/{database-checker.d.ts → database-checker.d.mts} +1 -1
- package/dist/aws/infra/canaries/{database-checker.js → database-checker.mjs} +12 -18
- package/dist/aws/infra/canaries/{url-canary.d.ts → url-canary.d.mts} +4 -4
- package/dist/aws/infra/canaries/{url-canary.js → url-canary.mjs} +9 -13
- package/dist/aws/infra/canaries/{url-checker.d.ts → url-checker.d.mts} +2 -2
- package/dist/aws/infra/canaries/{url-checker.js → url-checker.mjs} +35 -42
- package/dist/aws/infra/{documentation.js → documentation.mjs} +9 -17
- package/dist/aws/infra/{import-util.js → import-util.mjs} +11 -19
- package/dist/aws/infra/scheduler.mjs +27 -0
- package/dist/aws/infra/{security-rule.js → security-rule.mjs} +5 -9
- package/dist/aws/infra/{sqs-integration.d.ts → sqs-integration.d.mts} +1 -2
- package/dist/aws/infra/{sqs-integration.js → sqs-integration.mjs} +12 -16
- package/dist/aws/infra/{sqs-queue.d.ts → sqs-queue.d.mts} +1 -1
- package/dist/aws/infra/{sqs-queue.js → sqs-queue.mjs} +33 -41
- package/dist/aws/infra/stack/{lambda-configs.d.ts → lambda-configs.d.mts} +2 -2
- package/dist/aws/infra/stack/{lambda-configs.js → lambda-configs.mjs} +15 -21
- package/dist/aws/infra/stack/{monitoredfunction.d.ts → monitoredfunction.d.mts} +3 -3
- package/dist/aws/infra/stack/{monitoredfunction.js → monitoredfunction.mjs} +20 -28
- package/dist/aws/infra/stack/{parameters.d.ts → parameters.d.mts} +1 -1
- package/dist/aws/infra/stack/{parameters.js → parameters.mjs} +6 -11
- package/dist/aws/infra/stack/{rest_apis.d.ts → rest_apis.d.mts} +3 -3
- package/dist/aws/infra/stack/{rest_apis.js → rest_apis.mjs} +42 -55
- package/dist/aws/infra/stack/{stack-checking-aspect.d.ts → stack-checking-aspect.d.mts} +1 -1
- package/dist/aws/infra/stack/{stack-checking-aspect.js → stack-checking-aspect.mjs} +25 -32
- package/dist/aws/infra/stack/{stack.d.ts → stack.d.mts} +3 -4
- package/dist/aws/infra/stack/stack.mjs +63 -0
- package/dist/aws/infra/stack/{subscription.d.ts → subscription.d.mts} +2 -2
- package/dist/aws/infra/stack/{subscription.js → subscription.mjs} +6 -11
- package/dist/aws/infra/stacks/{db-dns-stack.d.ts → db-dns-stack.d.mts} +2 -2
- package/dist/aws/infra/stacks/db-dns-stack.mjs +60 -0
- package/dist/aws/infra/stacks/{db-proxy-stack.d.ts → db-proxy-stack.d.mts} +2 -2
- package/dist/aws/infra/stacks/db-proxy-stack.mjs +73 -0
- package/dist/aws/infra/stacks/{db-stack.d.ts → db-stack.d.mts} +3 -4
- package/dist/aws/infra/stacks/{db-stack.js → db-stack.mjs} +31 -35
- package/dist/aws/infra/stacks/intra-stack-configuration.mjs +2 -0
- package/dist/aws/infra/stacks/{network-stack.d.ts → network-stack.d.mts} +2 -2
- package/dist/aws/infra/stacks/network-stack.mjs +40 -0
- package/dist/aws/infra/{usage-plans.js → usage-plans.mjs} +3 -8
- package/dist/aws/runtime/apikey.mjs +9 -0
- package/dist/aws/runtime/{digitraffic-integration-response.d.ts → digitraffic-integration-response.d.mts} +1 -1
- package/dist/aws/runtime/digitraffic-integration-response.mjs +24 -0
- package/dist/aws/runtime/{dt-logger-default.d.ts → dt-logger-default.d.mts} +2 -2
- package/dist/aws/runtime/dt-logger-default.mjs +6 -0
- package/dist/aws/runtime/{dt-logger.d.ts → dt-logger.d.mts} +1 -1
- package/dist/aws/runtime/{dt-logger.js → dt-logger.mjs} +4 -11
- package/dist/aws/runtime/{environment.js → environment.mjs} +4 -8
- package/dist/aws/runtime/{messaging.js → messaging.mjs} +2 -6
- package/dist/aws/runtime/{s3.js → s3.mjs} +4 -8
- package/dist/aws/runtime/secrets/{dbsecret.d.ts → dbsecret.d.mts} +1 -1
- package/dist/aws/runtime/secrets/{dbsecret.js → dbsecret.mjs} +6 -10
- package/dist/aws/runtime/secrets/proxy-holder.mjs +24 -0
- package/dist/aws/runtime/secrets/rds-holder.mjs +24 -0
- package/dist/aws/runtime/secrets/{secret-holder.d.ts → secret-holder.d.mts} +1 -1
- package/dist/aws/runtime/secrets/{secret-holder.js → secret-holder.mjs} +14 -19
- package/dist/aws/runtime/secrets/{secret.js → secret.mjs} +8 -12
- package/dist/aws/types/errors.mjs +12 -0
- package/dist/aws/types/{lambda-response.js → lambda-response.mjs} +4 -11
- package/dist/aws/types/{mediatypes.js → mediatypes.mjs} +3 -6
- package/dist/aws/types/model-with-reference.mjs +2 -0
- package/dist/aws/types/proxytypes.mjs +2 -0
- package/dist/aws/types/tags.mjs +4 -0
- package/dist/database/{cached.d.ts → cached.d.mts} +1 -1
- package/dist/database/{cached.js → cached.mjs} +10 -15
- package/dist/database/{database.d.ts → database.d.mts} +1 -1
- package/dist/database/{database.js → database.mjs} +17 -24
- package/dist/database/{last-updated.d.ts → last-updated.d.mts} +1 -1
- package/dist/database/{last-updated.js → last-updated.mjs} +9 -18
- package/dist/database/models.mjs +2 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +2 -0
- package/dist/marine/{id_utils.js → id_utils.mjs} +4 -10
- package/dist/marine/rtz.mjs +2 -0
- package/dist/test/{asserter.js → asserter.mjs} +2 -6
- package/dist/test/{db-testutils.d.ts → db-testutils.d.mts} +1 -1
- package/dist/test/db-testutils.mjs +29 -0
- package/dist/test/{httpserver.js → httpserver.mjs} +11 -15
- package/dist/test/secrets-manager.mjs +34 -0
- package/dist/test/testutils.mjs +33 -0
- package/dist/types/async-timeout-error.mjs +6 -0
- package/dist/types/aws-env.mjs +2 -0
- package/dist/types/either.mjs +2 -0
- package/dist/types/http-error.mjs +7 -0
- package/dist/types/input-error.mjs +3 -0
- package/dist/types/language.mjs +7 -0
- package/dist/types/{nullable.d.ts → nullable.d.mts} +1 -1
- package/dist/types/nullable.mjs +2 -0
- package/dist/types/{traffictype.js → traffictype.mjs} +3 -6
- package/dist/types/urn.mjs +2 -0
- package/dist/types/util-types.mjs +2 -0
- package/dist/types/validator.mjs +9 -0
- package/dist/utils/{api-model.d.ts → api-model.d.mts} +1 -1
- package/dist/utils/{api-model.js → api-model.mjs} +18 -28
- package/dist/utils/{base64.d.ts → base64.d.mts} +1 -1
- package/dist/utils/base64.mjs +16 -0
- package/dist/utils/date-utils.mjs +44 -0
- package/dist/utils/geojson-types.mjs +13 -0
- package/dist/utils/{geometry.js → geometry.mjs} +16 -49
- package/dist/utils/{logging.d.ts → logging.d.mts} +1 -1
- package/dist/utils/{logging.js → logging.mjs} +9 -14
- package/dist/utils/{retry.js → retry.mjs} +22 -27
- package/dist/utils/slack.mjs +23 -0
- package/dist/utils/{utils.d.ts → utils.d.mts} +2 -2
- package/dist/utils/{utils.js → utils.mjs} +15 -30
- package/package.json +99 -10
- package/src/aws/infra/api/{handler-factory.ts → handler-factory.mts} +3 -3
- package/src/aws/infra/api/{integration.ts → integration.mts} +2 -2
- package/src/aws/infra/api/{response.ts → response.mts} +3 -3
- package/src/aws/infra/api/{responses.ts → responses.mts} +4 -4
- package/src/aws/infra/api/{static-integration.ts → static-integration.mts} +2 -2
- package/src/aws/infra/canaries/Synthetics.d.mts +21 -0
- package/src/aws/infra/canaries/{canary-alarm.ts → canary-alarm.mts} +1 -1
- package/src/aws/infra/canaries/{canary.ts → canary.mts} +3 -3
- package/src/aws/infra/canaries/{database-canary.ts → database-canary.mts} +3 -3
- package/src/aws/infra/canaries/{database-checker.ts → database-checker.mts} +7 -10
- package/src/aws/infra/canaries/{url-canary.ts → url-canary.mts} +6 -6
- package/src/aws/infra/canaries/{url-checker.ts → url-checker.mts} +9 -29
- package/src/aws/infra/{sqs-integration.ts → sqs-integration.mts} +1 -1
- package/src/aws/infra/{sqs-queue.ts → sqs-queue.mts} +3 -6
- package/src/aws/infra/stack/{lambda-configs.ts → lambda-configs.mts} +2 -2
- package/src/aws/infra/stack/{monitoredfunction.ts → monitoredfunction.mts} +4 -4
- package/src/aws/infra/stack/{parameters.ts → parameters.mts} +1 -1
- package/src/aws/infra/stack/{rest_apis.ts → rest_apis.mts} +6 -6
- package/src/aws/infra/stack/{stack-checking-aspect.ts → stack-checking-aspect.mts} +1 -1
- package/src/aws/infra/stack/{stack.ts → stack.mts} +4 -5
- package/src/aws/infra/stack/{subscription.ts → subscription.mts} +2 -2
- package/src/aws/infra/stacks/{db-dns-stack.ts → db-dns-stack.mts} +4 -4
- package/src/aws/infra/stacks/{db-proxy-stack.ts → db-proxy-stack.mts} +5 -5
- package/src/aws/infra/stacks/{db-stack.ts → db-stack.mts} +5 -5
- package/src/aws/infra/stacks/{network-stack.ts → network-stack.mts} +3 -3
- package/src/aws/runtime/{digitraffic-integration-response.ts → digitraffic-integration-response.mts} +2 -2
- package/src/aws/runtime/{dt-logger-default.ts → dt-logger-default.mts} +2 -2
- package/src/aws/runtime/secrets/{dbsecret.ts → dbsecret.mts} +1 -1
- package/src/aws/runtime/secrets/node-ttl.d.mts +12 -0
- package/src/aws/runtime/secrets/{proxy-holder.ts → proxy-holder.mts} +4 -4
- package/src/aws/runtime/secrets/{rds-holder.ts → rds-holder.mts} +4 -4
- package/src/aws/runtime/secrets/{secret-holder.ts → secret-holder.mts} +8 -9
- package/src/aws/runtime/secrets/{secret.ts → secret.mts} +2 -2
- package/src/database/{cached.ts → cached.mts} +4 -2
- package/src/database/{database.ts → database.mts} +6 -6
- package/src/database/{last-updated.ts → last-updated.mts} +1 -1
- package/src/index.mts +2 -0
- package/src/test/{db-testutils.ts → db-testutils.mts} +2 -2
- package/src/test/{secrets-manager.ts → secrets-manager.mts} +3 -3
- package/src/types/{nullable.ts → nullable.mts} +1 -1
- package/src/utils/{api-model.ts → api-model.mts} +1 -1
- package/src/utils/{geometry.ts → geometry.mts} +5 -3
- package/src/utils/{logging.ts → logging.mts} +2 -2
- package/src/utils/{retry.ts → retry.mts} +3 -3
- package/src/utils/{slack.ts → slack.mts} +2 -2
- package/src/utils/{utils.ts → utils.mts} +3 -3
- package/dist/aws/infra/api/responses.js +0 -84
- package/dist/aws/infra/canaries/canary-alarm.js +0 -24
- package/dist/aws/infra/canaries/canary-keys.js +0 -7
- package/dist/aws/infra/canaries/canary-parameters.js +0 -3
- package/dist/aws/infra/canaries/canary.js +0 -30
- package/dist/aws/infra/scheduler.js +0 -31
- package/dist/aws/infra/stack/stack.js +0 -67
- package/dist/aws/infra/stacks/db-dns-stack.js +0 -64
- package/dist/aws/infra/stacks/db-proxy-stack.js +0 -77
- package/dist/aws/infra/stacks/intra-stack-configuration.js +0 -3
- package/dist/aws/infra/stacks/network-stack.js +0 -44
- package/dist/aws/runtime/apikey.js +0 -13
- package/dist/aws/runtime/digitraffic-integration-response.js +0 -28
- package/dist/aws/runtime/dt-logger-default.js +0 -9
- package/dist/aws/runtime/secrets/proxy-holder.js +0 -28
- package/dist/aws/runtime/secrets/rds-holder.js +0 -28
- package/dist/aws/types/errors.js +0 -16
- package/dist/aws/types/model-with-reference.js +0 -3
- package/dist/aws/types/proxytypes.js +0 -3
- package/dist/aws/types/tags.js +0 -7
- package/dist/database/models.js +0 -3
- package/dist/marine/rtz.js +0 -3
- package/dist/test/db-testutils.js +0 -34
- package/dist/test/secrets-manager.js +0 -62
- package/dist/test/testutils.js +0 -44
- package/dist/types/async-timeout-error.js +0 -10
- package/dist/types/aws-env.js +0 -3
- package/dist/types/either.js +0 -3
- package/dist/types/http-error.js +0 -11
- package/dist/types/input-error.js +0 -7
- package/dist/types/language.js +0 -10
- package/dist/types/nullable.js +0 -3
- package/dist/types/urn.js +0 -3
- package/dist/types/util-types.js +0 -3
- package/dist/types/validator.js +0 -14
- package/dist/utils/base64.js +0 -21
- package/dist/utils/date-utils.js +0 -51
- package/dist/utils/geojson-types.js +0 -18
- package/dist/utils/slack.js +0 -30
- /package/dist/aws/infra/canaries/{canary-keys.d.ts → canary-keys.d.mts} +0 -0
- /package/dist/aws/infra/canaries/{canary-parameters.d.ts → canary-parameters.d.mts} +0 -0
- /package/dist/aws/infra/canaries/{canary-role.d.ts → canary-role.d.mts} +0 -0
- /package/dist/aws/infra/{documentation.d.ts → documentation.d.mts} +0 -0
- /package/dist/aws/infra/{import-util.d.ts → import-util.d.mts} +0 -0
- /package/dist/aws/infra/{scheduler.d.ts → scheduler.d.mts} +0 -0
- /package/dist/aws/infra/{security-rule.d.ts → security-rule.d.mts} +0 -0
- /package/dist/aws/infra/stacks/{intra-stack-configuration.d.ts → intra-stack-configuration.d.mts} +0 -0
- /package/dist/aws/infra/{usage-plans.d.ts → usage-plans.d.mts} +0 -0
- /package/dist/aws/runtime/{apikey.d.ts → apikey.d.mts} +0 -0
- /package/dist/aws/runtime/{environment.d.ts → environment.d.mts} +0 -0
- /package/dist/aws/runtime/{messaging.d.ts → messaging.d.mts} +0 -0
- /package/dist/aws/runtime/{s3.d.ts → s3.d.mts} +0 -0
- /package/dist/aws/runtime/secrets/{proxy-holder.d.ts → proxy-holder.d.mts} +0 -0
- /package/dist/aws/runtime/secrets/{rds-holder.d.ts → rds-holder.d.mts} +0 -0
- /package/dist/aws/runtime/secrets/{secret.d.ts → secret.d.mts} +0 -0
- /package/dist/aws/types/{errors.d.ts → errors.d.mts} +0 -0
- /package/dist/aws/types/{lambda-response.d.ts → lambda-response.d.mts} +0 -0
- /package/dist/aws/types/{mediatypes.d.ts → mediatypes.d.mts} +0 -0
- /package/dist/aws/types/{model-with-reference.d.ts → model-with-reference.d.mts} +0 -0
- /package/dist/aws/types/{proxytypes.d.ts → proxytypes.d.mts} +0 -0
- /package/dist/aws/types/{tags.d.ts → tags.d.mts} +0 -0
- /package/dist/database/{models.d.ts → models.d.mts} +0 -0
- /package/dist/marine/{id_utils.d.ts → id_utils.d.mts} +0 -0
- /package/dist/marine/{rtz.d.ts → rtz.d.mts} +0 -0
- /package/dist/test/{asserter.d.ts → asserter.d.mts} +0 -0
- /package/dist/test/{httpserver.d.ts → httpserver.d.mts} +0 -0
- /package/dist/test/{secrets-manager.d.ts → secrets-manager.d.mts} +0 -0
- /package/dist/test/{testutils.d.ts → testutils.d.mts} +0 -0
- /package/dist/types/{async-timeout-error.d.ts → async-timeout-error.d.mts} +0 -0
- /package/dist/types/{aws-env.d.ts → aws-env.d.mts} +0 -0
- /package/dist/types/{either.d.ts → either.d.mts} +0 -0
- /package/dist/types/{http-error.d.ts → http-error.d.mts} +0 -0
- /package/dist/types/{input-error.d.ts → input-error.d.mts} +0 -0
- /package/dist/types/{language.d.ts → language.d.mts} +0 -0
- /package/dist/types/{traffictype.d.ts → traffictype.d.mts} +0 -0
- /package/dist/types/{urn.d.ts → urn.d.mts} +0 -0
- /package/dist/types/{util-types.d.ts → util-types.d.mts} +0 -0
- /package/dist/types/{validator.d.ts → validator.d.mts} +0 -0
- /package/dist/utils/{date-utils.d.ts → date-utils.d.mts} +0 -0
- /package/dist/utils/{geojson-types.d.ts → geojson-types.d.mts} +0 -0
- /package/dist/utils/{geometry.d.ts → geometry.d.mts} +0 -0
- /package/dist/utils/{retry.d.ts → retry.d.mts} +0 -0
- /package/dist/utils/{slack.d.ts → slack.d.mts} +0 -0
- /package/src/@types/geojson-validation/{index.d.ts → index.d.mts} +0 -0
- /package/src/aws/infra/canaries/{canary-keys.ts → canary-keys.mts} +0 -0
- /package/src/aws/infra/canaries/{canary-parameters.ts → canary-parameters.mts} +0 -0
- /package/src/aws/infra/canaries/{canary-role.ts → canary-role.mts} +0 -0
- /package/src/aws/infra/{documentation.ts → documentation.mts} +0 -0
- /package/src/aws/infra/{import-util.ts → import-util.mts} +0 -0
- /package/src/aws/infra/{scheduler.ts → scheduler.mts} +0 -0
- /package/src/aws/infra/{security-rule.ts → security-rule.mts} +0 -0
- /package/src/aws/infra/stacks/{intra-stack-configuration.ts → intra-stack-configuration.mts} +0 -0
- /package/src/aws/infra/{usage-plans.ts → usage-plans.mts} +0 -0
- /package/src/aws/runtime/{apikey.ts → apikey.mts} +0 -0
- /package/src/aws/runtime/{dt-logger.ts → dt-logger.mts} +0 -0
- /package/src/aws/runtime/{environment.ts → environment.mts} +0 -0
- /package/src/aws/runtime/{messaging.ts → messaging.mts} +0 -0
- /package/src/aws/runtime/{s3.ts → s3.mts} +0 -0
- /package/src/aws/types/{errors.ts → errors.mts} +0 -0
- /package/src/aws/types/{lambda-response.ts → lambda-response.mts} +0 -0
- /package/src/aws/types/{mediatypes.ts → mediatypes.mts} +0 -0
- /package/src/aws/types/{model-with-reference.ts → model-with-reference.mts} +0 -0
- /package/src/aws/types/{proxytypes.ts → proxytypes.mts} +0 -0
- /package/src/aws/types/{tags.ts → tags.mts} +0 -0
- /package/src/database/{models.ts → models.mts} +0 -0
- /package/src/marine/{id_utils.ts → id_utils.mts} +0 -0
- /package/src/marine/{rtz.ts → rtz.mts} +0 -0
- /package/src/test/{asserter.ts → asserter.mts} +0 -0
- /package/src/test/{httpserver.ts → httpserver.mts} +0 -0
- /package/src/test/{testutils.ts → testutils.mts} +0 -0
- /package/src/types/{async-timeout-error.ts → async-timeout-error.mts} +0 -0
- /package/src/types/{aws-env.ts → aws-env.mts} +0 -0
- /package/src/types/{either.ts → either.mts} +0 -0
- /package/src/types/{http-error.ts → http-error.mts} +0 -0
- /package/src/types/{input-error.ts → input-error.mts} +0 -0
- /package/src/types/{language.ts → language.mts} +0 -0
- /package/src/types/{traffictype.ts → traffictype.mts} +0 -0
- /package/src/types/{urn.ts → urn.mts} +0 -0
- /package/src/types/{util-types.ts → util-types.mts} +0 -0
- /package/src/types/{validator.ts → validator.mts} +0 -0
- /package/src/utils/{base64.ts → base64.mts} +0 -0
- /package/src/utils/{date-utils.ts → date-utils.mts} +0 -0
- /package/src/utils/{geojson-types.ts → geojson-types.mts} +0 -0
@@ -3,8 +3,8 @@ import {
|
|
3
3
|
IVpc,
|
4
4
|
SecurityGroup,
|
5
5
|
SubnetType,
|
6
|
+
type ISecurityGroup,
|
6
7
|
} from "aws-cdk-lib/aws-ec2";
|
7
|
-
import { ISecurityGroup } from "aws-cdk-lib/aws-ec2/lib/security-group";
|
8
8
|
import {
|
9
9
|
AuroraPostgresEngineVersion,
|
10
10
|
CfnDBInstance,
|
@@ -17,12 +17,12 @@ import {
|
|
17
17
|
IParameterGroup,
|
18
18
|
ParameterGroup,
|
19
19
|
} from "aws-cdk-lib/aws-rds";
|
20
|
-
import { Construct } from "constructs/lib/construct";
|
20
|
+
import { Construct } from "constructs/lib/construct.js";
|
21
21
|
import { Secret } from "aws-cdk-lib/aws-secretsmanager";
|
22
|
-
import { InfraStackConfiguration } from "./intra-stack-configuration";
|
23
|
-
import { exportValue, importVpc } from "../import-util";
|
22
|
+
import { InfraStackConfiguration } from "./intra-stack-configuration.mjs";
|
23
|
+
import { exportValue, importVpc } from "../import-util.mjs";
|
24
24
|
import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib/core";
|
25
|
-
import { createParameter } from "../stack/parameters";
|
25
|
+
import { createParameter } from "../stack/parameters.mjs";
|
26
26
|
|
27
27
|
export interface DbConfiguration {
|
28
28
|
readonly cluster?: ClusterConfiguration;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { IpAddresses, IVpc, SubnetType, Vpc } from "aws-cdk-lib/aws-ec2";
|
2
|
-
import { InfraStackConfiguration } from "./intra-stack-configuration";
|
3
|
-
import { exportValue } from "../import-util";
|
2
|
+
import { InfraStackConfiguration } from "./intra-stack-configuration.mjs";
|
3
|
+
import { exportValue } from "../import-util.mjs";
|
4
4
|
import { Stack } from "aws-cdk-lib/core";
|
5
|
-
import { Construct } from "constructs/lib/construct";
|
5
|
+
import { Construct } from "constructs/lib/construct.js";
|
6
6
|
|
7
7
|
export interface NetworkConfiguration {
|
8
8
|
readonly vpcName: string;
|
package/src/aws/runtime/{digitraffic-integration-response.ts → digitraffic-integration-response.mts}
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { IntegrationResponse } from "aws-cdk-lib/aws-apigateway";
|
2
|
-
import { MediaType } from "../types/mediatypes";
|
2
|
+
import { MediaType } from "../types/mediatypes.mjs";
|
3
3
|
import {
|
4
4
|
getDeprecatedDefaultLambdaResponse,
|
5
5
|
RESPONSE_DEFAULT_LAMBDA,
|
6
|
-
} from "../infra/api/response";
|
6
|
+
} from "../infra/api/response.mjs";
|
7
7
|
|
8
8
|
export abstract class DigitrafficIntegrationResponse {
|
9
9
|
static ok(mediaType: MediaType, sunset?: string): IntegrationResponse {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { DtLogger } from "./dt-logger";
|
1
|
+
import { DtLogger } from "./dt-logger.mjs";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* You can use this for method name definition to match DtLogger LoggableType.method parameter.
|
5
5
|
*/
|
6
|
-
export type { LoggerMethodType } from "./dt-logger";
|
6
|
+
export type { LoggerMethodType } from "./dt-logger.mjs";
|
7
7
|
|
8
8
|
/**
|
9
9
|
* You can use this for your logging needs or create one locally and configure it as you wish.
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { SecretHolder } from "./secret-holder";
|
2
|
-
import { RdsProxySecretKey, RdsProxySecret } from "./dbsecret";
|
3
|
-
import { getEnvVariable } from "../../../utils/utils";
|
4
|
-
import { DatabaseEnvironmentKeys } from "../../../database/database";
|
1
|
+
import { SecretHolder } from "./secret-holder.mjs";
|
2
|
+
import { RdsProxySecretKey, RdsProxySecret } from "./dbsecret.mjs";
|
3
|
+
import { getEnvVariable } from "../../../utils/utils.mjs";
|
4
|
+
import { DatabaseEnvironmentKeys } from "../../../database/database.mjs";
|
5
5
|
|
6
6
|
const RDS_PROXY_SECRET_KEYS = Object.values(RdsProxySecretKey);
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { SecretHolder } from "./secret-holder";
|
2
|
-
import { RdsSecret, RdsSecretKey } from "./dbsecret";
|
3
|
-
import { getEnvVariable } from "../../../utils/utils";
|
4
|
-
import { DatabaseEnvironmentKeys } from "../../../database/database";
|
1
|
+
import { SecretHolder } from "./secret-holder.mjs";
|
2
|
+
import { RdsSecret, RdsSecretKey } from "./dbsecret.mjs";
|
3
|
+
import { getEnvVariable } from "../../../utils/utils.mjs";
|
4
|
+
import { DatabaseEnvironmentKeys } from "../../../database/database.mjs";
|
5
5
|
|
6
6
|
const RDS_SECRET_KEYS = Object.values(RdsSecretKey);
|
7
7
|
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import { GenericSecret, getSecret } from "./secret";
|
2
|
-
import { checkExpectedSecretKeys } from "./dbsecret";
|
3
|
-
import { getEnvVariable } from "../../../utils/utils";
|
4
|
-
import { logger } from "../dt-logger-default";
|
1
|
+
import { GenericSecret, getSecret } from "./secret.mjs";
|
2
|
+
import { checkExpectedSecretKeys } from "./dbsecret.mjs";
|
3
|
+
import { getEnvVariable } from "../../../utils/utils.mjs";
|
4
|
+
import { logger } from "../dt-logger-default.mjs";
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
const NodeTtlImport = await import("node-ttl");
|
7
|
+
//eslint-disable-next-line
|
8
|
+
const NodeTtl = NodeTtlImport.default;
|
8
9
|
|
9
10
|
const DEFAULT_PREFIX = "";
|
10
11
|
const DEFAULT_SECRET_KEY = "SECRET";
|
@@ -96,14 +97,12 @@ export class SecretHolder<Secret extends GenericSecret> {
|
|
96
97
|
}
|
97
98
|
|
98
99
|
private async getSecret<S>(): Promise<S> {
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
100
100
|
const secret: S | undefined = this.secretCache.get(DEFAULT_SECRET_KEY);
|
101
101
|
|
102
102
|
if (!secret) {
|
103
103
|
await this.initSecret();
|
104
104
|
}
|
105
105
|
|
106
|
-
|
107
|
-
return secret ?? (this.secretCache.get(DEFAULT_SECRET_KEY) as S);
|
106
|
+
return secret ?? (this.secretCache.get(DEFAULT_SECRET_KEY));
|
108
107
|
}
|
109
108
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SecretsManager } from "aws-sdk";
|
2
|
-
import { getEnvVariable, getEnvVariableOrElse } from "../../../utils/utils";
|
3
|
-
import { EnvKeys } from "../environment";
|
2
|
+
import { getEnvVariable, getEnvVariableOrElse } from "../../../utils/utils.mjs";
|
3
|
+
import { EnvKeys } from "../environment.mjs";
|
4
4
|
|
5
5
|
// SECRET_OVERRIDE_AWS_REGION might not have been set before import of
|
6
6
|
// secret, so we need to lazy initialize SecretsManager
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import { DTDatabase, DTTransaction } from "./database";
|
1
|
+
import pg from "pg-promise";
|
2
|
+
import { DTDatabase, DTTransaction } from "./database.mjs";
|
3
|
+
|
4
|
+
const { PreparedStatement } = pg;
|
3
5
|
|
4
6
|
export interface CachedValue<T> {
|
5
7
|
content: T;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { IDatabase, ITask } 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";
|
1
|
+
import { type IDatabase, type ITask } from "pg-promise";
|
2
|
+
import { getEnvVariable, getEnvVariableOrElse } from "../utils/utils.mjs";
|
3
|
+
import { logger } from "../aws/runtime/dt-logger-default.mjs";
|
4
|
+
import { logException } from "../utils/logging.mjs";
|
5
5
|
|
6
6
|
export enum DatabaseEnvironmentKeys {
|
7
7
|
DB_USER = "DB_USER",
|
@@ -11,8 +11,8 @@ export enum DatabaseEnvironmentKeys {
|
|
11
11
|
DB_APPLICATION = "DB_APPLICATION",
|
12
12
|
}
|
13
13
|
|
14
|
-
|
15
|
-
const pgp =
|
14
|
+
const pgpImport = await import("pg-promise");
|
15
|
+
const pgp = pgpImport.default();
|
16
16
|
|
17
17
|
// convert numeric types to number instead of string
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
package/src/index.mts
ADDED
@@ -2,8 +2,8 @@ import {
|
|
2
2
|
DatabaseEnvironmentKeys,
|
3
3
|
DTDatabase,
|
4
4
|
initDbConnection,
|
5
|
-
} from "../database/database";
|
6
|
-
import { Countable } from "../database/models";
|
5
|
+
} from "../database/database.mjs";
|
6
|
+
import { Countable } from "../database/models.mjs";
|
7
7
|
|
8
8
|
export async function assertCount(db: DTDatabase, sql: string, count: number) {
|
9
9
|
await db.one(sql).then((x: Countable) => expect(x.count).toEqual(count));
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
const AWS = await import("aws-sdk");
|
2
2
|
import * as sinon from "sinon";
|
3
|
-
import { EnvKeys } from "../aws/runtime/environment";
|
4
|
-
import { setEnvVariable } from "../utils/utils";
|
3
|
+
import { EnvKeys } from "../aws/runtime/environment.mjs";
|
4
|
+
import { setEnvVariable } from "../utils/utils.mjs";
|
5
5
|
|
6
6
|
setEnvVariable(EnvKeys.AWS_REGION, "eu-west-1");
|
7
7
|
const secretValue = sinon.stub();
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
JsonSchemaType,
|
7
7
|
JsonSchemaVersion,
|
8
8
|
} from 'aws-cdk-lib/aws-apigateway';
|
9
|
-
import {ModelWithReference} from "../aws/types/model-with-reference";
|
9
|
+
import {ModelWithReference} from "../aws/types/model-with-reference.mjs";
|
10
10
|
|
11
11
|
/**
|
12
12
|
* Get a reference to an OpenAPI model object in a REST API.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
import { Feature, FeatureCollection, Geometry, Position } from "geojson";
|
5
5
|
import * as geoJsonValidator from "geojson-validation";
|
6
|
-
import { logger } from "../aws/runtime/dt-logger-default";
|
6
|
+
import { logger } from "../aws/runtime/dt-logger-default.mjs";
|
7
7
|
|
8
8
|
export const SRID_WGS84 = 4326;
|
9
9
|
|
@@ -73,11 +73,13 @@ export function createFeatureCollection(
|
|
73
73
|
}
|
74
74
|
|
75
75
|
export function isValidGeoJson<T>(json: T): boolean {
|
76
|
-
|
76
|
+
// Tests complain about this method returning type string[] which is obviously wrong. Therefore, this casting.
|
77
|
+
return geoJsonValidator.valid(json) as unknown as boolean;
|
77
78
|
}
|
78
79
|
|
79
80
|
export function isFeatureCollection<T>(json: T): boolean {
|
80
|
-
|
81
|
+
// Tests complain about this method returning type string[] which is obviously wrong. Therefore, this casting.
|
82
|
+
return geoJsonValidator.isFeatureCollection(json) as unknown as boolean;
|
81
83
|
}
|
82
84
|
|
83
85
|
const DEGREES_TO_RADIANS = 0.017453292519943295; // = Math.PI / 180
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AxiosError } from "axios";
|
2
|
-
import { DtLogger } from "../aws/runtime/dt-logger";
|
3
|
-
import { getEnvVariableOrElse } from "./utils";
|
2
|
+
import { DtLogger } from "../aws/runtime/dt-logger.mjs";
|
3
|
+
import { getEnvVariableOrElse } from "./utils.mjs";
|
4
4
|
|
5
5
|
const functionName = getEnvVariableOrElse("AWS_LAMBDA_FUNCTION_NAME", "test");
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { HttpError } from "../types/http-error";
|
2
|
-
import { AsyncTimeoutError } from "../types/async-timeout-error";
|
3
|
-
import { logger } from "../aws/runtime/dt-logger-default";
|
1
|
+
import { HttpError } from "../types/http-error.mjs";
|
2
|
+
import { AsyncTimeoutError } from "../types/async-timeout-error.mjs";
|
3
|
+
import { logger } from "../aws/runtime/dt-logger-default.mjs";
|
4
4
|
|
5
5
|
export enum RetryLogError {
|
6
6
|
LOG_ALL_AS_ERRORS,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import axios from "axios";
|
2
|
-
import { logger } from "../aws/runtime/dt-logger-default";
|
3
|
-
import { logException } from "./logging";
|
2
|
+
import { logger } from "../aws/runtime/dt-logger-default.mjs";
|
3
|
+
import { logException } from "./logging.mjs";
|
4
4
|
|
5
5
|
export class SlackApi {
|
6
6
|
private readonly url: string;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { AwsEnv } from "../types/aws-env";
|
2
|
-
import { Either } from "../types/either";
|
3
|
-
import { EnvKeys } from "../aws/runtime/environment";
|
1
|
+
import { AwsEnv } from "../types/aws-env.mjs";
|
2
|
+
import { Either } from "../types/either.mjs";
|
3
|
+
import { EnvKeys } from "../aws/runtime/environment.mjs";
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Check if arrays have only elements that also exists also in other array.
|
@@ -1,84 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getResponse = exports.defaultIntegration = exports.methodResponse = exports.RESPONSE_404_NOT_FOUND = exports.RESPONSE_CORS_INTEGRATION = exports.RESPONSE_500_SERVER_ERROR = exports.RESPONSE_400_BAD_REQUEST = exports.RESPONSE_200_OK = void 0;
|
4
|
-
const response_1 = require("./response");
|
5
|
-
const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
|
6
|
-
const errors_1 = require("../../types/errors");
|
7
|
-
/// @deprecated
|
8
|
-
exports.RESPONSE_200_OK = {
|
9
|
-
statusCode: "200",
|
10
|
-
};
|
11
|
-
/// @deprecated
|
12
|
-
exports.RESPONSE_400_BAD_REQUEST = {
|
13
|
-
statusCode: "400",
|
14
|
-
selectionPattern: errors_1.BAD_REQUEST_MESSAGE,
|
15
|
-
responseTemplates: response_1.BadRequestResponseTemplate,
|
16
|
-
};
|
17
|
-
/// @deprecated
|
18
|
-
exports.RESPONSE_500_SERVER_ERROR = {
|
19
|
-
statusCode: "500",
|
20
|
-
selectionPattern: errors_1.ERROR_MESSAGE,
|
21
|
-
responseTemplates: response_1.InternalServerErrorResponseTemplate,
|
22
|
-
};
|
23
|
-
/// @deprecated
|
24
|
-
const RESPONSE_XML = {
|
25
|
-
responseTemplates: response_1.XmlResponseTemplate,
|
26
|
-
};
|
27
|
-
/// @deprecated
|
28
|
-
exports.RESPONSE_CORS_INTEGRATION = {
|
29
|
-
responseParameters: {
|
30
|
-
"method.response.header.Access-Control-Allow-Origin": "'*'",
|
31
|
-
},
|
32
|
-
};
|
33
|
-
/// @deprecated
|
34
|
-
exports.RESPONSE_404_NOT_FOUND = {
|
35
|
-
statusCode: "404",
|
36
|
-
selectionPattern: errors_1.NOT_FOUND_MESSAGE,
|
37
|
-
responseTemplates: response_1.NotFoundResponseTemplate,
|
38
|
-
};
|
39
|
-
/**
|
40
|
-
* @deprecated Use DigitrafficMethodResponse
|
41
|
-
*/
|
42
|
-
function methodResponse(status, contentType, model, parameters) {
|
43
|
-
return {
|
44
|
-
statusCode: status,
|
45
|
-
responseModels: {
|
46
|
-
[contentType]: model,
|
47
|
-
},
|
48
|
-
responseParameters: parameters ?? {},
|
49
|
-
};
|
50
|
-
}
|
51
|
-
exports.methodResponse = methodResponse;
|
52
|
-
/**
|
53
|
-
* Creates a default Lambda integration for a REST API resource _root_
|
54
|
-
* @param lambdaFunction The Lambda function
|
55
|
-
* @param options Options
|
56
|
-
*
|
57
|
-
* @deprecated Use DigitrafficIntegration
|
58
|
-
*/
|
59
|
-
function defaultIntegration(lambdaFunction, options) {
|
60
|
-
return new aws_apigateway_1.LambdaIntegration(lambdaFunction, {
|
61
|
-
proxy: false,
|
62
|
-
integrationResponses: options?.responses ?? [
|
63
|
-
getResponse(exports.RESPONSE_200_OK, options),
|
64
|
-
getResponse(exports.RESPONSE_400_BAD_REQUEST, options),
|
65
|
-
getResponse(exports.RESPONSE_404_NOT_FOUND, options),
|
66
|
-
getResponse(exports.RESPONSE_500_SERVER_ERROR, options),
|
67
|
-
],
|
68
|
-
requestParameters: options?.requestParameters ?? {},
|
69
|
-
requestTemplates: options?.requestTemplates ?? {},
|
70
|
-
passthroughBehavior: options?.passthroughBehavior ?? aws_apigateway_1.PassthroughBehavior.WHEN_NO_MATCH,
|
71
|
-
});
|
72
|
-
}
|
73
|
-
exports.defaultIntegration = defaultIntegration;
|
74
|
-
function getResponse(response, options) {
|
75
|
-
if (options?.xml) {
|
76
|
-
response = { ...response, ...RESPONSE_XML };
|
77
|
-
}
|
78
|
-
if (!options?.disableCors) {
|
79
|
-
response = { ...response, ...exports.RESPONSE_CORS_INTEGRATION };
|
80
|
-
}
|
81
|
-
return response;
|
82
|
-
}
|
83
|
-
exports.getResponse = getResponse;
|
84
|
-
//# sourceMappingURL=responses.js.map
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.CanaryAlarm = void 0;
|
4
|
-
const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch");
|
5
|
-
const aws_cloudwatch_actions_1 = require("aws-cdk-lib/aws-cloudwatch-actions");
|
6
|
-
const aws_sns_1 = require("aws-cdk-lib/aws-sns");
|
7
|
-
class CanaryAlarm {
|
8
|
-
constructor(stack, canary, params) {
|
9
|
-
const alarmName = params.alarm?.alarmName ?? `${params.name}-alarm`;
|
10
|
-
const alarm = new aws_cloudwatch_1.Alarm(stack, alarmName, {
|
11
|
-
alarmName,
|
12
|
-
alarmDescription: params.alarm?.description ?? "",
|
13
|
-
metric: canary.metricSuccessPercent(),
|
14
|
-
evaluationPeriods: params.alarm?.evalutionPeriods ?? 1,
|
15
|
-
threshold: params.alarm?.threshold ?? 100,
|
16
|
-
comparisonOperator: aws_cloudwatch_1.ComparisonOperator.LESS_THAN_THRESHOLD,
|
17
|
-
});
|
18
|
-
if (params.alarm?.topicArn) {
|
19
|
-
alarm.addAlarmAction(new aws_cloudwatch_actions_1.SnsAction(aws_sns_1.Topic.fromTopicArn(stack, `${alarmName}-action`, params.alarm.topicArn)));
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
exports.CanaryAlarm = CanaryAlarm;
|
24
|
-
//# sourceMappingURL=canary-alarm.js.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ENV_SECRET = exports.ENV_HOSTNAME = exports.ENV_API_KEY = void 0;
|
4
|
-
exports.ENV_API_KEY = "apiKeyId";
|
5
|
-
exports.ENV_HOSTNAME = "hostname";
|
6
|
-
exports.ENV_SECRET = "secret";
|
7
|
-
//# sourceMappingURL=canary-keys.js.map
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DigitrafficCanary = void 0;
|
4
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
5
|
-
const aws_synthetics_1 = require("aws-cdk-lib/aws-synthetics");
|
6
|
-
const canary_alarm_1 = require("./canary-alarm");
|
7
|
-
class DigitrafficCanary extends aws_synthetics_1.Canary {
|
8
|
-
constructor(scope, canaryName, role, params, environmentVariables) {
|
9
|
-
super(scope, canaryName, {
|
10
|
-
runtime: aws_synthetics_1.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0,
|
11
|
-
role,
|
12
|
-
test: aws_synthetics_1.Test.custom({
|
13
|
-
code: new aws_synthetics_1.AssetCode("dist", {
|
14
|
-
exclude: ["lambda", "out", "canaries"],
|
15
|
-
}),
|
16
|
-
handler: params.handler,
|
17
|
-
}),
|
18
|
-
environmentVariables: {
|
19
|
-
...environmentVariables,
|
20
|
-
...params.canaryEnv,
|
21
|
-
},
|
22
|
-
canaryName,
|
23
|
-
schedule: params.schedule ?? aws_synthetics_1.Schedule.rate(aws_cdk_lib_1.Duration.minutes(15)),
|
24
|
-
});
|
25
|
-
this.artifactsBucket.grantWrite(role);
|
26
|
-
new canary_alarm_1.CanaryAlarm(scope, this, params);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
exports.DigitrafficCanary = DigitrafficCanary;
|
30
|
-
//# sourceMappingURL=canary.js.map
|
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Scheduler = void 0;
|
4
|
-
const aws_events_1 = require("aws-cdk-lib/aws-events");
|
5
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
6
|
-
const aws_events_targets_1 = require("aws-cdk-lib/aws-events-targets");
|
7
|
-
class Scheduler extends aws_events_1.Rule {
|
8
|
-
constructor(stack, ruleName, schedule, lambda) {
|
9
|
-
super(stack, ruleName, { ruleName, schedule });
|
10
|
-
if (lambda) {
|
11
|
-
this.addTarget(new aws_events_targets_1.LambdaFunction(lambda));
|
12
|
-
}
|
13
|
-
}
|
14
|
-
static everyMinute(stack, ruleName, lambda) {
|
15
|
-
return Scheduler.every(stack, ruleName, aws_cdk_lib_1.Duration.minutes(1), lambda);
|
16
|
-
}
|
17
|
-
static everyMinutes(stack, ruleName, minutes, lambda) {
|
18
|
-
return Scheduler.every(stack, ruleName, aws_cdk_lib_1.Duration.minutes(minutes), lambda);
|
19
|
-
}
|
20
|
-
static everyHour(stack, ruleName, lambda) {
|
21
|
-
return Scheduler.every(stack, ruleName, aws_cdk_lib_1.Duration.hours(1), lambda);
|
22
|
-
}
|
23
|
-
static everyDay(stack, ruleName, lambda) {
|
24
|
-
return Scheduler.every(stack, ruleName, aws_cdk_lib_1.Duration.days(1), lambda);
|
25
|
-
}
|
26
|
-
static every(stack, ruleName, duration, lambda) {
|
27
|
-
return new Scheduler(stack, ruleName, aws_events_1.Schedule.rate(duration), lambda);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
exports.Scheduler = Scheduler;
|
31
|
-
//# sourceMappingURL=scheduler.js.map
|
@@ -1,67 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DigitrafficStack = exports.SSM_KEY_ALARM_TOPIC = exports.SSM_KEY_WARNING_TOPIC = exports.SOLUTION_KEY = void 0;
|
4
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
5
|
-
const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
|
6
|
-
const aws_sns_1 = require("aws-cdk-lib/aws-sns");
|
7
|
-
const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
|
8
|
-
const aws_secretsmanager_1 = require("aws-cdk-lib/aws-secretsmanager");
|
9
|
-
const stack_checking_aspect_1 = require("./stack-checking-aspect");
|
10
|
-
const SSM_ROOT = "/digitraffic";
|
11
|
-
exports.SOLUTION_KEY = "Solution";
|
12
|
-
const MONITORING_ROOT = "/monitoring";
|
13
|
-
exports.SSM_KEY_WARNING_TOPIC = `${SSM_ROOT}${MONITORING_ROOT}/warning-topic`;
|
14
|
-
exports.SSM_KEY_ALARM_TOPIC = `${SSM_ROOT}${MONITORING_ROOT}/alarm-topic`;
|
15
|
-
class DigitrafficStack extends aws_cdk_lib_1.Stack {
|
16
|
-
constructor(scope, id, configuration) {
|
17
|
-
super(scope, id, configuration.stackProps);
|
18
|
-
this.configuration = configuration;
|
19
|
-
if (configuration.secretId) {
|
20
|
-
this.secret = aws_secretsmanager_1.Secret.fromSecretNameV2(this, "Secret", configuration.secretId);
|
21
|
-
}
|
22
|
-
// VPC reference construction requires vpcId and availability zones
|
23
|
-
// private subnets are used in Lambda configuration
|
24
|
-
if (configuration.vpcId) {
|
25
|
-
this.vpc = aws_ec2_1.Vpc.fromVpcAttributes(this, "vpc", {
|
26
|
-
vpcId: configuration.vpcId,
|
27
|
-
privateSubnetIds: configuration.privateSubnetIds,
|
28
|
-
availabilityZones: configuration.availabilityZones ?? [],
|
29
|
-
});
|
30
|
-
}
|
31
|
-
// security group that allows Lambda database access
|
32
|
-
if (configuration.lambdaDbSgId) {
|
33
|
-
this.lambdaDbSg = aws_ec2_1.SecurityGroup.fromSecurityGroupId(this, "LambdaDbSG", configuration.lambdaDbSgId);
|
34
|
-
}
|
35
|
-
this.alarmTopic = aws_sns_1.Topic.fromTopicArn(this, "AlarmTopic", aws_ssm_1.StringParameter.fromStringParameterName(this, "AlarmTopicParam", exports.SSM_KEY_ALARM_TOPIC).stringValue);
|
36
|
-
this.warningTopic = aws_sns_1.Topic.fromTopicArn(this, "WarningTopic", aws_ssm_1.StringParameter.fromStringParameterName(this, "WarningTopicParam", exports.SSM_KEY_WARNING_TOPIC).stringValue);
|
37
|
-
this.addAspects();
|
38
|
-
}
|
39
|
-
addAspects() {
|
40
|
-
aws_cdk_lib_1.Aspects.of(this).add(stack_checking_aspect_1.StackCheckingAspect.create(this));
|
41
|
-
}
|
42
|
-
createLambdaEnvironment() {
|
43
|
-
return this.createDefaultLambdaEnvironment(this.configuration.shortName);
|
44
|
-
}
|
45
|
-
createDefaultLambdaEnvironment(dbApplication) {
|
46
|
-
return this.configuration.secretId
|
47
|
-
? {
|
48
|
-
SECRET_ID: this.configuration.secretId,
|
49
|
-
DB_APPLICATION: dbApplication,
|
50
|
-
}
|
51
|
-
: {
|
52
|
-
DB_APPLICATION: dbApplication,
|
53
|
-
};
|
54
|
-
}
|
55
|
-
getSecret() {
|
56
|
-
if (this.secret === undefined) {
|
57
|
-
throw new Error("Secret is undefined");
|
58
|
-
}
|
59
|
-
return this.secret;
|
60
|
-
}
|
61
|
-
grantSecret(...lambdas) {
|
62
|
-
const secret = this.getSecret();
|
63
|
-
lambdas.forEach((l) => secret.grantRead(l));
|
64
|
-
}
|
65
|
-
}
|
66
|
-
exports.DigitrafficStack = DigitrafficStack;
|
67
|
-
//# sourceMappingURL=stack.js.map
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DbDnsStack = void 0;
|
4
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
5
|
-
const aws_route53_1 = require("aws-cdk-lib/aws-route53");
|
6
|
-
const import_util_1 = require("../import-util");
|
7
|
-
const parameters_1 = require("../stack/parameters");
|
8
|
-
const DEFAULT_RECORD_TTL = aws_cdk_lib_1.Duration.seconds(30);
|
9
|
-
/**
|
10
|
-
* Creates a dns local zone and creates records for cluster endpoints and proxy endpoints.
|
11
|
-
*
|
12
|
-
* Please note, that created PrivateHostedZone has RETAIN removalPolicy, so if you want to delete this stack,
|
13
|
-
* you must remove the zone by hand after.
|
14
|
-
*/
|
15
|
-
class DbDnsStack extends aws_cdk_lib_1.Stack {
|
16
|
-
constructor(scope, id, isc) {
|
17
|
-
super(scope, id, {
|
18
|
-
env: isc.env,
|
19
|
-
});
|
20
|
-
this.createDnsRecords(isc);
|
21
|
-
}
|
22
|
-
createDnsRecords(isc) {
|
23
|
-
const vpc = (0, import_util_1.importVpc)(this, isc.environmentName);
|
24
|
-
const zone = new aws_route53_1.PrivateHostedZone(this, "DNSHostedZone", {
|
25
|
-
zoneName: isc.environmentName + ".local",
|
26
|
-
vpc,
|
27
|
-
});
|
28
|
-
zone.applyRemovalPolicy(aws_cdk_lib_1.RemovalPolicy.RETAIN);
|
29
|
-
const clusterReaderEndpoint = (0, parameters_1.getParameterValue)(this, "cluster.reader");
|
30
|
-
const clusterWriterEndpoint = (0, parameters_1.getParameterValue)(this, "cluster.writer");
|
31
|
-
const proxyReaderEndpoint = (0, parameters_1.getParameterValue)(this, "proxy.reader");
|
32
|
-
const proxyWriterEndpoint = (0, parameters_1.getParameterValue)(this, "proxy.writer");
|
33
|
-
new aws_route53_1.RecordSet(this, "ReaderRecord", {
|
34
|
-
recordType: aws_route53_1.RecordType.CNAME,
|
35
|
-
recordName: `db-ro.${isc.environmentName}.local`,
|
36
|
-
target: aws_route53_1.RecordTarget.fromValues(clusterReaderEndpoint),
|
37
|
-
ttl: DEFAULT_RECORD_TTL,
|
38
|
-
zone,
|
39
|
-
});
|
40
|
-
new aws_route53_1.RecordSet(this, "WriterRecord", {
|
41
|
-
recordType: aws_route53_1.RecordType.CNAME,
|
42
|
-
recordName: `db.${isc.environmentName}.local`,
|
43
|
-
target: aws_route53_1.RecordTarget.fromValues(clusterWriterEndpoint),
|
44
|
-
ttl: DEFAULT_RECORD_TTL,
|
45
|
-
zone,
|
46
|
-
});
|
47
|
-
new aws_route53_1.RecordSet(this, "ProxyReaderRecord", {
|
48
|
-
recordType: aws_route53_1.RecordType.CNAME,
|
49
|
-
recordName: `proxy-ro.${isc.environmentName}.local`,
|
50
|
-
target: aws_route53_1.RecordTarget.fromValues(proxyReaderEndpoint),
|
51
|
-
ttl: DEFAULT_RECORD_TTL,
|
52
|
-
zone,
|
53
|
-
});
|
54
|
-
new aws_route53_1.RecordSet(this, "ProxyWriterRecord", {
|
55
|
-
recordType: aws_route53_1.RecordType.CNAME,
|
56
|
-
recordName: `proxy.${isc.environmentName}.local`,
|
57
|
-
target: aws_route53_1.RecordTarget.fromValues(proxyWriterEndpoint),
|
58
|
-
ttl: DEFAULT_RECORD_TTL,
|
59
|
-
zone,
|
60
|
-
});
|
61
|
-
}
|
62
|
-
}
|
63
|
-
exports.DbDnsStack = DbDnsStack;
|
64
|
-
//# sourceMappingURL=db-dns-stack.js.map
|