import type { Pool, PoolClient } from 'pg'; import type { LandingPageRecord } from './manifest.js'; /** * Landing pages shipped by a theme (`theme.json` → `landingPages[]`). * * Landing pages are NOT theme property: the `landing_page` row has no theme * column, so a page installed by a theme stays reachable after a theme switch * — only its body (theme-bucketed `widget_placement` rows) follows the active * theme. "A theme's pages" is therefore DERIVED: pages with at least one * placement in that theme's bucket. See * specifications/theme-json-landing-pages.md. */ /** url_keys of homepage backups made by "Replace homepage" — never a theme's content. */ export declare const HOMEPAGE_BACKUP_URL_KEY_PREFIX = "homepage-backup-"; /** Landing-page fields a manifest can carry (never `url_key`, never the schedule). */ export declare const LANDING_PAGE_MANIFEST_FIELDS: readonly ["name", "description", "meta_title", "meta_description", "status"]; export type LandingPageField = (typeof LANDING_PAGE_MANIFEST_FIELDS)[number]; export declare function landingPageUrn(uuid: string): string; /** * Single-segment static storefront paths (`/cart`, `/search`, …). A url_key * equal to one of these would never reach the `url_rewrite` fallback, so the * page would 404 — the same rule `assertUrlKeyAvailable` enforces at runtime. * * The CLI never bootstraps modules, so this scans `route.json` files straight * off disk. Extensions are not scanned (they need a compiled `dist/` and the * loader's env branching); a collision with an extension route is caught later * by the same check running in `assertUrlKeyAvailable` when the merchant edits * the page. Failures degrade to an empty set rather than blocking an install. */ export declare function reservedStorefrontSlugs(): Set; export interface UrlKeyGuard { reserved: Set; locales: Set; } export declare function loadUrlKeyGuard(): Promise; /** * Is `key` unusable as a landing-page url_key? True when it is shadowed by a * static route or a locale prefix, or already owned by any `url_rewrite` row * or landing page. Mirrors `assertUrlKeyAvailable`, minus the same-entity * exemption (generation only ever runs for a brand-new page). */ export declare function isUrlKeyTaken(conn: Pool | PoolClient, key: string, guard: UrlKeyGuard): Promise; /** * Derive a free url_key from a page's name (decision D3): the manifest never * carries one, so a theme cannot promise a URL and two stores may land the * same page at different paths. Inside the theme nothing depends on it — * widget links target the page by URN. * * `random5` is injectable so the generator stays deterministic under test. */ export declare function generateUrlKey(conn: Pool | PoolClient, page: { uuid: string; name: string; }, guard: UrlKeyGuard, random5?: () => string): Promise; export interface LandingPageRow { landing_page_id: number; uuid: string; url_key: string; } export declare function findLandingPagesByUuid(conn: Pool | PoolClient, uuids: string[]): Promise>; /** Keep a landing page's root-level friendly URL in sync (mirrors `syncLandingPageUrlRewrite`). */ export declare function syncUrlRewrite(conn: PoolClient, uuid: string, urlKey: string): Promise; /** * Create a landing page from a manifest record. The url_key is generated here * and is merchant data from this moment on — never merged on upgrade, never * exported. */ export declare function insertLandingPage(conn: PoolClient, page: LandingPageRecord, guard: UrlKeyGuard): Promise<{ urlKey: string; }>; export declare function updateLandingPageFields(conn: PoolClient, uuid: string, changed: Record): Promise; export interface ExportablePage { uuid: string; name: string; url_key: string; description: string | null; meta_title: string | null; meta_description: string | null; status: boolean; } /** * Pages this theme has content on (D2): at least one placement in the theme's * bucket whose widget is enabled. Homepage backups are excluded — their bodies * are theme-stamped copies of a homepage, not theme content. */ export declare function derivePagesForTheme(conn: Pool | PoolClient, themeId: string): Promise;