{-# LANGUAGE DeriveAnyClass #-}
module Hasura.RQL.Types.Webhook.Transform.Body
( Body (..),
BodyTransformFn (..),
TransformFn (..),
TransformCtx (..),
)
where
import Autodocodec (HasCodec, codec, dimapCodec, disjointEitherCodec, object, requiredField', (.=))
import Autodocodec.Extended (discriminatorField)
import Data.Aeson (FromJSON, ToJSON)
import Data.Aeson qualified as J
import Data.ByteString.Lazy qualified as LBS
import Data.HashMap.Internal.Strict qualified as M
import Hasura.Prelude
import Hasura.RQL.Types.Webhook.Transform.Class (Template (..), TransformCtx, TransformFn, UnescapedTemplate (..))
import Hasura.RQL.Types.Webhook.Transform.Request (RequestTransformCtx (..))
data Body
= JSONBody (Maybe J.Value)
| RawBody LBS.ByteString
deriving stock (Body -> Body -> Bool
(Body -> Body -> Bool) -> (Body -> Body -> Bool) -> Eq Body
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Body -> Body -> Bool
== :: Body -> Body -> Bool
$c/= :: Body -> Body -> Bool
/= :: Body -> Body -> Bool
Eq, Int -> Body -> ShowS
[Body] -> ShowS
Body -> String
(Int -> Body -> ShowS)
-> (Body -> String) -> ([Body] -> ShowS) -> Show Body
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Body -> ShowS
showsPrec :: Int -> Body -> ShowS
$cshow :: Body -> String
show :: Body -> String
$cshowList :: [Body] -> ShowS
showList :: [Body] -> ShowS
Show)
data BodyTransformFn
=
Remove
|
ModifyAsJSON Template
|
ModifyAsFormURLEncoded (M.HashMap Text UnescapedTemplate)
deriving stock (BodyTransformFn -> BodyTransformFn -> Bool
(BodyTransformFn -> BodyTransformFn -> Bool)
-> (BodyTransformFn -> BodyTransformFn -> Bool)
-> Eq BodyTransformFn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BodyTransformFn -> BodyTransformFn -> Bool
== :: BodyTransformFn -> BodyTransformFn -> Bool
$c/= :: BodyTransformFn -> BodyTransformFn -> Bool
/= :: BodyTransformFn -> BodyTransformFn -> Bool
Eq, (forall x. BodyTransformFn -> Rep BodyTransformFn x)
-> (forall x. Rep BodyTransformFn x -> BodyTransformFn)
-> Generic BodyTransformFn
forall x. Rep BodyTransformFn x -> BodyTransformFn
forall x. BodyTransformFn -> Rep BodyTransformFn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BodyTransformFn -> Rep BodyTransformFn x
from :: forall x. BodyTransformFn -> Rep BodyTransformFn x
$cto :: forall x. Rep BodyTransformFn x -> BodyTransformFn
to :: forall x. Rep BodyTransformFn x -> BodyTransformFn
Generic, Int -> BodyTransformFn -> ShowS
[BodyTransformFn] -> ShowS
BodyTransformFn -> String
(Int -> BodyTransformFn -> ShowS)
-> (BodyTransformFn -> String)
-> ([BodyTransformFn] -> ShowS)
-> Show BodyTransformFn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BodyTransformFn -> ShowS
showsPrec :: Int -> BodyTransformFn -> ShowS
$cshow :: BodyTransformFn -> String
show :: BodyTransformFn -> String
$cshowList :: [BodyTransformFn] -> ShowS
showList :: [BodyTransformFn] -> ShowS
Show)
deriving anyclass (BodyTransformFn -> ()
(BodyTransformFn -> ()) -> NFData BodyTransformFn
forall a. (a -> ()) -> NFData a
$crnf :: BodyTransformFn -> ()
rnf :: BodyTransformFn -> ()
NFData)
instance FromJSON BodyTransformFn where
parseJSON :: Value -> Parser BodyTransformFn
parseJSON = String
-> (Object -> Parser BodyTransformFn)
-> Value
-> Parser BodyTransformFn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
J.withObject String
"BodyTransformFn" \Object
o -> do
Text
action <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
J..: Key
"action"
case (Text
action :: Text) of
Text
"remove" -> BodyTransformFn -> Parser BodyTransformFn
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure BodyTransformFn
Remove
Text
"transform" -> do
Template
template <- Object
o Object -> Key -> Parser Template
forall a. FromJSON a => Object -> Key -> Parser a
J..: Key
"template"
BodyTransformFn -> Parser BodyTransformFn
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BodyTransformFn -> Parser BodyTransformFn)
-> BodyTransformFn -> Parser BodyTransformFn
forall a b. (a -> b) -> a -> b
$ Template -> BodyTransformFn
ModifyAsJSON Template
template
Text
"x_www_form_urlencoded" -> do
HashMap Text UnescapedTemplate
formTemplates <- Object
o Object -> Key -> Parser (HashMap Text UnescapedTemplate)
forall a. FromJSON a => Object -> Key -> Parser a
J..: Key
"form_template"
BodyTransformFn -> Parser BodyTransformFn
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BodyTransformFn -> Parser BodyTransformFn)
-> BodyTransformFn -> Parser BodyTransformFn
forall a b. (a -> b) -> a -> b
$ HashMap Text UnescapedTemplate -> BodyTransformFn
ModifyAsFormURLEncoded HashMap Text UnescapedTemplate
formTemplates
Text
_ -> String -> Parser BodyTransformFn
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"invalid transform action"
instance ToJSON BodyTransformFn where
toJSON :: BodyTransformFn -> Value
toJSON = \case
BodyTransformFn
Remove -> [Pair] -> Value
J.object [Key
"action" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= (Text
"remove" :: Text)]
ModifyAsJSON Template
a ->
[Pair] -> Value
J.object
[ Key
"action" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= (Text
"transform" :: Text),
Key
"template" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= Template -> Value
forall a. ToJSON a => a -> Value
J.toJSON Template
a
]
ModifyAsFormURLEncoded HashMap Text UnescapedTemplate
formTemplates ->
[Pair] -> Value
J.object
[ Key
"action" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= (Text
"x_www_form_urlencoded" :: Text),
Key
"form_template" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= HashMap Text UnescapedTemplate -> Value
forall a. ToJSON a => a -> Value
J.toJSON HashMap Text UnescapedTemplate
formTemplates
]
newtype instance TransformFn Body = BodyTransformFn_ BodyTransformFn
deriving stock (TransformFn Body -> TransformFn Body -> Bool
(TransformFn Body -> TransformFn Body -> Bool)
-> (TransformFn Body -> TransformFn Body -> Bool)
-> Eq (TransformFn Body)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransformFn Body -> TransformFn Body -> Bool
== :: TransformFn Body -> TransformFn Body -> Bool
$c/= :: TransformFn Body -> TransformFn Body -> Bool
/= :: TransformFn Body -> TransformFn Body -> Bool
Eq, (forall x. TransformFn Body -> Rep (TransformFn Body) x)
-> (forall x. Rep (TransformFn Body) x -> TransformFn Body)
-> Generic (TransformFn Body)
forall x. Rep (TransformFn Body) x -> TransformFn Body
forall x. TransformFn Body -> Rep (TransformFn Body) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TransformFn Body -> Rep (TransformFn Body) x
from :: forall x. TransformFn Body -> Rep (TransformFn Body) x
$cto :: forall x. Rep (TransformFn Body) x -> TransformFn Body
to :: forall x. Rep (TransformFn Body) x -> TransformFn Body
Generic, Int -> TransformFn Body -> ShowS
[TransformFn Body] -> ShowS
TransformFn Body -> String
(Int -> TransformFn Body -> ShowS)
-> (TransformFn Body -> String)
-> ([TransformFn Body] -> ShowS)
-> Show (TransformFn Body)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransformFn Body -> ShowS
showsPrec :: Int -> TransformFn Body -> ShowS
$cshow :: TransformFn Body -> String
show :: TransformFn Body -> String
$cshowList :: [TransformFn Body] -> ShowS
showList :: [TransformFn Body] -> ShowS
Show)
deriving newtype (TransformFn Body -> ()
(TransformFn Body -> ()) -> NFData (TransformFn Body)
forall a. (a -> ()) -> NFData a
$crnf :: TransformFn Body -> ()
rnf :: TransformFn Body -> ()
NFData, Value -> Parser [TransformFn Body]
Value -> Parser (TransformFn Body)
(Value -> Parser (TransformFn Body))
-> (Value -> Parser [TransformFn Body])
-> FromJSON (TransformFn Body)
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser (TransformFn Body)
parseJSON :: Value -> Parser (TransformFn Body)
$cparseJSONList :: Value -> Parser [TransformFn Body]
parseJSONList :: Value -> Parser [TransformFn Body]
FromJSON, [TransformFn Body] -> Value
[TransformFn Body] -> Encoding
TransformFn Body -> Value
TransformFn Body -> Encoding
(TransformFn Body -> Value)
-> (TransformFn Body -> Encoding)
-> ([TransformFn Body] -> Value)
-> ([TransformFn Body] -> Encoding)
-> ToJSON (TransformFn Body)
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: TransformFn Body -> Value
toJSON :: TransformFn Body -> Value
$ctoEncoding :: TransformFn Body -> Encoding
toEncoding :: TransformFn Body -> Encoding
$ctoJSONList :: [TransformFn Body] -> Value
toJSONList :: [TransformFn Body] -> Value
$ctoEncodingList :: [TransformFn Body] -> Encoding
toEncodingList :: [TransformFn Body] -> Encoding
ToJSON)
newtype instance TransformCtx Body = TransformCtx RequestTransformCtx
instance HasCodec BodyTransformFn where
codec :: JSONCodec BodyTransformFn
codec =
(Either () (Either Template (HashMap Text UnescapedTemplate))
-> BodyTransformFn)
-> (BodyTransformFn
-> Either () (Either Template (HashMap Text UnescapedTemplate)))
-> Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate)))
-> JSONCodec BodyTransformFn
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec Either () (Either Template (HashMap Text UnescapedTemplate))
-> BodyTransformFn
forall {a}.
Either a (Either Template (HashMap Text UnescapedTemplate))
-> BodyTransformFn
dec BodyTransformFn
-> Either () (Either Template (HashMap Text UnescapedTemplate))
enc
(Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate)))
-> JSONCodec BodyTransformFn)
-> Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate)))
-> JSONCodec BodyTransformFn
forall a b. (a -> b) -> a -> b
$ Codec Value () ()
-> Codec
Value
(Either Template (HashMap Text UnescapedTemplate))
(Either Template (HashMap Text UnescapedTemplate))
-> Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate)))
forall context input1 output1 input2 output2.
Codec context input1 output1
-> Codec context input2 output2
-> Codec context (Either input1 input2) (Either output1 output2)
disjointEitherCodec Codec Value () ()
forall {input}. ValueCodec input ()
removeCodec
(Codec
Value
(Either Template (HashMap Text UnescapedTemplate))
(Either Template (HashMap Text UnescapedTemplate))
-> Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate))))
-> Codec
Value
(Either Template (HashMap Text UnescapedTemplate))
(Either Template (HashMap Text UnescapedTemplate))
-> Codec
Value
(Either () (Either Template (HashMap Text UnescapedTemplate)))
(Either () (Either Template (HashMap Text UnescapedTemplate)))
forall a b. (a -> b) -> a -> b
$ Codec Value Template Template
-> Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
-> Codec
Value
(Either Template (HashMap Text UnescapedTemplate))
(Either Template (HashMap Text UnescapedTemplate))
forall context input1 output1 input2 output2.
Codec context input1 output1
-> Codec context input2 output2
-> Codec context (Either input1 input2) (Either output1 output2)
disjointEitherCodec Codec Value Template Template
modifyAsJSONCodec Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
modifyAsFormURLEncodecCodec
where
removeCodec :: ValueCodec input ()
removeCodec = Text -> ObjectCodec input () -> ValueCodec input ()
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"BodyTransformFn_Remove" (ObjectCodec input () -> ValueCodec input ())
-> ObjectCodec input () -> ValueCodec input ()
forall a b. (a -> b) -> a -> b
$ Text -> Text -> ObjectCodec input ()
forall a. Text -> Text -> ObjectCodec a ()
discriminatorField Text
"action" Text
"remove"
modifyAsJSONCodec :: Codec Value Template Template
modifyAsJSONCodec =
(((), Template) -> Template)
-> (Template -> ((), Template))
-> Codec Value ((), Template) ((), Template)
-> Codec Value Template Template
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec ((), Template) -> Template
forall a b. (a, b) -> b
snd ((),)
(Codec Value ((), Template) ((), Template)
-> Codec Value Template Template)
-> Codec Value ((), Template) ((), Template)
-> Codec Value Template Template
forall a b. (a -> b) -> a -> b
$ Text
-> ObjectCodec ((), Template) ((), Template)
-> Codec Value ((), Template) ((), Template)
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"BodyTransformFn_ModifyAsJSON"
(ObjectCodec ((), Template) ((), Template)
-> Codec Value ((), Template) ((), Template))
-> ObjectCodec ((), Template) ((), Template)
-> Codec Value ((), Template) ((), Template)
forall a b. (a -> b) -> a -> b
$ (,)
(() -> Template -> ((), Template))
-> Codec Object ((), Template) ()
-> Codec Object ((), Template) (Template -> ((), Template))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Text -> ObjectCodec () ()
forall a. Text -> Text -> ObjectCodec a ()
discriminatorField Text
"action" Text
"transform"
ObjectCodec () ()
-> (((), Template) -> ()) -> Codec Object ((), Template) ()
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= ((), Template) -> ()
forall a b. (a, b) -> a
fst
Codec Object ((), Template) (Template -> ((), Template))
-> Codec Object ((), Template) Template
-> ObjectCodec ((), Template) ((), Template)
forall a b.
Codec Object ((), Template) (a -> b)
-> Codec Object ((), Template) a -> Codec Object ((), Template) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall output. HasCodec output => Text -> ObjectCodec output output
requiredField' @Template Text
"template"
ObjectCodec Template Template
-> (((), Template) -> Template)
-> Codec Object ((), Template) Template
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= ((), Template) -> Template
forall a b. (a, b) -> b
snd
modifyAsFormURLEncodecCodec :: Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
modifyAsFormURLEncodecCodec =
(((), HashMap Text UnescapedTemplate)
-> HashMap Text UnescapedTemplate)
-> (HashMap Text UnescapedTemplate
-> ((), HashMap Text UnescapedTemplate))
-> Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec ((), HashMap Text UnescapedTemplate)
-> HashMap Text UnescapedTemplate
forall a b. (a, b) -> b
snd ((),)
(Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate))
-> Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
(HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
forall a b. (a -> b) -> a -> b
$ Text
-> ObjectCodec
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"BodyTransformFn_ModifyAsFormURLEncoded"
(ObjectCodec
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate))
-> ObjectCodec
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
-> Codec
Value
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
forall a b. (a -> b) -> a -> b
$ (,)
(()
-> HashMap Text UnescapedTemplate
-> ((), HashMap Text UnescapedTemplate))
-> Codec Object ((), HashMap Text UnescapedTemplate) ()
-> Codec
Object
((), HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate
-> ((), HashMap Text UnescapedTemplate))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Text -> ObjectCodec () ()
forall a. Text -> Text -> ObjectCodec a ()
discriminatorField Text
"action" Text
"x_www_form_urlencoded"
ObjectCodec () ()
-> (((), HashMap Text UnescapedTemplate) -> ())
-> Codec Object ((), HashMap Text UnescapedTemplate) ()
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= ((), HashMap Text UnescapedTemplate) -> ()
forall a b. (a, b) -> a
fst
Codec
Object
((), HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate
-> ((), HashMap Text UnescapedTemplate))
-> Codec
Object
((), HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
-> ObjectCodec
((), HashMap Text UnescapedTemplate)
((), HashMap Text UnescapedTemplate)
forall a b.
Codec Object ((), HashMap Text UnescapedTemplate) (a -> b)
-> Codec Object ((), HashMap Text UnescapedTemplate) a
-> Codec Object ((), HashMap Text UnescapedTemplate) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall output. HasCodec output => Text -> ObjectCodec output output
requiredField' @(M.HashMap Text UnescapedTemplate) Text
"form_template"
ObjectCodec
(HashMap Text UnescapedTemplate) (HashMap Text UnescapedTemplate)
-> (((), HashMap Text UnescapedTemplate)
-> HashMap Text UnescapedTemplate)
-> Codec
Object
((), HashMap Text UnescapedTemplate)
(HashMap Text UnescapedTemplate)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= ((), HashMap Text UnescapedTemplate)
-> HashMap Text UnescapedTemplate
forall a b. (a, b) -> b
snd
dec :: Either a (Either Template (HashMap Text UnescapedTemplate))
-> BodyTransformFn
dec (Left a
_) = BodyTransformFn
Remove
dec (Right (Left Template
template)) = Template -> BodyTransformFn
ModifyAsJSON Template
template
dec (Right (Right HashMap Text UnescapedTemplate
hashMap)) = HashMap Text UnescapedTemplate -> BodyTransformFn
ModifyAsFormURLEncoded HashMap Text UnescapedTemplate
hashMap
enc :: BodyTransformFn
-> Either () (Either Template (HashMap Text UnescapedTemplate))
enc BodyTransformFn
Remove = () -> Either () (Either Template (HashMap Text UnescapedTemplate))
forall a b. a -> Either a b
Left ()
enc (ModifyAsJSON Template
template) = Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate))
forall a b. b -> Either a b
Right (Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate)))
-> Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate))
forall a b. (a -> b) -> a -> b
$ Template -> Either Template (HashMap Text UnescapedTemplate)
forall a b. a -> Either a b
Left Template
template
enc (ModifyAsFormURLEncoded HashMap Text UnescapedTemplate
hashMap) = Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate))
forall a b. b -> Either a b
Right (Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate)))
-> Either Template (HashMap Text UnescapedTemplate)
-> Either () (Either Template (HashMap Text UnescapedTemplate))
forall a b. (a -> b) -> a -> b
$ HashMap Text UnescapedTemplate
-> Either Template (HashMap Text UnescapedTemplate)
forall a b. b -> Either a b
Right HashMap Text UnescapedTemplate
hashMap