Elixir adapter for RelayMark AST and manifest JSON.
Every conversion and validation runs in the canonical RelayMark engine
(relaymark-core, Rust) through one NIF, so the server produces what the
web and native clients produce. This package keeps the Elixir value models.
Relay app persistence, authorization, and action execution belong in client
projects.
Summary
Functions
Converts finite historical AST input once; callers retain originals and the identity mapping.
Imports finite historical XML once and records exact identity attribute changes for the existing CRDT owner.
Finite saved publication conversion; optional source must be the same immutable released body.
Imports finite historical source using the same grammar and identity migration. Originals remain caller-owned evidence.
Normalize authored semantics while preserving all block/option IDs and envelope metadata.
Imports CommonMark/directives or the exact relaymark-ast source declaration.
Parses the bounded authored source of an canonical EntityRef atom.
Derives readable Markdown and safe static HTML through one strict preparation.
Projects readable Markdown; this projection is never a second writable body.
Projects a canonical RelayMark document map into its portable manifest.
Renders authored semantics; host hydration and authorization remain outside.
Writes exact source interchange, retaining identities and authored metadata.
Validates a canonical, JSON-keyed RelayMark document map: the RelayMark document JSON Schema, then the directive, evidence, lifecycle, comparison and identity rules of the reference runtime.
Validates and returns a canonical RelayMark document, raising on failure.
Validates a canonical, JSON-keyed RelayMark projection manifest map against its JSON Schema.
Validates one exact transported Agent Answer document/manifest JSON pair.
Functions
@spec decode_document(binary()) :: {:ok, RelayMark.Document.t()} | {:error, term()}
@spec decode_layer_composition(binary()) :: {:ok, RelayMark.Composition.t()} | {:error, term()}
@spec decode_manifest(binary()) :: {:ok, RelayMark.Manifest.t()} | {:error, term()}
Converts finite historical AST input once; callers retain originals and the identity mapping.
Imports finite historical XML once and records exact identity attribute changes for the existing CRDT owner.
Finite saved publication conversion; optional source must be the same immutable released body.
Imports finite historical source using the same grammar and identity migration. Originals remain caller-owned evidence.
Normalize authored semantics while preserving all block/option IDs and envelope metadata.
Imports CommonMark/directives or the exact relaymark-ast source declaration.
Parses the bounded authored source of an canonical EntityRef atom.
Derives readable Markdown and safe static HTML through one strict preparation.
Projects readable Markdown; this projection is never a second writable body.
Projects a canonical RelayMark document map into its portable manifest.
Hosts should use this function instead of maintaining a parallel manifest projector so newly added portable directives remain consistent everywhere.
Renders authored semantics; host hydration and authorization remain outside.
Writes exact source interchange, retaining identities and authored metadata.
@spec validate_document(map(), map()) :: :ok | {:error, [RelayMark.Diagnostic.t()]}
Validates a canonical, JSON-keyed RelayMark document map: the RelayMark document JSON Schema, then the directive, evidence, lifecycle, comparison and identity rules of the reference runtime.
Validates and returns a canonical RelayMark document, raising on failure.
@spec validate_layer_composition(term()) :: :ok | {:error, [RelayMark.Diagnostic.t()]}
@spec validate_manifest(term()) :: :ok | {:error, [RelayMark.Diagnostic.t()]}
Validates a canonical, JSON-keyed RelayMark projection manifest map against its JSON Schema.
@spec validate_transported_agent_answer_pair(binary(), binary(), map()) :: {:ok, RelayMark.AgentAnswer.validated_pair()} | {:error, [RelayMark.Diagnostic.t()]}
Validates one exact transported Agent Answer document/manifest JSON pair.
Success returns decoded value models plus SHA-256 digests of the exact input bytes. Any semantic or canonical projection mismatch is rejected.