# CollaborationOperation

interface

Extends the [operation](module_engine_model_operation_operation.md).

<a id="properties">

## Properties

<a id="member-_aiSource">

### `_aiSource?: AIOperationSource`

Set when the operation was produced by an AI feature. See [`AIOperationSource`](module_collaboration-core_collaborationoperation-AIOperationSource.md).

<a id="member-_authorId">

### `_authorId?: string | null`

<a id="member-_isDisconnection">

### `_isDisconnection?: boolean`

<a id="member-_isInit">

### `_isInit?: boolean`

<a id="member-affectedSelectable">

### `affectedSelectable: ModelSelectable` _(readonly)_

A selectable that will be affected by the operation after it is executed.

The exact returned parameter differs between operation types.

<a id="member-baseVersion">

### `baseVersion: number | null` _(inherited)_

[`version`](module_engine_model_document-ModelDocument.md#member-version) on which operation can be applied. If you try to [apply](module_engine_model_model-Model.md#function-applyOperation) operation with different base version than the [document version](module_engine_model_document-ModelDocument.md#member-version) the [model-document-applyOperation-wrong-version](module_utils_ckeditorerror-CKEditorError.md) error is thrown.

<a id="member-batch">

### `batch: Batch | null` _(inherited)_

[Batch](module_engine_model_batch-Batch.md) to which the operation is added or `null` if the operation is not added to any batch yet.

Note, that a [non-document operation](#member-isDocumentOperation) has this property always set to `null`, and is never added to any batch.

<a id="member-createdAt">

### `createdAt?: Date`

<a id="member-isDocumentOperation">

### `isDocumentOperation: boolean` _(readonly)_

Defines whether operation is executed on attached or detached [items](module_engine_model_item-ModelItem.md).

<a id="member-type">

### `type: string` _(readonly)_

Operation type.

<a id="member-wasUndone">

### `wasUndone?: boolean`

<a id="methods">

## Methods

<a id="function-clone">

### `clone() → CollaborationOperation`

Creates and returns an operation that has the same parameters as this operation.

#### Returns

* `CollaborationOperation`

  Clone of this operation.

<a id="function-getReversed">

### `getReversed() → Operation` _(inherited)_

Creates and returns a reverse operation. Reverse operation when executed right after the original operation will bring back tree model state to the point before the original operation execution. In other words, it reverses changes done by the original operation.

Keep in mind that tree model state may change since executing the original operation, so reverse operation will be "outdated". In that case you will need to transform it by all operations that were executed after the original operation.

#### Returns

* `Operation`

  Reversed operation.

<a id="function-toJSON">

### `toJSON() → unknown` _(inherited)_

Custom toJSON method to solve child-parent circular dependencies.

#### Returns

* `unknown`

  Clone of this object with the operation property replaced with string.

<a id="function-_execute">

### `_execute() → void` _(internal)_

Executes the operation - modifications described by the operation properties will be applied to the model tree.

#### Returns

* `void`

<a id="function-_validate">

### `_validate() → void` _(internal)_

Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws an error if operation is not valid.

#### Returns

* `void`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
