Lightning.Adaptors.NPM.Schema (Lightning v2.19.0)

View Source

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.

Summary

Functions

Fetch the configuration schema for name@version from jsDelivr.

Functions

schema(name, version)

@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.