# Interfaces

Import these from `@grafloria/engine`.

## Interfaces

### `CommandContext`

```ts
interface CommandContext
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `diagram` | `any` |  |  |
| `eventBus` | `any` |  |  |
| `store?` | `any` |  |  |
| `engine?` | `any` |  |  |

### `CommandHistoryEntry`

```ts
interface CommandHistoryEntry
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `command` | `Command` |  |  |
| `timestamp` | `number` |  |  |
| `duration` | `number` |  |  |
| `success` | `boolean` |  | History only ever records commands that EXECUTED successfully, so this is always `true` and `error` is never set. Both fields survive purely for API compatibility — a command that throws (or fails strict validation) no longer enters history at all, because canUndo()/undo() never consulted these flags and would happily "undo" a mutation that never happened. |
| `error?` | `Error` |  |  |

### `CutCommandOptions`

```ts
interface CutCommandOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `includeGroups?` | `boolean` |  | Include groups containing selected nodes in the clipboard payload (default: false) |
| `includeLinks?` | `boolean` |  | Include links between copied nodes in the clipboard payload (default: true) |
| `deleteChildren?` | `boolean` |  | Delete child nodes recursively (default: true) |
| `deleteLinks?` | `boolean` |  | Delete links connected to the deleted nodes (default: true) |

### `GroupFrameMove`

One (nested) group frame's move.

```ts
interface GroupFrameMove
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `groupId` | `string` |  |  |
| `from` | `GroupFrameSnapshot` |  |  |
| `to` | `GroupFrameSnapshot` |  |  |

### `GroupFrameSnapshot`

A group frame's restorable geometry (matches GroupModel.restoreGeometry).

```ts
interface GroupFrameSnapshot
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `position` | `{ x: number; y: number }` |  |  |
| `size?` | `{ width: number; height: number; depth: number }` |  |  |
| `bounds?` | `{ x: number; y: number; width: number; height: number }` |  |  |

### `GroupNodeMove`

One member node's absolute move.

```ts
interface GroupNodeMove
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `nodeId` | `string` |  |  |
| `from` | `Point` |  |  |
| `to` | `Point` |  |  |

### `MacroStep`

```ts
interface MacroStep
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `command` | `Command` |  |  |
| `delay?` | `number` |  |  |

### `MoveNodeCommandOptions`

```ts
interface MoveNodeCommandOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `mergeable?` | `boolean` |  | Whether CommandManager may MERGE this move into the previous one for the same node (default: true, preserving the historic behaviour). |

### `RotateNodeCommandOptions`

```ts
interface RotateNodeCommandOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `mergeable?` | `boolean` |  | Whether CommandManager may MERGE this rotation into the previous one for the same node (default: false). |

### `SerializedCommand`

```ts
interface SerializedCommand
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` |  |  |
| `name` | `string` |  |  |
| `timestamp` | `number` |  |  |
| `data` | `any` |  |  |
