import { type HygieneCommonOptions } from "../shared.js";
export interface AuditUnusedMediaOptions extends HygieneCommonOptions {
/**
* Root of the media library to scan. Defaults to
* `/sitecore/media library`. Override only for tenants that nest media
* under a non-default location (rare on XM Cloud).
*/
mediaRoot?: string;
/**
* Root under which references to media items are looked for. Defaults
* to `/sitecore/content` — most refs come from rendered content. To
* also include site definitions or design templates, broaden this
* to `/sitecore`.
*/
referenceRoot?: string;
/** Override the search index. */
index?: string;
/** Cap on the number of media items inspected. Default 5000. */
mediaLimit?: number;
/** Cap on the number of reference-side items inspected. Default 10000. */
referenceLimit?: number;
/** Batch size for item-fields lookups. Default 25. */
batchSize?: number;
}
export interface UnusedMediaReport {
itemId: string;
path: string;
templateName?: string | null;
size?: number | null;
}
/**
* Audit `/sitecore/media library` for media items that aren't referenced
* by any content item.
*
* Strategy (two-pass scan, both via the search index):
*
* 1. Enumerate every media item under `--media-root`. These become
* candidates for "unused."
* 2. Enumerate every non-media item under `--reference-root` (default
* `/sitecore/content`). For each, fetch all fields in batches and
* run `extractMediaRefs` over field values. The output is the set
* of media itemIds that *are* referenced.
* 3. Subtract: candidates minus referenced = unused media.
*
* Notes:
* - The Authoring API exposes neither a "where-used" query nor a link
* database read surface. This is the cheapest correct approach.
* - False positives are possible when a media item is referenced from
* content stored OUTSIDE `--reference-root` (e.g. presentation
* definitions under `/sitecore/layout` or rendering parameters in
* non-content trees). Operators with mixed content/layout media
* references should re-run with `--reference-root /sitecore`.
* - References from RichText `` tags and Image
* field XML (``) are recognised; bare GUIDs in
* Multilist fields targeting media are also captured by
* `extractInternalRefs` and filtered against the candidates set.
*/
export declare const runAuditUnusedMedia: (options: AuditUnusedMediaOptions) => Promise;