@friggframework/devtools 2.0.0--canary.490.36b3031.0 → 2.0.0--canary.490.e6d93e8.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.
@@ -1447,6 +1447,122 @@ describe('VpcBuilder', () => {
1447
1447
  });
1448
1448
  });
1449
1449
 
1450
+ describe('convertFlatDiscoveryToStructured - VPC Endpoints from CloudFormation', () => {
1451
+ it('should add VPC endpoints to stackManaged when in existingLogicalIds', () => {
1452
+ const flatDiscovery = {
1453
+ fromCloudFormationStack: true,
1454
+ stackName: 'test-stack',
1455
+ existingLogicalIds: [
1456
+ 'FriggS3VPCEndpoint',
1457
+ 'FriggDynamoDBVPCEndpoint',
1458
+ 'FriggKMSVPCEndpoint'
1459
+ ],
1460
+ s3VpcEndpointId: 'vpce-s3-stack',
1461
+ dynamodbVpcEndpointId: 'vpce-ddb-stack',
1462
+ kmsVpcEndpointId: 'vpce-kms-stack'
1463
+ };
1464
+
1465
+ const result = vpcBuilder.convertFlatDiscoveryToStructured(flatDiscovery);
1466
+
1467
+ // VPC endpoints should be in stackManaged (not external)
1468
+ expect(result.stackManaged).toContainEqual(
1469
+ expect.objectContaining({
1470
+ logicalId: 'FriggS3VPCEndpoint',
1471
+ physicalId: 'vpce-s3-stack',
1472
+ resourceType: 'AWS::EC2::VPCEndpoint'
1473
+ })
1474
+ );
1475
+ expect(result.stackManaged).toContainEqual(
1476
+ expect.objectContaining({
1477
+ logicalId: 'FriggDynamoDBVPCEndpoint',
1478
+ physicalId: 'vpce-ddb-stack',
1479
+ resourceType: 'AWS::EC2::VPCEndpoint'
1480
+ })
1481
+ );
1482
+ expect(result.stackManaged).toContainEqual(
1483
+ expect.objectContaining({
1484
+ logicalId: 'FriggKMSVPCEndpoint',
1485
+ physicalId: 'vpce-kms-stack',
1486
+ resourceType: 'AWS::EC2::VPCEndpoint'
1487
+ })
1488
+ );
1489
+
1490
+ // Should NOT be in external array
1491
+ expect(result.external.some(r => r.physicalId === 'vpce-s3-stack')).toBe(false);
1492
+ expect(result.external.some(r => r.physicalId === 'vpce-ddb-stack')).toBe(false);
1493
+ expect(result.external.some(r => r.physicalId === 'vpce-kms-stack')).toBe(false);
1494
+ });
1495
+
1496
+ it('should add VPC endpoints to external when NOT in existingLogicalIds', () => {
1497
+ const flatDiscovery = {
1498
+ fromCloudFormationStack: false, // AWS API discovery
1499
+ s3VpcEndpointId: 'vpce-s3-external',
1500
+ dynamodbVpcEndpointId: 'vpce-ddb-external'
1501
+ };
1502
+
1503
+ const result = vpcBuilder.convertFlatDiscoveryToStructured(flatDiscovery);
1504
+
1505
+ // Should be in external (AWS discovery)
1506
+ expect(result.external).toContainEqual(
1507
+ expect.objectContaining({
1508
+ physicalId: 'vpce-s3-external',
1509
+ resourceType: 'AWS::EC2::VPCEndpoint',
1510
+ source: 'aws-discovery'
1511
+ })
1512
+ );
1513
+
1514
+ // Should NOT be in stackManaged
1515
+ expect(result.stackManaged.some(r => r.physicalId === 'vpce-s3-external')).toBe(false);
1516
+ });
1517
+
1518
+ it('should preserve existing VPC endpoints and only create missing ones', async () => {
1519
+ const appDefinition = {
1520
+ vpc: { enable: true },
1521
+ encryption: { fieldLevelEncryptionMethod: 'kms' },
1522
+ };
1523
+
1524
+ const discoveredResources = {
1525
+ fromCloudFormationStack: true,
1526
+ stackName: 'test-stack',
1527
+ existingLogicalIds: [
1528
+ 'FriggS3VPCEndpoint', // In stack
1529
+ 'FriggDynamoDBVPCEndpoint', // In stack
1530
+ 'FriggKMSVPCEndpoint' // In stack
1531
+ // SecretsManager and SQS NOT in stack (were deleted)
1532
+ ],
1533
+ defaultVpcId: 'vpc-123',
1534
+ privateSubnetId1: 'subnet-1',
1535
+ privateSubnetId2: 'subnet-2',
1536
+ lambdaSecurityGroupId: 'sg-123',
1537
+ routeTableId: 'rtb-123',
1538
+ // Endpoints in stack
1539
+ s3VpcEndpointId: 'vpce-s3-existing',
1540
+ dynamodbVpcEndpointId: 'vpce-ddb-existing',
1541
+ kmsVpcEndpointId: 'vpce-kms-existing'
1542
+ // secretsManagerVpcEndpointId and sqsVpcEndpointId NOT present
1543
+ };
1544
+
1545
+ const result = await vpcBuilder.build(appDefinition, discoveredResources);
1546
+
1547
+ // Existing endpoints MUST be in template (re-added)
1548
+ expect(result.resources.FriggS3VPCEndpoint).toBeDefined();
1549
+ expect(result.resources.FriggS3VPCEndpoint.Properties.VpcId).toBe('vpc-123');
1550
+
1551
+ expect(result.resources.FriggDynamoDBVPCEndpoint).toBeDefined();
1552
+ expect(result.resources.FriggDynamoDBVPCEndpoint.Properties.VpcId).toBe('vpc-123');
1553
+
1554
+ expect(result.resources.FriggKMSVPCEndpoint).toBeDefined();
1555
+ expect(result.resources.FriggKMSVPCEndpoint.Properties.VpcId).toBe('vpc-123');
1556
+
1557
+ // Missing endpoints should also be created
1558
+ expect(result.resources.FriggSecretsManagerVPCEndpoint).toBeDefined();
1559
+ expect(result.resources.FriggSQSVPCEndpoint).toBeDefined();
1560
+
1561
+ // VPC Endpoint Security Group should be created
1562
+ expect(result.resources.FriggVPCEndpointSecurityGroup).toBeDefined();
1563
+ });
1564
+ });
1565
+
1450
1566
  describe('convertFlatDiscoveryToStructured - CloudFormation query results', () => {
1451
1567
  it('should add VPC from CloudFormation query to external array', () => {
1452
1568
  const flatDiscovery = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.490.36b3031.0",
4
+ "version": "2.0.0--canary.490.e6d93e8.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -16,9 +16,9 @@
16
16
  "@babel/eslint-parser": "^7.18.9",
17
17
  "@babel/parser": "^7.25.3",
18
18
  "@babel/traverse": "^7.25.3",
19
- "@friggframework/core": "2.0.0--canary.490.36b3031.0",
20
- "@friggframework/schemas": "2.0.0--canary.490.36b3031.0",
21
- "@friggframework/test": "2.0.0--canary.490.36b3031.0",
19
+ "@friggframework/core": "2.0.0--canary.490.e6d93e8.0",
20
+ "@friggframework/schemas": "2.0.0--canary.490.e6d93e8.0",
21
+ "@friggframework/test": "2.0.0--canary.490.e6d93e8.0",
22
22
  "@hapi/boom": "^10.0.1",
23
23
  "@inquirer/prompts": "^5.3.8",
24
24
  "axios": "^1.7.2",
@@ -46,8 +46,8 @@
46
46
  "validate-npm-package-name": "^5.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@friggframework/eslint-config": "2.0.0--canary.490.36b3031.0",
50
- "@friggframework/prettier-config": "2.0.0--canary.490.36b3031.0",
49
+ "@friggframework/eslint-config": "2.0.0--canary.490.e6d93e8.0",
50
+ "@friggframework/prettier-config": "2.0.0--canary.490.e6d93e8.0",
51
51
  "aws-sdk-client-mock": "^4.1.0",
52
52
  "aws-sdk-client-mock-jest": "^4.1.0",
53
53
  "jest": "^30.1.3",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "36b30311e062560a65a75a864b880bff01a745e7"
82
+ "gitHead": "e6d93e89ac26842505162381f435720d7923baf4"
83
83
  }