Skip to content

Commit

Permalink
feat: Update aeson upper version to latest (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
cptrodolfox authored Dec 29, 2022
1 parent 079c6b5 commit 4ed679e
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ['8.6', '8.8', '8.10']
ghc: ['8.8', '8.10']

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions rollbar-cli/package.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: rollbar-cli
version: 0.1.0
version: 1.0.0
github: "stackbuilders/rollbar-haskell"
license: MIT
author: "Stack Builders Inc."
maintainer: "Sebastián Estrella <[email protected]>"
copyright: "2020 Stack Builders Inc."
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2

extra-source-files:
- README.md
Expand All @@ -22,7 +22,7 @@ ghc-options:
- -Wall

dependencies:
- base >= 4.12 && < 5
- base >= 4.13 && < 5

_exe-ghc-options: &exe-ghc-options
- -threaded
Expand All @@ -33,7 +33,7 @@ library:
source-dirs: src
dependencies:
- optparse-applicative >= 0.14 && < 1
- rollbar-client >= 0.1 && < 1
- rollbar-client >= 1.0 && < 2

executables:
rollbar:
Expand Down
12 changes: 6 additions & 6 deletions rollbar-cli/rollbar-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cabal-version: 1.12
-- hash: 550be30f2b0d05cb1448d3ac2048f42b360608d96c8bd70aa2815abe73fb9c08

name: rollbar-cli
version: 0.1.0
version: 1.0.0
synopsis: Simple CLI tool to perform commons tasks such as tracking deploys.
description: Please see the README on GitHub at
<https://github.com/stackbuilders/rollbar-haskell/tree/master/rollbar-cli>
Expand All @@ -18,7 +18,7 @@ maintainer: Sebastián Estrella <[email protected]>
copyright: 2020 Stack Builders Inc.
license: MIT
license-file: LICENSE
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2
build-type: Simple
extra-source-files:
README.md
Expand All @@ -37,9 +37,9 @@ library
src
ghc-options: -Wall
build-depends:
base >=4.12 && <5
base >=4.13 && <5
, optparse-applicative >=0.14 && <1
, rollbar-client >=0.1 && <1
, rollbar-client >=1 && <2
default-language: Haskell2010

executable rollbar
Expand All @@ -50,7 +50,7 @@ executable rollbar
app
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.12 && <5
base >=4.13 && <5
, rollbar-cli
, rollbar-client
default-language: Haskell2010
Expand All @@ -64,6 +64,6 @@ test-suite spec
test
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.12 && <5
base >=4.13 && <5
, rollbar-cli
default-language: Haskell2010
13 changes: 12 additions & 1 deletion rollbar-client/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Changelog for rollbar-client

## Unreleased changes
All notable changes to this project will be documented in this file

## [1.0.0] - 2022-12-28

### Changed

- Updated dependency aeson version.
- Updated base version

### Removed

- Support for GHC 8.6.1
8 changes: 4 additions & 4 deletions rollbar-client/package.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: rollbar-client
version: 0.1.0
version: 1.0.0
github: "stackbuilders/rollbar-haskell"
license: MIT
author: "Stack Builders Inc."
maintainer: "Sebastián Estrella <[email protected]>"
copyright: "2020 Stack Builders Inc."
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2

extra-source-files:
- README.md
Expand All @@ -22,7 +22,7 @@ ghc-options:
- -Wall

dependencies:
- base >= 4.12 && < 5
- base >= 4.13 && < 5

flags:
example:
Expand All @@ -38,7 +38,7 @@ _exe-ghc-options: &exe-ghc-options
library:
source-dirs: src
dependencies:
- aeson >= 1.4 && < 2
- aeson >= 2.0 && <3
- bytestring >= 0.10 && < 1
- directory >= 1.3 && < 2
- exceptions >= 0.10 && < 1
Expand Down
12 changes: 6 additions & 6 deletions rollbar-client/rollbar-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cabal-version: 1.12
-- hash: b3e835bcc225cb66a06268126c5a04b48d06fd90b55677e26219ecfe207068d3

name: rollbar-client
version: 0.1.0
version: 1.0.0
synopsis: Core library to communicate with Rollbar API.
description: Please see the README on GitHub at
<https://github.com/stackbuilders/rollbar-haskell/tree/master/rollbar-client>
Expand All @@ -18,7 +18,7 @@ maintainer: Sebastián Estrella <[email protected]>
copyright: 2020 Stack Builders Inc.
license: MIT
license-file: LICENSE
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2
build-type: Simple
extra-source-files:
README.md
Expand Down Expand Up @@ -47,8 +47,8 @@ library
src
ghc-options: -Wall
build-depends:
aeson >=1.4 && <2
, base >=4.12 && <5
aeson >=2.0 && <3
, base >=4.13 && <5
, bytestring >=0.10 && <1
, directory >=1.3 && <2
, exceptions >=0.10 && <1
Expand All @@ -68,7 +68,7 @@ executable client-example
example
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.12 && <5
base >=4.13 && <5
, rollbar-client
, text
if flag(example)
Expand All @@ -90,7 +90,7 @@ test-suite spec
hspec-discover:hspec-discover >=2.7 && <3
build-depends:
aeson
, base >=4.12 && <5
, base >=4.13 && <5
, hspec >=2.7 && <3
, mtl
, rollbar-client
Expand Down
19 changes: 10 additions & 9 deletions rollbar-client/src/Rollbar/Client/Item.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module Rollbar.Client.Item
) where

