Spectre.Stack.Contract.V1 (Spectre v0.3.0)

Copy Markdown View Source

Executable version-one conformance contract for Stack packages.

Satellite libraries can call these functions from their own ExUnit suites without depending on ExUnit from production code.

Summary

Functions

Verifies an installable module or raises.

Reads a compiled V1 Stack and conservatively lowers it into Contract V2.

Verifies an installable module and returns its normalized manifest.

Verifies a raw manifest for module.

Returns the contract version implemented by this module.

Functions

assert_installable!(module)

@spec assert_installable!(module()) :: Spectre.Stack.Package.t()

Verifies an installable module or raises.

to_v2(stack, opts \\ [])

@spec to_v2(
  Spectre.Stack.Definition.t() | module() | nil,
  keyword()
) :: {:ok, Spectre.Stack.Contract.V2.t()} | {:error, term()}

Reads a compiled V1 Stack and conservatively lowers it into Contract V2.

V1 declarations remain requests. Only capabilities present in the trusted :authority_ceiling become effective grants in the returned contract.

verify_installable(module)

@spec verify_installable(module()) ::
  {:ok, Spectre.Stack.Package.t()} | {:error, term()}

Verifies an installable module and returns its normalized manifest.

verify_manifest(module, manifest)

@spec verify_manifest(module(), Spectre.Stack.Package.t() | map() | keyword()) ::
  {:ok, Spectre.Stack.Package.t()} | {:error, term()}

Verifies a raw manifest for module.

version()

@spec version() :: pos_integer()

Returns the contract version implemented by this module.