@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.
- package/dist/cjs/JaypieGitHubDeployRole.d.ts +1 -1
- package/dist/cjs/JaypieHostedZone.d.ts +6 -1
- package/dist/cjs/index.cjs +46 -4
- 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 +50 -8
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -3
|
@@ -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';
|
|
@@ -20,7 +20,6 @@ import { Role, FederatedPrincipal, PolicyStatement, Effect, ServicePrincipal, Ma
|
|
|
20
20
|
import { LogGroup, RetentionDays, FilterPattern } from 'aws-cdk-lib/aws-logs';
|
|
21
21
|
import { CfnPermissionSet, CfnAssignment } from 'aws-cdk-lib/aws-sso';
|
|
22
22
|
import { CfnApplication } from 'aws-cdk-lib/aws-sam';
|
|
23
|
-
import { ConfigurationError as ConfigurationError$1 } from '@jaypie/errors';
|
|
24
23
|
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
25
24
|
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
26
25
|
|
|
@@ -1321,7 +1320,7 @@ class JaypieDnsRecord extends Construct {
|
|
|
1321
1320
|
}
|
|
1322
1321
|
|
|
1323
1322
|
class JaypieGitHubDeployRole extends Construct {
|
|
1324
|
-
constructor(scope, id, props = {}) {
|
|
1323
|
+
constructor(scope, id = "GitHubDeployRole", props = {}) {
|
|
1325
1324
|
super(scope, id);
|
|
1326
1325
|
const { oidcProviderArn = Fn.importValue(CDK$2.IMPORT.OIDC_PROVIDER), output = true, repoRestriction: propsRepoRestriction, } = props;
|
|
1327
1326
|
// Extract account ID from the scope
|
|
@@ -1415,11 +1414,54 @@ class JaypieExpressLambda extends JaypieLambda {
|
|
|
1415
1414
|
const SERVICE = {
|
|
1416
1415
|
ROUTE53: "route53.amazonaws.com",
|
|
1417
1416
|
};
|
|
1417
|
+
/**
|
|
1418
|
+
* Check if a string is a valid hostname
|
|
1419
|
+
*/
|
|
1420
|
+
function isValidHostname(str) {
|
|
1421
|
+
// Check if it contains a dot and matches hostname pattern
|
|
1422
|
+
if (!str.includes("."))
|
|
1423
|
+
return false;
|
|
1424
|
+
// Basic hostname validation: alphanumeric, hyphens, dots
|
|
1425
|
+
// Each label must start and end with alphanumeric
|
|
1426
|
+
const hostnameRegex = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;
|
|
1427
|
+
return hostnameRegex.test(str);
|
|
1428
|
+
}
|
|
1418
1429
|
class JaypieHostedZone extends Construct {
|
|
1419
1430
|
/**
|
|
1420
1431
|
* Create a new hosted zone with query logging and optional DNS records
|
|
1421
1432
|
*/
|
|
1422
|
-
constructor(scope,
|
|
1433
|
+
constructor(scope, idOrProps, propsOrRecords) {
|
|
1434
|
+
// Handle overloaded constructor signatures
|
|
1435
|
+
let props;
|
|
1436
|
+
let id;
|
|
1437
|
+
if (typeof idOrProps === "string") {
|
|
1438
|
+
// If it's a valid hostname, treat it as zoneName
|
|
1439
|
+
if (isValidHostname(idOrProps)) {
|
|
1440
|
+
// Third param can be props object or records array
|
|
1441
|
+
if (Array.isArray(propsOrRecords)) {
|
|
1442
|
+
props = { zoneName: idOrProps, records: propsOrRecords };
|
|
1443
|
+
}
|
|
1444
|
+
else {
|
|
1445
|
+
props = propsOrRecords || { zoneName: idOrProps };
|
|
1446
|
+
// Set zoneName if not already set
|
|
1447
|
+
if (!props.zoneName) {
|
|
1448
|
+
props = { ...props, zoneName: idOrProps };
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
// Use id from props if provided, otherwise derive from zoneName
|
|
1452
|
+
id = props.id || `${idOrProps}-HostedZone`;
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
// Otherwise treat it as an explicit id
|
|
1456
|
+
props = propsOrRecords;
|
|
1457
|
+
id = idOrProps;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
else {
|
|
1461
|
+
// idOrProps is props
|
|
1462
|
+
props = idOrProps;
|
|
1463
|
+
id = props.id || `${props.zoneName}-HostedZone`;
|
|
1464
|
+
}
|
|
1423
1465
|
super(scope, id);
|
|
1424
1466
|
const { zoneName, project } = props;
|
|
1425
1467
|
const destination = props.destination ?? true;
|
|
@@ -1836,7 +1878,7 @@ class JaypieSsoSyncApplication extends Construct {
|
|
|
1836
1878
|
missingParams.push(`scimEndpointUrl or ${scimEndpointUrlEnvKey} environment variable`);
|
|
1837
1879
|
}
|
|
1838
1880
|
if (missingParams.length > 0) {
|
|
1839
|
-
throw new ConfigurationError
|
|
1881
|
+
throw new ConfigurationError(`JaypieSsoSyncApplication missing required configuration: ${missingParams.join(", ")}`);
|
|
1840
1882
|
}
|
|
1841
1883
|
// Create the SSO Sync Application
|
|
1842
1884
|
// Type assertion is safe because we validated all required values above
|
|
@@ -1891,11 +1933,11 @@ class JaypieWebDeploymentBucket extends Construct {
|
|
|
1891
1933
|
throw new ConfigurationError("CDK_ENV_WEB_SUBDOMAIN is not a valid subdomain");
|
|
1892
1934
|
}
|
|
1893
1935
|
if (process.env.CDK_ENV_WEB_HOSTED_ZONE &&
|
|
1894
|
-
!isValidHostname(process.env.CDK_ENV_WEB_HOSTED_ZONE)) {
|
|
1936
|
+
!isValidHostname$1(process.env.CDK_ENV_WEB_HOSTED_ZONE)) {
|
|
1895
1937
|
throw new ConfigurationError("CDK_ENV_WEB_HOSTED_ZONE is not a valid hostname");
|
|
1896
1938
|
}
|
|
1897
1939
|
if (process.env.CDK_ENV_HOSTED_ZONE &&
|
|
1898
|
-
!isValidHostname(process.env.CDK_ENV_HOSTED_ZONE)) {
|
|
1940
|
+
!isValidHostname$1(process.env.CDK_ENV_HOSTED_ZONE)) {
|
|
1899
1941
|
throw new ConfigurationError("CDK_ENV_HOSTED_ZONE is not a valid hostname");
|
|
1900
1942
|
}
|
|
1901
1943
|
// Determine host from props or environment
|
|
@@ -1912,7 +1954,7 @@ class JaypieWebDeploymentBucket extends Construct {
|
|
|
1912
1954
|
host = undefined;
|
|
1913
1955
|
}
|
|
1914
1956
|
}
|
|
1915
|
-
if (host && !isValidHostname(host)) {
|
|
1957
|
+
if (host && !isValidHostname$1(host)) {
|
|
1916
1958
|
throw new ConfigurationError("Host is not a valid hostname");
|
|
1917
1959
|
}
|
|
1918
1960
|
// Determine zone from props or environment
|