# `Lightning.Adaptors.Seed`
[🔗](https://github.com/OpenFn/lightning/blob/main/lib/lightning/adaptors/seed.ex#L1)

Populates the adaptor catalogue from a JSON snapshot file.

# `seed_from_file`

```elixir
@spec seed_from_file(Path.t(), keyword()) :: {:ok, non_neg_integer()}
```

Populates the catalogue from a JSON snapshot file and returns the
number of records written.

The file is a JSON array of adaptor records in the shape
`Lightning.Adaptors.Catalogue.upsert_adaptor/1` accepts, as written by
`mix lightning.adaptors.snapshot` or `mix lightning.adaptors.dump`.

Once the transaction commits, broadcasts `{:changed, name, source}` for
every name the seed touched, so each node's
`Lightning.Adaptors.Invalidator` drops its now-stale cache entries. In
`replace: true` mode that includes names the wipe removed.

Options:

  * `:source` - `:npm` (default) or `:local`
  * `:replace` - when `true`, deletes every existing row for the source
    first, in the same transaction as the upserts
  * `:sup` - supervisor instance whose topic the broadcasts go to,
    defaulting to `Lightning.Adaptors.Config.default_instance/0`

---

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