import { type ServiceResult } from '../models/service-result.js'; import { ProfilingDefinitionService } from '../services/ProfilingDefinitionService.js'; import { ProfilingSummaryService, type PurgeSummaryRecord, type SummaryDeleteProgressEvent } from '../services/ProfilingSummaryService.js'; /** * Options for the summary purge operation. */ export type SummaryPurgeOptions = { /** Target org username or alias */ targetOrg: string; /** Specific summary IDs to delete — exclusive mode */ ids?: string[]; /** Purge all summaries (can be combined with filter flags) */ all?: boolean; /** Filter by target object API name (resolves through definitions) */ objectName?: string; /** Filter by definition category */ category?: string; /** Filter by definition active status */ isActive?: boolean; /** Maximum number of summaries to process */ limit?: number; /** Only delete non-latest summaries (preserve latest per definition) */ prune?: boolean; /** Preview mode — categorize without deleting */ dryRun?: boolean; /** Skip interactive confirmation prompt */ noPrompt?: boolean; /** Callback when summaries are found */ onSummariesFound?: (count: number) => void; /** Callback for user confirmation before deletion */ onPreviewReady?: (preview: SummaryPurgePreview) => Promise; /** Progress callback for per-summary status updates */ onProgress?: (event: SummaryDeleteProgressEvent) => void; /** Optional logger */ logger?: Console; }; /** * Preview data for user confirmation. */ export type SummaryPurgePreview = { /** Summaries eligible for deletion */ deletable: PurgeSummaryRecord[]; /** Summaries skipped due to non-terminal status */ skippedByStatus: PurgeSummaryRecord[]; /** Summaries skipped because they are the latest (prune mode) */ skippedByPrune: PurgeSummaryRecord[]; /** Total summaries matched */ total: number; /** Whether prune mode is active */ pruneMode: boolean; }; /** * Result of a summary purge operation. */ export type SummaryPurgeResult = { /** Number of summaries successfully deleted */ deleted: number; /** Number of summaries skipped */ skipped: number; /** Number of summaries that failed to delete */ failed: number; /** Total number of summaries processed */ total: number; /** Summaries skipped by non-terminal status */ skippedByStatus: PurgeSummaryRecord[]; /** Summaries skipped by prune (latest preserved) */ skippedByPrune: PurgeSummaryRecord[]; /** Whether the operation was cancelled by the user */ cancelled?: boolean; /** Whether dry-run mode was active */ dryRun?: boolean; /** Dry-run preview data */ preview?: SummaryPurgePreview; }; /** * Error codes for summary purge operations. * Re-exported from ServiceErrorCodes (E4510-E4517) for convenience. */ export declare const SummaryPurgeErrorCodes: { readonly NO_SELECTION_CRITERIA: "E4510"; readonly MUTUALLY_EXCLUSIVE: "E4511"; readonly QUERY_FAILED: "E4512"; readonly NO_ELIGIBLE_SUMMARIES: "E4513"; readonly DELETE_FAILED: "E4514"; readonly USER_CANCELLED: "E4515"; readonly OPERATION_FAILED: "E4516"; readonly INVALID_IDS: "E4517"; }; /** * Orchestrates purging of profiling summaries. * * Supports two selection modes: * 1. ID mode: Delete specific summaries by ID (exclusive) * 2. Filter mode: Query definitions by filters, then resolve their summaries * * Two-level status filtering: * - Definition level: Exclude definitions with non-terminal statuses * - Summary level: Only delete summaries with terminal statuses * * Optional prune mode (--prune): Only delete non-latest summaries. */ export declare class SummaryPurgeOperation { private readonly definitionService; private readonly summaryService; private readonly logger?; constructor(definitionService: ProfilingDefinitionService, summaryService: ProfilingSummaryService, logger?: Console | undefined); /** * Creates the empty result structure. */ private static emptyResult; /** * Checks if filter flags are specified. */ private static hasFilterFlags; /** * Executes the summary purge operation. */ execute(options: SummaryPurgeOptions): Promise>; /** * Executes purge in ID mode: delete specific summaries by ID. * * Queries summaries directly by ID (O(requested) instead of O(all summaries)). * Terminal status filter is applied in the SOQL query. */ private executeIdMode; /** * Executes purge in filter mode: query definitions by filters, then resolve summaries. */ private executeFilterMode; /** * Handles confirmation, dry-run, and deletion execution. */ private confirmAndDelete; }