@openhi/constructs 0.0.128 → 0.0.129

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 CHANGED
@@ -1365,6 +1365,19 @@ declare class OpenHiAuthService extends OpenHiService {
1365
1365
  * Returns an IUserPoolDomain by looking up the Auth stack's User Pool Domain from SSM.
1366
1366
  */
1367
1367
  static userPoolDomainFromConstruct(scope: Construct): IUserPoolDomain;
1368
+ /**
1369
+ * Returns the full Cognito Hosted UI base URL (e.g.
1370
+ * `https://auth-abc.auth.us-east-2.amazoncognito.com`) by looking up
1371
+ * the Auth stack's User Pool Domain from SSM and composing it with the
1372
+ * calling stack's region.
1373
+ *
1374
+ * Equivalent to `UserPoolDomain.baseUrl()` on the concrete construct,
1375
+ * but works across stacks where the looked-up `IUserPoolDomain` is an
1376
+ * `Import` and does not carry the `baseUrl()` method. Assumes the
1377
+ * domain was created as a Cognito-managed prefix domain (the only
1378
+ * variant `OpenHiAuthService.createUserPoolDomain` produces).
1379
+ */
1380
+ static userPoolDomainBaseUrlFromConstruct(scope: Construct): string;
1368
1381
  /**
1369
1382
  * Returns an IKey (KMS) by looking up the Auth stack's User Pool KMS Key ARN from SSM.
1370
1383
  */
package/lib/index.d.ts CHANGED
@@ -2002,6 +2002,19 @@ declare class OpenHiAuthService extends OpenHiService {
2002
2002
  * Returns an IUserPoolDomain by looking up the Auth stack's User Pool Domain from SSM.
2003
2003
  */
2004
2004
  static userPoolDomainFromConstruct(scope: Construct): IUserPoolDomain;
2005
+ /**
2006
+ * Returns the full Cognito Hosted UI base URL (e.g.
2007
+ * `https://auth-abc.auth.us-east-2.amazoncognito.com`) by looking up
2008
+ * the Auth stack's User Pool Domain from SSM and composing it with the
2009
+ * calling stack's region.
2010
+ *
2011
+ * Equivalent to `UserPoolDomain.baseUrl()` on the concrete construct,
2012
+ * but works across stacks where the looked-up `IUserPoolDomain` is an
2013
+ * `Import` and does not carry the `baseUrl()` method. Assumes the
2014
+ * domain was created as a Cognito-managed prefix domain (the only
2015
+ * variant `OpenHiAuthService.createUserPoolDomain` produces).
2016
+ */
2017
+ static userPoolDomainBaseUrlFromConstruct(scope: Construct): string;
2005
2018
  /**
2006
2019
  * Returns an IKey (KMS) by looking up the Auth stack's User Pool KMS Key ARN from SSM.
2007
2020
  */
package/lib/index.js CHANGED
@@ -6747,6 +6747,26 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
6747
6747
  });
6748
6748
  return import_aws_cognito4.UserPoolDomain.fromDomainName(scope, "user-pool-domain", domainName);
6749
6749
  }
6750
+ /**
6751
+ * Returns the full Cognito Hosted UI base URL (e.g.
6752
+ * `https://auth-abc.auth.us-east-2.amazoncognito.com`) by looking up
6753
+ * the Auth stack's User Pool Domain from SSM and composing it with the
6754
+ * calling stack's region.
6755
+ *
6756
+ * Equivalent to `UserPoolDomain.baseUrl()` on the concrete construct,
6757
+ * but works across stacks where the looked-up `IUserPoolDomain` is an
6758
+ * `Import` and does not carry the `baseUrl()` method. Assumes the
6759
+ * domain was created as a Cognito-managed prefix domain (the only
6760
+ * variant `OpenHiAuthService.createUserPoolDomain` produces).
6761
+ */
6762
+ static userPoolDomainBaseUrlFromConstruct(scope) {
6763
+ const domainName = DiscoverableStringParameter.valueForLookupName(scope, {
6764
+ ssmParamName: CognitoUserPoolDomain.SSM_PARAM_NAME,
6765
+ serviceType: _OpenHiAuthService.SERVICE_TYPE
6766
+ });
6767
+ const region = import_core.Stack.of(scope).region;
6768
+ return `https://${domainName}.auth.${region}.amazoncognito.com`;
6769
+ }
6750
6770
  /**
6751
6771
  * Returns an IKey (KMS) by looking up the Auth stack's User Pool KMS Key ARN from SSM.
6752
6772
  */
@@ -7344,11 +7364,11 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
7344
7364
  const cognitoScope = new import_constructs21.Construct(this, "runtime-config");
7345
7365
  const userPool = OpenHiAuthService.userPoolFromConstruct(cognitoScope);
7346
7366
  const userPoolClient = OpenHiAuthService.userPoolClientFromConstruct(cognitoScope);
7347
- const userPoolDomain = OpenHiAuthService.userPoolDomainFromConstruct(cognitoScope);
7367
+ const cognitoDomainUrl = OpenHiAuthService.userPoolDomainBaseUrlFromConstruct(cognitoScope);
7348
7368
  return {
7349
7369
  OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_ID: userPool.userPoolId,
7350
7370
  OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_CLIENT_ID: userPoolClient.userPoolClientId,
7351
- OPENHI_RUNTIME_CONFIG_COGNITO_DOMAIN: userPoolDomain.domainName,
7371
+ OPENHI_RUNTIME_CONFIG_COGNITO_DOMAIN_URL: cognitoDomainUrl,
7352
7372
  OPENHI_RUNTIME_CONFIG_COGNITO_REDIRECT_URI: this.props.runtimeConfig.cognitoRedirectUri,
7353
7373
  OPENHI_RUNTIME_CONFIG_API_BASE_URL: this.props.runtimeConfig.apiBaseUrl
7354
7374
  };