/** * Discover SXA sites in a Sitecore CM environment via the Authoring * GraphQL API. * * Cross-domain home of site discovery (deploy / hygiene / publishing all * use it); `recipe/api/site-discovery.ts` is now a published-API * forwarder that re-exports from here. * * The convention this walks: each CM environment has a single tenant * at `/sitecore/content/` with one or more sites under it at * `/sitecore/content//`. Tenants and sites are identified * by template name match rather than hard-coded template GUIDs so * the discovery is resilient across SXA / XM Cloud variants: * * - Tenant: `Tenant`, `Tenant Folder`, `Headless Tenant`, * `Headless Tenant Folder` * - Site: `Site`, `Headless Site` * * Two round trips minimum: * 1. children of `/sitecore/content` → candidate tenants * 2. children of each tenant → candidate sites * * Sites typically expose hostnames via a `Settings/Site Grouping/` * sub-item. Walking deeper for hostnames is opt-in (`includeHostnames`) * because it adds an N+1 round trip per site. */ import type { EnvironmentConfiguration } from "../config/types.js"; export type DiscoveredSite = { /** Item name (URL-safe slug). Used as the SXA site name. */ name: string; /** Display name from the item, or the item name if not set. */ displayName: string; /** Full Sitecore content path, e.g. `/sitecore/content/MyTenant/MySite`. */ path: string; /** Parent tenant's item name. */ tenantName: string; /** Parent tenant's full path. */ tenantPath: string; /** Hostnames declared by `Settings/Site Grouping/` items. * Populated only when `includeHostnames: true` is requested. */ hostnames?: string[]; }; export type DiscoverSitesOptions = { /** Resolve each site's hostnames from its Site Grouping sub-items. * Adds N+1 GraphQL round trips. Defaults to false. */ includeHostnames?: boolean; /** Override the content root walked. Default `/sitecore/content`. * Useful for tests or for installations that nest content under a * non-default root. */ contentRoot?: string; }; export declare const discoverSites: (environment: EnvironmentConfiguration, options?: DiscoverSitesOptions) => Promise;