@bifravst/aws-cdk-lambda-helpers 1.0.2 → 1.1.0

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.
@@ -0,0 +1,7 @@
1
+ import { aws_lambda as Lambda } from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+ import type { PackedLambda } from './packLambda.js';
4
+ export declare class LambdaSource extends Construct {
5
+ readonly code: Lambda.S3Code;
6
+ constructor(parent: Construct, packedLambda: Pick<PackedLambda, 'zipFile' | 'id' | 'hash'>);
7
+ }
@@ -0,0 +1,15 @@
1
+ import { AssetHashType, aws_lambda as Lambda, aws_s3 as S3, aws_s3_assets as S3Assets, } from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+ export class LambdaSource extends Construct {
4
+ code;
5
+ constructor(parent, packedLambda) {
6
+ super(parent, `${packedLambda.id}Source`);
7
+ const asset = new S3Assets.Asset(this, 'asset', {
8
+ path: packedLambda.zipFile,
9
+ assetHash: packedLambda.hash,
10
+ assetHashType: AssetHashType.CUSTOM,
11
+ });
12
+ const sourceCodeBucket = S3.Bucket.fromBucketName(this, 'bucket', asset.s3BucketName);
13
+ this.code = Lambda.Code.fromBucket(sourceCodeBucket, asset.s3ObjectKey);
14
+ }
15
+ }
@@ -10,8 +10,8 @@ export type PackedLambda = {
10
10
  export declare const packLambda: ({ sourceFile, zipFile, debug, progress, }: {
11
11
  sourceFile: string;
12
12
  zipFile: string;
13
- debug?: (label: string, info: string) => void;
14
- progress?: (label: string, info: string) => void;
13
+ debug?: ((label: string, info: string) => void) | undefined;
14
+ progress?: ((label: string, info: string) => void) | undefined;
15
15
  }) => Promise<{
16
16
  handler: string;
17
17
  hash: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifravst/aws-cdk-lambda-helpers",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Helper functions which simplify working with TypeScript lambdas for AWS CDK.",
5
5
  "exports": {
6
6
  ".": {
@@ -102,5 +102,9 @@
102
102
  "@swc/core": "1.4.11",
103
103
  "glob": "10.3.12",
104
104
  "yazl": "2.5.1"
105
+ },
106
+ "peerDependencies": {
107
+ "aws-cdk-lib": "2.135.0",
108
+ "constructs": "10.3.0"
105
109
  }
106
110
  }