Wardrik.Catalog (wardrik v0.1.0-rc.1)

Copy Markdown

Maps each WardrikProtocol operation to its handler and its compiled input schema.

Every surface runs operations through it, with Wardrik.run/3.

Summary

Functions

Returns the operation id with its compiled input schema, or :error.

Returns the catalog of Wardrik's own operations.

Types

handler()

@type handler() :: (Wardrik.Scope.t(), map() ->
                {:ok, term()} | {:error, Wardrik.Error.t()})

t()

@type t() :: %Wardrik.Catalog{
  handlers: %{required(String.t()) => handler()},
  operations: %{
    required(String.t()) => {WardrikProtocol.operation(), JSV.Root.t()}
  },
  streams: %{required(String.t()) => handler()}
}

Functions

fetch(catalog, id)

@spec fetch(t(), String.t()) ::
  {:ok, {WardrikProtocol.operation(), JSV.Root.t()}} | :error

Returns the operation id with its compiled input schema, or :error.

new()

@spec new() :: t()

Returns the catalog of Wardrik's own operations.