/** * Renderer for the structured source fields on `SitecoreFieldAugment`. * * The recipe author surface decomposes Sitecore's `Source` field into * orthogonal pieces: * * sourceTypes string[] — picker filter (template handles) * sourceQuery string — where to look (Sitecore Query) * sourceScope string — where to look (fixed content path) * sourceRaw string — escape hatch (verbatim Source string) * sourcePlugin string — Marketplace plugin app_id UUID (the * resolved value of `source.defaultAppId` * after the orchestrator applies any * per-org override; paired with * `sitecore.type: "Plugin"`) * * `renderSourceFields` composes them into the URL-encoded Source value * Sitecore expects. The combinations preserve longstanding Sitecore * semantics: * * sourceQuery alone → `query:` (Droplist shorthand) * sourceTypes alone → `IncludeTemplatesForSelection={GUID},...` * sourceScope alone → `DataSource=` * sourceQuery + types → `DataSource=query:&IncludeTemplatesForSelection=...` * sourceScope + types → `DataSource=&IncludeTemplatesForSelection=...` * sourceRaw → verbatim, ignores everything else * sourcePlugin → verbatim UUID, ignores everything else * * Authors who need a Source form outside this surface (e.g. a bare * `/sitecore/content/Tags` Treelist source) use `sourceRaw`. Authors * mounting a Marketplace plugin use `source: { kind: "plugin", id, defaultAppId }` * paired with `type: "Plugin"`; the orchestrator pre-resolves the * effective app_id (override or default) and inlines it as `defaultAppId` * before scai sees the recipe. */ export interface SourceFields { sourceTypes?: readonly string[]; sourceQuery?: string; sourceScope?: string; sourceRaw?: string; sourcePlugin?: string; } /** * Compose structured source fields into the Sitecore-encoded Source string. * `resolveHandle` maps a recipe handle to its deterministic template GUID * (typically `templateId(handle)` from `guids.ts`). * * Returns `undefined` when no source fields are set — callers can use this * to decide whether to emit the Source field at all. */ export declare const renderSourceFields: (fields: SourceFields, resolveHandle: (handle: string) => string) => string | undefined; /** * True when the structured source fields require recipe-handle resolution * to render. The compiler uses this to decide between emitting a plain * `string` RefValue at compile time vs deferring to the executor via * `ref-source-fields`. */ export declare const sourceFieldsNeedHandleResolution: (fields: SourceFields) => boolean; /** * Convert the author-surface `SitecoreFieldSource` discriminated union * to the flat `SourceFields` bag the renderer + IR consume. Internal * adapter — author surface stays union-shaped (clean for JSON Schema * and Agent Studio), compiler internals stay flat-shaped (clean for * `renderSourceFields` and the `ref-source-fields` IR op). * * Returns an empty bag when `source` is undefined, so callers can * unconditionally invoke this and feed the result to * `renderSourceFields` / `sourceFieldsNeedHandleResolution`. */ export declare const augmentSourceToFields: (source: { kind: "filter"; types?: readonly string[]; query?: string; scope?: string; } | { kind: "raw"; value: string; } | { kind: "plugin"; id: string; defaultAppId: string; } | undefined) => SourceFields; /** * Apply the per-org marketplace plugin override map to a source. When * the source is a `plugin` reference and its `id` (the recipe-side * `plugin_key`) is in `overrides`, swap the `defaultAppId` UUID for the * override value. Non-plugin sources pass through unchanged, as do * plugin sources with no matching override entry. Returns the original * source object identity when no substitution applies so callers can * cheaply check for "did it change?". * * The override map is supplied by the orchestrator at recipe-sync * preflight (from `internal.marketplace_plugin_overrides`) and read out * of `sitecoreai.cli.json`'s top-level `marketplacePluginOverrides` * field. Recipes that ship `defaultAppId` from the recipe author remain * valid when no overrides apply — they just emit the recipe-author's * UUID verbatim. */ export declare const applyMarketplacePluginOverride: (source: T, overrides: Record | undefined) => T;