mig-server 0.2.1.0 → 0.2.2.0
raw patch · 1 files changed
+96/−96 lines, 1 filesdep ~mig-swagger-uiPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: mig-swagger-ui
API changes (from Hackage documentation)
- Mig: Form :: HashMap Text [Text] -> Form
- Mig: FormOptions :: (String -> String) -> FormOptions
- Mig: Just :: a -> Maybe a
- Mig: LenientData :: Either Text a -> LenientData a
- Mig: Nothing :: Maybe a
- Mig: Status :: Int -> ByteString -> Status
- Mig: [$sel:body:Resp] :: Resp media a -> Maybe a
- Mig: [$sel:cache:ServerConfig] :: ServerConfig -> Maybe CacheConfig
- Mig: [$sel:cacheFilter:CacheConfig] :: CacheConfig -> CacheKey -> Bool
- Mig: [$sel:captures:Url] :: Url -> Map Text Text
- Mig: [$sel:cookie:SetCookie] :: SetCookie a -> a
- Mig: [$sel:domain:SetCookie] :: SetCookie a -> Maybe Text
- Mig: [$sel:expires:SetCookie] :: SetCookie a -> Maybe UTCTime
- Mig: [$sel:findRoute:ServerConfig] :: ServerConfig -> FindRouteType
- Mig: [$sel:headers:Resp] :: Resp media a -> ResponseHeaders
- Mig: [$sel:httpOnly:SetCookie] :: SetCookie a -> Bool
- Mig: [$sel:info:Plugin] :: Plugin (m :: Type -> Type) -> RouteInfo -> RouteInfo
- Mig: [$sel:info:Route] :: Route (m :: Type -> Type) -> RouteInfo
- Mig: [$sel:maxBodySize:ServerConfig] :: ServerConfig -> Maybe Kilobytes
- Mig: [$sel:path:SetCookie] :: SetCookie a -> Maybe Text
- Mig: [$sel:path:Url] :: Url -> Path
- Mig: [$sel:queries:Url] :: Url -> [(Text, Text)]
- Mig: [$sel:run:Plugin] :: Plugin (m :: Type -> Type) -> PluginFun m
- Mig: [$sel:run:Route] :: Route (m :: Type -> Type) -> ServerFun m
- Mig: [$sel:secure:SetCookie] :: SetCookie a -> Bool
- Mig: [$sel:size:CacheConfig] :: CacheConfig -> Int
- Mig: [$sel:status:Resp] :: Resp media a -> Status
- Mig: [$sel:unPath:Path] :: Path -> [PathItem]
- Mig: [$sel:unRespOr:RespOr] :: RespOr ty err a -> Either (Resp ty err) (Resp ty a)
- Mig: [$sel:unSend:Send] :: Send (method :: k) (m :: k1 -> Type) (a :: k1) -> m a
- Mig: [$sel:unServer:Server] :: Server (m :: Type -> Type) -> Api (Route m)
- Mig: [fieldLabelModifier] :: FormOptions -> String -> String
- Mig: [getLenientData] :: LenientData a -> Either Text a
- Mig: [statusCode] :: Status -> Int
- Mig: [statusMessage] :: Status -> ByteString
- Mig: [unForm] :: Form -> HashMap Text [Text]
- Mig: accepted202 :: Status
- Mig: badGateway502 :: Status
- Mig: badRequest400 :: Status
- Mig: bodyClasses :: [Name]
- Mig: catMaybes :: [Maybe a] -> [a]
- Mig: class Default a
- Mig: class FromForm a
- Mig: class FromFormKey k
- Mig: class FromHttpApiData a
- Mig: class IsString a
- Mig: class Monad m => MonadIO (m :: Type -> Type)
- Mig: class MonadTrans (t :: Type -> Type -> Type -> Type)
- Mig: class ToForm a
- Mig: class ToFormKey k
- Mig: class ToHttpApiData a
- Mig: conflict409 :: Status
- Mig: continue100 :: Status
- Mig: created201 :: Status
- Mig: data FormOptions
- Mig: data Maybe a
- Mig: data Status
- Mig: def :: Default a => a
- Mig: defaultFormOptions :: FormOptions
- Mig: deriveBody :: Name -> Q [Dec]
- Mig: deriveForm :: Name -> Q [Dec]
- Mig: deriveHttp :: Name -> Q [Dec]
- Mig: deriveNewtypeBody :: Name -> Q [Dec]
- Mig: deriveNewtypeForm :: Name -> Q [Dec]
- Mig: deriveNewtypeHttp :: Name -> Q [Dec]
- Mig: deriveNewtypeParam :: Name -> Q [Dec]
- Mig: deriveNewtypeParamBody :: Name -> Q [Dec]
- Mig: deriveParam :: Name -> Q [Dec]
- Mig: deriveParamBody :: Name -> Q [Dec]
- Mig: expectationFailed417 :: Status
- Mig: forbidden403 :: Status
- Mig: found302 :: Status
- Mig: fromEntriesByKey :: (ToFormKey k, ToHttpApiData v) => [(k, [v])] -> Form
- Mig: fromForm :: FromForm a => Form -> Either Text a
- Mig: fromJust :: HasCallStack => Maybe a -> a
- Mig: fromMaybe :: a -> Maybe a -> a
- Mig: fromString :: IsString a => String -> a
- Mig: gatewayTimeout504 :: Status
- Mig: genericFromForm :: (Generic a, GFromForm a (Rep a)) => FormOptions -> Form -> Either Text a
- Mig: genericToForm :: (Generic a, GToForm a (Rep a)) => FormOptions -> a -> Form
- Mig: gone410 :: Status
- Mig: httpClasses :: [Name]
- Mig: httpVersionNotSupported505 :: Status
- Mig: imATeapot418 :: Status
- Mig: internalServerError500 :: Status
- Mig: isJust :: Maybe a -> Bool
- Mig: isNothing :: Maybe a -> Bool
- Mig: lengthRequired411 :: Status
- Mig: lift :: (MonadTrans t, Monad m) => m a -> t m a
- Mig: liftIO :: MonadIO m => IO a -> m a
- Mig: lines :: String -> [String]
- Mig: listToMaybe :: [a] -> Maybe a
- Mig: lookupAll :: Text -> Form -> [Text]
- Mig: lookupMaybe :: Text -> Form -> Either Text (Maybe Text)
- Mig: lookupUnique :: Text -> Form -> Either Text Text
- Mig: mapDerive :: (Name -> Q [Dec]) -> [Name] -> Q [Dec]
- Mig: mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- Mig: maybe :: b -> (a -> b) -> Maybe a -> b
- Mig: maybeToList :: Maybe a -> [a]
- Mig: methodNotAllowed405 :: Status
- Mig: mkStatus :: Int -> ByteString -> Status
- Mig: movedPermanently301 :: Status
- Mig: multipleChoices300 :: Status
- Mig: networkAuthenticationRequired511 :: Status
- Mig: newtype Form
- Mig: newtype LenientData a
- Mig: noContent204 :: Status
- Mig: nonAuthoritative203 :: Status
- Mig: notAcceptable406 :: Status
- Mig: notFound404 :: Status
- Mig: notImplemented501 :: Status
- Mig: notModified304 :: Status
- Mig: ok200 :: Status
- Mig: paramBodyClasses :: [Name]
- Mig: paramClasses :: [Name]
- Mig: parseAll :: FromHttpApiData v => Text -> Form -> Either Text [v]
- Mig: parseBoundedEnumOf :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text a
- Mig: parseBoundedEnumOfI :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text a
- Mig: parseBoundedHeader :: (ToHttpApiData a, Bounded a, Enum a) => ByteString -> Either Text a
- Mig: parseBoundedQueryParam :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a
- Mig: parseBoundedTextData :: (Show a, Bounded a, Enum a) => Text -> Either Text a
- Mig: parseBoundedUrlPiece :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a
- Mig: parseFormKey :: FromFormKey k => Text -> Either Text k
- Mig: parseHeader :: FromHttpApiData a => ByteString -> Either Text a
- Mig: parseHeaderMaybe :: FromHttpApiData a => ByteString -> Maybe a
- Mig: parseHeaderWithPrefix :: FromHttpApiData a => ByteString -> ByteString -> Either Text a
- Mig: parseMaybe :: FromHttpApiData v => Text -> Form -> Either Text (Maybe v)
- Mig: parseQueryParam :: FromHttpApiData a => Text -> Either Text a
- Mig: parseQueryParamMaybe :: FromHttpApiData a => Text -> Maybe a
- Mig: parseQueryParamWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a
- Mig: parseQueryParams :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)
- Mig: parseUnique :: FromHttpApiData v => Text -> Form -> Either Text v
- Mig: parseUrlPiece :: FromHttpApiData a => Text -> Either Text a
- Mig: parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a
- Mig: parseUrlPieceWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a
- Mig: parseUrlPieces :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)
- Mig: partialContent206 :: Status
- Mig: paymentRequired402 :: Status
- Mig: permanentRedirect308 :: Status
- Mig: preconditionFailed412 :: Status
- Mig: preconditionRequired428 :: Status
- Mig: proxyAuthenticationRequired407 :: Status
- Mig: readTextData :: Read a => Text -> Either Text a
- Mig: requestEntityTooLarge413 :: Status
- Mig: requestHeaderFieldsTooLarge431 :: Status
- Mig: requestTimeout408 :: Status
- Mig: requestURITooLong414 :: Status
- Mig: requestedRangeNotSatisfiable416 :: Status
- Mig: resetContent205 :: Status
- Mig: seeOther303 :: Status
- Mig: serviceUnavailable503 :: Status
- Mig: showTextData :: Show a => a -> Text
- Mig: status100 :: Status
- Mig: status101 :: Status
- Mig: status200 :: Status
- Mig: status201 :: Status
- Mig: status202 :: Status
- Mig: status203 :: Status
- Mig: status204 :: Status
- Mig: status205 :: Status
- Mig: status206 :: Status
- Mig: status300 :: Status
- Mig: status301 :: Status
- Mig: status302 :: Status
- Mig: status303 :: Status
- Mig: status304 :: Status
- Mig: status305 :: Status
- Mig: status307 :: Status
- Mig: status308 :: Status
- Mig: status400 :: Status
- Mig: status401 :: Status
- Mig: status402 :: Status
- Mig: status403 :: Status
- Mig: status404 :: Status
- Mig: status405 :: Status
- Mig: status406 :: Status
- Mig: status407 :: Status
- Mig: status408 :: Status
- Mig: status409 :: Status
- Mig: status410 :: Status
- Mig: status411 :: Status
- Mig: status412 :: Status
- Mig: status413 :: Status
- Mig: status414 :: Status
- Mig: status415 :: Status
- Mig: status416 :: Status
- Mig: status417 :: Status
- Mig: status418 :: Status
- Mig: status422 :: Status
- Mig: status426 :: Status
- Mig: status428 :: Status
- Mig: status429 :: Status
- Mig: status431 :: Status
- Mig: status500 :: Status
- Mig: status501 :: Status
- Mig: status502 :: Status
- Mig: status503 :: Status
- Mig: status504 :: Status
- Mig: status505 :: Status
- Mig: status511 :: Status
- Mig: statusIsClientError :: Status -> Bool
- Mig: statusIsInformational :: Status -> Bool
- Mig: statusIsRedirection :: Status -> Bool
- Mig: statusIsServerError :: Status -> Bool
- Mig: statusIsSuccessful :: Status -> Bool
- Mig: switchingProtocols101 :: Status
- Mig: temporaryRedirect307 :: Status
- Mig: toEncodedQueryParam :: ToHttpApiData a => a -> Builder
- Mig: toEncodedUrlPiece :: ToHttpApiData a => a -> Builder
- Mig: toEntriesByKey :: (FromFormKey k, FromHttpApiData v) => Form -> Either Text [(k, [v])]
- Mig: toEntriesByKeyStable :: (Ord k, FromFormKey k, FromHttpApiData v) => Form -> Either Text [(k, [v])]
- Mig: toForm :: ToForm a => a -> Form
- Mig: toFormKey :: ToFormKey k => k -> Text
- Mig: toHeader :: ToHttpApiData a => a -> ByteString
- Mig: toListStable :: Form -> [(Text, Text)]
- Mig: toQueryParam :: ToHttpApiData a => a -> Text
- Mig: toQueryParams :: (Functor t, ToHttpApiData a) => t a -> t Text
- Mig: toUrlPiece :: ToHttpApiData a => a -> Text
- Mig: toUrlPieces :: (Functor t, ToHttpApiData a) => t a -> t Text
- Mig: tooManyRequests429 :: Status
- Mig: type String = [Char]
- Mig: unauthorized401 :: Status
- Mig: unlines :: [String] -> String
- Mig: unprocessableEntity422 :: Status
- Mig: unsupportedMediaType415 :: Status
- Mig: unwords :: [String] -> String
- Mig: upgradeRequired426 :: Status
- Mig: urlDecodeAsForm :: FromForm a => ByteString -> Either Text a
- Mig: urlDecodeForm :: ByteString -> Either Text Form
- Mig: urlDecodeParams :: ByteString -> Either Text [(Text, Text)]
- Mig: urlEncodeAsForm :: ToForm a => a -> ByteString
- Mig: urlEncodeAsFormStable :: ToForm a => a -> ByteString
- Mig: urlEncodeForm :: Form -> ByteString
- Mig: urlEncodeFormStable :: Form -> ByteString
- Mig: urlEncodeParams :: [(Text, Text)] -> ByteString
- Mig: useProxy305 :: Status
- Mig: words :: String -> [String]
- Mig.Server.Warp: [$sel:cache:ServerConfig] :: ServerConfig -> Maybe CacheConfig
- Mig.Server.Warp: [$sel:cacheFilter:CacheConfig] :: CacheConfig -> CacheKey -> Bool
- Mig.Server.Warp: [$sel:findRoute:ServerConfig] :: ServerConfig -> FindRouteType
- Mig.Server.Warp: [$sel:maxBodySize:ServerConfig] :: ServerConfig -> Maybe Kilobytes
- Mig.Server.Warp: [$sel:size:CacheConfig] :: CacheConfig -> Int
+ Mig: ($dmdeclareNamedSchema) :: (ToSchema a, Generic a, GToSchema (Rep a)) => Proxy a -> Declare (Definitions Schema) NamedSchema
+ Mig: ($dmparseJSON) :: (FromJSON a, Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
+ Mig: ($dmtoJSON) :: (ToJSON a, Generic a, GToJSON' Value Zero (Rep a)) => a -> Value
+ Mig: ($dmtoParamSchema) :: (ToParamSchema a, Generic a, GToParamSchema (Rep a)) => Proxy a -> Schema
+ Mig: [body] :: Resp media a -> Maybe a
+ Mig: [cacheFilter] :: CacheConfig -> CacheKey -> Bool
+ Mig: [cache] :: ServerConfig -> Maybe CacheConfig
+ Mig: [captures] :: Url -> Map Text Text
+ Mig: [cookie] :: SetCookie a -> a
+ Mig: [domain] :: SetCookie a -> Maybe Text
+ Mig: [expires] :: SetCookie a -> Maybe UTCTime
+ Mig: [findRoute] :: ServerConfig -> FindRouteType
+ Mig: [headers] :: Resp media a -> ResponseHeaders
+ Mig: [httpOnly] :: SetCookie a -> Bool
+ Mig: [info] :: Plugin (m :: Type -> Type) -> RouteInfo -> RouteInfo
+ Mig: [maxBodySize] :: ServerConfig -> Maybe Kilobytes
+ Mig: [path] :: Url -> Path
+ Mig: [queries] :: Url -> [(Text, Text)]
+ Mig: [run] :: Plugin (m :: Type -> Type) -> PluginFun m
+ Mig: [secure] :: SetCookie a -> Bool
+ Mig: [size] :: CacheConfig -> Int
+ Mig: [status] :: Resp media a -> Status
+ Mig: [unPath] :: Path -> [PathItem]
+ Mig: [unRespOr] :: RespOr ty err a -> Either (Resp ty err) (Resp ty a)
+ Mig: [unSend] :: Send (method :: k) (m :: k1 -> Type) (a :: k1) -> m a
+ Mig: [unServer] :: Server (m :: Type -> Type) -> Api (Route m)
+ Mig: omitField :: ToJSON a => a -> Bool
+ Mig: omittedField :: FromJSON a => Maybe a
+ Mig: type RespBody a;
+ Mig: type RespError a;
+ Mig: type RespMedia a;
+ Mig: type ServerResult (m :: Type -> Type);
+ Mig.Server.Warp: [cacheFilter] :: CacheConfig -> CacheKey -> Bool
+ Mig.Server.Warp: [cache] :: ServerConfig -> Maybe CacheConfig
+ Mig.Server.Warp: [findRoute] :: ServerConfig -> FindRouteType
+ Mig.Server.Warp: [maxBodySize] :: ServerConfig -> Maybe Kilobytes
+ Mig.Server.Warp: [size] :: CacheConfig -> Int
- Mig: type family ServerResult (m :: Type -> Type);
+ Mig: type family UrlOf a
Files
- mig-server.cabal +96/−96
mig-server.cabal view
@@ -1,75 +1,75 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack -name: mig-server-version: 0.2.1.0-synopsis: Build lightweight and composable servers-description: With library mig we can build lightweight and composable servers.- There are only couple of combinators to assemble servers from parts.- It supports generic handler functions as servant does. But strives to use more- simple model for API. It does not go to describing Server API at type level which- leads to simpler error messages.- .- The main features are:- .- * lightweight library- .- * expressive DSL to compose servers- .- * type-safe handlers- .- * handlers are encoded with generic haskell functions- .- * built on top of WAI and warp server libraries.- .- Example of hello world server:- .- > {-# Language OverloadedStrings #-}- > import Mig.Json.IO- >- > -- | We can render the server and run it on port 8085.- > -- It uses wai and warp.- > main :: IO ()- > main = runServer 8085 server- >- > -- | Init simple hello world server whith two routes:- > server :: Server IO- > server =- > "api/v1" /.- > [ "hello" /. hello- > , "bye" /. bye- > ]- >- > -- | Handler takes no inputs and marked as Get HTTP-request that returns Text.- > hello :: Get (Resp Text)- > hello = pure $ ok "Hello World"- >- > -- | Handle with URL-param query and json body input as Post HTTP-request that returns Text.- > bye :: Query "name" Text -> Body Text -> Post (Resp Text)- > bye (Query name) (Body greeting) =- > pure $ ok $ "Bye to " <> name <> " " <> greeting- .- Please see:- .- * quick start guide at <https://anton-k.github.io/mig/>- .- * examples directory for more fun servers: at <https://github.com/anton-k/mig/tree/main/examples/mig-example-apps#readme>- .- * reference for the main functions: <https://anton-k.github.io/mig/09-reference.html>-category: Web-homepage: https://github.com/anton-k/mig#readme-bug-reports: https://github.com/anton-k/mig/issues-author: Anton Kholomiov-maintainer: anton.kholomiov@gmail.com-copyright: 2023 Anton Kholomiov-license: BSD3-license-file: LICENSE-build-type: Simple+name: mig-server+version: 0.2.2.0+synopsis: Build lightweight and composable servers+description: With library mig we can build lightweight and composable servers.+ There are only couple of combinators to assemble servers from parts.+ It supports generic handler functions as servant does. But strives to use more+ simple model for API. It does not go to describing Server API at type level which+ leads to simpler error messages.+ .+ The main features are:+ .+ * lightweight library+ .+ * expressive DSL to compose servers+ .+ * type-safe handlers+ .+ * handlers are encoded with generic haskell functions+ .+ * built on top of WAI and warp server libraries.+ .+ Example of hello world server:+ .+ > {-# Language OverloadedStrings #-}+ > import Mig.Json.IO+ >+ > -- | We can render the server and run it on port 8085.+ > -- It uses wai and warp.+ > main :: IO ()+ > main = runServer 8085 server+ >+ > -- | Init simple hello world server whith two routes:+ > server :: Server IO+ > server =+ > "api/v1" /.+ > [ "hello" /. hello+ > , "bye" /. bye+ > ]+ >+ > -- | Handler takes no inputs and marked as Get HTTP-request that returns Text.+ > hello :: Get (Resp Text)+ > hello = pure $ ok "Hello World"+ >+ > -- | Handle with URL-param query and json body input as Post HTTP-request that returns Text.+ > bye :: Query "name" Text -> Body Text -> Post (Resp Text)+ > bye (Query name) (Body greeting) =+ > pure $ ok $ "Bye to " <> name <> " " <> greeting+ .+ Please see:+ .+ * quick start guide at <https://anton-k.github.io/mig/>+ .+ * examples directory for more fun servers: at <https://github.com/anton-k/mig/tree/main/examples/mig-example-apps#readme>+ .+ * reference for the main functions: <https://anton-k.github.io/mig/09-reference.html>+category: Web+homepage: https://github.com/anton-k/mig#readme+bug-reports: https://github.com/anton-k/mig/issues+author: Anton Kholomiov+maintainer: anton.kholomiov@gmail.com+copyright: 2023 Anton Kholomiov+license: BSD3+license-file: LICENSE+build-type: Simple extra-source-files:- README.md+ README.md source-repository head type: git@@ -77,39 +77,39 @@ library exposed-modules:- Mig- Mig.Html- Mig.Html.IO- Mig.IO- Mig.Json- Mig.Json.IO- Mig.Server.Warp+ Mig+ Mig.Html+ Mig.Html.IO+ Mig.IO+ Mig.Json+ Mig.Json.IO+ Mig.Server.Warp other-modules:- Paths_mig_server+ Paths_mig_server hs-source-dirs:- src+ src default-extensions:- DerivingStrategies- DuplicateRecordFields- LambdaCase- OverloadedRecordDot- OverloadedStrings- StrictData- TypeFamilies+ DerivingStrategies+ DuplicateRecordFields+ LambdaCase+ OverloadedRecordDot+ OverloadedStrings+ StrictData+ TypeFamilies ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages build-depends:- aeson- , base >=4.7 && <5- , blaze-html- , data-default- , http-api-data- , http-types- , mig >=0.2.1.0- , mig-extra >=0.1.1.0- , mig-swagger-ui >=0.1- , mig-wai >=0.1.0.1- , openapi3- , text- , transformers- , warp+ aeson,+ base >=4.7 && <5,+ blaze-html,+ data-default,+ http-api-data,+ http-types,+ mig >=0.2.1.0,+ mig-extra >=0.1.1.0,+ mig-swagger-ui >=0.1.1,+ mig-wai >=0.1.0.1,+ openapi3,+ text,+ transformers,+ warp default-language: GHC2021