@digitraffic/common 2026.1.14-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,
|
|
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,
|
|
36
|
-
this._name =
|
|
35
|
+
constructor(stack, lambdaPath) {
|
|
36
|
+
this._name = lambdaPath;
|
|
37
37
|
this._stack = stack;
|
|
38
|
-
this.functionName = `${stack.configuration.shortName}-${startCase(camelCase(
|
|
38
|
+
this.functionName = `${stack.configuration.shortName}-${startCase(camelCase(lambdaPath)).replace(/\s/g, "")}`;
|
|
39
39
|
this.environment = {};
|
|
40
40
|
this.vpc = stack.vpc;
|
|
41
|
-
this
|
|
42
|
-
this.withAssetCode(
|
|
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).
|
|
@@ -58,8 +58,12 @@ export class StackCheckingAspect {
|
|
|
58
58
|
Annotations.of(node).addWarning(annotationMessage);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
isDigitrafficStack(node) {
|
|
62
|
+
return node instanceof DigitrafficStack;
|
|
63
|
+
}
|
|
61
64
|
checkStack(node) {
|
|
62
|
-
|
|
65
|
+
// Fix Invalid 'instanceof' check: 'nodeToCheck' has type that is not related to 'DigitrafficStack'
|
|
66
|
+
if (this.isDigitrafficStack(node)) {
|
|
63
67
|
if ((node.stackName.includes("Test") || node.stackName.includes("Tst")) &&
|
|
64
68
|
node.configuration.production) {
|
|
65
69
|
this.addAnnotation(node, ResourceType.stackName, "Production is set for Test-stack");
|