Synapse.Signal (Synapse v0.1.1)

View Source

Canonical registry of signal topics and their schemas.

Delegates to Synapse.Signal.Registry so topics can be declared via configuration or registered at runtime.

Summary

Functions

Registers a topic at runtime.

Resolves a type string (e.g., "review.request") into the canonical topic atom.

Lists all known topics.

Returns the wire-format type for the given topic.

Validates a payload for the provided topic and returns the normalized map.

Types

topic()

@type topic() :: atom()

Functions

register_topic(topic, config)

@spec register_topic(
  topic(),
  keyword()
) :: :ok | {:error, term()}

Registers a topic at runtime.

topic_from_type(type)

@spec topic_from_type(String.t()) :: {:ok, topic()} | :error

Resolves a type string (e.g., "review.request") into the canonical topic atom.

topics()

@spec topics() :: [topic()]

Lists all known topics.

type(topic)

@spec type(topic()) :: String.t()

Returns the wire-format type for the given topic.

validate!(topic, payload)

@spec validate!(topic(), map()) :: map()

Validates a payload for the provided topic and returns the normalized map.