{-# LANGUAGE UndecidableInstances #-}

module Hasura.RQL.Types.Run
  ( RunT (..),
    RunCtx (..),
    peelRun,
  )
where

import Control.Monad.Trans.Control (MonadBaseControl)
import Hasura.Base.Error
import Hasura.Metadata.Class
import Hasura.Prelude
import Hasura.RQL.Types.Source
import Hasura.Server.Types
import Hasura.Session
import Hasura.Tracing qualified as Tracing
import Network.HTTP.Client.Manager qualified as HTTP

data RunCtx = RunCtx
  { RunCtx -> UserInfo
_rcUserInfo :: UserInfo,
    RunCtx -> Manager
_rcHttpMgr :: HTTP.Manager,
    RunCtx -> ServerConfigCtx
_rcServerConfigCtx :: ServerConfigCtx
  }

newtype RunT m a = RunT {RunT m a -> ReaderT RunCtx (ExceptT QErr m) a
unRunT :: ReaderT RunCtx (ExceptT QErr m) a}
  deriving
    ( a -> RunT m b -> RunT m a
(a -> b) -> RunT m a -> RunT m b
(forall a b. (a -> b) -> RunT m a -> RunT m b)
-> (forall a b. a -> RunT m b -> RunT m a) -> Functor (RunT m)
forall a b. a -> RunT m b -> RunT m a
forall a b. (a -> b) -> RunT m a -> RunT m b
forall (m :: * -> *) a b. Functor m => a -> RunT m b -> RunT m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> RunT m a -> RunT m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> RunT m b -> RunT m a
$c<$ :: forall (m :: * -> *) a b. Functor m => a -> RunT m b -> RunT m a
fmap :: (a -> b) -> RunT m a -> RunT m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> RunT m a -> RunT m b
Functor,
      Functor (RunT m)
a -> RunT m a
Functor (RunT m)
-> (forall a. a -> RunT m a)
-> (forall a b. RunT m (a -> b) -> RunT m a -> RunT m b)
-> (forall a b c.
    (a -> b -> c) -> RunT m a -> RunT m b -> RunT m c)
-> (forall a b. RunT m a -> RunT m b -> RunT m b)
-> (forall a b. RunT m a -> RunT m b -> RunT m a)
-> Applicative (RunT m)
RunT m a -> RunT m b -> RunT m b
RunT m a -> RunT m b -> RunT m a
RunT m (a -> b) -> RunT m a -> RunT m b
(a -> b -> c) -> RunT m a -> RunT m b -> RunT m c
forall a. a -> RunT m a
forall a b. RunT m a -> RunT m b -> RunT m a
forall a b. RunT m a -> RunT m b -> RunT m b
forall a b. RunT m (a -> b) -> RunT m a -> RunT m b
forall a b c. (a -> b -> c) -> RunT m a -> RunT m b -> RunT m c
forall (m :: * -> *). Monad m => Functor (RunT m)
forall (m :: * -> *) a. Monad m => a -> RunT m a
forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m a
forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m b
forall (m :: * -> *) a b.
Monad m =>
RunT m (a -> b) -> RunT m a -> RunT m b
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> RunT m a -> RunT m b -> RunT m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: RunT m a -> RunT m b -> RunT m a
$c<* :: forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m a
*> :: RunT m a -> RunT m b -> RunT m b
$c*> :: forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m b
liftA2 :: (a -> b -> c) -> RunT m a -> RunT m b -> RunT m c
$cliftA2 :: forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> RunT m a -> RunT m b -> RunT m c
<*> :: RunT m (a -> b) -> RunT m a -> RunT m b
$c<*> :: forall (m :: * -> *) a b.
Monad m =>
RunT m (a -> b) -> RunT m a -> RunT m b
pure :: a -> RunT m a
$cpure :: forall (m :: * -> *) a. Monad m => a -> RunT m a
$cp1Applicative :: forall (m :: * -> *). Monad m => Functor (RunT m)
Applicative,
      Applicative (RunT m)
a -> RunT m a
Applicative (RunT m)
-> (forall a b. RunT m a -> (a -> RunT m b) -> RunT m b)
-> (forall a b. RunT m a -> RunT m b -> RunT m b)
-> (forall a. a -> RunT m a)
-> Monad (RunT m)
RunT m a -> (a -> RunT m b) -> RunT m b
RunT m a -> RunT m b -> RunT m b
forall a. a -> RunT m a
forall a b. RunT m a -> RunT m b -> RunT m b
forall a b. RunT m a -> (a -> RunT m b) -> RunT m b
forall (m :: * -> *). Monad m => Applicative (RunT m)
forall (m :: * -> *) a. Monad m => a -> RunT m a
forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m b
forall (m :: * -> *) a b.
Monad m =>
RunT m a -> (a -> RunT m b) -> RunT m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> RunT m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> RunT m a
>> :: RunT m a -> RunT m b -> RunT m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
RunT m a -> RunT m b -> RunT m b
>>= :: RunT m a -> (a -> RunT m b) -> RunT m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
RunT m a -> (a -> RunT m b) -> RunT m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (RunT m)
Monad,
      MonadError QErr,
      MonadReader RunCtx,
      Monad (RunT m)
Monad (RunT m) -> (forall a. IO a -> RunT m a) -> MonadIO (RunT m)
IO a -> RunT m a
forall a. IO a -> RunT m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (RunT m)
forall (m :: * -> *) a. MonadIO m => IO a -> RunT m a
liftIO :: IO a -> RunT m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> RunT m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (RunT m)
MonadIO,
      MonadError QErr (RunT m)
RunT m [ActionLogItem]
RunT m ()
RunT m ([CronEvent], [OneOffScheduledEvent])
RunT m (Metadata, MetadataResourceVersion)
RunT m MetadataDbId
RunT m CatalogState
RunT m MetadataResourceVersion
[TriggerName] -> RunT m [CronTriggerStats]
[CronEventSeed] -> RunT m ()
MonadError QErr (RunT m)
-> RunT m MetadataResourceVersion
-> RunT m (Metadata, MetadataResourceVersion)
-> (MetadataResourceVersion
    -> InstanceId
    -> RunT m [(MetadataResourceVersion, CacheInvalidations)])
-> (MetadataResourceVersion
    -> Metadata -> RunT m MetadataResourceVersion)
-> (MetadataResourceVersion
    -> InstanceId -> CacheInvalidations -> RunT m ())
-> RunT m CatalogState
-> (CatalogStateType -> Value -> RunT m ())
-> RunT m MetadataDbId
-> RunT m ()
-> ([TriggerName] -> RunT m [CronTriggerStats])
-> RunT m ([CronEvent], [OneOffScheduledEvent])
-> ([CronEventSeed] -> RunT m ())
-> (OneOffEvent -> RunT m EventId)
-> (Invocation 'ScheduledType -> ScheduledEventType -> RunT m ())
-> (EventId -> ScheduledEventOp -> ScheduledEventType -> RunT m ())
-> (ScheduledEventType -> [EventId] -> RunT m Int)
-> RunT m ()
-> (ClearCronEvents -> RunT m ())
-> (ScheduledEventPagination
    -> [ScheduledEventStatus]
    -> RunT m (WithTotalCount [OneOffScheduledEvent]))
-> (TriggerName
    -> ScheduledEventPagination
    -> [ScheduledEventStatus]
    -> RunT m (WithTotalCount [CronEvent]))
-> (GetInvocationsBy
    -> ScheduledEventPagination
    -> RunT m (WithTotalCount [ScheduledEventInvocation]))
-> (EventId -> ScheduledEventType -> RunT m ())
-> (ActionName
    -> SessionVariables -> [Header] -> Value -> RunT m ActionId)
-> RunT m [ActionLogItem]
-> (ActionId -> AsyncActionStatus -> RunT m ())
-> (ActionId -> RunT m ActionLogResponse)
-> (ActionName -> RunT m ())
-> (LockedActionIdArray -> RunT m ())
-> MonadMetadataStorage (RunT m)
EventId -> ScheduledEventType -> RunT m ()
EventId -> ScheduledEventOp -> ScheduledEventType -> RunT m ()
Invocation 'ScheduledType -> ScheduledEventType -> RunT m ()
TriggerName
-> ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [CronEvent])
OneOffEvent -> RunT m EventId
ScheduledEventType -> [EventId] -> RunT m Int
ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [OneOffScheduledEvent])
ClearCronEvents -> RunT m ()
GetInvocationsBy
-> ScheduledEventPagination
-> RunT m (WithTotalCount [ScheduledEventInvocation])
LockedActionIdArray -> RunT m ()
ActionId -> RunT m ActionLogResponse
ActionId -> AsyncActionStatus -> RunT m ()
ActionName -> RunT m ()
ActionName
-> SessionVariables -> [Header] -> Value -> RunT m ActionId
CatalogStateType -> Value -> RunT m ()
MetadataResourceVersion
-> InstanceId
-> RunT m [(MetadataResourceVersion, CacheInvalidations)]
MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> RunT m ()
MetadataResourceVersion
-> Metadata -> RunT m MetadataResourceVersion
forall (m :: * -> *).
MonadError QErr m
-> m MetadataResourceVersion
-> m (Metadata, MetadataResourceVersion)
-> (MetadataResourceVersion
    -> InstanceId -> m [(MetadataResourceVersion, CacheInvalidations)])
-> (MetadataResourceVersion
    -> Metadata -> m MetadataResourceVersion)
-> (MetadataResourceVersion
    -> InstanceId -> CacheInvalidations -> m ())
-> m CatalogState
-> (CatalogStateType -> Value -> m ())
-> m MetadataDbId
-> m ()
-> ([TriggerName] -> m [CronTriggerStats])
-> m ([CronEvent], [OneOffScheduledEvent])
-> ([CronEventSeed] -> m ())
-> (OneOffEvent -> m EventId)
-> (Invocation 'ScheduledType -> ScheduledEventType -> m ())
-> (EventId -> ScheduledEventOp -> ScheduledEventType -> m ())
-> (ScheduledEventType -> [EventId] -> m Int)
-> m ()
-> (ClearCronEvents -> m ())
-> (ScheduledEventPagination
    -> [ScheduledEventStatus]
    -> m (WithTotalCount [OneOffScheduledEvent]))
-> (TriggerName
    -> ScheduledEventPagination
    -> [ScheduledEventStatus]
    -> m (WithTotalCount [CronEvent]))
-> (GetInvocationsBy
    -> ScheduledEventPagination
    -> m (WithTotalCount [ScheduledEventInvocation]))
-> (EventId -> ScheduledEventType -> m ())
-> (ActionName
    -> SessionVariables -> [Header] -> Value -> m ActionId)
-> m [ActionLogItem]
-> (ActionId -> AsyncActionStatus -> m ())
-> (ActionId -> m ActionLogResponse)
-> (ActionName -> m ())
-> (LockedActionIdArray -> m ())
-> MonadMetadataStorage m
forall (m :: * -> *).
MonadMetadataStorage m =>
MonadError QErr (RunT m)
forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m [ActionLogItem]
forall (m :: * -> *). MonadMetadataStorage m => RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m ([CronEvent], [OneOffScheduledEvent])
forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m (Metadata, MetadataResourceVersion)
forall (m :: * -> *). MonadMetadataStorage m => RunT m MetadataDbId
forall (m :: * -> *). MonadMetadataStorage m => RunT m CatalogState
forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m MetadataResourceVersion
forall (m :: * -> *).
MonadMetadataStorage m =>
[TriggerName] -> RunT m [CronTriggerStats]
forall (m :: * -> *).
MonadMetadataStorage m =>
[CronEventSeed] -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
EventId -> ScheduledEventType -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
EventId -> ScheduledEventOp -> ScheduledEventType -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
Invocation 'ScheduledType -> ScheduledEventType -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
TriggerName
-> ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [CronEvent])
forall (m :: * -> *).
MonadMetadataStorage m =>
OneOffEvent -> RunT m EventId
forall (m :: * -> *).
MonadMetadataStorage m =>
ScheduledEventType -> [EventId] -> RunT m Int
forall (m :: * -> *).
MonadMetadataStorage m =>
ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [OneOffScheduledEvent])
forall (m :: * -> *).
MonadMetadataStorage m =>
ClearCronEvents -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
GetInvocationsBy
-> ScheduledEventPagination
-> RunT m (WithTotalCount [ScheduledEventInvocation])
forall (m :: * -> *).
MonadMetadataStorage m =>
LockedActionIdArray -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
ActionId -> RunT m ActionLogResponse
forall (m :: * -> *).
MonadMetadataStorage m =>
ActionId -> AsyncActionStatus -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
ActionName -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
ActionName
-> SessionVariables -> [Header] -> Value -> RunT m ActionId
forall (m :: * -> *).
MonadMetadataStorage m =>
CatalogStateType -> Value -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> InstanceId
-> RunT m [(MetadataResourceVersion, CacheInvalidations)]
forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> RunT m ()
forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> Metadata -> RunT m MetadataResourceVersion
setProcessingActionLogsToPending :: LockedActionIdArray -> RunT m ()
$csetProcessingActionLogsToPending :: forall (m :: * -> *).
MonadMetadataStorage m =>
LockedActionIdArray -> RunT m ()
clearActionData :: ActionName -> RunT m ()
$cclearActionData :: forall (m :: * -> *).
MonadMetadataStorage m =>
ActionName -> RunT m ()
fetchActionResponse :: ActionId -> RunT m ActionLogResponse
$cfetchActionResponse :: forall (m :: * -> *).
MonadMetadataStorage m =>
ActionId -> RunT m ActionLogResponse
setActionStatus :: ActionId -> AsyncActionStatus -> RunT m ()
$csetActionStatus :: forall (m :: * -> *).
MonadMetadataStorage m =>
ActionId -> AsyncActionStatus -> RunT m ()
fetchUndeliveredActionEvents :: RunT m [ActionLogItem]
$cfetchUndeliveredActionEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m [ActionLogItem]
insertAction :: ActionName
-> SessionVariables -> [Header] -> Value -> RunT m ActionId
$cinsertAction :: forall (m :: * -> *).
MonadMetadataStorage m =>
ActionName
-> SessionVariables -> [Header] -> Value -> RunT m ActionId
deleteScheduledEvent :: EventId -> ScheduledEventType -> RunT m ()
$cdeleteScheduledEvent :: forall (m :: * -> *).
MonadMetadataStorage m =>
EventId -> ScheduledEventType -> RunT m ()
getInvocations :: GetInvocationsBy
-> ScheduledEventPagination
-> RunT m (WithTotalCount [ScheduledEventInvocation])
$cgetInvocations :: forall (m :: * -> *).
MonadMetadataStorage m =>
GetInvocationsBy
-> ScheduledEventPagination
-> RunT m (WithTotalCount [ScheduledEventInvocation])
getCronEvents :: TriggerName
-> ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [CronEvent])
$cgetCronEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
TriggerName
-> ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [CronEvent])
getOneOffScheduledEvents :: ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [OneOffScheduledEvent])
$cgetOneOffScheduledEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
ScheduledEventPagination
-> [ScheduledEventStatus]
-> RunT m (WithTotalCount [OneOffScheduledEvent])
clearFutureCronEvents :: ClearCronEvents -> RunT m ()
$cclearFutureCronEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
ClearCronEvents -> RunT m ()
unlockAllLockedScheduledEvents :: RunT m ()
$cunlockAllLockedScheduledEvents :: forall (m :: * -> *). MonadMetadataStorage m => RunT m ()
unlockScheduledEvents :: ScheduledEventType -> [EventId] -> RunT m Int
$cunlockScheduledEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
ScheduledEventType -> [EventId] -> RunT m Int
setScheduledEventOp :: EventId -> ScheduledEventOp -> ScheduledEventType -> RunT m ()
$csetScheduledEventOp :: forall (m :: * -> *).
MonadMetadataStorage m =>
EventId -> ScheduledEventOp -> ScheduledEventType -> RunT m ()
insertScheduledEventInvocation :: Invocation 'ScheduledType -> ScheduledEventType -> RunT m ()
$cinsertScheduledEventInvocation :: forall (m :: * -> *).
MonadMetadataStorage m =>
Invocation 'ScheduledType -> ScheduledEventType -> RunT m ()
insertOneOffScheduledEvent :: OneOffEvent -> RunT m EventId
$cinsertOneOffScheduledEvent :: forall (m :: * -> *).
MonadMetadataStorage m =>
OneOffEvent -> RunT m EventId
insertCronEvents :: [CronEventSeed] -> RunT m ()
$cinsertCronEvents :: forall (m :: * -> *).
MonadMetadataStorage m =>
[CronEventSeed] -> RunT m ()
getScheduledEventsForDelivery :: RunT m ([CronEvent], [OneOffScheduledEvent])
$cgetScheduledEventsForDelivery :: forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m ([CronEvent], [OneOffScheduledEvent])
getDeprivedCronTriggerStats :: [TriggerName] -> RunT m [CronTriggerStats]
$cgetDeprivedCronTriggerStats :: forall (m :: * -> *).
MonadMetadataStorage m =>
[TriggerName] -> RunT m [CronTriggerStats]
checkMetadataStorageHealth :: RunT m ()
$ccheckMetadataStorageHealth :: forall (m :: * -> *). MonadMetadataStorage m => RunT m ()
getMetadataDbUid :: RunT m MetadataDbId
$cgetMetadataDbUid :: forall (m :: * -> *). MonadMetadataStorage m => RunT m MetadataDbId
setCatalogState :: CatalogStateType -> Value -> RunT m ()
$csetCatalogState :: forall (m :: * -> *).
MonadMetadataStorage m =>
CatalogStateType -> Value -> RunT m ()
getCatalogState :: RunT m CatalogState
$cgetCatalogState :: forall (m :: * -> *). MonadMetadataStorage m => RunT m CatalogState
notifySchemaCacheSync :: MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> RunT m ()
$cnotifySchemaCacheSync :: forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> RunT m ()
setMetadata :: MetadataResourceVersion
-> Metadata -> RunT m MetadataResourceVersion
$csetMetadata :: forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> Metadata -> RunT m MetadataResourceVersion
fetchMetadataNotifications :: MetadataResourceVersion
-> InstanceId
-> RunT m [(MetadataResourceVersion, CacheInvalidations)]
$cfetchMetadataNotifications :: forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> InstanceId
-> RunT m [(MetadataResourceVersion, CacheInvalidations)]
fetchMetadata :: RunT m (Metadata, MetadataResourceVersion)
$cfetchMetadata :: forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m (Metadata, MetadataResourceVersion)
fetchMetadataResourceVersion :: RunT m MetadataResourceVersion
$cfetchMetadataResourceVersion :: forall (m :: * -> *).
MonadMetadataStorage m =>
RunT m MetadataResourceVersion
$cp1MonadMetadataStorage :: forall (m :: * -> *).
MonadMetadataStorage m =>
MonadError QErr (RunT m)
MonadMetadataStorage,
      Monad (RunT m)
