@ts-cloud/core 0.7.25 → 0.7.27

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22339,6 +22339,16 @@ function apexOf(domain) {
22339
22339
  const parts = domain.split(".").filter(Boolean);
22340
22340
  return parts.length <= 2 ? domain : parts.slice(-2).join(".");
22341
22341
  }
22342
+ function dashboardHostFor(domain, ownedDomains) {
22343
+ const apex = apexOf(domain);
22344
+ if (apex === domain)
22345
+ return `dashboard.${apex}`;
22346
+ for (const owned of ownedDomains) {
22347
+ if (owned === apex)
22348
+ return `dashboard.${apex}`;
22349
+ }
22350
+ return `dashboard.${domain}`;
22351
+ }
22342
22352
  function collectDomains(config, environment) {
22343
22353
  const candidates = [];
22344
22354
  const dnsDomain = config.infrastructure?.dns?.domain;
@@ -22361,21 +22371,23 @@ function collectDomains(config, environment) {
22361
22371
  function resolveDashboardDomain(config, environment, explicit) {
22362
22372
  if (explicit)
22363
22373
  return explicit;
22364
- const base = collectDomains(config, environment)[0];
22374
+ const domains = collectDomains(config, environment);
22375
+ const base = domains[0];
22365
22376
  if (!base)
22366
22377
  return null;
22367
- return `dashboard.${apexOf(base)}`;
22378
+ return dashboardHostFor(base, domains);
22368
22379
  }
22369
22380
  function resolveDashboardDomains(config, environment, explicit) {
22370
22381
  if (explicit)
22371
22382
  return [explicit];
22372
- const apexes = [];
22373
- for (const d of collectDomains(config, environment)) {
22374
- const apex = apexOf(d);
22375
- if (!apexes.includes(apex))
22376
- apexes.push(apex);
22377
- }
22378
- return apexes.map((apex) => `dashboard.${apex}`);
22383
+ const domains = collectDomains(config, environment);
22384
+ const hosts = [];
22385
+ for (const d of domains) {
22386
+ const host = dashboardHostFor(d, domains);
22387
+ if (!hosts.includes(host))
22388
+ hosts.push(host);
22389
+ }
22390
+ return hosts;
22379
22391
  }
22380
22392
  function hasManagementDashboardSite(config) {
22381
22393
  return Object.entries(config.sites ?? {}).some(([name, site]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
- "version": "0.7.25",
3
+ "version": "0.7.27",
4
4
  "type": "module",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.7.25"
34
+ "@ts-cloud/aws-types": "0.7.27"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"