import type { RefValue } from "../ir/operations.js"; /** * Render a typed `RefValue` to the canonical Sitecore string form. * * Sitecore field storage is always a string — the `RefValue` discriminator * tells us *how* to serialize that string for Sitecore to understand it. * See `plans/sitecore-relationships.md` (Reference encoding patterns) for * the per-pattern serialization rules. * * `ref-recipe` / `ref-recipe-list` cannot be rendered directly — the * executor must resolve their `refKey` against the per-run captured-itemId * map first (see `resolveRecipeRefs` below). Calling `renderRefValue` on * an unresolved recipe-ref is a programmer error. */ export declare const renderRefValue: (value: RefValue) => string; /** * Substitute recipe-internal refKey GUIDs EMBEDDED IN A STRING with their * captured tenant itemIds. * * Layout XML (`__Renderings` / `__Final Renderings`) is compiled to a * plain string with `renderingId(site, handle)` / `contentItemId(...)` / * `variantId(...)` uuidv5 refKeys baked in — but the Authoring API mints * its own item ids at create time (`CreateItemInput` carries no id), so * those refKeys never match anything on the tenant. Every GUID-shaped * token in the string is looked up in the captured map: hits are * replaced with the real (dashed, uppercase) tenant id, misses pass * through untouched — real Sitecore constants (device ids, the JSON * layout definition) and tenant-pre-existing GUIDs are never in the * captured map, so they survive verbatim. A uuidv5 refKey colliding * with an unrelated real GUID is cryptographically negligible. */ export declare const substituteCapturedGuids: (text: string, capturedItemIds: ReadonlyMap) => string; /** * Hotlink fallback for a `media-xml-ref` whose producer `MediaUpload` * failed to source its bytes from an EXTERNAL URL (dead link, blocked * host, transient 5xx). Keyed by the MediaUpload op's refKey; populated * by `planMediaUpload` when it marks the upload `error`. The resolver * degrades the referencing field to the legacy `` form * instead of aborting the whole recipe — imagery is progressive * enhancement, so hotlinking stays the fallback when ingest fails. * Asset-source (repo-local file) failures never populate this map: a * missing checked-in asset is an authoring bug and must keep failing * hard via the resolver throw below. */ export interface MediaFallback { url: string; alt?: string; } /** * The legacy hotlink image XML (`…`). Known * trade-off: the `src=` form shows in Pages' field editor but does not * render via the Layout Service — an author can re-pick the image. It * is still strictly better than losing the whole page install. */ export declare const renderMediaFallbackXml: (fallback: MediaFallback) => string; /** * Substitute every `ref-recipe` / `ref-recipe-list` against the captured * Sitecore itemId map. Returns a new `RefValue` with `ref-guid` / * `ref-guid-list` in their place. Throws when a refKey is missing — that * indicates a topological ordering bug (executor referenced an item that * hadn't been created yet). * * `string` values are scanned for embedded refKey GUIDs (see * `substituteCapturedGuids`) — the seam that makes compile-time layout * XML resolve against server-assigned item ids. * * `mediaFallbacks` (optional) degrades `media-xml-ref` misses whose * producer `MediaUpload` failed on an external URL — see * {@link MediaFallback}. A miss with NEITHER capture nor fallback is a * real producer/ordering bug and keeps throwing. */ export declare const resolveRecipeRefs: (value: RefValue, capturedItemIds: ReadonlyMap, mediaFallbacks?: ReadonlyMap) => RefValue; /** * Normalise a Sitecore itemId to the canonical 8-4-4-4-12 dashed * form. Authoring GraphQL returns IDs without dashes * (`825b30b4b40b422e992023a1b6bda89c`), but Sitecore's Treelist * field-value parser only resolves IDs in dashed form * (`{825B30B4-B40B-422E-9920-23A1B6BDA89C}`). Without this, multilist * field values written by `toCurly` come out as `{NODASH}` and the * editor renders "Item not found" for every entry even though the * items exist. * * Returns input unchanged (lowercased) when the value isn't a 32-hex * GUID — defensive against ref values that aren't actual itemIds. */ export declare const dashifyGuid: (guid: string) => string; /** * Sitecore per-level name equality. Item names are unique per level * CASE-INSENSITIVELY — `createItem` rejects a name that differs from an * existing sibling's only by case (or surrounding whitespace) with * `already defined on this level`. Every sibling-match probe (the * planner's sibling fallback, the authoring client's `idempotencyCheck` * pre-create and already-exists adoption) must compare names with the * same semantics, or an existing item the server treats as a duplicate * becomes an unrecoverable collision. */ export declare const sameLevelItemName: (a: string, b: string) => boolean;