@jaypie/constructs 1.1.51 → 1.1.52

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.
@@ -7,7 +7,7 @@ export interface JaypieGitHubDeployRoleProps {
7
7
  }
8
8
  export declare class JaypieGitHubDeployRole extends Construct {
9
9
  private readonly _role;
10
- constructor(scope: Construct, id: string, props?: JaypieGitHubDeployRoleProps);
10
+ constructor(scope: Construct, id?: string, props?: JaypieGitHubDeployRoleProps);
11
11
  get role(): Role;
12
12
  get roleArn(): string;
13
13
  get roleName(): string;
@@ -15,6 +15,11 @@ export interface JaypieHostedZoneRecordProps extends Omit<JaypieDnsRecordProps,
15
15
  id?: string;
16
16
  }
17
17
  interface JaypieHostedZoneProps {
18
+ /**
19
+ * Optional construct ID
20
+ * @default `${zoneName}-HostedZone`
21
+ */
22
+ id?: string;
18
23
  /**
19
24
  * The domain name for the hosted zone
20
25
  */
@@ -49,6 +54,6 @@ export declare class JaypieHostedZone extends Construct {
49
54
  /**
50
55
  * Create a new hosted zone with query logging and optional DNS records
51
56
  */
52
- constructor(scope: Construct, id: string, props: JaypieHostedZoneProps);
57
+ constructor(scope: Construct, idOrProps: string | JaypieHostedZoneProps, propsOrRecords?: JaypieHostedZoneProps | JaypieHostedZoneRecordProps[]);
53
58
  }
54
59
  export {};
@@ -1352,7 +1352,7 @@ class JaypieDnsRecord extends constructs.Construct {
1352
1352
  }
1353
1353
 
1354
1354
  class JaypieGitHubDeployRole extends constructs.Construct {
1355
- constructor(scope, id, props = {}) {
1355
+ constructor(scope, id = "GitHubDeployRole", props = {}) {
1356
1356
  super(scope, id);
1357
1357
  const { oidcProviderArn = cdk$1.Fn.importValue(cdk.CDK.IMPORT.OIDC_PROVIDER), output = true, repoRestriction: propsRepoRestriction, } = props;
1358
1358
  // Extract account ID from the scope
@@ -1446,11 +1446,54 @@ class JaypieExpressLambda extends JaypieLambda {
1446
1446
  const SERVICE = {
1447
1447
  ROUTE53: "route53.amazonaws.com",
1448
1448
  };
1449
+ /**
1450
+ * Check if a string is a valid hostname
1451
+ */
1452
+ function isValidHostname(str) {
1453
+ // Check if it contains a dot and matches hostname pattern
1454
+ if (!str.includes("."))
1455
+ return false;
1456
+ // Basic hostname validation: alphanumeric, hyphens, dots
1457
+ // Each label must start and end with alphanumeric
1458
+ const hostnameRegex = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;
1459
+ return hostnameRegex.test(str);
1460
+ }
1449
1461
  class JaypieHostedZone extends constructs.Construct {
1450
1462
  /**
1451
1463
  * Create a new hosted zone with query logging and optional DNS records
1452
1464
  */
1453
- constructor(scope, id, props) {
1465
+ constructor(scope, idOrProps, propsOrRecords) {
1466
+ // Handle overloaded constructor signatures
1467
+ let props;
1468
+ let id;
1469
+ if (typeof idOrProps === "string") {
1470
+ // If it's a valid hostname, treat it as zoneName
1471
+ if (isValidHostname(idOrProps)) {
1472
+ // Third param can be props object or records array
1473
+ if (Array.isArray(propsOrRecords)) {
1474
+ props = { zoneName: idOrProps, records: propsOrRecords };
1475
+ }
1476
+ else {
1477
+ props = propsOrRecords || { zoneName: idOrProps };
1478
+ // Set zoneName if not already set
1479
+ if (!props.zoneName) {
1480
+ props = { ...props, zoneName: idOrProps };
1481
+ }
1482
+ }
1483
+ // Use id from props if provided, otherwise derive from zoneName
1484
+ id = props.id || `${idOrProps}-HostedZone`;
1485
+ }
1486
+ else {
1487
+ // Otherwise treat it as an explicit id
1488
+ props = propsOrRecords;
1489
+ id = idOrProps;
1490
+ }
1491
+ }
1492
+ else {
1493
+ // idOrProps is props
1494
+ props = idOrProps;
1495
+ id = props.id || `${props.zoneName}-HostedZone`;
1496
+ }
1454
1497
  super(scope, id);
1455
1498
  const { zoneName, project } = props;
1456
1499
  const destination = props.destination ?? true;