A2UIAgent.Express.Catalogs (A2UIAgent v0.1.1)

Copy Markdown View Source

The active catalogs of an Express format, compiler or decompiler, with a schema helper for each, and the lookups they share.

The catalogs must be non-empty, have distinct ids and target one protocol version; several catalogs need v1.0 or later, where each component and function call carries its own catalogId. With one catalog, a surface is bound to it and nothing in Express names it. With several, a surface has no catalog: a name is looked up across the catalogs, and one that several catalogs define needs a catalogId.

Summary

Types

Whether a name is a component or a function.

t()

Functions

Whether helper's catalog defines a component or function.

The ids of the catalogs that define a component or function, in catalog order.

The first catalog's helper.

The helper of the catalog with id catalog_id, or nil.

Checks catalogs and builds their helpers for version (default: the catalogs' protocol version). A version must be on the catalogs' release line (v0.9 and v0.9.1 are one line).

The id of the only catalog, or nil when there are several.

Whether the protocol version is at least v1.0, where components and calls carry their own catalogId.

Types

kind()

(since 0.1.0)
@type kind() :: :component | :function

Whether a name is a component or a function.

t()

(since 0.1.0)
@type t() :: %A2UIAgent.Express.Catalogs{
  catalogs: [A2UICore.Catalog.t()],
  helpers: [A2UIAgent.Express.SchemaHelper.t()],
  version: String.t()
}

Functions

defines?(helper, atom, name)

(since 0.1.0)
@spec defines?(A2UIAgent.Express.SchemaHelper.t(), kind(), String.t()) :: boolean()

Whether helper's catalog defines a component or function.

defining(catalogs, kind, name)

(since 0.1.0)
@spec defining(t(), kind(), String.t()) :: [String.t()]

The ids of the catalogs that define a component or function, in catalog order.

first_helper(catalogs)

(since 0.1.0)
@spec first_helper(t()) :: A2UIAgent.Express.SchemaHelper.t()

The first catalog's helper.

helper(catalogs, catalog_id)

(since 0.1.0)
@spec helper(t(), term()) :: A2UIAgent.Express.SchemaHelper.t() | nil

The helper of the catalog with id catalog_id, or nil.

new(catalogs, version \\ nil)

(since 0.1.0)
@spec new([A2UICore.Catalog.t()], String.t() | nil) ::
  {:ok, t()} | {:error, A2UICore.Error.t()}

Checks catalogs and builds their helpers for version (default: the catalogs' protocol version). A version must be on the catalogs' release line (v0.9 and v0.9.1 are one line).

sole_catalog_id(catalogs)

(since 0.1.0)
@spec sole_catalog_id(t()) :: String.t() | nil

The id of the only catalog, or nil when there are several.

v1?(version)

(since 0.1.0)
@spec v1?(String.t()) :: boolean()

Whether the protocol version is at least v1.0, where components and calls carry their own catalogId.