@openhi/constructs 0.0.114 → 0.0.116
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/lib/chunk-AHYQFT4N.mjs +212 -0
- package/lib/chunk-AHYQFT4N.mjs.map +1 -0
- package/lib/{chunk-CUUKXDB2.mjs → chunk-AJQUWHFK.mjs} +460 -54
- package/lib/chunk-AJQUWHFK.mjs.map +1 -0
- package/lib/{chunk-GBDIGTNV.mjs → chunk-QWWLM452.mjs} +2 -2
- package/lib/{chunk-QMBJ4VHC.mjs → chunk-U7L7T4XU.mjs} +25 -25
- package/lib/{chunk-QMBJ4VHC.mjs.map → chunk-U7L7T4XU.mjs.map} +1 -1
- package/lib/{chunk-NZRW7ROK.mjs → chunk-YYRWDEG4.mjs} +2 -2
- package/lib/{chunk-KSFC72TT.mjs → chunk-ZHMHLK3S.mjs} +2 -2
- package/lib/{events-DPodvl07.d.mts → events-CMG8xanm.d.mts} +7 -53
- package/lib/{events-DPodvl07.d.ts → events-CMG8xanm.d.ts} +7 -53
- package/lib/index.d.mts +330 -84
- package/lib/index.d.ts +350 -136
- package/lib/index.js +844 -301
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +472 -304
- package/lib/index.mjs.map +1 -1
- package/lib/pre-token-generation.handler.mjs +3 -3
- package/lib/provision-default-workspace.handler.mjs +3 -3
- package/lib/rest-api-lambda.handler.mjs +282 -452
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.d.mts +6 -3
- package/lib/seed-demo-data.handler.d.ts +6 -3
- package/lib/seed-demo-data.handler.js +656 -0
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +4 -4
- package/lib/static-hosting.viewer-request-handler.d.mts +54 -0
- package/lib/static-hosting.viewer-request-handler.d.ts +54 -0
- package/lib/static-hosting.viewer-request-handler.js +79 -0
- package/lib/static-hosting.viewer-request-handler.js.map +1 -0
- package/lib/static-hosting.viewer-request-handler.mjs +53 -0
- package/lib/static-hosting.viewer-request-handler.mjs.map +1 -0
- package/package.json +2 -2
- package/lib/chunk-53OHXLIL.mjs +0 -27
- package/lib/chunk-53OHXLIL.mjs.map +0 -1
- package/lib/chunk-CUUKXDB2.mjs.map +0 -1
- /package/lib/{chunk-GBDIGTNV.mjs.map → chunk-QWWLM452.mjs.map} +0 -0
- /package/lib/{chunk-NZRW7ROK.mjs.map → chunk-YYRWDEG4.mjs.map} +0 -0
- /package/lib/{chunk-KSFC72TT.mjs.map → chunk-ZHMHLK3S.mjs.map} +0 -0
package/lib/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import_workflows as import_workflows2
|
|
12
12
|
} from "./chunk-WPCBVDFZ.mjs";
|
|
13
13
|
import {
|
|
14
|
+
DEMO_DATA_PLANE_FIXTURES,
|
|
14
15
|
DEMO_PERIOD,
|
|
15
16
|
DEMO_TENANT_SPECS,
|
|
16
17
|
DEMO_URN_SYSTEM,
|
|
@@ -21,21 +22,13 @@ import {
|
|
|
21
22
|
PLATFORM_SCOPE_TENANT_ID,
|
|
22
23
|
SEED_DEMO_DATA_CONSUMER_NAME,
|
|
23
24
|
SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR,
|
|
24
|
-
demoBasePartitionKeys,
|
|
25
|
-
demoDevUserPartitionKeys,
|
|
26
25
|
demoMembershipId,
|
|
27
|
-
demoMembershipPartitionKey,
|
|
28
26
|
demoRoleAssignmentId,
|
|
29
|
-
demoRoleAssignmentPartitionKey,
|
|
30
27
|
demoRolesForUserInTenant,
|
|
31
28
|
demoScenarioIdentifier,
|
|
32
|
-
demoTenantPartitionKey,
|
|
33
|
-
demoUserPartitionKey,
|
|
34
|
-
demoWorkspacePartitionKey,
|
|
35
29
|
import_workflows,
|
|
36
|
-
openhiResourceIdentifier
|
|
37
|
-
|
|
38
|
-
} from "./chunk-CUUKXDB2.mjs";
|
|
30
|
+
openhiResourceIdentifier
|
|
31
|
+
} from "./chunk-AJQUWHFK.mjs";
|
|
39
32
|
import {
|
|
40
33
|
OWNING_DELETE_CASCADE_CONSUMER_NAME,
|
|
41
34
|
OWNING_DELETE_CASCADE_DEFAULT_CONCURRENCY,
|
|
@@ -51,7 +44,7 @@ import {
|
|
|
51
44
|
RENAME_CASCADE_SLOW_THRESHOLD_SECONDS,
|
|
52
45
|
import_workflows as import_workflows4
|
|
53
46
|
} from "./chunk-23PUSHBV.mjs";
|
|
54
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-AHYQFT4N.mjs";
|
|
55
48
|
import {
|
|
56
49
|
PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE,
|
|
57
50
|
USER_ONBOARDING_EVENT_SOURCE,
|
|
@@ -69,10 +62,10 @@ import {
|
|
|
69
62
|
import {
|
|
70
63
|
require_lib
|
|
71
64
|
} from "./chunk-ZM4GDHHC.mjs";
|
|
72
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-QWWLM452.mjs";
|
|
73
66
|
import "./chunk-HQ67J7BP.mjs";
|
|
74
67
|
import "./chunk-QJDHVMKT.mjs";
|
|
75
|
-
import "./chunk-
|
|
68
|
+
import "./chunk-U7L7T4XU.mjs";
|
|
76
69
|
import "./chunk-FYHBHHWK.mjs";
|
|
77
70
|
import "./chunk-6NBGYGFL.mjs";
|
|
78
71
|
import "./chunk-TRY7JGWO.mjs";
|
|
@@ -620,46 +613,6 @@ var _RootGraphqlApi = class _RootGraphqlApi extends GraphqlApi {
|
|
|
620
613
|
_RootGraphqlApi.SSM_PARAM_NAME = "ROOT_GRAPHQL_API";
|
|
621
614
|
var RootGraphqlApi = _RootGraphqlApi;
|
|
622
615
|
|
|
623
|
-
// src/components/cognito/cognito-fixture-seeder-client.ts
|
|
624
|
-
import { Duration } from "aws-cdk-lib";
|
|
625
|
-
import {
|
|
626
|
-
UserPoolClient
|
|
627
|
-
} from "aws-cdk-lib/aws-cognito";
|
|
628
|
-
var CognitoFixtureSeederClient = class extends UserPoolClient {
|
|
629
|
-
constructor(scope, props) {
|
|
630
|
-
const { userPool, ...rest } = props;
|
|
631
|
-
super(scope, "fixture-seeder-client", {
|
|
632
|
-
userPool,
|
|
633
|
-
generateSecret: false,
|
|
634
|
-
authFlows: {
|
|
635
|
-
userPassword: true
|
|
636
|
-
},
|
|
637
|
-
// No OAuth flows — the seeder calls Cognito's `InitiateAuth`
|
|
638
|
-
// directly with USER_PASSWORD_AUTH, not through the hosted-UI
|
|
639
|
-
// OAuth grant flows the SPA client uses. `disableOAuth: true`
|
|
640
|
-
// causes CDK to omit `AllowedOAuthFlowsUserPoolClient` entirely;
|
|
641
|
-
// passing an empty `oAuth` block instead still flips that flag on
|
|
642
|
-
// and Cognito rejects the create call for missing flows/scopes.
|
|
643
|
-
disableOAuth: true,
|
|
644
|
-
// Short-lived tokens: a seeder run takes seconds, not hours.
|
|
645
|
-
// 1h access-token validity is the minimum Cognito permits and is
|
|
646
|
-
// plenty for a fixture run.
|
|
647
|
-
accessTokenValidity: Duration.hours(1),
|
|
648
|
-
idTokenValidity: Duration.hours(1),
|
|
649
|
-
refreshTokenValidity: Duration.days(1),
|
|
650
|
-
preventUserExistenceErrors: true,
|
|
651
|
-
...rest
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
/**
|
|
656
|
-
* SSM parameter name suffix used to publish this client's ID for
|
|
657
|
-
* cross-stack lookups. Built into a full parameter name via
|
|
658
|
-
* `buildParameterName` with `serviceType` AUTH (since the auth stack
|
|
659
|
-
* owns this resource).
|
|
660
|
-
*/
|
|
661
|
-
CognitoFixtureSeederClient.SSM_PARAM_NAME = "COGNITO_FIXTURE_SEEDER_CLIENT";
|
|
662
|
-
|
|
663
616
|
// src/components/cognito/cognito-user-pool.ts
|
|
664
617
|
import {
|
|
665
618
|
FeaturePlan,
|
|
@@ -704,8 +657,8 @@ var CognitoUserPool = class extends UserPool {
|
|
|
704
657
|
CognitoUserPool.SSM_PARAM_NAME = "COGNITO_USER_POOL";
|
|
705
658
|
|
|
706
659
|
// src/components/cognito/cognito-user-pool-client.ts
|
|
707
|
-
import { UserPoolClient
|
|
708
|
-
var CognitoUserPoolClient = class extends
|
|
660
|
+
import { UserPoolClient } from "aws-cdk-lib/aws-cognito";
|
|
661
|
+
var CognitoUserPoolClient = class extends UserPoolClient {
|
|
709
662
|
constructor(scope, props) {
|
|
710
663
|
super(scope, "user-pool-client", {
|
|
711
664
|
/**
|
|
@@ -850,7 +803,7 @@ var PreTokenGenerationLambda = class extends Construct3 {
|
|
|
850
803
|
// src/components/dynamodb/data-store-historical-archive.ts
|
|
851
804
|
import fs4 from "fs";
|
|
852
805
|
import path4 from "path";
|
|
853
|
-
import { Duration
|
|
806
|
+
import { Duration, RemovalPolicy as RemovalPolicy2, Size } from "aws-cdk-lib";
|
|
854
807
|
import * as kinesisfirehose from "aws-cdk-lib/aws-kinesisfirehose";
|
|
855
808
|
import { Runtime as Runtime4 } from "aws-cdk-lib/aws-lambda";
|
|
856
809
|
import { NodejsFunction as NodejsFunction4 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
@@ -888,7 +841,7 @@ var DataStoreHistoricalArchive = class extends Construct4 {
|
|
|
888
841
|
entry: resolveHandlerEntry4(__dirname),
|
|
889
842
|
runtime: Runtime4.NODEJS_LATEST,
|
|
890
843
|
memorySize: 512,
|
|
891
|
-
timeout:
|
|
844
|
+
timeout: Duration.minutes(1),
|
|
892
845
|
description: "Firehose transform: filter CURRENT resource rows, S3 keys, EventBridge PutEvents",
|
|
893
846
|
environment: props.dataEventBus && putEventsFailureDlqBucket ? {
|
|
894
847
|
DATA_EVENT_BUS_NAME: props.dataEventBus.eventBusName,
|
|
@@ -904,14 +857,14 @@ var DataStoreHistoricalArchive = class extends Construct4 {
|
|
|
904
857
|
const processor = new kinesisfirehose.LambdaFunctionProcessor(
|
|
905
858
|
this.transformFunction,
|
|
906
859
|
{
|
|
907
|
-
bufferInterval:
|
|
860
|
+
bufferInterval: Duration.seconds(60),
|
|
908
861
|
bufferSize: Size.mebibytes(3),
|
|
909
862
|
retries: 3
|
|
910
863
|
}
|
|
911
864
|
);
|
|
912
865
|
const destination = new kinesisfirehose.S3Bucket(this.archiveBucket, {
|
|
913
866
|
compression: kinesisfirehose.Compression.GZIP,
|
|
914
|
-
bufferingInterval:
|
|
867
|
+
bufferingInterval: Duration.seconds(300),
|
|
915
868
|
// Firehose requires SizeInMBs ≥ 64 when dynamic partitioning is enabled.
|
|
916
869
|
bufferingSize: Size.mebibytes(64),
|
|
917
870
|
processors: [processor],
|
|
@@ -1291,7 +1244,7 @@ var ControlEventBus = class _ControlEventBus extends EventBus3 {
|
|
|
1291
1244
|
// src/components/postgres/data-store-postgres-replica.ts
|
|
1292
1245
|
import fs5 from "fs";
|
|
1293
1246
|
import path5 from "path";
|
|
1294
|
-
import { Duration as
|
|
1247
|
+
import { Duration as Duration2, Stack as Stack2 } from "aws-cdk-lib";
|
|
1295
1248
|
import * as ec2 from "aws-cdk-lib/aws-ec2";
|
|
1296
1249
|
import { Runtime as Runtime5, StartingPosition } from "aws-cdk-lib/aws-lambda";
|
|
1297
1250
|
import { KinesisEventSource } from "aws-cdk-lib/aws-lambda-event-sources";
|
|
@@ -1393,7 +1346,7 @@ var DataStorePostgresReplica = class extends Construct6 {
|
|
|
1393
1346
|
entry: resolveHandlerEntry5(__dirname),
|
|
1394
1347
|
runtime: Runtime5.NODEJS_LATEST,
|
|
1395
1348
|
memorySize: 512,
|
|
1396
|
-
timeout:
|
|
1349
|
+
timeout: Duration2.minutes(1),
|
|
1397
1350
|
vpc: this.vpc,
|
|
1398
1351
|
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
|
|
1399
1352
|
description: "Replicates DynamoDB current-resource changes into the Postgres `resources` JSONB table (ADR 2026-04-17-01).",
|
|
@@ -1420,7 +1373,7 @@ var DataStorePostgresReplica = class extends Construct6 {
|
|
|
1420
1373
|
new KinesisEventSource(props.kinesisStream, {
|
|
1421
1374
|
startingPosition: StartingPosition.LATEST,
|
|
1422
1375
|
batchSize: 100,
|
|
1423
|
-
maxBatchingWindow:
|
|
1376
|
+
maxBatchingWindow: Duration2.seconds(5),
|
|
1424
1377
|
retryAttempts: 10,
|
|
1425
1378
|
bisectBatchOnError: true,
|
|
1426
1379
|
parallelizationFactor: 2,
|
|
@@ -1453,7 +1406,7 @@ var DataStorePostgresReplica = class extends Construct6 {
|
|
|
1453
1406
|
};
|
|
1454
1407
|
|
|
1455
1408
|
// src/components/route-53/child-hosted-zone.ts
|
|
1456
|
-
import { Duration as
|
|
1409
|
+
import { Duration as Duration3 } from "aws-cdk-lib";
|
|
1457
1410
|
import {
|
|
1458
1411
|
HostedZone,
|
|
1459
1412
|
NsRecord
|
|
@@ -1465,7 +1418,7 @@ var ChildHostedZone = class extends HostedZone {
|
|
|
1465
1418
|
zone: props.parentHostedZone,
|
|
1466
1419
|
recordName: this.zoneName,
|
|
1467
1420
|
values: this.hostedZoneNameServers || [],
|
|
1468
|
-
ttl:
|
|
1421
|
+
ttl: Duration3.minutes(5)
|
|
1469
1422
|
});
|
|
1470
1423
|
}
|
|
1471
1424
|
};
|
|
@@ -1479,14 +1432,39 @@ import { Construct as Construct7 } from "constructs";
|
|
|
1479
1432
|
var RootHostedZone = class extends Construct7 {
|
|
1480
1433
|
};
|
|
1481
1434
|
|
|
1435
|
+
// src/components/static-hosting/static-content.ts
|
|
1436
|
+
import { Bucket as Bucket3 } from "aws-cdk-lib/aws-s3";
|
|
1437
|
+
import { BucketDeployment, Source } from "aws-cdk-lib/aws-s3-deployment";
|
|
1438
|
+
import { paramCase as paramCase2 } from "change-case";
|
|
1439
|
+
import { Construct as Construct9 } from "constructs";
|
|
1440
|
+
|
|
1482
1441
|
// src/components/static-hosting/static-hosting.ts
|
|
1442
|
+
import * as fs6 from "fs";
|
|
1443
|
+
import * as path6 from "path";
|
|
1444
|
+
import { Duration as Duration4 } from "aws-cdk-lib";
|
|
1483
1445
|
import {
|
|
1446
|
+
AccessLevel,
|
|
1447
|
+
AllowedMethods,
|
|
1448
|
+
CacheCookieBehavior,
|
|
1449
|
+
CacheHeaderBehavior,
|
|
1484
1450
|
CachePolicy,
|
|
1485
|
-
|
|
1451
|
+
CacheQueryStringBehavior,
|
|
1452
|
+
Distribution,
|
|
1453
|
+
LambdaEdgeEventType,
|
|
1454
|
+
S3OriginAccessControl,
|
|
1455
|
+
Signing,
|
|
1456
|
+
ViewerProtocolPolicy
|
|
1486
1457
|
} from "aws-cdk-lib/aws-cloudfront";
|
|
1487
1458
|
import { S3BucketOrigin } from "aws-cdk-lib/aws-cloudfront-origins";
|
|
1459
|
+
import { Runtime as Runtime6 } from "aws-cdk-lib/aws-lambda";
|
|
1460
|
+
import { NodejsFunction as NodejsFunction6 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
1461
|
+
import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
1462
|
+
import {
|
|
1463
|
+
ARecord,
|
|
1464
|
+
RecordTarget
|
|
1465
|
+
} from "aws-cdk-lib/aws-route53";
|
|
1466
|
+
import { CloudFrontTarget } from "aws-cdk-lib/aws-route53-targets";
|
|
1488
1467
|
import { Bucket as Bucket2 } from "aws-cdk-lib/aws-s3";
|
|
1489
|
-
import { Duration as Duration5 } from "aws-cdk-lib/core";
|
|
1490
1468
|
import { Construct as Construct8 } from "constructs";
|
|
1491
1469
|
var STATIC_HOSTING_SERVICE_TYPE = "website";
|
|
1492
1470
|
var _StaticHosting = class _StaticHosting extends Construct8 {
|
|
@@ -1494,6 +1472,7 @@ var _StaticHosting = class _StaticHosting extends Construct8 {
|
|
|
1494
1472
|
super(scope, id);
|
|
1495
1473
|
const stack = OpenHiService.of(scope);
|
|
1496
1474
|
const serviceType = props.serviceType ?? STATIC_HOSTING_SERVICE_TYPE;
|
|
1475
|
+
const hostingMode = props.hostingMode ?? "spa";
|
|
1497
1476
|
this.bucket = new Bucket2(this, "bucket", {
|
|
1498
1477
|
blockPublicAccess: {
|
|
1499
1478
|
blockPublicAcls: true,
|
|
@@ -1503,30 +1482,105 @@ var _StaticHosting = class _StaticHosting extends Construct8 {
|
|
|
1503
1482
|
},
|
|
1504
1483
|
...props.bucketProps
|
|
1505
1484
|
});
|
|
1506
|
-
const
|
|
1485
|
+
const handlerJs = path6.join(
|
|
1486
|
+
__dirname,
|
|
1487
|
+
"static-hosting.viewer-request-handler.js"
|
|
1488
|
+
);
|
|
1489
|
+
const handlerTs = path6.join(
|
|
1490
|
+
__dirname,
|
|
1491
|
+
"static-hosting.viewer-request-handler.ts"
|
|
1492
|
+
);
|
|
1493
|
+
const handlerEntry = fs6.existsSync(handlerJs) ? handlerJs : handlerTs;
|
|
1494
|
+
this.viewerRequestHandler = new NodejsFunction6(
|
|
1495
|
+
this,
|
|
1496
|
+
"viewer-request-handler",
|
|
1497
|
+
{
|
|
1498
|
+
entry: handlerEntry,
|
|
1499
|
+
handler: hostingMode === "static" ? "staticHandler" : "spaHandler",
|
|
1500
|
+
memorySize: 128,
|
|
1501
|
+
runtime: Runtime6.NODEJS_LATEST,
|
|
1502
|
+
logGroup: new LogGroup(this, "viewer-request-handler-log-group", {
|
|
1503
|
+
retention: RetentionDays.ONE_MONTH
|
|
1504
|
+
})
|
|
1505
|
+
}
|
|
1506
|
+
);
|
|
1507
1507
|
const cachePolicy = new CachePolicy(this, "cache-policy", {
|
|
1508
|
-
cachePolicyName: `static-hosting
|
|
1509
|
-
comment: "
|
|
1510
|
-
defaultTtl:
|
|
1511
|
-
minTtl:
|
|
1512
|
-
maxTtl:
|
|
1513
|
-
|
|
1508
|
+
cachePolicyName: `static-hosting-${stack.branchHash}`,
|
|
1509
|
+
comment: "Static hosting default: 60s default / 300s max, gzip+brotli.",
|
|
1510
|
+
defaultTtl: Duration4.seconds(60),
|
|
1511
|
+
minTtl: Duration4.seconds(0),
|
|
1512
|
+
maxTtl: Duration4.seconds(300),
|
|
1513
|
+
headerBehavior: CacheHeaderBehavior.none(),
|
|
1514
|
+
queryStringBehavior: CacheQueryStringBehavior.none(),
|
|
1515
|
+
cookieBehavior: CacheCookieBehavior.none(),
|
|
1516
|
+
enableAcceptEncodingGzip: true,
|
|
1517
|
+
enableAcceptEncodingBrotli: true,
|
|
1518
|
+
...props.cachePolicyProps
|
|
1519
|
+
});
|
|
1520
|
+
const oac = new S3OriginAccessControl(this, "origin-access-control", {
|
|
1521
|
+
signing: Signing.SIGV4_NO_OVERRIDE
|
|
1522
|
+
});
|
|
1523
|
+
const origin = S3BucketOrigin.withOriginAccessControl(this.bucket, {
|
|
1524
|
+
originAccessControl: oac,
|
|
1525
|
+
originAccessLevels: [AccessLevel.READ]
|
|
1526
|
+
});
|
|
1527
|
+
const hasCustomDomain = props.certificate !== void 0 && props.hostedZone !== void 0 && props.domainNames !== void 0 && props.domainNames.length > 0;
|
|
1514
1528
|
this.distribution = new Distribution(this, "distribution", {
|
|
1529
|
+
comment: `Static hosting distribution for ${props.description ?? id}`,
|
|
1530
|
+
...hasCustomDomain ? {
|
|
1531
|
+
certificate: props.certificate,
|
|
1532
|
+
domainNames: [...props.domainNames]
|
|
1533
|
+
} : {},
|
|
1534
|
+
defaultRootObject: "index.html",
|
|
1515
1535
|
defaultBehavior: {
|
|
1516
1536
|
origin,
|
|
1517
|
-
|
|
1537
|
+
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
1538
|
+
cachePolicy,
|
|
1539
|
+
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
1540
|
+
edgeLambdas: [
|
|
1541
|
+
{
|
|
1542
|
+
functionVersion: this.viewerRequestHandler.currentVersion,
|
|
1543
|
+
eventType: LambdaEdgeEventType.VIEWER_REQUEST,
|
|
1544
|
+
includeBody: false
|
|
1545
|
+
}
|
|
1546
|
+
]
|
|
1518
1547
|
},
|
|
1519
1548
|
...props.distributionProps
|
|
1520
1549
|
});
|
|
1550
|
+
if (hasCustomDomain) {
|
|
1551
|
+
props.domainNames.forEach((domainName, index) => {
|
|
1552
|
+
new ARecord(this, `dns-record-${index}`, {
|
|
1553
|
+
zone: props.hostedZone,
|
|
1554
|
+
recordName: domainName,
|
|
1555
|
+
target: RecordTarget.fromAlias(
|
|
1556
|
+
new CloudFrontTarget(this.distribution)
|
|
1557
|
+
)
|
|
1558
|
+
});
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1521
1561
|
new DiscoverableStringParameter(this, "bucket-arn-param", {
|
|
1522
1562
|
ssmParamName: _StaticHosting.SSM_PARAM_NAME_BUCKET_ARN,
|
|
1523
1563
|
serviceType,
|
|
1524
|
-
stringValue: this.bucket.bucketArn
|
|
1564
|
+
stringValue: this.bucket.bucketArn,
|
|
1565
|
+
description: `Static hosting bucket ARN (${props.description ?? id})`
|
|
1525
1566
|
});
|
|
1526
1567
|
new DiscoverableStringParameter(this, "distribution-arn-param", {
|
|
1527
1568
|
ssmParamName: _StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ARN,
|
|
1528
1569
|
serviceType,
|
|
1529
|
-
stringValue: this.distribution.distributionArn
|
|
1570
|
+
stringValue: this.distribution.distributionArn,
|
|
1571
|
+
description: `Static hosting distribution ARN (${props.description ?? id})`
|
|
1572
|
+
});
|
|
1573
|
+
new DiscoverableStringParameter(this, "distribution-domain-param", {
|
|
1574
|
+
ssmParamName: _StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_DOMAIN,
|
|
1575
|
+
serviceType,
|
|
1576
|
+
stringValue: this.distribution.domainName,
|
|
1577
|
+
description: `Static hosting distribution domain (${props.description ?? id})`
|
|
1578
|
+
});
|
|
1579
|
+
new DiscoverableStringParameter(this, "distribution-id-param", {
|
|
1580
|
+
ssmParamName: _StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ID,
|
|
1581
|
+
serviceType,
|
|
1582
|
+
stringValue: this.distribution.distributionId,
|
|
1583
|
+
description: `Static hosting distribution ID (${props.description ?? id})`
|
|
1530
1584
|
});
|
|
1531
1585
|
}
|
|
1532
1586
|
};
|
|
@@ -1538,14 +1592,51 @@ _StaticHosting.SSM_PARAM_NAME_BUCKET_ARN = "STATIC_HOSTING_BUCKET_ARN";
|
|
|
1538
1592
|
* SSM parameter name for the CloudFront distribution ARN.
|
|
1539
1593
|
*/
|
|
1540
1594
|
_StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ARN = "STATIC_HOSTING_DISTRIBUTION_ARN";
|
|
1595
|
+
/**
|
|
1596
|
+
* SSM parameter name for the CloudFront distribution domain
|
|
1597
|
+
* (e.g. dXXXXX.cloudfront.net).
|
|
1598
|
+
*/
|
|
1599
|
+
_StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_DOMAIN = "STATIC_HOSTING_DISTRIBUTION_DOMAIN";
|
|
1600
|
+
/**
|
|
1601
|
+
* SSM parameter name for the CloudFront distribution ID.
|
|
1602
|
+
*/
|
|
1603
|
+
_StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ID = "STATIC_HOSTING_DISTRIBUTION_ID";
|
|
1541
1604
|
var StaticHosting = _StaticHosting;
|
|
1542
1605
|
|
|
1606
|
+
// src/components/static-hosting/static-content.ts
|
|
1607
|
+
var StaticContent = class extends Construct9 {
|
|
1608
|
+
constructor(scope, id, props) {
|
|
1609
|
+
super(scope, id);
|
|
1610
|
+
const stack = OpenHiService.of(scope);
|
|
1611
|
+
const {
|
|
1612
|
+
contentSourceDirectory,
|
|
1613
|
+
contentDestinationDirectory = "/",
|
|
1614
|
+
subDomain = stack.branchName,
|
|
1615
|
+
fullDomain,
|
|
1616
|
+
serviceType = STATIC_HOSTING_SERVICE_TYPE
|
|
1617
|
+
} = props;
|
|
1618
|
+
const keyPrefix = [paramCase2(subDomain), fullDomain].join(".");
|
|
1619
|
+
const bucketArn = DiscoverableStringParameter.valueForLookupName(this, {
|
|
1620
|
+
ssmParamName: StaticHosting.SSM_PARAM_NAME_BUCKET_ARN,
|
|
1621
|
+
serviceType
|
|
1622
|
+
});
|
|
1623
|
+
const bucket = Bucket3.fromBucketArn(this, "bucket", bucketArn);
|
|
1624
|
+
const isTestEnv = process.env.JEST_WORKER_ID !== void 0;
|
|
1625
|
+
const sources = isTestEnv ? [] : [Source.asset(contentSourceDirectory)];
|
|
1626
|
+
new BucketDeployment(this, "deploy", {
|
|
1627
|
+
sources,
|
|
1628
|
+
destinationBucket: bucket,
|
|
1629
|
+
retainOnDelete: false,
|
|
1630
|
+
destinationKeyPrefix: `${keyPrefix}${contentDestinationDirectory}`
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
|
|
1543
1635
|
// src/services/open-hi-auth-service.ts
|
|
1544
|
-
var import_config5 = __toESM(require_lib2());
|
|
1545
1636
|
import {
|
|
1546
1637
|
LambdaVersion,
|
|
1547
1638
|
UserPool as UserPool2,
|
|
1548
|
-
UserPoolClient as
|
|
1639
|
+
UserPoolClient as UserPoolClient2,
|
|
1549
1640
|
UserPoolDomain as UserPoolDomain2,
|
|
1550
1641
|
UserPoolOperation
|
|
1551
1642
|
} from "aws-cdk-lib/aws-cognito";
|
|
@@ -1570,27 +1661,27 @@ import {
|
|
|
1570
1661
|
import { StringParameter as StringParameter3 } from "aws-cdk-lib/aws-ssm";
|
|
1571
1662
|
|
|
1572
1663
|
// src/workflows/control-plane/platform-deploy-bridge/platform-deploy-bridge.ts
|
|
1573
|
-
import { Construct as
|
|
1664
|
+
import { Construct as Construct11 } from "constructs";
|
|
1574
1665
|
|
|
1575
1666
|
// src/workflows/control-plane/platform-deploy-bridge/platform-deploy-bridge-lambda.ts
|
|
1576
|
-
import
|
|
1577
|
-
import
|
|
1578
|
-
import { Duration as
|
|
1667
|
+
import fs7 from "fs";
|
|
1668
|
+
import path7 from "path";
|
|
1669
|
+
import { Duration as Duration5, Stack as Stack3 } from "aws-cdk-lib";
|
|
1579
1670
|
import { Rule } from "aws-cdk-lib/aws-events";
|
|
1580
1671
|
import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
|
|
1581
1672
|
import { Effect as Effect2, PolicyStatement as PolicyStatement2 } from "aws-cdk-lib/aws-iam";
|
|
1582
|
-
import { Runtime as
|
|
1583
|
-
import { NodejsFunction as
|
|
1584
|
-
import { Construct as
|
|
1673
|
+
import { Runtime as Runtime7 } from "aws-cdk-lib/aws-lambda";
|
|
1674
|
+
import { NodejsFunction as NodejsFunction7 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
1675
|
+
import { Construct as Construct10 } from "constructs";
|
|
1585
1676
|
var HANDLER_NAME6 = "platform-deploy-bridge.handler.js";
|
|
1586
1677
|
function resolveHandlerEntry6(dirname) {
|
|
1587
|
-
const sameDir =
|
|
1588
|
-
if (
|
|
1678
|
+
const sameDir = path7.join(dirname, HANDLER_NAME6);
|
|
1679
|
+
if (fs7.existsSync(sameDir)) {
|
|
1589
1680
|
return sameDir;
|
|
1590
1681
|
}
|
|
1591
|
-
return
|
|
1682
|
+
return path7.join(dirname, "..", "..", "..", "..", "lib", HANDLER_NAME6);
|
|
1592
1683
|
}
|
|
1593
|
-
var PlatformDeployBridgeLambda = class extends
|
|
1684
|
+
var PlatformDeployBridgeLambda = class extends Construct10 {
|
|
1594
1685
|
constructor(scope, props) {
|
|
1595
1686
|
super(scope, "platform-deploy-bridge-lambda");
|
|
1596
1687
|
const service = OpenHiService.of(this);
|
|
@@ -1603,11 +1694,11 @@ var PlatformDeployBridgeLambda = class extends Construct9 {
|
|
|
1603
1694
|
const ownSuffix = `-${service.serviceId}-${Stack3.of(this).account}-${Stack3.of(this).region}`;
|
|
1604
1695
|
const sharedPrefix = ownStackName.endsWith(ownSuffix) ? ownStackName.slice(0, -ownSuffix.length) : service.branchHash;
|
|
1605
1696
|
const stackIdPrefix = `arn:aws:cloudformation:${Stack3.of(this).region}:${Stack3.of(this).account}:stack/${sharedPrefix}-`;
|
|
1606
|
-
this.lambda = new
|
|
1697
|
+
this.lambda = new NodejsFunction7(this, "handler", {
|
|
1607
1698
|
entry: resolveHandlerEntry6(__dirname),
|
|
1608
|
-
runtime:
|
|
1699
|
+
runtime: Runtime7.NODEJS_LATEST,
|
|
1609
1700
|
memorySize: 256,
|
|
1610
|
-
timeout:
|
|
1701
|
+
timeout: Duration5.seconds(30),
|
|
1611
1702
|
environment: {
|
|
1612
1703
|
[CONTROL_EVENT_BUS_NAME_ENV_VAR]: props.controlEventBus.eventBusName,
|
|
1613
1704
|
[OPENHI_REPO_TAG_KEY_ENV_VAR]: repoTagKey,
|
|
@@ -1638,7 +1729,7 @@ var PlatformDeployBridgeLambda = class extends Construct9 {
|
|
|
1638
1729
|
targets: [
|
|
1639
1730
|
new LambdaFunction(this.lambda, {
|
|
1640
1731
|
retryAttempts: 2,
|
|
1641
|
-
maxEventAge:
|
|
1732
|
+
maxEventAge: Duration5.hours(2)
|
|
1642
1733
|
})
|
|
1643
1734
|
]
|
|
1644
1735
|
});
|
|
@@ -1646,7 +1737,7 @@ var PlatformDeployBridgeLambda = class extends Construct9 {
|
|
|
1646
1737
|
};
|
|
1647
1738
|
|
|
1648
1739
|
// src/workflows/control-plane/platform-deploy-bridge/platform-deploy-bridge.ts
|
|
1649
|
-
var PlatformDeployBridge = class extends
|
|
1740
|
+
var PlatformDeployBridge = class extends Construct11 {
|
|
1650
1741
|
constructor(scope, props) {
|
|
1651
1742
|
super(scope, "platform-deploy-bridge");
|
|
1652
1743
|
this.bridgeLambda = new PlatformDeployBridgeLambda(this, {
|
|
@@ -1839,64 +1930,48 @@ _OpenHiGlobalService.SERVICE_TYPE = "global";
|
|
|
1839
1930
|
var OpenHiGlobalService = _OpenHiGlobalService;
|
|
1840
1931
|
|
|
1841
1932
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data-lambda.ts
|
|
1842
|
-
import
|
|
1843
|
-
import
|
|
1844
|
-
import {
|
|
1845
|
-
import { Duration as Duration7, Stack as Stack4 } from "aws-cdk-lib";
|
|
1933
|
+
import fs8 from "fs";
|
|
1934
|
+
import path8 from "path";
|
|
1935
|
+
import { Duration as Duration6, Stack as Stack4 } from "aws-cdk-lib";
|
|
1846
1936
|
import { Rule as Rule2 } from "aws-cdk-lib/aws-events";
|
|
1847
1937
|
import { LambdaFunction as LambdaFunction2 } from "aws-cdk-lib/aws-events-targets";
|
|
1848
1938
|
import { Effect as Effect3, PolicyStatement as PolicyStatement3 } from "aws-cdk-lib/aws-iam";
|
|
1849
|
-
import { Runtime as
|
|
1850
|
-
import { NodejsFunction as
|
|
1851
|
-
import { Construct as
|
|
1939
|
+
import { Runtime as Runtime8 } from "aws-cdk-lib/aws-lambda";
|
|
1940
|
+
import { NodejsFunction as NodejsFunction8 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
1941
|
+
import { Construct as Construct12 } from "constructs";
|
|
1852
1942
|
var HANDLER_NAME7 = "seed-demo-data.handler.js";
|
|
1853
1943
|
function resolveHandlerEntry7(dirname) {
|
|
1854
|
-
const sameDir =
|
|
1855
|
-
if (
|
|
1944
|
+
const sameDir = path8.join(dirname, HANDLER_NAME7);
|
|
1945
|
+
if (fs8.existsSync(sameDir)) {
|
|
1856
1946
|
return sameDir;
|
|
1857
1947
|
}
|
|
1858
|
-
return
|
|
1948
|
+
return path8.join(dirname, "..", "..", "..", "..", "lib", HANDLER_NAME7);
|
|
1859
1949
|
}
|
|
1860
|
-
var SeedDemoDataLambda = class extends
|
|
1950
|
+
var SeedDemoDataLambda = class extends Construct12 {
|
|
1861
1951
|
constructor(scope, props) {
|
|
1862
1952
|
super(scope, "seed-demo-data-lambda");
|
|
1863
|
-
this.lambda = new
|
|
1953
|
+
this.lambda = new NodejsFunction8(this, "handler", {
|
|
1864
1954
|
entry: resolveHandlerEntry7(__dirname),
|
|
1865
|
-
runtime:
|
|
1955
|
+
runtime: Runtime8.NODEJS_LATEST,
|
|
1866
1956
|
memorySize: 512,
|
|
1867
|
-
timeout:
|
|
1957
|
+
timeout: Duration6.minutes(2),
|
|
1868
1958
|
environment: {
|
|
1869
1959
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName,
|
|
1870
1960
|
[SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR]: props.userPool.userPoolId
|
|
1871
1961
|
}
|
|
1872
1962
|
});
|
|
1873
|
-
const roleReadKeys = Object.values(PLATFORM_ROLE_IDS).map(rolePartitionKey);
|
|
1874
1963
|
this.lambda.addToRolePolicy(
|
|
1875
1964
|
new PolicyStatement3({
|
|
1876
1965
|
effect: Effect3.ALLOW,
|
|
1877
1966
|
actions: ["dynamodb:GetItem"],
|
|
1878
|
-
resources: [props.dataStoreTable.tableArn]
|
|
1879
|
-
conditions: {
|
|
1880
|
-
"ForAllValues:StringEquals": {
|
|
1881
|
-
"dynamodb:LeadingKeys": roleReadKeys
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1967
|
+
resources: [props.dataStoreTable.tableArn]
|
|
1884
1968
|
})
|
|
1885
1969
|
);
|
|
1886
|
-
const writeKeys = [
|
|
1887
|
-
...demoBasePartitionKeys(),
|
|
1888
|
-
...demoDevUserPartitionKeys(DEV_USERS)
|
|
1889
|
-
];
|
|
1890
1970
|
this.lambda.addToRolePolicy(
|
|
1891
1971
|
new PolicyStatement3({
|
|
1892
1972
|
effect: Effect3.ALLOW,
|
|
1893
1973
|
actions: ["dynamodb:PutItem", "dynamodb:UpdateItem"],
|
|
1894
|
-
resources: [props.dataStoreTable.tableArn]
|
|
1895
|
-
conditions: {
|
|
1896
|
-
"ForAllValues:StringEquals": {
|
|
1897
|
-
"dynamodb:LeadingKeys": writeKeys
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1974
|
+
resources: [props.dataStoreTable.tableArn]
|
|
1900
1975
|
})
|
|
1901
1976
|
);
|
|
1902
1977
|
this.lambda.addToRolePolicy(
|
|
@@ -1925,7 +2000,7 @@ var SeedDemoDataLambda = class extends Construct11 {
|
|
|
1925
2000
|
targets: [
|
|
1926
2001
|
new LambdaFunction2(this.lambda, {
|
|
1927
2002
|
retryAttempts: 2,
|
|
1928
|
-
maxEventAge:
|
|
2003
|
+
maxEventAge: Duration6.hours(2)
|
|
1929
2004
|
})
|
|
1930
2005
|
]
|
|
1931
2006
|
});
|
|
@@ -1933,8 +2008,8 @@ var SeedDemoDataLambda = class extends Construct11 {
|
|
|
1933
2008
|
};
|
|
1934
2009
|
|
|
1935
2010
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data-workflow.ts
|
|
1936
|
-
import { Construct as
|
|
1937
|
-
var SeedDemoDataWorkflow = class extends
|
|
2011
|
+
import { Construct as Construct13 } from "constructs";
|
|
2012
|
+
var SeedDemoDataWorkflow = class extends Construct13 {
|
|
1938
2013
|
constructor(scope, props) {
|
|
1939
2014
|
super(scope, "seed-demo-data-workflow");
|
|
1940
2015
|
this.seedDemoData = new SeedDemoDataLambda(this, {
|
|
@@ -1951,38 +2026,38 @@ var SeedDemoDataWorkflow = class extends Construct12 {
|
|
|
1951
2026
|
};
|
|
1952
2027
|
|
|
1953
2028
|
// src/workflows/control-plane/seed-system-data/seed-system-data-lambda.ts
|
|
1954
|
-
import
|
|
1955
|
-
import
|
|
1956
|
-
import { PLATFORM_ROLE_IDS
|
|
1957
|
-
import { Duration as
|
|
2029
|
+
import fs9 from "fs";
|
|
2030
|
+
import path9 from "path";
|
|
2031
|
+
import { PLATFORM_ROLE_IDS } from "@openhi/types";
|
|
2032
|
+
import { Duration as Duration7, Stack as Stack5 } from "aws-cdk-lib";
|
|
1958
2033
|
import { Rule as Rule3 } from "aws-cdk-lib/aws-events";
|
|
1959
2034
|
import { LambdaFunction as LambdaFunction3 } from "aws-cdk-lib/aws-events-targets";
|
|
1960
2035
|
import { Effect as Effect4, PolicyStatement as PolicyStatement4 } from "aws-cdk-lib/aws-iam";
|
|
1961
|
-
import { Runtime as
|
|
1962
|
-
import { NodejsFunction as
|
|
1963
|
-
import { Construct as
|
|
2036
|
+
import { Runtime as Runtime9 } from "aws-cdk-lib/aws-lambda";
|
|
2037
|
+
import { NodejsFunction as NodejsFunction9 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
2038
|
+
import { Construct as Construct14 } from "constructs";
|
|
1964
2039
|
var HANDLER_NAME8 = "seed-system-data.handler.js";
|
|
1965
2040
|
function resolveHandlerEntry8(dirname) {
|
|
1966
|
-
const sameDir =
|
|
1967
|
-
if (
|
|
2041
|
+
const sameDir = path9.join(dirname, HANDLER_NAME8);
|
|
2042
|
+
if (fs9.existsSync(sameDir)) {
|
|
1968
2043
|
return sameDir;
|
|
1969
2044
|
}
|
|
1970
|
-
return
|
|
2045
|
+
return path9.join(dirname, "..", "..", "..", "..", "lib", HANDLER_NAME8);
|
|
1971
2046
|
}
|
|
1972
|
-
var SeedSystemDataLambda = class extends
|
|
2047
|
+
var SeedSystemDataLambda = class extends Construct14 {
|
|
1973
2048
|
constructor(scope, props) {
|
|
1974
2049
|
super(scope, "seed-system-data-lambda");
|
|
1975
|
-
this.lambda = new
|
|
2050
|
+
this.lambda = new NodejsFunction9(this, "handler", {
|
|
1976
2051
|
entry: resolveHandlerEntry8(__dirname),
|
|
1977
|
-
runtime:
|
|
2052
|
+
runtime: Runtime9.NODEJS_LATEST,
|
|
1978
2053
|
memorySize: 512,
|
|
1979
|
-
timeout:
|
|
2054
|
+
timeout: Duration7.minutes(1),
|
|
1980
2055
|
environment: {
|
|
1981
2056
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName,
|
|
1982
2057
|
[SEED_SYSTEM_DATA_CONTROL_BUS_ENV_VAR]: props.controlEventBus.eventBusName
|
|
1983
2058
|
}
|
|
1984
2059
|
});
|
|
1985
|
-
const roleArns = Object.values(
|
|
2060
|
+
const roleArns = Object.values(PLATFORM_ROLE_IDS).map(
|
|
1986
2061
|
(id) => `role#id#${id}`
|
|
1987
2062
|
);
|
|
1988
2063
|
this.lambda.addToRolePolicy(
|
|
@@ -2013,7 +2088,7 @@ var SeedSystemDataLambda = class extends Construct13 {
|
|
|
2013
2088
|
targets: [
|
|
2014
2089
|
new LambdaFunction3(this.lambda, {
|
|
2015
2090
|
retryAttempts: 2,
|
|
2016
|
-
maxEventAge:
|
|
2091
|
+
maxEventAge: Duration7.hours(2)
|
|
2017
2092
|
})
|
|
2018
2093
|
]
|
|
2019
2094
|
});
|
|
@@ -2021,8 +2096,8 @@ var SeedSystemDataLambda = class extends Construct13 {
|
|
|
2021
2096
|
};
|
|
2022
2097
|
|
|
2023
2098
|
// src/workflows/control-plane/seed-system-data/seed-system-data-workflow.ts
|
|
2024
|
-
import { Construct as
|
|
2025
|
-
var SeedSystemDataWorkflow = class extends
|
|
2099
|
+
import { Construct as Construct15 } from "constructs";
|
|
2100
|
+
var SeedSystemDataWorkflow = class extends Construct15 {
|
|
2026
2101
|
constructor(scope, props) {
|
|
2027
2102
|
super(scope, "seed-system-data-workflow");
|
|
2028
2103
|
this.seedSystemData = new SeedSystemDataLambda(this, {
|
|
@@ -2148,29 +2223,29 @@ _OpenHiDataService.SERVICE_TYPE = "data";
|
|
|
2148
2223
|
var OpenHiDataService = _OpenHiDataService;
|
|
2149
2224
|
|
|
2150
2225
|
// src/workflows/control-plane/user-onboarding/provision-default-workspace-lambda.ts
|
|
2151
|
-
import
|
|
2152
|
-
import
|
|
2153
|
-
import { Duration as
|
|
2226
|
+
import fs10 from "fs";
|
|
2227
|
+
import path10 from "path";
|
|
2228
|
+
import { Duration as Duration8 } from "aws-cdk-lib";
|
|
2154
2229
|
import { Rule as Rule4 } from "aws-cdk-lib/aws-events";
|
|
2155
2230
|
import { LambdaFunction as LambdaFunction4 } from "aws-cdk-lib/aws-events-targets";
|
|
2156
2231
|
import { Effect as Effect5, PolicyStatement as PolicyStatement5 } from "aws-cdk-lib/aws-iam";
|
|
2157
|
-
import { Runtime as
|
|
2158
|
-
import { NodejsFunction as
|
|
2159
|
-
import { Construct as
|
|
2232
|
+
import { Runtime as Runtime10 } from "aws-cdk-lib/aws-lambda";
|
|
2233
|
+
import { NodejsFunction as NodejsFunction10 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
2234
|
+
import { Construct as Construct16 } from "constructs";
|
|
2160
2235
|
var HANDLER_NAME9 = "provision-default-workspace.handler.js";
|
|
2161
2236
|
function resolveHandlerEntry9(dirname) {
|
|
2162
|
-
const sameDir =
|
|
2163
|
-
if (
|
|
2237
|
+
const sameDir = path10.join(dirname, HANDLER_NAME9);
|
|
2238
|
+
if (fs10.existsSync(sameDir)) {
|
|
2164
2239
|
return sameDir;
|
|
2165
2240
|
}
|
|
2166
|
-
return
|
|
2241
|
+
return path10.join(dirname, "..", "..", "..", "..", "lib", HANDLER_NAME9);
|
|
2167
2242
|
}
|
|
2168
|
-
var ProvisionDefaultWorkspaceLambda = class extends
|
|
2243
|
+
var ProvisionDefaultWorkspaceLambda = class extends Construct16 {
|
|
2169
2244
|
constructor(scope, props) {
|
|
2170
2245
|
super(scope, "provision-default-workspace-lambda");
|
|
2171
|
-
this.lambda = new
|
|
2246
|
+
this.lambda = new NodejsFunction10(this, "handler", {
|
|
2172
2247
|
entry: resolveHandlerEntry9(__dirname),
|
|
2173
|
-
runtime:
|
|
2248
|
+
runtime: Runtime10.NODEJS_LATEST,
|
|
2174
2249
|
memorySize: 1024,
|
|
2175
2250
|
environment: {
|
|
2176
2251
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName
|
|
@@ -2197,7 +2272,7 @@ var ProvisionDefaultWorkspaceLambda = class extends Construct15 {
|
|
|
2197
2272
|
targets: [
|
|
2198
2273
|
new LambdaFunction4(this.lambda, {
|
|
2199
2274
|
retryAttempts: 2,
|
|
2200
|
-
maxEventAge:
|
|
2275
|
+
maxEventAge: Duration8.hours(2)
|
|
2201
2276
|
})
|
|
2202
2277
|
]
|
|
2203
2278
|
});
|
|
@@ -2205,8 +2280,8 @@ var ProvisionDefaultWorkspaceLambda = class extends Construct15 {
|
|
|
2205
2280
|
};
|
|
2206
2281
|
|
|
2207
2282
|
// src/workflows/control-plane/user-onboarding/user-onboarding-workflow.ts
|
|
2208
|
-
import { Construct as
|
|
2209
|
-
var UserOnboardingWorkflow = class extends
|
|
2283
|
+
import { Construct as Construct17 } from "constructs";
|
|
2284
|
+
var UserOnboardingWorkflow = class extends Construct17 {
|
|
2210
2285
|
constructor(scope, props) {
|
|
2211
2286
|
super(scope, "user-onboarding-workflow");
|
|
2212
2287
|
this.provisionDefaultWorkspace = new ProvisionDefaultWorkspaceLambda(this, {
|
|
@@ -2240,7 +2315,6 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
2240
2315
|
this.grantPostConfirmationPermissions();
|
|
2241
2316
|
this.userPoolClient = this.createUserPoolClient();
|
|
2242
2317
|
this.userPoolDomain = this.createUserPoolDomain();
|
|
2243
|
-
this.fixtureSeederClient = this.createFixtureSeederClient();
|
|
2244
2318
|
}
|
|
2245
2319
|
/**
|
|
2246
2320
|
* Returns an IUserPool by looking up the Auth stack's User Pool ID from SSM.
|
|
@@ -2263,33 +2337,12 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
2263
2337
|
serviceType: _OpenHiAuthService.SERVICE_TYPE
|
|
2264
2338
|
}
|
|
2265
2339
|
);
|
|
2266
|
-
return
|
|
2340
|
+
return UserPoolClient2.fromUserPoolClientId(
|
|
2267
2341
|
scope,
|
|
2268
2342
|
"user-pool-client",
|
|
2269
2343
|
userPoolClientId
|
|
2270
2344
|
);
|
|
2271
2345
|
}
|
|
2272
|
-
/**
|
|
2273
|
-
* Returns the dedicated fixture-seeder IUserPoolClient by looking up
|
|
2274
|
-
* its ID from SSM. Only non-prod auth stacks publish this parameter
|
|
2275
|
-
* (per the conditional in {@link createFixtureSeederClient}); calling
|
|
2276
|
-
* this against a prod-deployed stack will fail at lookup time.
|
|
2277
|
-
*
|
|
2278
|
-
* Consumed by `OpenHiRestApiService` (in non-prod) so the authorizer
|
|
2279
|
-
* accepts tokens issued by this client, and by the seed-fixtures CLI
|
|
2280
|
-
* to drive USER_PASSWORD_AUTH against this client's ID.
|
|
2281
|
-
*/
|
|
2282
|
-
static fixtureSeederClientFromConstruct(scope) {
|
|
2283
|
-
const clientId = DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2284
|
-
ssmParamName: CognitoFixtureSeederClient.SSM_PARAM_NAME,
|
|
2285
|
-
serviceType: _OpenHiAuthService.SERVICE_TYPE
|
|
2286
|
-
});
|
|
2287
|
-
return UserPoolClient3.fromUserPoolClientId(
|
|
2288
|
-
scope,
|
|
2289
|
-
"fixture-seeder-client",
|
|
2290
|
-
clientId
|
|
2291
|
-
);
|
|
2292
|
-
}
|
|
2293
2346
|
/**
|
|
2294
2347
|
* Returns an IUserPoolDomain by looking up the Auth stack's User Pool Domain from SSM.
|
|
2295
2348
|
*/
|
|
@@ -2478,31 +2531,6 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
2478
2531
|
});
|
|
2479
2532
|
return client;
|
|
2480
2533
|
}
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates the dedicated USER_PASSWORD_AUTH app client for the
|
|
2483
|
-
* `@openhi/seed-fixtures` CLI, **only** in non-prod environments.
|
|
2484
|
-
* Returns `undefined` when this stack is being deployed to a prod
|
|
2485
|
-
* stage so the prod auth stack carries no fixture-seeder code path.
|
|
2486
|
-
*
|
|
2487
|
-
* Operator post-deploy: create a `fixture-seeder` Cognito user with
|
|
2488
|
-
* a service password (manually via console or scripted with
|
|
2489
|
-
* `aws cognito-idp admin-create-user`); the CLI consumes those creds
|
|
2490
|
-
* via env vars to drive `InitiateAuth`.
|
|
2491
|
-
*/
|
|
2492
|
-
createFixtureSeederClient() {
|
|
2493
|
-
if (this.ohEnv.ohStage.stageType === import_config5.OPEN_HI_STAGE.PROD) {
|
|
2494
|
-
return void 0;
|
|
2495
|
-
}
|
|
2496
|
-
const client = new CognitoFixtureSeederClient(this, {
|
|
2497
|
-
userPool: this.userPool
|
|
2498
|
-
});
|
|
2499
|
-
new DiscoverableStringParameter(this, "fixture-seeder-client-param", {
|
|
2500
|
-
ssmParamName: CognitoFixtureSeederClient.SSM_PARAM_NAME,
|
|
2501
|
-
stringValue: client.userPoolClientId,
|
|
2502
|
-
description: "Cognito User Pool Client ID for the OpenHI fixture-seeder CLI (USER_PASSWORD_AUTH; non-prod only); cross-stack reference"
|
|
2503
|
-
});
|
|
2504
|
-
return client;
|
|
2505
|
-
}
|
|
2506
2534
|
/**
|
|
2507
2535
|
* Creates the User Pool Domain (Cognito hosted UI) and exports domain name to SSM.
|
|
2508
2536
|
* Look up via {@link OpenHiAuthService.userPoolDomainFromConstruct}.
|
|
@@ -2527,7 +2555,6 @@ _OpenHiAuthService.SERVICE_TYPE = "auth";
|
|
|
2527
2555
|
var OpenHiAuthService = _OpenHiAuthService;
|
|
2528
2556
|
|
|
2529
2557
|
// src/services/open-hi-rest-api-service.ts
|
|
2530
|
-
var import_config6 = __toESM(require_lib2());
|
|
2531
2558
|
import {
|
|
2532
2559
|
CorsHttpMethod,
|
|
2533
2560
|
DomainName,
|
|
@@ -2541,60 +2568,60 @@ import { HttpUserPoolAuthorizer } from "aws-cdk-lib/aws-apigatewayv2-authorizers
|
|
|
2541
2568
|
import { HttpLambdaIntegration } from "aws-cdk-lib/aws-apigatewayv2-integrations";
|
|
2542
2569
|
import { Effect as Effect7, PolicyStatement as PolicyStatement7 } from "aws-cdk-lib/aws-iam";
|
|
2543
2570
|
import {
|
|
2544
|
-
ARecord,
|
|
2571
|
+
ARecord as ARecord2,
|
|
2545
2572
|
HostedZone as HostedZone3,
|
|
2546
|
-
RecordTarget
|
|
2573
|
+
RecordTarget as RecordTarget2
|
|
2547
2574
|
} from "aws-cdk-lib/aws-route53";
|
|
2548
2575
|
import { ApiGatewayv2DomainProperties } from "aws-cdk-lib/aws-route53-targets";
|
|
2549
|
-
import { Duration as
|
|
2576
|
+
import { Duration as Duration9 } from "aws-cdk-lib/core";
|
|
2550
2577
|
|
|
2551
2578
|
// src/data/lambda/cors-options-lambda.ts
|
|
2552
|
-
import
|
|
2553
|
-
import
|
|
2554
|
-
import { Runtime as
|
|
2555
|
-
import { NodejsFunction as
|
|
2556
|
-
import { Construct as
|
|
2579
|
+
import fs11 from "fs";
|
|
2580
|
+
import path11 from "path";
|
|
2581
|
+
import { Runtime as Runtime11 } from "aws-cdk-lib/aws-lambda";
|
|
2582
|
+
import { NodejsFunction as NodejsFunction11 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
2583
|
+
import { Construct as Construct18 } from "constructs";
|
|
2557
2584
|
var HANDLER_NAME10 = "cors-options-lambda.handler.js";
|
|
2558
2585
|
function resolveHandlerEntry10(dirname) {
|
|
2559
|
-
const sameDir =
|
|
2560
|
-
if (
|
|
2586
|
+
const sameDir = path11.join(dirname, HANDLER_NAME10);
|
|
2587
|
+
if (fs11.existsSync(sameDir)) {
|
|
2561
2588
|
return sameDir;
|
|
2562
2589
|
}
|
|
2563
|
-
const fromLib =
|
|
2590
|
+
const fromLib = path11.join(dirname, "..", "..", "..", "lib", HANDLER_NAME10);
|
|
2564
2591
|
return fromLib;
|
|
2565
2592
|
}
|
|
2566
|
-
var CorsOptionsLambda = class extends
|
|
2593
|
+
var CorsOptionsLambda = class extends Construct18 {
|
|
2567
2594
|
constructor(scope, id = "cors-options-lambda") {
|
|
2568
2595
|
super(scope, id);
|
|
2569
|
-
this.lambda = new
|
|
2596
|
+
this.lambda = new NodejsFunction11(this, "handler", {
|
|
2570
2597
|
entry: resolveHandlerEntry10(__dirname),
|
|
2571
|
-
runtime:
|
|
2598
|
+
runtime: Runtime11.NODEJS_LATEST,
|
|
2572
2599
|
memorySize: 128
|
|
2573
2600
|
});
|
|
2574
2601
|
}
|
|
2575
2602
|
};
|
|
2576
2603
|
|
|
2577
2604
|
// src/data/lambda/rest-api-lambda.ts
|
|
2578
|
-
import
|
|
2579
|
-
import
|
|
2580
|
-
import { Runtime as
|
|
2581
|
-
import { NodejsFunction as
|
|
2582
|
-
import { Construct as
|
|
2605
|
+
import fs12 from "fs";
|
|
2606
|
+
import path12 from "path";
|
|
2607
|
+
import { Runtime as Runtime12 } from "aws-cdk-lib/aws-lambda";
|
|
2608
|
+
import { NodejsFunction as NodejsFunction12 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
2609
|
+
import { Construct as Construct19 } from "constructs";
|
|
2583
2610
|
var HANDLER_NAME11 = "rest-api-lambda.handler.js";
|
|
2584
2611
|
function resolveHandlerEntry11(dirname) {
|
|
2585
|
-
const sameDir =
|
|
2586
|
-
if (
|
|
2612
|
+
const sameDir = path12.join(dirname, HANDLER_NAME11);
|
|
2613
|
+
if (fs12.existsSync(sameDir)) {
|
|
2587
2614
|
return sameDir;
|
|
2588
2615
|
}
|
|
2589
|
-
const fromLib =
|
|
2616
|
+
const fromLib = path12.join(dirname, "..", "..", "..", "lib", HANDLER_NAME11);
|
|
2590
2617
|
return fromLib;
|
|
2591
2618
|
}
|
|
2592
|
-
var RestApiLambda = class extends
|
|
2619
|
+
var RestApiLambda = class extends Construct19 {
|
|
2593
2620
|
constructor(scope, props) {
|
|
2594
2621
|
super(scope, "rest-api-lambda");
|
|
2595
|
-
this.lambda = new
|
|
2622
|
+
this.lambda = new NodejsFunction12(this, "handler", {
|
|
2596
2623
|
entry: resolveHandlerEntry11(__dirname),
|
|
2597
|
-
runtime:
|
|
2624
|
+
runtime: Runtime12.NODEJS_LATEST,
|
|
2598
2625
|
memorySize: 1024,
|
|
2599
2626
|
environment: {
|
|
2600
2627
|
DYNAMO_TABLE_NAME: props.dynamoTableName,
|
|
@@ -2812,10 +2839,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
2812
2839
|
integration
|
|
2813
2840
|
});
|
|
2814
2841
|
const apiPrefix = this.branchName === "main" ? `api` : `api-${this.childZonePrefix}`;
|
|
2815
|
-
new
|
|
2842
|
+
new ARecord2(this, "api-a-record", {
|
|
2816
2843
|
zone: hostedZone,
|
|
2817
2844
|
recordName: apiPrefix,
|
|
2818
|
-
target:
|
|
2845
|
+
target: RecordTarget2.fromAlias(
|
|
2819
2846
|
new ApiGatewayv2DomainProperties(
|
|
2820
2847
|
domainName.regionalDomainName,
|
|
2821
2848
|
domainName.regionalHostedZoneId
|
|
@@ -2831,16 +2858,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
2831
2858
|
createRootHttpApi(domainName) {
|
|
2832
2859
|
const userPool = OpenHiAuthService.userPoolFromConstruct(this);
|
|
2833
2860
|
const userPoolClient = OpenHiAuthService.userPoolClientFromConstruct(this);
|
|
2834
|
-
const userPoolClients = [userPoolClient];
|
|
2835
|
-
if (this.ohEnv.ohStage.stageType !== import_config6.OPEN_HI_STAGE.PROD) {
|
|
2836
|
-
userPoolClients.push(
|
|
2837
|
-
OpenHiAuthService.fixtureSeederClientFromConstruct(this)
|
|
2838
|
-
);
|
|
2839
|
-
}
|
|
2840
2861
|
const cognitoAuthorizer = new HttpUserPoolAuthorizer(
|
|
2841
2862
|
"cognito-authorizer",
|
|
2842
2863
|
userPool,
|
|
2843
|
-
{ userPoolClients }
|
|
2864
|
+
{ userPoolClients: [userPoolClient] }
|
|
2844
2865
|
);
|
|
2845
2866
|
const { corsPreflight: cors, ...restRootHttpApiProps } = this.props.rootHttpApiProps ?? {};
|
|
2846
2867
|
const corsPreflight = cors !== void 0 ? {
|
|
@@ -2859,7 +2880,7 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
2859
2880
|
"Authorization"
|
|
2860
2881
|
],
|
|
2861
2882
|
allowCredentials: cors.allowCredentials ?? true,
|
|
2862
|
-
maxAge: cors.maxAge ??
|
|
2883
|
+
maxAge: cors.maxAge ?? Duration9.days(1),
|
|
2863
2884
|
...cors.exposeHeaders !== void 0 && {
|
|
2864
2885
|
exposeHeaders: cors.exposeHeaders
|
|
2865
2886
|
}
|
|
@@ -2924,34 +2945,186 @@ var _OpenHiGraphqlService = class _OpenHiGraphqlService extends OpenHiService {
|
|
|
2924
2945
|
_OpenHiGraphqlService.SERVICE_TYPE = "graphql-api";
|
|
2925
2946
|
var OpenHiGraphqlService = _OpenHiGraphqlService;
|
|
2926
2947
|
|
|
2948
|
+
// src/services/open-hi-website-service.ts
|
|
2949
|
+
var SSM_PARAM_NAME_FULL_DOMAIN = "WEBSITE_FULL_DOMAIN";
|
|
2950
|
+
var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
2951
|
+
/**
|
|
2952
|
+
* Looks up the static-hosting bucket ARN published by the release-branch
|
|
2953
|
+
* deploy of this service.
|
|
2954
|
+
*/
|
|
2955
|
+
static bucketArnFromConstruct(scope) {
|
|
2956
|
+
return DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2957
|
+
ssmParamName: StaticHosting.SSM_PARAM_NAME_BUCKET_ARN,
|
|
2958
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
2959
|
+
});
|
|
2960
|
+
}
|
|
2961
|
+
/**
|
|
2962
|
+
* Looks up the CloudFront distribution ARN published by the release-branch
|
|
2963
|
+
* deploy of this service.
|
|
2964
|
+
*/
|
|
2965
|
+
static distributionArnFromConstruct(scope) {
|
|
2966
|
+
return DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2967
|
+
ssmParamName: StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ARN,
|
|
2968
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Looks up the CloudFront distribution domain
|
|
2973
|
+
* (e.g. dXXXXX.cloudfront.net) published by the release-branch deploy.
|
|
2974
|
+
*/
|
|
2975
|
+
static distributionDomainFromConstruct(scope) {
|
|
2976
|
+
return DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2977
|
+
ssmParamName: StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_DOMAIN,
|
|
2978
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
2979
|
+
});
|
|
2980
|
+
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Looks up the CloudFront distribution ID published by the release-branch
|
|
2983
|
+
* deploy of this service.
|
|
2984
|
+
*/
|
|
2985
|
+
static distributionIdFromConstruct(scope) {
|
|
2986
|
+
return DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2987
|
+
ssmParamName: StaticHosting.SSM_PARAM_NAME_DISTRIBUTION_ID,
|
|
2988
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
/**
|
|
2992
|
+
* Looks up the website's full domain (e.g. www.example.com) published by
|
|
2993
|
+
* the release-branch deploy of this service.
|
|
2994
|
+
*/
|
|
2995
|
+
static fullDomainFromConstruct(scope) {
|
|
2996
|
+
return DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2997
|
+
ssmParamName: SSM_PARAM_NAME_FULL_DOMAIN,
|
|
2998
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
get serviceType() {
|
|
3002
|
+
return _OpenHiWebsiteService.SERVICE_TYPE;
|
|
3003
|
+
}
|
|
3004
|
+
constructor(ohEnv, props) {
|
|
3005
|
+
super(ohEnv, _OpenHiWebsiteService.SERVICE_TYPE, props);
|
|
3006
|
+
this.props = props;
|
|
3007
|
+
this.validateConfig(props);
|
|
3008
|
+
const hostedZone = this.createHostedZone();
|
|
3009
|
+
this.fullDomain = this.computeFullDomain(hostedZone);
|
|
3010
|
+
const shouldCreateHostingInfra = props.createHostingInfrastructure ?? this.branchName === this.defaultReleaseBranch;
|
|
3011
|
+
if (shouldCreateHostingInfra) {
|
|
3012
|
+
const certificate = this.createCertificate();
|
|
3013
|
+
this.staticHosting = this.createStaticHosting({
|
|
3014
|
+
certificate,
|
|
3015
|
+
hostedZone
|
|
3016
|
+
});
|
|
3017
|
+
this.createFullDomainParameter();
|
|
3018
|
+
}
|
|
3019
|
+
this.staticContent = this.createStaticContent();
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Validates that config required for the website stack is present.
|
|
3023
|
+
*/
|
|
3024
|
+
validateConfig(props) {
|
|
3025
|
+
const { config } = props;
|
|
3026
|
+
if (!config) {
|
|
3027
|
+
throw new Error("Config is required");
|
|
3028
|
+
}
|
|
3029
|
+
if (!config.zoneName) {
|
|
3030
|
+
throw new Error("Zone name is required");
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
/**
|
|
3034
|
+
* Looks up the child hosted zone published by the Global service.
|
|
3035
|
+
* Override to customize.
|
|
3036
|
+
*/
|
|
3037
|
+
createHostedZone() {
|
|
3038
|
+
return OpenHiGlobalService.childHostedZoneFromConstruct(this, {
|
|
3039
|
+
zoneName: this.config.zoneName
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
/**
|
|
3043
|
+
* Returns the wildcard certificate looked up from the Global service.
|
|
3044
|
+
* Override to customize.
|
|
3045
|
+
*/
|
|
3046
|
+
createCertificate() {
|
|
3047
|
+
return OpenHiGlobalService.rootWildcardCertificateFromConstruct(this);
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Computes the full website domain from `domainPrefix` and the child
|
|
3051
|
+
* zone name.
|
|
3052
|
+
*/
|
|
3053
|
+
computeFullDomain(hostedZone) {
|
|
3054
|
+
const prefix = this.props.domainPrefix ?? "www";
|
|
3055
|
+
return [prefix, hostedZone.zoneName].join(".");
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* Creates the StaticHosting infrastructure (bucket + distribution +
|
|
3059
|
+
* Lambda@Edge + 4 SSM params + DNS).
|
|
3060
|
+
*/
|
|
3061
|
+
createStaticHosting(deps) {
|
|
3062
|
+
return new StaticHosting(this, "static-hosting", {
|
|
3063
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE,
|
|
3064
|
+
certificate: deps.certificate,
|
|
3065
|
+
hostedZone: deps.hostedZone,
|
|
3066
|
+
domainNames: [this.fullDomain],
|
|
3067
|
+
description: `OpenHI website (${this.fullDomain})`
|
|
3068
|
+
});
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Creates the SSM parameter that publishes the website's full domain.
|
|
3072
|
+
* Look up via {@link OpenHiWebsiteService.fullDomainFromConstruct}.
|
|
3073
|
+
*/
|
|
3074
|
+
createFullDomainParameter() {
|
|
3075
|
+
new DiscoverableStringParameter(this, "full-domain-param", {
|
|
3076
|
+
ssmParamName: SSM_PARAM_NAME_FULL_DOMAIN,
|
|
3077
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE,
|
|
3078
|
+
stringValue: this.fullDomain,
|
|
3079
|
+
description: "Full website domain (e.g. www.example.com)"
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Creates the StaticContent uploader. Always created so feature-branch
|
|
3084
|
+
* deploys can publish content to their own sub-domain folder against the
|
|
3085
|
+
* release-branch bucket.
|
|
3086
|
+
*/
|
|
3087
|
+
createStaticContent() {
|
|
3088
|
+
const { contentSourceDirectory, contentDestinationDirectory } = this.props;
|
|
3089
|
+
return new StaticContent(this, "static-content", {
|
|
3090
|
+
contentSourceDirectory,
|
|
3091
|
+
contentDestinationDirectory,
|
|
3092
|
+
fullDomain: this.fullDomain,
|
|
3093
|
+
serviceType: _OpenHiWebsiteService.SERVICE_TYPE
|
|
3094
|
+
});
|
|
3095
|
+
}
|
|
3096
|
+
};
|
|
3097
|
+
_OpenHiWebsiteService.SERVICE_TYPE = "website";
|
|
3098
|
+
var OpenHiWebsiteService = _OpenHiWebsiteService;
|
|
3099
|
+
|
|
2927
3100
|
// src/workflows/control-plane/owning-delete-cascade/owning-delete-cascade-lambdas.ts
|
|
2928
|
-
import
|
|
2929
|
-
import
|
|
2930
|
-
import { Duration as
|
|
3101
|
+
import fs13 from "fs";
|
|
3102
|
+
import path13 from "path";
|
|
3103
|
+
import { Duration as Duration10 } from "aws-cdk-lib";
|
|
2931
3104
|
import { Effect as Effect8, PolicyStatement as PolicyStatement8 } from "aws-cdk-lib/aws-iam";
|
|
2932
|
-
import { Runtime as
|
|
2933
|
-
import { NodejsFunction as
|
|
2934
|
-
import { Construct as
|
|
3105
|
+
import { Runtime as Runtime13 } from "aws-cdk-lib/aws-lambda";
|
|
3106
|
+
import { NodejsFunction as NodejsFunction13 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
3107
|
+
import { Construct as Construct20 } from "constructs";
|
|
2935
3108
|
function resolveHandlerEntry12(dirname, handlerName) {
|
|
2936
|
-
const sameDir =
|
|
2937
|
-
if (
|
|
3109
|
+
const sameDir = path13.join(dirname, handlerName);
|
|
3110
|
+
if (fs13.existsSync(sameDir)) {
|
|
2938
3111
|
return { entry: sameDir, handler: "handler" };
|
|
2939
3112
|
}
|
|
2940
|
-
const libDir =
|
|
3113
|
+
const libDir = path13.join(dirname, "..", "..", "..", "..", "lib", handlerName);
|
|
2941
3114
|
return { entry: libDir, handler: "handler" };
|
|
2942
3115
|
}
|
|
2943
|
-
var OwningDeleteCascadeLambdas = class extends
|
|
3116
|
+
var OwningDeleteCascadeLambdas = class extends Construct20 {
|
|
2944
3117
|
constructor(scope, props) {
|
|
2945
3118
|
super(scope, "owning-delete-cascade-lambdas");
|
|
2946
3119
|
const listResolved = resolveHandlerEntry12(
|
|
2947
3120
|
__dirname,
|
|
2948
3121
|
"list-chunks.handler.js"
|
|
2949
3122
|
);
|
|
2950
|
-
this.listChunks = new
|
|
3123
|
+
this.listChunks = new NodejsFunction13(this, "list-chunks-handler", {
|
|
2951
3124
|
entry: listResolved.entry,
|
|
2952
|
-
runtime:
|
|
3125
|
+
runtime: Runtime13.NODEJS_LATEST,
|
|
2953
3126
|
memorySize: 512,
|
|
2954
|
-
timeout:
|
|
3127
|
+
timeout: Duration10.minutes(1),
|
|
2955
3128
|
environment: {
|
|
2956
3129
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName
|
|
2957
3130
|
}
|
|
@@ -2961,11 +3134,11 @@ var OwningDeleteCascadeLambdas = class extends Construct19 {
|
|
|
2961
3134
|
__dirname,
|
|
2962
3135
|
"delete-chunk.handler.js"
|
|
2963
3136
|
);
|
|
2964
|
-
this.deleteChunk = new
|
|
3137
|
+
this.deleteChunk = new NodejsFunction13(this, "delete-chunk-handler", {
|
|
2965
3138
|
entry: deleteResolved.entry,
|
|
2966
|
-
runtime:
|
|
3139
|
+
runtime: Runtime13.NODEJS_LATEST,
|
|
2967
3140
|
memorySize: 512,
|
|
2968
|
-
timeout:
|
|
3141
|
+
timeout: Duration10.minutes(1),
|
|
2969
3142
|
environment: {
|
|
2970
3143
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName
|
|
2971
3144
|
}
|
|
@@ -2980,11 +3153,11 @@ var OwningDeleteCascadeLambdas = class extends Construct19 {
|
|
|
2980
3153
|
__dirname,
|
|
2981
3154
|
"finalize.handler.js"
|
|
2982
3155
|
);
|
|
2983
|
-
this.finalize = new
|
|
3156
|
+
this.finalize = new NodejsFunction13(this, "finalize-handler", {
|
|
2984
3157
|
entry: finalizeResolved.entry,
|
|
2985
|
-
runtime:
|
|
3158
|
+
runtime: Runtime13.NODEJS_LATEST,
|
|
2986
3159
|
memorySize: 512,
|
|
2987
|
-
timeout:
|
|
3160
|
+
timeout: Duration10.minutes(1),
|
|
2988
3161
|
environment: {
|
|
2989
3162
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName,
|
|
2990
3163
|
[OWNING_DELETE_OPS_EVENT_BUS_ENV_VAR]: props.opsEventBus.eventBusName
|
|
@@ -3002,7 +3175,7 @@ var OwningDeleteCascadeLambdas = class extends Construct19 {
|
|
|
3002
3175
|
};
|
|
3003
3176
|
|
|
3004
3177
|
// src/workflows/control-plane/owning-delete-cascade/owning-delete-cascade-workflow.ts
|
|
3005
|
-
import { Duration as
|
|
3178
|
+
import { Duration as Duration11 } from "aws-cdk-lib";
|
|
3006
3179
|
import { Rule as Rule5 } from "aws-cdk-lib/aws-events";
|
|
3007
3180
|
import { SfnStateMachine } from "aws-cdk-lib/aws-events-targets";
|
|
3008
3181
|
import {
|
|
@@ -3018,8 +3191,8 @@ import {
|
|
|
3018
3191
|
WaitTime
|
|
3019
3192
|
} from "aws-cdk-lib/aws-stepfunctions";
|
|
3020
3193
|
import { LambdaInvoke } from "aws-cdk-lib/aws-stepfunctions-tasks";
|
|
3021
|
-
import { Construct as
|
|
3022
|
-
var OwningDeleteCascadeWorkflow = class extends
|
|
3194
|
+
import { Construct as Construct21 } from "constructs";
|
|
3195
|
+
var OwningDeleteCascadeWorkflow = class extends Construct21 {
|
|
3023
3196
|
constructor(scope, props) {
|
|
3024
3197
|
super(scope, "owning-delete-cascade-workflow");
|
|
3025
3198
|
this.lambdas = new OwningDeleteCascadeLambdas(this, {
|
|
@@ -3128,7 +3301,7 @@ var OwningDeleteCascadeWorkflow = class extends Construct20 {
|
|
|
3128
3301
|
}
|
|
3129
3302
|
});
|
|
3130
3303
|
const interPageWait = new Wait(this, "inter-page-wait", {
|
|
3131
|
-
time: WaitTime.duration(
|
|
3304
|
+
time: WaitTime.duration(Duration11.seconds(0))
|
|
3132
3305
|
});
|
|
3133
3306
|
const isExhausted = new Choice(this, "is-exhausted");
|
|
3134
3307
|
const finalize = new LambdaInvoke(this, "finalize", {
|
|
@@ -3159,7 +3332,7 @@ var OwningDeleteCascadeWorkflow = class extends Construct20 {
|
|
|
3159
3332
|
// Long timeout because real-world cascades can run minutes when
|
|
3160
3333
|
// a workspace has thousands of members. The stuck-cascade alarm
|
|
3161
3334
|
// fires at 15 minutes; the state machine itself does not abort.
|
|
3162
|
-
timeout:
|
|
3335
|
+
timeout: Duration11.hours(2)
|
|
3163
3336
|
});
|
|
3164
3337
|
this.rule = new Rule5(this, "rule", {
|
|
3165
3338
|
eventBus: props.dataEventBus,
|
|
@@ -3170,7 +3343,7 @@ var OwningDeleteCascadeWorkflow = class extends Construct20 {
|
|
|
3170
3343
|
targets: [
|
|
3171
3344
|
new SfnStateMachine(this.stateMachine, {
|
|
3172
3345
|
retryAttempts: 2,
|
|
3173
|
-
maxEventAge:
|
|
3346
|
+
maxEventAge: Duration11.hours(2)
|
|
3174
3347
|
})
|
|
3175
3348
|
]
|
|
3176
3349
|
});
|
|
@@ -3178,33 +3351,33 @@ var OwningDeleteCascadeWorkflow = class extends Construct20 {
|
|
|
3178
3351
|
};
|
|
3179
3352
|
|
|
3180
3353
|
// src/workflows/control-plane/rename-cascade/rename-cascade-lambdas.ts
|
|
3181
|
-
import
|
|
3182
|
-
import
|
|
3183
|
-
import { Duration as
|
|
3354
|
+
import fs14 from "fs";
|
|
3355
|
+
import path14 from "path";
|
|
3356
|
+
import { Duration as Duration12 } from "aws-cdk-lib";
|
|
3184
3357
|
import { Effect as Effect9, PolicyStatement as PolicyStatement9 } from "aws-cdk-lib/aws-iam";
|
|
3185
|
-
import { Runtime as
|
|
3186
|
-
import { NodejsFunction as
|
|
3187
|
-
import { Construct as
|
|
3358
|
+
import { Runtime as Runtime14 } from "aws-cdk-lib/aws-lambda";
|
|
3359
|
+
import { NodejsFunction as NodejsFunction14 } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
3360
|
+
import { Construct as Construct22 } from "constructs";
|
|
3188
3361
|
function resolveHandlerEntry13(dirname, handlerName) {
|
|
3189
|
-
const sameDir =
|
|
3190
|
-
if (
|
|
3362
|
+
const sameDir = path14.join(dirname, handlerName);
|
|
3363
|
+
if (fs14.existsSync(sameDir)) {
|
|
3191
3364
|
return { entry: sameDir, handler: "handler" };
|
|
3192
3365
|
}
|
|
3193
|
-
const libDir =
|
|
3366
|
+
const libDir = path14.join(dirname, "..", "..", "..", "..", "lib", handlerName);
|
|
3194
3367
|
return { entry: libDir, handler: "handler" };
|
|
3195
3368
|
}
|
|
3196
|
-
var RenameCascadeLambdas = class extends
|
|
3369
|
+
var RenameCascadeLambdas = class extends Construct22 {
|
|
3197
3370
|
constructor(scope, props) {
|
|
3198
3371
|
super(scope, "rename-cascade-lambdas");
|
|
3199
3372
|
const listResolved = resolveHandlerEntry13(
|
|
3200
3373
|
__dirname,
|
|
3201
3374
|
"rename-list-targets.handler.js"
|
|
3202
3375
|
);
|
|
3203
|
-
this.listTargets = new
|
|
3376
|
+
this.listTargets = new NodejsFunction14(this, "list-targets-handler", {
|
|
3204
3377
|
entry: listResolved.entry,
|
|
3205
|
-
runtime:
|
|
3378
|
+
runtime: Runtime14.NODEJS_LATEST,
|
|
3206
3379
|
memorySize: 512,
|
|
3207
|
-
timeout:
|
|
3380
|
+
timeout: Duration12.minutes(1),
|
|
3208
3381
|
environment: {
|
|
3209
3382
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName
|
|
3210
3383
|
}
|
|
@@ -3214,11 +3387,11 @@ var RenameCascadeLambdas = class extends Construct21 {
|
|
|
3214
3387
|
__dirname,
|
|
3215
3388
|
"rename-rewrite-chunk.handler.js"
|
|
3216
3389
|
);
|
|
3217
|
-
this.rewriteChunk = new
|
|
3390
|
+
this.rewriteChunk = new NodejsFunction14(this, "rewrite-chunk-handler", {
|
|
3218
3391
|
entry: rewriteResolved.entry,
|
|
3219
|
-
runtime:
|
|
3392
|
+
runtime: Runtime14.NODEJS_LATEST,
|
|
3220
3393
|
memorySize: 512,
|
|
3221
|
-
timeout:
|
|
3394
|
+
timeout: Duration12.minutes(1),
|
|
3222
3395
|
environment: {
|
|
3223
3396
|
DYNAMO_TABLE_NAME: props.dataStoreTable.tableName
|
|
3224
3397
|
}
|
|
@@ -3233,11 +3406,11 @@ var RenameCascadeLambdas = class extends Construct21 {
|
|
|
3233
3406
|
__dirname,
|
|
3234
3407
|
"rename-finalize.handler.js"
|
|
3235
3408
|
);
|
|
3236
|
-
this.finalize = new
|
|
3409
|
+
this.finalize = new NodejsFunction14(this, "finalize-handler", {
|
|
3237
3410
|
entry: finalizeResolved.entry,
|
|
3238
|
-
runtime:
|
|
3411
|
+
runtime: Runtime14.NODEJS_LATEST,
|
|
3239
3412
|
memorySize: 512,
|
|
3240
|
-
timeout:
|
|
3413
|
+
timeout: Duration12.minutes(1),
|
|
3241
3414
|
environment: {
|
|
3242
3415
|
[RENAME_CASCADE_OPS_EVENT_BUS_ENV_VAR]: props.opsEventBus.eventBusName
|
|
3243
3416
|
}
|
|
@@ -3253,7 +3426,7 @@ var RenameCascadeLambdas = class extends Construct21 {
|
|
|
3253
3426
|
};
|
|
3254
3427
|
|
|
3255
3428
|
// src/workflows/control-plane/rename-cascade/rename-cascade-workflow.ts
|
|
3256
|
-
import { Duration as
|
|
3429
|
+
import { Duration as Duration13 } from "aws-cdk-lib";
|
|
3257
3430
|
import { Rule as Rule6 } from "aws-cdk-lib/aws-events";
|
|
3258
3431
|
import { SfnStateMachine as SfnStateMachine2 } from "aws-cdk-lib/aws-events-targets";
|
|
3259
3432
|
import {
|
|
@@ -3267,8 +3440,8 @@ import {
|
|
|
3267
3440
|
TaskInput as TaskInput2
|
|
3268
3441
|
} from "aws-cdk-lib/aws-stepfunctions";
|
|
3269
3442
|
import { LambdaInvoke as LambdaInvoke2 } from "aws-cdk-lib/aws-stepfunctions-tasks";
|
|
3270
|
-
import { Construct as
|
|
3271
|
-
var RenameCascadeWorkflow = class extends
|
|
3443
|
+
import { Construct as Construct23 } from "constructs";
|
|
3444
|
+
var RenameCascadeWorkflow = class extends Construct23 {
|
|
3272
3445
|
constructor(scope, props) {
|
|
3273
3446
|
super(scope, "rename-cascade-workflow");
|
|
3274
3447
|
this.lambdas = new RenameCascadeLambdas(this, {
|
|
@@ -3412,7 +3585,7 @@ var RenameCascadeWorkflow = class extends Construct22 {
|
|
|
3412
3585
|
// Long timeout — large renames may rewrite thousands of rows;
|
|
3413
3586
|
// the `CascadeSlow` alarm fires at 300s p99 but the state
|
|
3414
3587
|
// machine itself does not abort.
|
|
3415
|
-
timeout:
|
|
3588
|
+
timeout: Duration13.hours(2)
|
|
3416
3589
|
});
|
|
3417
3590
|
this.rule = new Rule6(this, "rule", {
|
|
3418
3591
|
eventBus: props.dataEventBus,
|
|
@@ -3423,7 +3596,7 @@ var RenameCascadeWorkflow = class extends Construct22 {
|
|
|
3423
3596
|
targets: [
|
|
3424
3597
|
new SfnStateMachine2(this.stateMachine, {
|
|
3425
3598
|
retryAttempts: 2,
|
|
3426
|
-
maxEventAge:
|
|
3599
|
+
maxEventAge: Duration13.hours(2)
|
|
3427
3600
|
})
|
|
3428
3601
|
]
|
|
3429
3602
|
});
|
|
@@ -3444,7 +3617,6 @@ export {
|
|
|
3444
3617
|
CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE,
|
|
3445
3618
|
CONTROL_EVENT_BUS_NAME_ENV_VAR,
|
|
3446
3619
|
ChildHostedZone,
|
|
3447
|
-
CognitoFixtureSeederClient,
|
|
3448
3620
|
CognitoUserPool,
|
|
3449
3621
|
CognitoUserPoolClient,
|
|
3450
3622
|
CognitoUserPoolDomain,
|
|
@@ -3459,6 +3631,7 @@ export {
|
|
|
3459
3631
|
DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES,
|
|
3460
3632
|
DATA_STORE_CHANGE_DETAIL_TYPE,
|
|
3461
3633
|
DATA_STORE_CHANGE_EVENT_SOURCE,
|
|
3634
|
+
DEMO_DATA_PLANE_FIXTURES,
|
|
3462
3635
|
DEMO_PERIOD,
|
|
3463
3636
|
DEMO_TENANT_SPECS,
|
|
3464
3637
|
DEMO_URN_SYSTEM,
|
|
@@ -3489,6 +3662,7 @@ export {
|
|
|
3489
3662
|
OpenHiRestApiService,
|
|
3490
3663
|
OpenHiService,
|
|
3491
3664
|
OpenHiStage,
|
|
3665
|
+
OpenHiWebsiteService,
|
|
3492
3666
|
OpsEventBus,
|
|
3493
3667
|
OwningDeleteCascadeLambdas,
|
|
3494
3668
|
OwningDeleteCascadeWorkflow,
|
|
@@ -3524,11 +3698,13 @@ export {
|
|
|
3524
3698
|
SEED_SYSTEM_DATA_ACTOR_SYSTEM,
|
|
3525
3699
|
SEED_SYSTEM_DATA_CONSUMER_NAME,
|
|
3526
3700
|
SEED_SYSTEM_DATA_CONTROL_BUS_ENV_VAR,
|
|
3701
|
+
SSM_PARAM_NAME_FULL_DOMAIN,
|
|
3527
3702
|
STATIC_HOSTING_SERVICE_TYPE,
|
|
3528
3703
|
SeedDemoDataLambda,
|
|
3529
3704
|
SeedDemoDataWorkflow,
|
|
3530
3705
|
SeedSystemDataLambda,
|
|
3531
3706
|
SeedSystemDataWorkflow,
|
|
3707
|
+
StaticContent,
|
|
3532
3708
|
StaticHosting,
|
|
3533
3709
|
USER_ONBOARDING_EVENT_SOURCE,
|
|
3534
3710
|
UserOnboardingWorkflow,
|
|
@@ -3537,22 +3713,14 @@ export {
|
|
|
3537
3713
|
WorkflowDedupTableDuplicateError,
|
|
3538
3714
|
buildFhirCurrentResourceChangeDetail,
|
|
3539
3715
|
buildProvisionDefaultWorkspaceRequestedDetail,
|
|
3540
|
-
demoBasePartitionKeys,
|
|
3541
|
-
demoDevUserPartitionKeys,
|
|
3542
3716
|
demoMembershipId,
|
|
3543
|
-
demoMembershipPartitionKey,
|
|
3544
3717
|
demoRoleAssignmentId,
|
|
3545
|
-
demoRoleAssignmentPartitionKey,
|
|
3546
3718
|
demoRolesForUserInTenant,
|
|
3547
3719
|
demoScenarioIdentifier,
|
|
3548
|
-
demoTenantPartitionKey,
|
|
3549
|
-
demoUserPartitionKey,
|
|
3550
|
-
demoWorkspacePartitionKey,
|
|
3551
3720
|
getDynamoDbDataStoreTableName,
|
|
3552
3721
|
getPostgresReplicaSchemaName,
|
|
3553
3722
|
getWorkflowDedupTableName,
|
|
3554
3723
|
openHiTagKey,
|
|
3555
|
-
openhiResourceIdentifier
|
|
3556
|
-
rolePartitionKey
|
|
3724
|
+
openhiResourceIdentifier
|
|
3557
3725
|
};
|
|
3558
3726
|
//# sourceMappingURL=index.mjs.map
|