packages feed

eventsource-geteventstore-store 1.0.4 → 1.0.5

raw patch · 5 files changed

+46/−102 lines, 5 filesdep +string-conversionsdep +transformers-basedep ~protoludePVP ok

version bump matches the API change (PVP)

Dependencies added: string-conversions, transformers-base

Dependency ranges changed: protolude

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+1.0.5+=====+* Dependencies cleaning.+ 1.0.4 ===== * Fix Stackage build.
eventsource-geteventstore-store.cabal view
@@ -1,9 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.17.1.+-- This file has been generated from package.yaml by hpack version 0.20.0. -- -- see: https://github.com/sol/hpack+--+-- hash: 3a39c866c5e178fe9b4154414f572ef5d6cab5aedcdbd094d87ac4a1ac356529  name:           eventsource-geteventstore-store-version:        1.0.4+version:        1.0.5 synopsis:       GetEventStore store implementation. description:    GetEventStore store implementation. category:       Eventsourcing@@ -21,7 +23,6 @@     LICENSE.md     package.yaml     README.md-    stack.yaml  source-repository head   type: git@@ -30,17 +31,19 @@ library   hs-source-dirs:       library-  default-extensions: NoImplicitPrelude   ghc-options: -Wall   build-depends:-      base >=4.9 && <5-    , protolude >=0.1.10 && <0.3+      aeson+    , base >=4.9 && <5+    , eventsource-api >=1.1     , eventstore >=0.14 && <0.16-    , eventsource-api >= 1.1-    , aeson     , mtl+    , string-conversions+    , transformers-base   exposed-modules:       EventSource.Store.GetEventStore+  other-modules:+      Paths_eventsource_geteventstore_store   default-language: Haskell2010  test-suite geteventstore-store-test-suite@@ -51,13 +54,14 @@   ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N   build-depends:       base-    , eventsource-geteventstore-store     , eventsource-api+    , eventsource-geteventstore-store     , eventsource-store-specs ==1.*     , eventstore+    , protolude     , tasty     , tasty-hspec-    , protolude   other-modules:       Test.EventSource.Store.GetEventStore+      Paths_eventsource_geteventstore_store   default-language: Haskell2010
library/EventSource/Store/GetEventStore.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleContexts  #-} {-# LANGUAGE GADTs             #-} {-# LANGUAGE OverloadedStrings #-} --------------------------------------------------------------------------------@@ -19,8 +20,13 @@   ) where  ---------------------------------------------------------------------------------import           Protolude-import           Data.Aeson+import Control.Exception (try)++--------------------------------------------------------------------------------+import           Control.Monad.Base (MonadBase, liftBase)+import           Control.Monad.State.Strict (execState)+import           Data.Aeson (encode, decodeStrict)+import           Data.String.Conversions (convertString) import qualified Database.EventStore as GES import           EventSource @@ -37,7 +43,7 @@   GES.exactEventVersion i  ---------------------------------------------------------------------------------buildEvent :: (EncodeEvent a, MonadIO m) => a -> m Event+buildEvent :: (EncodeEvent a, MonadBase IO m) => a -> m Event buildEvent a = do   eid <- freshEventId   let start = Event { eventType = ""@@ -67,7 +73,7 @@             DataAsJson v -> GES.withJson v         Just p ->           case eventPayload e of-            Data bs -> GES.withBinaryAndMetadata bs (toS $ encode p)+            Data bs -> GES.withBinaryAndMetadata bs (convertString $ encode p)             DataAsJson v -> GES.withJsonAndMetadata v p  --------------------------------------------------------------------------------@@ -103,19 +109,19 @@                        }  ---------------------------------------------------------------------------------fromGesReadResult :: GES.ReadResult t a -> ReadStatus a-fromGesReadResult (GES.ReadSuccess a) =+fromGesReadResult :: StreamName -> GES.ReadResult t a -> ReadStatus a+fromGesReadResult _ (GES.ReadSuccess a) =   ReadSuccess a-fromGesReadResult GES.ReadNoStream =-  ReadFailure StreamNotFound-fromGesReadResult (GES.ReadStreamDeleted _) =-  ReadFailure StreamNotFound-fromGesReadResult GES.ReadNotModified =+fromGesReadResult n GES.ReadNoStream =+  ReadFailure $ StreamNotFound n+fromGesReadResult n (GES.ReadStreamDeleted _) =+  ReadFailure $ StreamNotFound n+fromGesReadResult _ GES.ReadNotModified =   ReadFailure (ReadError $ Just "not modified")-fromGesReadResult (GES.ReadError e) =+fromGesReadResult _ (GES.ReadError e) =   ReadFailure $ ReadError e-fromGesReadResult (GES.ReadAccessDenied _) =-  ReadFailure AccessDenied+fromGesReadResult n (GES.ReadAccessDenied _) =+  ReadFailure $ AccessDenied n  -------------------------------------------------------------------------------- toGESStreamName :: StreamName -> GES.StreamName@@ -123,21 +129,21 @@  -------------------------------------------------------------------------------- instance Store GetEventStore where-  appendEvents (GetEventStore conn) name ver xs = liftIO $ do+  appendEvents (GetEventStore conn) name ver xs = liftBase $ do     events <- traverse makeEvent xs     w <- GES.sendEvents conn (toGESStreamName name) (toGesExpVer ver) events     return $ fmap (EventNumber . GES.writeNextExpectedVersion) w -  readBatch (GetEventStore conn) name b = liftIO $ do+  readBatch (GetEventStore conn) name b = liftBase $ do     let EventNumber n = batchFrom b     w <- GES.readStreamEventsForward conn (toGESStreamName name) n (batchSize b) True-    return $ fmap (fmap fromGesSlice . fromGesReadResult) w+    return $ fmap (fmap fromGesSlice . fromGesReadResult name) w -  subscribe (GetEventStore conn) name = liftIO $ do+  subscribe (GetEventStore conn) name = liftBase $ do     sub <- GES.subscribe conn (toGESStreamName name) True     sid <- freshSubscriptionId -    return $ Subscription sid $ liftIO $+    return $ Subscription sid $ liftBase $       try $ fmap fromGesEvent $ GES.nextEvent sub  --------------------------------------------------------------------------------
package.yaml view
@@ -8,19 +8,17 @@ - LICENSE.md - package.yaml - README.md-- stack.yaml ghc-options: -Wall github: YoEight/eventsource-api library:-  default-extensions:-    - NoImplicitPrelude   dependencies:   - base >=4.9 && <5-  - protolude >=0.1.10 && <0.3   - eventstore >=0.14 && <0.16   - eventsource-api >= 1.1   - aeson   - mtl+  - transformers-base+  - string-conversions   source-dirs: library license: BSD3 license-file: LICENSE.md@@ -45,4 +43,4 @@     - -with-rtsopts=-N     main: Main.hs     source-dirs: test-suite-version: '1.0.4'+version: '1.0.5'
− stack.yaml
@@ -1,68 +0,0 @@-# This file was automatically generated by 'stack init'-#-# Some commonly used options have been documented as comments in this file.-# For advanced use and comprehensive documentation of the format, please see:-# http://docs.haskellstack.org/en/stable/yaml_configuration/--# Resolver to choose a 'specific' stackage snapshot or a compiler version.-# A snapshot resolver dictates the compiler version and the set of packages-# to be used for project dependencies. For example:-#-# resolver: lts-3.5-# resolver: nightly-2015-09-21-# resolver: ghc-7.10.2-# resolver: ghcjs-0.1.0_ghc-7.10.2-# resolver:-#  name: custom-snapshot-#  location: "./custom-snapshot.yaml"-resolver: lts-9.0--# User packages to be built.-# Various formats can be used as shown in the example below.-#-# packages:-# - some-directory-# - https://example.com/foo/bar/baz-0.0.2.tar.gz-# - location:-#    git: https://github.com/commercialhaskell/stack.git-#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a-# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a-#   extra-dep: true-#  subdirs:-#  - auto-update-#  - wai-#-# A package marked 'extra-dep: true' will only be built if demanded by a-# non-dependency (i.e. a user package), and its test suites and benchmarks-# will not be run. This is useful for tweaking upstream packages.-packages:-- '.'-- '../api'--# Dependency packages to be pulled from upstream that are not in the resolver-# (e.g., acme-missiles-0.3)-extra-deps: []--# Override default flag values for local packages and extra-deps-flags: {}--# Extra package databases containing global packages-extra-package-dbs: []--# Control whether we use the GHC we find on the path-# system-ghc: true-#-# Require a specific version of stack, using version ranges-# require-stack-version: -any # Default-# require-stack-version: ">=1.2"-#-# Override the architecture used by stack, especially useful on Windows-# arch: i386-# arch: x86_64-#-# Extra directories used by stack for building-# extra-include-dirs: [/path/to/dir]-# extra-lib-dirs: [/path/to/dir]-#-# Allow a newer minor version of GHC than the snapshot specifies-# compiler-check: newer-minor