packages feed

servant-purescript 0.4.0.1 → 0.5.0.0

raw patch · 5 files changed

+13/−13 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Servant.PureScript.Internal: pName :: forall f_abHf. Lens' (Param f_abHf) ParamName
+ Servant.PureScript.Internal: pName :: forall f_akfh. Lens' (Param f_akfh) ParamName
- Servant.PureScript.Internal: pType :: forall f_abHf f_agdO. Lens (Param f_abHf) (Param f_agdO) f_abHf f_agdO
+ Servant.PureScript.Internal: pType :: forall f_akfh f_an1C. Lens (Param f_akfh) (Param f_an1C) f_akfh f_an1C

Files

Readme.md view
@@ -8,15 +8,15 @@  ## Features - - Typed serialization/deserialization taken care of by Haskell's aeson and PureScript's argonaut.+ - Typed serialization/deserialization, taken care of by Haskell's aeson and PureScript's argonaut.    Generic encoding/decoding of both made compatible by     [purescript-argonaut-generic-codecs](https://github.com/eskimor/purescript-argonaut-generic-codecs/blob/purescript-argonaut-generic-codec/src/Data/Argonaut/Generic/Aeson.purs).- - You can put common parameters like Auth tokens and the base URL in a reader monad so you don't+ - You can put common parameters like Auth tokens and the base URL in a reader monad, so you don't    have to pass them explicitly. This is configurable in the code generator with `readerParams` in `Settings`.     ## Usage -Apart from the above basic usage example the documentation is still lacking. For+Apart from the above basic usage example, the documentation is still lacking. For the purescript side make sure you have [purescript-servant-support](https://github.com/eskimor/purescript-servant-support) and@@ -28,7 +28,7 @@ It works!  Documentation is yet to come, but there is a usage example in-examples/central-counter which also uses servant-subscriber used for counter+examples/central-counter which also uses servant-subscriber for counter live updates. Generated code is only partly tested, especially Query parameters are still completely untested. 
servant-purescript.cabal view
@@ -1,5 +1,5 @@ name:                servant-purescript-version:             0.4.0.1+version:             0.5.0.0 synopsis:            Generate PureScript accessor functions for you servant API description:         Please see README.md homepage:            https://github.com/eskimor/servant-purescript#readme
src/Servant/PureScript.hs view
@@ -71,7 +71,7 @@       writeModule (opts ^. apiModuleName <> ".Subscriber") SubGen.genModule       writeModule (opts ^. apiModuleName <> ".MakeRequests") MakeRequests.genModule     T.putStrLn "Successfully created your servant API purescript functions!"-    T.putStrLn "Please make sure you have purescript-servant-support version 2.0.0 or above installed:\n"+    T.putStrLn "Please make sure you have purescript-servant-support version 4.0.0 or above installed:\n"     T.putStrLn "  bower i --save purescript-servant-support\n"   where     apiList  = apiToList pAPI pBr@@ -99,9 +99,9 @@ -- >   parseUrlPiece = jsonParseUrlPiece -- >   parseHeader   = jsonParseHeader -- >--- +-- jsonParseUrlPiece :: FromJSON a => Text -> Either Text a-jsonParseUrlPiece = first T.pack . eitherDecodeStrict . T.encodeUtf8+jsonParseUrlPiece = jsonParseHeader . T.encodeUtf8  -- | Use this function for implementing 'toUrlPiece' in your ToHttpApiData instances --   in order to be compatible with the generated PS code.@@ -111,9 +111,9 @@ -- | Use this function for implementing 'parseHeader' in your FromHttpApiData instances --   in order to be compatible with the generated PS code. jsonParseHeader :: FromJSON a => ByteString -> Either Text a-jsonParseHeader = first T.pack . eitherDecodeStrict . urlDecode False+jsonParseHeader = first T.pack . eitherDecodeStrict  -- | Use this function for implementing 'toHeader' in your ToHttpApiData instances --   in order to be compatible with the generated PS code. jsonToHeader :: ToJSON a => a -> ByteString-jsonToHeader = urlEncode False . BS.toStrict . encode+jsonToHeader = BS.toStrict . encode
src/Servant/PureScript/CodeGen.hs view
@@ -28,7 +28,7 @@     apiImports = reqsToImportLines reqs     imports    = mergeImportLines (_standardImports opts) apiImports   in-    genModuleHeader (_apiModuleName opts) imports +    genModuleHeader (_apiModuleName opts) imports     </> genParamSettings rParams <> line     </> (docIntercalate line . map (genFunction rParams)) reqs @@ -166,7 +166,7 @@   in     align $ "{ field : " <> dquotes encodedArgName       <+/> comma <+> "value :"-      <+> "encodeURLPiece spOpts_'" <+> psVar argText+      <+> "encodeHeader spOpts_'" <+> psVar argText       </> "}" genBuildHeader (ReplaceHeaderArg _ _) = error "ReplaceHeaderArg - not yet implemented!" 
src/Servant/PureScript/Internal.hs view
@@ -102,7 +102,7 @@         , ImportLine "Data.Nullable" (Set.fromList [ "Nullable()", "toNullable" ])         , ImportLine "Servant.PureScript.Affjax" (Set.fromList [ "defaultRequest", "affjax", "AjaxError(..)" ])         , ImportLine "Servant.PureScript.Settings" (Set.fromList [ "SPSettings_(..)", "gDefaultToURLPiece" ])-        , ImportLine "Servant.PureScript.Util" (Set.fromList [ "encodeListQuery", "encodeURLPiece", "encodeQueryItem", "getResult" ])+        , ImportLine "Servant.PureScript.Util" (Set.fromList [ "encodeListQuery", "encodeURLPiece", "encodeQueryItem", "getResult", "encodeHeader" ])         , ImportLine "Prim" (Set.fromList [ "String" ]) -- For baseURL!         , ImportLine "Data.Argonaut.Generic.Aeson" (Set.fromList [ "encodeJson", "decodeJson" ]) -- Should not be necessary - compiler bug!         , ImportLine "Data.Maybe" (Set.fromList [ "Maybe(..)"])