import { type HygieneCommonOptions } from "../shared.js"; export type FieldSetMode = "replace" | "add" | "remove" | "clear"; export interface CleanupFieldSetOptions extends HygieneCommonOptions { /** * Required. Field name to write (case-insensitive against the item's * template). Single field per run — the verb is intentionally narrow * so the audit trail stays clear. */ field: string; /** * Required for `replace` and `add`/`remove`. The value to write: * - `replace`: written verbatim (any Sitecore wire shape — raw * string, `{guid}`, pipe-delimited list, `` XML, ISO date). * - `add` / `remove`: one or more GUIDs (with or without braces), * comma- or pipe-separated. Each is treated as a multilist * member to union with / subtract from the current value. * - `clear`: ignored; the field is wiped. */ value?: string; /** * How to combine `value` with the existing field state. * Default `replace`. * * - `replace`: overwrite the field with `value` verbatim. Works for * any field type — caller owns the wire shape. * - `add`: union the supplied GUIDs into a pipe-delimited list. * Reads the current value first; refuses if the existing value is * non-empty and isn't a pipe-delimited GUID list (avoids corrupting * Single-Line Text or RichText fields by accident). * - `remove`: subtract the supplied GUIDs from a pipe-delimited list. * Same shape guard as `add`. * - `clear`: write the empty string. * * The `add` / `remove` modes are the answer to "bulk tag-add" / * "bulk tag-remove" — Sitecore tags are TreelistEx fields whose * underlying wire format is `{guid1}|{guid2}|…`, so set-union and * set-difference are the right primitives. */ mode?: FieldSetMode; /** Restrict to descendants of this content-tree path. Default `/sitecore/content`. */ root?: string; /** Restrict by template name pattern. Strongly recommended. */ templatePattern?: string; /** Only update items whose current value of `field` matches this regex. */ whereCurrentMatches?: string; /** Restrict by language. Default: every language version of each item. */ language?: string; index?: string; limit?: number; includeSystem?: boolean; /** Allow writing to `__`-prefixed system fields. Off by default. */ includeSystemFields?: boolean; batchSize?: number; concurrency?: number; pageParallelism?: number; cache?: boolean; exclude?: string[]; since?: string; owner?: string; whatIf?: boolean; allowWrite?: boolean; baseline?: boolean; output?: string; format?: "json" | "csv" | "markdown"; /** * Maximum number of items mutated per run. Default 100 — defends * against an unintentionally-broad `--template-pattern` matching * thousands of items. */ maxMutations?: number; } export interface FieldSetAction { itemId: string; path: string; templateName: string | null; language: string | null; fieldName: string; mode: FieldSetMode; oldValue: string; newValue: string; status: "applied" | "what-if" | "failed" | "skipped-cap" | "skipped-no-change" | "skipped-shape"; error?: string; } export declare const runCleanupFieldSet: (options: CleanupFieldSetOptions) => Promise;