eventstore 1.4.1 → 1.4.2
raw patch · 7 files changed
+65/−34 lines, 7 filesdep +hspecdep ~aesonPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: hspec
Dependency ranges changed: aeson
API changes (from Hackage documentation)
- Database.EventStore: getCustomProperty :: FromJSON a => StreamMetadata -> Text -> Maybe a
+ Database.EventStore: getCustomProperty :: FromJSON a => StreamMetadata -> Key -> Maybe a
- Database.EventStore: getCustomPropertyValue :: StreamMetadata -> Text -> Maybe Value
+ Database.EventStore: getCustomPropertyValue :: StreamMetadata -> Key -> Maybe Value
- Database.EventStore: nonEmpty :: () => [a] -> Maybe (NonEmpty a)
+ Database.EventStore: nonEmpty :: [a] -> Maybe (NonEmpty a)
- Database.EventStore: setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder
+ Database.EventStore: setCustomProperty :: ToJSON a => Key -> a -> StreamMetadataBuilder
Files
- CHANGELOG.markdown +4/−0
- Database/EventStore/Internal/Types.hs +22/−22
- eventstore.cabal +33/−11
- tests/Test/Bus.hs +1/−0
- tests/Test/Connection.hs +1/−0
- tests/Test/Integration/Tests.hs +3/−1
- tests/Test/Operation.hs +1/−0
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.4.2+-----+Bump `aeson` to >= 2.+ 1.4.1 ----- * Update EventStore website link in documentation.
Database/EventStore/Internal/Types.hs view
@@ -31,8 +31,8 @@ import Control.Monad.Reader import qualified Data.Aeson as A import Data.Aeson.Types (Object, ToJSON(..), Pair, Parser, (.=))+import qualified Data.Aeson.KeyMap as KeyMap import Data.DotNet.TimeSpan-import Data.HashMap.Strict (filterWithKey) import Data.ProtocolBuffers import Data.Time (NominalDiffTime) import Data.Time.Clock.POSIX@@ -722,14 +722,14 @@ -------------------------------------------------------------------------------- -- | Gets a custom property value from metadata.-getCustomPropertyValue :: StreamMetadata -> Text -> Maybe A.Value-getCustomPropertyValue s k = lookup k obj+getCustomPropertyValue :: StreamMetadata -> A.Key -> Maybe A.Value+getCustomPropertyValue s k = KeyMap.lookup k obj where obj = streamMetadataCustom s -------------------------------------------------------------------------------- -- | Get a custom property value from metadata.-getCustomProperty :: A.FromJSON a => StreamMetadata -> Text -> Maybe a+getCustomProperty :: A.FromJSON a => StreamMetadata -> A.Key -> Maybe a getCustomProperty s k = do v <- getCustomPropertyValue s k case A.fromJSON v of@@ -760,7 +760,7 @@ -------------------------------------------------------------------------------- -- | Maps an 'Object' to a list of 'Pair' to ease the 'StreamMetadata'. customMetaToPairs :: Object -> [Pair]-customMetaToPairs = fmap go . mapToList+customMetaToPairs = fmap go . KeyMap.toList where go (k,v) = k .= v @@ -814,60 +814,60 @@ -- Stream ACL Properties -------------------------------------------------------------------------------- -- | Read ACL property.-p_readRoles :: Text+p_readRoles :: A.Key p_readRoles = "$r" -------------------------------------------------------------------------------- -- | Write ACL property.-p_writeRoles :: Text+p_writeRoles :: A.Key p_writeRoles = "$w" -------------------------------------------------------------------------------- -- | Delete ACL property.-p_deleteRoles :: Text+p_deleteRoles :: A.Key p_deleteRoles = "$d" -------------------------------------------------------------------------------- -- | Metadata read ACL property.-p_metaReadRoles :: Text+p_metaReadRoles :: A.Key p_metaReadRoles = "$mr" -------------------------------------------------------------------------------- -- | Metadata write ACL property.-p_metaWriteRoles :: Text+p_metaWriteRoles :: A.Key p_metaWriteRoles = "$mw" -------------------------------------------------------------------------------- -- Internal MetaData Properties -------------------------------------------------------------------------------- -- | Max age metadata property.-p_maxAge :: Text+p_maxAge :: A.Key p_maxAge = "$maxAge" -------------------------------------------------------------------------------- -- | Max count metadata property.-p_maxCount :: Text+p_maxCount :: A.Key p_maxCount = "$maxCount" -------------------------------------------------------------------------------- -- | truncated before metadata property.-p_truncateBefore :: Text+p_truncateBefore :: A.Key p_truncateBefore = "$tb" -------------------------------------------------------------------------------- -- | Cache control metadata property.-p_cacheControl :: Text+p_cacheControl :: A.Key p_cacheControl = "$cacheControl" -------------------------------------------------------------------------------- -- | ACL metadata property.-p_acl :: Text+p_acl :: A.Key p_acl = "$acl" -------------------------------------------------------------------------------- -- | Gathers every internal metadata properties into a 'Set'. It used to safely -- 'StreamMetadata' in JSON.-internalMetaProperties :: Set Text+internalMetaProperties :: Set A.Key internalMetaProperties = setFromList [ p_maxAge , p_maxCount@@ -879,13 +879,13 @@ -------------------------------------------------------------------------------- -- | Only keeps the properties the users has set. keepUserProperties :: Object -> Object-keepUserProperties = filterWithKey go+keepUserProperties = KeyMap.filterWithKey go where go k _ = notMember k internalMetaProperties -------------------------------------------------------------------------------- -- | Parses a 'NominalDiffTime' from an 'Object' given a JSON property.-parseNominalDiffTime :: Text -> Object -> Parser (Maybe NominalDiffTime)+parseNominalDiffTime :: A.Key -> Object -> Parser (Maybe NominalDiffTime) parseNominalDiffTime k m = fmap (fmap go) (m A..: k) where go n = (realToFrac $ CTime n)@@ -903,7 +903,7 @@ parseStreamACL _ = mzero ---------------------------------------------------------------------------------parseSingleOrMultiple :: A.Object -> Text -> Parser (Maybe [Text])+parseSingleOrMultiple :: A.Object -> A.Key -> Parser (Maybe [Text]) parseSingleOrMultiple obj name = multiple <|> single where single = do@@ -924,7 +924,7 @@ <*> ((m A..: p_acl >>= traverse parseStreamACL) <|> pure Nothing) <*> pure (keepUserProperties m) where- parseTimeSpan :: Text -> Parser (Maybe TimeSpan)+ parseTimeSpan :: A.Key -> Parser (Maybe TimeSpan) parseTimeSpan prop = do (secs :: Maybe Int64) <- m A..: prop return $ fmap (fromSeconds . realToFrac) secs@@ -1044,10 +1044,10 @@ -------------------------------------------------------------------------------- -- | Sets a custom metadata property.-setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder+setCustomProperty :: ToJSON a => A.Key -> a -> StreamMetadataBuilder setCustomProperty k v = Endo $ \s -> let m = streamMetadataCustom s- m' = insertMap k (toJSON v) m in+ m' = KeyMap.insert k (toJSON v) m in s { streamMetadataCustom = m' } --------------------------------------------------------------------------------
eventstore.cabal view
@@ -1,31 +1,30 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: ce06cc20eb2ef61c0d52dc888830182016c2f8c1d036e25d6e481d12b9d0ae76 name: eventstore-version: 1.4.1+version: 1.4.2 synopsis: EventStore TCP Client description: EventStore TCP Client <https://eventstore.com> category: Database-homepage: https://github.com/YoEight/eventstore+homepage: https://github.com/EventStore/EventStoreDB-Client-Haskell author: Yorick Laupa maintainer: yo.eight@gmail.com copyright: Yorick Laupa license: BSD3 license-file: LICENSE-tested-with: GHC >= 8.0 && <= 8.8 build-type: Simple+tested-with:+ GHC >= 8.0 && <= 8.8 extra-source-files: README.md CHANGELOG.markdown source-repository head type: git- location: https://github.com/YoEight/eventstore.git+ location: https://github.com/EventStore/EventStoreDB-Client-Haskell.git library exposed-modules:@@ -84,10 +83,21 @@ Database.EventStore.Internal.Utils Paths_eventstore hs-source-dirs:- ./.- default-extensions: NoImplicitPrelude OverloadedStrings LambdaCase RecordWildCards RankNTypes TemplateHaskell QuasiQuotes FlexibleContexts MultiParamTypeClasses TypeFamilies ConstraintKinds+ ./+ default-extensions:+ NoImplicitPrelude+ OverloadedStrings+ LambdaCase+ RecordWildCards+ RankNTypes+ TemplateHaskell+ QuasiQuotes+ FlexibleContexts+ MultiParamTypeClasses+ TypeFamilies+ ConstraintKinds build-depends:- aeson >=0.8+ aeson >=2 , array , base >=4.7 && <5 , bifunctors@@ -139,7 +149,18 @@ Paths_eventstore hs-source-dirs: tests- default-extensions: NoImplicitPrelude OverloadedStrings LambdaCase RecordWildCards RankNTypes TemplateHaskell QuasiQuotes FlexibleContexts MultiParamTypeClasses TypeFamilies ConstraintKinds+ default-extensions:+ NoImplicitPrelude+ OverloadedStrings+ LambdaCase+ RecordWildCards+ RankNTypes+ TemplateHaskell+ QuasiQuotes+ FlexibleContexts+ MultiParamTypeClasses+ TypeFamilies+ ConstraintKinds ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: aeson@@ -155,6 +176,7 @@ , fast-logger , file-embed , hashable+ , hspec , lifted-async , lifted-base , monad-control
tests/Test/Bus.hs view
@@ -17,6 +17,7 @@ -------------------------------------------------------------------------------- import Test.Common+import Test.Hspec (Spec, beforeAll, specify, shouldBe) import Test.Tasty.Hspec --------------------------------------------------------------------------------
tests/Test/Connection.hs view
@@ -17,6 +17,7 @@ -------------------------------------------------------------------------------- import Test.Bogus.Connection import Test.Common+import Test.Hspec (Spec, beforeAll, specify) import Test.Tasty.Hspec spec :: Spec
tests/Test/Integration/Tests.hs view
@@ -20,6 +20,7 @@ import Prelude (fail) import Control.Concurrent.Async (wait) import Data.Aeson+import qualified Data.Aeson.Key as Key import Data.DotNet.TimeSpan import Data.FileEmbed (embedFile) import Data.Maybe (fromMaybe)@@ -27,6 +28,7 @@ import Data.UUID.V4 import qualified Streaming.Prelude as Streaming import System.Environment (lookupEnv)+import Test.Hspec (Spec, it, afterAll, beforeAll, describe, parallel) import Test.Tasty.HUnit import Test.Tasty.Hspec @@ -552,7 +554,7 @@ -------------------------------------------------------------------------------- toObj :: Int -> Value-toObj n = object [ pack (show n) .= n ]+toObj n = object [ Key.fromString (show n) .= n ] -------------------------------------------------------------------------------- streamRegularStreamForwardTest :: Connection -> IO ()
tests/Test/Operation.hs view
@@ -19,6 +19,7 @@ -------------------------------------------------------------------------------- import Test.Bogus.Connection import Test.Common+import Test.Hspec (Spec, beforeAll, specify, shouldBe) import Test.Tasty.Hspec --------------------------------------------------------------------------------