@jaypie/constructs 1.1.51 → 1.1.53

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 {};
@@ -19,7 +19,6 @@ var awsIam = require('aws-cdk-lib/aws-iam');
19
19
  var awsLogs = require('aws-cdk-lib/aws-logs');
20
20
  var awsSso = require('aws-cdk-lib/aws-sso');
21
21
  var awsSam = require('aws-cdk-lib/aws-sam');
22
- var errors = require('@jaypie/errors');
23
22
  var cloudfront = require('aws-cdk-lib/aws-cloudfront');
24
23
  var origins = require('aws-cdk-lib/aws-cloudfront-origins');
25
24
 
@@ -1352,7 +1351,7 @@ class JaypieDnsRecord extends constructs.Construct {
1352
1351
  }
1353
1352
 
1354
1353
  class JaypieGitHubDeployRole extends constructs.Construct {
1355
- constructor(scope, id, props = {}) {
1354
+ constructor(scope, id = "GitHubDeployRole", props = {}) {
1356
1355
  super(scope, id);
1357
1356
  const { oidcProviderArn = cdk$1.Fn.importValue(cdk.CDK.IMPORT.OIDC_PROVIDER), output = true, repoRestriction: propsRepoRestriction, } = props;
1358
1357
  // Extract account ID from the scope
@@ -1446,11 +1445,54 @@ class JaypieExpressLambda extends JaypieLambda {
1446
1445
  const SERVICE = {
1447
1446
  ROUTE53: "route53.amazonaws.com",
1448
1447
  };
1448
+ /**
1449
+ * Check if a string is a valid hostname
1450
+ */
1451
+ function isValidHostname(str) {
1452
+ // Check if it contains a dot and matches hostname pattern
1453
+ if (!str.includes("."))
1454
+ return false;
1455
+ // Basic hostname validation: alphanumeric, hyphens, dots
1456
+ // Each label must start and end with alphanumeric
1457
+ const hostnameRegex = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;
1458
+ return hostnameRegex.test(str);
1459
+ }
1449
1460
  class JaypieHostedZone extends constructs.Construct {
1450
1461
  /**
1451
1462
  * Create a new hosted zone with query logging and optional DNS records
1452
1463
  */
1453
- constructor(scope, id, props) {
1464
+ constructor(scope, idOrProps, propsOrRecords) {
1465
+ // Handle overloaded constructor signatures
1466
+ let props;
1467
+ let id;
1468
+ if (typeof idOrProps === "string") {
1469
+ // If it's a valid hostname, treat it as zoneName
1470
+ if (isValidHostname(idOrProps)) {
1471
+ // Third param can be props object or records array
1472
+ if (Array.isArray(propsOrRecords)) {
1473
+ props = { zoneName: idOrProps, records: propsOrRecords };
1474
+ }
1475
+ else {
1476
+ props = propsOrRecords || { zoneName: idOrProps };
1477
+ // Set zoneName if not already set
1478
+ if (!props.zoneName) {
1479
+ props = { ...props, zoneName: idOrProps };
1480
+ }
1481
+ }
1482
+ // Use id from props if provided, otherwise derive from zoneName
1483
+ id = props.id || `${idOrProps}-HostedZone`;
1484
+ }
1485
+ else {
1486
+ // Otherwise treat it as an explicit id
1487
+ props = propsOrRecords;
1488
+ id = idOrProps;
1489
+ }
1490
+ }
1491
+ else {
1492
+ // idOrProps is props
1493
+ props = idOrProps;
1494
+ id = props.id || `${props.zoneName}-HostedZone`;
1495
+ }
1454
1496
  super(scope, id);
1455
1497
  const { zoneName, project } = props;
1456
1498
  const destination = props.destination ?? true;
@@ -1867,7 +1909,7 @@ class JaypieSsoSyncApplication extends constructs.Construct {
1867
1909
  missingParams.push(`scimEndpointUrl or ${scimEndpointUrlEnvKey} environment variable`);
1868
1910
  }
1869
1911
  if (missingParams.length > 0) {
1870
- throw new errors.ConfigurationError(`JaypieSsoSyncApplication missing required configuration: ${missingParams.join(", ")}`);
1912
+ throw new cdk.ConfigurationError(`JaypieSsoSyncApplication missing required configuration: ${missingParams.join(", ")}`);
1871
1913
  }
1872
1914
  // Create the SSO Sync Application
1873
1915
  // Type assertion is safe because we validated all required values above