Accrue.Events.Schemas (accrue v0.2.0)

Copy Markdown View Source

Registry mapping Phase 3 event atoms to their canonical schema modules (D3-66, D3-68).

The registry covers all 24 Phase 3 event types. Seven events have fully-typed schema modules (created, updated, canceled, plan_swapped, invoice.paid, refund.created, card.expiring_soon); the remaining 17 are minimal stubs that establish the Accrue.Events.Upcaster contract at schema_version: 1 but do not yet enumerate every typed field. Future revisions can expand any stub into a typed struct without touching the registry shape.

Usage

iex> Accrue.Events.Schemas.for(:"subscription.created")
Accrue.Events.Schemas.SubscriptionCreated

iex> Accrue.Events.Schemas.for(:"unknown.event")
nil

iex> Accrue.Events.Schemas.count()
24

Summary

Functions

Returns the full event_type => module registry.

Number of registered event types (always 24 in Phase 3).

Returns the schema module for an event type atom, or nil for unknown types.

Functions

all()

@spec all() :: %{required(atom()) => module()}

Returns the full event_type => module registry.

count()

@spec count() :: non_neg_integer()

Number of registered event types (always 24 in Phase 3).

for(type)

@spec for(atom()) :: module() | nil

Returns the schema module for an event type atom, or nil for unknown types.