import { type HygieneCommonOptions } from "../shared.js"; export interface CleanupVersionsPruneOptions extends HygieneCommonOptions { /** * Required. Number of most-recent versions to keep per (item, language). * Older versions are deleted. Must be >= 1. */ keep: number; /** * Required scope. Prune is restricted to descendants of this content * path — there's no tenant-wide form. This is a guardrail: a stray * `--keep 1` against `/sitecore` would otherwise mass-delete platform * version history. */ root: string; /** * Restrict pruning to one language. Defaults to all languages found * for each item. */ language?: string; /** Cap on items inspected. Default 5000. */ limit?: number; /** Override the search index. */ index?: string; /** Concurrency for version reads + deletes. Default 4. */ concurrency?: number; /** Include system items. Off by default. */ includeSystem?: boolean; whatIf?: boolean; allowWrite?: boolean; /** * Override the default safety guard that refuses to operate against * `/sitecore/system` or `/sitecore/templates` even when those are the * `--root`. Off by default. Set only when intentionally pruning * platform-area versions. */ force?: boolean; } export interface VersionPruneAction { itemId: string; path: string; language: string; versionsBefore: number; versionsAfter: number; deletedVersions: number[]; errors: string[]; } /** * Prune per-item, per-language version history down to the N most recent * versions. * * Safety rails: * - `--root` is required. The command never operates tenant-wide * because a stray `--keep 1` would mass-delete platform versions. * - `--keep` must be >= 1. Setting it to zero would orphan a language * entry with no versions (the very pattern `audit language-data * list` flags). * - The `/sitecore/system`, `/sitecore/templates/System`, and * `/sitecore/layout/Layouts/System` subtrees are protected; the * prune refuses to operate on those paths unless `--force` is also * set. * - Without `--what-if`, the environment must have `allowWrite: true` * (or `--allow-write` passed). Same contract as serialization push * / recipe push. * * Behavior: * 1. Search for items under `--root` (one row per language). For each * observed (item, language), fetch the version list via * `getItemVersions`. If the list has more than `--keep` entries, * schedule deletes for the oldest (`length - keep`) entries. * 2. Under `--what-if`, just emit the plan and return. * 3. Otherwise, execute `deleteItemVersion` sequentially per item * (concurrent across items, bounded by `--concurrency`). Failures * collect into the item's `errors` array but don't abort other * items — the report shows partial success. */ export declare const runCleanupVersionsPrune: (options: CleanupVersionsPruneOptions) => Promise;