packages feed

morpheus-graphql-subscriptions 0.17.0 → 0.18.0

raw patch · 4 files changed

+26/−34 lines, 4 filesdep ~morpheus-graphql-appdep ~morpheus-graphql-corePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: morpheus-graphql-app, morpheus-graphql-core

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,5 +1,7 @@ # Changelog +## 0.18.0 - 08.11.2021+ ## 0.17.0 - 25.02.2021  ## 0.16.0 - 05.11.2020
morpheus-graphql-subscriptions.cabal view
@@ -1,13 +1,13 @@ 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: 40586929fbcd9a5ce62f2ead4671794c67d60abbc29dc992cf7bc859c5ee5735+-- hash: 54dee88f65b459eb5f01523b3d409aee9fc4679f02786b1f5bbd046abfc869a7  name:           morpheus-graphql-subscriptions-version:        0.17.0+version:        0.18.0 synopsis:       Morpheus GraphQL Subscriptions description:    Build GraphQL APIs with your favourite functional language! category:       web, graphql, subscriptions@@ -45,8 +45,8 @@       aeson >=1.4.4.0 && <=1.6     , base >=4.7 && <5     , bytestring >=0.10.4 && <0.11-    , morpheus-graphql-app >=0.17.0 && <=0.18.0-    , morpheus-graphql-core >=0.17.0 && <0.18.0+    , morpheus-graphql-app >=0.18.0 && <0.19.0+    , morpheus-graphql-core >=0.18.0 && <0.19.0     , mtl >=2.0 && <=3.0     , relude >=0.3.0     , text >=1.2.3.0 && <1.3@@ -70,8 +70,8 @@     , base >=4.7 && <5     , bytestring >=0.10.4 && <0.11     , directory >=1.0-    , morpheus-graphql-app >=0.17.0 && <=0.18.0-    , morpheus-graphql-core >=0.17.0 && <0.18.0+    , morpheus-graphql-app >=0.18.0 && <0.19.0+    , morpheus-graphql-core >=0.18.0 && <0.19.0     , mtl >=2.0 && <=3.0     , relude >=0.3.0     , tasty
src/Data/Morpheus/Subscriptions/ClientConnectionStore.hs view
@@ -35,8 +35,7 @@   ( EventHandler (..),   ) import Data.Morpheus.Internal.Utils-  ( Collection (..),-    Empty (..),+  ( Empty (..),     KeyOf (..),   ) import Data.Morpheus.Subscriptions.Apollo@@ -223,9 +222,6 @@  instance Empty (ClientConnectionStore (Event ch con) m) where   empty = ClientConnectionStore empty HM.empty HM.empty--instance Collection (ClientConnection m) (ClientConnectionStore (Event ch con) m) where-  singleton x = ClientConnectionStore (singleton x) HM.empty HM.empty  mapConnections ::   ( HashMap UUID (ClientConnection m) -> HashMap UUID (ClientConnection m)
src/Data/Morpheus/Subscriptions/Stream.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-}@@ -23,6 +24,7 @@   ) where +import Control.Monad.Except (throwError) import Data.ByteString.Lazy.Char8 (ByteString) import Data.Morpheus.App.Internal.Resolving   ( Channel,@@ -32,12 +34,6 @@     ResultT (..),     runResultT,   )-import Data.Morpheus.Error-  ( globalErrorMessage,-  )-import Data.Morpheus.Internal.Utils-  ( failure,-  ) import Data.Morpheus.Subscriptions.Apollo   ( ApolloAction (..),     apolloFormat,@@ -57,7 +53,7 @@     GQLResponse (..),   ) import Data.Morpheus.Types.Internal.AST-  ( GQLErrors,+  ( GQLError,     VALID,     Value (..),   )@@ -118,13 +114,15 @@ handleResponseStream session (ResultT res) =   SubOutput $ const $ unfoldR <$> res   where-    execute Publish {} = apolloError $ globalErrorMessage "websocket can only handle subscriptions, not mutations"+    execute Publish {} =+      apolloError+        ["websocket can only handle subscriptions, not mutations"]     execute (Subscribe ch subRes) = Right $ startSession ch subRes session     ---------------------------    unfoldR Success {events} = traverse execute events-    unfoldR Failure {errors} = apolloError errors+    unfoldR Success {result = (events, _)} = traverse execute events+    unfoldR Failure {errors} = apolloError (toList errors)     ---------------------------    apolloError :: GQLErrors -> Either ByteString a+    apolloError :: [GQLError] -> Either ByteString a     apolloError = Left . toApolloResponse (sid session) . Errors  handleWSRequest ::@@ -205,10 +203,10 @@   res   PubContext {eventPublisher} = runResultT (handleRes res execute) >>= runResult     where-      runResult Success {result, events} = traverse_ eventPublisher events $> Data result-      runResult Failure {errors} = pure $ Errors errors+      runResult Success {result = (events, result)} = traverse_ eventPublisher events $> Data result+      runResult Failure {errors} = pure $ Errors $ toList errors       execute (Publish event) = pure event-      execute Subscribe {} = failure (globalErrorMessage "http server can't handle subscription")+      execute Subscribe {} = throwError "http server can't handle subscription"  handleRes ::   (Monad m) =>@@ -220,13 +218,9 @@ unfoldRes ::   (Monad m) =>   (e -> ResultT e' m e') ->-  Result e a ->+  Result GQLError ([e], a) ->   ResultT e' m a-unfoldRes execute Success {result, warnings, events} =-  traverse execute events-    >>= ( ResultT . pure-            . Success-              result-              warnings-        )+unfoldRes execute Success {result = (events, result), ..} = traverse execute events >>= packResultT+  where+    packResultT events' = ResultT $ pure $ Success {result = (events', result), ..} unfoldRes _ Failure {errors} = ResultT $ pure $ Failure {errors}