Jido.Messaging.Events (Jido Messaging v1.1.0)

Copy Markdown View Source

Constructors for Jido.Messaging domain events as Jido.Signal CloudEvents.

These events describe committed local messaging state. jido_chat still owns adapter-facing envelopes and payloads; this module carries the normalized runtime facts that small chat apps, bridges, agents, and UIs can subscribe to.

Summary

Functions

Builds the canonical signal for a locally committed room message.

Converts a messaging record into the plain event payload used by message signals.

Builds the canonical signal for a failed outbound platform delivery.

Builds the canonical signal for an inbound platform message.

Builds the canonical signal for a successful outbound platform delivery.

Builds a Jido.Signal CloudEvent for a normalized messaging event type.

Builds the canonical signal for a message reaction being added.

Builds the canonical signal for a message reaction being removed.

Builds a canonical room-scoped signal from arbitrary event data.

Returns the telemetry event name associated with a messaging event type.

Returns the CloudEvent type string for a messaging event atom or custom type string.

Types

event_type()

@type event_type() ::
  :message_added
  | :message_received
  | :message_sent
  | :message_failed
  | :room_created
  | :participant_joined
  | :participant_left
  | :presence_changed
  | :typing
  | :reaction_added
  | :reaction_removed
  | :message_delivered
  | :message_read
  | :thread_created
  | :thread_reply_added
  | atom()

Functions

message_added(instance_module, message, opts \\ [])

@spec message_added(module(), Jido.Messaging.Message.t(), keyword() | map()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for a locally committed room message.

message_data(message, opts \\ [])

@spec message_data(Jido.Messaging.Message.t(), keyword() | map()) :: map()

Converts a messaging record into the plain event payload used by message signals.

message_failed(instance_module, room_id, reason, opts \\ [])

@spec message_failed(module() | nil, String.t(), term(), keyword() | map()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for a failed outbound platform delivery.

message_received(instance_module, message, opts \\ [])

@spec message_received(module() | nil, Jido.Messaging.Message.t(), keyword() | map()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for an inbound platform message.

message_sent(instance_module, message, opts \\ [])

@spec message_sent(module() | nil, Jido.Messaging.Message.t(), keyword() | map()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for a successful outbound platform delivery.

new(type_or_event, instance_module, subject, data, opts \\ [])

@spec new(
  String.t() | event_type(),
  module() | nil,
  String.t() | nil,
  map(),
  keyword() | map()
) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds a Jido.Signal CloudEvent for a normalized messaging event type.

reaction_added(instance_module, message, participant_id, reaction, opts \\ [])

@spec reaction_added(
  module(),
  Jido.Messaging.Message.t(),
  String.t(),
  String.t(),
  keyword() | map()
) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for a message reaction being added.

reaction_removed(instance_module, message, participant_id, reaction, opts \\ [])

@spec reaction_removed(
  module(),
  Jido.Messaging.Message.t(),
  String.t(),
  String.t(),
  keyword() | map()
) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds the canonical signal for a message reaction being removed.

room_event(instance_module, event_type, room_id, data, opts \\ [])

@spec room_event(module(), event_type(), String.t(), map(), keyword() | map()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Builds a canonical room-scoped signal from arbitrary event data.

telemetry_event_for(type)

@spec telemetry_event_for(String.t() | event_type()) :: [atom()]

Returns the telemetry event name associated with a messaging event type.

type_for(type)

@spec type_for(String.t() | event_type()) :: String.t()

Returns the CloudEvent type string for a messaging event atom or custom type string.