@digitraffic/common 2026.3.5-1 → 2026.3.17-2

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/README.md CHANGED
@@ -50,6 +50,16 @@ pnpm up --latest
50
50
 
51
51
  After updating, run `pnpm audit` to check for vulnerabilities. If vulnerabilities exist in transitive dependencies, you may need to add overrides in `package.json` and/or exclusions in `.npmrc`. See [DEPENDENCY_OVERRIDES.md](./DEPENDENCY_OVERRIDES.md) for details.
52
52
 
53
+ ## Publishing to [npmjs.com](https://www.npmjs.com/)
54
+
55
+ See https://www.npmjs.com/package/@digitraffic/common
56
+
57
+ Run the following command to publish a new version:
58
+
59
+ ```bash
60
+ ./scripts/publish.sh 2026.3.5-1
61
+ ```
62
+
53
63
  ## How to use
54
64
 
55
65
  In package.json dependencies:
@@ -2,6 +2,7 @@ import { Duration } from "aws-cdk-lib";
2
2
  import type { ISecurityGroup } from "aws-cdk-lib/aws-ec2";
3
3
  import type { IRole } from "aws-cdk-lib/aws-iam";
4
4
  import { PolicyStatement } from "aws-cdk-lib/aws-iam";
5
+ import type { ILayerVersion } from "aws-cdk-lib/aws-lambda";
5
6
  import { Architecture, Function as AwsFunction, Code, Runtime } from "aws-cdk-lib/aws-lambda";
6
7
  import { DtFunctionAlarms } from "./dt-function-alarms.js";
7
8
  import type { LambdaEnvironment } from "./lambda-configs.js";
@@ -22,6 +23,7 @@ export declare class FunctionBuilder {
22
23
  private alarms;
23
24
  private code;
24
25
  private handler;
26
+ private readonly layers;
25
27
  private readonly securityGroups;
26
28
  private readonly policyStatements;
27
29
  private readonly allowedActions;
@@ -73,6 +75,10 @@ export declare class FunctionBuilder {
73
75
  * Set runtime for the lambda. Default is Runtime.NODEJS_24_X.
74
76
  */
75
77
  withRuntime(runtime: Runtime): this;
78
+ /**
79
+ * Add Lambda layers.
80
+ */
81
+ withLayers(...layers: ILayerVersion[]): this;
76
82
  /**
77
83
  * Set architecture for the lambda. Default is Architecture.ARM_64.
78
84
  */
@@ -25,6 +25,7 @@ export class FunctionBuilder {
25
25
  // these will be overridden in constructor, but inspection won't see it, so set some default values.
26
26
  code = Code.fromInline("placeholder");
27
27
  handler = "";
28
+ layers = [];
28
29
  securityGroups = [];
29
30
  policyStatements = [];
30
31
  allowedActions = [];
@@ -133,6 +134,13 @@ export class FunctionBuilder {
133
134
  this.runtime = runtime;
134
135
  return this;
135
136
  }
137
+ /**
138
+ * Add Lambda layers.
139
+ */
140
+ withLayers(...layers) {
141
+ this.layers.push(...layers);
142
+ return this;
143
+ }
136
144
  /**
137
145
  * Set architecture for the lambda. Default is Architecture.ARM_64.
138
146
  */
@@ -230,6 +238,7 @@ export class FunctionBuilder {
230
238
  securityGroups,
231
239
  environment: this.getEnvironment(),
232
240
  description: this.description,
241
+ layers: this.layers.length > 0 ? this.layers : undefined,
233
242
  });
234
243
  if (this._features.secretAccess) {
235
244
  this._stack.grantSecret(createdFunction);
@@ -8,7 +8,12 @@ import { kebabCase } from "change-case";
8
8
  import { snakeCase } from "es-toolkit";
9
9
  import { DigitrafficStack, SOLUTION_KEY } from "./stack.js";
10
10
  const MAX_CONCURRENCY_LIMIT = 100;
11
- const NODE_RUNTIMES = [Runtime.NODEJS_24_X.name, Runtime.NODEJS_22_X.name];
11
+ const ALLOWED_RUNTIMES = [
12
+ Runtime.NODEJS_24_X.name,
13
+ Runtime.NODEJS_22_X.name,
14
+ Runtime.PYTHON_3_12.name,
15
+ Runtime.PYTHON_3_13.name,
16
+ ];
12
17
  var ResourceType;
13
18
  (function (ResourceType) {
14
19
  ResourceType["stackName"] = "STACK_NAME";
@@ -88,7 +93,8 @@ export class StackCheckingAspect {
88
93
  if (!node.memorySize) {
89
94
  this.addAnnotation(node, ResourceType.functionMemorySize, "Function must have memorySize");
90
95
  }
91
- if (node.runtime !== undefined && !NODE_RUNTIMES.includes(node.runtime)) {
96
+ if (node.runtime !== undefined &&
97
+ !ALLOWED_RUNTIMES.includes(node.runtime)) {
92
98
  this.addAnnotation(node, ResourceType.functionRuntime, `Function has wrong runtime ${node.runtime}!`);
93
99
  }
94
100
  if (this.stackShortName &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.3.5-1",
3
+ "version": "2026.3.17-2",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {