eventsource-api 1.0.1 → 1.0.2
raw patch · 5 files changed
+36/−12 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ EventSource.Store: instance GHC.Exception.Exception EventSource.Store.ForEventFailure
+ EventSource.Types: instance Data.Aeson.Types.FromJSON.FromJSON EventSource.Types.EventId
+ EventSource.Types: instance Data.Aeson.Types.FromJSON.FromJSON EventSource.Types.EventNumber
+ EventSource.Types: instance Data.Aeson.Types.FromJSON.FromJSON EventSource.Types.EventType
+ EventSource.Types: instance Data.Aeson.Types.FromJSON.FromJSON EventSource.Types.StreamName
+ EventSource.Types: instance Data.Aeson.Types.ToJSON.ToJSON EventSource.Types.EventId
+ EventSource.Types: instance Data.Aeson.Types.ToJSON.ToJSON EventSource.Types.EventNumber
+ EventSource.Types: instance Data.Aeson.Types.ToJSON.ToJSON EventSource.Types.EventType
+ EventSource.Types: instance Data.Aeson.Types.ToJSON.ToJSON EventSource.Types.StreamName
+ EventSource.Types: instance EventSource.Types.EncodeEvent EventSource.Types.Event
+ EventSource.Types: instance GHC.Classes.Eq EventSource.Types.ExpectedVersion
Files
- CHANGELOG.md +11/−6
- eventsource-api.cabal +1/−1
- library/EventSource/Store.hs +3/−0
- library/EventSource/Types.hs +20/−4
- package.yaml +1/−1
CHANGELOG.md view
@@ -1,7 +1,12 @@-# Change log--eventsource-api uses [Semantic Versioning][].-The change log is available through the [releases on GitHub][].+1.0.2+=====+ * Implement essential typesclasses -[Semantic Versioning]: http://semver.org/spec/v2.0.0.html-[releases on GitHub]: https://github.com/githubuser/eventsource-api/releases+1.0.1+=====+ * Add `forSavedEvents`+ * Add `foldSavedEventsM`+ * Add `foldSavedEvents`+ * Add `foldSubSaved`+ * Add `foldSubSavedAsync`+ * Expose `ForEventFailure(..)`
eventsource-api.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: eventsource-api-version: 1.0.1+version: 1.0.2 synopsis: Provides a eventsourcing high level API. description: Please read README.md. category: Eventsourcing
library/EventSource/Store.hs view
@@ -215,6 +215,9 @@ deriving Show --------------------------------------------------------------------------------+instance Exception ForEventFailure++-------------------------------------------------------------------------------- -- | Iterates over all events of stream given a starting point and a batch size. forEvents :: (MonadIO m, DecodeEvent a, Store store) => store
library/EventSource/Types.hs view
@@ -152,6 +152,17 @@ newtype EventId = EventId UUID deriving (Eq, Ord) --------------------------------------------------------------------------------+instance ToJSON EventId where+ toJSON (EventId u) = toJSON (toText u)++--------------------------------------------------------------------------------+instance FromJSON EventId where+ parseJSON = withText "EventId" $ \t ->+ case fromText t of+ Just u -> return $ EventId u+ Nothing -> mzero++-------------------------------------------------------------------------------- instance Show EventId where show (EventId uuid) = show uuid @@ -162,7 +173,7 @@ -------------------------------------------------------------------------------- -- | Represents a stream name.-newtype StreamName = StreamName Text deriving (Eq, Ord)+newtype StreamName = StreamName Text deriving (Eq, Ord, ToJSON, FromJSON) -------------------------------------------------------------------------------- instance Show StreamName where@@ -174,7 +185,7 @@ -------------------------------------------------------------------------------- -- | Used to identity the type of an 'Event'.-newtype EventType = EventType Text deriving Eq+newtype EventType = EventType Text deriving (Eq, ToJSON, FromJSON) -------------------------------------------------------------------------------- instance Show EventType where@@ -215,7 +226,8 @@ -------------------------------------------------------------------------------- -- | Represents an event index in a stream.-newtype EventNumber = EventNumber Int32 deriving (Eq, Ord, Num, Enum, Show)+newtype EventNumber = EventNumber Int32+ deriving (Eq, Ord, Num, Enum, Show, FromJSON, ToJSON) -------------------------------------------------------------------------------- -- | Represents an event that's saved into the event store.@@ -260,6 +272,10 @@ instance Exception DecodeEventException --------------------------------------------------------------------------------+instance EncodeEvent Event where+ encodeEvent e = put e++-------------------------------------------------------------------------------- instance DecodeEvent Event where decodeEvent = Right @@ -275,7 +291,7 @@ -- Stream should exist. | ExactVersion EventNumber -- Stream should be at givent event number.- deriving Show+ deriving (Show, Eq) -------------------------------------------------------------------------------- -- | Statuses you can get on every read attempt.
package.yaml view
@@ -29,4 +29,4 @@ maintainer: yo.eight@gmail.com name: eventsource-api synopsis: Provides a eventsourcing high level API.-version: '1.0.1'+version: '1.0.2'