# `MishkaDocument.Resources.Helpers.VersionClones`
[🔗](https://github.com/mishka-group/mishka_document/blob/v0.0.1/lib/mishka_document/resources/__helpers/version_clones.ex#L5)

The versions cloned from a version, and from those, however deep: every version whose
`source_version_id` leads back to it. Deleting a version deletes them with it
(`MishkaDocument.Resources.Changes.DestroyClones`); its delete confirmation names them
(`MishkaDocument.Resources.Calculations.CloneNumbers`).

Read as the caller, under each version's own site, one read a generation.

    VersionClones.of([version], actor: actor, authorize?: true)
    #=> {:ok, %{version.id => [%WorkspaceVersion{version_number: "0.0.10"}, …]}}

# `as_caller`

```elixir
@spec as_caller(map(), map()) :: keyword()
```

The options a write or read made for a caller is run with: its actor and authorization, and the
shared context it came with — the admin surface its permissions are asked on among it — taken
from the context of the change or calculation running (`context`) and of the changeset or query
around it (`source_context`).

# `of`

```elixir
@spec of([map()], keyword()) ::
  {:ok, %{required(String.t()) =&gt; [map()]}} | {:error, term()}
```

Each of `versions`' clones, nearest first, keyed by the version's id. `opts` are the caller's
`:actor` and `:authorize?`.

---

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