# `Lightning.Adaptors.NPM.Schema`
[🔗](https://github.com/OpenFn/lightning/blob/main/lib/lightning/adaptors/npm/schema.ex#L1)

jsDelivr CDN client for adaptor configuration schemas.

Fetches `/npm/<name>@<version>/configuration-schema.json` from
`cdn.jsdelivr.net`, checks it decodes, and keeps the body as the bytes
served.

Base URL via `Lightning.Adaptors.Config.strategy_opts(Lightning.Adaptors.NPM)[:jsdelivr_url]`,
default `https://cdn.jsdelivr.net`.

# `schema`

```elixir
@spec schema(String.t(), String.t()) ::
  {:ok, {String.t(), String.t()}} | {:ok, {nil, nil}} | {:error, term()}
```

Fetch the configuration schema for `name@version` from jsDelivr.

Returns `{:ok, {schema_data, schema_sha256}}` on success and
`{:ok, {nil, nil}}` on a 404. jsDelivr answers 404 both for a package
with no schema and for a version it has not mirrored yet, so the
Scheduler decides what a `nil` means. Any other failure (timeout, other status, undecodable body) is
`{:error, reason}`, so callers that persist the result never mistake a
transient failure for absence.

---

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