RunT m TraceContext
RunT m Reporter
Monad (RunT m)
-> (forall a. Text -> RunT m a -> RunT m a)
-> RunT m TraceContext
-> RunT m Reporter
-> (TracingMetadata -> RunT m ())
-> MonadTrace (RunT m)
TracingMetadata -> RunT m ()
Text -> RunT m a -> RunT m a
forall a. Text -> RunT m a -> RunT m a
forall (m :: * -> *).
Monad m
-> (forall a. Text -> m a -> m a)
-> m TraceContext
-> m Reporter
-> (TracingMetadata -> m ())
-> MonadTrace m
forall (m :: * -> *). MonadTrace m => Monad (RunT m)
forall (m :: * -> *). MonadTrace m => RunT m TraceContext
forall (m :: * -> *). MonadTrace m => RunT m Reporter
forall (m :: * -> *). MonadTrace m => TracingMetadata -> RunT m ()
forall (m :: * -> *) a.
MonadTrace m =>
Text -> RunT m a -> RunT m a
attachMetadata :: TracingMetadata -> RunT m ()
$cattachMetadata :: forall (m :: * -> *). MonadTrace m => TracingMetadata -> RunT m ()
currentReporter :: RunT m Reporter
$ccurrentReporter :: forall (m :: * -> *). MonadTrace m => RunT m Reporter
currentContext :: RunT m TraceContext
$ccurrentContext :: forall (m :: * -> *). MonadTrace m => RunT m TraceContext
trace :: Text -> RunT m a -> RunT m a
$ctrace :: forall (m :: * -> *) a.
MonadTrace m =>
Text -> RunT m a -> RunT m a
$cp1MonadTrace :: forall (m :: * -> *). MonadTrace m => Monad (RunT m)
Tracing.MonadTrace,
      MonadBase b,
      MonadBaseControl b
    )

