@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 { type IVpc } from "aws-cdk-lib/aws-ec2";
|
2
|
-
import { Stack } from "aws-cdk-lib";
|
3
|
-
import { Construct } from "constructs";
|
2
|
+
import { type Stack } from "aws-cdk-lib";
|
3
|
+
import type { Construct } from "constructs";
|
4
4
|
export declare class OldStackImports {
|
5
5
|
static AURORAINSTANCE_SG_IMPORT_NAME: string;
|
6
6
|
static RDSPROXY_SG_IMPORT_NAME: string;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Vpc } from "aws-cdk-lib/aws-ec2";
|
2
|
-
import { CfnOutput, Fn
|
3
|
-
import { Construct } from "constructs";
|
2
|
+
import { CfnOutput, Fn } from "aws-cdk-lib";
|
4
3
|
export class OldStackImports {
|
5
4
|
static AURORAINSTANCE_SG_IMPORT_NAME = "AuroraSG";
|
6
5
|
static RDSPROXY_SG_IMPORT_NAME = "RDSProxySG";
|
@@ -35,6 +34,7 @@ export function importValue(environmentName, name) {
|
|
35
34
|
*/
|
36
35
|
export function exportValue(stack, environmentName, name, value) {
|
37
36
|
const exportName = outputName(environmentName, name);
|
37
|
+
// eslint-disable-next-line no-new
|
38
38
|
new CfnOutput(stack, exportName, {
|
39
39
|
exportName,
|
40
40
|
value,
|
@@ -43,4 +43,4 @@ export function exportValue(stack, environmentName, name, value) {
|
|
43
43
|
export function outputName(environmentName, name) {
|
44
44
|
return `digitraffic-${environmentName}-${name}`;
|
45
45
|
}
|
46
|
-
//# sourceMappingURL=import-util.
|
46
|
+
//# sourceMappingURL=import-util.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Rule, Schedule } from "aws-cdk-lib/aws-events";
|
2
2
|
import { Duration } from "aws-cdk-lib";
|
3
|
-
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
4
|
-
import { Construct } from "constructs";
|
3
|
+
import type { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
4
|
+
import type { Construct } from "constructs";
|
5
5
|
export declare class Scheduler extends Rule {
|
6
6
|
constructor(stack: Construct, ruleName: string, schedule: Schedule, lambda?: AWSFunction);
|
7
7
|
static everyMinute(stack: Construct, ruleName: string, lambda?: AWSFunction): Scheduler;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { Rule, Schedule } from "aws-cdk-lib/aws-events";
|
2
2
|
import { Duration } from "aws-cdk-lib";
|
3
3
|
import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
|
4
|
-
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
5
|
-
import { Construct } from "constructs";
|
6
4
|
export class Scheduler extends Rule {
|
7
5
|
constructor(stack, ruleName, schedule, lambda) {
|
8
6
|
super(stack, ruleName, { ruleName, schedule });
|
@@ -26,4 +24,4 @@ export class Scheduler extends Rule {
|
|
26
24
|
return new Scheduler(stack, ruleName, Schedule.rate(duration), lambda);
|
27
25
|
}
|
28
26
|
}
|
29
|
-
//# sourceMappingURL=scheduler.
|
27
|
+
//# sourceMappingURL=scheduler.js.map
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Construct } from "constructs";
|
2
1
|
import { Rule } from "aws-cdk-lib/aws-events";
|
3
2
|
import { SnsTopic } from "aws-cdk-lib/aws-events-targets";
|
4
3
|
/**
|
@@ -33,4 +32,4 @@ export class DigitrafficSecurityRule extends Rule {
|
|
33
32
|
this.addTarget(new SnsTopic(topic));
|
34
33
|
}
|
35
34
|
}
|
36
|
-
//# sourceMappingURL=security-rule.
|
35
|
+
//# sourceMappingURL=security-rule.js.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { Queue } from "aws-cdk-lib/aws-sqs";
|
3
|
-
import { Construct } from "constructs";
|
1
|
+
import { type IModel, type RequestValidator, type Resource } from "aws-cdk-lib/aws-apigateway";
|
2
|
+
import type { Queue } from "aws-cdk-lib/aws-sqs";
|
3
|
+
import type { Construct } from "constructs";
|
4
4
|
export declare function attachQueueToApiGatewayResource(stack: Construct, queue: Queue, resource: Resource, requestValidator: RequestValidator, resourceName: string, apiKeyRequired: boolean, requestModels?: Record<string, IModel>): void;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { Aws } from "aws-cdk-lib";
|
2
|
-
import { AwsIntegration, PassthroughBehavior,
|
3
|
-
import { Queue } from "aws-cdk-lib/aws-sqs";
|
2
|
+
import { AwsIntegration, PassthroughBehavior, } from "aws-cdk-lib/aws-apigateway";
|
4
3
|
import { PolicyStatement, Role, ServicePrincipal } from "aws-cdk-lib/aws-iam";
|
5
|
-
import { Construct } from "constructs";
|
6
4
|
export function attachQueueToApiGatewayResource(stack, queue, resource, requestValidator, resourceName, apiKeyRequired, requestModels) {
|
7
5
|
// role for API Gateway
|
8
6
|
const apiGwRole = new Role(stack, `${resourceName}APIGatewayToSQSRole`, {
|
@@ -27,9 +25,7 @@ export function attachQueueToApiGatewayResource(stack, queue, resource, requestV
|
|
27
25
|
],
|
28
26
|
}));
|
29
27
|
// create an integration between API Gateway and an SQS queue
|
30
|
-
const fifoMessageGroupId = queue.fifo
|
31
|
-
? "&MessageGroupId=AlwaysSameFifoGroup"
|
32
|
-
: "";
|
28
|
+
const fifoMessageGroupId = queue.fifo ? "&MessageGroupId=AlwaysSameFifoGroup" : "";
|
33
29
|
const sqsIntegration = new AwsIntegration({
|
34
30
|
service: "sqs",
|
35
31
|
integrationHttpMethod: "POST",
|
@@ -84,4 +80,4 @@ export function attachQueueToApiGatewayResource(stack, queue, resource, requestV
|
|
84
80
|
],
|
85
81
|
});
|
86
82
|
}
|
87
|
-
//# sourceMappingURL=sqs-integration.
|
83
|
+
//# sourceMappingURL=sqs-integration.js.map
|
@@ -7,10 +7,22 @@ import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
7
7
|
import { SqsEventSource } from "aws-cdk-lib/aws-lambda-event-sources";
|
8
8
|
import { ComparisonOperator, TreatMissingData } from "aws-cdk-lib/aws-cloudwatch";
|
9
9
|
import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
|
10
|
+
import { MonitoredFunction } from "./stack/monitoredfunction.js";
|
11
|
+
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
12
|
+
import { logger } from "../runtime/dt-logger-default.js";
|
13
|
+
const DLQ_LAMBDA_CODE = `
|
14
|
+
import type { ObjectCannedACL } from "@aws-sdk/client-s3";
|
15
|
+
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
16
|
+
import { type NodeJsRuntimeStreamingBlobPayloadInputTypes } from "@smithy/types";
|
17
|
+
import { logger } from "./dt-logger-default.mjs";
|
18
|
+
|
19
|
+
|
20
|
+
const bucketName = "__bucketName__";
|
21
|
+
|
22
|
+
__upload__
|
23
|
+
|
24
|
+
exports.handler = async (event) => __handler__
|
25
|
+
`;
|
14
26
|
/**
|
15
27
|
* Construct for creating SQS-queues.
|
16
28
|
*
|
@@ -27,6 +39,7 @@ export class DigitrafficSqsQueue extends Queue {
|
|
27
39
|
queueName,
|
28
40
|
deadLetterQueue: props.deadLetterQueue ?? {
|
29
41
|
maxReceiveCount: 2,
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
30
43
|
queue: DigitrafficDLQueue.create(stack, name),
|
31
44
|
},
|
32
45
|
},
|
@@ -111,21 +124,8 @@ function createHandler() {
|
|
111
124
|
const millis = new Date().getTime();
|
112
125
|
const s3 = new S3Client({});
|
113
126
|
await Promise.all(event.Records.map((e, idx) => {
|
114
|
-
uploadToS3(s3, bucketName, e.body, `dlq-${millis}-${idx}.json`);
|
127
|
+
return uploadToS3(s3, bucketName, e.body, `dlq-${millis}-${idx}.json`);
|
115
128
|
}));
|
116
129
|
};
|
117
130
|
}
|
118
|
-
|
119
|
-
import type { ObjectCannedACL } from "@aws-sdk/client-s3";
|
120
|
-
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
121
|
-
import { type NodeJsRuntimeStreamingBlobPayloadInputTypes } from "@smithy/types";
|
122
|
-
import { logger } from "./dt-logger-default.mjs";
|
123
|
-
|
124
|
-
|
125
|
-
const bucketName = "__bucketName__";
|
126
|
-
|
127
|
-
__upload__
|
128
|
-
|
129
|
-
exports.handler = async (event) => __handler__
|
130
|
-
`;
|
131
|
-
//# sourceMappingURL=sqs-queue.mjs.map
|
131
|
+
//# sourceMappingURL=sqs-queue.js.map
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Architecture, Code, type FunctionProps, Runtime } from "aws-cdk-lib/aws-lambda";
|
1
|
+
import { Architecture, type Code, type FunctionProps, Runtime } from "aws-cdk-lib/aws-lambda";
|
2
2
|
import type { IVpc, SubnetSelection } from "aws-cdk-lib/aws-ec2";
|
3
|
-
import { Role } from "aws-cdk-lib/aws-iam";
|
4
|
-
import { DigitrafficStack } from "./stack.
|
5
|
-
import type { MonitoredFunctionAlarmProps } from "./monitoredfunction.
|
3
|
+
import type { Role } from "aws-cdk-lib/aws-iam";
|
4
|
+
import type { DigitrafficStack } from "./stack.js";
|
5
|
+
import type { MonitoredFunctionAlarmProps } from "./monitoredfunction.js";
|
6
6
|
export type LambdaEnvironment = Record<string, string>;
|
7
7
|
export type DBLambdaEnvironment = LambdaEnvironment & {
|
8
8
|
SECRET_ID?: string;
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import { Architecture, AssetCode,
|
1
|
+
import { Architecture, AssetCode, Runtime } from "aws-cdk-lib/aws-lambda";
|
2
2
|
import { Duration } from "aws-cdk-lib";
|
3
3
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
4
|
-
import { Role } from "aws-cdk-lib/aws-iam";
|
5
|
-
import { DigitrafficStack } from "./stack.mjs";
|
6
4
|
export function databaseFunctionProps(stack, environment, lambdaName, simpleLambdaName, config) {
|
7
5
|
const vpcSubnets = stack.vpc
|
8
6
|
? {
|
@@ -34,9 +32,7 @@ export function lambdaFunctionProps(_, environment, lambdaName, simpleLambdaName
|
|
34
32
|
};
|
35
33
|
}
|
36
34
|
function getAssetCode(simpleLambdaName, isSingleLambda) {
|
37
|
-
const lambdaPath = isSingleLambda
|
38
|
-
? `dist/lambda/`
|
39
|
-
: `dist/lambda/${simpleLambdaName}`;
|
35
|
+
const lambdaPath = isSingleLambda ? `dist/lambda/` : `dist/lambda/${simpleLambdaName}`;
|
40
36
|
return new AssetCode(lambdaPath);
|
41
37
|
}
|
42
38
|
export function defaultLambdaConfiguration(config) {
|
@@ -65,4 +61,4 @@ export function defaultLambdaConfiguration(config) {
|
|
65
61
|
}
|
66
62
|
return props;
|
67
63
|
}
|
68
|
-
//# sourceMappingURL=lambda-configs.
|
64
|
+
//# sourceMappingURL=lambda-configs.js.map
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Function, type FunctionProps } from "aws-cdk-lib/aws-lambda";
|
2
|
-
import { Stack } from "aws-cdk-lib";
|
2
|
+
import type { Stack } from "aws-cdk-lib";
|
3
3
|
import { ComparisonOperator } from "aws-cdk-lib/aws-cloudwatch";
|
4
|
-
import { DigitrafficStack } from "./stack.
|
4
|
+
import type { DigitrafficStack } from "./stack.js";
|
5
5
|
import type { ITopic } from "aws-cdk-lib/aws-sns";
|
6
|
-
import { type LambdaEnvironment, type MonitoredFunctionParameters } from "./lambda-configs.
|
7
|
-
import { TrafficType } from "../../../types/traffictype.
|
6
|
+
import { type LambdaEnvironment, type MonitoredFunctionParameters } from "./lambda-configs.js";
|
7
|
+
import type { TrafficType } from "../../../types/traffictype.js";
|
8
8
|
/**
|
9
9
|
* Allows customization of CloudWatch Alarm properties
|
10
10
|
*/
|
@@ -31,6 +31,17 @@ export declare class MonitoredFunction extends Function {
|
|
31
31
|
readonly givenName: string;
|
32
32
|
/** disable all alarms */
|
33
33
|
static readonly DISABLE_ALARMS: MonitoredFunctionProps;
|
34
|
+
/**
|
35
|
+
* @param scope Stack
|
36
|
+
* @param id Lambda construct Id
|
37
|
+
* @param functionProps Lambda function properties
|
38
|
+
* @param alarmSnsTopic SNS topic for alarms
|
39
|
+
* @param warningSnsTopic SNS topic for warnings
|
40
|
+
* @param production Is the stack a production stack, used for determining the alarm topic
|
41
|
+
* @param trafficType Traffic type, used for alarm names. Set to null if Lambda is not related to any traffic type.
|
42
|
+
* @param props Monitored function properties
|
43
|
+
*/
|
44
|
+
constructor(scope: Stack, id: string, functionProps: FunctionProps, alarmSnsTopic: ITopic, warningSnsTopic: ITopic, production: boolean, trafficType: TrafficType | null, props?: MonitoredFunctionProps);
|
34
45
|
/**
|
35
46
|
* Create new MonitoredFunction. Use topics from given DigitrafficStack.
|
36
47
|
*
|
@@ -51,17 +62,6 @@ export declare class MonitoredFunction extends Function {
|
|
51
62
|
* @param functionParameters Lambda function parameters
|
52
63
|
*/
|
53
64
|
static createV2(stack: DigitrafficStack, name: string, environment: LambdaEnvironment, functionParameters?: Partial<MonitoredFunctionParameters>): MonitoredFunction;
|
54
|
-
/**
|
55
|
-
* @param scope Stack
|
56
|
-
* @param id Lambda construct Id
|
57
|
-
* @param functionProps Lambda function properties
|
58
|
-
* @param alarmSnsTopic SNS topic for alarms
|
59
|
-
* @param warningSnsTopic SNS topic for warnings
|
60
|
-
* @param production Is the stack a production stack, used for determining the alarm topic
|
61
|
-
* @param trafficType Traffic type, used for alarm names. Set to null if Lambda is not related to any traffic type.
|
62
|
-
* @param props Monitored function properties
|
63
|
-
*/
|
64
|
-
constructor(scope: Stack, id: string, functionProps: FunctionProps, alarmSnsTopic: ITopic, warningSnsTopic: ITopic, production: boolean, trafficType: TrafficType | null, props?: MonitoredFunctionProps);
|
65
65
|
private createAlarm;
|
66
66
|
private getAlarmActionForEnv;
|
67
67
|
}
|
@@ -1,10 +1,7 @@
|
|
1
1
|
import { ApplicationLogLevel, Function, LoggingFormat, SystemLogLevel, } from "aws-cdk-lib/aws-lambda";
|
2
|
-
import { Stack } from "aws-cdk-lib";
|
3
2
|
import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
|
4
|
-
import { ComparisonOperator
|
5
|
-
import {
|
6
|
-
import { databaseFunctionProps, } from "./lambda-configs.mjs";
|
7
|
-
import { TrafficType } from "../../../types/traffictype.mjs";
|
3
|
+
import { ComparisonOperator } from "aws-cdk-lib/aws-cloudwatch";
|
4
|
+
import { databaseFunctionProps, } from "./lambda-configs.js";
|
8
5
|
import { chain } from "lodash-es";
|
9
6
|
/**
|
10
7
|
* Creates a Lambda function that monitors default CloudWatch Lambda metrics with CloudWatch Alarms.
|
@@ -26,42 +23,6 @@ export class MonitoredFunction extends Function {
|
|
26
23
|
create: false,
|
27
24
|
},
|
28
25
|
};
|
29
|
-
/**
|
30
|
-
* Create new MonitoredFunction. Use topics from given DigitrafficStack.
|
31
|
-
*
|
32
|
-
* @param stack DigitrafficStack
|
33
|
-
* @param id Lambda construct Id
|
34
|
-
* @param functionProps Lambda function properties
|
35
|
-
* @param props Monitored function properties
|
36
|
-
*/
|
37
|
-
static create(stack, id, functionProps, props) {
|
38
|
-
if (props === MonitoredFunction.DISABLE_ALARMS && stack.configuration.production) {
|
39
|
-
throw new Error(
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
41
|
-
`Function ${functionProps.functionName} has DISABLE_ALARMS. Remove before installing to production or define your own properties!`);
|
42
|
-
}
|
43
|
-
return new MonitoredFunction(stack, id, functionProps, stack.alarmTopic, stack.warningTopic, stack.configuration.production, stack.configuration.trafficType, props);
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* Create new MonitoredFunction. Use topics from given DigitrafficStack. Generate names from given name and configuration shortName.
|
47
|
-
*
|
48
|
-
* For example, shortName FOO and given name update-things will create function FOO-UpdateThings and use code from lambda/update-things/update-things.ts method handler.
|
49
|
-
*
|
50
|
-
* @param stack DigitrafficStack
|
51
|
-
* @param name param-case name
|
52
|
-
* @param environment Lambda environment
|
53
|
-
* @param functionParameters Lambda function parameters
|
54
|
-
*/
|
55
|
-
static createV2(stack, name, environment, functionParameters) {
|
56
|
-
const functionName = functionParameters?.functionName ??
|
57
|
-
`${stack.configuration.shortName}-${chain(name)
|
58
|
-
.camelCase()
|
59
|
-
.startCase()
|
60
|
-
.replace(/\s/g, "")
|
61
|
-
.value()}`;
|
62
|
-
const functionProps = databaseFunctionProps(stack, environment, functionName, name, functionParameters);
|
63
|
-
return MonitoredFunction.create(stack, functionName, functionProps, functionParameters);
|
64
|
-
}
|
65
26
|
/**
|
66
27
|
* @param scope Stack
|
67
28
|
* @param id Lambda construct Id
|
@@ -72,7 +33,9 @@ export class MonitoredFunction extends Function {
|
|
72
33
|
* @param trafficType Traffic type, used for alarm names. Set to null if Lambda is not related to any traffic type.
|
73
34
|
* @param props Monitored function properties
|
74
35
|
*/
|
75
|
-
constructor(scope, id, functionProps, alarmSnsTopic, warningSnsTopic, production,
|
36
|
+
constructor(scope, id, functionProps, alarmSnsTopic, warningSnsTopic, production,
|
37
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
38
|
+
trafficType, props) {
|
76
39
|
// Set default loggingFormat to JSON if not explicitly set to TEXT
|
77
40
|
super(scope, id, {
|
78
41
|
...{
|
@@ -107,6 +70,42 @@ export class MonitoredFunction extends Function {
|
|
107
70
|
this.createAlarm(scope, this.metricThrottles(), "Throttles", "Throttles alarm", "Has throttled", trafficType, this.getAlarmActionForEnv(alarmSnsAction, warningSnsAction, production), 0, 1, 1, ComparisonOperator.GREATER_THAN_THRESHOLD, props?.throttleAlarmProps);
|
108
71
|
}
|
109
72
|
}
|
73
|
+
/**
|
74
|
+
* Create new MonitoredFunction. Use topics from given DigitrafficStack.
|
75
|
+
*
|
76
|
+
* @param stack DigitrafficStack
|
77
|
+
* @param id Lambda construct Id
|
78
|
+
* @param functionProps Lambda function properties
|
79
|
+
* @param props Monitored function properties
|
80
|
+
*/
|
81
|
+
static create(stack, id, functionProps, props) {
|
82
|
+
if (props === MonitoredFunction.DISABLE_ALARMS && stack.configuration.production) {
|
83
|
+
throw new Error(
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
85
|
+
`Function ${functionProps.functionName} has DISABLE_ALARMS. Remove before installing to production or define your own properties!`);
|
86
|
+
}
|
87
|
+
return new MonitoredFunction(stack, id, functionProps, stack.alarmTopic, stack.warningTopic, stack.configuration.production, stack.configuration.trafficType, props);
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* Create new MonitoredFunction. Use topics from given DigitrafficStack. Generate names from given name and configuration shortName.
|
91
|
+
*
|
92
|
+
* For example, shortName FOO and given name update-things will create function FOO-UpdateThings and use code from lambda/update-things/update-things.ts method handler.
|
93
|
+
*
|
94
|
+
* @param stack DigitrafficStack
|
95
|
+
* @param name param-case name
|
96
|
+
* @param environment Lambda environment
|
97
|
+
* @param functionParameters Lambda function parameters
|
98
|
+
*/
|
99
|
+
static createV2(stack, name, environment, functionParameters) {
|
100
|
+
const functionName = functionParameters?.functionName ??
|
101
|
+
`${stack.configuration.shortName}-${chain(name)
|
102
|
+
.camelCase()
|
103
|
+
.startCase()
|
104
|
+
.replace(/\s/g, "")
|
105
|
+
.value()}`;
|
106
|
+
const functionProps = databaseFunctionProps(stack, environment, functionName, name, functionParameters);
|
107
|
+
return MonitoredFunction.create(stack, functionName, functionProps, functionParameters);
|
108
|
+
}
|
110
109
|
createAlarm(stack, metric, alarmId, alarmName, alarmDescription, trafficType, alarmSnsAction, threshold, evaluationPeriods, datapointsToAlarm, comparisonOperator, alarmProps) {
|
111
110
|
metric
|
112
111
|
.createAlarm(stack, `${this.node.id}-${alarmId}`, {
|
@@ -152,4 +151,4 @@ export class MonitoredDBFunction {
|
|
152
151
|
return mf;
|
153
152
|
}
|
154
153
|
}
|
155
|
-
//# sourceMappingURL=monitoredfunction.
|
154
|
+
//# sourceMappingURL=monitoredfunction.js.map
|
@@ -1,9 +1,16 @@
|
|
1
|
-
import { type IResource, type JsonSchema, Resource, type ResourceOptions, RestApi, type RestApiProps } from "aws-cdk-lib/aws-apigateway";
|
1
|
+
import { type IResource, type JsonSchema, type Resource, type ResourceOptions, RestApi, type RestApiProps } from "aws-cdk-lib/aws-apigateway";
|
2
2
|
import { PolicyDocument } from "aws-cdk-lib/aws-iam";
|
3
|
-
import { Construct } from "constructs";
|
4
|
-
import type { ModelWithReference } from "../../types/model-with-reference.
|
5
|
-
import { DocumentationPart } from "../documentation.
|
6
|
-
import { DigitrafficStack } from "./stack.
|
3
|
+
import type { Construct } from "constructs";
|
4
|
+
import type { ModelWithReference } from "../../types/model-with-reference.js";
|
5
|
+
import type { DocumentationPart } from "../documentation.js";
|
6
|
+
import type { DigitrafficStack } from "./stack.js";
|
7
|
+
export declare const PUBLIC_REST_API_CORS_CONFIG: {
|
8
|
+
readonly defaultCorsPreflightOptions: {
|
9
|
+
readonly allowOrigins: string[];
|
10
|
+
readonly allowHeaders: ["Content-Type", "X-Amz-Date", "Authorization", "X-Api-Key", "X-Amz-Security-Token", "Digitraffic-User"];
|
11
|
+
readonly allowMethods: ["OPTIONS", "GET", "HEAD"];
|
12
|
+
};
|
13
|
+
};
|
7
14
|
export declare class DigitrafficRestApi extends RestApi {
|
8
15
|
readonly apiKeyIds: string[];
|
9
16
|
readonly enableDocumentation: boolean;
|
@@ -46,4 +53,3 @@ export declare function setReturnCodeForMissingAuthenticationToken(returnCode: n
|
|
46
53
|
export declare function createRestApi(stack: Construct, apiId: string, apiName: string, allowFromIpAddresses?: string[] | undefined): RestApi;
|
47
54
|
export declare function createDefaultPolicyDocument(): PolicyDocument;
|
48
55
|
export declare function createIpRestrictionPolicyDocument(allowFromIpAddresses: string[]): PolicyDocument;
|
49
|
-
export declare const PUBLIC_REST_API_CORS_CONFIG: Partial<ResourceOptions>;
|
@@ -1,17 +1,28 @@
|
|
1
|
-
import { CfnDocumentationPart, Cors, EndpointType, GatewayResponse, MethodLoggingLevel,
|
1
|
+
import { CfnDocumentationPart, Cors, EndpointType, GatewayResponse, MethodLoggingLevel, ResponseType, RestApi, } from "aws-cdk-lib/aws-apigateway";
|
2
2
|
import { AnyPrincipal, Effect, PolicyDocument, PolicyStatement } from "aws-cdk-lib/aws-iam";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { DocumentationPart } from "../documentation.mjs";
|
7
|
-
import { createDefaultUsagePlan, createUsagePlan } from "../usage-plans.mjs";
|
8
|
-
import { DigitrafficStack } from "./stack.mjs";
|
3
|
+
import { getModelReference } from "../../../utils/api-model.js";
|
4
|
+
import { MediaType } from "../../types/mediatypes.js";
|
5
|
+
import { createDefaultUsagePlan, createUsagePlan } from "../usage-plans.js";
|
9
6
|
import { set } from "lodash-es";
|
7
|
+
export const PUBLIC_REST_API_CORS_CONFIG = {
|
8
|
+
defaultCorsPreflightOptions: {
|
9
|
+
allowOrigins: Cors.ALL_ORIGINS,
|
10
|
+
allowHeaders: [
|
11
|
+
"Content-Type",
|
12
|
+
"X-Amz-Date",
|
13
|
+
"Authorization",
|
14
|
+
"X-Api-Key",
|
15
|
+
"X-Amz-Security-Token",
|
16
|
+
"Digitraffic-User",
|
17
|
+
],
|
18
|
+
allowMethods: ["OPTIONS", "GET", "HEAD"],
|
19
|
+
},
|
20
|
+
};
|
10
21
|
export class DigitrafficRestApi extends RestApi {
|
11
22
|
apiKeyIds;
|
12
23
|
enableDocumentation;
|
13
24
|
constructor(stack, apiId, apiName, allowFromIpAddresses, config) {
|
14
|
-
const policyDocument = allowFromIpAddresses
|
25
|
+
const policyDocument = allowFromIpAddresses === null || allowFromIpAddresses === undefined
|
15
26
|
? createDefaultPolicyDocument()
|
16
27
|
: createIpRestrictionPolicyDocument(allowFromIpAddresses);
|
17
28
|
// override default config with given extra config
|
@@ -67,6 +78,7 @@ export class DigitrafficRestApi extends RestApi {
|
|
67
78
|
path: resource.path,
|
68
79
|
name: type !== "METHOD" ? parameterName : undefined,
|
69
80
|
};
|
81
|
+
// eslint-disable-next-line no-new
|
70
82
|
new CfnDocumentationPart(this.stack, resourceName, {
|
71
83
|
restApiId: resource.api.restApiId,
|
72
84
|
location,
|
@@ -78,6 +90,7 @@ export class DigitrafficRestApi extends RestApi {
|
|
78
90
|
documentationPart.forEach((dp) => this.addDocumentationPart(resource, dp.parameterName, `${resource.path}.${dp.parameterName}.Documentation`, dp.type, dp.documentationProperties));
|
79
91
|
}
|
80
92
|
else {
|
93
|
+
// eslint-disable-next-line no-console
|
81
94
|
console.info("Skipping documentation for %s", resource.path);
|
82
95
|
}
|
83
96
|
}
|
@@ -105,6 +118,7 @@ export class DigitrafficRestApi extends RestApi {
|
|
105
118
|
* @param stack Construct
|
106
119
|
*/
|
107
120
|
export function add404Support(restApi, stack) {
|
121
|
+
// eslint-disable-next-line no-new
|
108
122
|
new GatewayResponse(stack, `MissingAuthenticationTokenResponse-${restApi.restApiName}`, {
|
109
123
|
restApi,
|
110
124
|
type: ResponseType.MISSING_AUTHENTICATION_TOKEN,
|
@@ -115,6 +129,7 @@ export function add404Support(restApi, stack) {
|
|
115
129
|
});
|
116
130
|
}
|
117
131
|
export function add401Support(restApi, stack) {
|
132
|
+
// eslint-disable-next-line no-new
|
118
133
|
new GatewayResponse(stack, `AuthenticationFailedResponse-${restApi.restApiName}`, {
|
119
134
|
restApi,
|
120
135
|
type: ResponseType.UNAUTHORIZED,
|
@@ -134,6 +149,7 @@ export function add401Support(restApi, stack) {
|
|
134
149
|
* @param stack Construct
|
135
150
|
*/
|
136
151
|
export function setReturnCodeForMissingAuthenticationToken(returnCode, message, restApi, stack) {
|
152
|
+
// eslint-disable-next-line no-new
|
137
153
|
new GatewayResponse(stack, `MissingAuthenticationTokenResponse-${restApi.restApiName}`, {
|
138
154
|
restApi,
|
139
155
|
type: ResponseType.MISSING_AUTHENTICATION_TOKEN,
|
@@ -144,7 +160,7 @@ export function setReturnCodeForMissingAuthenticationToken(returnCode, message,
|
|
144
160
|
});
|
145
161
|
}
|
146
162
|
export function createRestApi(stack, apiId, apiName, allowFromIpAddresses) {
|
147
|
-
const policyDocument = allowFromIpAddresses
|
163
|
+
const policyDocument = allowFromIpAddresses === null || allowFromIpAddresses === undefined
|
148
164
|
? createDefaultPolicyDocument()
|
149
165
|
: createIpRestrictionPolicyDocument(allowFromIpAddresses);
|
150
166
|
const restApi = new RestApi(stack, apiId, {
|
@@ -187,18 +203,4 @@ export function createIpRestrictionPolicyDocument(allowFromIpAddresses) {
|
|
187
203
|
],
|
188
204
|
});
|
189
205
|
}
|
190
|
-
|
191
|
-
defaultCorsPreflightOptions: {
|
192
|
-
allowOrigins: Cors.ALL_ORIGINS,
|
193
|
-
allowHeaders: [
|
194
|
-
"Content-Type",
|
195
|
-
"X-Amz-Date",
|
196
|
-
"Authorization",
|
197
|
-
"X-Api-Key",
|
198
|
-
"X-Amz-Security-Token",
|
199
|
-
"Digitraffic-User",
|
200
|
-
],
|
201
|
-
allowMethods: ["OPTIONS", "GET", "HEAD"],
|
202
|
-
},
|
203
|
-
};
|
204
|
-
//# sourceMappingURL=rest_apis.mjs.map
|
206
|
+
//# sourceMappingURL=rest_apis.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Annotations, Stack } from "aws-cdk-lib";
|
2
2
|
import { CfnFunction, Runtime } from "aws-cdk-lib/aws-lambda";
|
3
3
|
import { CfnBucket } from "aws-cdk-lib/aws-s3";
|
4
|
-
import { DigitrafficStack, SOLUTION_KEY } from "./stack.
|
4
|
+
import { DigitrafficStack, SOLUTION_KEY } from "./stack.js";
|
5
5
|
import { CfnMethod, CfnResource } from "aws-cdk-lib/aws-apigateway";
|
6
6
|
import { CfnQueue } from "aws-cdk-lib/aws-sqs";
|
7
7
|
import { LogRetention } from "aws-cdk-lib/aws-logs";
|
@@ -42,6 +42,7 @@ export class StackCheckingAspect {
|
|
42
42
|
}
|
43
43
|
isWhitelisted(key) {
|
44
44
|
return this.whitelistedResources?.some((wl) => {
|
45
|
+
// eslint-disable-next-line @rushstack/security/no-unsafe-regexp
|
45
46
|
return key.matchAll(new RegExp(wl, "g"));
|
46
47
|
});
|
47
48
|
}
|
@@ -114,6 +115,9 @@ export class StackCheckingAspect {
|
|
114
115
|
}
|
115
116
|
}
|
116
117
|
static isValidPath(path) {
|
118
|
+
if (!path) {
|
119
|
+
return false;
|
120
|
+
}
|
117
121
|
// if path includes . or { check only the trailing part of path
|
118
122
|
if (path.includes(".")) {
|
119
123
|
return this.isValidPath(path.split(".")[0]);
|
@@ -159,6 +163,7 @@ export class StackCheckingAspect {
|
|
159
163
|
checkLogGroupRetention(node) {
|
160
164
|
if (node instanceof LogRetention) {
|
161
165
|
const child = node.node.defaultChild;
|
166
|
+
// eslint-disable-next-line dot-notation
|
162
167
|
const retention = child?.["_cfnProperties"]?.["RetentionInDays"];
|
163
168
|
if (!retention) {
|
164
169
|
this.addAnnotation(node, ResourceType.logGroupRetention, "Log group must define log group retention");
|
@@ -166,4 +171,4 @@ export class StackCheckingAspect {
|
|
166
171
|
}
|
167
172
|
}
|
168
173
|
}
|
169
|
-
//# sourceMappingURL=stack-checking-aspect.
|
174
|
+
//# sourceMappingURL=stack-checking-aspect.js.map
|
@@ -2,10 +2,10 @@ import { Stack, type StackProps } from "aws-cdk-lib";
|
|
2
2
|
import { type ISecurityGroup, type IVpc } from "aws-cdk-lib/aws-ec2";
|
3
3
|
import { type ITopic } from "aws-cdk-lib/aws-sns";
|
4
4
|
import { type ISecret } from "aws-cdk-lib/aws-secretsmanager";
|
5
|
-
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
6
|
-
import { Construct } from "constructs";
|
7
|
-
import { TrafficType } from "../../../types/traffictype.
|
8
|
-
import type { DBLambdaEnvironment } from "./lambda-configs.
|
5
|
+
import type { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
6
|
+
import type { Construct } from "constructs";
|
7
|
+
import type { TrafficType } from "../../../types/traffictype.js";
|
8
|
+
import type { DBLambdaEnvironment } from "./lambda-configs.js";
|
9
9
|
export declare const SOLUTION_KEY = "Solution";
|
10
10
|
export declare const SSM_KEY_WARNING_TOPIC = "/digitraffic/monitoring/warning-topic";
|
11
11
|
export declare const SSM_KEY_ALARM_TOPIC = "/digitraffic/monitoring/alarm-topic";
|
@@ -3,10 +3,7 @@ import { SecurityGroup, Vpc } from "aws-cdk-lib/aws-ec2";
|
|
3
3
|
import { Topic } from "aws-cdk-lib/aws-sns";
|
4
4
|
import { StringParameter } from "aws-cdk-lib/aws-ssm";
|
5
5
|
import { Secret } from "aws-cdk-lib/aws-secretsmanager";
|
6
|
-
import {
|
7
|
-
import { StackCheckingAspect } from "./stack-checking-aspect.mjs";
|
8
|
-
import { Construct } from "constructs";
|
9
|
-
import { TrafficType } from "../../../types/traffictype.mjs";
|
6
|
+
import { StackCheckingAspect } from "./stack-checking-aspect.js";
|
10
7
|
const SSM_ROOT = "/digitraffic";
|
11
8
|
export const SOLUTION_KEY = "Solution";
|
12
9
|
const MONITORING_ROOT = "/monitoring";
|
@@ -70,4 +67,4 @@ export class DigitrafficStack extends Stack {
|
|
70
67
|
lambdas.forEach((l) => secret.grantRead(l));
|
71
68
|
}
|
72
69
|
}
|
73
|
-
//# sourceMappingURL=stack.
|
70
|
+
//# sourceMappingURL=stack.js.map
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { CfnSubscriptionFilter } from "aws-cdk-lib/aws-logs";
|
2
|
-
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
3
|
-
import { DigitrafficStack } from "./stack.
|
4
|
-
import { Construct } from "constructs";
|
5
|
-
import { MonitoredFunction } from "./monitoredfunction.
|
2
|
+
import type { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
3
|
+
import type { DigitrafficStack } from "./stack.js";
|
4
|
+
import type { Construct } from "constructs";
|
5
|
+
import type { MonitoredFunction } from "./monitoredfunction.js";
|
6
6
|
/**
|
7
7
|
* Creates a subscription filter that subscribes to a Lambda Log Group and delivers the logs to another destination.
|
8
8
|
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html
|
@@ -1,8 +1,4 @@
|
|
1
1
|
import { CfnSubscriptionFilter } from "aws-cdk-lib/aws-logs";
|
2
|
-
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
3
|
-
import { DigitrafficStack } from "./stack.mjs";
|
4
|
-
import { Construct } from "constructs";
|
5
|
-
import { MonitoredFunction } from "./monitoredfunction.mjs";
|
6
2
|
/**
|
7
3
|
* Creates a subscription filter that subscribes to a Lambda Log Group and delivers the logs to another destination.
|
8
4
|
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html
|
@@ -12,7 +8,7 @@ import { MonitoredFunction } from "./monitoredfunction.mjs";
|
|
12
8
|
* @param stack CloudFormation stack
|
13
9
|
*/
|
14
10
|
export function createSubscription(lambda, lambdaName, logDestinationArn, stack) {
|
15
|
-
if (logDestinationArn
|
11
|
+
if (logDestinationArn === undefined || logDestinationArn === null) {
|
16
12
|
return undefined;
|
17
13
|
}
|
18
14
|
const filter = new CfnSubscriptionFilter(stack, `${lambdaName}LogsSubscription`, {
|
@@ -38,4 +34,4 @@ export class DigitrafficLogSubscriptions {
|
|
38
34
|
}
|
39
35
|
}
|
40
36
|
}
|
41
|
-
//# sourceMappingURL=subscription.
|
37
|
+
//# sourceMappingURL=subscription.js.map
|