@digitraffic/common 2024.1.10-1 → 2024.1.19-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.
Files changed (166) hide show
  1. package/dist/aws/infra/api/handler-factory.d.ts +2 -2
  2. package/dist/aws/infra/api/handler-factory.js +4 -9
  3. package/dist/aws/infra/api/integration.d.ts +1 -1
  4. package/dist/aws/infra/api/integration.js +9 -13
  5. package/dist/aws/infra/api/response.d.ts +2 -3
  6. package/dist/aws/infra/api/response.js +25 -30
  7. package/dist/aws/infra/api/responses.d.ts +2 -3
  8. package/dist/aws/infra/api/responses.js +25 -31
  9. package/dist/aws/infra/api/static-integration.d.ts +1 -1
  10. package/dist/aws/infra/api/static-integration.js +7 -11
  11. package/dist/aws/infra/canaries/canary-alarm.d.ts +1 -1
  12. package/dist/aws/infra/canaries/canary-alarm.js +7 -11
  13. package/dist/aws/infra/canaries/canary-keys.js +3 -6
  14. package/dist/aws/infra/canaries/canary-parameters.js +1 -2
  15. package/dist/aws/infra/canaries/canary-role.js +8 -12
  16. package/dist/aws/infra/canaries/canary.d.ts +2 -2
  17. package/dist/aws/infra/canaries/canary.js +9 -13
  18. package/dist/aws/infra/canaries/database-canary.d.ts +3 -3
  19. package/dist/aws/infra/canaries/database-canary.js +8 -12
  20. package/dist/aws/infra/canaries/database-checker.d.ts +1 -1
  21. package/dist/aws/infra/canaries/database-checker.js +10 -14
  22. package/dist/aws/infra/canaries/url-canary.d.ts +4 -4
  23. package/dist/aws/infra/canaries/url-canary.js +8 -12
  24. package/dist/aws/infra/canaries/url-checker.d.ts +2 -2
  25. package/dist/aws/infra/canaries/url-checker.js +33 -40
  26. package/dist/aws/infra/documentation.js +8 -16
  27. package/dist/aws/infra/import-util.js +10 -18
  28. package/dist/aws/infra/scheduler.js +10 -14
  29. package/dist/aws/infra/security-rule.js +4 -8
  30. package/dist/aws/infra/sqs-integration.d.ts +1 -2
  31. package/dist/aws/infra/sqs-integration.js +11 -15
  32. package/dist/aws/infra/sqs-queue.d.ts +1 -1
  33. package/dist/aws/infra/sqs-queue.js +30 -35
  34. package/dist/aws/infra/stack/lambda-configs.d.ts +2 -2
  35. package/dist/aws/infra/stack/lambda-configs.js +14 -20
  36. package/dist/aws/infra/stack/monitoredfunction.d.ts +3 -3
  37. package/dist/aws/infra/stack/monitoredfunction.js +19 -27
  38. package/dist/aws/infra/stack/parameters.d.ts +1 -1
  39. package/dist/aws/infra/stack/parameters.js +5 -10
  40. package/dist/aws/infra/stack/rest_apis.d.ts +3 -3
  41. package/dist/aws/infra/stack/rest_apis.js +41 -54
  42. package/dist/aws/infra/stack/stack-checking-aspect.d.ts +1 -1
  43. package/dist/aws/infra/stack/stack-checking-aspect.js +24 -31
  44. package/dist/aws/infra/stack/stack.d.ts +3 -4
  45. package/dist/aws/infra/stack/stack.js +16 -20
  46. package/dist/aws/infra/stack/subscription.d.ts +2 -2
  47. package/dist/aws/infra/stack/subscription.js +5 -10
  48. package/dist/aws/infra/stacks/db-dns-stack.d.ts +2 -2
  49. package/dist/aws/infra/stacks/db-dns-stack.js +25 -29
  50. package/dist/aws/infra/stacks/db-proxy-stack.d.ts +2 -2
  51. package/dist/aws/infra/stacks/db-proxy-stack.js +23 -27
  52. package/dist/aws/infra/stacks/db-stack.d.ts +3 -4
  53. package/dist/aws/infra/stacks/db-stack.js +30 -34
  54. package/dist/aws/infra/stacks/intra-stack-configuration.js +1 -2
  55. package/dist/aws/infra/stacks/network-stack.d.ts +2 -2
  56. package/dist/aws/infra/stacks/network-stack.js +14 -18
  57. package/dist/aws/infra/usage-plans.js +2 -7
  58. package/dist/aws/runtime/apikey.js +3 -7
  59. package/dist/aws/runtime/digitraffic-integration-response.d.ts +1 -1
  60. package/dist/aws/runtime/digitraffic-integration-response.js +7 -11
  61. package/dist/aws/runtime/dt-logger-default.d.ts +2 -2
  62. package/dist/aws/runtime/dt-logger-default.js +2 -5
  63. package/dist/aws/runtime/dt-logger.d.ts +1 -1
  64. package/dist/aws/runtime/dt-logger.js +3 -10
  65. package/dist/aws/runtime/environment.js +3 -7
  66. package/dist/aws/runtime/messaging.js +1 -5
  67. package/dist/aws/runtime/s3.js +3 -7
  68. package/dist/aws/runtime/secrets/dbsecret.d.ts +1 -1
  69. package/dist/aws/runtime/secrets/dbsecret.js +5 -9
  70. package/dist/aws/runtime/secrets/proxy-holder.js +12 -16
  71. package/dist/aws/runtime/secrets/rds-holder.js +12 -16
  72. package/dist/aws/runtime/secrets/secret-holder.d.ts +1 -1
  73. package/dist/aws/runtime/secrets/secret-holder.js +9 -13
  74. package/dist/aws/runtime/secrets/secret.js +7 -11
  75. package/dist/aws/types/errors.js +5 -9
  76. package/dist/aws/types/lambda-response.js +3 -10
  77. package/dist/aws/types/mediatypes.js +2 -5
  78. package/dist/aws/types/model-with-reference.js +1 -2
  79. package/dist/aws/types/proxytypes.js +1 -2
  80. package/dist/aws/types/tags.js +2 -5
  81. package/dist/database/cached.d.ts +1 -1
  82. package/dist/database/cached.js +8 -14
  83. package/dist/database/database.js +14 -21
  84. package/dist/database/last-updated.d.ts +1 -1
  85. package/dist/database/last-updated.js +8 -17
  86. package/dist/database/models.js +1 -2
  87. package/dist/index.d.ts +1 -0
  88. package/dist/index.js +2 -0
  89. package/dist/marine/id_utils.js +3 -9
  90. package/dist/marine/rtz.js +1 -2
  91. package/dist/test/asserter.js +1 -5
  92. package/dist/test/db-testutils.d.ts +1 -1
  93. package/dist/test/db-testutils.js +8 -13
  94. package/dist/test/httpserver.js +10 -14
  95. package/dist/test/secrets-manager.js +9 -35
  96. package/dist/test/testutils.js +8 -19
  97. package/dist/types/async-timeout-error.js +1 -5
  98. package/dist/types/aws-env.js +1 -2
  99. package/dist/types/either.js +1 -2
  100. package/dist/types/http-error.js +1 -5
  101. package/dist/types/input-error.js +1 -5
  102. package/dist/types/language.js +2 -5
  103. package/dist/types/nullable.d.ts +1 -1
  104. package/dist/types/nullable.js +1 -2
  105. package/dist/types/traffictype.js +2 -5
  106. package/dist/types/urn.js +1 -2
  107. package/dist/types/util-types.js +1 -2
  108. package/dist/types/validator.js +4 -9
  109. package/dist/utils/api-model.d.ts +1 -1
  110. package/dist/utils/api-model.js +17 -27
  111. package/dist/utils/base64.d.ts +1 -1
  112. package/dist/utils/base64.js +2 -7
  113. package/dist/utils/date-utils.js +9 -16
  114. package/dist/utils/geojson-types.js +2 -7
  115. package/dist/utils/geometry.js +15 -48
  116. package/dist/utils/logging.d.ts +1 -1
  117. package/dist/utils/logging.js +8 -13
  118. package/dist/utils/retry.js +21 -26
  119. package/dist/utils/slack.js +7 -14
  120. package/dist/utils/utils.d.ts +2 -2
  121. package/dist/utils/utils.js +14 -29
  122. package/package.json +107 -18
  123. package/src/aws/infra/api/handler-factory.ts +3 -3
  124. package/src/aws/infra/api/integration.ts +2 -2
  125. package/src/aws/infra/api/response.ts +3 -3
  126. package/src/aws/infra/api/responses.ts +4 -4
  127. package/src/aws/infra/api/static-integration.ts +2 -2
  128. package/src/aws/infra/canaries/canary-alarm.ts +1 -1
  129. package/src/aws/infra/canaries/canary.ts +3 -3
  130. package/src/aws/infra/canaries/database-canary.ts +3 -3
  131. package/src/aws/infra/canaries/database-checker.ts +6 -6
  132. package/src/aws/infra/canaries/url-canary.ts +6 -6
  133. package/src/aws/infra/canaries/url-checker.ts +8 -8
  134. package/src/aws/infra/sqs-integration.ts +1 -1
  135. package/src/aws/infra/sqs-queue.ts +2 -2
  136. package/src/aws/infra/stack/lambda-configs.ts +2 -2
  137. package/src/aws/infra/stack/monitoredfunction.ts +4 -4
  138. package/src/aws/infra/stack/parameters.ts +1 -1
  139. package/src/aws/infra/stack/rest_apis.ts +6 -6
  140. package/src/aws/infra/stack/stack-checking-aspect.ts +1 -1
  141. package/src/aws/infra/stack/stack.ts +4 -5
  142. package/src/aws/infra/stack/subscription.ts +2 -2
  143. package/src/aws/infra/stacks/db-dns-stack.ts +4 -4
  144. package/src/aws/infra/stacks/db-proxy-stack.ts +5 -5
  145. package/src/aws/infra/stacks/db-stack.ts +5 -5
  146. package/src/aws/infra/stacks/network-stack.ts +3 -3
  147. package/src/aws/runtime/digitraffic-integration-response.ts +2 -2
  148. package/src/aws/runtime/dt-logger-default.ts +2 -2
  149. package/src/aws/runtime/secrets/dbsecret.ts +1 -1
  150. package/src/aws/runtime/secrets/proxy-holder.ts +4 -4
  151. package/src/aws/runtime/secrets/rds-holder.ts +4 -4
  152. package/src/aws/runtime/secrets/secret-holder.ts +4 -4
  153. package/src/aws/runtime/secrets/secret.ts +2 -2
  154. package/src/database/cached.ts +1 -1
  155. package/src/database/database.ts +3 -3
  156. package/src/database/last-updated.ts +1 -1
  157. package/src/index.ts +2 -0
  158. package/src/test/db-testutils.ts +2 -2
  159. package/src/test/secrets-manager.ts +2 -2
  160. package/src/types/nullable.ts +1 -1
  161. package/src/utils/api-model.ts +1 -1
  162. package/src/utils/geometry.ts +5 -3
  163. package/src/utils/logging.ts +2 -2
  164. package/src/utils/retry.ts +3 -3
  165. package/src/utils/slack.ts +2 -2
  166. package/src/utils/utils.ts +3 -3
