@aws-blocks/bb-file-bucket 0.1.4 → 0.1.5

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/dist/index.cdk.js CHANGED
@@ -29,7 +29,7 @@ export class FileBucket extends Scope {
29
29
  // `fromExisting`: don't provision; bind to the pre-existing bucket and
30
30
  // grant read/write to the Blocks runtime Lambda.
31
31
  this.bucket = s3.Bucket.fromBucketName(this, 'bucket', options.bucket.bucketName);
32
- this.bucket.grantReadWrite(this.handler);
32
+ this.bucket.grantReadWrite(this.executionRole);
33
33
  return;
34
34
  }
35
35
  // In sandbox mode, default to DESTROY + autoDeleteObjects so
@@ -70,6 +70,6 @@ export class FileBucket extends Scope {
70
70
  }] : undefined,
71
71
  })),
72
72
  });
73
- this.bucket.grantReadWrite(this.handler);
73
+ this.bucket.grantReadWrite(this.executionRole);
74
74
  }
75
75
  }
@@ -15,15 +15,20 @@ import { Scope, DEFAULT_NODE_RUNTIME } from '@aws-blocks/core/cdk';
15
15
  import { FileBucket } from './index.cdk.js';
16
16
  class StubBlocksStack extends cdk.Stack {
17
17
  handler;
18
+ executionRole;
18
19
  id;
19
20
  constructor(scope, id) {
20
21
  super(scope, id);
21
22
  this.id = id;
22
23
  globalThis.CURRENT_BLOCKS_STACK = this;
24
+ this.executionRole = new cdk.aws_iam.Role(this, 'BlocksRole', {
25
+ assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'),
26
+ });
23
27
  this.handler = new cdk.aws_lambda.Function(this, 'StubHandler', {
24
28
  runtime: DEFAULT_NODE_RUNTIME,
25
29
  handler: 'index.handler',
26
30
  code: cdk.aws_lambda.Code.fromInline('exports.handler = async () => {};'),
31
+ role: this.executionRole,
27
32
  });
28
33
  }
29
34
  }
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const BB_NAME = "FileBucket";
2
- export declare const BB_VERSION = "0.1.4";
2
+ export declare const BB_VERSION = "0.1.5";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.mjs — do not edit manually
2
2
  export const BB_NAME = 'FileBucket';
3
- export const BB_VERSION = '0.1.4';
3
+ export const BB_VERSION = '0.1.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-blocks/bb-file-bucket",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/aws-devtools-labs/aws-blocks.git",
@@ -50,8 +50,8 @@
50
50
  "test": "node --test dist/index.test.js dist/index.cdk.test.js dist/scan.test.js dist/file-server.test.js dist/url-encoding.test.js dist/path-containment.test.js dist/bucket-name.test.js"
51
51
  },
52
52
  "dependencies": {
53
- "@aws-blocks/bb-logger": "^0.1.4",
54
- "@aws-blocks/core": "^0.2.0",
53
+ "@aws-blocks/bb-logger": "^0.1.5",
54
+ "@aws-blocks/core": "^0.3.0",
55
55
  "@aws-sdk/client-s3": "^3.0.0",
56
56
  "@aws-sdk/s3-request-presigner": "^3.0.0"
57
57
  },
@@ -18,15 +18,20 @@ import { FileBucket } from './index.cdk.js';
18
18
 
19
19
  class StubBlocksStack extends cdk.Stack {
20
20
  public readonly handler: cdk.aws_lambda.Function;
21
+ public readonly executionRole: cdk.aws_iam.IRole;
21
22
  public readonly id: string;
22
23
  constructor(scope: Construct, id: string) {
23
24
  super(scope, id);
24
25
  this.id = id;
25
26
  (globalThis as any).CURRENT_BLOCKS_STACK = this;
27
+ this.executionRole = new cdk.aws_iam.Role(this, 'BlocksRole', {
28
+ assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'),
29
+ });
26
30
  this.handler = new cdk.aws_lambda.Function(this, 'StubHandler', {
27
31
  runtime: DEFAULT_NODE_RUNTIME,
28
32
  handler: 'index.handler',
29
33
  code: cdk.aws_lambda.Code.fromInline('exports.handler = async () => {};'),
34
+ role: this.executionRole,
30
35
  });
31
36
  }
32
37
  }
package/src/index.cdk.ts CHANGED
@@ -39,7 +39,7 @@ export class FileBucket<O extends FileBucketOptions = FileBucketOptions> extends
39
39
  // `fromExisting`: don't provision; bind to the pre-existing bucket and
40
40
  // grant read/write to the Blocks runtime Lambda.
41
41
  this.bucket = s3.Bucket.fromBucketName(this, 'bucket', options.bucket.bucketName);
42
- this.bucket.grantReadWrite(this.handler);
42
+ this.bucket.grantReadWrite(this.executionRole);
43
43
  return;
44
44
  }
45
45
 
@@ -84,6 +84,6 @@ export class FileBucket<O extends FileBucketOptions = FileBucketOptions> extends
84
84
  })),
85
85
  });
86
86
 
87
- this.bucket.grantReadWrite(this.handler);
87
+ this.bucket.grantReadWrite(this.executionRole);
88
88
  }
89
89
  }
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.mjs — do not edit manually
2
2
  export const BB_NAME = 'FileBucket';
3
- export const BB_VERSION = '0.1.4';
3
+ export const BB_VERSION = '0.1.5';