@mapbox/cloudfriend 9.1.1-0 → 9.1.1

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 (60) hide show
  1. package/.idea/copilot.data.migration.ask2agent.xml +6 -0
  2. package/.idea/misc.xml +1 -1
  3. package/.nyc_output/b6e4581b-e7fc-423e-9c50-3d23e5008df1.json +1 -0
  4. package/.nyc_output/f18b3f27-0357-4d4c-873b-fe236737f0d0.json +1 -0
  5. package/.nyc_output/processinfo/b6e4581b-e7fc-423e-9c50-3d23e5008df1.json +1 -0
  6. package/.nyc_output/processinfo/f18b3f27-0357-4d4c-873b-fe236737f0d0.json +1 -0
  7. package/.nyc_output/processinfo/index.json +1 -1
  8. package/changelog.md +4 -0
  9. package/lib/shortcuts/api.md +1 -40
  10. package/lib/shortcuts/index.js +0 -1
  11. package/lib/shortcuts/lambda.js +4 -2
  12. package/package.json +2 -2
  13. package/requirements.dev.txt +2 -2
  14. package/test/fixtures/shortcuts/event-lambda-custom-eventbus.json +2 -1
  15. package/test/fixtures/shortcuts/event-lambda-defaults.json +2 -1
  16. package/test/fixtures/shortcuts/event-lambda-full.json +2 -1
  17. package/test/fixtures/shortcuts/hookshot-github-compatible-legacy-node-runtimes.json +3 -1
  18. package/test/fixtures/shortcuts/hookshot-github-secret-ref.json +3 -1
  19. package/test/fixtures/shortcuts/hookshot-github-secret-string.json +3 -1
  20. package/test/fixtures/shortcuts/hookshot-github.json +3 -1
  21. package/test/fixtures/shortcuts/hookshot-passthrough-access-log-format.json +3 -1
  22. package/test/fixtures/shortcuts/hookshot-passthrough-alarms.json +3 -1
  23. package/test/fixtures/shortcuts/hookshot-passthrough-compatible-legacy-node-runtimes.json +3 -1
  24. package/test/fixtures/shortcuts/hookshot-passthrough-enhanced-logging.json +3 -1
  25. package/test/fixtures/shortcuts/hookshot-passthrough-full-blown-logging.json +3 -1
  26. package/test/fixtures/shortcuts/hookshot-passthrough-logging.json +3 -1
  27. package/test/fixtures/shortcuts/hookshot-passthrough.json +3 -1
  28. package/test/fixtures/shortcuts/lambda-defaults.json +2 -1
  29. package/test/fixtures/shortcuts/lambda-docker.json +2 -1
  30. package/test/fixtures/shortcuts/lambda-full.json +2 -1
  31. package/test/fixtures/shortcuts/lambda-provided-role.json +2 -1
  32. package/test/fixtures/shortcuts/lambda-zipfile.json +2 -1
  33. package/test/fixtures/shortcuts/log-subscription-lambda-defaults.json +2 -1
  34. package/test/fixtures/shortcuts/log-subscription-lambda-no-defaults.json +2 -1
  35. package/test/fixtures/shortcuts/queue-lambda-zero.json +2 -1
  36. package/test/fixtures/shortcuts/queue-lambda.json +2 -1
  37. package/test/fixtures/shortcuts/scheduled-lambda-defaults.json +2 -1
  38. package/test/fixtures/shortcuts/scheduled-lambda-full.json +2 -1
  39. package/test/fixtures/shortcuts/stream-lambda-defaults.json +2 -1
  40. package/test/fixtures/shortcuts/stream-lambda-no-defaults.json +2 -1
  41. package/test/shortcuts.test.js +15 -298
  42. package/.claude/settings.local.json +0 -7
  43. package/.idea/codeStyles/Project.xml +0 -7
  44. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  45. package/.nyc_output/8d7825ff-d255-4e4a-ace8-09ece4986dd0.json +0 -1
  46. package/.nyc_output/a47652f0-6d32-4764-bfc0-35090b7c546a.json +0 -1
  47. package/.nyc_output/processinfo/8d7825ff-d255-4e4a-ace8-09ece4986dd0.json +0 -1
  48. package/.nyc_output/processinfo/a47652f0-6d32-4764-bfc0-35090b7c546a.json +0 -1
  49. package/cfniceberg_createtable.yaml +0 -71
  50. package/lib/shortcuts/glue-iceberg-table.js +0 -227
  51. package/test/fixtures/shortcuts/glue-iceberg-table-defaults.json +0 -41
  52. package/test/fixtures/shortcuts/glue-iceberg-table-no-defaults.json +0 -51
  53. package/test/fixtures/shortcuts/glue-iceberg-table-with-all-optimizers.json +0 -101
  54. package/test/fixtures/shortcuts/glue-iceberg-table-with-both-optimizers.json +0 -80
  55. package/test/fixtures/shortcuts/glue-iceberg-table-with-compaction-custom.json +0 -68
  56. package/test/fixtures/shortcuts/glue-iceberg-table-with-compaction-defaults.json +0 -57
  57. package/test/fixtures/shortcuts/glue-iceberg-table-with-optimizer-custom.json +0 -84
  58. package/test/fixtures/shortcuts/glue-iceberg-table-with-optimizer-defaults.json +0 -64
  59. package/test/fixtures/shortcuts/glue-iceberg-table-with-orphan-deletion-custom.json +0 -74
  60. package/test/fixtures/shortcuts/glue-iceberg-table-with-orphan-deletion-defaults.json +0 -62
