@digitraffic/common 2026.1.15-1-node24 → 2026.1.15-2-node24

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.
@@ -26,7 +26,7 @@ export declare class FunctionBuilder {
26
26
  private readonly policyStatements;
27
27
  private readonly allowedActions;
28
28
  private readonly _features;
29
- constructor(stack: DigitrafficStack, lambdaName: string);
29
+ constructor(stack: DigitrafficStack, lambdaPath: string);
30
30
  /**
31
31
  * Creates a new builder with defaults, using the lambdaName as a source for the lambda implementation (dist/lambdaName/lambdaName.js).
32
32
  * Database access is given by default.
@@ -32,14 +32,20 @@ export class FunctionBuilder {
32
32
  databaseAccess: true,
33
33
  secretAccess: true,
34
34
  };
35
- constructor(stack, lambdaName) {
36
- this._name = lambdaName;
35
+ constructor(stack, lambdaPath) {
36
+ this._name = lambdaPath;
37
37
  this._stack = stack;
38
- this.functionName = `${stack.configuration.shortName}-${startCase(camelCase(lambdaName)).replace(/\s/g, "")}`;
38
+ this.functionName = `${stack.configuration.shortName}-${startCase(camelCase(lambdaPath)).replace(/\s/g, "")}`;
39
39
  this.environment = {};
40
40
  this.vpc = stack.vpc;
41
- this.withHandler(lambdaName);
42
- this.withAssetCode(lambdaName);
41
+ // this calls withHandler as well but with full path
42
+ this.withAssetCode(lambdaPath);
43
+ // In CommonJS, the handler is in the form of "api/charging-network/v1/operators.handler" as commonjs can handle paths.
44
+ // In ESModules, the handler must be like "operators.handler", so override the handler to have only the module name
45
+ // e.g. for lambdaName "api/charging-network/v1/operators",
46
+ // moduleName becomes "operators" and handler becomes "operators.handler"
47
+ const moduleName = lambdaPath.split("/").pop() ?? lambdaPath;
48
+ this.withHandler(moduleName);
43
49
  }
44
50
  /**
45
51
  * Creates a new builder with defaults, using the lambdaName as a source for the lambda implementation (dist/lambdaName/lambdaName.js).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.1.15-1-node24",
3
+ "version": "2026.1.15-2-node24",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {