import { type HygieneCommonOptions } from "../shared.js";
export interface AuditBrokenLinksOptions extends HygieneCommonOptions {
/**
* Limit the scan to descendants of this content-tree path (or itemId).
* Defaults to `/sitecore/content` — most authored content lives there
* and scanning the full master DB is rarely useful.
*/
root?: string;
index?: string;
limit?: number;
includeSystem?: boolean;
batchSize?: number;
concurrency?: number;
pageParallelism?: number;
/** Opt-in to the on-disk field cache for this run. */
cache?: boolean;
}
export interface BrokenLinkReport {
itemId: string;
path: string;
templateName?: string | null;
language?: string | null;
brokenRefs: Array<{
fieldName: string;
refItemId: string;
}>;
}
/**
* Audit content for internal links that target items that don't exist.
*
* Strategy (XM Cloud Authoring API only — no direct link-database query):
*
* 1. Use `scanItemsAndFields` to page through `search` and batch-fetch
* fields. The helper applies the active perf knobs (concurrency,
* batchSize, pageParallelism) and the optional on-disk field cache.
* 2. Run `extractInternalRefs` over field values to collect referenced
* itemIds (RichText `` tags, bare GUIDs, pipe-delimited
* Multilist values).
* 3. Resolve refs in bulk via `itemsExistBatch` — same concurrency as
* field reads.
* 4. Emit a report row for every (item, field, ref) where ref doesn't
* resolve.
*
* Notes:
* - Scoped to **internal** Sitecore item refs only — external URLs
* and media refs aren't surfaced here. `audit unused-media list`
* handles the media side.
* - The dotnet `Sitecore.DevEx` plugin had access to the SQL-backed
* link database, which is O(N) in references rather than O(N) in
* items + O(R) in refs. The Authoring GraphQL path is fundamentally
* more expensive, hence the `--limit` cap.
*/
export declare const runAuditBrokenLinks: (options: AuditBrokenLinksOptions) => Promise;