import qualified Control.Exception as E
import qualified Data.HashMap.Strict as HM
import qualified Data.Aeson.KeyMap as KM
import qualified Data.Aeson.Key as K
import qualified Data.Text as T

import Control.Monad.IO.Class (MonadIO(..))
Expand Down Expand Up @@ -239,7 +240,7 @@ data Message = Message

instance ToJSON Message where
toJSON Message{..} = Object $
HM.insert "body" (toJSON messageBody) messageMetadata
KM.insert "body" (toJSON messageBody) messageMetadata

-- | The severity level. One of: "critical", "error", "warning", "info",
-- "debug" Defaults to "error" for exceptions and "info" for messages. The
Expand Down Expand Up @@ -308,18 +309,18 @@ getRequestModifier :: (HasSettings m, Monad m) => m (Request -> Request)
getRequestModifier = do
RequestModifiers{..} <- settingsRequestModifiers <$> getSettings
return $ appEndo $ mconcat $ catMaybes
[ withHeaders . excludeNames <$> requestModifiersExcludeHeaders
, withParams . excludeNames <$> requestModifiersExcludeParams
, withHeaders . includeNames <$> requestModifiersIncludeHeaders
, withParams . includeNames <$> requestModifiersIncludeParams
[ withHeaders . excludeNames . fmap K.fromText <$> requestModifiersExcludeHeaders
, withParams . excludeNames . fmap K.fromText <$> requestModifiersExcludeParams
, withHeaders . includeNames . fmap K.fromText <$> requestModifiersIncludeHeaders
, withParams . includeNames . fmap K.fromText <$> requestModifiersIncludeParams
]
where
withHeaders f = Endo $ \request -> request
{ requestHeaders = f $ requestHeaders request }
withParams f = Endo $ \request -> request
{ requestParams = f $ requestParams request }
excludeNames names = HM.filterWithKey $ \name _ -> name `notElem` names
includeNames names = HM.filterWithKey $ \name _ -> name `elem` names
excludeNames names = KM.filterWithKey $ \name _ -> name `notElem` names
includeNames names = KM.filterWithKey $ \name _ -> name `elem` names

-- | Data about the server related to this event.
data Server = Server
Expand Down Expand Up @@ -360,7 +361,7 @@ instance ToJSON Notifier where
defaultNotifier :: Notifier
defaultNotifier = Notifier
{ notifierName = "rollbar-client"
, notifierVersion = "0.1.0"
, notifierVersion = "1.0.0"
}

newtype ItemId = ItemId Text
Expand Down
16 changes: 8 additions & 8 deletions rollbar-client/test/Rollbar/ClientSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Rollbar.ClientSpec
( spec
) where

import qualified Data.HashMap.Strict as HM
import qualified Data.Aeson.KeyMap as KM

import Control.Monad.Reader
import Data.Aeson
Expand Down Expand Up @@ -41,11 +41,11 @@ spec = do
request = Request
{ requestUrl = "http://example.com"
, requestMethod = "GET"
, requestHeaders = HM.fromList
, requestHeaders = KM.fromList
[ ("Host", "example.com")
, ("Secret", "p4ssw0rd")
]
, requestParams = HM.fromList
, requestParams = KM.fromList
[ ("user", "John Doe")
, ("password", "p4ssw0rd")
]
Expand All @@ -61,28 +61,28 @@ spec = do
defaultRequestModifiers
{ requestModifiersExcludeHeaders = Just $ pure "Secret" }
in requestModifier request `shouldBe` request
{ requestHeaders = HM.fromList [("Host", "example.com")] }
{ requestHeaders = KM.fromList [("Host", "example.com")] }

it "excludes the params not matching the given names" $
let requestModifier = runReader getRequestModifier $ mkSettings $
defaultRequestModifiers
{ requestModifiersExcludeParams = Just $ pure "password" }
in requestModifier request `shouldBe` request
{ requestParams = HM.fromList [("user", "John Doe")] }
{ requestParams = KM.fromList [("user", "John Doe")] }

it "includes only the headers matching the given names" $
let requestModifier = runReader getRequestModifier $ mkSettings $
defaultRequestModifiers
{ requestModifiersIncludeHeaders = Just $ pure "Host" }
in requestModifier request `shouldBe` request
{ requestHeaders = HM.fromList [("Host", "example.com")] }
{ requestHeaders = KM.fromList [("Host", "example.com")] }

it "includes only the params matching the given names" $
let requestModifier = runReader getRequestModifier $ mkSettings $
defaultRequestModifiers
{ requestModifiersIncludeParams = Just $ pure "user" }
in requestModifier request `shouldBe` request
{ requestParams = HM.fromList [("user", "John Doe")] }
{ requestParams = KM.fromList [("user", "John Doe")] }

describe "defaultNotifier" $
it "matches the package name and version" $ do
Expand Down Expand Up @@ -127,7 +127,7 @@ spec = do
itemId <- runRollbar settings $ do
item <- mkItem $ PayloadMessage $ Message
{ messageBody = "Request over threshold of 10 seconds"
, messageMetadata = HM.fromList
, messageMetadata = KM.fromList
[ ("route", "home#index")
, ("time_elapsed", Number 15.23)
]
Expand Down
10 changes: 5 additions & 5 deletions rollbar-wai/package.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: rollbar-wai
version: 0.1.0
version: 1.0.0
github: "stackbuilders/rollbar-haskell"
license: MIT
author: "Stack Builders Inc."
maintainer: "Sebastián Estrella <[email protected]>"
copyright: "2020 Stack Builders Inc."
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2

extra-source-files:
- README.md
Expand All @@ -24,7 +24,7 @@ ghc-options:
- -Wall

dependencies:
- base >= 4.12 && < 5
- base >= 4.13 && < 5

flags:
example:
Expand All @@ -40,11 +40,11 @@ _exe-ghc-options: &exe-ghc-options
library:
source-dirs: src
dependencies:
- aeson >= 1.4 && < 2
- aeson >= 2.0 && <3
- bytestring >= 0.10 && < 1
- case-insensitive >= 1.2 && < 2
- http-types >= 0.12 && < 1
- rollbar-client >= 0.1 && < 1
- rollbar-client >= 1.0 && < 2
- text >= 1.2 && < 2
- unordered-containers >= 0.2 && < 1
- wai >= 3.2 && < 4
Expand Down
14 changes: 7 additions & 7 deletions rollbar-wai/rollbar-wai.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cabal-version: 1.12
-- hash: 36882de3e15bbc25fa5b54c1ee7d9dbe96436e87f4502b002a3a388508677741

name: rollbar-wai
version: 0.1.0
version: 1.0.0
synopsis: Provides error reporting capabilities to WAI based applications through Rollbar API.

description: Please see the README on GitHub at
Expand All @@ -19,7 +19,7 @@ maintainer: Sebastián Estrella <[email protected]>
copyright: 2020 Stack Builders Inc.
license: MIT
license-file: LICENSE
tested-with: GHC ==8.6.5, GHC ==8.8.4, GHC ==8.10.2
tested-with: GHC ==8.8.4, GHC ==8.10.2
build-type: Simple
extra-source-files:
README.md
Expand All @@ -43,12 +43,12 @@ library
src
ghc-options: -Wall
build-depends:
aeson >=1.4 && <2
, base >=4.12 && <5
aeson >=2.0 && <3
, base >=4.13 && <5
, bytestring >=0.10 && <1
, case-insensitive >=1.2 && <2
, http-types >=0.12 && <1
, rollbar-client >=0.1 && <1
, rollbar-client >=1.0 && <2
, text >=1.2 && <2
, unordered-containers >=0.2 && <1
, wai >=3.2 && <4
Expand All @@ -63,7 +63,7 @@ executable wai-example
example
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.12 && <5
base >=4.13 && <5
, rollbar-client
, rollbar-wai
, wai
Expand All @@ -87,7 +87,7 @@ test-suite spec
hspec-discover:hspec-discover >=2.7 && <3
build-depends:
aeson
, base >=4.12 && <5
, base >=4.13 && <5
, hspec >=2.7 && <3
, http-types
, mtl >=2.2 && <3
Expand Down
Loading

0 comments on commit 4ed679e

Please sign in to comment.