@@ -1,12 +1,12 @@
1
1
  import { Role } from "aws-cdk-lib/aws-iam";
2
2
  import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
3
3
  import { CfnCanary } from "aws-cdk-lib/aws-synthetics";
4
- import { LambdaEnvironment } from "../stack/lambda-configs";
5
- import { DigitrafficRestApi } from "../stack/rest_apis";
6
- import { DigitrafficStack } from "../stack/stack";
7
- import { DigitrafficCanary } from "./canary";
8
- import { ENV_API_KEY, ENV_HOSTNAME, ENV_SECRET } from "./canary-keys";
9
- import { CanaryParameters } from "./canary-parameters";
4
+ import { LambdaEnvironment } from "../stack/lambda-configs.js";
5
+ import { DigitrafficRestApi } from "../stack/rest_apis.js";
6
+ import { DigitrafficStack } from "../stack/stack.js";
7
+ import { DigitrafficCanary } from "./canary.js";
8
+ import { ENV_API_KEY, ENV_HOSTNAME, ENV_SECRET } from "./canary-keys.js";
9
+ import { CanaryParameters } from "./canary-parameters.js";
10
10
 
11
11
  export interface UrlCanaryParameters extends CanaryParameters {
12
12
  readonly hostname: string;
@@ -1,17 +1,17 @@
1
1
  import { IncomingMessage, RequestOptions } from "http";
2
- import { Asserter } from "../../../test/asserter";
2
+ import { Asserter } from "../../../test/asserter.js";
3
3
 
4
4
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
5
5
  const synthetics: Synthetics = require("Synthetics");
6
6
  import zlib = require("zlib");
7
- import { MediaType } from "../../types/mediatypes";
8
- import { getApiKeyFromAPIGateway } from "../../runtime/apikey";
7
+ import { MediaType } from "../../types/mediatypes.js";
8
+ import { getApiKeyFromAPIGateway } from "../../runtime/apikey.js";
9
9
  import { FeatureCollection } from "geojson";
10
- import { isValidGeoJson } from "../../../utils/geometry";
11
- import { getEnvVariable } from "../../../utils/utils";
12
- import { ENV_API_KEY, ENV_HOSTNAME } from "./canary-keys";
13
- import { logger } from "../../runtime/dt-logger-default";
14
- import { logException } from "../../../utils/logging";
10
+ import { isValidGeoJson } from "../../../utils/geometry.js";
11
+ import { getEnvVariable } from "../../../utils/utils.js";
12
+ import { ENV_API_KEY, ENV_HOSTNAME } from "./canary-keys.js";
13
+ import { logger } from "../../runtime/dt-logger-default.js";
14
+ import { logException } from "../../../utils/logging.js";
15
15
 
16
16
  export const API_KEY_HEADER = "x-api-key";
17
17
 
@@ -4,10 +4,10 @@ import {
4
4
  PassthroughBehavior,
5
5
  RequestValidator,
6
6
  Resource,
7
+ IModel
7
8
  } from "aws-cdk-lib/aws-apigateway";
8
9
  import { Queue } from "aws-cdk-lib/aws-sqs";
9
10
  import { PolicyStatement, Role, ServicePrincipal } from "aws-cdk-lib/aws-iam";
10
- import { IModel } from "aws-cdk-lib/aws-apigateway/lib/model";
11
11
  import { Construct } from "constructs";
12
12
 
13
13
  export function attachQueueToApiGatewayResource(
@@ -10,8 +10,8 @@ import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
10
10
  import { S3, S3Client } from "@aws-sdk/client-s3";
11
11
  import { Upload } from "@aws-sdk/lib-storage";
12
12
  import { SQSEvent, SQSHandler, SQSRecord } from "aws-lambda";
13
- import { DigitrafficStack } from "./stack/stack";
14
- import { MonitoredFunction } from "./stack/monitoredfunction";
13
+ import { DigitrafficStack } from "./stack/stack.js";
14
+ import { MonitoredFunction } from "./stack/monitoredfunction.js";
15
15
 
16
16
  /**
17
17
  * Construct for creating SQS-queues.
@@ -9,8 +9,8 @@ import { Duration } from "aws-cdk-lib";
9
9
  import { IVpc, SubnetSelection } from "aws-cdk-lib/aws-ec2";
10
10
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
11
11
  import { Role } from "aws-cdk-lib/aws-iam";
12
- import { DigitrafficStack } from "./stack";
13
- import { MonitoredFunctionAlarmProps } from "./monitoredfunction";
12
+ import { DigitrafficStack } from "./stack.js";
13
+ import { MonitoredFunctionAlarmProps } from "./monitoredfunction.js";
14
14
 
15
15
  export type LambdaEnvironment = Record<string, string>;
16
16
 
@@ -2,15 +2,15 @@ import { Function, FunctionProps } from "aws-cdk-lib/aws-lambda";
2
2
  import { Stack } from "aws-cdk-lib";
3
3
  import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
4
4
  import { ComparisonOperator, Metric } from "aws-cdk-lib/aws-cloudwatch";
5
- import { DigitrafficStack } from "../stack/stack";
5
+ import { DigitrafficStack } from "./stack.js";
6
6
  import { ITopic } from "aws-cdk-lib/aws-sns";
7
7
  import {
8
8
  databaseFunctionProps,
9
9
  LambdaEnvironment,
10
10
  MonitoredFunctionParameters,
11
- } from "../stack/lambda-configs";
12
- import { DigitrafficLogSubscriptions } from "../stack/subscription";
13
- import { TrafficType } from "../../../types/traffictype";
11
+ } from "./lambda-configs.js";
12
+ import { DigitrafficLogSubscriptions } from "./subscription.js";
13
+ import { TrafficType } from "../../../types/traffictype.js";
14
14
 
15
15
  import _ from "lodash";
16
16
 
@@ -1,5 +1,5 @@
1
1
  import { StringParameter } from "aws-cdk-lib/aws-ssm";
2
- import { Construct } from "constructs/lib/construct";
2
+ import { type Construct } from "constructs";
3
3
 
4
4
  const SSM_ROOT = "/digitraffic" as const;
5
5
  const MONITORING_ROOT = "/monitoring" as const;
@@ -19,12 +19,12 @@ import {
19
19
  PolicyStatement,
20
20
  } from "aws-cdk-lib/aws-iam";
21
21
  import { Construct } from "constructs";
22
- import { getModelReference } from "../../../utils/api-model";
23
- import { MediaType } from "../../types/mediatypes";
24
- import { ModelWithReference } from "../../types/model-with-reference";
25
- import { DocumentationPart, DocumentationProperties } from "../documentation";
26
- import { createDefaultUsagePlan, createUsagePlan } from "../usage-plans";
27
- import { DigitrafficStack } from "./stack";
22
+ import { getModelReference } from "../../../utils/api-model.js";
23
+ import { MediaType } from "../../types/mediatypes.js";
24
+ import { ModelWithReference } from "../../types/model-with-reference.js";
25
+ import { DocumentationPart, DocumentationProperties } from "../documentation.js";
26
+ import { createDefaultUsagePlan, createUsagePlan } from "../usage-plans.js";
27
+ import { DigitrafficStack } from "./stack.js";
28
28
 
29
29
  import _ from "lodash";
30
30
 
@@ -1,7 +1,7 @@
1
1
  import { Annotations, IAspect, 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 { IConstruct } from "constructs";
6
6
  import { CfnMethod, CfnResource } from "aws-cdk-lib/aws-apigateway";
7
7
  import { CfnQueue } from "aws-cdk-lib/aws-sqs";
@@ -1,15 +1,14 @@
1
1
  import { Aspects, Stack, StackProps } from "aws-cdk-lib";
2
- import { IVpc, SecurityGroup, Vpc } from "aws-cdk-lib/aws-ec2";
3
- import { ISecurityGroup } from "aws-cdk-lib/aws-ec2/lib/security-group";
2
+ import { type ISecurityGroup, IVpc, SecurityGroup, Vpc } from "aws-cdk-lib/aws-ec2";
4
3
  import { ITopic, Topic } from "aws-cdk-lib/aws-sns";
5
4
  import { StringParameter } from "aws-cdk-lib/aws-ssm";
6
5
  import { ISecret, Secret } from "aws-cdk-lib/aws-secretsmanager";
7
6
  import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
8
7
 
9
- import { StackCheckingAspect } from "./stack-checking-aspect";
8
+ import { StackCheckingAspect } from "./stack-checking-aspect.js";
10
9
  import { Construct } from "constructs";
11
- import { TrafficType } from "../../../types/traffictype";
12
- import { DBLambdaEnvironment } from "./lambda-configs";
10
+ import { TrafficType } from "../../../types/traffictype.js";
11
+ import { DBLambdaEnvironment } from "./lambda-configs.js";
13
12
 
14
13
  const SSM_ROOT = "/digitraffic";
15
14
  export const SOLUTION_KEY = "Solution";
@@ -1,8 +1,8 @@
1
1
  import { CfnSubscriptionFilter } from "aws-cdk-lib/aws-logs";
2
2
  import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
3
- import { DigitrafficStack } from "./stack";
3
+ import { DigitrafficStack } from "./stack.js";
4
4
  import { Construct } from "constructs";
5
- import { MonitoredFunction } from "./monitoredfunction";
5
+ import { MonitoredFunction } from "./monitoredfunction.js";
6
6
 
7
7
  /**
8
8
  * Creates a subscription filter that subscribes to a Lambda Log Group and delivers the logs to another destination.
@@ -1,14 +1,14 @@
1
1
  import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib";
2
- import { Construct } from "constructs/lib/construct";
2
+ import { type Construct } from "constructs";
3
3
  import {
4
4
  PrivateHostedZone,
5
5
  RecordSet,
6
6
  RecordTarget,
7
7
  RecordType,
8
8
  } from "aws-cdk-lib/aws-route53";
9
- import { InfraStackConfiguration } from "./intra-stack-configuration";
10
- import { importVpc } from "../import-util";
11
- import { getParameterValue } from "../stack/parameters";
9
+ import { InfraStackConfiguration } from "./intra-stack-configuration.js";
10
+ import { importVpc } from "../import-util.js";
11
+ import { getParameterValue } from "../stack/parameters.js";
12
12
 
13
13
  const DEFAULT_RECORD_TTL = Duration.seconds(30);
14
14
 
@@ -7,12 +7,12 @@ import {
7
7
  } from "aws-cdk-lib/aws-rds";
8
8
  import { ISecret, Secret } from "aws-cdk-lib/aws-secretsmanager";
9
9
  import { IVpc, SecurityGroup } from "aws-cdk-lib/aws-ec2";
10
- import { InfraStackConfiguration } from "./intra-stack-configuration";
11
- import { DbStack } from "./db-stack";
12
- import { exportValue, importVpc } from "../import-util";
13
- import { createParameter } from "../stack/parameters";
10
+ import { InfraStackConfiguration } from "./intra-stack-configuration.js";
11
+ import { DbStack } from "./db-stack.js";
12
+ import { exportValue, importVpc } from "../import-util.js";
13
+ import { createParameter } from "../stack/parameters.js";
14
14
  import { Stack, Duration } from "aws-cdk-lib/core";
15
- import { Construct } from "constructs/lib/construct";
15
+ import { Construct } from "constructs/lib/construct.js";
16
16
 
17
17
  export interface ProxyConfiguration {
18
18
  readonly secretArn: string;
@@ -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.js";
23
+ import { exportValue, importVpc } from "../import-util.js";
24
24
  import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib/core";
25
- import { createParameter } from "../stack/parameters";
25
+ import { createParameter } from "../stack/parameters.js";
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.js";
3
+ import { exportValue } from "../import-util.js";
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;
@@ -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.js";
3
3
  import {
4
4
  getDeprecatedDefaultLambdaResponse,
5
5
  RESPONSE_DEFAULT_LAMBDA,
6
- } from "../infra/api/response";
6
+ } from "../infra/api/response.js";
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.js";
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.js";
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,4 +1,4 @@
1
- import { GenericSecret } from "./secret";
1
+ import { GenericSecret } from "./secret.js";
2
2
 
3
3
  export enum RdsProxySecretKey {
4
4
  username = "username",
@@ -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.js";
2
+ import { RdsProxySecretKey, RdsProxySecret } from "./dbsecret.js";
3
+ import { getEnvVariable } from "../../../utils/utils.js";
4
+ import { DatabaseEnvironmentKeys } from "../../../database/database.js";
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.js";
2
+ import { RdsSecret, RdsSecretKey } from "./dbsecret.js";
3
+ import { getEnvVariable } from "../../../utils/utils.js";
4
+ import { DatabaseEnvironmentKeys } from "../../../database/database.js";
5
5
 
6
6
  const RDS_SECRET_KEYS = Object.values(RdsSecretKey);
7
7
 
@@ -1,7 +1,7 @@
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.js";
2
+ import { checkExpectedSecretKeys } from "./dbsecret.js";
3
+ import { getEnvVariable } from "../../../utils/utils.js";
4
+ import { logger } from "../dt-logger-default.js";
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
7
7
  const NodeTtl = require("node-ttl");
@@ -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.js";
3
+ import { EnvKeys } from "../environment.js";
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,5 @@
1
1
  import { PreparedStatement } from "pg-promise";
2
- import { DTDatabase, DTTransaction } from "./database";
2
+ import { DTDatabase, DTTransaction } from "./database.js";
3
3
 
4
4
  export interface CachedValue<T> {
5
5
  content: T;
@@ -1,7 +1,7 @@
1
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";
2
+ import { getEnvVariable, getEnvVariableOrElse } from "../utils/utils.js";
3
+ import { logger } from "../aws/runtime/dt-logger-default.js";
4
+ import { logException } from "../utils/logging.js";
5
5
 
6
6
  export enum DatabaseEnvironmentKeys {
7
7
  DB_USER = "DB_USER",
@@ -1,4 +1,4 @@
1
- import { DTDatabase, DTTransaction } from "./database";
1
+ import { DTDatabase, DTTransaction } from "./database.js";
2
2
 
3
3
  export enum DataType {
4
4
  VS_DATEX2 = "VS_DATEX2",
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { DigitrafficStack } from "./aws/infra/stack/stack.js";
2
+
@@ -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.js";
6
+ import { Countable } from "../database/models.js";
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
  import AWS = require("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.js";
4
+ import { setEnvVariable } from "../utils/utils.js";
5
5
 
6
6
  setEnvVariable(EnvKeys.AWS_REGION, "eu-west-1");
7
7
  const secretValue = sinon.stub();
@@ -1,4 +1,4 @@
1
- import { ValueOf } from "./util-types";
1
+ import { ValueOf } from "./util-types.js";
2
2
 
3
3
  /**
4
4
  * Adds `null` as an accepted type to all properties in given type.
@@ -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.js";
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.js";
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
- return geoJsonValidator.valid(json);
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
- return geoJsonValidator.isFeatureCollection(json);
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.js";
3
+ import { getEnvVariableOrElse } from "./utils.js";
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.js";
2
+ import { AsyncTimeoutError } from "../types/async-timeout-error.js";
3
+ import { logger } from "../aws/runtime/dt-logger-default.js";
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.js";
3
+ import { logException } from "./logging.js";
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.js";
2
+ import { Either } from "../types/either.js";
3
+ import { EnvKeys } from "../aws/runtime/environment.js";
4
4
 
5
5
  /**
6
6
  * Check if arrays have only elements that also exists also in other array.