LibTmux.Schema (libtmux v0.0.1-alpha.1)

Copy Markdown View Source

Defines observed fields, wire names and graph relations.

The table is a semantic overlay on tmux 3.3 format variables. It drives observation validation, portable filtering and reference generation. Empty text remains text; only explicitly nullable fields admit nil.

Summary

Types

An entity's canonical local name. Physical windows and membership links are distinct.

The observation struct modules accepted alongside canonical entity names.

A canonical entity atom or its corresponding observation module.

Field metadata shared by validation and documentation; nil format identifies a derived field.

One physical or contextual observation from a captured graph.

A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type.

A scalar filter operator; each field category permits only its applicable subset.

The cardinality and target entity of one indexed graph relation.

A field's validation category; integer fields use the schema's nonnegative 32-bit range.

Functions

Returns supported entity names in a stable order.

Resolves an entity atom or its observation module.

Returns field metadata, or nil for a field outside the schema.

Returns the whitelisted field metadata for an entity.

Returns the ordinary observation struct module for an entity.

Returns the portable operators allowed by a scalar field's value category.

Returns a relation's explicit stable wire name.

Returns each relation's cardinality and target entity.

Types

entity()

@type entity() :: :session | :window | :window_link | :pane | :client

An entity's canonical local name. Physical windows and membership links are distinct.

entity_module()

@type entity_module() ::
  LibTmux.Session
  | LibTmux.Window
  | LibTmux.WindowLink
  | LibTmux.Pane
  | LibTmux.Client

The observation struct modules accepted alongside canonical entity names.

entity_selector()

@type entity_selector() :: entity() | entity_module()

A canonical entity atom or its corresponding observation module.

field()

@type field() :: %{
  name: atom(),
  wire: String.t(),
  format: String.t() | nil,
  type: value_type(),
  since: String.t(),
  nullable: boolean()
}

Field metadata shared by validation and documentation; nil format identifies a derived field.

observation()

One physical or contextual observation from a captured graph.

observed(value)

@type observed(value) :: value | :unloaded | :unavailable

A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type.

operator()

@type operator() ::
  :equals
  | :not
  | :in
  | :not_in
  | :lt
  | :lte
  | :gt
  | :gte
  | :contains
  | :starts_with
  | :ends_with

A scalar filter operator; each field category permits only its applicable subset.

relation()

@type relation() :: {:one | :many, entity()}

The cardinality and target entity of one indexed graph relation.

value_type()

@type value_type() ::
  :string | :integer | :nullable_integer | :boolean | {:id, entity()}

A field's validation category; integer fields use the schema's nonnegative 32-bit range.

Functions

entities()

@spec entities() :: [entity()]

Returns supported entity names in a stable order.

entity(entity)

@spec entity(entity_selector()) :: entity()

Resolves an entity atom or its observation module.

field(entity, name)

@spec field(entity_selector(), atom()) :: field() | nil

Returns field metadata, or nil for a field outside the schema.

fields(entity)

@spec fields(entity_selector()) :: %{required(atom()) => field()}

Returns the whitelisted field metadata for an entity.

module(entity)

@spec module(entity()) :: entity_module()

Returns the ordinary observation struct module for an entity.

operators(map)

@spec operators(field()) :: [operator()]

Returns the portable operators allowed by a scalar field's value category.

relation_wire(name)

@spec relation_wire(atom()) :: String.t()

Returns a relation's explicit stable wire name.

relations(entity)

@spec relations(entity_selector()) :: %{required(atom()) => relation()}

Returns each relation's cardinality and target entity.