# `Decree.Commands.ExecutionResult`
[🔗](https://github.com/sparkle-space/decree/blob/v0.1.0/lib/decree/commands/execution_result.ex#L1)

Contains the aggregate, events, and metadata created by a successfully
executed command.

The available fields are:

  - `aggregate_uuid` - identity of the aggregate instance. For a decision, the route's
    stream, or the first member's in a multi-stream batch.

  - `aggregate_state` - resultant state of the aggregate after executing
    the command. For a decision, the state its fold reached, with the new events applied.

  - `aggregate_version` - resultant version of the aggregate after executing
    the command. For a decision, the version of the stream `aggregate_uuid` names.

  - `events` - a list of the created events, it may be an empty list.

  - `metadata` - a map containing the metadata associated with the command
    dispatch.

  - `position` - for a decision, the last `$all` position its append wrote. `nil` for an
    aggregate.

  - `stream_versions` - for a decision, `%{stream_uuid => version}`, each stream's version
    after its append. `nil` for an aggregate.

# `t`

```elixir
@type t() :: %Decree.Commands.ExecutionResult{
  aggregate_state: struct(),
  aggregate_uuid: String.t(),
  aggregate_version: non_neg_integer(),
  events: [struct()],
  metadata: struct(),
  position: non_neg_integer() | nil,
  stream_versions: %{required(String.t()) =&gt; non_neg_integer()} | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
