# `Choreo.Lab.DSL.Sequence`
[🔗](https://github.com/code-shoily/choreo/blob/v0.14.1/lib/choreo/lab/dsl/sequence.ex#L1)

Experimental Livebook-friendly DSL for sketching sequence diagrams.

Unlike most Choreo Lab DSLs, sequence diagrams are primarily ordered event
streams rather than static topology. This DSL still uses participant
constructors for nouns, but message, activation, note, and fragment statements
compile to ordered `Choreo.Sequence` events.

## Examples

    iex> import Choreo.Lab.DSL.Sequence
    ...> diagram = sequence do
    ...>   user = actor("User")
    ...>   api = participant("API")
    ...>   db = participant("Database")
    ...>
    ...>   user ~> api |> call("GET /accounts")
    ...>   activate api
    ...>   api ~> db |> call("SELECT accounts")
    ...>   reply db ~> api, "rows"
    ...>   deactivate api
    ...>   reply api ~> user, "200 OK"
    ...> end
    iex> Choreo.Sequence.participants(diagram)
    [:user, :api, :db]
    iex> Choreo.Sequence.messages(diagram) |> Enum.map(& &1[:label])
    ["GET /accounts", "SELECT accounts", "rows", "200 OK"]

Message edges can use pipe modifiers, typed constructors, or generic `edge`:

    user ~> api |> call("GET /accounts")
    async api ~> worker, "enqueue job"
    reply db ~> api, "rows"
    edge api ~> db, async: "fire and forget"

Notes and fragments are event statements:

    over api, "Validates bearer token"
    between api, db, "Tenant scoped query"

    loop "retry up to 3 times" do
      api ~> worker |> async("process job")
    end

    alt "authorized" do
      api ~> db |> call("read tenant")
      otherwise "denied"
      api ~> user |> reply("403")
    end

# `participant_decl`

```elixir
@type participant_decl() :: %{id: atom(), builder: atom(), opts: keyword()}
```

# `step`

```elixir
@type step() ::
  {:participant, participant_decl()}
  | {:message, map()}
  | {:activation, atom(), atom()}
  | {:note, tuple(), String.t()}
  | {:fragment, atom(), String.t() | nil}
  | :end_fragment
```

# `activate`

# `actor`

# `alt`

# `async`

# `between`

# `break`

# `call`

# `critical`

# `deactivate`

# `edge`

# `else`

# `left`

# `loop`

# `message`

# `note`

# `on`

# `opt`

# `otherwise`

# `over`

# `par`

# `participant`

# `publish`

# `reply`

# `request`

# `response`

# `return`

# `right`

# `sequence`
*macro* 

Builds a `%Choreo.Sequence{}` from a compact Lab DSL block.

# `sequence`
*macro* 

# `service`

# `signal`

# `sync`

# `system`

# `taxonomy`

```elixir
@spec taxonomy() :: %{
  participants: [atom()],
  messages: [atom()],
  events: [atom()],
  notes: [atom()],
  fragments: [atom()],
  modifiers: [atom()],
  options: [atom()]
}
```

Returns the vocabulary supported by the sequence DSL.

This is meant as a lightweight Livebook discovery helper when autocomplete is
not enough.

    iex> taxonomy = Choreo.Lab.DSL.Sequence.taxonomy()
    iex> :actor in taxonomy.participants
    true
    iex> :reply in taxonomy.messages
    true
    iex> :loop in taxonomy.fragments
    true

# `type`

# `user`

# `verbs`

```elixir
@spec verbs() :: map()
```

Compatibility alias for `taxonomy/0`.

---

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