@digitraffic/common 2026.4.17-2 → 2026.4.17-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import type { Stack } from "aws-cdk-lib";
2
1
  import { Duration } from "aws-cdk-lib";
3
2
  import type { ISecurityGroup } from "aws-cdk-lib/aws-ec2";
4
3
  import type { IRole } from "aws-cdk-lib/aws-iam";
@@ -7,7 +6,7 @@ import type { ILayerVersion } from "aws-cdk-lib/aws-lambda";
7
6
  import { Architecture, Function as AwsFunction, Code, Runtime } from "aws-cdk-lib/aws-lambda";
8
7
  import { DtFunctionAlarms } from "./dt-function-alarms.js";
9
8
  import type { LambdaEnvironment } from "./lambda-configs.js";
10
- import type { DigitrafficStackInterface } from "./stack.js";
9
+ import type { DigitrafficStack } from "./stack.js";
11
10
  export declare class FunctionBuilder {
12
11
  private readonly _stack;
13
12
  private readonly _name;
@@ -29,16 +28,16 @@ export declare class FunctionBuilder {
29
28
  private readonly policyStatements;
30
29
  private readonly allowedActions;
31
30
  private readonly _features;
32
- constructor(stack: Stack & DigitrafficStackInterface, lambdaName: string);
31
+ constructor(stack: DigitrafficStack, lambdaName: string);
33
32
  /**
34
33
  * Creates a new builder with defaults, using the lambdaName as a source for the lambda implementation (dist/lambdaName/lambdaName.js).
35
34
  * Database access is given by default.
36
35
  */
37
- static create(stack: Stack & DigitrafficStackInterface, lambdaName: string): FunctionBuilder;
36
+ static create(stack: DigitrafficStack, lambdaName: string): FunctionBuilder;
38
37
  /**
39
38
  * Creates a new builder with defaults, but without database or secret access.
40
39
  */
41
- static plain(stack: Stack & DigitrafficStackInterface, lambdaName: string): FunctionBuilder;
40
+ static plain(stack: DigitrafficStack, lambdaName: string): FunctionBuilder;
42
41
  /**
43
42
  * Stack only has one lambda. Default is that it has multiple lambdas.
44
43
  */
@@ -1,6 +1,6 @@
1
1
  import type { Stack } from "aws-cdk-lib";
2
2
  import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
3
- import type { DigitrafficStackInterface } from "./stack.js";
3
+ import type { DigitrafficStack } from "./stack.js";
4
4
  export interface CreateLambdaLogGroupParams {
5
5
  functionName: string;
6
6
  retention?: RetentionDays;
@@ -10,6 +10,6 @@ export interface CreateLambdaLogGroupParamsForStack extends CreateLambdaLogGroup
10
10
  shortName: string;
11
11
  }
12
12
  export interface CreateLambdaLogGroupParamsForDigitrafficStack extends CreateLambdaLogGroupParams {
13
- stack: Stack & DigitrafficStackInterface;
13
+ stack: DigitrafficStack;
14
14
  }
15
15
  export declare function createLambdaLogGroup(params: CreateLambdaLogGroupParamsForStack | CreateLambdaLogGroupParamsForDigitrafficStack): LogGroup;
@@ -1,4 +1,3 @@
1
- import type { Stack } from "aws-cdk-lib";
2
1
  import type { IResource, JsonSchema, Resource, ResourceOptions, RestApiProps } from "aws-cdk-lib/aws-apigateway";
3
2
  import { RestApi } from "aws-cdk-lib/aws-apigateway";
4
3
  import { PolicyDocument } from "aws-cdk-lib/aws-iam";
@@ -6,7 +5,7 @@ import { StringParameter } from "aws-cdk-lib/aws-ssm";
6
5
  import type { Construct } from "constructs";
7
6
  import type { ModelWithReference } from "../../types/model-with-reference.js";
8
7
  import type { DocumentationPart } from "../documentation.js";
9
- import type { DigitrafficStackInterface } from "./stack.js";
8
+ import type { DigitrafficStack } from "./stack.js";
10
9
  export declare const PUBLIC_REST_API_CORS_CONFIG: {
11
10
  readonly defaultCorsPreflightOptions: {
12
11
  readonly allowOrigins: string[];
@@ -24,7 +23,7 @@ export declare class DigitrafficRestApi extends RestApi {
24
23
  readonly apiKeyIds: string[];
25
24
  readonly enableDocumentation: boolean;
26
25
  private readonly _stack;
27
- constructor(stack: Stack & DigitrafficStackInterface, apiId: string, apiName: string, allowFromIpAddresses?: string[] | undefined, config?: Partial<RestApiProps>);
26
+ constructor(stack: DigitrafficStack, apiId: string, apiName: string, allowFromIpAddresses?: string[] | undefined, config?: Partial<RestApiProps>);
28
27
  hostname(): string;
29
28
  /** Export end point and api key to Parameter store */
30
29
  exportEndpoint(): [StringParameter, StringParameter];
@@ -29,18 +29,7 @@ export interface StackConfiguration {
29
29
  };
30
30
  readonly whitelistedResources?: string[];
31
31
  }
32
- export interface DigitrafficStackInterface {
33
- readonly configuration: StackConfiguration;
34
- readonly vpc?: IVpc;
35
- readonly lambdaDbSg?: ISecurityGroup;
36
- readonly alarmTopic: ITopic;
37
- readonly warningTopic: ITopic;
38
- createLambdaEnvironment(): DBLambdaEnvironment;
39
- createDefaultLambdaEnvironment(dbApplication: string): DBLambdaEnvironment;
40
- getSecret(): ISecret;
41
- grantSecret(...lambdas: AWSFunction[]): void;
42
- }
43
- export declare class DigitrafficStack extends Stack implements DigitrafficStackInterface {
32
+ export declare class DigitrafficStack extends Stack {
44
33
  readonly vpc?: IVpc;
45
34
  readonly lambdaDbSg?: ISecurityGroup;
46
35
  readonly alarmTopic: ITopic;
@@ -6,9 +6,7 @@ import type { InfraStackConfiguration } from "./intra-stack-configuration.js";
6
6
  export interface NetworkConfiguration {
7
7
  readonly vpcName: string;
8
8
  readonly cidr: string;
9
- readonly transitGatewayId?: string;
10
9
  }
11
- /** Creates a network stack with VPC and optional transit gateway routing */
12
10
  export declare class NetworkStack extends Stack {
13
11
  readonly vpc: IVpc;
14
12
  constructor(scope: Construct, id: string, isc: InfraStackConfiguration, configuration: NetworkConfiguration);
@@ -1,7 +1,6 @@
1
- import { CfnRoute, IpAddresses, SubnetType, Vpc } from "aws-cdk-lib/aws-ec2";
1
+ import { IpAddresses, SubnetType, Vpc } from "aws-cdk-lib/aws-ec2";
2
2
  import { Stack } from "aws-cdk-lib/core";
3
3
  import { exportValue } from "../import-util.js";
4
- /** Creates a network stack with VPC and optional transit gateway routing */
5
4
  export class NetworkStack extends Stack {
6
5
  vpc;
7
6
  constructor(scope, id, isc, configuration) {
@@ -22,13 +21,11 @@ export class NetworkStack extends Stack {
22
21
  exportValue(this, isc.environmentName, "digitrafficprivateBSubnet", this.vpc.privateSubnets[1].subnetId);
23
22
  }
24
23
  createVpc(configuration) {
25
- const vpc = new Vpc(this, "DigitrafficVPC", {
24
+ return new Vpc(this, "DigitrafficVPC", {
26
25
  vpcName: configuration.vpcName,
27
- restrictDefaultSecurityGroup: false,
28
26
  availabilityZones: Stack.of(this).availabilityZones.sort().slice(0, 2), // take two first azs
29
27
  enableDnsHostnames: true,
30
28
  enableDnsSupport: true,
31
- natGateways: configuration.transitGatewayId ? 0 : 2, // one for each AZ, or none if using transit gateway
32
29
  ipAddresses: IpAddresses.cidr(configuration.cidr),
33
30
  subnetConfiguration: [
34
31
  {
@@ -43,17 +40,6 @@ export class NetworkStack extends Stack {
43
40
  },
44
41
  ],
45
42
  });
46
- // route traffic to transit gateway
47
- if (configuration.transitGatewayId) {
48
- vpc.selectSubnets(undefined).subnets.forEach((subnet) => {
49
- new CfnRoute(this, `SubnetRouteToTgw${subnet.node.id}`, {
50
- routeTableId: subnet.routeTable.routeTableId,
51
- destinationCidrBlock: "0.0.0.0/0",
52
- transitGatewayId: configuration.transitGatewayId,
53
- });
54
- });
55
- }
56
- return vpc;
57
43
  }
58
44
  }
59
45
  //# sourceMappingURL=network-stack.js.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- export type { DigitrafficStackInterface } from "./aws/infra/stack/stack.js";
2
1
  export { DigitrafficStack } from "./aws/infra/stack/stack.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.4.17-2",
3
+ "version": "2026.4.17-3",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {