{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# HLINT ignore "Use maybe" #-}
module Hasura.RQL.DDL.Webhook.Transform
(
RequestFields (..),
RequestTransform (..),
RequestTransformFns,
applyRequestTransform,
RequestTransformCtx (..),
RequestContext,
mkRequestContext,
mkReqTransformCtx,
TransformErrorBundle (..),
WithOptional (..),
withOptional,
MetadataResponseTransform (..),
ResponseTransform (..),
ResponseTransformCtx (..),
applyResponseTransform,
buildRespTransformCtx,
mkResponseTransform,
)
where
import Control.Lens (Lens', lens, preview, set, traverseOf, view)
import Data.Aeson.Extended qualified as J
import Data.ByteString.Lazy qualified as BL
import Data.CaseInsensitive qualified as CI
import Data.Functor.Barbie qualified as B
import Data.Text.Encoding qualified as TE
import Data.Validation qualified as V
import Hasura.Prelude hiding (first)
import Hasura.RQL.DDL.Webhook.Transform.Body (Body (..), BodyTransformFn)
import Hasura.RQL.DDL.Webhook.Transform.Body qualified as Body
import Hasura.RQL.DDL.Webhook.Transform.Class
import Hasura.RQL.DDL.Webhook.Transform.Headers
import Hasura.RQL.DDL.Webhook.Transform.Method
import Hasura.RQL.DDL.Webhook.Transform.QueryParams
import Hasura.RQL.DDL.Webhook.Transform.Request
import Hasura.RQL.DDL.Webhook.Transform.Response
import Hasura.RQL.DDL.Webhook.Transform.Url
import Hasura.RQL.Types.Webhook.Transform (MetadataResponseTransform (..), RequestContext, RequestData, RequestFields (..), RequestTransform (..), RequestTransformFns)
import Hasura.RQL.Types.Webhook.Transform.WithOptional (WithOptional (..), withOptional)
import Hasura.Session (SessionVariables)
import Network.HTTP.Client.Transformable qualified as HTTP
requestL :: Lens' HTTP.Request RequestData
requestL :: Lens' Request RequestData
requestL = (Request -> RequestData)
-> (Request -> RequestData -> Request) -> Lens' Request RequestData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Request -> RequestData
getter Request -> RequestData -> Request
setter
where
getter :: HTTP.Request -> RequestData
getter :: Request -> RequestData
getter Request
req =
RequestFields
{ method :: Identity Method
method = CI Text -> Identity Method
forall a b. Coercible a b => a -> b
coerce (CI Text -> Identity Method) -> CI Text -> Identity Method
forall a b. (a -> b) -> a -> b
$ Text -> CI Text
forall s. FoldCase s => s -> CI s
CI.mk (Text -> CI Text) -> Text -> CI Text
forall a b. (a -> b) -> a -> b
$ ByteString -> Text
TE.decodeUtf8 (ByteString -> Text) -> ByteString -> Text
forall a b. (a -> b) -> a -> b
$ Getting ByteString Request ByteString -> Request -> ByteString
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting ByteString Request ByteString
Lens' Request ByteString
HTTP.method Request
req,
url :: Identity Url
url = Text -> Identity Url
forall a b. Coercible a b => a -> b
coerce (Text -> Identity Url) -> Text -> Identity Url
forall a b. (a -> b) -> a -> b
$ Getting Text Request Text -> Request -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Text Request Text
Lens' Request Text
HTTP.url Request
req,
body :: Identity Body
body = Body -> Identity Body
forall a b. Coercible a b => a -> b
coerce (Body -> Identity Body) -> Body -> Identity Body
forall a b. (a -> b) -> a -> b
$ Maybe Value -> Body
JSONBody (Maybe Value -> Body) -> Maybe Value -> Body
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe Value
forall a. FromJSON a => ByteString -> Maybe a
J.decode (ByteString -> Maybe Value) -> Maybe ByteString -> Maybe Value
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Getting (First ByteString) Request ByteString
-> Request -> Maybe ByteString
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((RequestBody -> Const (First ByteString) RequestBody)
-> Request -> Const (First ByteString) Request
Lens' Request RequestBody
HTTP.body ((RequestBody -> Const (First ByteString) RequestBody)
-> Request -> Const (First ByteString) Request)
-> ((ByteString -> Const (First ByteString) ByteString)
-> RequestBody -> Const (First ByteString) RequestBody)
-> Getting (First ByteString) Request ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteString -> Const (First ByteString) ByteString)
-> RequestBody -> Const (First ByteString) RequestBody
Prism' RequestBody ByteString
HTTP._RequestBodyLBS) Request
req,
queryParams :: Identity QueryParams
queryParams = Query -> Identity QueryParams
forall a b. Coercible a b => a -> b
coerce (Query -> Identity QueryParams) -> Query -> Identity QueryParams
forall a b. (a -> b) -> a -> b
$ Getting Query Request Query -> Request -> Query
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Query Request Query
Lens' Request Query
HTTP.queryParams Request
req,
requestHeaders :: Identity Headers
requestHeaders = [Header] -> Identity Headers
forall a b. Coercible a b => a -> b
coerce ([Header] -> Identity Headers) -> [Header] -> Identity Headers
forall a b. (a -> b) -> a -> b
$ Getting [Header] Request [Header] -> Request -> [Header]
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting [Header] Request [Header]
Lens' Request [Header]
HTTP.headers Request
req
}
serializeBody :: Body -> HTTP.RequestBody
serializeBody :: Body -> RequestBody
serializeBody = \case
JSONBody Maybe Value
body -> ByteString -> RequestBody
HTTP.RequestBodyLBS (ByteString -> RequestBody) -> ByteString -> RequestBody
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe ByteString -> ByteString
forall a. a -> Maybe a -> a
fromMaybe ByteString
forall a. Monoid a => a
mempty (Maybe ByteString -> ByteString) -> Maybe ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ (Value -> ByteString) -> Maybe Value -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Value -> ByteString
forall a. ToJSON a => a -> ByteString
J.encode Maybe Value
body
RawBody ByteString
"" -> RequestBody
forall a. Monoid a => a
mempty
RawBody ByteString
bs -> ByteString -> RequestBody
HTTP.RequestBodyLBS ByteString
bs
setter :: HTTP.Request -> RequestData -> HTTP.Request
setter :: Request -> RequestData -> Request
setter Request
req RequestFields {Identity Url
Identity QueryParams
Identity Method
Identity Headers
Identity Body
method :: forall (f :: * -> *). RequestFields f -> f Method
url :: forall (f :: * -> *). RequestFields f -> f Url
body :: forall (f :: * -> *). RequestFields f -> f Body
queryParams :: forall (f :: * -> *). RequestFields f -> f QueryParams
requestHeaders :: forall (f :: * -> *). RequestFields f -> f Headers
method :: Identity Method
url :: Identity Url
body :: Identity Body
queryParams :: Identity QueryParams
requestHeaders :: Identity Headers
..} =
Request
req
Request -> (Request -> Request) -> Request
forall a b. a -> (a -> b) -> b
& ASetter Request Request ByteString ByteString
-> ByteString -> Request -> Request
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter Request Request ByteString ByteString
Lens' Request ByteString
HTTP.method (Text -> ByteString
TE.encodeUtf8 (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
$ CI Text -> Text
forall s. CI s -> s
CI.original (CI Text -> Text) -> CI Text -> Text
forall a b. (a -> b) -> a -> b
$ Identity Method -> CI Text
forall a b. Coercible a b => a -> b
coerce Identity Method
method)
Request -> (Request -> Request) -> Request
forall a b. a -> (a -> b) -> b
& ASetter Request Request RequestBody RequestBody
-> RequestBody -> Request -> Request
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter Request Request RequestBody RequestBody
Lens' Request RequestBody
HTTP.body (Body -> RequestBody
serializeBody (Body -> RequestBody) -> Body -> RequestBody
forall a b. (a -> b) -> a -> b
$ Identity Body -> Body
forall a b. Coercible a b => a -> b
coerce Identity Body
body)
Request -> (Request -> Request) -> Request
forall a b. a -> (a -> b) -> b
& ASetter Request Request Text Text -> Text -> Request -> Request
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter Request Request Text Text
Lens' Request Text
HTTP.url (Identity Url -> Text
forall a b. Coercible a b => a -> b
coerce Identity Url
url)
Request -> (Request -> Request) -> Request
forall a b. a -> (a -> b) -> b
& ASetter Request Request Query Query -> Query -> Request -> Request
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter Request Request Query Query
Lens' Request Query
HTTP.queryParams (QueryParams -> Query
unQueryParams (QueryParams -> Query) -> QueryParams -> Query
forall a b. (a -> b) -> a -> b
$ Identity QueryParams -> QueryParams
forall a b. Coercible a b => a -> b
coerce Identity QueryParams
queryParams)
Request -> (Request -> Request) -> Request
forall a b. a -> (a -> b) -> b
& ASetter Request Request [Header] [Header]
-> [Header] -> Request -> Request
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter Request Request [Header] [Header]
Lens' Request [Header]
HTTP.headers (Identity Headers -> [Header]
forall a b. Coercible a b => a -> b
coerce Identity Headers
requestHeaders)
applyRequestTransform ::
forall m.
(MonadError TransformErrorBundle m) =>
(HTTP.Request -> RequestContext) ->
RequestTransformFns ->
HTTP.Request ->
m HTTP.Request
applyRequestTransform :: forall (m :: * -> *).
MonadError TransformErrorBundle m =>
(Request -> RequestContext)
-> RequestTransformFns -> Request -> m Request
applyRequestTransform Request -> RequestContext
mkCtx RequestTransformFns
transformations Request
request =
LensLike m Request Request RequestData RequestData
-> LensLike m Request Request RequestData RequestData
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf
LensLike m Request Request RequestData RequestData
Lens' Request RequestData
requestL
(RequestContext -> RequestData -> m RequestData
transformReqData (Request -> RequestContext
mkCtx Request
request))
Request
request
where
transformReqData :: RequestContext -> RequestData -> m RequestData
transformReqData RequestContext
transformCtx RequestData
reqData =
RequestFields m -> m RequestData
forall (e :: * -> *) (b :: (* -> *) -> *).
(Applicative e, TraversableB b) =>
b e -> e (b Identity)
B.bsequence'
(RequestFields m -> m RequestData)
-> RequestFields m -> m RequestData
forall a b. (a -> b) -> a -> b
$ forall {k} (c :: k -> Constraint) (b :: (k -> *) -> *)
(f :: k -> *) (g :: k -> *) (h :: k -> *) (i :: k -> *).
(AllB c b, ConstraintsB b, ApplicativeB b) =>
(forall (a :: k). c a => f a -> g a -> h a -> i a)
-> b f -> b g -> b h -> b i
forall (c :: * -> Constraint) (b :: (* -> *) -> *) (f :: * -> *)
(g :: * -> *) (h :: * -> *) (i :: * -> *).
(AllB c b, ConstraintsB b, ApplicativeB b) =>
(forall a. c a => f a -> g a -> h a -> i a)
-> b f -> b g -> b h -> b i
B.bzipWith3C @Transform
TransformCtx a -> WithOptional TransformFn a -> Identity a -> m a
forall a.
Transform a =>
TransformCtx a -> WithOptional TransformFn a -> Identity a -> m a
forall {f :: * -> *} {a}.
(Transform a, MonadError TransformErrorBundle f) =>
TransformCtx a -> WithOptional TransformFn a -> Identity a -> f a
transformField
RequestContext
transformCtx
RequestTransformFns
transformations
RequestData
reqData
transformField :: TransformCtx a -> WithOptional TransformFn a -> Identity a -> f a
transformField TransformCtx a
ctx (WithOptional Maybe (TransformFn a)
maybeFn) (Identity a
a) =
case Maybe (TransformFn a)
maybeFn of
Maybe (TransformFn a)
Nothing -> a -> f a
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a
Just TransformFn a
fn -> TransformFn a -> TransformCtx a -> a -> f a
forall a (m :: * -> *).
(Transform a, MonadError TransformErrorBundle m) =>
TransformFn a -> TransformCtx a -> a -> m a
forall (m :: * -> *).
MonadError TransformErrorBundle m =>
TransformFn a -> TransformCtx a -> a -> m a
transform TransformFn a
fn TransformCtx a
ctx a
a
data ResponseTransform = ResponseTransform
{ ResponseTransform
-> Maybe
(ResponseTransformCtx -> Either TransformErrorBundle Value)
respTransformBody :: Maybe (ResponseTransformCtx -> Either TransformErrorBundle J.Value),
ResponseTransform -> TemplatingEngine
respTransformTemplateEngine :: TemplatingEngine
}
buildRespTransformCtx :: Maybe RequestContext -> Maybe SessionVariables -> TemplatingEngine -> BL.ByteString -> Int -> ResponseTransformCtx
buildRespTransformCtx :: Maybe RequestContext
-> Maybe SessionVariables
-> TemplatingEngine
-> ByteString
-> Int
-> ResponseTransformCtx
buildRespTransformCtx Maybe RequestContext
requestContext Maybe SessionVariables
sessionVars TemplatingEngine
engine ByteString
respBody Int
respStatusCode =
ResponseTransformCtx
{ responseTransformBody :: Value
responseTransformBody = Value -> Maybe Value -> Value
forall a. a -> Maybe a -> a
fromMaybe Value
J.Null (Maybe Value -> Value) -> Maybe Value -> Value
forall a b. (a -> b) -> a -> b
$ forall a. FromJSON a => ByteString -> Maybe a
J.decode @J.Value ByteString
respBody,
responseTransformReqCtx :: Value
responseTransformReqCtx = Maybe RequestContext -> Value
forall a. ToJSON a => a -> Value
J.toJSON Maybe RequestContext
requestContext,
responseSessionVariables :: Maybe SessionVariables
responseSessionVariables = Maybe SessionVariables
sessionVars,
responseTransformEngine :: TemplatingEngine
responseTransformEngine = TemplatingEngine
engine,
responseStatusCode :: Int
responseStatusCode = Int
respStatusCode
}
mkRespTemplateTransform ::
BodyTransformFn ->
ResponseTransformCtx ->
Either TransformErrorBundle J.Value
mkRespTemplateTransform :: BodyTransformFn
-> ResponseTransformCtx -> Either TransformErrorBundle Value
mkRespTemplateTransform BodyTransformFn
Body.Remove ResponseTransformCtx
_ = Value -> Either TransformErrorBundle Value
forall a. a -> Either TransformErrorBundle a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Value
J.Null
mkRespTemplateTransform (Body.ModifyAsJSON Template
template) ResponseTransformCtx
context =
Template
-> ResponseTransformCtx -> Either TransformErrorBundle Value
runResponseTemplateTransform Template
template ResponseTransformCtx
context
mkRespTemplateTransform (Body.ModifyAsFormURLEncoded HashMap Text UnescapedTemplate
formTemplates) ResponseTransformCtx
context = do
HashMap Text ByteString
result <-
Either TransformErrorBundle (HashMap Text ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString)
forall e (m :: * -> *) a. MonadError e m => Either e a -> m a
liftEither
(Either TransformErrorBundle (HashMap Text ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString))
-> ((UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString))
-> (UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Validation TransformErrorBundle (HashMap Text ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString)
forall e a. Validation e a -> Either e a
V.toEither
(Validation TransformErrorBundle (HashMap Text ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString))
-> ((UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Validation TransformErrorBundle (HashMap Text ByteString))
-> (UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap Text UnescapedTemplate
-> (UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Validation TransformErrorBundle (HashMap Text ByteString)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
t a -> (a -> f b) -> f (t b)
for HashMap Text UnescapedTemplate
formTemplates
((UnescapedTemplate -> Validation TransformErrorBundle ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString))
-> (UnescapedTemplate
-> Validation TransformErrorBundle ByteString)
-> Either TransformErrorBundle (HashMap Text ByteString)
forall a b. (a -> b) -> a -> b
$ ResponseTransformCtx
-> UnescapedTemplate -> Validation TransformErrorBundle ByteString
runUnescapedResponseTemplateTransform' ResponseTransformCtx
context
Value -> Either TransformErrorBundle Value
forall a. a -> Either TransformErrorBundle a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Value -> Either TransformErrorBundle Value)
-> (ByteString -> Value)
-> ByteString
-> Either TransformErrorBundle Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Value
J.String (Text -> Value) -> (ByteString -> Text) -> ByteString -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Text
TE.decodeUtf8 (ByteString -> Text)
-> (ByteString -> ByteString) -> ByteString -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
BL.toStrict (ByteString -> Either TransformErrorBundle Value)
-> ByteString -> Either TransformErrorBundle Value
forall a b. (a -> b) -> a -> b
$ HashMap Text ByteString -> ByteString
Body.foldFormEncoded HashMap Text ByteString
result
mkResponseTransform :: MetadataResponseTransform -> ResponseTransform
mkResponseTransform :: MetadataResponseTransform -> ResponseTransform
mkResponseTransform MetadataResponseTransform {Maybe BodyTransformFn
TemplatingEngine
Version
mrtVersion :: Version
mrtBodyTransform :: Maybe BodyTransformFn
mrtTemplatingEngine :: TemplatingEngine
mrtVersion :: MetadataResponseTransform -> Version
mrtBodyTransform :: MetadataResponseTransform -> Maybe BodyTransformFn
mrtTemplatingEngine :: MetadataResponseTransform -> TemplatingEngine
..} =
let bodyTransform :: Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
bodyTransform = BodyTransformFn
-> ResponseTransformCtx -> Either TransformErrorBundle Value
mkRespTemplateTransform (BodyTransformFn
-> ResponseTransformCtx -> Either TransformErrorBundle Value)
-> Maybe BodyTransformFn
-> Maybe
(ResponseTransformCtx -> Either TransformErrorBundle Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe BodyTransformFn
mrtBodyTransform
in Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
-> TemplatingEngine -> ResponseTransform
ResponseTransform Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
bodyTransform TemplatingEngine
mrtTemplatingEngine
applyResponseTransform ::
ResponseTransform ->
ResponseTransformCtx ->
Either TransformErrorBundle BL.ByteString
applyResponseTransform :: ResponseTransform
-> ResponseTransformCtx -> Either TransformErrorBundle ByteString
applyResponseTransform ResponseTransform {Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
TemplatingEngine
respTransformBody :: ResponseTransform
-> Maybe
(ResponseTransformCtx -> Either TransformErrorBundle Value)
respTransformTemplateEngine :: ResponseTransform -> TemplatingEngine
respTransformBody :: Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
respTransformTemplateEngine :: TemplatingEngine
..} ctx :: ResponseTransformCtx
ctx@ResponseTransformCtx {Int
Maybe SessionVariables
Value
TemplatingEngine
responseTransformBody :: ResponseTransformCtx -> Value
responseTransformReqCtx :: ResponseTransformCtx -> Value
responseSessionVariables :: ResponseTransformCtx -> Maybe SessionVariables
responseTransformEngine :: ResponseTransformCtx -> TemplatingEngine
responseStatusCode :: ResponseTransformCtx -> Int
responseTransformBody :: Value
responseTransformReqCtx :: Value
responseSessionVariables :: Maybe SessionVariables
responseTransformEngine :: TemplatingEngine
responseStatusCode :: Int
..} =
let bodyFunc :: BL.ByteString -> Either TransformErrorBundle BL.ByteString
bodyFunc :: ByteString -> Either TransformErrorBundle ByteString
bodyFunc ByteString
body =
case Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
respTransformBody of
Maybe (ResponseTransformCtx -> Either TransformErrorBundle Value)
Nothing -> ByteString -> Either TransformErrorBundle ByteString
forall a. a -> Either TransformErrorBundle a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ByteString
body
Just ResponseTransformCtx -> Either TransformErrorBundle Value
f -> Value -> ByteString
forall a. ToJSON a => a -> ByteString
J.encode (Value -> ByteString)
-> Either TransformErrorBundle Value
-> Either TransformErrorBundle ByteString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ResponseTransformCtx -> Either TransformErrorBundle Value
f ResponseTransformCtx
ctx
in ByteString -> Either TransformErrorBundle ByteString
bodyFunc (Value -> ByteString
forall a. ToJSON a => a -> ByteString
J.encode Value
responseTransformBody)
mkRequestContext :: RequestTransformCtx -> RequestContext
mkRequestContext :: RequestTransformCtx -> RequestContext
mkRequestContext RequestTransformCtx
ctx =
RequestFields
{ method :: TransformCtx Method
method = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @RequestTransformCtx @(TransformCtx Method) RequestTransformCtx
ctx,
url :: TransformCtx Url
url = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @RequestTransformCtx @(TransformCtx Url) RequestTransformCtx
ctx,
body :: TransformCtx Body
body = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @RequestTransformCtx @(TransformCtx Body) RequestTransformCtx
ctx,
queryParams :: TransformCtx QueryParams
queryParams = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @RequestTransformCtx @(TransformCtx QueryParams) RequestTransformCtx
ctx,
requestHeaders :: TransformCtx Headers
requestHeaders = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @RequestTransformCtx @(TransformCtx Headers) RequestTransformCtx
ctx
}