@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.
- package/dist/cjs/JaypieGitHubDeployRole.d.ts +1 -1
- package/dist/cjs/JaypieHostedZone.d.ts +6 -1
- package/dist/cjs/index.cjs +45 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/JaypieGitHubDeployRole.d.ts +1 -1
- package/dist/esm/JaypieHostedZone.d.ts +6 -1
- package/dist/esm/index.js +49 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
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,
|
|
57
|
+
constructor(scope: Construct, idOrProps: string | JaypieHostedZoneProps, propsOrRecords?: JaypieHostedZoneProps | JaypieHostedZoneRecordProps[]);
|
|
53
58
|
}
|
|
54
59
|
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CDK as CDK$2, ConfigurationError, mergeDomain, isValidSubdomain, isValidHostname } from '@jaypie/cdk';
|
|
1
|
+
import { CDK as CDK$2, ConfigurationError, mergeDomain, isValidSubdomain, isValidHostname as isValidHostname$1 } from '@jaypie/cdk';
|
|
2
2
|
export { CDK } from '@jaypie/cdk';
|
|
3
3
|
import { Construct } from 'constructs';
|
|
4
4
|
import * as cdk from 'aws-cdk-lib';
|
|
@@ -1321,7 +1321,7 @@ class JaypieDnsRecord extends Construct {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
1323
|
class JaypieGitHubDeployRole extends Construct {
|
|
1324
|
-
constructor(scope, id, props = {}) {
|
|
1324
|
+
constructor(scope, id = "GitHubDeployRole", props = {}) {
|
|
1325
1325
|
super(scope, id);
|
|
1326
1326
|
const { oidcProviderArn = Fn.importValue(CDK$2.IMPORT.OIDC_PROVIDER), output = true, repoRestriction: propsRepoRestriction, } = props;
|
|
1327
1327
|
// Extract account ID from the scope
|
|
@@ -1415,11 +1415,54 @@ class JaypieExpressLambda extends JaypieLambda {
|
|
|
1415
1415
|
const SERVICE = {
|
|
1416
1416
|
ROUTE53: "route53.amazonaws.com",
|
|
1417
1417
|
};
|
|
1418
|
+
/**
|
|
1419
|
+
* Check if a string is a valid hostname
|
|
1420
|
+
*/
|
|
1421
|
+
function isValidHostname(str) {
|
|
1422
|
+
// Check if it contains a dot and matches hostname pattern
|
|
1423
|
+
if (!str.includes("."))
|
|
1424
|
+
return false;
|
|
1425
|
+
// Basic hostname validation: alphanumeric, hyphens, dots
|
|
1426
|
+
// Each label must start and end with alphanumeric
|
|
1427
|
+
const hostnameRegex = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;
|
|
1428
|
+
return hostnameRegex.test(str);
|
|
1429
|
+
}
|
|
1418
1430
|
class JaypieHostedZone extends Construct {
|
|
1419
1431
|
/**
|
|
1420
1432
|
* Create a new hosted zone with query logging and optional DNS records
|
|
1421
1433
|
*/
|
|
1422
|
-
constructor(scope,
|
|
1434
|
+
constructor(scope, idOrProps, propsOrRecords) {
|
|
1435
|
+
// Handle overloaded constructor signatures
|
|
1436
|
+
let props;
|
|
1437
|
+
let id;
|
|
1438
|
+
if (typeof idOrProps === "string") {
|
|
1439
|
+
// If it's a valid hostname, treat it as zoneName
|
|
1440
|
+
if (isValidHostname(idOrProps)) {
|
|
1441
|
+
// Third param can be props object or records array
|
|
1442
|
+
if (Array.isArray(propsOrRecords)) {
|
|
1443
|
+
props = { zoneName: idOrProps, records: propsOrRecords };
|
|
1444
|
+
}
|
|
1445
|
+
else {
|
|
1446
|
+
props = propsOrRecords || { zoneName: idOrProps };
|
|
1447
|
+
// Set zoneName if not already set
|
|
1448
|
+
if (!props.zoneName) {
|
|
1449
|
+
props = { ...props, zoneName: idOrProps };
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
// Use id from props if provided, otherwise derive from zoneName
|
|
1453
|
+
id = props.id || `${idOrProps}-HostedZone`;
|
|
1454
|
+
}
|
|
1455
|
+
else {
|
|
1456
|
+
// Otherwise treat it as an explicit id
|
|
1457
|
+
props = propsOrRecords;
|
|
1458
|
+
id = idOrProps;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
else {
|
|
1462
|
+
// idOrProps is props
|
|
1463
|
+
props = idOrProps;
|
|
1464
|
+
id = props.id || `${props.zoneName}-HostedZone`;
|
|
1465
|
+
}
|
|
1423
1466
|
super(scope, id);
|
|
1424
1467
|
const { zoneName, project } = props;
|
|
1425
1468
|
const destination = props.destination ?? true;
|
|
@@ -1891,11 +1934,11 @@ class JaypieWebDeploymentBucket extends Construct {
|
|
|
1891
1934
|
throw new ConfigurationError("CDK_ENV_WEB_SUBDOMAIN is not a valid subdomain");
|
|
1892
1935
|
}
|
|
1893
1936
|
if (process.env.CDK_ENV_WEB_HOSTED_ZONE &&
|
|
1894
|
-
!isValidHostname(process.env.CDK_ENV_WEB_HOSTED_ZONE)) {
|
|
1937
|
+
!isValidHostname$1(process.env.CDK_ENV_WEB_HOSTED_ZONE)) {
|
|
1895
1938
|
throw new ConfigurationError("CDK_ENV_WEB_HOSTED_ZONE is not a valid hostname");
|
|
1896
1939
|
}
|
|
1897
1940
|
if (process.env.CDK_ENV_HOSTED_ZONE &&
|
|
1898
|
-
!isValidHostname(process.env.CDK_ENV_HOSTED_ZONE)) {
|
|
1941
|
+
!isValidHostname$1(process.env.CDK_ENV_HOSTED_ZONE)) {
|
|
1899
1942
|
throw new ConfigurationError("CDK_ENV_HOSTED_ZONE is not a valid hostname");
|
|
1900
1943
|
}
|
|
1901
1944
|
// Determine host from props or environment
|
|
@@ -1912,7 +1955,7 @@ class JaypieWebDeploymentBucket extends Construct {
|
|
|
1912
1955
|
host = undefined;
|
|
1913
1956
|
}
|
|
1914
1957
|
}
|
|
1915
|
-
if (host && !isValidHostname(host)) {
|
|
1958
|
+
if (host && !isValidHostname$1(host)) {
|
|
1916
1959
|
throw new ConfigurationError("Host is not a valid hostname");
|
|
1917
1960
|
}
|
|
1918
1961
|
// Determine zone from props or environment
|