packages feed

Deadpan-DDP 0.9.1.0 → 0.9.3.0

raw patch · 4 files changed

+26/−8 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Web.DDP.Deadpan.Callbacks: rpc :: Text -> [EJsonValue] -> DeadpanApp GUID
- Web.DDP.Deadpan.Callbacks: clientRPCMethod :: Text -> Maybe [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp ()
+ Web.DDP.Deadpan.Callbacks: clientRPCMethod :: Text -> [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp GUID
- Web.DDP.Deadpan.Callbacks: rpcWait :: Text -> Maybe [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue)
+ Web.DDP.Deadpan.Callbacks: rpcWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue)
- Web.DDP.Deadpan.DSL: body :: Lens (LookupItem a_ajFx) (LookupItem a_ajGw) a_ajFx a_ajGw
+ Web.DDP.Deadpan.DSL: body :: Lens (LookupItem a_ajLX) (LookupItem a_ajMW) a_ajLX a_ajMW
- Web.DDP.Deadpan.DSL: callbackSet :: Lens (AppState cb_ajGN) (AppState cb_ajIf) (Lookup cb_ajGN) (Lookup cb_ajIf)
+ Web.DDP.Deadpan.DSL: callbackSet :: Lens (AppState cb_ajNd) (AppState cb_ajOF) (Lookup cb_ajNd) (Lookup cb_ajOF)
- Web.DDP.Deadpan.DSL: collections :: Lens' (AppState cb_ajGN) EJsonValue
+ Web.DDP.Deadpan.DSL: collections :: Lens' (AppState cb_ajNd) EJsonValue
- Web.DDP.Deadpan.DSL: connection :: Lens' (AppState cb_ajGN) Connection
+ Web.DDP.Deadpan.DSL: connection :: Lens' (AppState cb_ajNd) Connection
- Web.DDP.Deadpan.DSL: deadpanApp :: Iso (DeadpanApp a_ajIG) (DeadpanApp a_ajNa) (ReaderT (TVar (AppState Callback)) IO a_ajIG) (ReaderT (TVar (AppState Callback)) IO a_ajNa)
+ Web.DDP.Deadpan.DSL: deadpanApp :: Iso (DeadpanApp a_ajP6) (DeadpanApp a_ajTA) (ReaderT (TVar (AppState Callback)) IO a_ajP6) (ReaderT (TVar (AppState Callback)) IO a_ajTA)
- Web.DDP.Deadpan.DSL: ident :: Lens' (LookupItem a_ajFx) GUID
+ Web.DDP.Deadpan.DSL: ident :: Lens' (LookupItem a_ajLX) GUID

Files

Deadpan-DDP.cabal view
@@ -1,5 +1,5 @@ name:                Deadpan-DDP-version:             0.9.1.0+version:             0.9.3.0 synopsis:            Write clients for Meteor's DDP Protocol description:         The Deadpan-DDP project includes a debugging-tool, as well as a general purpose library.                      .
changelog.md view
@@ -1,5 +1,18 @@ # Deadpan-DDP Change Log +## 0.9.3.0++* RPC now only takes a list of params++## 0.9.2.0++* Hex GUID strings++## 0.9.1.0++* Better TODO Example+* Added subscription methods that return the subscription id+ ## 0.9.0.0  * Fixed the exit error
src/Web/DDP/Deadpan/Callbacks.hs view
@@ -113,22 +113,26 @@       randomSeed: optional JSON value           (an arbitrary client-determined seed for pseudo-random generators)   @ -}-clientRPCMethod :: Text -> Maybe [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp ()+clientRPCMethod :: Text -> [EJsonValue] -> GUID -> Maybe Text -> DeadpanApp GUID clientRPCMethod method params rpcid seed = do-  let msg = [("method", ejstring method)]-         &~ do forOf_ _Just params $ \v -> modify (("params", ejarray  v):)-               forOf_ _Just seed   $ \v -> modify (("seed",   ejstring v):)+  let msg = [ ("method", ejstring method)+            , ("params", ejarray  params) ]+         &~ (forOf_ _Just seed   $ \v -> modify (("seed",   ejstring v):))    sendMessage "method" (makeEJsonId rpcid <> ejobject msg)+  return rpcid +rpc :: Text -> [EJsonValue] -> DeadpanApp GUID+rpc method params = newID >>= \guid -> clientRPCMethod method params guid Nothing+ -- | Like clientRPCMethod, except that it blocks, returning the response from the server. -- -- TODO: Should we use the seed? ---rpcWait :: Text -> Maybe [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue)+rpcWait :: Text -> [EJsonValue] -> DeadpanApp (Either EJsonValue EJsonValue) rpcWait method params = do   mv         <- liftIO newEmptyMVar-  rpcId      <- newID+  rpcId      <- newID -- Can't use rpc, since we need the ID to set handlers first...   handlerId  <- setMatchHandler (makeEJsonId rpcId) (handler mv)   _          <- clientRPCMethod method params rpcId Nothing   res        <- liftIO $ readMVar mv
src/Web/DDP/Deadpan/GUID.hs view
@@ -41,6 +41,7 @@ import System.CPUTime import Data.Time import Data.Text+import Text.Printf import Data.Hashable import GHC.Generics @@ -69,7 +70,7 @@ newGuidInt = hash `fmap` hashTriple  newGuidString :: IO String-newGuidString = (show . hash) `fmap` hashTriple+newGuidString = printf "%016x" `fmap` newGuidInt  newGuidText :: IO Text newGuidText = pack `fmap` newGuidString