@openhi/constructs 0.0.135 → 0.0.136
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/index.d.mts +145 -37
- package/lib/index.d.ts +146 -38
- package/lib/index.js +177 -49
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +175 -49
- package/lib/index.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +554 -66
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +554 -66
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -766,6 +766,7 @@ var require_lib2 = __commonJS({
|
|
|
766
766
|
// src/index.ts
|
|
767
767
|
var src_exports = {};
|
|
768
768
|
__export(src_exports, {
|
|
769
|
+
ADMIN_DOMAIN_PREFIX: () => ADMIN_DOMAIN_PREFIX,
|
|
769
770
|
BRIDGED_STATUSES: () => BRIDGED_STATUSES,
|
|
770
771
|
CLOUDFORMATION_EVENT_SOURCE: () => CLOUDFORMATION_EVENT_SOURCE,
|
|
771
772
|
CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE: () => CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE,
|
|
@@ -790,6 +791,7 @@ __export(src_exports, {
|
|
|
790
791
|
DEMO_PERIOD: () => DEMO_PERIOD,
|
|
791
792
|
DEMO_TENANT_SPECS: () => DEMO_TENANT_SPECS,
|
|
792
793
|
DEMO_URN_SYSTEM: () => DEMO_URN_SYSTEM,
|
|
794
|
+
DEV_CORS_ALLOW_ORIGINS: () => DEV_CORS_ALLOW_ORIGINS,
|
|
793
795
|
DEV_USERS: () => DEV_USERS,
|
|
794
796
|
DataEventBus: () => DataEventBus,
|
|
795
797
|
DataStoreHistoricalArchive: () => DataStoreHistoricalArchive,
|
|
@@ -1104,12 +1106,14 @@ var import_utils2 = require("@codedrifters/utils");
|
|
|
1104
1106
|
var import_config3 = __toESM(require_lib());
|
|
1105
1107
|
var import_aws_cdk_lib4 = require("aws-cdk-lib");
|
|
1106
1108
|
var import_change_case = require("change-case");
|
|
1109
|
+
var DEFAULT_RELEASE_BRANCH = "main";
|
|
1110
|
+
var CHILD_ZONE_PREFIX_MAX_LENGTH = 56;
|
|
1107
1111
|
var OPENHI_TAG_SUFFIX_REPO_NAME = "repo-name";
|
|
1108
1112
|
var OPENHI_TAG_SUFFIX_BRANCH_NAME = "branch-name";
|
|
1109
1113
|
var OPENHI_TAG_SUFFIX_SERVICE_TYPE = "service-type";
|
|
1110
1114
|
var OPENHI_TAG_SUFFIX_STAGE_TYPE = "stage-type";
|
|
1111
1115
|
var openHiTagKey = (appName, suffix) => `${appName}:${suffix}`;
|
|
1112
|
-
var OpenHiService = class extends import_aws_cdk_lib4.Stack {
|
|
1116
|
+
var OpenHiService = class _OpenHiService extends import_aws_cdk_lib4.Stack {
|
|
1113
1117
|
/**
|
|
1114
1118
|
* Creates a new OpenHI service stack.
|
|
1115
1119
|
*
|
|
@@ -1129,8 +1133,12 @@ var OpenHiService = class extends import_aws_cdk_lib4.Stack {
|
|
|
1129
1133
|
}
|
|
1130
1134
|
const appName = props.appName ?? ohEnv.ohStage.ohApp.appName ?? "openhi";
|
|
1131
1135
|
const repoName = props.repoName ?? (0, import_utils2.findGitRepoName)();
|
|
1132
|
-
const defaultReleaseBranch =
|
|
1133
|
-
|
|
1136
|
+
const { branchName, defaultReleaseBranch } = _OpenHiService.resolveBranchContext(ohEnv, {
|
|
1137
|
+
...props.branchName !== void 0 && { branchName: props.branchName },
|
|
1138
|
+
...props.defaultReleaseBranch !== void 0 && {
|
|
1139
|
+
defaultReleaseBranch: props.defaultReleaseBranch
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1134
1142
|
const environmentHash = (0, import_utils2.hashString)(
|
|
1135
1143
|
[appName, ohEnv.deploymentTargetRole, account, region].join("-"),
|
|
1136
1144
|
6
|
|
@@ -1205,6 +1213,50 @@ var OpenHiService = class extends import_aws_cdk_lib4.Stack {
|
|
|
1205
1213
|
ohEnv.ohStage.stageType.slice(0, 255)
|
|
1206
1214
|
);
|
|
1207
1215
|
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Compose the full per-deploy domain for an OpenHI service.
|
|
1218
|
+
*
|
|
1219
|
+
* On the release branch (`branchName === defaultReleaseBranch`), the
|
|
1220
|
+
* full domain is `<domainPrefix>.<zoneName>`. On every other branch
|
|
1221
|
+
* the per-PR preview hostname is
|
|
1222
|
+
* `<domainPrefix>-<childZonePrefix>.<zoneName>`.
|
|
1223
|
+
*
|
|
1224
|
+
* Pure helper — reads no environment state. Subclasses expose thin
|
|
1225
|
+
* statics (`composeFullDomain`) that fill in `domainPrefix` from their
|
|
1226
|
+
* own service constant and delegate here.
|
|
1227
|
+
*/
|
|
1228
|
+
static composeServiceDomain(opts) {
|
|
1229
|
+
const isRelease = opts.branchName === opts.defaultReleaseBranch;
|
|
1230
|
+
const subDomain = isRelease ? opts.domainPrefix : `${opts.domainPrefix}-${opts.childZonePrefix}`;
|
|
1231
|
+
return `${subDomain}.${opts.zoneName}`;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Compute the `childZonePrefix` segment for a given branch — kebab-cased
|
|
1235
|
+
* and truncated to {@link CHILD_ZONE_PREFIX_MAX_LENGTH}. Matches the
|
|
1236
|
+
* per-instance {@link OpenHiService.childZonePrefix} getter so consumers
|
|
1237
|
+
* can compose hostnames identical to the service's own without
|
|
1238
|
+
* instantiating it.
|
|
1239
|
+
*/
|
|
1240
|
+
static computeChildZonePrefix(branchName) {
|
|
1241
|
+
return (0, import_change_case.paramCase)(branchName).slice(0, CHILD_ZONE_PREFIX_MAX_LENGTH);
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Resolve the branch context the service would compute internally given
|
|
1245
|
+
* an environment and optional overrides. Mirrors the same defaulting
|
|
1246
|
+
* (props override → JEST sentinel → `GIT_BRANCH_NAME` env → git
|
|
1247
|
+
* detection on DEV → release branch on stage/prod) the
|
|
1248
|
+
* {@link OpenHiService} constructor uses.
|
|
1249
|
+
*
|
|
1250
|
+
* Consumers (e.g. sibling stack entries) call this to predict the
|
|
1251
|
+
* branch values a service will see at synth time so they can compose
|
|
1252
|
+
* hostnames against the same inputs.
|
|
1253
|
+
*/
|
|
1254
|
+
static resolveBranchContext(ohEnv, overrides = {}) {
|
|
1255
|
+
const defaultReleaseBranch = overrides.defaultReleaseBranch ?? DEFAULT_RELEASE_BRANCH;
|
|
1256
|
+
const branchName = overrides.branchName ?? (process.env.JEST_WORKER_ID ? "test-branch" : process.env.GIT_BRANCH_NAME?.trim() || (ohEnv.ohStage.stageType === import_config3.OPEN_HI_STAGE.DEV ? (0, import_utils2.findGitBranch)() : defaultReleaseBranch));
|
|
1257
|
+
const childZonePrefix = _OpenHiService.computeChildZonePrefix(branchName);
|
|
1258
|
+
return { branchName, defaultReleaseBranch, childZonePrefix };
|
|
1259
|
+
}
|
|
1208
1260
|
/**
|
|
1209
1261
|
* DNS prefix for this branche's child zone. Capped at 56 chars so
|
|
1210
1262
|
* that a `<service>-<prefix>` hostname segment stays under the 63-byte
|
|
@@ -1213,7 +1265,7 @@ var OpenHiService = class extends import_aws_cdk_lib4.Stack {
|
|
|
1213
1265
|
* headroom on the longer side.
|
|
1214
1266
|
*/
|
|
1215
1267
|
get childZonePrefix() {
|
|
1216
|
-
return
|
|
1268
|
+
return _OpenHiService.computeChildZonePrefix(this.branchName);
|
|
1217
1269
|
}
|
|
1218
1270
|
};
|
|
1219
1271
|
|
|
@@ -7117,6 +7169,7 @@ _OpenHiAuthService.SERVICE_TYPE = "auth";
|
|
|
7117
7169
|
var OpenHiAuthService = _OpenHiAuthService;
|
|
7118
7170
|
|
|
7119
7171
|
// src/services/open-hi-rest-api-service.ts
|
|
7172
|
+
var import_config5 = __toESM(require_lib());
|
|
7120
7173
|
var import_aws_apigatewayv22 = require("aws-cdk-lib/aws-apigatewayv2");
|
|
7121
7174
|
var import_aws_apigatewayv2_authorizers = require("aws-cdk-lib/aws-apigatewayv2-authorizers");
|
|
7122
7175
|
var import_aws_apigatewayv2_integrations = require("aws-cdk-lib/aws-apigatewayv2-integrations");
|
|
@@ -7195,7 +7248,31 @@ var RestApiLambda = class extends import_constructs20.Construct {
|
|
|
7195
7248
|
// src/services/open-hi-rest-api-service.ts
|
|
7196
7249
|
var REST_API_BASE_URL_SSM_NAME = "REST_API_BASE_URL";
|
|
7197
7250
|
var REST_API_DOMAIN_NAME_SSM_NAME = "REST_API_DOMAIN_NAME";
|
|
7251
|
+
var DEV_CORS_ALLOW_ORIGINS = [
|
|
7252
|
+
"http://localhost:3000",
|
|
7253
|
+
"https://localhost:3000",
|
|
7254
|
+
"http://localhost:5173",
|
|
7255
|
+
"https://localhost:5173",
|
|
7256
|
+
"http://127.0.0.1:3000",
|
|
7257
|
+
"https://127.0.0.1:3000",
|
|
7258
|
+
"http://127.0.0.1:5173",
|
|
7259
|
+
"https://127.0.0.1:5173"
|
|
7260
|
+
];
|
|
7198
7261
|
var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
7262
|
+
/**
|
|
7263
|
+
* Compose the REST API's full per-deploy domain. Thin wrapper over
|
|
7264
|
+
* {@link OpenHiService.composeServiceDomain} that pins `domainPrefix`
|
|
7265
|
+
* to {@link API_DOMAIN_PREFIX}.
|
|
7266
|
+
*
|
|
7267
|
+
* Use from sibling stacks that need to predict the API's hostname
|
|
7268
|
+
* before the REST API stack is synthesised.
|
|
7269
|
+
*/
|
|
7270
|
+
static composeFullDomain(opts) {
|
|
7271
|
+
return OpenHiService.composeServiceDomain({
|
|
7272
|
+
...opts,
|
|
7273
|
+
domainPrefix: _OpenHiRestApiService.API_DOMAIN_PREFIX
|
|
7274
|
+
});
|
|
7275
|
+
}
|
|
7199
7276
|
/**
|
|
7200
7277
|
* Returns an IHttpApi by looking up the REST API stack's HTTP API ID from SSM.
|
|
7201
7278
|
*/
|
|
@@ -7279,11 +7356,18 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7279
7356
|
}
|
|
7280
7357
|
/**
|
|
7281
7358
|
* Returns the API domain name string (e.g. api.example.com or api-\{prefix\}.example.com).
|
|
7359
|
+
* Delegates to {@link OpenHiRestApiService.composeFullDomain} so the
|
|
7360
|
+
* release-vs-feature composition stays in one place; picks up
|
|
7361
|
+
* `this.defaultReleaseBranch` (not a hard-coded `"main"`).
|
|
7282
7362
|
* Override to customize.
|
|
7283
7363
|
*/
|
|
7284
7364
|
createApiDomainNameString(hostedZone) {
|
|
7285
|
-
|
|
7286
|
-
|
|
7365
|
+
return _OpenHiRestApiService.composeFullDomain({
|
|
7366
|
+
branchName: this.branchName,
|
|
7367
|
+
defaultReleaseBranch: this.defaultReleaseBranch,
|
|
7368
|
+
childZonePrefix: this.childZonePrefix,
|
|
7369
|
+
zoneName: hostedZone.zoneName
|
|
7370
|
+
});
|
|
7287
7371
|
}
|
|
7288
7372
|
/**
|
|
7289
7373
|
* Creates the SSM parameter for the REST API base URL.
|
|
@@ -7342,7 +7426,7 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7342
7426
|
postgresSecretArn,
|
|
7343
7427
|
postgresDatabase,
|
|
7344
7428
|
postgresSchema,
|
|
7345
|
-
|
|
7429
|
+
extraEnvironment
|
|
7346
7430
|
});
|
|
7347
7431
|
lambda.addToRolePolicy(
|
|
7348
7432
|
new import_aws_iam7.PolicyStatement({
|
|
@@ -7432,7 +7516,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7432
7516
|
routeKey: import_aws_apigatewayv22.HttpRouteKey.with("/{proxy+}", import_aws_apigatewayv22.HttpMethod.ANY),
|
|
7433
7517
|
integration
|
|
7434
7518
|
});
|
|
7435
|
-
const apiPrefix = this.
|
|
7519
|
+
const apiPrefix = this.apiDomainName.slice(
|
|
7520
|
+
0,
|
|
7521
|
+
-(hostedZone.zoneName.length + 1)
|
|
7522
|
+
);
|
|
7436
7523
|
new import_aws_route535.ARecord(this, `api-a-record-${apiPrefix}`, {
|
|
7437
7524
|
zone: hostedZone,
|
|
7438
7525
|
recordName: apiPrefix,
|
|
@@ -7458,27 +7545,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7458
7545
|
{ userPoolClients: [userPoolClient] }
|
|
7459
7546
|
);
|
|
7460
7547
|
const { corsPreflight: cors, ...restRootHttpApiProps } = this.props.rootHttpApiProps ?? {};
|
|
7461
|
-
const
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
import_aws_apigatewayv22.CorsHttpMethod.HEAD,
|
|
7466
|
-
import_aws_apigatewayv22.CorsHttpMethod.POST,
|
|
7467
|
-
import_aws_apigatewayv22.CorsHttpMethod.PUT,
|
|
7468
|
-
import_aws_apigatewayv22.CorsHttpMethod.PATCH,
|
|
7469
|
-
import_aws_apigatewayv22.CorsHttpMethod.DELETE,
|
|
7470
|
-
import_aws_apigatewayv22.CorsHttpMethod.OPTIONS
|
|
7471
|
-
],
|
|
7472
|
-
allowHeaders: cors.allowHeaders ?? [
|
|
7473
|
-
"Content-Type",
|
|
7474
|
-
"Authorization"
|
|
7475
|
-
],
|
|
7476
|
-
allowCredentials: cors.allowCredentials ?? true,
|
|
7477
|
-
maxAge: cors.maxAge ?? import_core2.Duration.days(1),
|
|
7478
|
-
...cors.exposeHeaders !== void 0 && {
|
|
7479
|
-
exposeHeaders: cors.exposeHeaders
|
|
7480
|
-
}
|
|
7481
|
-
} : void 0;
|
|
7548
|
+
const isNonProd = this.ohEnv.ohStage.stageType !== import_config5.OPEN_HI_STAGE.PROD;
|
|
7549
|
+
const callerOrigins = cors?.allowOrigins ?? [];
|
|
7550
|
+
const mergedOrigins = isNonProd ? Array.from(/* @__PURE__ */ new Set([...callerOrigins, ...DEV_CORS_ALLOW_ORIGINS])) : callerOrigins;
|
|
7551
|
+
const corsPreflight = cors !== void 0 || isNonProd ? this.buildCorsPreflightOptions(mergedOrigins, cors) : void 0;
|
|
7482
7552
|
const rootHttpApi = new RootHttpApi(this, {
|
|
7483
7553
|
...restRootHttpApiProps,
|
|
7484
7554
|
...corsPreflight !== void 0 && { corsPreflight },
|
|
@@ -7495,21 +7565,43 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7495
7565
|
});
|
|
7496
7566
|
return rootHttpApi;
|
|
7497
7567
|
}
|
|
7568
|
+
/**
|
|
7569
|
+
* Builds the full `CorsPreflightOptions` from a merged origins array,
|
|
7570
|
+
* filling defaults for `allowMethods`/`allowHeaders`/`allowCredentials`/
|
|
7571
|
+
* `maxAge` from the caller-supplied block when present.
|
|
7572
|
+
*/
|
|
7573
|
+
buildCorsPreflightOptions(allowOrigins, cors) {
|
|
7574
|
+
return {
|
|
7575
|
+
allowOrigins: [...allowOrigins],
|
|
7576
|
+
allowMethods: cors?.allowMethods ?? [
|
|
7577
|
+
import_aws_apigatewayv22.CorsHttpMethod.GET,
|
|
7578
|
+
import_aws_apigatewayv22.CorsHttpMethod.HEAD,
|
|
7579
|
+
import_aws_apigatewayv22.CorsHttpMethod.POST,
|
|
7580
|
+
import_aws_apigatewayv22.CorsHttpMethod.PUT,
|
|
7581
|
+
import_aws_apigatewayv22.CorsHttpMethod.PATCH,
|
|
7582
|
+
import_aws_apigatewayv22.CorsHttpMethod.DELETE,
|
|
7583
|
+
import_aws_apigatewayv22.CorsHttpMethod.OPTIONS
|
|
7584
|
+
],
|
|
7585
|
+
allowHeaders: cors?.allowHeaders ?? ["Content-Type", "Authorization"],
|
|
7586
|
+
allowCredentials: cors?.allowCredentials ?? true,
|
|
7587
|
+
maxAge: cors?.maxAge ?? import_core2.Duration.days(1),
|
|
7588
|
+
...cors?.exposeHeaders !== void 0 && {
|
|
7589
|
+
exposeHeaders: cors.exposeHeaders
|
|
7590
|
+
}
|
|
7591
|
+
};
|
|
7592
|
+
}
|
|
7498
7593
|
/**
|
|
7499
7594
|
* Builds the `OPENHI_RUNTIME_CONFIG_*` env-var map the REST API Lambda
|
|
7500
|
-
* exposes through `GET /control/runtime-config`.
|
|
7501
|
-
*
|
|
7502
|
-
*
|
|
7503
|
-
*
|
|
7504
|
-
*
|
|
7505
|
-
*
|
|
7506
|
-
*
|
|
7507
|
-
*
|
|
7595
|
+
* exposes through `GET /control/runtime-config`. The four values are
|
|
7596
|
+
* always populated — the three Cognito IDs are resolved via SSM lookups
|
|
7597
|
+
* against the auth stack from a dedicated sub-scope (`runtime-config`)
|
|
7598
|
+
* so they don't collide with the user-pool / user-pool-client constructs
|
|
7599
|
+
* already created in {@link createRootHttpApi}, and `apiBaseUrl` is
|
|
7600
|
+
* derived from this stack's own custom domain. The OAuth callback URL
|
|
7601
|
+
* is no longer plumbed through the API — the admin-console derives it
|
|
7602
|
+
* client-side from `window.location.origin`.
|
|
7508
7603
|
*/
|
|
7509
7604
|
resolveRuntimeConfigEnvVars() {
|
|
7510
|
-
if (this.props.runtimeConfig === void 0) {
|
|
7511
|
-
return void 0;
|
|
7512
|
-
}
|
|
7513
7605
|
const cognitoScope = new import_constructs21.Construct(this, "runtime-config");
|
|
7514
7606
|
const userPool = OpenHiAuthService.userPoolFromConstruct(cognitoScope);
|
|
7515
7607
|
const userPoolClient = OpenHiAuthService.userPoolClientFromConstruct(cognitoScope);
|
|
@@ -7518,12 +7610,16 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7518
7610
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_ID: userPool.userPoolId,
|
|
7519
7611
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_CLIENT_ID: userPoolClient.userPoolClientId,
|
|
7520
7612
|
OPENHI_RUNTIME_CONFIG_COGNITO_DOMAIN_URL: cognitoDomainUrl,
|
|
7521
|
-
OPENHI_RUNTIME_CONFIG_COGNITO_REDIRECT_URI: this.props.runtimeConfig.cognitoRedirectUri,
|
|
7522
7613
|
OPENHI_RUNTIME_CONFIG_API_BASE_URL: `https://${this.apiDomainName}`
|
|
7523
7614
|
};
|
|
7524
7615
|
}
|
|
7525
7616
|
};
|
|
7526
7617
|
_OpenHiRestApiService.SERVICE_TYPE = "rest-api";
|
|
7618
|
+
/**
|
|
7619
|
+
* Sub-domain prefix used by the REST API. Release-branch hostname is
|
|
7620
|
+
* `api.<zone>`; per-PR preview hostname is `api-<childZonePrefix>.<zone>`.
|
|
7621
|
+
*/
|
|
7622
|
+
_OpenHiRestApiService.API_DOMAIN_PREFIX = "api";
|
|
7527
7623
|
var OpenHiRestApiService = _OpenHiRestApiService;
|
|
7528
7624
|
|
|
7529
7625
|
// src/services/open-hi-graphql-service.ts
|
|
@@ -7564,10 +7660,26 @@ _OpenHiGraphqlService.SERVICE_TYPE = "graphql-api";
|
|
|
7564
7660
|
var OpenHiGraphqlService = _OpenHiGraphqlService;
|
|
7565
7661
|
|
|
7566
7662
|
// src/services/open-hi-website-service.ts
|
|
7567
|
-
var
|
|
7663
|
+
var import_config6 = __toESM(require_lib());
|
|
7568
7664
|
var import_aws_s32 = require("aws-cdk-lib/aws-s3");
|
|
7569
7665
|
var SSM_PARAM_NAME_FULL_DOMAIN = "WEBSITE_FULL_DOMAIN";
|
|
7666
|
+
var ADMIN_DOMAIN_PREFIX = "admin";
|
|
7570
7667
|
var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
7668
|
+
/**
|
|
7669
|
+
* Compose the website's full per-deploy domain. Thin wrapper over
|
|
7670
|
+
* {@link OpenHiService.composeServiceDomain} that fills in
|
|
7671
|
+
* {@link DEFAULT_DOMAIN_PREFIX} when `domainPrefix` is omitted.
|
|
7672
|
+
*
|
|
7673
|
+
* Use from sibling stacks that need to predict the website's hostname
|
|
7674
|
+
* before the website stack is synthesised — e.g. the REST API stack
|
|
7675
|
+
* computing its CORS `allowOrigins` for the admin-console.
|
|
7676
|
+
*/
|
|
7677
|
+
static composeFullDomain(opts) {
|
|
7678
|
+
return OpenHiService.composeServiceDomain({
|
|
7679
|
+
...opts,
|
|
7680
|
+
domainPrefix: opts.domainPrefix ?? _OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX
|
|
7681
|
+
});
|
|
7682
|
+
}
|
|
7571
7683
|
/**
|
|
7572
7684
|
* Looks up the static-hosting bucket ARN published by the release-branch
|
|
7573
7685
|
* deploy of this service.
|
|
@@ -7686,16 +7798,24 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7686
7798
|
* every other deploy serves a per-PR preview at
|
|
7687
7799
|
* `\<domainPrefix\>-\<childZonePrefix\>.\<zone\>`
|
|
7688
7800
|
* (e.g. `admin-feat-1093-patient-migration.dev.openhi.org`).
|
|
7801
|
+
*
|
|
7802
|
+
* Delegates to {@link OpenHiWebsiteService.composeFullDomain} so the
|
|
7803
|
+
* release-vs-feature composition stays in one place.
|
|
7689
7804
|
*/
|
|
7690
7805
|
computeFullDomain(hostedZone) {
|
|
7691
|
-
|
|
7692
|
-
|
|
7806
|
+
return _OpenHiWebsiteService.composeFullDomain({
|
|
7807
|
+
domainPrefix: this.props.domainPrefix,
|
|
7808
|
+
branchName: this.branchName,
|
|
7809
|
+
defaultReleaseBranch: this.defaultReleaseBranch,
|
|
7810
|
+
childZonePrefix: this.childZonePrefix,
|
|
7811
|
+
zoneName: hostedZone.zoneName
|
|
7812
|
+
});
|
|
7693
7813
|
}
|
|
7694
7814
|
/**
|
|
7695
7815
|
* Returns the sub-domain label (left of the zone) for the current
|
|
7696
|
-
* deploy. Used
|
|
7697
|
-
*
|
|
7698
|
-
*
|
|
7816
|
+
* deploy. Used for the per-branch S3 key prefix passed to
|
|
7817
|
+
* {@link StaticContent} so the upload prefix always matches the
|
|
7818
|
+
* served hostname.
|
|
7699
7819
|
*
|
|
7700
7820
|
* Non-release deploys compose the per-PR slug as
|
|
7701
7821
|
* `\<domainPrefix\>-\<childZonePrefix\>`, mirroring the REST API's
|
|
@@ -7706,7 +7826,7 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7706
7826
|
*/
|
|
7707
7827
|
computeSubDomain() {
|
|
7708
7828
|
const isReleaseBranch = this.branchName === this.defaultReleaseBranch;
|
|
7709
|
-
const domainPrefix = this.props.domainPrefix ??
|
|
7829
|
+
const domainPrefix = this.props.domainPrefix ?? _OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX;
|
|
7710
7830
|
if (isReleaseBranch) {
|
|
7711
7831
|
return domainPrefix;
|
|
7712
7832
|
}
|
|
@@ -7733,7 +7853,7 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7733
7853
|
domainNames: [this.fullDomain, wildcardSan],
|
|
7734
7854
|
description: `OpenHI website (${this.fullDomain})`,
|
|
7735
7855
|
prefixPattern: PER_BRANCH_PREVIEW_PREFIX,
|
|
7736
|
-
enablePreviewLifecycle: this.ohEnv.ohStage.stageType !==
|
|
7856
|
+
enablePreviewLifecycle: this.ohEnv.ohStage.stageType !== import_config6.OPEN_HI_STAGE.PROD,
|
|
7737
7857
|
...restApi !== void 0 && { restApi }
|
|
7738
7858
|
});
|
|
7739
7859
|
}
|
|
@@ -7819,6 +7939,12 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7819
7939
|
}
|
|
7820
7940
|
};
|
|
7821
7941
|
_OpenHiWebsiteService.SERVICE_TYPE = "website";
|
|
7942
|
+
/**
|
|
7943
|
+
* Default `domainPrefix` for this service when none is supplied.
|
|
7944
|
+
* Release-branch hostname is `www.<zone>`; per-PR preview hostname is
|
|
7945
|
+
* `www-<childZonePrefix>.<zone>`.
|
|
7946
|
+
*/
|
|
7947
|
+
_OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX = "www";
|
|
7822
7948
|
var OpenHiWebsiteService = _OpenHiWebsiteService;
|
|
7823
7949
|
|
|
7824
7950
|
// src/workflows/control-plane/owning-delete-cascade/events.ts
|
|
@@ -8323,6 +8449,7 @@ var RenameCascadeWorkflow = class extends import_constructs25.Construct {
|
|
|
8323
8449
|
};
|
|
8324
8450
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8325
8451
|
0 && (module.exports = {
|
|
8452
|
+
ADMIN_DOMAIN_PREFIX,
|
|
8326
8453
|
BRIDGED_STATUSES,
|
|
8327
8454
|
CLOUDFORMATION_EVENT_SOURCE,
|
|
8328
8455
|
CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE,
|
|
@@ -8347,6 +8474,7 @@ var RenameCascadeWorkflow = class extends import_constructs25.Construct {
|
|
|
8347
8474
|
DEMO_PERIOD,
|
|
8348
8475
|
DEMO_TENANT_SPECS,
|
|
8349
8476
|
DEMO_URN_SYSTEM,
|
|
8477
|
+
DEV_CORS_ALLOW_ORIGINS,
|
|
8350
8478
|
DEV_USERS,
|
|
8351
8479
|
DataEventBus,
|
|
8352
8480
|
DataStoreHistoricalArchive,
|