@bifravst/aws-cdk-lambda-helpers 4.0.14 → 4.0.16

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 (61) hide show
  1. package/{dist/src/src → npm}/PackedLambdaFn.d.ts +5 -4
  2. package/{dist/src → npm}/PackedLambdaFn.js +5 -4
  3. package/{dist/src/src → npm}/findDependencies.d.ts +5 -5
  4. package/{dist/src/src → npm}/packLambda.d.ts +3 -3
  5. package/{dist/src/src → npm}/packLambdaFromPath.d.ts +6 -6
  6. package/{dist/src/src → npm}/packLayer.d.ts +4 -4
  7. package/{dist/src/src → npm}/updateLambdaCode.d.ts +1 -1
  8. package/package.json +20 -20
  9. package/dist/src/test/getFileFromZip.js +0 -20
  10. package/dist/src/test-data/module-folder-named-like-handler-bug/different-level/acme/lib.js +0 -1
  11. package/dist/src/test-data/module-folder-named-like-handler-bug/different-level/lambda/acme.js +0 -2
  12. package/dist/src/test-data/module-folder-named-like-handler-bug/same-level/acme/lib.js +0 -1
  13. package/dist/src/test-data/module-folder-named-like-handler-bug/same-level/acme.js +0 -2
  14. package/dist/src/test-data/resolve-paths/foo/1.js +0 -1
  15. package/dist/src/test-data/resolve-paths/foo/2.js +0 -1
  16. package/dist/src/test-data/resolve-paths/foo/index.js +0 -1
  17. package/dist/src/test-data/resolve-paths/lambda.js +0 -4
  18. /package/{dist/src/src → npm}/IoTActionRole.d.ts +0 -0
  19. /package/{dist/src → npm}/IoTActionRole.js +0 -0
  20. /package/{dist/src/src → npm}/LambdaLogGroup.d.ts +0 -0
  21. /package/{dist/src → npm}/LambdaLogGroup.js +0 -0
  22. /package/{dist/src/src → npm}/LambdaSource.d.ts +0 -0
  23. /package/{dist/src → npm}/LambdaSource.js +0 -0
  24. /package/{dist/src/src → npm}/cdk.d.ts +0 -0
  25. /package/{dist/src → npm}/cdk.js +0 -0
  26. /package/{dist/src/src → npm}/checkSumOfFiles.spec.d.ts +0 -0
  27. /package/{dist/src → npm}/checkSumOfFiles.spec.js +0 -0
  28. /package/{dist/src/src → npm}/checksumOfFiles.d.ts +0 -0
  29. /package/{dist/src → npm}/checksumOfFiles.js +0 -0
  30. /package/{dist/src/src → npm}/commonParent.d.ts +0 -0
  31. /package/{dist/src → npm}/commonParent.js +0 -0
  32. /package/{dist/src/src → npm}/commonParent.spec.d.ts +0 -0
  33. /package/{dist/src → npm}/commonParent.spec.js +0 -0
  34. /package/{dist/src → npm}/findDependencies.js +0 -0
  35. /package/{dist/src/src → npm}/findDependencies.spec.d.ts +0 -0
  36. /package/{dist/src → npm}/findDependencies.spec.js +0 -0
  37. /package/{dist/src/src → npm}/isTest.d.ts +0 -0
  38. /package/{dist/src → npm}/isTest.js +0 -0
  39. /package/{dist/src/src → npm}/isTest.spec.d.ts +0 -0
  40. /package/{dist/src → npm}/isTest.spec.js +0 -0
  41. /package/{dist/src/src → npm}/lambda.d.ts +0 -0
  42. /package/{dist/src → npm}/lambda.js +0 -0
  43. /package/{dist/src/src → npm}/layer.d.ts +0 -0
  44. /package/{dist/src → npm}/layer.js +0 -0
  45. /package/{dist/src/src → npm}/module-folder-named-like-handler-bug.spec.d.ts +0 -0
  46. /package/{dist/src → npm}/module-folder-named-like-handler-bug.spec.js +0 -0
  47. /package/{dist/src → npm}/packLambda.js +0 -0
  48. /package/{dist/src/src → npm}/packLambda.spec.d.ts +0 -0
  49. /package/{dist/src → npm}/packLambda.spec.js +0 -0
  50. /package/{dist/src → npm}/packLambdaFromPath.js +0 -0
  51. /package/{dist/src → npm}/packLayer.js +0 -0
  52. /package/{dist/src/src → npm}/packLayer.spec.d.ts +0 -0
  53. /package/{dist/src → npm}/packLayer.spec.js +0 -0
  54. /package/{dist/src/src → npm}/test/getFileFromZip.d.ts +0 -0
  55. /package/{dist/src/src → npm}/updateImports.d.ts +0 -0
  56. /package/{dist/src → npm}/updateImports.js +0 -0
  57. /package/{dist/src/src → npm}/updateImports.spec.d.ts +0 -0
  58. /package/{dist/src → npm}/updateImports.spec.js +0 -0
  59. /package/{dist/src → npm}/updateLambdaCode.js +0 -0
  60. /package/{dist/src/src → npm}/util.d.ts +0 -0
  61. /package/{dist/src → npm}/util.js +0 -0
