servant-js 0.9.3.2 → 0.9.4
raw patch · 8 files changed
+45/−22 lines, 8 filesdep ~aesondep ~basedep ~base-compatPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, base, base-compat, charset, hspec, lens, servant, servant-foreign, text
API changes (from Hackage documentation)
- Servant.JS.Internal: data Header (sym :: Symbol) a :: Symbol -> * -> *
- Servant.JS.Internal: data ReqBody k (contentTypes :: [*]) (a :: k) :: forall k. () => [*] -> k -> *
+ Servant.JS.Internal: [_reqBodyContentType] :: Req f -> ReqBodyContentType
+ Servant.JS.Internal: infixr 3 :<|>
+ Servant.JS.Internal: infixr 4 :>
+ Servant.JS.Internal: type Header = (Header' Optional : Strict : ([] :: [Type]) :: Symbol -> k -> Type)
+ Servant.JS.Internal: type ReqBody = ReqBody' Required : Strict : ([] :: [Type])
- Servant.JS: AxiosOptions :: !Bool -> !(Maybe Text) -> !(Maybe Text) -> AxiosOptions
+ Servant.JS: AxiosOptions :: !Bool -> !Maybe Text -> !Maybe Text -> AxiosOptions
- Servant.JS: [xsrfCookieName] :: AxiosOptions -> !(Maybe Text)
+ Servant.JS: [xsrfCookieName] :: AxiosOptions -> !Maybe Text
- Servant.JS: [xsrfHeaderName] :: AxiosOptions -> !(Maybe Text)
+ Servant.JS: [xsrfHeaderName] :: AxiosOptions -> !Maybe Text
- Servant.JS: data NoTypes :: *
+ Servant.JS: data NoTypes
- Servant.JS: listFromAPI :: (HasForeign k lang ftype api, GenerateList ftype Foreign ftype api) => Proxy k lang -> Proxy * ftype -> Proxy * api -> [Req ftype]
+ Servant.JS: listFromAPI :: (HasForeign lang ftype api, GenerateList ftype (Foreign ftype api)) => Proxy lang -> Proxy ftype -> Proxy api -> [Req ftype]
- Servant.JS: newtype FunctionName :: *
+ Servant.JS: newtype FunctionName
- Servant.JS.Axios: AxiosOptions :: !Bool -> !(Maybe Text) -> !(Maybe Text) -> AxiosOptions
+ Servant.JS.Axios: AxiosOptions :: !Bool -> !Maybe Text -> !Maybe Text -> AxiosOptions
- Servant.JS.Axios: [xsrfCookieName] :: AxiosOptions -> !(Maybe Text)
+ Servant.JS.Axios: [xsrfCookieName] :: AxiosOptions -> !Maybe Text
- Servant.JS.Axios: [xsrfHeaderName] :: AxiosOptions -> !(Maybe Text)
+ Servant.JS.Axios: [xsrfHeaderName] :: AxiosOptions -> !Maybe Text
- Servant.JS.Internal: Req :: Url f -> Method -> [HeaderArg f] -> Maybe f -> Maybe f -> FunctionName -> Req f
+ Servant.JS.Internal: Req :: Url f -> Method -> [HeaderArg f] -> Maybe f -> Maybe f -> FunctionName -> ReqBodyContentType -> Req f
- Servant.JS.Internal: class HasForeign k (lang :: k) ftype api where {
+ Servant.JS.Internal: class HasForeign (lang :: k) ftype api where {
- Servant.JS.Internal: class HasForeignType k k1 (lang :: k) ftype (a :: k1)
+ Servant.JS.Internal: class HasForeignType (lang :: k) ftype (a :: k1)
- Servant.JS.Internal: data (:<|>) a b :: * -> * -> *
+ Servant.JS.Internal: data (:<|>) a b
- Servant.JS.Internal: data Arg f :: * -> *
+ Servant.JS.Internal: data Arg f
- Servant.JS.Internal: data ArgType :: *
+ Servant.JS.Internal: data ArgType
- Servant.JS.Internal: data FormUrlEncoded :: *
+ Servant.JS.Internal: data FormUrlEncoded
- Servant.JS.Internal: data HeaderArg f :: * -> *
+ Servant.JS.Internal: data HeaderArg f
- Servant.JS.Internal: data JSON :: *
+ Servant.JS.Internal: data JSON
- Servant.JS.Internal: data NoTypes :: *
+ Servant.JS.Internal: data NoTypes
- Servant.JS.Internal: data QueryArg f :: * -> *
+ Servant.JS.Internal: data QueryArg f
- Servant.JS.Internal: data Raw :: *
+ Servant.JS.Internal: data Raw
- Servant.JS.Internal: data Req f :: * -> *
+ Servant.JS.Internal: data Req f
- Servant.JS.Internal: data SegmentType f :: * -> *
+ Servant.JS.Internal: data SegmentType f
- Servant.JS.Internal: data Url f :: * -> *
+ Servant.JS.Internal: data Url f
- Servant.JS.Internal: data (:>) k k1 (path :: k) (a :: k1) :: forall k k1. () => k -> k1 -> *
+ Servant.JS.Internal: data (:>) (path :: k) a :: forall k. () => k -> Type -> Type
- Servant.JS.Internal: foreignFor :: HasForeign k lang ftype api => Proxy k lang -> Proxy * ftype -> Proxy * api -> Req ftype -> Foreign ftype api
+ Servant.JS.Internal: foreignFor :: HasForeign lang ftype api => Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api
- Servant.JS.Internal: newtype FunctionName :: *
+ Servant.JS.Internal: newtype FunctionName
- Servant.JS.Internal: newtype PathSegment :: *
+ Servant.JS.Internal: newtype PathSegment
- Servant.JS.Internal: newtype Segment f :: * -> *
+ Servant.JS.Internal: newtype Segment f
- Servant.JS.Internal: reqHeaders :: Functor f => ([HeaderArg f] -> f [HeaderArg f]) -> Req f -> f Req f
+ Servant.JS.Internal: reqHeaders :: () => Lens' (Req f) [HeaderArg f]
- Servant.JS.Internal: type Get k = Verb StdMethod k GET 200
+ Servant.JS.Internal: type Get = Verb GET 200
- Servant.JS.Internal: type Post k = Verb StdMethod k POST 200
+ Servant.JS.Internal: type Post = Verb POST 200
- Servant.JS.Internal: type family Foreign ftype api :: *;
+ Servant.JS.Internal: type family Foreign ftype api :: Type;
- Servant.JS.Internal: typeFor :: HasForeignType k k1 lang ftype a => Proxy k lang -> Proxy * ftype -> Proxy k1 a -> ftype
+ Servant.JS.Internal: typeFor :: HasForeignType lang ftype a => Proxy lang -> Proxy ftype -> Proxy a -> ftype
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- servant-js.cabal +20/−13
- src/Servant/JS/Angular.hs +3/−1
- src/Servant/JS/Axios.hs +3/−1
- src/Servant/JS/Internal.hs +4/−1
- src/Servant/JS/JQuery.hs +3/−1
- src/Servant/JS/Vanilla.hs +6/−4
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.9.4+-----++* `servant-0.15` support+ 0.9.3 -------
README.md view
@@ -9,7 +9,7 @@ ## Example -Read more about the following example [here](https://github.com/haskell-servant/servant/tree/master/servant-js/examples#examples).+Read more about the following example [here](https://github.com/haskell-servant/servant-js/tree/master/examples). ``` haskell {-# LANGUAGE DataKinds #-}
servant-js.cabal view
@@ -1,6 +1,8 @@ name: servant-js-version: 0.9.3.2+version: 0.9.4+ synopsis: Automatically derive javascript functions to query servant webservices.+category: Web, Servant description: Automatically derive javascript functions to query servant webservices. .@@ -11,17 +13,22 @@ webservice calls. . <https://github.com/haskell-servant/servant-js/blob/master/CHANGELOG.md CHANGELOG>+ license: BSD3 license-file: LICENSE author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com copyright: 2015-2016 Servant Contributors-category: Web, Servant build-type: Simple cabal-version: >=1.10 homepage: http://haskell-servant.readthedocs.org/ bug-reports: http://github.com/haskell-servant/servant-js/issues-tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2+tested-with:+ GHC ==8.0.2+ || ==8.2.2+ || ==8.4.4+ || ==8.6.1+ extra-source-files: include/*.h CHANGELOG.md@@ -42,13 +49,13 @@ Servant.JS.Internal Servant.JS.JQuery Servant.JS.Vanilla- build-depends: base >= 4.7 && <4.11- , base-compat >= 0.9- , charset >= 0.3- , lens >= 4- , servant-foreign >= 0.9 && <0.12- , servant >= 0.9 && <0.14- , text >= 1.2 && < 1.3+ build-depends: base >= 4.9 && <4.13+ , base-compat >= 0.10.5 && <0.11+ , charset >= 0.3.7.1 && <0.4+ , lens >= 4.17 && <4.18+ , servant-foreign >= 0.15 && <0.16+ , servant >= 0.15 && <0.16+ , text >= 1.2.3.0 && < 1.3 hs-source-dirs: src default-language: Haskell2010@@ -66,7 +73,7 @@ buildable: False build-depends: base- , aeson >= 0.7 && < 1.3+ , aeson >= 1.4.1.0 && < 1.5 , filepath >= 1 , lens >= 4 , servant@@ -85,10 +92,10 @@ other-modules: Servant.JSSpec Servant.JSSpec.CustomHeaders- build-tool-depends: hspec-discover:hspec-discover >=2.3.0 && <2.5+ build-tool-depends: hspec-discover:hspec-discover >=2.6.0 && <2.7 build-depends: base , base-compat- , hspec >= 2.3.0 && <2.5+ , hspec >= 2.6.0 && <2.7 , hspec-expectations , language-ecmascript >= 0.16 , lens
src/Servant/JS/Angular.hs view
@@ -1,9 +1,11 @@ {-#LANGUAGE OverloadedStrings #-} module Servant.JS.Angular where +import Prelude ()+import Prelude.Compat+ import Control.Lens import Data.Maybe (isJust)-import Data.Monoid import qualified Data.Text as T import Data.Text (Text) import Data.Text.Encoding (decodeUtf8)
src/Servant/JS/Axios.hs view
@@ -1,9 +1,11 @@ {-#LANGUAGE OverloadedStrings #-} module Servant.JS.Axios where +import Prelude ()+import Prelude.Compat+ import Control.Lens import Data.Maybe (isJust)-import Data.Monoid import Data.Text (Text) import Data.Text.Encoding (decodeUtf8) import qualified Data.Text as T
src/Servant/JS/Internal.hs view
@@ -45,10 +45,13 @@ , Header ) where +import Prelude ()+import Prelude.Compat+ import Control.Lens ((^.)) import qualified Data.CharSet as Set import qualified Data.CharSet.Unicode.Category as Set-import Data.Monoid+ import qualified Data.Text as T import Data.Text (Text) import Servant.Foreign
src/Servant/JS/JQuery.hs view
@@ -1,9 +1,11 @@ {-#LANGUAGE OverloadedStrings #-} module Servant.JS.JQuery where +import Prelude ()+import Prelude.Compat+ import Control.Lens import Data.Maybe (isJust)-import Data.Monoid import qualified Data.Text as T import Data.Text (Text) import Data.Text.Encoding (decodeUtf8)
src/Servant/JS/Vanilla.hs view
@@ -1,13 +1,15 @@ {-#LANGUAGE OverloadedStrings #-} module Servant.JS.Vanilla where +import Prelude ()+import Prelude.Compat+ import Control.Lens import Data.Maybe (isJust) import Data.Text (Text) import Data.Text.Encoding (decodeUtf8) import qualified Data.Text as T-import Data.Monoid-import Servant.Foreign+import Servant.Foreign hiding (header) import Servant.JS.Internal -- | Generate vanilla javascript functions to make AJAX requests@@ -34,7 +36,7 @@ <> " xhr.open('" <> decodeUtf8 method <> "', " <> url <> ", true);\n" <> reqheaders <> " xhr.setRequestHeader('Accept', 'application/json');\n"- <> (if isJust (req ^. reqBody) then " xhr.setRequestHeader('Content-Type', 'application/json');\n" else "")+ <> (if isJust (req ^. reqBody) && (req ^. reqBodyContentType == ReqBodyJSON) then " xhr.setRequestHeader('Content-Type', 'application/json');\n" else "") <> " xhr.onreadystatechange = function () {\n" <> " var res = null;\n" <> " if (xhr.readyState === 4) {\n"@@ -79,7 +81,7 @@ dataBody = if isJust (req ^. reqBody)- then "JSON.stringify(body)"+ then if (req ^. reqBodyContentType == ReqBodyJSON) then "JSON.stringify(body)" else "body" else "null"