# `Macaw.Frame.Catalog.Store`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/catalog/store.ex#L1)

The catalog store (spec/13 §1.3): a registry's catalog modules as a read-only
`Macaw.Layers.Store` of frame document fragments, its context the registry
(`%{id => module}`, `Macaw.Frame.Catalog.registry/1`). Reach it through
`Macaw.Frame.Catalog.store/1`.

An entry's id is the fragment's catalog id (`"charts.line"`), so a use site `ref`s it as
it would any stored fragment; its name is the id too. `list/1` answers each id with its
doc, parameters and slots beside the store's summary keys. `put/2`, `delete/2` and
`import/2` are refused with `:read_only`: a host layers its own store over this one to
hold a variant under its own id.

    iex> {:ok, store} = Macaw.Frame.Catalog.store([])
    iex> Macaw.Layers.Store.put(store, %{id: nil, name: "mine", fragment: %{}})
    {:error, :read_only}

# `delete`

```elixir
@spec delete(term(), term()) :: {:error, :read_only}
```

Refused: the catalog is read-only.

# `get`

```elixir
@spec get(term(), term()) :: {:ok, map()} | {:error, :not_found | term()}
```

The entry of an id: `{:ok, %{id, name, fragment}}`, or `{:error, :not_found}`.

# `import`

```elixir
@spec import(term(), term()) :: {:error, [Macaw.Base.Fault.t(), ...]}
```

Refused: the catalog is read-only.

# `list`

```elixir
@spec list(term()) :: {:ok, [map()]} | {:error, term()}
```

Every entry's summary, by id: `%{id, name, kind, doc, parameters, slots}`, its `kind`
the fragment's (`:design`), its parameters in order.

# `put`

```elixir
@spec put(term(), term()) :: {:error, :read_only}
```

Refused: the catalog is read-only.

# `types`

```elixir
@spec types(term()) :: [module()]
```

The fragment type the store holds: the frame document.

---

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