Skip to content
Document Authoring DA  API Docs v1.20.0
npmGitHub

RevisionNEW

Revision:

A pending tracked change in the document.

A Revision exposes the imported or transaction-authored metadata for one pending change. Text revisions include paragraph-local anchors and a preview formed by concatenating the text of runs carrying the revision ID. Structural revisions have an empty preview and no anchors.

Anchors use the coordinates of their paragraph’s current text surface. In a review transaction, deleted text is hidden, so a deletion can have a zero-length anchor at its review-visible position. A field’s value is ordinary runs on that surface, so a revision inside one anchors to the text it covers like any other.

withdraw() is mechanically a rejection, but it is permitted only when the revision author equals the effective transaction author. A transaction opened with review.author uses that author; otherwise the document author callback supplies the identity. A different author produces a not-permitted refusal and leaves the document unchanged.

Withdraw a pending suggestion authored by the current reviewer:

const ownSuggestion = draft.revisions().all({ author: 'Bot' })[0];
if (ownSuggestion) {
const result = ownSuggestion.withdraw();
console.log(result.decided, result.refused);
}

id: string

Stable identifier for this revision.


type: RevisionType

Public tracked-change type.


author: string | null

Revision author, or null when the document has no author metadata.


date: string | null

Revision timestamp, or null when the document has no date metadata.


story: RevisionStory

Document story containing this revision.


preview: string

Concatenated run text carrying this ID, or an empty string for structural revisions.


anchors: TextAnchorRange[]

Paragraph-local text ranges carrying this ID, or an empty array for structural revisions.

accept(options?): RevisionDecisionResult

Accepts this revision.

RevisionDecisionOptions

Optional contiguous-expansion behavior

RevisionDecisionResult

IDs decided by the operation and any non-throwing refusals


reject(options?): RevisionDecisionResult

Rejects this revision.

RevisionDecisionOptions

Optional contiguous-expansion behavior

RevisionDecisionResult

IDs decided by the operation and any non-throwing refusals


withdraw(options?): RevisionDecisionResult

Withdraws this revision when it belongs to the effective author.

RevisionDecisionOptions

Optional contiguous-expansion behavior

RevisionDecisionResult

IDs decided by the operation and any non-throwing refusals

Withdrawal uses rejection mechanics. An author mismatch returns a not-permitted refusal and does not mutate the document.