@mettlecast/domain-cdk-packer 0.2.49 → 0.2.51

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 (2) hide show
  1. package/dist/DomainStack.js +14 -12
  2. package/package.json +1 -1
@@ -199,7 +199,7 @@ export class DomainStack extends cdk.Stack {
199
199
  else {
200
200
  apiRoute = apiRouteBase;
201
201
  }
202
- addRouteToApi(this, fn, api.path, [toHttpMethod(api.method)], this.httpApi.httpApiId);
202
+ addRouteToApi(this, fn, `/${domainId}${api.path}`, [toHttpMethod(api.method)], this.httpApi.httpApiId);
203
203
  }
204
204
  }
205
205
  // Deploy webhooks as grouped Lambdas
@@ -242,7 +242,7 @@ export class DomainStack extends cdk.Stack {
242
242
  // Add routes for each webhook entry
243
243
  for (const webhook of registry.webhooks) {
244
244
  const fn = webhookLambdas[0]; // Grouped Lambda or first dedicated
245
- addRouteToApi(this, fn, webhook.path, [apigwv2.HttpMethod.POST], this.httpApi.httpApiId);
245
+ addRouteToApi(this, fn, `/${domainId}${webhook.path}`, [apigwv2.HttpMethod.POST], this.httpApi.httpApiId);
246
246
  }
247
247
  }
248
248
  // Deploy event subscribers as grouped Lambdas
@@ -452,21 +452,23 @@ export class DomainStack extends cdk.Stack {
452
452
  domainBucket.grantReadWrite(fn);
453
453
  }
454
454
  // Replace the tenant-scoped role trust policy — only domain Lambdas can assume with tenantId tag
455
+ // Use a single Statement with ArnLike wildcard to stay under the 2048-byte ACL size limit
455
456
  const cfnRole = tenantScopedRole.node.defaultChild;
456
- cfnRole.assumeRolePolicyDocument = cdk.Lazy.any({
457
- produce: () => ({
458
- Version: '2012-10-17',
459
- Statement: allDomainLambdas.map(fn => ({
457
+ const accountId = cdk.Stack.of(this).account;
458
+ const stackPrefix = cdk.Stack.of(this).stackName;
459
+ cfnRole.assumeRolePolicyDocument = {
460
+ Version: '2012-10-17',
461
+ Statement: [{
460
462
  Effect: 'Allow',
461
- Principal: { AWS: fn.role.roleArn },
463
+ Principal: { AWS: accountId },
462
464
  Action: ['sts:AssumeRole', 'sts:TagSession'],
463
465
  Condition: {
464
466
  StringLike: { 'aws:RequestTag/tenantId': '*' },
465
467
  'ForAllValues:StringEquals': { 'sts:TransitiveTagKeys': ['tenantId'] },
468
+ ArnLike: { 'aws:PrincipalArn': `arn:aws:iam::${accountId}:role/${stackPrefix}*` },
466
469
  },
467
- })),
468
- }),
469
- });
470
+ }],
471
+ };
470
472
  // Attach tenant-scoped storage policy to the tenant-scoped role
471
473
  const tenantStoragePolicies = iamBuilder.forTenantScopedStorage({
472
474
  tableArn: domainTable.tableArn,
@@ -507,8 +509,8 @@ export class DomainStack extends cdk.Stack {
507
509
  DB_SECRET_ARN: dbSecretArn ?? '',
508
510
  },
509
511
  });
510
- addRouteToApi(this, healthConstruct.healthFn, '/_health', [apigwv2.HttpMethod.GET], this.httpApi.httpApiId);
511
- addRouteToApi(this, healthConstruct.readyFn, '/_ready', [apigwv2.HttpMethod.GET], this.httpApi.httpApiId);
512
+ addRouteToApi(this, healthConstruct.healthFn, `/${domainId}/_health`, [apigwv2.HttpMethod.GET], this.httpApi.httpApiId);
513
+ addRouteToApi(this, healthConstruct.readyFn, `/${domainId}/_ready`, [apigwv2.HttpMethod.GET], this.httpApi.httpApiId);
512
514
  // Create CloudWatch dashboard for all primitives
513
515
  const allEndpoints = [
514
516
  ...registry.apis.map(a => ({ id: a.id, primitiveClass: 'api' })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mettlecast/domain-cdk-packer",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",