import { type Operation, type PushPolicy } from "../ir/operations.js"; import { type FieldDefinition } from "../schema/recipe.js"; import { type CompileContext } from "./shared.js"; export interface DatasourceTemplateInput { handle: string; name: string; displayName: string; fields: FieldDefinition[]; insertOptions?: string[]; /** * Where external-URL image DEFAULTS (Standard Values) land in the * media library. Site scope only — SVs are template-level, not * page-bound; `resolveMediaLocationFolder` rejects `scope: "page"`. */ mediaLocation?: { scope: "page" | "site"; subfolder?: string; }; /** * Optional override for the template's parent path. When set, the * template lands at `/` and `parent` resolves via * `ref-path`. When omitted, falls back to `context.templatesRoot` * for back-compat with the legacy flat layout. */ parentPath?: string; /** * Optional override for the template's parent — when the parent has * already been emitted as a CreateItem op in this set (e.g. a section * folder), passing the refKey here lets the planner resolve via the * captured-itemId map without needing a path-based lookup. Mutually * exclusive with `parentPath`'s refKey-as-string semantics. */ parentRefKey?: string; /** * Extra template GUIDs to append to the synthesised * `SetBaseTemplates` op (in addition to the implicit Standard * Template). Used by `compileComponentTemplateRecipe` to wire in the * SXA Foundation bases (`SXA_COMPONENT_BASE_TEMPLATES`) so the * resulting template is recognised as an SXA Headless component; * datasource-only callers (`compileContentTemplateRecipe`) leave it * unset so content templates stay shape-pure. */ additionalBaseTemplates?: readonly string[]; /** * Base templates resolved by TENANT PATH at apply time, forwarded to * the synthesised `SetBaseTemplates` op's `pathBases`. Used by * `compilePageTemplateRecipe` to inherit the SXA-scaffolded * `/sitecore/templates/Project//Page` when the tenant has * one, with the raw SXA Foundation page facets as the fallback. */ baseTemplatePathBases?: readonly { path: string; fallbackTemplates: string[]; }[]; /** * Drop the implicit Standard template from the synthesised * `SetBaseTemplates`. Set when `additionalBaseTemplates` already * chains Standard transitively (page templates: the SXA `Base Page` * facet carries it) — listing it explicitly is redundant noise in the * Content Editor's inheritance view. Callers using this MUST provide * a non-empty `additionalBaseTemplates` (base lists can't be empty). */ omitStandardBaseTemplate?: boolean; } export declare function emitDatasourceTemplate(operations: Operation[], recipe: DatasourceTemplateInput, context: CompileContext, icon: string, policy: PushPolicy): void;