@aws-blocks/bb-distributed-data 0.1.7 → 0.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cdk.d.ts","sourceRoot":"","sources":["../src/index.cdk.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAA0E,MAAM,sBAAsB,CAAC;AACrH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAG7D,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,0BAA0B;IAkGhF;;;;;OAKG;IACH,SAAS,IAAI,KAAK;CAGnB;AAaD,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.cdk.d.ts","sourceRoot":"","sources":["../src/index.cdk.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAA0E,MAAM,sBAAsB,CAAC;AACrH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAG7D,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,0BAA0B;IAwGhF;;;;;OAKG;IACH,SAAS,IAAI,KAAK;CAGnB;AAaD,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.cdk.js CHANGED
@@ -9,6 +9,7 @@ import { Scope, DEFAULT_NODE_RUNTIME, synthGuard, blocksNodejsBundling, register
9
9
  import * as cdk from 'aws-cdk-lib';
10
10
  import * as iam from 'aws-cdk-lib/aws-iam';
11
11
  import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs';
12
+ import { LogGroup } from 'aws-cdk-lib/aws-logs';
12
13
  import * as cr from 'aws-cdk-lib/custom-resources';
13
14
  import { createHash } from 'node:crypto';
14
15
  import { readdirSync, readFileSync } from 'node:fs';
@@ -64,6 +65,12 @@ export class DistributedDatabase extends Scope {
64
65
  handler: 'handler',
65
66
  runtime: DEFAULT_NODE_RUNTIME,
66
67
  timeout: cdk.Duration.minutes(MIGRATION_LAMBDA_TIMEOUT_MINUTES),
68
+ // Own the migration Lambda's log group so its retention follows the
69
+ // stack-wide default instead of AWS's infinite retention.
70
+ logGroup: new LogGroup(stack, `${this.fullId}DsqlMigrationLogs`, {
71
+ retention: this.defaults.logRetention,
72
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
73
+ }),
67
74
  environment: {
68
75
  DSQL_ENDPOINT: endpoint,
69
76
  DSQL_REGION: region,
@@ -189,6 +189,33 @@ test('CDK: migration/provisioning resources always created', () => {
189
189
  const hasDsqlGrant = policyValues.some((p) => JSON.stringify(p).includes('dsql:DbConnectAdmin'));
190
190
  assert.ok(hasDsqlGrant, 'Migration Lambda should have dsql:DbConnectAdmin');
191
191
  });
192
+ test('CDK: DSQL migration Lambda log group adopts defaults.logRetention', () => {
193
+ const app = new cdk.App();
194
+ const stack = new cdk.Stack(app, 'DsqlMigrationRetentionStack');
195
+ const executionRole = new cdk.aws_iam.Role(stack, 'BlocksRole', {
196
+ assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'),
197
+ });
198
+ const handler = new lambda.Function(stack, 'Handler', {
199
+ runtime: DEFAULT_NODE_RUNTIME,
200
+ handler: 'index.handler',
201
+ code: lambda.Code.fromInline('exports.handler = async () => {};'),
202
+ role: executionRole,
203
+ });
204
+ stack.handler = handler;
205
+ stack.executionRole = executionRole;
206
+ stack.defaults = BlocksPresets.sandbox;
207
+ globalThis.CURRENT_BLOCKS_STACK = stack;
208
+ try {
209
+ new DistributedDatabase(scope(stack), 'mydsql');
210
+ const template = Template.fromStack(stack);
211
+ // The always-created migration Lambda now owns an explicit log group whose
212
+ // retention follows the stack-wide default (sandbox → one week).
213
+ template.hasResourceProperties('AWS::Logs::LogGroup', { RetentionInDays: 7 });
214
+ }
215
+ finally {
216
+ delete globalThis.CURRENT_BLOCKS_STACK;
217
+ }
218
+ });
192
219
  test('CDK: migration resources created when migrationsPath is provided', () => {
193
220
  rmSync(MIGRATIONS_DIR, { recursive: true, force: true });
194
221
  mkdirSync(MIGRATIONS_DIR, { recursive: true });
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const BB_NAME = "DistributedDatabase";
2
- export declare const BB_VERSION = "0.1.7";
2
+ export declare const BB_VERSION = "0.1.8";
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 = 'DistributedDatabase';
3
- export const BB_VERSION = '0.1.7';
3
+ export const BB_VERSION = '0.1.8';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-blocks/bb-distributed-data",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/aws-devtools-labs/aws-blocks.git",
@@ -37,9 +37,9 @@
37
37
  "test": "node --test 'dist/**/*.test.js'"
38
38
  },
39
39
  "dependencies": {
40
- "@aws-blocks/core": "^0.3.0",
40
+ "@aws-blocks/core": "^0.4.0",
41
41
  "@aws-blocks/data-common": "^0.1.4",
42
- "@aws-blocks/bb-logger": "^0.1.5",
42
+ "@aws-blocks/bb-logger": "^0.1.6",
43
43
  "@aws-sdk/dsql-signer": "^3.700.0",
44
44
  "@electric-sql/pglite": "^0.2.0",
45
45
  "pg": "^8.13.0"