/** * Track Changes — Accept / Reject API * * Functions for accepting or rejecting tracked changes in a DocxDocument. */ import type { DocxDocument } from "../types.js"; /** * Accept all tracked changes in a document (mutates in place). * * - Inserted runs: their content is kept, the `InsertedRun` wrapper is removed. * - Deleted runs: their content is removed entirely. * - Moved content: moved-to content is kept, moved-from is removed. * - Property changes: the new properties are kept, change info is removed. * * @param doc - The document to modify (mutated in place). * @returns Number of revisions accepted. */ export declare function acceptAllRevisions(doc: DocxDocument): number; /** * Reject all tracked changes in a document (mutates in place). * * - Inserted runs: removed entirely (content was not in original). * - Deleted runs: their content is kept (restoring original text). * - Moved content: moved-from content is kept, moved-to is removed. * * @param doc - The document to modify (mutated in place). * @returns Number of revisions rejected. */ export declare function rejectAllRevisions(doc: DocxDocument): number; /** A revision found in the document, with its location and metadata. */ export interface RevisionEntry { /** Unique revision id (from w:ins/w:del/w:moveFrom/w:moveTo @id). */ readonly id: number; /** Revision type. */ readonly type: "insert" | "delete" | "moveFrom" | "moveTo" | "rowInsert" | "rowDelete" | "cellMerge" | "tablePropertyChange" | "rowPropertyChange" | "cellPropertyChange" | "paragraphPropertyChange" | "runPropertyChange"; /** Author of the revision. */ readonly author?: string; /** Date of the revision (ISO 8601 string). */ readonly date?: string; } /** * List all tracked changes in a document. * * Walks the document body, headers, footers, footnotes, endnotes, and comments * collecting all `RevisionInfo`-bearing nodes (insertions, deletions, moves, * property changes). * * @param doc - The document to scan. * @returns Array of revision entries. */ export declare function listRevisions(doc: DocxDocument): RevisionEntry[]; /** * Accept a single revision by id (mutates in place). * * @param doc - The document to modify. * @param revisionId - The revision id to accept. * @returns true if the revision was found and accepted, false otherwise. */ export declare function acceptRevision(doc: DocxDocument, revisionId: number): boolean; /** * Reject a single revision by id (mutates in place). * * @param doc - The document to modify. * @param revisionId - The revision id to reject. * @returns true if the revision was found and rejected, false otherwise. */ export declare function rejectRevision(doc: DocxDocument, revisionId: number): boolean;