@@ -1,4 +1,5 @@
1
- import { aws_lambda as Lambda, type aws_logs as Logs } from 'aws-cdk-lib';
1
+ import { Function as LambdaFunction, type FunctionProps } from 'aws-cdk-lib/aws-lambda';
2
+ import type { ILogGroupRef } from 'aws-cdk-lib/aws-logs';
2
3
  import { Construct } from 'constructs';
3
4
  import type { PackedLambda } from './packLambda.ts';
4
5
  /**
@@ -18,7 +19,7 @@ import type { PackedLambda } from './packLambda.ts';
18
19
  * - policies that allow to access all SSM parameters below the current stack name
19
20
  */
20
21
  export declare class PackedLambdaFn extends Construct {
21
- readonly fn: Lambda.Function;
22
- readonly logGroup: Logs.ILogGroup;
23
- constructor(parent: Construct, id: string, source: PackedLambda, props: Partial<Omit<Lambda.FunctionProps, 'code' | 'handler'>>);
22
+ readonly fn: LambdaFunction;
23
+ readonly logGroup: ILogGroupRef;
24
+ constructor(parent: Construct, id: string, source: PackedLambda, props: Partial<Omit<FunctionProps, 'code' | 'handler'>>);
24
25
  }
@@ -1,5 +1,6 @@
1
1
  import { Permissions as SettingsPermissions } from '@bifravst/aws-ssm-settings-helpers/cdk';
2
- import { Duration, aws_lambda as Lambda, Stack, Tags } from 'aws-cdk-lib';
2
+ import { Duration, Stack, Tags } from 'aws-cdk-lib';
3
+ import { Architecture, Function as LambdaFunction, Runtime } from 'aws-cdk-lib/aws-lambda';
3
4
  import { Construct } from 'constructs';
4
5
  import { LambdaLogGroup } from './LambdaLogGroup.js';
5
6
  import { LambdaSource } from './LambdaSource.js';
@@ -25,9 +26,9 @@ import { LambdaSource } from './LambdaSource.js';
25
26
  super(parent, id);
26
27
  const { environment, initialPolicy, architecture, ...rest } = props;
27
28
  this.logGroup = props.logGroup ?? new LambdaLogGroup(this, 'fnLogs').logGroup;
