@openhi/constructs 0.0.135 → 0.0.137
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 +182 -53
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +180 -53
- 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 +3 -3
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
|
|
|
@@ -2270,10 +2322,11 @@ var DataStorePostgresReplica = class extends import_constructs6.Construct {
|
|
|
2270
2322
|
bundling: {
|
|
2271
2323
|
minify: true,
|
|
2272
2324
|
sourceMap: false,
|
|
2273
|
-
// pg
|
|
2274
|
-
//
|
|
2275
|
-
//
|
|
2276
|
-
|
|
2325
|
+
// pg's conditional optional deps (pg-native, pg-cloudflare) are
|
|
2326
|
+
// marked external so esbuild does not try to resolve them — pg's
|
|
2327
|
+
// runtime code wraps the requires in try/catch and falls back to
|
|
2328
|
+
// the pure-JS client when they are not present.
|
|
2329
|
+
externalModules: ["pg-native", "pg-cloudflare"]
|
|
2277
2330
|
}
|
|
2278
2331
|
});
|
|
2279
2332
|
this.cluster.secret.grantRead(this.replicationFunction);
|
|
@@ -7117,6 +7170,7 @@ _OpenHiAuthService.SERVICE_TYPE = "auth";
|
|
|
7117
7170
|
var OpenHiAuthService = _OpenHiAuthService;
|
|
7118
7171
|
|
|
7119
7172
|
// src/services/open-hi-rest-api-service.ts
|
|
7173
|
+
var import_config5 = __toESM(require_lib());
|
|
7120
7174
|
var import_aws_apigatewayv22 = require("aws-cdk-lib/aws-apigatewayv2");
|
|
7121
7175
|
var import_aws_apigatewayv2_authorizers = require("aws-cdk-lib/aws-apigatewayv2-authorizers");
|
|
7122
7176
|
var import_aws_apigatewayv2_integrations = require("aws-cdk-lib/aws-apigatewayv2-integrations");
|
|
@@ -7195,7 +7249,31 @@ var RestApiLambda = class extends import_constructs20.Construct {
|
|
|
7195
7249
|
// src/services/open-hi-rest-api-service.ts
|
|
7196
7250
|
var REST_API_BASE_URL_SSM_NAME = "REST_API_BASE_URL";
|
|
7197
7251
|
var REST_API_DOMAIN_NAME_SSM_NAME = "REST_API_DOMAIN_NAME";
|
|
7252
|
+
var DEV_CORS_ALLOW_ORIGINS = [
|
|
7253
|
+
"http://localhost:3000",
|
|
7254
|
+
"https://localhost:3000",
|
|
7255
|
+
"http://localhost:5173",
|
|
7256
|
+
"https://localhost:5173",
|
|
7257
|
+
"http://127.0.0.1:3000",
|
|
7258
|
+
"https://127.0.0.1:3000",
|
|
7259
|
+
"http://127.0.0.1:5173",
|
|
7260
|
+
"https://127.0.0.1:5173"
|
|
7261
|
+
];
|
|
7198
7262
|
var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
7263
|
+
/**
|
|
7264
|
+
* Compose the REST API's full per-deploy domain. Thin wrapper over
|
|
7265
|
+
* {@link OpenHiService.composeServiceDomain} that pins `domainPrefix`
|
|
7266
|
+
* to {@link API_DOMAIN_PREFIX}.
|
|
7267
|
+
*
|
|
7268
|
+
* Use from sibling stacks that need to predict the API's hostname
|
|
7269
|
+
* before the REST API stack is synthesised.
|
|
7270
|
+
*/
|
|
7271
|
+
static composeFullDomain(opts) {
|
|
7272
|
+
return OpenHiService.composeServiceDomain({
|
|
7273
|
+
...opts,
|
|
7274
|
+
domainPrefix: _OpenHiRestApiService.API_DOMAIN_PREFIX
|
|
7275
|
+
});
|
|
7276
|
+
}
|
|
7199
7277
|
/**
|
|
7200
7278
|
* Returns an IHttpApi by looking up the REST API stack's HTTP API ID from SSM.
|
|
7201
7279
|
*/
|
|
@@ -7279,11 +7357,18 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7279
7357
|
}
|
|
7280
7358
|
/**
|
|
7281
7359
|
* Returns the API domain name string (e.g. api.example.com or api-\{prefix\}.example.com).
|
|
7360
|
+
* Delegates to {@link OpenHiRestApiService.composeFullDomain} so the
|
|
7361
|
+
* release-vs-feature composition stays in one place; picks up
|
|
7362
|
+
* `this.defaultReleaseBranch` (not a hard-coded `"main"`).
|
|
7282
7363
|
* Override to customize.
|
|
7283
7364
|
*/
|
|
7284
7365
|
createApiDomainNameString(hostedZone) {
|
|
7285
|
-
|
|
7286
|
-
|
|
7366
|
+
return _OpenHiRestApiService.composeFullDomain({
|
|
7367
|
+
branchName: this.branchName,
|
|
7368
|
+
defaultReleaseBranch: this.defaultReleaseBranch,
|
|
7369
|
+
childZonePrefix: this.childZonePrefix,
|
|
7370
|
+
zoneName: hostedZone.zoneName
|
|
7371
|
+
});
|
|
7287
7372
|
}
|
|
7288
7373
|
/**
|
|
7289
7374
|
* Creates the SSM parameter for the REST API base URL.
|
|
@@ -7342,7 +7427,7 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7342
7427
|
postgresSecretArn,
|
|
7343
7428
|
postgresDatabase,
|
|
7344
7429
|
postgresSchema,
|
|
7345
|
-
|
|
7430
|
+
extraEnvironment
|
|
7346
7431
|
});
|
|
7347
7432
|
lambda.addToRolePolicy(
|
|
7348
7433
|
new import_aws_iam7.PolicyStatement({
|
|
@@ -7432,7 +7517,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7432
7517
|
routeKey: import_aws_apigatewayv22.HttpRouteKey.with("/{proxy+}", import_aws_apigatewayv22.HttpMethod.ANY),
|
|
7433
7518
|
integration
|
|
7434
7519
|
});
|
|
7435
|
-
const apiPrefix = this.
|
|
7520
|
+
const apiPrefix = this.apiDomainName.slice(
|
|
7521
|
+
0,
|
|
7522
|
+
-(hostedZone.zoneName.length + 1)
|
|
7523
|
+
);
|
|
7436
7524
|
new import_aws_route535.ARecord(this, `api-a-record-${apiPrefix}`, {
|
|
7437
7525
|
zone: hostedZone,
|
|
7438
7526
|
recordName: apiPrefix,
|
|
@@ -7458,27 +7546,10 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7458
7546
|
{ userPoolClients: [userPoolClient] }
|
|
7459
7547
|
);
|
|
7460
7548
|
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;
|
|
7549
|
+
const isNonProd = this.ohEnv.ohStage.stageType !== import_config5.OPEN_HI_STAGE.PROD;
|
|
7550
|
+
const callerOrigins = cors?.allowOrigins ?? [];
|
|
7551
|
+
const mergedOrigins = isNonProd ? Array.from(/* @__PURE__ */ new Set([...callerOrigins, ...DEV_CORS_ALLOW_ORIGINS])) : callerOrigins;
|
|
7552
|
+
const corsPreflight = cors !== void 0 || isNonProd ? this.buildCorsPreflightOptions(mergedOrigins, cors) : void 0;
|
|
7482
7553
|
const rootHttpApi = new RootHttpApi(this, {
|
|
7483
7554
|
...restRootHttpApiProps,
|
|
7484
7555
|
...corsPreflight !== void 0 && { corsPreflight },
|
|
@@ -7495,21 +7566,43 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7495
7566
|
});
|
|
7496
7567
|
return rootHttpApi;
|
|
7497
7568
|
}
|
|
7569
|
+
/**
|
|
7570
|
+
* Builds the full `CorsPreflightOptions` from a merged origins array,
|
|
7571
|
+
* filling defaults for `allowMethods`/`allowHeaders`/`allowCredentials`/
|
|
7572
|
+
* `maxAge` from the caller-supplied block when present.
|
|
7573
|
+
*/
|
|
7574
|
+
buildCorsPreflightOptions(allowOrigins, cors) {
|
|
7575
|
+
return {
|
|
7576
|
+
allowOrigins: [...allowOrigins],
|
|
7577
|
+
allowMethods: cors?.allowMethods ?? [
|
|
7578
|
+
import_aws_apigatewayv22.CorsHttpMethod.GET,
|
|
7579
|
+
import_aws_apigatewayv22.CorsHttpMethod.HEAD,
|
|
7580
|
+
import_aws_apigatewayv22.CorsHttpMethod.POST,
|
|
7581
|
+
import_aws_apigatewayv22.CorsHttpMethod.PUT,
|
|
7582
|
+
import_aws_apigatewayv22.CorsHttpMethod.PATCH,
|
|
7583
|
+
import_aws_apigatewayv22.CorsHttpMethod.DELETE,
|
|
7584
|
+
import_aws_apigatewayv22.CorsHttpMethod.OPTIONS
|
|
7585
|
+
],
|
|
7586
|
+
allowHeaders: cors?.allowHeaders ?? ["Content-Type", "Authorization"],
|
|
7587
|
+
allowCredentials: cors?.allowCredentials ?? true,
|
|
7588
|
+
maxAge: cors?.maxAge ?? import_core2.Duration.days(1),
|
|
7589
|
+
...cors?.exposeHeaders !== void 0 && {
|
|
7590
|
+
exposeHeaders: cors.exposeHeaders
|
|
7591
|
+
}
|
|
7592
|
+
};
|
|
7593
|
+
}
|
|
7498
7594
|
/**
|
|
7499
7595
|
* 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
|
-
*
|
|
7596
|
+
* exposes through `GET /control/runtime-config`. The four values are
|
|
7597
|
+
* always populated — the three Cognito IDs are resolved via SSM lookups
|
|
7598
|
+
* against the auth stack from a dedicated sub-scope (`runtime-config`)
|
|
7599
|
+
* so they don't collide with the user-pool / user-pool-client constructs
|
|
7600
|
+
* already created in {@link createRootHttpApi}, and `apiBaseUrl` is
|
|
7601
|
+
* derived from this stack's own custom domain. The OAuth callback URL
|
|
7602
|
+
* is no longer plumbed through the API — the admin-console derives it
|
|
7603
|
+
* client-side from `window.location.origin`.
|
|
7508
7604
|
*/
|
|
7509
7605
|
resolveRuntimeConfigEnvVars() {
|
|
7510
|
-
if (this.props.runtimeConfig === void 0) {
|
|
7511
|
-
return void 0;
|
|
7512
|
-
}
|
|
7513
7606
|
const cognitoScope = new import_constructs21.Construct(this, "runtime-config");
|
|
7514
7607
|
const userPool = OpenHiAuthService.userPoolFromConstruct(cognitoScope);
|
|
7515
7608
|
const userPoolClient = OpenHiAuthService.userPoolClientFromConstruct(cognitoScope);
|
|
@@ -7518,12 +7611,16 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7518
7611
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_ID: userPool.userPoolId,
|
|
7519
7612
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_CLIENT_ID: userPoolClient.userPoolClientId,
|
|
7520
7613
|
OPENHI_RUNTIME_CONFIG_COGNITO_DOMAIN_URL: cognitoDomainUrl,
|
|
7521
|
-
OPENHI_RUNTIME_CONFIG_COGNITO_REDIRECT_URI: this.props.runtimeConfig.cognitoRedirectUri,
|
|
7522
7614
|
OPENHI_RUNTIME_CONFIG_API_BASE_URL: `https://${this.apiDomainName}`
|
|
7523
7615
|
};
|
|
7524
7616
|
}
|
|
7525
7617
|
};
|
|
7526
7618
|
_OpenHiRestApiService.SERVICE_TYPE = "rest-api";
|
|
7619
|
+
/**
|
|
7620
|
+
* Sub-domain prefix used by the REST API. Release-branch hostname is
|
|
7621
|
+
* `api.<zone>`; per-PR preview hostname is `api-<childZonePrefix>.<zone>`.
|
|
7622
|
+
*/
|
|
7623
|
+
_OpenHiRestApiService.API_DOMAIN_PREFIX = "api";
|
|
7527
7624
|
var OpenHiRestApiService = _OpenHiRestApiService;
|
|
7528
7625
|
|
|
7529
7626
|
// src/services/open-hi-graphql-service.ts
|
|
@@ -7564,10 +7661,26 @@ _OpenHiGraphqlService.SERVICE_TYPE = "graphql-api";
|
|
|
7564
7661
|
var OpenHiGraphqlService = _OpenHiGraphqlService;
|
|
7565
7662
|
|
|
7566
7663
|
// src/services/open-hi-website-service.ts
|
|
7567
|
-
var
|
|
7664
|
+
var import_config6 = __toESM(require_lib());
|
|
7568
7665
|
var import_aws_s32 = require("aws-cdk-lib/aws-s3");
|
|
7569
7666
|
var SSM_PARAM_NAME_FULL_DOMAIN = "WEBSITE_FULL_DOMAIN";
|
|
7667
|
+
var ADMIN_DOMAIN_PREFIX = "admin";
|
|
7570
7668
|
var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
7669
|
+
/**
|
|
7670
|
+
* Compose the website's full per-deploy domain. Thin wrapper over
|
|
7671
|
+
* {@link OpenHiService.composeServiceDomain} that fills in
|
|
7672
|
+
* {@link DEFAULT_DOMAIN_PREFIX} when `domainPrefix` is omitted.
|
|
7673
|
+
*
|
|
7674
|
+
* Use from sibling stacks that need to predict the website's hostname
|
|
7675
|
+
* before the website stack is synthesised — e.g. the REST API stack
|
|
7676
|
+
* computing its CORS `allowOrigins` for the admin-console.
|
|
7677
|
+
*/
|
|
7678
|
+
static composeFullDomain(opts) {
|
|
7679
|
+
return OpenHiService.composeServiceDomain({
|
|
7680
|
+
...opts,
|
|
7681
|
+
domainPrefix: opts.domainPrefix ?? _OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX
|
|
7682
|
+
});
|
|
7683
|
+
}
|
|
7571
7684
|
/**
|
|
7572
7685
|
* Looks up the static-hosting bucket ARN published by the release-branch
|
|
7573
7686
|
* deploy of this service.
|
|
@@ -7686,16 +7799,24 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7686
7799
|
* every other deploy serves a per-PR preview at
|
|
7687
7800
|
* `\<domainPrefix\>-\<childZonePrefix\>.\<zone\>`
|
|
7688
7801
|
* (e.g. `admin-feat-1093-patient-migration.dev.openhi.org`).
|
|
7802
|
+
*
|
|
7803
|
+
* Delegates to {@link OpenHiWebsiteService.composeFullDomain} so the
|
|
7804
|
+
* release-vs-feature composition stays in one place.
|
|
7689
7805
|
*/
|
|
7690
7806
|
computeFullDomain(hostedZone) {
|
|
7691
|
-
|
|
7692
|
-
|
|
7807
|
+
return _OpenHiWebsiteService.composeFullDomain({
|
|
7808
|
+
domainPrefix: this.props.domainPrefix,
|
|
7809
|
+
branchName: this.branchName,
|
|
7810
|
+
defaultReleaseBranch: this.defaultReleaseBranch,
|
|
7811
|
+
childZonePrefix: this.childZonePrefix,
|
|
7812
|
+
zoneName: hostedZone.zoneName
|
|
7813
|
+
});
|
|
7693
7814
|
}
|
|
7694
7815
|
/**
|
|
7695
7816
|
* Returns the sub-domain label (left of the zone) for the current
|
|
7696
|
-
* deploy. Used
|
|
7697
|
-
*
|
|
7698
|
-
*
|
|
7817
|
+
* deploy. Used for the per-branch S3 key prefix passed to
|
|
7818
|
+
* {@link StaticContent} so the upload prefix always matches the
|
|
7819
|
+
* served hostname.
|
|
7699
7820
|
*
|
|
7700
7821
|
* Non-release deploys compose the per-PR slug as
|
|
7701
7822
|
* `\<domainPrefix\>-\<childZonePrefix\>`, mirroring the REST API's
|
|
@@ -7706,7 +7827,7 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7706
7827
|
*/
|
|
7707
7828
|
computeSubDomain() {
|
|
7708
7829
|
const isReleaseBranch = this.branchName === this.defaultReleaseBranch;
|
|
7709
|
-
const domainPrefix = this.props.domainPrefix ??
|
|
7830
|
+
const domainPrefix = this.props.domainPrefix ?? _OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX;
|
|
7710
7831
|
if (isReleaseBranch) {
|
|
7711
7832
|
return domainPrefix;
|
|
7712
7833
|
}
|
|
@@ -7733,7 +7854,7 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7733
7854
|
domainNames: [this.fullDomain, wildcardSan],
|
|
7734
7855
|
description: `OpenHI website (${this.fullDomain})`,
|
|
7735
7856
|
prefixPattern: PER_BRANCH_PREVIEW_PREFIX,
|
|
7736
|
-
enablePreviewLifecycle: this.ohEnv.ohStage.stageType !==
|
|
7857
|
+
enablePreviewLifecycle: this.ohEnv.ohStage.stageType !== import_config6.OPEN_HI_STAGE.PROD,
|
|
7737
7858
|
...restApi !== void 0 && { restApi }
|
|
7738
7859
|
});
|
|
7739
7860
|
}
|
|
@@ -7819,6 +7940,12 @@ var _OpenHiWebsiteService = class _OpenHiWebsiteService extends OpenHiService {
|
|
|
7819
7940
|
}
|
|
7820
7941
|
};
|
|
7821
7942
|
_OpenHiWebsiteService.SERVICE_TYPE = "website";
|
|
7943
|
+
/**
|
|
7944
|
+
* Default `domainPrefix` for this service when none is supplied.
|
|
7945
|
+
* Release-branch hostname is `www.<zone>`; per-PR preview hostname is
|
|
7946
|
+
* `www-<childZonePrefix>.<zone>`.
|
|
7947
|
+
*/
|
|
7948
|
+
_OpenHiWebsiteService.DEFAULT_DOMAIN_PREFIX = "www";
|
|
7822
7949
|
var OpenHiWebsiteService = _OpenHiWebsiteService;
|
|
7823
7950
|
|
|
7824
7951
|
// src/workflows/control-plane/owning-delete-cascade/events.ts
|
|
@@ -8323,6 +8450,7 @@ var RenameCascadeWorkflow = class extends import_constructs25.Construct {
|
|
|
8323
8450
|
};
|
|
8324
8451
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8325
8452
|
0 && (module.exports = {
|
|
8453
|
+
ADMIN_DOMAIN_PREFIX,
|
|
8326
8454
|
BRIDGED_STATUSES,
|
|
8327
8455
|
CLOUDFORMATION_EVENT_SOURCE,
|
|
8328
8456
|
CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE,
|
|
@@ -8347,6 +8475,7 @@ var RenameCascadeWorkflow = class extends import_constructs25.Construct {
|
|
|
8347
8475
|
DEMO_PERIOD,
|
|
8348
8476
|
DEMO_TENANT_SPECS,
|
|
8349
8477
|
DEMO_URN_SYSTEM,
|
|
8478
|
+
DEV_CORS_ALLOW_ORIGINS,
|
|
8350
8479
|
DEV_USERS,
|
|
8351
8480
|
DataEventBus,
|
|
8352
8481
|
DataStoreHistoricalArchive,
|