import { type FieldValue, type Operation, type PushPolicy, type RefValue } from "../ir/operations.js"; import { type FieldDefinition, type DesignParameter } from "../schema/recipe.js"; import { type ImageMediaSink } from "./media.js"; /** * Build the field-default entries for a template's `__Standard Values` * item. Each entry carries the field's recipe-derived `fieldId` AND * `fieldName` — Sitecore resolves recipe-created field GUIDs by name * against the SV item's template (the recipe-derived id won't match the * tenant's server-assigned field-definition id; the name lookup is what * actually writes the value). * * Reference-shape defaults (link / image / treelist, plus * non-enum-backed droplink) are skipped silently — those need encoded * GUIDs or structured payloads that the simple `default: "string"` * recipe surface can't express. Authors who need defaults for those * can layer them in via a `ContentItemRecipe` that targets the SV * path explicitly. * * Enum-shaped fields branch on the resolved Type: * - **Type=Droplist** (override): default is the raw string. Droplist * reads its options from a pipe-separated Source; SV default is a * name match against that list. * - **Type=Droplink + `sitecore.enumHandle`** (the canonical shared * enum shape): default is a `ref-recipe` GUID reference to the * value item under `enumerationFolderId(site, enumHandle)`. * - **Type=Droplink without `sitecore.enumHandle`** (inline Droplink): * unsupported — `resolveFieldSource` rejects it upstream and this * function throws defensively if it ever reaches here. * * If the declared default isn't actually one of the enum's values, the * derived GUID won't exist on the tenant and the SV write fails at * apply time — author error, not silently masked here. */ /** * One non-primary-language `__Standard Values` field version — emitted * (via {@link emitStandardValuesLocaleVersions}) as an `AddItemVersion` * followed by a versioned `SetField` after the SV `CreateItem`. */ export interface StandardValuesLocaleVersion { fieldId: string; fieldName: string; language: string; value: RefValue; } /** * Result of {@link buildStandardValuesFieldEntries}: the primary-language * (`en`) field entries that go straight into the SV `CreateItem.fields`, * plus any non-primary language versions a locale-map default declared. */ export interface StandardValuesBuild { primary: FieldValue[]; localeVersions: StandardValuesLocaleVersion[]; } export declare function buildStandardValuesFieldEntries(site: string, handle: string, fields: ReadonlyArray, fieldIdResolver?: (site: string, handle: string, fieldName: string) => string, imageMediaSink?: ImageMediaSink, availableLanguages?: readonly string[]): StandardValuesBuild; /** * Emit the non-primary language versions a locale-map default produced. * Mirrors the dictionary translation pattern: a `SetField` against a * language with no version yet fails with "item … does not contain * version #1 in ''", so each new language gets one * `AddItemVersion` before its `SetField`(s). Call AFTER the SV * `CreateItem` (which materialises the primary-language version) and its * `SetStandardValues` link. */ export declare function emitStandardValuesLocaleVersions(operations: Operation[], standardValuesRefKey: string, localeVersions: readonly StandardValuesLocaleVersion[], policy: PushPolicy, labelPrefix: string): void;