import { type HygieneCommonOptions } from "../shared.js"; export interface AuditReferencesOptions extends HygieneCommonOptions { /** Required. Item ID to find inbound references for. Any GUID form accepted. */ to?: string; /** Content root to scan. Default `/sitecore/content`. */ root?: string; index?: string; limit?: number; includeSystem?: boolean; language?: string; batchSize?: number; concurrency?: number; pageParallelism?: number; cache?: boolean; /** Include `__`-prefixed system fields in the scan. On by default — that's where most refs live. */ includeSystemFields?: boolean; /** Restrict the scan to these field names. */ fields?: string[]; /** * Suppress the audit's own report. Used by cleanup tasks that call * this audit as a pre-flight check and surface blockers in their own * combined report rather than as a separate audit record. Pair with * `cache: true` when running back-to-back checks against the same * `--root` so subsequent calls hit the field cache. Default false. */ silent?: boolean; } export interface ReferenceReport { itemId: string; path: string; templateName: string | null; language: string | null; /** One entry per field that mentions the target. */ matches: Array<{ fieldName: string; /** * How the target appears in the field value: as a raw 32-char id * (`abc123…`), a dashed id (`abc-123-…`), a curly-wrapped id * (`{abc-123-…}`), or a path that contains the target's normalized * id. Mostly diagnostic — the operator usually just needs to know * "this field references the target," not which form. */ form: "flat" | "dashed" | "curly-upper" | "curly-lower" | "path-ancestor"; }>; } /** * Inbound-reference scan: walk items + fields under `--root` and * report every field whose value mentions the target item id in any * of the canonical Sitecore GUID forms. The companion primitive to * `audit template-dependencies` — that audit uses the search index's * indexed-field criteria (template-specific signals like `__masters`, * `_basetemplates`); this one walks raw field values to catch the * long tail of custom droplist/treelist/link fields the index doesn't * classify. * * Performance: cost scales with `--root` size, not with how many * references actually exist. On a tenant with 50k items, expect * 30s–2min depending on `--page-parallelism` and `--concurrency`. The * field cache (`--cache`) makes re-runs against the same root nearly * free for the unchanged items. * * Use this when: * - The target is NOT a template (template-dependencies has stronger * signals for templates). * - `audit template-dependencies` returned empty and you suspect a * custom field type the index doesn't classify. * - You need to find every author-facing field referencing a media * item / rendering / data-source before deleting it. */ export declare const runAuditReferences: (options: AuditReferencesOptions) => Promise;