morpheus-graphql 0.3.0 → 0.3.1
raw patch · 4 files changed
+25/−34 lines, 4 filesdep −attoparsecdep −utf8-stringdep ~aeson
Dependencies removed: attoparsec, utf8-string
Dependency ranges changed: aeson
Files
- README.md +1/−2
- changelog.md +11/−6
- morpheus-graphql.cabal +3/−14
- src/Data/Morpheus/Execution/Server/Resolve.hs +10/−12
README.md view
@@ -26,10 +26,9 @@ _stack.yml_ ```yaml-resolver: lts-13.24+resolver: lts-13.30 extra-deps:- - megaparsec-7.0.5 - aeson-1.4.4.0 - time-compat-1.9.2.2 ```
changelog.md view
@@ -1,3 +1,10 @@+## [0.3.1] - 05.10.2019++### Changed++- removed dependencies: attoparsec , utf8-string+- updated aeson lower bound up to: 1.4.4.0+ ## [0.3.0] - 04.10.2019 ### Added@@ -30,7 +37,7 @@ ```haskell data Deity m = Deity {- name :: () -> m String+ name :: () -> m Text, power :: () -> m (Power m) } ```@@ -50,15 +57,13 @@ will be generated. ```haskell- $(importGQLDocumentWithNamespace "examples/Sophisticated/api.gql")- data Deity m = Deity {- DeityName :: DeityNameArgs -> m String- DeityPower :: () -> m (Power m)+ deityName :: DeityNameArgs -> m Text,+ deityPower :: () -> m (Power m) } data DeityNameArgs = DeityNameArgs {- deityNameId :: Int+ deityNameArgsId :: Int } ```
morpheus-graphql.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9eb00b52c6088e489408ff248d45e1402e955f2885390bbcc2fbd26944051b36+-- hash: 67b09c4ab9487b3b733622bc074185fee7c90c8828efc81188d85dd4b7507df8 name: morpheus-graphql-version: 0.3.0+version: 0.3.1 synopsis: Morpheus GraphQL description: Build GraphQL APIs with your favourite functional language! category: web, graphql@@ -321,8 +321,7 @@ src ghc-options: -Wall build-depends:- aeson >=1.0 && <=1.5- , attoparsec >=0.13.2 && <0.14+ aeson >=1.4.4.0 && <=1.6 , base >=4.7 && <5 , bytestring >=0.10.4 && <0.11 , containers >=0.4.2.1 && <0.7@@ -334,10 +333,8 @@ , text >=1.2.3.0 && <1.3 , transformers >=0.3.0.0 && <0.6 , unordered-containers >=0.2.8.0 && <0.3- , utf8-string >=1.0.1 && <1.1 , uuid >=1.0 && <=1.4 , vector >=0.12.0.1 && <0.13- , wai-websockets >=1.0 && <=3.5 , websockets >=0.11.0 && <=0.12.5.3 default-language: Haskell2010 @@ -360,7 +357,6 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: aeson- , attoparsec >=0.13.2 && <0.14 , base >=4.7 && <5 , bytestring , containers >=0.4.2.1 && <0.7@@ -374,7 +370,6 @@ , text , transformers >=0.3.0.0 && <0.6 , unordered-containers >=0.2.8.0 && <0.3- , utf8-string >=1.0.1 && <1.1 , uuid >=1.0 && <=1.4 , vector >=0.12.0.1 && <0.13 , wai@@ -392,7 +387,6 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: aeson- , attoparsec >=0.13.2 && <0.14 , base >=4.7 && <5 , bytestring , containers >=0.4.2.1 && <0.7@@ -407,10 +401,8 @@ , text , transformers >=0.3.0.0 && <0.6 , unordered-containers >=0.2.8.0 && <0.3- , utf8-string >=1.0.1 && <1.1 , uuid >=1.0 && <=1.4 , vector >=0.12.0.1 && <0.13- , wai-websockets >=1.0 && <=3.5 , websockets >=0.11.0 && <=0.12.5.3 default-language: Haskell2010 @@ -433,7 +425,6 @@ ghc-options: -Wall build-depends: aeson- , attoparsec >=0.13.2 && <0.14 , base >=4.7 && <5 , bytestring >=0.10.4 && <0.11 , containers >=0.4.2.1 && <0.7@@ -448,9 +439,7 @@ , text >=1.2.3.0 && <1.3 , transformers >=0.3.0.0 && <0.6 , unordered-containers >=0.2.8.0 && <0.3- , utf8-string >=1.0.1 && <1.1 , uuid >=1.0 && <=1.4 , vector >=0.12.0.1 && <0.13- , wai-websockets >=1.0 && <=3.5 , websockets >=0.11.0 && <=0.12.5.3 default-language: Haskell2010
src/Data/Morpheus/Execution/Server/Resolve.hs view
@@ -15,13 +15,11 @@ , fullSchema ) where -import qualified Codec.Binary.UTF8.String as UTF8 import Control.Monad.Except (liftEither) import Control.Monad.Trans.Except (ExceptT (..), runExceptT)-import Data.Aeson (Result (..), encode, fromJSON)-import Data.Aeson.Parser (jsonNoDup)-import Data.Attoparsec.ByteString (parseOnly)-import qualified Data.ByteString as S+import Data.Aeson (encode)+import Data.Aeson.Internal (formatError, ifromJSON)+import Data.Aeson.Parser (eitherDecodeWith, jsonNoDup) import qualified Data.ByteString.Lazy.Char8 as L import Data.Functor.Identity (Identity (..)) import Data.Proxy (Proxy (..))@@ -64,17 +62,17 @@ , EncodeMutCon m event cont mutation , EncodeSubCon m event cont subscription) -decodeNoDup :: L.ByteString -> Result GQLRequest-decodeNoDup bs =- case parseOnly jsonNoDup (S.pack . UTF8.encode $ L.unpack bs) of- Left e -> Error e- Right v -> fromJSON v+decodeNoDup :: L.ByteString -> Either String GQLRequest+decodeNoDup str =+ case eitherDecodeWith jsonNoDup ifromJSON str of+ Left (path, x) -> Left $ formatError path x+ Right value -> Right value byteStringIO :: Monad m => (GQLRequest -> m GQLResponse) -> L.ByteString -> m L.ByteString byteStringIO resolver request = case decodeNoDup request of- Error aesonError' -> return $ badRequestError aesonError'- Success req -> encode <$> resolver req+ Left aesonError' -> return $ badRequestError aesonError'+ Right req -> encode <$> resolver req statelessResolver :: (Monad m, RootResCon m s cont query mut sub)