Renamed to bellroy/elm-eventstream. It is published under that name, and new versions come out there.
Versions published as tricycle/elm-eventstream still install under that name. 2 versions of 3 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.
Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/bellroy/elm-eventstream exists but has no tag 1.1.0; Software Heritage not asked yet (this run's --swh-calls were used up); no fork with tag 1.1.0 found (1 same-name repos checked); no cached copy. Use another version.
Allows you to setup a "stream" of Events. For every event you are required to setup a name and decoder to validate it's contents. Triggers can be placed to listen to events and consolidate the data in to a new outgoing event.
eventMatcher : Matcher -> Decode.Decoder Bool
eventMatcher matcher =
Decode.field "eventData"
(Decode.field "someField" Decode.string
|> Decode.andThen
(\someFieldValue ->
if matcher == ("TestEvent." ++ someFieldValue) then
Decode.succeed True
else
Decode.succeed False
)
)
testEventEncoder : Matcher -> Decode.Value -> Result EventStream.Error Encode.Value
testEventEncoder matcher rawEvent =
Ok <| Encode.string "outgoing"
eventStream =
EventStream.init
[ ( "TestEvent", eventMatcher )
]
[ ( "TestEvent", testEventEncoder ) ](updatedEventStream, listOfOutgoingEvents) =
EventStream.addEvent anEncodedValue eventStream