instance (MonadMetadataStorage m) => MonadMetadataStorageQueryAPI (RunT m)

instance (Monad m) => UserInfoM (RunT m) where
  askUserInfo :: RunT m UserInfo
askUserInfo = (RunCtx -> UserInfo) -> RunT m UserInfo
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks RunCtx -> UserInfo
_rcUserInfo

instance (Monad m) => HTTP.HasHttpManagerM (RunT m) where
  askHttpManager :: RunT m Manager
askHttpManager = (RunCtx -> Manager) -> RunT m Manager
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks RunCtx -> Manager
_rcHttpMgr

instance (Monad m) => HasServerConfigCtx (RunT m) where
  askServerConfigCtx :: RunT m ServerConfigCtx
askServerConfigCtx = (RunCtx -> ServerConfigCtx) -> RunT m ServerConfigCtx
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks RunCtx -> ServerConfigCtx
_rcServerConfigCtx

instance (MonadResolveSource m) => MonadResolveSource (RunT m) where
  getPGSourceResolver :: RunT m (SourceResolver ('Postgres 'Vanilla))
getPGSourceResolver = ReaderT
  RunCtx
  (ExceptT QErr m)
  (SourceName
   -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> RunT
     m
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall (m :: * -> *) a.
ReaderT RunCtx (ExceptT QErr m) a -> RunT m a
RunT (ReaderT
   RunCtx
   (ExceptT QErr m)
   (SourceName
    -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
 -> RunT
      m
      (SourceName
       -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig)))
-> (m (SourceName
       -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
    -> ReaderT
         RunCtx
         (ExceptT QErr m)
         (SourceName
          -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig)))
-> m (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> RunT
     m
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ExceptT
  QErr
  m
  (SourceName
   -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> ReaderT
     RunCtx
     (ExceptT QErr m)
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ExceptT
   QErr
   m
   (SourceName
    -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
 -> ReaderT
      RunCtx
      (ExceptT QErr m)
      (SourceName
       -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig)))
-> (m (SourceName
       -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
    -> ExceptT
         QErr
         m
         (SourceName
          -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig)))
-> m (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> ReaderT
     RunCtx
     (ExceptT QErr m)
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (SourceName
   -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> ExceptT
     QErr
     m
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SourceName
    -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
 -> RunT
      m
      (SourceName
       -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig)))
-> m (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
-> RunT
     m
     (SourceName
      -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall a b. (a -> b) -> a -> b
$ m (SourceName
   -> PostgresConnConfiguration -> IO (Either QErr PGSourceConfig))
forall (m :: * -> *).
MonadResolveSource m =>
m (SourceResolver ('Postgres 'Vanilla))
getPGSourceResolver
  getMSSQLSourceResolver :: RunT m (SourceResolver 'MSSQL)
getMSSQLSourceResolver = ReaderT
  RunCtx
  (ExceptT QErr m)
  (SourceName
   -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> RunT
     m
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall (m :: * -> *) a.
ReaderT RunCtx (ExceptT QErr m) a -> RunT m a
RunT (ReaderT
   RunCtx
   (ExceptT QErr m)
   (SourceName
    -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
 -> RunT
      m
      (SourceName
       -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig)))
-> (m (SourceName
       -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
    -> ReaderT
         RunCtx
         (ExceptT QErr m)
         (SourceName
          -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig)))
-> m (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> RunT
     m
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ExceptT
  QErr
  m
  (SourceName
   -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> ReaderT
     RunCtx
     (ExceptT QErr m)
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ExceptT
   QErr
   m
   (SourceName
    -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
 -> ReaderT
      RunCtx
      (ExceptT QErr m)
      (SourceName
       -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig)))
-> (m (SourceName
       -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
    -> ExceptT
         QErr
         m
         (SourceName
          -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig)))
-> m (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> ReaderT
     RunCtx
     (ExceptT QErr m)
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (SourceName
   -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> ExceptT
     QErr
     m
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SourceName
    -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
 -> RunT
      m
      (SourceName
       -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig)))
-> m (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
-> RunT
     m
     (SourceName
      -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall a b. (a -> b) -> a -> b
$ m (SourceName
   -> MSSQLConnConfiguration -> IO (Either QErr MSSQLSourceConfig))
forall (m :: * -> *).
MonadResolveSource m =>
m (SourceResolver 'MSSQL)
getMSSQLSourceResolver

peelRun ::
  RunCtx ->
  RunT m a ->
  ExceptT QErr m a
peelRun :: RunCtx -> RunT m a -> ExceptT QErr m a
peelRun RunCtx
runCtx (RunT ReaderT RunCtx (ExceptT QErr m) a
m) = ReaderT RunCtx (ExceptT QErr m) a -> RunCtx -> ExceptT QErr m a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT ReaderT RunCtx (ExceptT QErr m) a
m RunCtx
runCtx