28
- this.fn = new Lambda.Function(this, 'fn', {
29
- architecture: architecture ?? Lambda.Architecture.ARM_64,
30
- runtime: props.runtime ?? Lambda.Runtime.NODEJS_24_X,
29
+ this.fn = new LambdaFunction(this, 'fn', {
30
+ architecture: architecture ?? Architecture.ARM_64,
31
+ runtime: props.runtime ?? Runtime.NODEJS_24_X,
31
32
  timeout: Duration.seconds(5),
32
33
  memorySize: 1792,
33
34
  environment: {
@@ -3,11 +3,11 @@
3
3
  */
4
4
  export declare const findDependencies: (args: {
5
5
  sourceFilePath: string;
6
- imports?: string[] | undefined;
7
- visited?: string[] | undefined;
8
- packages?: Set<string> | undefined;
9
- tsConfigFilePath?: string | undefined;
10
- importsSubpathPatterns?: Record<string, string> | undefined;
6
+ imports?: string[];
7
+ visited?: string[];
8
+ packages?: Set<string>;
9
+ tsConfigFilePath?: string;
10
+ importsSubpathPatterns?: Record<string, string>;
11
11
  }) => {
12
12
  dependencies: string[];
13
13
  /**
@@ -13,9 +13,9 @@ export declare const packLambda: ({ sourceFilePath, zipFilePath, tsConfigFilePat
13
13
  /**
14
14
  * Pass the path to the tsconfig.json file if you want to use paths from the tsconfig.json file.
15
15
  */
16
- tsConfigFilePath?: string | undefined;
17
- debug?: ((label: string, info: string) => void) | undefined;
18
- progress?: ((label: string, info: string) => void) | undefined;
16
+ tsConfigFilePath?: string;
17
+ debug?: (label: string, info: string) => void;
18
+ progress?: (label: string, info: string) => void;
19
19
  }) => Promise<{
20
20
  handler: string;
21
21
  hash: string;
@@ -2,19 +2,19 @@ import { type PackedLambda } from './packLambda.ts';
2
2
  export declare const packLambdaFromPath: ({ id, sourceFilePath, handlerFunction: handlerFunctionArg, baseDir: baseDirArg, distDir: distDirArg, tsConfigFilePath, debug, progress, }: {
3
3
  id: string;
4
4
  sourceFilePath: string;
5
- handlerFunction?: string | undefined;
5
+ handlerFunction?: string;
6
6
  /**
7
7
  * @default process.cwd()
8
8
  */
9
- baseDir?: string | undefined;
9
+ baseDir?: string;
10
10
  /**
11
11
  * @default ${baseDir}/dist/lambdas
12
12
  */
13
- distDir?: string | undefined;
13
+ distDir?: string;
14
14
  /**
15
15
  * Pass the path to the tsconfig.json file if you want to use paths from the tsconfig.json file.
16
16
  */
17
- tsConfigFilePath?: string | undefined;
18
- debug?: ((label: string, info: string) => void) | undefined;
19
- progress?: ((label: string, info: string) => void) | undefined;
17
+ tsConfigFilePath?: string;
18
+ debug?: (label: string, info: string) => void;
19
+ progress?: (label: string, info: string) => void;
20
20
  }) => Promise<PackedLambda>;
@@ -8,16 +8,16 @@ export declare const packLayer: ({ id, dependencies, baseDir, distDir, installCo
8
8
  /**
9
9
  * @default process.cwd()
10
10
  */
11
- baseDir?: string | undefined;
11
+ baseDir?: string;
12
12
  /**
13
13
  * @default ${baseDir}/dist/layers
14
14
  */
15
- distDir?: string | undefined;
15
+ distDir?: string;
16
16
  /**
17
17
  * Returns the command to run, the first element is the command (e.g. `npm`) and the rest are its arguments.
18
18
  */
19
- installCommand?: ((args: {
19
+ installCommand?: (args: {
20
20
  packageFilePath: string;
21
21
  packageLockFilePath: string;
22
- }) => [string, ...string[]]) | undefined;
22
+ }) => [string, ...string[]];
23
23
  }) => Promise<PackedLayer>;
@@ -4,4 +4,4 @@ import type { PackedLambda } from './packLambda.ts';
4
4
  export declare const updateLambdaCode: ({ cf, lambda }: {
5
5
  cf: CloudFormationClient;
6
6
  lambda: LambdaClient;
7
- }) => (stackName: string, packedLambdas: Record<string, PackedLambda>, debug?: ((...args: any[]) => void) | undefined) => Promise<void>;
7
+ }) => (stackName: string, packedLambdas: Record<string, PackedLambda>, debug?: (...args: any[]) => void) => Promise<void>;
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "name": "@bifravst/aws-cdk-lambda-helpers",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "description": "Helper functions which simplify working with TypeScript lambdas for AWS CDK.",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": {
8
- "types": "./dist/src/lambda.d.ts",
9
- "default": "./dist/src/lambda.js"
8
+ "types": "./npm/lambda.d.ts",
9
+ "default": "./npm/lambda.js"
10
10
  }
11
11
  },
12
12
  "./layer": {
13
13
  "import": {
14
- "types": "./dist/src/layer.d.ts",
15
- "default": "./dist/src/layer.js"
14
+ "types": "./npm/layer.d.ts",
15
+ "default": "./npm/layer.js"
16
16
  }
17
17
  },
18
18
  "./util": {
19
19
  "import": {
20
- "types": "./dist/src/util.d.ts",
21
- "default": "./dist/src/util.js"
20
+ "types": "./npm/util.d.ts",
21
+ "default": "./npm/util.js"
22
22
  }
23
23
  },
24
24
  "./cdk": {
25
25
  "import": {
26
- "types": "./dist/src/cdk.d.ts",
27
- "default": "./dist/src/cdk.js"
26
+ "types": "./npm/cdk.d.ts",
27
+ "default": "./npm/cdk.js"
28
28
  }
29
29
  }
30
30
  },
@@ -34,7 +34,7 @@
34
34
  "test:e2e": "node --experimental-strip-types --test e2e.spec.ts",
35
35
  "test:e2e:updated": "node --experimental-strip-types --test e2e-updated.spec.ts",
36
36
  "prepare": "husky",
