0.2.0
A ground-up rewrite. 0.1.2's public API (Ussd.Machine, the old Ussd.Decision/Ussd.Menu
functions, and the mix phx.gen.ussd.state generator) is gone - there is no compatibility
shim, since 0.1.2's own generator produced code that didn't run. If you have a project on
0.1.2, treat this as a new dependency rather than an upgrade.
Fixed
- The
mix phx.gen.ussd.stategenerator produced abefore_render/1that didn't match what 0.1.2'sUssd.Machine(removed in this release) actually called (before_render/2) - every generated state crashed. The new generators (mix ussd.gen.*) produce code that matches the current engine. - 0.1.2's Ussd.Decision.between/3 (removed in this release) compared USSD input as strings
(
"10" <= "9"is true lexicographically), silently breaking range matching once a menu had 10+ options. The newUssd.Decisions.Betweenand friends compare numerically when both sides look numeric. - Session state (
Ussd.Recordin 0.1.2) had no expiry at all and was only ever cleared when a flow explicitly returned a"prompt"action, so abandoned sessions accumulated in an ETS table forever.Ussd.Cache.ETSnow expires entries on a real TTL, both lazily on read and via a periodic sweep, and the engine gives its own bookkeeping a default TTL (config :ussd, :session_ttl, default 300s) so this happens automatically. - Ussd.Application started its
GenServerdirectly instead of under aSupervisor, so a crash there took the whole application down with no restart. It now starts under a real one-for-one supervisor. - The library depended on all of Phoenix (
{:phoenix, "~> 1.6.6"}) just for one generator's inflection helpers. The generators now useMacro.camelize/1andMacro.underscore/1from Elixir's own standard library; Phoenix is no longer a dependency at all.
Added
Feature parity with speso/laravel-ussd v3, expressed idiomatically rather than
transliterated:
Ussd.StateDSL -transition/2,back/2,paginate/2,truncate/2,terminate/0macros compiled into the module, replacing 0.1.2's untypedUssd.Decision.*functions.Ussd.Action- one-shot, no-render decision points that chain to the next state.Ussd.Pagination-use Ussd.Pagination, per_page: npluspaginate/2pages a long listing without hand-rolled bookkeeping.- Truncation -
truncate/2caps how much of a screen is returned per request, with a "more" continuation key. - Resumable sessions -
Ussd.use_continuing_state/4(:start/:continue/:confirm) lets a redial pick back up where a dropped call left off. Ussd.Configurator- sharedUssd.use_*/2setup across entry points.- Localization -
Ussd.Menu.trans/4andtrans_line/4via an optional Gettext backend. Ussd.Record.set_encrypted/4andget_encrypted/4- AES-256-GCM at rest, keyed byconfig :ussd, :encryption_key.- Six gateway response formatters -
Ussd.Responses.{AfricasTalking, Speso, Nalo, Nsano, Moolre, Arkesel}. Ussd.ExceptionHandler- turns an unhandled exception into a message instead of a dead session.mix ussd.graph,mix ussd.lint,mix ussd.simulate- Mermaid flow diagrams, static analysis for dead ends/broken transitions/duplicate matches, and an interactive terminal simulator.mix ussd.gen.{state,action,response,decision,configurator,exception_handler}generators.Ussd.Test- a fluent ExUnit helper for walking a flow screen by screen and asserting on the message, session record, and context.:telemetryevents -[:ussd, :state, :entered]and[:ussd, :session, :terminated].- Pluggable
Ussd.Cachebehaviour, so the session store can be swapped for Redis,:cachex, Mnesia, etc. in a multi-node deployment.
0.1.2 and earlier
Initial minimal proof of concept.