@@ -16,13 +16,8 @@ const noUndefined = (template) => JSON.parse(JSON.stringify(template));
16
16
  test('[shortcuts] fixture validation', async (assert) => {
17
17
  // Runs cfn-lint, ignoring "warnings". Install via pip or Homebrew to run these
18
18
  // tests locally.
19
- const cfnLint = (filepath, filename) => new Promise((resolve, reject) => {
20
- // Ignore E3003 (missing TableInput) and E3002 (unexpected properties) for Iceberg tables only
21
- // cfn-lint doesn't yet support OpenTableFormatInput (Iceberg table format)
22
- const isIcebergTable = filename.includes('glue-iceberg-table');
23
- const ignoreChecks = isIcebergTable ? 'W,E3003,E3002' : 'W';
24
-
25
- cp.exec(`cfn-lint ${filepath} --ignore-checks ${ignoreChecks}`, (err, stdout) => {
19
+ const cfnLint = (filepath) => new Promise((resolve, reject) => {
20
+ cp.exec(`cfn-lint ${filepath} --ignore-checks W`, (err, stdout) => {
26
21
  if (err) return reject(new Error(stdout));
27
22
  return resolve();
28
23
  });
@@ -35,7 +30,7 @@ test('[shortcuts] fixture validation', async (assert) => {
35
30
  while (toValidate.length) {
36
31
  const filename = toValidate.shift();
37
32
  await Promise.all([
38
- cfnLint(path.join(__dirname, 'fixtures', 'shortcuts', filename), filename)
33
+ cfnLint(path.join(__dirname, 'fixtures', 'shortcuts', filename))
39
34
  .then(() => assert.pass(`${filename} fixture passed validation`))
40
35
  .catch((err) => {
41
36
  assert.fail(`${filename} fixture fails validation`);
@@ -94,6 +89,18 @@ test('[shortcuts] lambda', (assert) => {
94
89
  'expected resources generated using all default values'
95
90
  );
96
91
 
92
+ const lambdaWithRetain = new cf.shortcuts.Lambda({
93
+ LogicalName: 'MyLambda',
94
+ Code: { S3Bucket: 'my-code-bucket', S3Key: 'path/to/code.zip' },
95
+ LogPolicyDeletionPolicy: 'Retain'
96
+ });
97
+ const templateWithRetain = cf.merge(lambdaWithRetain);
98
+ assert.equal(
99
+ templateWithRetain.Resources.MyLambdaLogPolicy.DeletionPolicy,
100
+ 'Retain',
101
+ 'LogPolicyDeletionPolicy=Retain sets DeletionPolicy on IAM Policy resource'
102
+ );
103
+
97
104
  lambda = new cf.shortcuts.Lambda({
98
105
  LogicalName: 'MyLambda',
99
106
  Code: {
@@ -1427,296 +1434,6 @@ test('[shortcuts] glue parquet table', (assert) => {
1427
1434
  assert.end();
1428
1435
  });
1429
1436
 
1430
- test('[shortcuts] glue iceberg table', (assert) => {
1431
- assert.throws(
1432
- () => new cf.shortcuts.GlueIcebergTable(),
1433
- 'Options required',
1434
- 'throws without options'
1435
- );
1436
- assert.throws(
1437
- () => new cf.shortcuts.GlueIcebergTable({}),
1438
- /You must provide a LogicalName, Name, DatabaseName, and Location/,
1439
- 'throws without required parameters'
1440
- );
1441
-
1442
- let db = new cf.shortcuts.GlueIcebergTable({
1443
- LogicalName: 'MyTable',
1444
- DatabaseName: 'my_database',
1445
- Name: 'my_table',
1446
- Columns: [
1447
- { Name: 'column', Type: 'string' }
1448
- ],
1449
- Location: 's3://fake/location'
1450
- });
1451
-
1452
- let template = cf.merge(db);
1453
- if (update) fixtures.update('glue-iceberg-table-defaults', template);
1454
- assert.deepEqual(
1455
- noUndefined(template),
1456
- fixtures.get('glue-iceberg-table-defaults'),
1457
- 'expected resources generated with defaults'
1458
- );
1459
-
1460
- db = new cf.shortcuts.GlueIcebergTable({
1461
- LogicalName: 'MyTable',
1462
- DatabaseName: 'my_database',
1463
- Name: 'my_table',
1464
- Columns: [
1465
- { Name: 'column', Type: 'string' }
1466
- ],
1467
- CatalogId: '1234',
1468
- Owner: 'Team',
1469
- Parameters: { table: 'params' },
1470
- Description: 'my_table description',
1471
- Retention: 12,
1472
- Location: 's3://fake/location',
1473
- IcebergVersion: '2',
1474
- Condition: 'Always',
1475
- DependsOn: 'AnotherThing'
1476
- });
1477
-
1478
- template = cf.merge(
1479
- { Conditions: { Always: cf.equals('1', '1') } },
1480
- { Resources: { AnotherThing: { Type: 'AWS::SNS::Topic' } } },
1481
- db
1482
- );
1483
- if (update) fixtures.update('glue-iceberg-table-no-defaults', template);
1484
- assert.deepEqual(
1485
- noUndefined(template),
1486
- fixtures.get('glue-iceberg-table-no-defaults'),
1487
- 'expected resources generated without defaults'
1488
- );
1489
-
1490
- assert.throws(
1491
- () => new cf.shortcuts.GlueIcebergTable({
1492
- LogicalName: 'MyTable',
1493
- DatabaseName: 'my_database',
1494
- Name: 'my_table',
1495
- Columns: [
1496
- { Name: 'column', Type: 'string' }
1497
- ],
1498
- Location: 's3://fake/location',
1499
- EnableOptimizer: true
1500
- }),
1501
- /You must provide an OptimizerRoleArn when EnableOptimizer is true/,
1502
- 'throws when EnableOptimizer is true but OptimizerRoleArn is missing'
1503
- );
1504
-
1505
- db = new cf.shortcuts.GlueIcebergTable({
1506
- LogicalName: 'MyTable',
1507
- DatabaseName: 'my_database',
1508
- Name: 'my_table',
1509
- Columns: [
1510
- { Name: 'column', Type: 'string' }
1511
- ],
1512
- Location: 's3://fake/location',
1513
- EnableOptimizer: true,
1514
- OptimizerRoleArn: 'arn:aws:iam::123456789012:role/OptimizerRole'
1515
- });
1516
-
1517
- template = cf.merge(db);
1518
- if (update) fixtures.update('glue-iceberg-table-with-optimizer-defaults', template);
1519
- assert.deepEqual(
1520
- noUndefined(template),
1521
- fixtures.get('glue-iceberg-table-with-optimizer-defaults'),
1522
- 'expected resources generated with optimizer using default retention settings'
1523
- );
1524
-
1525
- db = new cf.shortcuts.GlueIcebergTable({
1526
- LogicalName: 'MyTable',
1527
- DatabaseName: 'my_database',
1528
- Name: 'my_table',
1529
- Columns: [
1530
- { Name: 'column', Type: 'string' }
1531
- ],
1532
- Location: 's3://fake/location',
1533
- EnableOptimizer: true,
1534
- OptimizerRoleArn: cf.getAtt('OptimizerRole', 'Arn'),
1535
- SnapshotRetentionPeriodInDays: 7,
1536
- NumberOfSnapshotsToRetain: 3,
1537
- CleanExpiredFiles: false,
1538
- Condition: 'Always'
1539
- });
1540
-
1541
- template = cf.merge(
1542
- { Conditions: { Always: cf.equals('1', '1') } },
1543
- { Resources: { OptimizerRole: { Type: 'AWS::IAM::Role', Properties: { AssumeRolePolicyDocument: {} } } } },
1544
- db
1545
- );
1546
- if (update) fixtures.update('glue-iceberg-table-with-optimizer-custom', template);
1547
- assert.deepEqual(
1548
- noUndefined(template),
1549
- fixtures.get('glue-iceberg-table-with-optimizer-custom'),
1550
- 'expected resources generated with optimizer using custom retention settings'
1551
- );
1552
-
1553
- assert.throws(
1554
- () => new cf.shortcuts.GlueIcebergTable({
1555
- LogicalName: 'MyTable',
1556
- DatabaseName: 'my_database',
1557
- Name: 'my_table',
1558
- Columns: [
1559
- { Name: 'column', Type: 'string' }
1560
- ],
1561
- Location: 's3://fake/location',
1562
- EnableCompaction: true
1563
- }),
1564
- /You must provide a CompactionRoleArn when EnableCompaction is true/,
1565
- 'throws when EnableCompaction is true but CompactionRoleArn is missing'
1566
- );
1567
-
1568
- db = new cf.shortcuts.GlueIcebergTable({
1569
- LogicalName: 'MyTable',
1570
- DatabaseName: 'my_database',
1571
- Name: 'my_table',
1572
- Columns: [
1573
- { Name: 'column', Type: 'string' }
1574
- ],
1575
- Location: 's3://fake/location',
1576
- EnableCompaction: true,
1577
- CompactionRoleArn: 'arn:aws:iam::123456789012:role/CompactionRole'
1578
- });
1579
-
1580
- template = cf.merge(db);
1581
- if (update) fixtures.update('glue-iceberg-table-with-compaction-defaults', template);
1582
- assert.deepEqual(
1583
- noUndefined(template),
1584
- fixtures.get('glue-iceberg-table-with-compaction-defaults'),
1585
- 'expected resources generated with compaction using default settings'
1586
- );
1587
-
1588
- db = new cf.shortcuts.GlueIcebergTable({
1589
- LogicalName: 'MyTable',
1590
- DatabaseName: 'my_database',
1591
- Name: 'my_table',
1592
- Columns: [
1593
- { Name: 'column', Type: 'string' }
1594
- ],
1595
- Location: 's3://fake/location',
1596
- EnableCompaction: true,
1597
- CompactionRoleArn: cf.getAtt('CompactionRole', 'Arn')
1598
- });
1599
-
1600
- template = cf.merge(
1601
- { Resources: { CompactionRole: { Type: 'AWS::IAM::Role', Properties: { AssumeRolePolicyDocument: {} } } } },
1602
- db
1603
- );
1604
- if (update) fixtures.update('glue-iceberg-table-with-compaction-custom', template);
1605
- assert.deepEqual(
1606
- noUndefined(template),
1607
- fixtures.get('glue-iceberg-table-with-compaction-custom'),
1608
- 'expected resources generated with compaction using custom settings'
1609
- );
1610
-
1611
- db = new cf.shortcuts.GlueIcebergTable({
1612
- LogicalName: 'MyTable',
1613
- DatabaseName: 'my_database',
1614
- Name: 'my_table',
1615
- Columns: [
1616
- { Name: 'column', Type: 'string' }
1617
- ],
1618
- Location: 's3://fake/location',
1619
- EnableOptimizer: true,
1620
- OptimizerRoleArn: 'arn:aws:iam::123456789012:role/RetentionRole',
1621
- EnableCompaction: true,
1622
- CompactionRoleArn: 'arn:aws:iam::123456789012:role/CompactionRole'
1623
- });
1624
-
1625
- template = cf.merge(db);
1626
- if (update) fixtures.update('glue-iceberg-table-with-both-optimizers', template);
1627
- assert.deepEqual(
1628
- noUndefined(template),
1629
- fixtures.get('glue-iceberg-table-with-both-optimizers'),
1630
- 'expected resources generated with both retention and compaction optimizers'
1631
- );
1632
-
1633
- assert.throws(
1634
- () => new cf.shortcuts.GlueIcebergTable({
1635
- LogicalName: 'MyTable',
1636
- DatabaseName: 'my_database',
1637
- Name: 'my_table',
1638
- Columns: [
1639
- { Name: 'column', Type: 'string' }
1640
- ],
1641
- Location: 's3://fake/location',
1642
- EnableOrphanFileDeletion: true
1643
- }),
1644
- /You must provide an OrphanFileDeletionRoleArn when EnableOrphanFileDeletion is true/,
1645
- 'throws when EnableOrphanFileDeletion is true but OrphanFileDeletionRoleArn is missing'
1646
- );
1647
-
1648
- db = new cf.shortcuts.GlueIcebergTable({
1649
- LogicalName: 'MyTable',
1650
- DatabaseName: 'my_database',
1651
- Name: 'my_table',
1652
- Columns: [
1653
- { Name: 'column', Type: 'string' }
1654
- ],
1655
- Location: 's3://fake/location',
1656
- EnableOrphanFileDeletion: true,
1657
- OrphanFileDeletionRoleArn: 'arn:aws:iam::123456789012:role/OrphanFileDeletionRole'
1658
- });
1659
-
1660
- template = cf.merge(db);
1661
- if (update) fixtures.update('glue-iceberg-table-with-orphan-deletion-defaults', template);
1662
- assert.deepEqual(
1663
- noUndefined(template),
1664
- fixtures.get('glue-iceberg-table-with-orphan-deletion-defaults'),
1665
- 'expected resources generated with orphan file deletion using default settings'
1666
- );
1667
-
1668
- db = new cf.shortcuts.GlueIcebergTable({
1669
- LogicalName: 'MyTable',
1670
- DatabaseName: 'my_database',
1671
- Name: 'my_table',
1672
- Columns: [
1673
- { Name: 'column', Type: 'string' }
1674
- ],
1675
- Location: 's3://fake/location',
1676
- EnableOrphanFileDeletion: true,
1677
- OrphanFileDeletionRoleArn: cf.getAtt('OrphanFileDeletionRole', 'Arn'),
1678
- OrphanFileRetentionPeriodInDays: 7,
1679
- OrphanFileDeletionLocation: 's3://fake/location/subdir'
1680
- });
1681
-
1682
- template = cf.merge(
1683
- { Resources: { OrphanFileDeletionRole: { Type: 'AWS::IAM::Role', Properties: { AssumeRolePolicyDocument: {} } } } },
1684
- db
1685
- );
1686
- if (update) fixtures.update('glue-iceberg-table-with-orphan-deletion-custom', template);
1687
- assert.deepEqual(
1688
- noUndefined(template),
1689
- fixtures.get('glue-iceberg-table-with-orphan-deletion-custom'),
1690
- 'expected resources generated with orphan file deletion using custom settings'
1691
- );
1692
-
1693
- db = new cf.shortcuts.GlueIcebergTable({
1694
- LogicalName: 'MyTable',
1695
- DatabaseName: 'my_database',
1696
- Name: 'my_table',
1697
- Columns: [
1698
- { Name: 'column', Type: 'string' }
1699
- ],
1700
- Location: 's3://fake/location',
1701
- EnableOptimizer: true,
1702
- OptimizerRoleArn: 'arn:aws:iam::123456789012:role/SharedRole',
1703
- EnableCompaction: true,
1704
- CompactionRoleArn: 'arn:aws:iam::123456789012:role/SharedRole',
1705
- EnableOrphanFileDeletion: true,
1706
- OrphanFileDeletionRoleArn: 'arn:aws:iam::123456789012:role/SharedRole'
1707
- });
1708
-
1709
- template = cf.merge(db);
1710
- if (update) fixtures.update('glue-iceberg-table-with-all-optimizers', template);
1711
- assert.deepEqual(
1712
- noUndefined(template),
1713
- fixtures.get('glue-iceberg-table-with-all-optimizers'),
1714
- 'expected resources generated with all three optimizers using same role'
1715
- );
1716
-
1717
- assert.end();
1718
- });
1719
-
1720
1437
  test('[shortcuts] glue view', (assert) => {
1721
1438
  assert.throws(
1722
1439
  () => new cf.shortcuts.GluePrestoView(),
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run test:*)"
5
- ]
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <ScalaCodeStyleSettings>
4
- <option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
5
- </ScalaCodeStyleSettings>
6
- </code_scheme>
7
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
- </state>
5
- </component>