37
- "prepublishOnly": "node --experimental-strip-types npm-compile.ts && npx tsgo -P tsconfig.npm.json --outDir ./dist/src"
37
+ "prepublishOnly": "node --experimental-strip-types .npm/npm-compile.ts && npx tsgo src/*.ts --emitDeclarationOnly --declaration --ignoreConfig --allowImportingTsExtensions --target esnext --module nodenext --moduleResolution nodenext --outDir ./npm && mv npm/src/* npm"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
@@ -53,8 +53,8 @@
53
53
  "author": "Nordic Semiconductor ASA | nordicsemi.no",
54
54
  "license": "BSD-3-Clause",
55
55
  "devDependencies": {
56
- "@aws-sdk/client-cloudformation": "3.972.0",
57
- "@aws-sdk/client-dynamodb": "3.972.0",
56
+ "@aws-sdk/client-cloudformation": "3.975.0",
57
+ "@aws-sdk/client-dynamodb": "3.975.0",
58
58
  "@bifravst/cloudformation-helpers": "9.1.1",
59
59
  "@bifravst/eslint-config-typescript": "6.4.4",
60
60
  "@bifravst/from-env": "3.0.2",
@@ -65,8 +65,8 @@
65
65
  "@types/node": "25.0.10",
66
66
  "@types/unzip-stream": "0.3.4",
67
67
  "@types/yazl": "3.3.0",
68
- "@typescript/native-preview": "7.0.0-dev.20260122.3",
69
- "cdk": "2.1101.0",
68
+ "@typescript/native-preview": "7.0.0-dev.20260124.1",
69
+ "cdk": "2.1103.0",
70
70
  "commitlint": "20.3.1",
71
71
  "husky": "9.1.7",
72
72
  "id128": "1.6.6",
@@ -83,8 +83,8 @@
83
83
  ]
84
84
  },
85
85
  "engines": {
86
- "node": ">=22.7.0",
87
- "npm": ">=10"
86
+ "node": ">=24",
87
+ "npm": ">=11"
88
88
  },
89
89
  "release": {
90
90
  "branches": [
@@ -108,7 +108,7 @@
108
108
  "access": "public"
109
109
  },
110
110
  "files": [
111
- "dist/src",
111
+ "npm",
112
112
  "LICENSE",
113
113
  "README.md"
114
114
  ],
@@ -121,9 +121,9 @@
121
121
  "yazl": "3.3.1"
122
122
  },
123
123
  "peerDependencies": {
124
- "@aws-sdk/client-lambda": "^3.972.0",
125
- "@bifravst/aws-ssm-settings-helpers": "^1.2.257",
126
- "aws-cdk-lib": "^2.234.1",
124
+ "@aws-sdk/client-lambda": "^3.975.0",
125
+ "@bifravst/aws-ssm-settings-helpers": "^1.2.259",
126
+ "aws-cdk-lib": "^2.236.0",
127
127
  "constructs": "^10.4.5"
128
128
  }
129
129
  }
@@ -1,20 +0,0 @@
1
- import fs from 'node:fs';
2
- import unzip from 'unzip-stream';
3
- export const getFileFromZip = async (zipFilePath, filename)=>{
4
- let found = false;
5
- let content = '';
6
- await new Promise((resolve, reject)=>{
7
- fs.createReadStream(zipFilePath).pipe(unzip.Parse()).on('entry', (entry)=>{
8
- if (entry.path === filename) {
9
- found = true;
10
- entry.on('data', (data)=>content += data);
11
- } else {
12
- entry.autodrain();
13
- }
14
- }).on('error', reject).on('end', resolve);
15
- });
16
- if (!found) {
17
- throw new Error(`File not found in zip: ${filename}`);
18
- }
19
- return content;
20
- };
@@ -1 +0,0 @@
1
- export const hello = ()=>'Hello World!';
@@ -1,2 +0,0 @@
1
- import { hello } from '../acme/lib.js';
2
- export const handler = ()=>hello();
@@ -1 +0,0 @@
1
- export const hello = ()=>'Hello World!';
@@ -1,2 +0,0 @@
1
- import { hello } from './acme/lib.js';
2
- export const handler = ()=>hello();
@@ -1 +0,0 @@
1
- export const foo = ()=>42;
@@ -1 +0,0 @@
1
- export const foo2 = ()=>17;
@@ -1 +0,0 @@
1
- export { foo } from './1.js';
@@ -1,4 +0,0 @@
1
- import { foo } from '#foo';
2
- import { foo2 } from '#foo/2.js';
3
- export const handler = ()=>foo() + foo2() // 42 + 17
4
- ;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes