-- | The RQL metadata query ('/v1/metadata')
module Hasura.Server.API.Metadata
  ( RQLMetadata,
    RQLMetadataV1 (..),
    runMetadataQuery,
  )
where

import Control.Lens (_Just)
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.Aeson
import Data.Environment qualified as Env
import Data.Has (Has)
import Data.HashMap.Strict qualified as HashMap
import Data.Text qualified as T
import GHC.Generics.Extended (constrName)
import Hasura.App.State
import Hasura.Base.Error
import Hasura.EncJSON
import Hasura.Eventing.Backend
import Hasura.Function.API qualified as Functions
import Hasura.GraphQL.Transport.WebSocket qualified as WS
import Hasura.Logging qualified as L
import Hasura.LogicalModel.API qualified as LogicalModel
import Hasura.Metadata.Class
import Hasura.NativeQuery.API qualified as NativeQueries
import Hasura.Prelude hiding (first)
import Hasura.RQL.DDL.Action
import Hasura.RQL.DDL.Action.Lenses (caDefinition, uaDefinition)
import Hasura.RQL.DDL.ApiLimit
import Hasura.RQL.DDL.ComputedField
import Hasura.RQL.DDL.ConnectionTemplate
import Hasura.RQL.DDL.CustomTypes
import Hasura.RQL.DDL.DataConnector
import Hasura.RQL.DDL.Endpoint
import Hasura.RQL.DDL.EventTrigger
import Hasura.RQL.DDL.GraphqlSchemaIntrospection
import Hasura.RQL.DDL.InheritedRoles
import Hasura.RQL.DDL.Metadata
import Hasura.RQL.DDL.Network
import Hasura.RQL.DDL.OpenTelemetry
import Hasura.RQL.DDL.Permission
import Hasura.RQL.DDL.QueryCollection
import Hasura.RQL.DDL.QueryTags
import Hasura.RQL.DDL.Relationship
import Hasura.RQL.DDL.Relationship.Rename
import Hasura.RQL.DDL.Relationship.Suggest
import Hasura.RQL.DDL.RemoteRelationship
import Hasura.RQL.DDL.ScheduledTrigger
import Hasura.RQL.DDL.Schema
import Hasura.RQL.DDL.Schema.Cache.Config
import Hasura.RQL.DDL.Schema.Source
import Hasura.RQL.DDL.SourceKinds
import Hasura.RQL.DDL.Webhook.Transform.Validation
import Hasura.RQL.Types.Action
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.Metadata (Metadata, MetadataModifier (MetadataModifier), emptyMetadataDefaults)
import Hasura.RQL.Types.Metadata.Backend
import Hasura.RQL.Types.Metadata.Object (MetadataObjId)
import Hasura.RQL.Types.Permission
import Hasura.RQL.Types.ScheduledTrigger
import Hasura.RQL.Types.Schema.Options qualified as Options
import Hasura.RQL.Types.SchemaCache
import Hasura.RQL.Types.SchemaCache.Build
import Hasura.RQL.Types.Source
import Hasura.RemoteSchema.MetadataAPI
import Hasura.SQL.AnyBackend
import Hasura.Server.API.Instances ()
import Hasura.Server.API.Metadata.Instances ()
import Hasura.Server.API.Metadata.Types
import Hasura.Server.Init.FeatureFlag (HasFeatureFlagChecker)
import Hasura.Server.Logging (SchemaSyncLog (..), SchemaSyncThreadType (TTMetadataApi))
import Hasura.Server.Types
import Hasura.Services
import Hasura.Session
import Hasura.StoredProcedure.API qualified as StoredProcedures
import Hasura.Tracing qualified as Tracing

-- | The payload for the @/v1/metadata@ endpoint. See:
--
-- https://hasura.io/docs/latest/graphql/core/api-reference/metadata-api/index/
data RQLMetadata = RQLMetadata
  { RQLMetadata -> Maybe MetadataResourceVersion
_rqlMetadataResourceVersion :: !(Maybe MetadataResourceVersion),
    RQLMetadata -> RQLMetadataRequest
_rqlMetadata :: !RQLMetadataRequest
  }

instance FromJSON RQLMetadata where
  parseJSON :: Value -> Parser RQLMetadata
parseJSON = String
-> (Object -> Parser RQLMetadata) -> Value -> Parser RQLMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"RQLMetadata" ((Object -> Parser RQLMetadata) -> Value -> Parser RQLMetadata)
-> (Object -> Parser RQLMetadata) -> Value -> Parser RQLMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
    Maybe MetadataResourceVersion
_rqlMetadataResourceVersion <- Object
o Object -> Key -> Parser (Maybe MetadataResourceVersion)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"resource_version"
    RQLMetadataRequest
_rqlMetadata <- Value -> Parser RQLMetadataRequest
forall a. FromJSON a => Value -> Parser a
parseJSON (Value -> Parser RQLMetadataRequest)
-> Value -> Parser RQLMetadataRequest
forall a b. (a -> b) -> a -> b
$ Object -> Value
Object Object
o
    RQLMetadata -> Parser RQLMetadata
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure RQLMetadata {Maybe MetadataResourceVersion
RQLMetadataRequest
_rqlMetadataResourceVersion :: Maybe MetadataResourceVersion
_rqlMetadata :: RQLMetadataRequest
_rqlMetadataResourceVersion :: Maybe MetadataResourceVersion
_rqlMetadata :: RQLMetadataRequest
..}

runMetadataQuery ::
  ( MonadIO m,
    MonadError QErr m,
    MonadBaseControl IO m,
    HasAppEnv m,
    HasCacheStaticConfig m,
    HasFeatureFlagChecker m,
    Tracing.MonadTrace m,
    MonadMetadataStorage m,
    MonadResolveSource m,
    MonadEventLogCleanup m,
    ProvidesHasuraServices m,
    MonadGetPolicies m,
    UserInfoM m
  ) =>
  AppContext ->
  RebuildableSchemaCache ->
  WS.WebsocketCloseOnMetadataChangeAction ->
  RQLMetadata ->
  m (EncJSON, RebuildableSchemaCache)
runMetadataQuery :: forall (m :: * -> *).
(MonadIO m, MonadError QErr m, MonadBaseControl IO m, HasAppEnv m,
 HasCacheStaticConfig m, HasFeatureFlagChecker m, MonadTrace m,
 MonadMetadataStorage m, MonadResolveSource m,
 MonadEventLogCleanup m, ProvidesHasuraServices m,
 MonadGetPolicies m, UserInfoM m) =>
AppContext
-> RebuildableSchemaCache
-> WebsocketCloseOnMetadataChangeAction
-> RQLMetadata
-> m (EncJSON, RebuildableSchemaCache)
runMetadataQuery AppContext
appContext RebuildableSchemaCache
schemaCache WebsocketCloseOnMetadataChangeAction
closeWebsocketsOnMetadataChange RQLMetadata {Maybe MetadataResourceVersion
RQLMetadataRequest
_rqlMetadataResourceVersion :: RQLMetadata -> Maybe MetadataResourceVersion
_rqlMetadata :: RQLMetadata -> RQLMetadataRequest
_rqlMetadataResourceVersion :: Maybe MetadataResourceVersion
_rqlMetadata :: RQLMetadataRequest
..} = do
  AppEnv {Int
Maybe Text
Maybe PGPool
Maybe (CredentialCache AgentLicenseKey)
SamplingPolicy
HostPreference
Manager
TxIsolation
ConnParams
PGPool
Refined NonNegative Seconds
TMVar MetadataResourceVersion
ConnectionOptions
CheckFeatureFlag
ServerMetrics
EventingMode
ReadOnlyMode
MaintenanceMode ()
InstanceId
PrometheusMetrics
ShutdownLatch
LoggingSettings
LockedEventsCtx
WSConnectionInitTimeout
KeepAliveDelay
OptionalInterval
Port
SubscriptionsState
Loggers
appEnvPort :: Port
appEnvHost :: HostPreference
appEnvMetadataDbPool :: PGPool
appEnvIntrospectionDbPool :: Maybe PGPool
appEnvManager :: Manager
appEnvLoggers :: Loggers
appEnvMetadataVersionRef :: TMVar MetadataResourceVersion
appEnvInstanceId :: InstanceId
appEnvEnableMaintenanceMode :: MaintenanceMode ()
appEnvLoggingSettings :: LoggingSettings
appEnvEventingMode :: EventingMode
appEnvEnableReadOnlyMode :: ReadOnlyMode
appEnvServerMetrics :: ServerMetrics
appEnvShutdownLatch :: ShutdownLatch
appEnvMetaVersionRef :: TMVar MetadataResourceVersion
appEnvPrometheusMetrics :: PrometheusMetrics
appEnvTraceSamplingPolicy :: SamplingPolicy
appEnvSubscriptionState :: SubscriptionsState
appEnvLockedEventsCtx :: LockedEventsCtx
appEnvConnParams :: ConnParams
appEnvTxIso :: TxIsolation
appEnvConsoleAssetsDir :: Maybe Text
appEnvConsoleSentryDsn :: Maybe Text
appEnvConnectionOptions :: ConnectionOptions
appEnvWebSocketKeepAlive :: KeepAliveDelay
appEnvWebSocketConnectionInitTimeout :: WSConnectionInitTimeout
appEnvGracefulShutdownTimeout :: Refined NonNegative Seconds
appEnvSchemaPollInterval :: OptionalInterval
appEnvCheckFeatureFlag :: CheckFeatureFlag
appEnvLicenseKeyCache :: Maybe (CredentialCache AgentLicenseKey)
appEnvMaxTotalHeaderLength :: Int
appEnvPort :: AppEnv -> Port
appEnvHost :: AppEnv -> HostPreference
appEnvMetadataDbPool :: AppEnv -> PGPool
appEnvIntrospectionDbPool :: AppEnv -> Maybe PGPool
appEnvManager :: AppEnv -> Manager
appEnvLoggers :: AppEnv -> Loggers
appEnvMetadataVersionRef :: AppEnv -> TMVar MetadataResourceVersion
appEnvInstanceId :: AppEnv -> InstanceId
appEnvEnableMaintenanceMode :: AppEnv -> MaintenanceMode ()
appEnvLoggingSettings :: AppEnv -> LoggingSettings
appEnvEventingMode :: AppEnv -> EventingMode
appEnvEnableReadOnlyMode :: AppEnv -> ReadOnlyMode
appEnvServerMetrics :: AppEnv -> ServerMetrics
appEnvShutdownLatch :: AppEnv -> ShutdownLatch
appEnvMetaVersionRef :: AppEnv -> TMVar MetadataResourceVersion
appEnvPrometheusMetrics :: AppEnv -> PrometheusMetrics
appEnvTraceSamplingPolicy :: AppEnv -> SamplingPolicy
appEnvSubscriptionState :: AppEnv -> SubscriptionsState
appEnvLockedEventsCtx :: AppEnv -> LockedEventsCtx
appEnvConnParams :: AppEnv -> ConnParams
appEnvTxIso :: AppEnv -> TxIsolation
appEnvConsoleAssetsDir :: AppEnv -> Maybe Text
appEnvConsoleSentryDsn :: AppEnv -> Maybe Text
appEnvConnectionOptions :: AppEnv -> ConnectionOptions
appEnvWebSocketKeepAlive :: AppEnv -> KeepAliveDelay
appEnvWebSocketConnectionInitTimeout :: AppEnv -> WSConnectionInitTimeout
appEnvGracefulShutdownTimeout :: AppEnv -> Refined NonNegative Seconds
appEnvSchemaPollInterval :: AppEnv -> OptionalInterval
appEnvCheckFeatureFlag :: AppEnv -> CheckFeatureFlag
appEnvLicenseKeyCache :: AppEnv -> Maybe (CredentialCache AgentLicenseKey)
appEnvMaxTotalHeaderLength :: AppEnv -> Int
..} <- m AppEnv
forall (m :: * -> *). HasAppEnv m => m AppEnv
askAppEnv
  let logger :: Logger Hasura
logger = Loggers -> Logger Hasura
_lsLogger Loggers
appEnvLoggers
  MetadataWithResourceVersion Metadata
metadata MetadataResourceVersion
currentResourceVersion <- Text
-> m MetadataWithResourceVersion -> m MetadataWithResourceVersion
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"fetchMetadata" (m MetadataWithResourceVersion -> m MetadataWithResourceVersion)
-> m MetadataWithResourceVersion -> m MetadataWithResourceVersion
forall a b. (a -> b) -> a -> b
$ m (Either QErr MetadataWithResourceVersion)
-> m MetadataWithResourceVersion
forall e (m :: * -> *) a. MonadError e m => m (Either e a) -> m a
liftEitherM m (Either QErr MetadataWithResourceVersion)
forall (m :: * -> *).
MonadMetadataStorage m =>
m (Either QErr MetadataWithResourceVersion)
fetchMetadata
  let exportsMetadata :: RQLMetadataRequest -> Bool
exportsMetadata = \case
        RMV1 (RMExportMetadata ExportMetadata
_) -> Bool
True
        RMV2 (RMV2ExportMetadata ExportMetadata
_) -> Bool
True
        RQLMetadataRequest
_ -> Bool
False
      metadataDefaults :: MetadataDefaults
metadataDefaults =
        -- Note: The following check is performed to determine if the metadata defaults can
        --       be safely merged into the reader at this point.
        --
        -- We want to prevent scenarios:
        -- \* Exporting defaults - Contradicting the "roundtrip" principle of metadata operations
        -- \* Serializing defaults into the metadata storage - Putting data into the users hdb_catalog
        --
        -- While this check does have the desired effect it relies on the fact that the only
        -- operations that need access to the defaults here do not export or modify metadata.
        -- If at some point in future an operation needs access to the defaults and also needs to
        -- export/modify metadata, then another approach will need to be taken.
        --
        -- Luckily, most actual need for defaults access exists within the schema cache build phase,
        -- so metadata operations don't need "smarts" that require defaults access.
        --
        if (RQLMetadataRequest -> Bool
exportsMetadata RQLMetadataRequest
_rqlMetadata Bool -> Bool -> Bool
|| RQLMetadataRequest -> Bool
queryModifiesMetadata RQLMetadataRequest
_rqlMetadata)
          then MetadataDefaults
emptyMetadataDefaults
          else AppContext -> MetadataDefaults
acMetadataDefaults AppContext
appContext
  let dynamicConfig :: CacheDynamicConfig
dynamicConfig = AppContext -> CacheDynamicConfig
buildCacheDynamicConfig AppContext
appContext
  ((EncJSON
r, Metadata
modMetadata), RebuildableSchemaCache
modSchemaCache, CacheInvalidations
cacheInvalidations, SourcesIntrospectionStatus
sourcesIntrospection, SchemaRegistryAction
schemaRegistryAction) <-
    Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
runMetadataQueryM
      (AppContext -> Environment
acEnvironment AppContext
appContext)
      CheckFeatureFlag
appEnvCheckFeatureFlag
      (AppContext -> RemoteSchemaPermissions
acRemoteSchemaPermsCtx AppContext
appContext)
      MetadataResourceVersion
currentResourceVersion
      RQLMetadataRequest
_rqlMetadata
      -- TODO: remove this straight runReaderT that provides no actual new info
      ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
-> (ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
    -> MetadataT (CacheRWT m) EncJSON)
-> MetadataT (CacheRWT m) EncJSON
forall a b. a -> (a -> b) -> b
& (ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
 -> Logger Hasura -> MetadataT (CacheRWT m) EncJSON)
-> Logger Hasura
-> ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
-> MetadataT (CacheRWT m) EncJSON
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT (Logger Hasura) (MetadataT (CacheRWT m)) EncJSON
-> Logger Hasura -> MetadataT (CacheRWT m) EncJSON
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Logger Hasura
logger
      MetadataT (CacheRWT m) EncJSON
-> (MetadataT (CacheRWT m) EncJSON
    -> CacheRWT m (EncJSON, Metadata))
-> CacheRWT m (EncJSON, Metadata)
forall a b. a -> (a -> b) -> b
& Metadata
-> MetadataDefaults
-> MetadataT (CacheRWT m) EncJSON
-> CacheRWT m (EncJSON, Metadata)
forall (m :: * -> *) a.
Metadata -> MetadataDefaults -> MetadataT m a -> m (a, Metadata)
runMetadataT Metadata
metadata MetadataDefaults
metadataDefaults
      CacheRWT m (EncJSON, Metadata)
-> (CacheRWT m (EncJSON, Metadata)
    -> m ((EncJSON, Metadata), RebuildableSchemaCache,
          CacheInvalidations, SourcesIntrospectionStatus,
          SchemaRegistryAction))
-> m ((EncJSON, Metadata), RebuildableSchemaCache,
      CacheInvalidations, SourcesIntrospectionStatus,
      SchemaRegistryAction)
forall a b. a -> (a -> b) -> b
& CacheDynamicConfig
-> RebuildableSchemaCache
-> CacheRWT m (EncJSON, Metadata)
-> m ((EncJSON, Metadata), RebuildableSchemaCache,
      CacheInvalidations, SourcesIntrospectionStatus,
      SchemaRegistryAction)
forall (m :: * -> *) a.
Monad m =>
CacheDynamicConfig
-> RebuildableSchemaCache
-> CacheRWT m a
-> m (a, RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
runCacheRWT CacheDynamicConfig
dynamicConfig RebuildableSchemaCache
schemaCache
  -- set modified metadata in storage
  if RQLMetadataRequest -> Bool
queryModifiesMetadata RQLMetadataRequest
_rqlMetadata
    then case (MaintenanceMode ()
appEnvEnableMaintenanceMode, ReadOnlyMode
appEnvEnableReadOnlyMode) of
      (MaintenanceMode ()
MaintenanceModeDisabled, ReadOnlyMode
ReadOnlyModeDisabled) -> do
        -- set modified metadata in storage
        Logger Hasura
-> forall a (m :: * -> *).
   (ToEngineLog a Hasura, MonadIO m) =>
   a -> m ()
forall impl.
Logger impl
-> forall a (m :: * -> *).
   (ToEngineLog a impl, MonadIO m) =>
   a -> m ()
L.unLogger Logger Hasura
logger
          (SchemaSyncLog -> m ()) -> SchemaSyncLog -> m ()
forall a b. (a -> b) -> a -> b
$ LogLevel -> SchemaSyncThreadType -> Value -> SchemaSyncLog
SchemaSyncLog LogLevel
L.LevelInfo SchemaSyncThreadType
TTMetadataApi
          (Value -> SchemaSyncLog) -> Value -> SchemaSyncLog
forall a b. (a -> b) -> a -> b
$ Text -> Value
String
          (Text -> Value) -> Text -> Value
forall a b. (a -> b) -> a -> b
$ Text
"Attempting to insert new metadata in storage"
        MetadataResourceVersion
newResourceVersion <-
          Text -> m MetadataResourceVersion -> m MetadataResourceVersion
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"setMetadata"
            (m MetadataResourceVersion -> m MetadataResourceVersion)
-> m MetadataResourceVersion -> m MetadataResourceVersion
forall a b. (a -> b) -> a -> b
$ m (Either QErr MetadataResourceVersion)
-> m MetadataResourceVersion
forall e (m :: * -> *) a. MonadError e m => m (Either e a) -> m a
liftEitherM
            (m (Either QErr MetadataResourceVersion)
 -> m MetadataResourceVersion)
-> m (Either QErr MetadataResourceVersion)
-> m MetadataResourceVersion
forall a b. (a -> b) -> a -> b
$ MetadataResourceVersion
-> Metadata -> m (Either QErr MetadataResourceVersion)
forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> Metadata -> m (Either QErr MetadataResourceVersion)
setMetadata (MetadataResourceVersion
-> Maybe MetadataResourceVersion -> MetadataResourceVersion
forall a. a -> Maybe a -> a
fromMaybe MetadataResourceVersion
currentResourceVersion Maybe MetadataResourceVersion
_rqlMetadataResourceVersion) Metadata
modMetadata
        Logger Hasura
-> forall a (m :: * -> *).
   (ToEngineLog a Hasura, MonadIO m) =>
   a -> m ()
forall impl.
Logger impl
-> forall a (m :: * -> *).
   (ToEngineLog a impl, MonadIO m) =>
   a -> m ()
L.unLogger Logger Hasura
logger
          (SchemaSyncLog -> m ()) -> SchemaSyncLog -> m ()
forall a b. (a -> b) -> a -> b
$ LogLevel -> SchemaSyncThreadType -> Value -> SchemaSyncLog
SchemaSyncLog LogLevel
L.LevelInfo SchemaSyncThreadType
TTMetadataApi
          (Value -> SchemaSyncLog) -> Value -> SchemaSyncLog
forall a b. (a -> b) -> a -> b
$ Text -> Value
String
          (Text -> Value) -> Text -> Value
forall a b. (a -> b) -> a -> b
$ Text
"Successfully inserted new metadata in storage with resource version: "
          Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> MetadataResourceVersion -> Text
showMetadataResourceVersion MetadataResourceVersion
newResourceVersion

        -- save sources introspection to stored-introspection DB
        Text -> m () -> m ()
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"storeSourcesIntrospection"
          (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ Logger Hasura
-> SourcesIntrospectionStatus -> MetadataResourceVersion -> m ()
forall (m :: * -> *).
(MonadIO m, MonadMetadataStorage m) =>
Logger Hasura
-> SourcesIntrospectionStatus -> MetadataResourceVersion -> m ()
saveSourcesIntrospection Logger Hasura
logger SourcesIntrospectionStatus
sourcesIntrospection MetadataResourceVersion
newResourceVersion

        -- run the schema registry action
        Text -> m () -> m ()
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"runSchemaRegistryAction"
          (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SchemaRegistryAction
-> ((MetadataResourceVersion
     -> [InconsistentMetadata] -> Metadata -> IO ())
    -> m ())
-> m ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
t a -> (a -> f b) -> f ()
for_ SchemaRegistryAction
schemaRegistryAction
          (((MetadataResourceVersion
   -> [InconsistentMetadata] -> Metadata -> IO ())
  -> m ())
 -> m ())
-> ((MetadataResourceVersion
     -> [InconsistentMetadata] -> Metadata -> IO ())
    -> m ())
-> m ()
forall a b. (a -> b) -> a -> b
$ \MetadataResourceVersion
-> [InconsistentMetadata] -> Metadata -> IO ()
action -> do
            IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ MetadataResourceVersion
-> [InconsistentMetadata] -> Metadata -> IO ()
action MetadataResourceVersion
newResourceVersion (SchemaCache -> [InconsistentMetadata]
scInconsistentObjs (RebuildableSchemaCache -> SchemaCache
lastBuiltSchemaCache RebuildableSchemaCache
modSchemaCache)) Metadata
modMetadata

        -- notify schema cache sync
        Text -> m () -> m ()
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"notifySchemaCacheSync"
          (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ m (Either QErr ()) -> m ()
forall e (m :: * -> *) a. MonadError e m => m (Either e a) -> m a
liftEitherM
          (m (Either QErr ()) -> m ()) -> m (Either QErr ()) -> m ()
forall a b. (a -> b) -> a -> b
$ MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> m (Either QErr ())
forall (m :: * -> *).
MonadMetadataStorage m =>
MetadataResourceVersion
-> InstanceId -> CacheInvalidations -> m (Either QErr ())
notifySchemaCacheSync MetadataResourceVersion
newResourceVersion InstanceId
appEnvInstanceId CacheInvalidations
cacheInvalidations
        Logger Hasura
-> forall a (m :: * -> *).
   (ToEngineLog a Hasura, MonadIO m) =>
   a -> m ()
forall impl.
Logger impl
-> forall a (m :: * -> *).
   (ToEngineLog a impl, MonadIO m) =>
   a -> m ()
L.unLogger Logger Hasura
logger
          (SchemaSyncLog -> m ()) -> SchemaSyncLog -> m ()
forall a b. (a -> b) -> a -> b
$ LogLevel -> SchemaSyncThreadType -> Value -> SchemaSyncLog
SchemaSyncLog LogLevel
L.LevelInfo SchemaSyncThreadType
TTMetadataApi
          (Value -> SchemaSyncLog) -> Value -> SchemaSyncLog
forall a b. (a -> b) -> a -> b
$ Text -> Value
String
          (Text -> Value) -> Text -> Value
forall a b. (a -> b) -> a -> b
$ Text
"Inserted schema cache sync notification at resource version:"
          Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> MetadataResourceVersion -> Text
showMetadataResourceVersion MetadataResourceVersion
newResourceVersion

        (()
_, RebuildableSchemaCache
modSchemaCache', CacheInvalidations
_, SourcesIntrospectionStatus
_, SchemaRegistryAction
_) <-
          Text
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"setMetadataResourceVersionInSchemaCache"
            (m ((), RebuildableSchemaCache, CacheInvalidations,
    SourcesIntrospectionStatus, SchemaRegistryAction)
 -> m ((), RebuildableSchemaCache, CacheInvalidations,
       SourcesIntrospectionStatus, SchemaRegistryAction))
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
forall a b. (a -> b) -> a -> b
$ MetadataResourceVersion -> CacheRWT m ()
forall (m :: * -> *). CacheRWM m => MetadataResourceVersion -> m ()
setMetadataResourceVersionInSchemaCache MetadataResourceVersion
newResourceVersion
            CacheRWT m ()
-> (CacheRWT m ()
    -> m ((), RebuildableSchemaCache, CacheInvalidations,
          SourcesIntrospectionStatus, SchemaRegistryAction))
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
forall a b. a -> (a -> b) -> b
& CacheDynamicConfig
-> RebuildableSchemaCache
-> CacheRWT m ()
-> m ((), RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
forall (m :: * -> *) a.
Monad m =>
CacheDynamicConfig
-> RebuildableSchemaCache
-> CacheRWT m a
-> m (a, RebuildableSchemaCache, CacheInvalidations,
      SourcesIntrospectionStatus, SchemaRegistryAction)
runCacheRWT CacheDynamicConfig
dynamicConfig RebuildableSchemaCache
modSchemaCache

        -- Close all subscriptions with 1012 code (subscribers should reconnect)
        -- and close poller threads
        Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when ((CacheDynamicConfig -> CloseWebsocketsOnMetadataChangeStatus
_cdcCloseWebsocketsOnMetadataChangeStatus CacheDynamicConfig
dynamicConfig) CloseWebsocketsOnMetadataChangeStatus
-> CloseWebsocketsOnMetadataChangeStatus -> Bool
forall a. Eq a => a -> a -> Bool
== CloseWebsocketsOnMetadataChangeStatus
CWMCEnabled)
          (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ Text -> m () -> m ()
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan Text
"closeWebsocketsOnMetadataChange"
          (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
          (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ WebsocketCloseOnMetadataChangeAction -> IO ()
WS.runWebsocketCloseOnMetadataChangeAction WebsocketCloseOnMetadataChangeAction
closeWebsocketsOnMetadataChange

        (EncJSON, RebuildableSchemaCache)
-> m (EncJSON, RebuildableSchemaCache)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EncJSON
r, RebuildableSchemaCache
modSchemaCache')
      (MaintenanceModeEnabled (), ReadOnlyMode
ReadOnlyModeDisabled) ->
        Text -> m (EncJSON, RebuildableSchemaCache)
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500 Text
"metadata cannot be modified in maintenance mode"
      (MaintenanceMode ()
MaintenanceModeDisabled, ReadOnlyMode
ReadOnlyModeEnabled) ->
        Code -> Text -> m (EncJSON, RebuildableSchemaCache)
forall (m :: * -> *) a. QErrM m => Code -> Text -> m a
throw400 Code
NotSupported Text
"metadata cannot be modified in read-only mode"
      (MaintenanceModeEnabled (), ReadOnlyMode
ReadOnlyModeEnabled) ->
        Text -> m (EncJSON, RebuildableSchemaCache)
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500 Text
"metadata cannot be modified in maintenance mode"
    else (EncJSON, RebuildableSchemaCache)
-> m (EncJSON, RebuildableSchemaCache)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EncJSON
r, RebuildableSchemaCache
modSchemaCache)

queryModifiesMetadata :: RQLMetadataRequest -> Bool
queryModifiesMetadata :: RQLMetadataRequest -> Bool
queryModifiesMetadata = \case
  RMV1 RQLMetadataV1
q ->
    case RQLMetadataV1
q of
      RMRedeliverEvent AnyBackend RedeliverEventQuery
_ -> Bool
False
      RMInvokeEventTrigger AnyBackend InvokeEventTriggerQuery
_ -> Bool
False
      RMGetEventLogs AnyBackend GetEventLogs
_ -> Bool
False
      RMGetEventInvocationLogs AnyBackend GetEventInvocations
_ -> Bool
False
      RMGetEventById AnyBackend GetEventById
_ -> Bool
False
      RMGetInconsistentMetadata GetInconsistentMetadata
_ -> Bool
False
      RMIntrospectRemoteSchema RemoteSchemaNameQuery
_ -> Bool
False
      RMDumpInternalState DumpInternalState
_ -> Bool
False
      RMSetCatalogState SetCatalogState
_ -> Bool
False
      RMGetCatalogState GetCatalogState
_ -> Bool
False
      RMExportMetadata ExportMetadata
_ -> Bool
False
      RMGetScheduledEventInvocations GetScheduledEventInvocations
_ -> Bool
False
      RQLMetadataV1
RMGetCronTriggers -> Bool
False
      RMGetScheduledEvents GetScheduledEvents
_ -> Bool
False
      RMCreateScheduledEvent CreateScheduledEvent
_ -> Bool
False
      RMDeleteScheduledEvent DeleteScheduledEvent
_ -> Bool
False
      RMTestWebhookTransform Unvalidated TestWebhookTransform
_ -> Bool
False
      RMGetSourceKindCapabilities GetSourceKindCapabilities
_ -> Bool
False
      RMListSourceKinds ListSourceKinds
_ -> Bool
False
      RMGetSourceTables AnyBackend GetSourceTables
_ -> Bool
False
      RMGetSourceTrackables AnyBackend GetSourceTrackables
_ -> Bool
False
      RMGetTableInfo AnyBackend GetTableInfo
_ -> Bool
False
      RMGetTableInfo_ GetTableInfo_
_ -> Bool
False
      RMTestConnectionTemplate AnyBackend TestConnectionTemplate
_ -> Bool
False
      RMSuggestRelationships AnyBackend SuggestRels
_ -> Bool
False
      RMGetNativeQuery AnyBackend GetNativeQuery
_ -> Bool
False
      RMTrackNativeQuery AnyBackend TrackNativeQuery
_ -> Bool
True
      RMUntrackNativeQuery AnyBackend UntrackNativeQuery
_ -> Bool
True
      RMGetStoredProcedure AnyBackend GetStoredProcedure
_ -> Bool
False
      RMTrackStoredProcedure AnyBackend TrackStoredProcedure
_ -> Bool
True
      RMUntrackStoredProcedure AnyBackend UntrackStoredProcedure
_ -> Bool
True
      RMGetLogicalModel AnyBackend GetLogicalModel
_ -> Bool
False
      RMTrackLogicalModel AnyBackend TrackLogicalModel
_ -> Bool
True
      RMUntrackLogicalModel AnyBackend UntrackLogicalModel
_ -> Bool
True
      RMCreateSelectLogicalModelPermission AnyBackend (CreateLogicalModelPermission SelPerm)
_ -> Bool
True
      RMDropSelectLogicalModelPermission AnyBackend DropLogicalModelPermission
_ -> Bool
True
      RMBulk [RQLMetadataRequest]
qs -> (RQLMetadataRequest -> Bool) -> [RQLMetadataRequest] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any RQLMetadataRequest -> Bool
queryModifiesMetadata [RQLMetadataRequest]
qs
      RMBulkKeepGoing [RQLMetadataRequest]
qs -> (RQLMetadataRequest -> Bool) -> [RQLMetadataRequest] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any RQLMetadataRequest -> Bool
queryModifiesMetadata [RQLMetadataRequest]
qs
      RMBulkAtomic [RQLMetadataRequest]
qs -> (RQLMetadataRequest -> Bool) -> [RQLMetadataRequest] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any RQLMetadataRequest -> Bool
queryModifiesMetadata [RQLMetadataRequest]
qs
      -- We used to assume that the fallthrough was True,
      -- but it is better to be explicit here to warn when new constructors are added.
      RMAddSource AnyBackend AddSource
_ -> Bool
True
      RMDropSource DropSource
_ -> Bool
True
      RMRenameSource RenameSource
_ -> Bool
True
      RMUpdateSource AnyBackend UpdateSource
_ -> Bool
True
      RMTrackTable AnyBackend TrackTableV2
_ -> Bool
True
      RMTrackTables AnyBackend TrackTables
_ -> Bool
True
      RMUntrackTable AnyBackend UntrackTable
_ -> Bool
True
      RMUntrackTables AnyBackend UntrackTables
_ -> Bool
True
      RMSetTableCustomization AnyBackend SetTableCustomization
_ -> Bool
True
      RMSetApolloFederationConfig AnyBackend SetApolloFederationConfig
_ -> Bool
True
      RMPgSetTableIsEnum AnyBackend SetTableIsEnum
_ -> Bool
True
      RMCreateInsertPermission AnyBackend (CreatePerm InsPerm)
_ -> Bool
True
      RMCreateSelectPermission AnyBackend (CreatePerm SelPerm)
_ -> Bool
True
      RMCreateUpdatePermission AnyBackend (CreatePerm UpdPerm)
_ -> Bool
True
      RMCreateDeletePermission AnyBackend (CreatePerm DelPerm)
_ -> Bool
True
      RMDropInsertPermission AnyBackend DropPerm
_ -> Bool
True
      RMDropSelectPermission AnyBackend DropPerm
_ -> Bool
True
      RMDropUpdatePermission AnyBackend DropPerm
_ -> Bool
True
      RMDropDeletePermission AnyBackend DropPerm
_ -> Bool
True
      RMSetPermissionComment AnyBackend SetPermComment
_ -> Bool
True
      RMCreateObjectRelationship AnyBackend CreateObjRel
_ -> Bool
True
      RMCreateArrayRelationship AnyBackend CreateArrRel
_ -> Bool
True
      RMDropRelationship AnyBackend DropRel
_ -> Bool
True
      RMSetRelationshipComment AnyBackend SetRelComment
_ -> Bool
True
      RMRenameRelationship AnyBackend RenameRel
_ -> Bool
True
      RMCreateRemoteRelationship AnyBackend CreateFromSourceRelationship
_ -> Bool
True
      RMUpdateRemoteRelationship AnyBackend CreateFromSourceRelationship
_ -> Bool
True
      RMDeleteRemoteRelationship AnyBackend DeleteFromSourceRelationship
_ -> Bool
True
      RMTrackFunction AnyBackend TrackFunctionV2
_ -> Bool
True
      RMUntrackFunction AnyBackend UnTrackFunction
_ -> Bool
True
      RMSetFunctionCustomization AnyBackend SetFunctionCustomization
_ -> Bool
True
      RMCreateFunctionPermission AnyBackend FunctionPermissionArgument
_ -> Bool
True
      RMDropFunctionPermission AnyBackend FunctionPermissionArgument
_ -> Bool
True
      RMAddComputedField AnyBackend AddComputedField
_ -> Bool
True
      RMDropComputedField AnyBackend DropComputedField
_ -> Bool
True
      RMCreateEventTrigger AnyBackend (Unvalidated1 CreateEventTriggerQuery)
_ -> Bool
True
      RMDeleteEventTrigger AnyBackend DeleteEventTriggerQuery
_ -> Bool
True
      RMCleanupEventTriggerLog TriggerLogCleanupConfig
_ -> Bool
True
      RMResumeEventTriggerCleanup TriggerLogCleanupToggleConfig
_ -> Bool
True
      RMPauseEventTriggerCleanup TriggerLogCleanupToggleConfig
_ -> Bool
True
      RMAddRemoteSchema AddRemoteSchemaQuery
_ -> Bool
True
      RMUpdateRemoteSchema AddRemoteSchemaQuery
_ -> Bool
True
      RMRemoveRemoteSchema RemoteSchemaNameQuery
_ -> Bool
True
      RMReloadRemoteSchema RemoteSchemaNameQuery
_ -> Bool
True
      RMAddRemoteSchemaPermissions AddRemoteSchemaPermission
_ -> Bool
True
      RMDropRemoteSchemaPermissions DropRemoteSchemaPermissions
_ -> Bool
True
      RMCreateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
_ -> Bool
True
      RMUpdateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
_ -> Bool
True
      RMDeleteRemoteSchemaRemoteRelationship DeleteRemoteSchemaRemoteRelationship
_ -> Bool
True
      RMCreateCronTrigger Unvalidated CreateCronTrigger
_ -> Bool
True
      RMDeleteCronTrigger ScheduledTriggerName
_ -> Bool
True
      RMCreateAction Unvalidated CreateAction
_ -> Bool
True
      RMDropAction DropAction
_ -> Bool
True
      RMUpdateAction Unvalidated UpdateAction
_ -> Bool
True
      RMCreateActionPermission CreateActionPermission
_ -> Bool
True
      RMDropActionPermission DropActionPermission
_ -> Bool
True
      RMCreateQueryCollection CreateCollection
_ -> Bool
True
      RMRenameQueryCollection RenameCollection
_ -> Bool
True
      RMDropQueryCollection DropCollection
_ -> Bool
True
      RMAddQueryToCollection AddQueryToCollection
_ -> Bool
True
      RMDropQueryFromCollection DropQueryFromCollection
_ -> Bool
True
      RMAddCollectionToAllowlist AllowlistEntry
_ -> Bool
True
      RMDropCollectionFromAllowlist DropCollectionFromAllowlist
_ -> Bool
True
      RMUpdateScopeOfCollectionInAllowlist UpdateScopeOfCollectionInAllowlist
_ -> Bool
True
      RMCreateRestEndpoint CreateEndpoint
_ -> Bool
True
      RMDropRestEndpoint DropEndpoint
_ -> Bool
True
      RMDCAddAgent DCAddAgent
_ -> Bool
True
      RMDCDeleteAgent DCDeleteAgent
_ -> Bool
True
      RMSetCustomTypes CustomTypes
_ -> Bool
True
      RMSetApiLimits ApiLimit
_ -> Bool
True
      RQLMetadataV1
RMRemoveApiLimits -> Bool
True
      RMSetMetricsConfig MetricsConfig
_ -> Bool
True
      RQLMetadataV1
RMRemoveMetricsConfig -> Bool
True
      RMAddInheritedRole InheritedRole
_ -> Bool
True
      RMDropInheritedRole DropInheritedRole
_ -> Bool
True
      RMReplaceMetadata ReplaceMetadata
_ -> Bool
True
      RMClearMetadata ClearMetadata
_ -> Bool
True
      RMReloadMetadata ReloadMetadata
_ -> Bool
True
      RMDropInconsistentMetadata DropInconsistentMetadata
_ -> Bool
True
      RMSetGraphqlSchemaIntrospectionOptions SetGraphqlIntrospectionOptions
_ -> Bool
True
      RMAddHostToTLSAllowlist AddHostToTLSAllowlist
_ -> Bool
True
      RMDropHostFromTLSAllowlist DropHostFromTLSAllowlist
_ -> Bool
True
      RMSetQueryTagsConfig SetQueryTagsConfig
_ -> Bool
True
      RMSetOpenTelemetryConfig OpenTelemetryConfig
_ -> Bool
True
      RMSetOpenTelemetryStatus OtelStatus
_ -> Bool
True
  RMV2 RQLMetadataV2
q ->
    case RQLMetadataV2
q of
      RMV2ExportMetadata ExportMetadata
_ -> Bool
False
      RQLMetadataV2
_ -> Bool
True

runMetadataQueryM ::
  ( MonadIO m,
    MonadBaseControl IO m,
    CacheRWM m,
    Tracing.MonadTrace m,
    UserInfoM m,
    MetadataM m,
    MonadMetadataStorage m,
    MonadReader r m,
    Has (L.Logger L.Hasura) r,
    MonadError QErr m,
    MonadEventLogCleanup m,
    ProvidesHasuraServices m,
    MonadGetPolicies m,
    HasFeatureFlagChecker m
  ) =>
  Env.Environment ->
  CheckFeatureFlag ->
  Options.RemoteSchemaPermissions ->
  MetadataResourceVersion ->
  RQLMetadataRequest ->
  m EncJSON
runMetadataQueryM :: forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
runMetadataQueryM Environment
env CheckFeatureFlag
checkFeatureFlag RemoteSchemaPermissions
remoteSchemaPerms MetadataResourceVersion
currentResourceVersion =
  Text -> m EncJSON -> m EncJSON
forall (m :: * -> *) a. QErrM m => Text -> m a -> m a
withPathK Text
"args" (m EncJSON -> m EncJSON)
-> (RQLMetadataRequest -> m EncJSON)
-> RQLMetadataRequest
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
    -- NOTE: This is a good place to install tracing, since it's involved in
    -- the recursive case via "bulk":
    RMV1 RQLMetadataV1
q ->
      Text -> m EncJSON -> m EncJSON
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan (Text
"v1 " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
T.pack (RQLMetadataV1 -> String
forall a. (HasConstructor (Rep a), Generic a) => a -> String
constrName RQLMetadataV1
q))
        (m EncJSON -> m EncJSON) -> m EncJSON -> m EncJSON
forall a b. (a -> b) -> a -> b
$ Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataV1
-> m EncJSON
forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataV1
-> m EncJSON
runMetadataQueryV1M Environment
env CheckFeatureFlag
checkFeatureFlag RemoteSchemaPermissions
remoteSchemaPerms MetadataResourceVersion
currentResourceVersion RQLMetadataV1
q
    RMV2 RQLMetadataV2
q ->
      Text -> m EncJSON -> m EncJSON
forall (m :: * -> *) a.
(MonadIO m, MonadTrace m) =>
Text -> m a -> m a
Tracing.newSpan (Text
"v2 " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
T.pack (RQLMetadataV2 -> String
forall a. (HasConstructor (Rep a), Generic a) => a -> String
constrName RQLMetadataV2
q))
        (m EncJSON -> m EncJSON) -> m EncJSON -> m EncJSON
forall a b. (a -> b) -> a -> b
$ MetadataResourceVersion -> RQLMetadataV2 -> m EncJSON
forall (m :: * -> *) r.
(MonadIO m, CacheRWM m, MonadBaseControl IO m, MetadataM m,
 MonadMetadataStorage m, MonadReader r m, Has (Logger Hasura) r,
 MonadError QErr m, MonadEventLogCleanup m, MonadGetPolicies m) =>
MetadataResourceVersion -> RQLMetadataV2 -> m EncJSON
runMetadataQueryV2M MetadataResourceVersion
currentResourceVersion RQLMetadataV2
q

runMetadataQueryV1M ::
  forall m r.
  ( MonadIO m,
    MonadBaseControl IO m,
    CacheRWM m,
    Tracing.MonadTrace m,
    UserInfoM m,
    MetadataM m,
    MonadMetadataStorage m,
    MonadReader r m,
    Has (L.Logger L.Hasura) r,
    MonadError QErr m,
    MonadEventLogCleanup m,
    ProvidesHasuraServices m,
    MonadGetPolicies m,
    HasFeatureFlagChecker m
  ) =>
  Env.Environment ->
  CheckFeatureFlag ->
  Options.RemoteSchemaPermissions ->
  MetadataResourceVersion ->
  RQLMetadataV1 ->
  m EncJSON
runMetadataQueryV1M :: forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataV1
-> m EncJSON
runMetadataQueryV1M Environment
env CheckFeatureFlag
checkFeatureFlag RemoteSchemaPermissions
remoteSchemaPerms MetadataResourceVersion
currentResourceVersion = \case
  RMAddSource AnyBackend AddSource
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 AddSource b -> m EncJSON)
-> AnyBackend AddSource -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (Environment -> AddSource b -> m EncJSON
forall (m :: * -> *) (b :: BackendType).
(MonadIO m, MonadError QErr m, CacheRWM m, MetadataM m,
 BackendMetadata b) =>
Environment -> AddSource b -> m EncJSON
runAddSource Environment
env) AnyBackend AddSource
q
  RMDropSource DropSource
q -> DropSource -> m EncJSON
forall (m :: * -> *) r.
(MonadError QErr m, CacheRWM m, MonadIO m, MonadBaseControl IO m,
 MetadataM m, MonadReader r m, Has (Logger Hasura) r) =>
DropSource -> m EncJSON
runDropSource DropSource
q
  RMRenameSource RenameSource
q -> RenameSource -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
RenameSource -> m EncJSON
runRenameSource RenameSource
q
  RMUpdateSource AnyBackend UpdateSource
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 UpdateSource b -> m EncJSON)
-> AnyBackend UpdateSource -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata UpdateSource b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
UpdateSource b -> m EncJSON
forall (m :: * -> *) (b :: BackendType).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
UpdateSource b -> m EncJSON
runUpdateSource AnyBackend UpdateSource
q
  RMListSourceKinds ListSourceKinds
q -> ListSourceKinds -> m EncJSON
forall (m :: * -> *).
(MetadataM m, MonadError QErr m, CacheRM m) =>
ListSourceKinds -> m EncJSON
runListSourceKinds ListSourceKinds
q
  RMGetSourceKindCapabilities GetSourceKindCapabilities
q -> GetSourceKindCapabilities -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRM m) =>
GetSourceKindCapabilities -> m EncJSON
runGetSourceKindCapabilities GetSourceKindCapabilities
q
  RMGetSourceTables AnyBackend GetSourceTables
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetSourceTables b -> m EncJSON)
-> AnyBackend GetSourceTables -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetSourceTables b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetSourceTables b -> m EncJSON
forall (b :: BackendType) (m :: * -> *) r.
(BackendMetadata b, CacheRM m, MonadError QErr m, MetadataM m,
 MonadIO m, MonadBaseControl IO m, MonadReader r m,
 Has (Logger Hasura) r, ProvidesNetwork m) =>
GetSourceTables b -> m EncJSON
runGetSourceTables AnyBackend GetSourceTables
q
  RMGetSourceTrackables AnyBackend GetSourceTrackables
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetSourceTrackables b -> m EncJSON)
-> AnyBackend GetSourceTrackables -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetSourceTrackables b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetSourceTrackables b -> m EncJSON
forall (b :: BackendType) (m :: * -> *) r.
(BackendMetadata b, CacheRM m, MonadError QErr m, MetadataM m,
 MonadIO m, MonadBaseControl IO m, MonadReader r m,
 Has (Logger Hasura) r, ProvidesNetwork m) =>
GetSourceTrackables b -> m EncJSON
runGetSourceTrackables AnyBackend GetSourceTrackables
q
  RMGetTableInfo AnyBackend GetTableInfo
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetTableInfo b -> m EncJSON)
-> AnyBackend GetTableInfo -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetTableInfo b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetTableInfo b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, CacheRM m, MonadError QErr m, MetadataM m,
 MonadBaseControl IO m, MonadIO m) =>
GetTableInfo b -> m EncJSON
runGetTableInfo AnyBackend GetTableInfo
q
  RMGetTableInfo_ GetTableInfo_
q -> GetTableInfo_ -> m EncJSON
forall (m :: * -> *).
(CacheRM m, MonadError QErr m, MetadataM m, MonadBaseControl IO m,
 MonadIO m) =>
GetTableInfo_ -> m EncJSON
runGetTableInfo_ GetTableInfo_
q
  RMTrackTable AnyBackend TrackTableV2
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackTableV2 b -> m EncJSON)
-> AnyBackend TrackTableV2 -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata TrackTableV2 b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
TrackTableV2 b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
TrackTableV2 b -> m EncJSON
runTrackTableV2Q AnyBackend TrackTableV2
q
  RMTrackTables AnyBackend TrackTables
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackTables b -> m EncJSON)
-> AnyBackend TrackTables -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata TrackTables b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
TrackTables b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
TrackTables b -> m EncJSON
runTrackTablesQ AnyBackend TrackTables
q
  RMUntrackTable AnyBackend UntrackTable
q -> (forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 UntrackTable b -> m EncJSON)
-> AnyBackend UntrackTable -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 i b -> a)
-> AnyBackend i -> a
dispatchMetadataAndEventTrigger UntrackTable b -> m EncJSON
forall (b :: BackendType).
(BackendMetadata b, BackendEventTrigger b) =>
UntrackTable b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(CacheRWM m, QErrM m, MetadataM m, BackendMetadata b,
 BackendEventTrigger b, MonadIO m) =>
UntrackTable b -> m EncJSON
runUntrackTableQ AnyBackend UntrackTable
q
  RMUntrackTables AnyBackend UntrackTables
q -> (forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 UntrackTables b -> m EncJSON)
-> AnyBackend UntrackTables -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 i b -> a)
-> AnyBackend i -> a
dispatchMetadataAndEventTrigger UntrackTables b -> m EncJSON
forall (b :: BackendType).
(BackendMetadata b, BackendEventTrigger b) =>
UntrackTables b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(CacheRWM m, QErrM m, MetadataM m, BackendMetadata b,
 BackendEventTrigger b, MonadIO m) =>
UntrackTables b -> m EncJSON
runUntrackTablesQ AnyBackend UntrackTables
q
  RMSetFunctionCustomization AnyBackend SetFunctionCustomization
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetFunctionCustomization b -> m EncJSON)
-> AnyBackend SetFunctionCustomization -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetFunctionCustomization b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetFunctionCustomization b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m, Backend b) =>
SetFunctionCustomization b -> m EncJSON
Functions.runSetFunctionCustomization AnyBackend SetFunctionCustomization
q
  RMSetTableCustomization AnyBackend SetTableCustomization
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetTableCustomization b -> m EncJSON)
-> AnyBackend SetTableCustomization -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetTableCustomization b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetTableCustomization b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m, Backend b) =>
SetTableCustomization b -> m EncJSON
runSetTableCustomization AnyBackend SetTableCustomization
q
  RMSetApolloFederationConfig AnyBackend SetApolloFederationConfig
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetApolloFederationConfig b -> m EncJSON)
-> AnyBackend SetApolloFederationConfig -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetApolloFederationConfig b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetApolloFederationConfig b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m, Backend b) =>
SetApolloFederationConfig b -> m EncJSON
runSetApolloFederationConfig AnyBackend SetApolloFederationConfig
q
  RMPgSetTableIsEnum AnyBackend SetTableIsEnum
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetTableIsEnum b -> m EncJSON)
-> AnyBackend SetTableIsEnum -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetTableIsEnum b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetTableIsEnum b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
SetTableIsEnum b -> m EncJSON
runSetExistingTableIsEnumQ AnyBackend SetTableIsEnum
q
  RMCreateInsertPermission AnyBackend (CreatePerm InsPerm)
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreatePerm InsPerm b -> m EncJSON)
-> AnyBackend (CreatePerm InsPerm) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreatePerm InsPerm b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreatePerm InsPerm b -> m EncJSON
forall (m :: * -> *) (b :: BackendType) (a :: BackendType -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
CreatePerm a b -> m EncJSON
runCreatePerm AnyBackend (CreatePerm InsPerm)
q
  RMCreateSelectPermission AnyBackend (CreatePerm SelPerm)
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreatePerm SelPerm b -> m EncJSON)
-> AnyBackend (CreatePerm SelPerm) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreatePerm SelPerm b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreatePerm SelPerm b -> m EncJSON
forall (m :: * -> *) (b :: BackendType) (a :: BackendType -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
CreatePerm a b -> m EncJSON
runCreatePerm AnyBackend (CreatePerm SelPerm)
q
  RMCreateUpdatePermission AnyBackend (CreatePerm UpdPerm)
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreatePerm UpdPerm b -> m EncJSON)
-> AnyBackend (CreatePerm UpdPerm) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreatePerm UpdPerm b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreatePerm UpdPerm b -> m EncJSON
forall (m :: * -> *) (b :: BackendType) (a :: BackendType -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
CreatePerm a b -> m EncJSON
runCreatePerm AnyBackend (CreatePerm UpdPerm)
q
  RMCreateDeletePermission AnyBackend (CreatePerm DelPerm)
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreatePerm DelPerm b -> m EncJSON)
-> AnyBackend (CreatePerm DelPerm) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreatePerm DelPerm b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreatePerm DelPerm b -> m EncJSON
forall (m :: * -> *) (b :: BackendType) (a :: BackendType -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
CreatePerm a b -> m EncJSON
runCreatePerm AnyBackend (CreatePerm DelPerm)
q
  RMDropInsertPermission AnyBackend DropPerm
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropPerm b -> m EncJSON)
-> AnyBackend DropPerm -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (PermType -> DropPerm b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
PermType -> DropPerm b -> m EncJSON
runDropPerm PermType
PTInsert) AnyBackend DropPerm
q
  RMDropSelectPermission AnyBackend DropPerm
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropPerm b -> m EncJSON)
-> AnyBackend DropPerm -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (PermType -> DropPerm b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
PermType -> DropPerm b -> m EncJSON
runDropPerm PermType
PTSelect) AnyBackend DropPerm
q
  RMDropUpdatePermission AnyBackend DropPerm
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropPerm b -> m EncJSON)
-> AnyBackend DropPerm -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (PermType -> DropPerm b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
PermType -> DropPerm b -> m EncJSON
runDropPerm PermType
PTUpdate) AnyBackend DropPerm
q
  RMDropDeletePermission AnyBackend DropPerm
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropPerm b -> m EncJSON)
-> AnyBackend DropPerm -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (PermType -> DropPerm b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(UserInfoM m, CacheRWM m, MonadError QErr m, MetadataM m,
 BackendMetadata b) =>
PermType -> DropPerm b -> m EncJSON
runDropPerm PermType
PTDelete) AnyBackend DropPerm
q
  RMSetPermissionComment AnyBackend SetPermComment
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetPermComment b -> m EncJSON)
-> AnyBackend SetPermComment -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetPermComment b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetPermComment b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m, BackendMetadata b) =>
SetPermComment b -> m EncJSON
runSetPermComment AnyBackend SetPermComment
q
  RMCreateObjectRelationship AnyBackend CreateObjRel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreateObjRel b -> m EncJSON)
-> AnyBackend CreateObjRel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (RelType -> WithTable b (RelDef (ObjRelUsing b)) -> m EncJSON
forall (m :: * -> *) (b :: BackendType) a.
(MonadError QErr m, CacheRWM m, ToJSON a, MetadataM m,
 BackendMetadata b) =>
RelType -> WithTable b (RelDef a) -> m EncJSON
runCreateRelationship RelType
ObjRel (WithTable b (RelDef (ObjRelUsing b)) -> m EncJSON)
-> (CreateObjRel b -> WithTable b (RelDef (ObjRelUsing b)))
-> CreateObjRel b
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateObjRel b -> WithTable b (RelDef (ObjRelUsing b))
forall (b :: BackendType).
CreateObjRel b -> WithTable b (ObjRelDef b)
unCreateObjRel) AnyBackend CreateObjRel
q
  RMCreateArrayRelationship AnyBackend CreateArrRel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreateArrRel b -> m EncJSON)
-> AnyBackend CreateArrRel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (RelType -> WithTable b (RelDef (ArrRelUsing b)) -> m EncJSON
forall (m :: * -> *) (b :: BackendType) a.
(MonadError QErr m, CacheRWM m, ToJSON a, MetadataM m,
 BackendMetadata b) =>
RelType -> WithTable b (RelDef a) -> m EncJSON
runCreateRelationship RelType
ArrRel (WithTable b (RelDef (ArrRelUsing b)) -> m EncJSON)
-> (CreateArrRel b -> WithTable b (RelDef (ArrRelUsing b)))
-> CreateArrRel b
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateArrRel b -> WithTable b (RelDef (ArrRelUsing b))
forall (b :: BackendType).
CreateArrRel b -> WithTable b (ArrRelDef b)
unCreateArrRel) AnyBackend CreateArrRel
q
  RMDropRelationship AnyBackend DropRel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropRel b -> m EncJSON)
-> AnyBackend DropRel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata DropRel b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
DropRel b -> m EncJSON
forall (m :: * -> *) (b :: BackendType).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
DropRel b -> m EncJSON
runDropRel AnyBackend DropRel
q
  RMSetRelationshipComment AnyBackend SetRelComment
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SetRelComment b -> m EncJSON)
-> AnyBackend SetRelComment -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SetRelComment b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SetRelComment b -> m EncJSON
forall (m :: * -> *) (b :: BackendType).
(CacheRWM m, MonadError QErr m, MetadataM m, BackendMetadata b) =>
SetRelComment b -> m EncJSON
runSetRelComment AnyBackend SetRelComment
q
  RMRenameRelationship AnyBackend RenameRel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 RenameRel b -> m EncJSON)
-> AnyBackend RenameRel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata RenameRel b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
RenameRel b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
RenameRel b -> m EncJSON
runRenameRel AnyBackend RenameRel
q
  RMSuggestRelationships AnyBackend SuggestRels
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 SuggestRels b -> m EncJSON)
-> AnyBackend SuggestRels -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata SuggestRels b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
SuggestRels b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, BackendMetadata b) =>
SuggestRels b -> m EncJSON
runSuggestRels AnyBackend SuggestRels
q
  RMCreateRemoteRelationship AnyBackend CreateFromSourceRelationship
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreateFromSourceRelationship b -> m EncJSON)
-> AnyBackend CreateFromSourceRelationship -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreateFromSourceRelationship b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreateFromSourceRelationship b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
CreateFromSourceRelationship b -> m EncJSON
runCreateRemoteRelationship AnyBackend CreateFromSourceRelationship
q
  RMUpdateRemoteRelationship AnyBackend CreateFromSourceRelationship
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreateFromSourceRelationship b -> m EncJSON)
-> AnyBackend CreateFromSourceRelationship -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreateFromSourceRelationship b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreateFromSourceRelationship b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m, BackendMetadata b) =>
CreateFromSourceRelationship b -> m EncJSON
runUpdateRemoteRelationship AnyBackend CreateFromSourceRelationship
q
  RMDeleteRemoteRelationship AnyBackend DeleteFromSourceRelationship
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DeleteFromSourceRelationship b -> m EncJSON)
-> AnyBackend DeleteFromSourceRelationship -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata DeleteFromSourceRelationship b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
DeleteFromSourceRelationship b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, CacheRWM m, MetadataM m) =>
DeleteFromSourceRelationship b -> m EncJSON
runDeleteRemoteRelationship AnyBackend DeleteFromSourceRelationship
q
  RMTrackFunction AnyBackend TrackFunctionV2
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackFunctionV2 b -> m EncJSON)
-> AnyBackend TrackFunctionV2 -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata TrackFunctionV2 b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
TrackFunctionV2 b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, QErrM m, CacheRWM m, MetadataM m) =>
TrackFunctionV2 b -> m EncJSON
Functions.runTrackFunctionV2 AnyBackend TrackFunctionV2
q
  RMUntrackFunction AnyBackend UnTrackFunction
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 UnTrackFunction b -> m EncJSON)
-> AnyBackend UnTrackFunction -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata UnTrackFunction b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
UnTrackFunction b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(CacheRWM m, MonadError QErr m, MetadataM m, BackendMetadata b) =>
UnTrackFunction b -> m EncJSON
Functions.runUntrackFunc AnyBackend UnTrackFunction
q
  RMCreateFunctionPermission AnyBackend FunctionPermissionArgument
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 FunctionPermissionArgument b -> m EncJSON)
-> AnyBackend FunctionPermissionArgument -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata FunctionPermissionArgument b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
FunctionPermissionArgument b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(CacheRWM m, MonadError QErr m, MetadataM m, BackendMetadata b) =>
FunctionPermissionArgument b -> m EncJSON
Functions.runCreateFunctionPermission AnyBackend FunctionPermissionArgument
q
  RMDropFunctionPermission AnyBackend FunctionPermissionArgument
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 FunctionPermissionArgument b -> m EncJSON)
-> AnyBackend FunctionPermissionArgument -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata FunctionPermissionArgument b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
FunctionPermissionArgument b -> m EncJSON
forall (m :: * -> *) (b :: BackendType).
(CacheRWM m, MonadError QErr m, MetadataM m, BackendMetadata b) =>
FunctionPermissionArgument b -> m EncJSON
Functions.runDropFunctionPermission AnyBackend FunctionPermissionArgument
q
  RMAddComputedField AnyBackend AddComputedField
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 AddComputedField b -> m EncJSON)
-> AnyBackend AddComputedField -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata AddComputedField b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
AddComputedField b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, CacheRWM m, MetadataM m) =>
AddComputedField b -> m EncJSON
runAddComputedField AnyBackend AddComputedField
q
  RMDropComputedField AnyBackend DropComputedField
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropComputedField b -> m EncJSON)
-> AnyBackend DropComputedField -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata DropComputedField b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
DropComputedField b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m, BackendMetadata b) =>
DropComputedField b -> m EncJSON
runDropComputedField AnyBackend DropComputedField
q
  RMTestConnectionTemplate AnyBackend TestConnectionTemplate
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TestConnectionTemplate b -> m EncJSON)
-> AnyBackend TestConnectionTemplate -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata TestConnectionTemplate b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
TestConnectionTemplate b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRM m, Backend b, MetadataM m) =>
TestConnectionTemplate b -> m EncJSON
runTestConnectionTemplate AnyBackend TestConnectionTemplate
q
  RMGetNativeQuery AnyBackend GetNativeQuery
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetNativeQuery b -> m EncJSON)
-> AnyBackend GetNativeQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetNativeQuery b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetNativeQuery b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MetadataM m, MonadError QErr m) =>
GetNativeQuery b -> m EncJSON
NativeQueries.runGetNativeQuery AnyBackend GetNativeQuery
q
  RMTrackNativeQuery AnyBackend TrackNativeQuery
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackNativeQuery b -> m EncJSON)
-> AnyBackend TrackNativeQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((TrackNativeQuery b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> TrackNativeQuery b -> m EncJSON
forall (m :: * -> *) request.
(MonadError QErr m, CacheRWM m, MetadataM m) =>
(request -> Metadata -> m (MetadataObjId, MetadataModifier))
-> request -> m EncJSON
runSingleExec TrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
TrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
NativeQueries.execTrackNativeQuery) AnyBackend TrackNativeQuery
q
  RMUntrackNativeQuery AnyBackend UntrackNativeQuery
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 UntrackNativeQuery b -> m EncJSON)
-> AnyBackend UntrackNativeQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((UntrackNativeQuery b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> UntrackNativeQuery b -> m EncJSON
forall (m :: * -> *) request.
(MonadError QErr m, CacheRWM m, MetadataM m) =>
(request -> Metadata -> m (MetadataObjId, MetadataModifier))
-> request -> m EncJSON
runSingleExec UntrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
UntrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
NativeQueries.execUntrackNativeQuery) AnyBackend UntrackNativeQuery
q
  RMGetStoredProcedure AnyBackend GetStoredProcedure
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetStoredProcedure b -> m EncJSON)
-> AnyBackend GetStoredProcedure -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetStoredProcedure b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetStoredProcedure b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MetadataM m) =>
GetStoredProcedure b -> m EncJSON
StoredProcedures.runGetStoredProcedure AnyBackend GetStoredProcedure
q
  RMTrackStoredProcedure AnyBackend TrackStoredProcedure
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackStoredProcedure b -> m EncJSON)
-> AnyBackend TrackStoredProcedure -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata TrackStoredProcedure b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
TrackStoredProcedure b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, CacheRWM m, MetadataM m) =>
TrackStoredProcedure b -> m EncJSON
StoredProcedures.runTrackStoredProcedure AnyBackend TrackStoredProcedure
q
  RMUntrackStoredProcedure AnyBackend UntrackStoredProcedure
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 UntrackStoredProcedure b -> m EncJSON)
-> AnyBackend UntrackStoredProcedure -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata UntrackStoredProcedure b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
UntrackStoredProcedure b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, CacheRWM m, MetadataM m) =>
UntrackStoredProcedure b -> m EncJSON
StoredProcedures.runUntrackStoredProcedure AnyBackend UntrackStoredProcedure
q
  RMGetLogicalModel AnyBackend GetLogicalModel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 GetLogicalModel b -> m EncJSON)
-> AnyBackend GetLogicalModel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata GetLogicalModel b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
GetLogicalModel b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, MetadataM m) =>
GetLogicalModel b -> m EncJSON
LogicalModel.runGetLogicalModel AnyBackend GetLogicalModel
q
  RMTrackLogicalModel AnyBackend TrackLogicalModel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 TrackLogicalModel b -> m EncJSON)
-> AnyBackend TrackLogicalModel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((TrackLogicalModel b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> TrackLogicalModel b -> m EncJSON
forall (m :: * -> *) request.
(MonadError QErr m, CacheRWM m, MetadataM m) =>
(request -> Metadata -> m (MetadataObjId, MetadataModifier))
-> request -> m EncJSON
runSingleExec TrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
TrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
LogicalModel.execTrackLogicalModel) AnyBackend TrackLogicalModel
q
  RMUntrackLogicalModel AnyBackend UntrackLogicalModel
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 UntrackLogicalModel b -> m EncJSON)
-> AnyBackend UntrackLogicalModel -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((UntrackLogicalModel b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> UntrackLogicalModel b -> m EncJSON
forall (m :: * -> *) request.
(MonadError QErr m, CacheRWM m, MetadataM m) =>
(request -> Metadata -> m (MetadataObjId, MetadataModifier))
-> request -> m EncJSON
runSingleExec UntrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
UntrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
LogicalModel.execUntrackLogicalModel) AnyBackend UntrackLogicalModel
q
  RMCreateSelectLogicalModelPermission AnyBackend (CreateLogicalModelPermission SelPerm)
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 CreateLogicalModelPermission SelPerm b -> m EncJSON)
-> AnyBackend (CreateLogicalModelPermission SelPerm) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata CreateLogicalModelPermission SelPerm b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
CreateLogicalModelPermission SelPerm b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(Backend b, CacheRWM m, MetadataM m, MonadError QErr m) =>
CreateLogicalModelPermission SelPerm b -> m EncJSON
LogicalModel.runCreateSelectLogicalModelPermission AnyBackend (CreateLogicalModelPermission SelPerm)
q
  RMDropSelectLogicalModelPermission AnyBackend DropLogicalModelPermission
q -> (forall (b :: BackendType).
 BackendMetadata b =>
 DropLogicalModelPermission b -> m EncJSON)
-> AnyBackend DropLogicalModelPermission -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata DropLogicalModelPermission b -> m EncJSON
forall (b :: BackendType).
BackendMetadata b =>
DropLogicalModelPermission b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(Backend b, CacheRWM m, MetadataM m, MonadError QErr m) =>
DropLogicalModelPermission b -> m EncJSON
LogicalModel.runDropSelectLogicalModelPermission AnyBackend DropLogicalModelPermission
q
  RMCreateEventTrigger AnyBackend (Unvalidated1 CreateEventTriggerQuery)
q ->
    (forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 Unvalidated1 CreateEventTriggerQuery b -> m EncJSON)
-> AnyBackend (Unvalidated1 CreateEventTriggerQuery) -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 i b -> a)
-> AnyBackend i -> a
dispatchMetadataAndEventTrigger
      ( LensLike
  m
  (Unvalidated1 CreateEventTriggerQuery b)
  (Unvalidated1 CreateEventTriggerQuery b)
  RequestTransform
  RequestTransform
-> LensLike
     m
     (Unvalidated1 CreateEventTriggerQuery b)
     (Unvalidated1 CreateEventTriggerQuery b)
     MetadataResponseTransform
     MetadataResponseTransform
-> (Unvalidated1 CreateEventTriggerQuery b -> m EncJSON)
-> Unvalidated1 CreateEventTriggerQuery b
-> m EncJSON
forall (m :: * -> *) api.
MonadError QErr m =>
LensLike m api api RequestTransform RequestTransform
-> LensLike
     m api api MetadataResponseTransform MetadataResponseTransform
-> (api -> m EncJSON)
-> api
-> m EncJSON
validateTransforms
          ((CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> Unvalidated1 CreateEventTriggerQuery b
-> m (Unvalidated1 CreateEventTriggerQuery b)
forall {k} (f1 :: k -> *) (a :: k) (f2 :: * -> *).
Functor f2 =>
(f1 a -> f2 (f1 a)) -> Unvalidated1 f1 a -> f2 (Unvalidated1 f1 a)
unUnvalidate1 ((CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
 -> Unvalidated1 CreateEventTriggerQuery b
 -> m (Unvalidated1 CreateEventTriggerQuery b))
-> ((RequestTransform -> m RequestTransform)
    -> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> LensLike
     m
     (Unvalidated1 CreateEventTriggerQuery b)
     (Unvalidated1 CreateEventTriggerQuery b)
     RequestTransform
     RequestTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe RequestTransform -> m (Maybe RequestTransform))
-> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe RequestTransform -> f (Maybe RequestTransform))
-> CreateEventTriggerQuery b -> f (CreateEventTriggerQuery b)
cetqRequestTransform ((Maybe RequestTransform -> m (Maybe RequestTransform))
 -> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> ((RequestTransform -> m RequestTransform)
    -> Maybe RequestTransform -> m (Maybe RequestTransform))
-> (RequestTransform -> m RequestTransform)
-> CreateEventTriggerQuery b
-> m (CreateEventTriggerQuery b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RequestTransform -> m RequestTransform)
-> Maybe RequestTransform -> m (Maybe RequestTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
          ((CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> Unvalidated1 CreateEventTriggerQuery b
-> m (Unvalidated1 CreateEventTriggerQuery b)
forall {k} (f1 :: k -> *) (a :: k) (f2 :: * -> *).
Functor f2 =>
(f1 a -> f2 (f1 a)) -> Unvalidated1 f1 a -> f2 (Unvalidated1 f1 a)
unUnvalidate1 ((CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
 -> Unvalidated1 CreateEventTriggerQuery b
 -> m (Unvalidated1 CreateEventTriggerQuery b))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> LensLike
     m
     (Unvalidated1 CreateEventTriggerQuery b)
     (Unvalidated1 CreateEventTriggerQuery b)
     MetadataResponseTransform
     MetadataResponseTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe MetadataResponseTransform
 -> m (Maybe MetadataResponseTransform))
-> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe MetadataResponseTransform
 -> f (Maybe MetadataResponseTransform))
-> CreateEventTriggerQuery b -> f (CreateEventTriggerQuery b)
cetqResponseTrasnform ((Maybe MetadataResponseTransform
  -> m (Maybe MetadataResponseTransform))
 -> CreateEventTriggerQuery b -> m (CreateEventTriggerQuery b))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> Maybe MetadataResponseTransform
    -> m (Maybe MetadataResponseTransform))
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> CreateEventTriggerQuery b
-> m (CreateEventTriggerQuery b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MetadataResponseTransform -> m MetadataResponseTransform)
-> Maybe MetadataResponseTransform
-> m (Maybe MetadataResponseTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
          (CreateEventTriggerQuery b -> m EncJSON
forall (b :: BackendType) (m :: * -> *) r.
(BackendMetadata b, BackendEventTrigger b, QErrM m, UserInfoM m,
 CacheRWM m, MetadataM m, MonadIO m, MonadEventLogCleanup m,
 MonadReader r m, Has (Logger Hasura) r) =>
CreateEventTriggerQuery b -> m EncJSON
runCreateEventTriggerQuery (CreateEventTriggerQuery b -> m EncJSON)
-> (Unvalidated1 CreateEventTriggerQuery b
    -> CreateEventTriggerQuery b)
-> Unvalidated1 CreateEventTriggerQuery b
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unvalidated1 CreateEventTriggerQuery b -> CreateEventTriggerQuery b
forall k (f :: k -> *) (a :: k). Unvalidated1 f a -> f a
_unUnvalidate1)
      )
      AnyBackend (Unvalidated1 CreateEventTriggerQuery)
q
  RMDeleteEventTrigger AnyBackend DeleteEventTriggerQuery
q -> (forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 DeleteEventTriggerQuery b -> m EncJSON)
-> AnyBackend DeleteEventTriggerQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 i b -> a)
-> AnyBackend i -> a
dispatchMetadataAndEventTrigger DeleteEventTriggerQuery b -> m EncJSON
forall (b :: BackendType).
(BackendMetadata b, BackendEventTrigger b) =>
DeleteEventTriggerQuery b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendEventTrigger b, MonadError QErr m, CacheRWM m, MonadIO m,
 MetadataM m) =>
DeleteEventTriggerQuery b -> m EncJSON
runDeleteEventTriggerQuery AnyBackend DeleteEventTriggerQuery
q
  RMRedeliverEvent AnyBackend RedeliverEventQuery
q -> (forall (b :: BackendType).
 BackendEventTrigger b =>
 RedeliverEventQuery b -> m EncJSON)
-> AnyBackend RedeliverEventQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger RedeliverEventQuery b -> m EncJSON
forall (b :: BackendType).
BackendEventTrigger b =>
RedeliverEventQuery b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(BackendEventTrigger b, MonadIO m, CacheRM m, QErrM m,
 MetadataM m) =>
RedeliverEventQuery b -> m EncJSON
runRedeliverEvent AnyBackend RedeliverEventQuery
q
  RMInvokeEventTrigger AnyBackend InvokeEventTriggerQuery
q -> (forall (b :: BackendType).
 BackendEventTrigger b =>
 InvokeEventTriggerQuery b -> m EncJSON)
-> AnyBackend InvokeEventTriggerQuery -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger InvokeEventTriggerQuery b -> m EncJSON
forall (b :: BackendType).
BackendEventTrigger b =>
InvokeEventTriggerQuery b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadIO m, QErrM m, CacheRM m, MetadataM m, MonadTrace m,
 UserInfoM m, BackendEventTrigger b) =>
InvokeEventTriggerQuery b -> m EncJSON
runInvokeEventTrigger AnyBackend InvokeEventTriggerQuery
q
  RMCleanupEventTriggerLog TriggerLogCleanupConfig
q -> TriggerLogCleanupConfig -> m EncJSON
forall (m :: * -> *).
(MonadEventLogCleanup m, MonadError QErr m, CacheRWM m) =>
TriggerLogCleanupConfig -> m EncJSON
runCleanupEventTriggerLog TriggerLogCleanupConfig
q
  RMResumeEventTriggerCleanup TriggerLogCleanupToggleConfig
q -> TriggerLogCleanupToggleConfig -> m EncJSON
forall (m :: * -> *).
(MonadIO m, QErrM m, CacheRWM m, MetadataM m) =>
TriggerLogCleanupToggleConfig -> m EncJSON
runEventTriggerResumeCleanup TriggerLogCleanupToggleConfig
q
  RMPauseEventTriggerCleanup TriggerLogCleanupToggleConfig
q -> TriggerLogCleanupToggleConfig -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MonadIO m, MetadataM m) =>
TriggerLogCleanupToggleConfig -> m EncJSON
runEventTriggerPauseCleanup TriggerLogCleanupToggleConfig
q
  RMGetEventLogs AnyBackend GetEventLogs
q -> (forall (b :: BackendType).
 BackendEventTrigger b =>
 GetEventLogs b -> m EncJSON)
-> AnyBackend GetEventLogs -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger GetEventLogs b -> m EncJSON
forall (b :: BackendType).
BackendEventTrigger b =>
GetEventLogs b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadIO m, CacheRM m, MonadError QErr m, BackendEventTrigger b,
 MetadataM m) =>
GetEventLogs b -> m EncJSON
runGetEventLogs AnyBackend GetEventLogs
q
  RMGetEventInvocationLogs AnyBackend GetEventInvocations
q -> (forall (b :: BackendType).
 BackendEventTrigger b =>
 GetEventInvocations b -> m EncJSON)
-> AnyBackend GetEventInvocations -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger GetEventInvocations b -> m EncJSON
forall (b :: BackendType).
BackendEventTrigger b =>
GetEventInvocations b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadIO m, CacheRM m, MonadError QErr m, BackendEventTrigger b,
 MetadataM m) =>
GetEventInvocations b -> m EncJSON
runGetEventInvocationLogs AnyBackend GetEventInvocations
q
  RMGetEventById AnyBackend GetEventById
q -> (forall (b :: BackendType).
 BackendEventTrigger b =>
 GetEventById b -> m EncJSON)
-> AnyBackend GetEventById -> m EncJSON
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger GetEventById b -> m EncJSON
forall (b :: BackendType).
BackendEventTrigger b =>
GetEventById b -> m EncJSON
forall (b :: BackendType) (m :: * -> *).
(MonadIO m, CacheRM m, MonadError QErr m, BackendEventTrigger b,
 MetadataM m) =>
GetEventById b -> m EncJSON
runGetEventById AnyBackend GetEventById
q
  RMAddRemoteSchema AddRemoteSchemaQuery
q -> Environment -> AddRemoteSchemaQuery -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MonadIO m, ProvidesNetwork m, MetadataM m,
 MonadTrace m) =>
Environment -> AddRemoteSchemaQuery -> m EncJSON
runAddRemoteSchema Environment
env AddRemoteSchemaQuery
q
  RMUpdateRemoteSchema AddRemoteSchemaQuery
q -> Environment -> AddRemoteSchemaQuery -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MonadIO m, ProvidesNetwork m, MetadataM m,
 MonadTrace m) =>
Environment -> AddRemoteSchemaQuery -> m EncJSON
runUpdateRemoteSchema Environment
env AddRemoteSchemaQuery
q
  RMRemoveRemoteSchema RemoteSchemaNameQuery
q -> RemoteSchemaNameQuery -> m EncJSON
forall (m :: * -> *).
(QErrM m, UserInfoM m, CacheRWM m, MetadataM m) =>
RemoteSchemaNameQuery -> m EncJSON
runRemoveRemoteSchema RemoteSchemaNameQuery
q
  RMReloadRemoteSchema RemoteSchemaNameQuery
q -> RemoteSchemaNameQuery -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
RemoteSchemaNameQuery -> m EncJSON
runReloadRemoteSchema RemoteSchemaNameQuery
q
  RMIntrospectRemoteSchema RemoteSchemaNameQuery
q -> RemoteSchemaNameQuery -> m EncJSON
forall (m :: * -> *).
(CacheRM m, QErrM m) =>
RemoteSchemaNameQuery -> m EncJSON
runIntrospectRemoteSchema RemoteSchemaNameQuery
q
  RMAddRemoteSchemaPermissions AddRemoteSchemaPermission
q -> RemoteSchemaPermissions -> AddRemoteSchemaPermission -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
RemoteSchemaPermissions -> AddRemoteSchemaPermission -> m EncJSON
runAddRemoteSchemaPermissions RemoteSchemaPermissions
remoteSchemaPerms AddRemoteSchemaPermission
q
  RMDropRemoteSchemaPermissions DropRemoteSchemaPermissions
q -> DropRemoteSchemaPermissions -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
DropRemoteSchemaPermissions -> m EncJSON
runDropRemoteSchemaPermissions DropRemoteSchemaPermissions
q
  RMCreateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
q -> CreateRemoteSchemaRemoteRelationship -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
CreateRemoteSchemaRemoteRelationship -> m EncJSON
runCreateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
q
  RMUpdateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
q -> CreateRemoteSchemaRemoteRelationship -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
CreateRemoteSchemaRemoteRelationship -> m EncJSON
runUpdateRemoteSchemaRemoteRelationship CreateRemoteSchemaRemoteRelationship
q
  RMDeleteRemoteSchemaRemoteRelationship DeleteRemoteSchemaRemoteRelationship
q -> DeleteRemoteSchemaRemoteRelationship -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
DeleteRemoteSchemaRemoteRelationship -> m EncJSON
runDeleteRemoteSchemaRemoteRelationship DeleteRemoteSchemaRemoteRelationship
q
  RMCreateCronTrigger Unvalidated CreateCronTrigger
q ->
    LensLike
  m
  (Unvalidated CreateCronTrigger)
  (Unvalidated CreateCronTrigger)
  RequestTransform
  RequestTransform
-> LensLike
     m
     (Unvalidated CreateCronTrigger)
     (Unvalidated CreateCronTrigger)
     MetadataResponseTransform
     MetadataResponseTransform
-> (Unvalidated CreateCronTrigger -> m EncJSON)
-> Unvalidated CreateCronTrigger
-> m EncJSON
forall (m :: * -> *) api.
MonadError QErr m =>
LensLike m api api RequestTransform RequestTransform
-> LensLike
     m api api MetadataResponseTransform MetadataResponseTransform
-> (api -> m EncJSON)
-> api
-> m EncJSON
validateTransforms
      ((CreateCronTrigger -> m CreateCronTrigger)
-> Unvalidated CreateCronTrigger
-> m (Unvalidated CreateCronTrigger)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((CreateCronTrigger -> m CreateCronTrigger)
 -> Unvalidated CreateCronTrigger
 -> m (Unvalidated CreateCronTrigger))
-> ((RequestTransform -> m RequestTransform)
    -> CreateCronTrigger -> m CreateCronTrigger)
-> LensLike
     m
     (Unvalidated CreateCronTrigger)
     (Unvalidated CreateCronTrigger)
     RequestTransform
     RequestTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe RequestTransform -> m (Maybe RequestTransform))
-> CreateCronTrigger -> m CreateCronTrigger
Lens' CreateCronTrigger (Maybe RequestTransform)
cctRequestTransform ((Maybe RequestTransform -> m (Maybe RequestTransform))
 -> CreateCronTrigger -> m CreateCronTrigger)
-> ((RequestTransform -> m RequestTransform)
    -> Maybe RequestTransform -> m (Maybe RequestTransform))
-> (RequestTransform -> m RequestTransform)
-> CreateCronTrigger
-> m CreateCronTrigger
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RequestTransform -> m RequestTransform)
-> Maybe RequestTransform -> m (Maybe RequestTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      ((CreateCronTrigger -> m CreateCronTrigger)
-> Unvalidated CreateCronTrigger
-> m (Unvalidated CreateCronTrigger)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((CreateCronTrigger -> m CreateCronTrigger)
 -> Unvalidated CreateCronTrigger
 -> m (Unvalidated CreateCronTrigger))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> CreateCronTrigger -> m CreateCronTrigger)
-> LensLike
     m
     (Unvalidated CreateCronTrigger)
     (Unvalidated CreateCronTrigger)
     MetadataResponseTransform
     MetadataResponseTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe MetadataResponseTransform
 -> m (Maybe MetadataResponseTransform))
-> CreateCronTrigger -> m CreateCronTrigger
Lens' CreateCronTrigger (Maybe MetadataResponseTransform)
cctResponseTransform ((Maybe MetadataResponseTransform
  -> m (Maybe MetadataResponseTransform))
 -> CreateCronTrigger -> m CreateCronTrigger)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> Maybe MetadataResponseTransform
    -> m (Maybe MetadataResponseTransform))
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> CreateCronTrigger
-> m CreateCronTrigger
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MetadataResponseTransform -> m MetadataResponseTransform)
-> Maybe MetadataResponseTransform
-> m (Maybe MetadataResponseTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      (CreateCronTrigger -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MonadIO m, MetadataM m,
 MonadMetadataStorage m) =>
CreateCronTrigger -> m EncJSON
runCreateCronTrigger (CreateCronTrigger -> m EncJSON)
-> (Unvalidated CreateCronTrigger -> CreateCronTrigger)
-> Unvalidated CreateCronTrigger
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unvalidated CreateCronTrigger -> CreateCronTrigger
forall a. Unvalidated a -> a
_unUnvalidate)
      Unvalidated CreateCronTrigger
q
  RMDeleteCronTrigger ScheduledTriggerName
q -> ScheduledTriggerName -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m,
 MonadMetadataStorage m) =>
ScheduledTriggerName -> m EncJSON
runDeleteCronTrigger ScheduledTriggerName
q
  RMCreateScheduledEvent CreateScheduledEvent
q -> CreateScheduledEvent -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MonadMetadataStorage m) =>
CreateScheduledEvent -> m EncJSON
runCreateScheduledEvent CreateScheduledEvent
q
  RMDeleteScheduledEvent DeleteScheduledEvent
q -> DeleteScheduledEvent -> m EncJSON
forall (m :: * -> *).
(MonadMetadataStorage m, MonadError QErr m) =>
DeleteScheduledEvent -> m EncJSON
runDeleteScheduledEvent DeleteScheduledEvent
q
  RMGetScheduledEvents GetScheduledEvents
q -> GetScheduledEvents -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRM m, MonadMetadataStorage m) =>
GetScheduledEvents -> m EncJSON
runGetScheduledEvents GetScheduledEvents
q
  RMGetScheduledEventInvocations GetScheduledEventInvocations
q -> GetScheduledEventInvocations -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRM m, MonadMetadataStorage m) =>
GetScheduledEventInvocations -> m EncJSON
runGetScheduledEventInvocations GetScheduledEventInvocations
q
  RQLMetadataV1
RMGetCronTriggers -> m EncJSON
forall (m :: * -> *). MetadataM m => m EncJSON
runGetCronTriggers
  RMCreateAction Unvalidated CreateAction
q ->
    LensLike
  m
  (Unvalidated CreateAction)
  (Unvalidated CreateAction)
  RequestTransform
  RequestTransform
-> LensLike
     m
     (Unvalidated CreateAction)
     (Unvalidated CreateAction)
     MetadataResponseTransform
     MetadataResponseTransform
-> (Unvalidated CreateAction -> m EncJSON)
-> Unvalidated CreateAction
-> m EncJSON
forall (m :: * -> *) api.
MonadError QErr m =>
LensLike m api api RequestTransform RequestTransform
-> LensLike
     m api api MetadataResponseTransform MetadataResponseTransform
-> (api -> m EncJSON)
-> api
-> m EncJSON
validateTransforms
      ((CreateAction -> m CreateAction)
-> Unvalidated CreateAction -> m (Unvalidated CreateAction)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((CreateAction -> m CreateAction)
 -> Unvalidated CreateAction -> m (Unvalidated CreateAction))
-> ((RequestTransform -> m RequestTransform)
    -> CreateAction -> m CreateAction)
-> LensLike
     m
     (Unvalidated CreateAction)
     (Unvalidated CreateAction)
     RequestTransform
     RequestTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ActionDefinitionInput -> m ActionDefinitionInput)
-> CreateAction -> m CreateAction
Lens' CreateAction ActionDefinitionInput
caDefinition ((ActionDefinitionInput -> m ActionDefinitionInput)
 -> CreateAction -> m CreateAction)
-> ((RequestTransform -> m RequestTransform)
    -> ActionDefinitionInput -> m ActionDefinitionInput)
-> (RequestTransform -> m RequestTransform)
-> CreateAction
-> m CreateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe RequestTransform -> m (Maybe RequestTransform))
-> ActionDefinitionInput -> m ActionDefinitionInput
forall arg webhook (f :: * -> *).
Functor f =>
(Maybe RequestTransform -> f (Maybe RequestTransform))
-> ActionDefinition arg webhook -> f (ActionDefinition arg webhook)
adRequestTransform ((Maybe RequestTransform -> m (Maybe RequestTransform))
 -> ActionDefinitionInput -> m ActionDefinitionInput)
-> ((RequestTransform -> m RequestTransform)
    -> Maybe RequestTransform -> m (Maybe RequestTransform))
-> (RequestTransform -> m RequestTransform)
-> ActionDefinitionInput
-> m ActionDefinitionInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RequestTransform -> m RequestTransform)
-> Maybe RequestTransform -> m (Maybe RequestTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      ((CreateAction -> m CreateAction)
-> Unvalidated CreateAction -> m (Unvalidated CreateAction)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((CreateAction -> m CreateAction)
 -> Unvalidated CreateAction -> m (Unvalidated CreateAction))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> CreateAction -> m CreateAction)
-> LensLike
     m
     (Unvalidated CreateAction)
     (Unvalidated CreateAction)
     MetadataResponseTransform
     MetadataResponseTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ActionDefinitionInput -> m ActionDefinitionInput)
-> CreateAction -> m CreateAction
Lens' CreateAction ActionDefinitionInput
caDefinition ((ActionDefinitionInput -> m ActionDefinitionInput)
 -> CreateAction -> m CreateAction)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> ActionDefinitionInput -> m ActionDefinitionInput)
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> CreateAction
-> m CreateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe MetadataResponseTransform
 -> m (Maybe MetadataResponseTransform))
-> ActionDefinitionInput -> m ActionDefinitionInput
forall arg webhook (f :: * -> *).
Functor f =>
(Maybe MetadataResponseTransform
 -> f (Maybe MetadataResponseTransform))
-> ActionDefinition arg webhook -> f (ActionDefinition arg webhook)
adResponseTransform ((Maybe MetadataResponseTransform
  -> m (Maybe MetadataResponseTransform))
 -> ActionDefinitionInput -> m ActionDefinitionInput)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> Maybe MetadataResponseTransform
    -> m (Maybe MetadataResponseTransform))
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> ActionDefinitionInput
-> m ActionDefinitionInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MetadataResponseTransform -> m MetadataResponseTransform)
-> Maybe MetadataResponseTransform
-> m (Maybe MetadataResponseTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      (CreateAction -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
CreateAction -> m EncJSON
runCreateAction (CreateAction -> m EncJSON)
-> (Unvalidated CreateAction -> CreateAction)
-> Unvalidated CreateAction
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unvalidated CreateAction -> CreateAction
forall a. Unvalidated a -> a
_unUnvalidate)
      Unvalidated CreateAction
q
  RMDropAction DropAction
q -> DropAction -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m,
 MonadMetadataStorage m) =>
DropAction -> m EncJSON
runDropAction DropAction
q
  RMUpdateAction Unvalidated UpdateAction
q ->
    LensLike
  m
  (Unvalidated UpdateAction)
  (Unvalidated UpdateAction)
  RequestTransform
  RequestTransform
-> LensLike
     m
     (Unvalidated UpdateAction)
     (Unvalidated UpdateAction)
     MetadataResponseTransform
     MetadataResponseTransform
-> (Unvalidated UpdateAction -> m EncJSON)
-> Unvalidated UpdateAction
-> m EncJSON
forall (m :: * -> *) api.
MonadError QErr m =>
LensLike m api api RequestTransform RequestTransform
-> LensLike
     m api api MetadataResponseTransform MetadataResponseTransform
-> (api -> m EncJSON)
-> api
-> m EncJSON
validateTransforms
      ((UpdateAction -> m UpdateAction)
-> Unvalidated UpdateAction -> m (Unvalidated UpdateAction)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((UpdateAction -> m UpdateAction)
 -> Unvalidated UpdateAction -> m (Unvalidated UpdateAction))
-> ((RequestTransform -> m RequestTransform)
    -> UpdateAction -> m UpdateAction)
-> LensLike
     m
     (Unvalidated UpdateAction)
     (Unvalidated UpdateAction)
     RequestTransform
     RequestTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ActionDefinitionInput -> m ActionDefinitionInput)
-> UpdateAction -> m UpdateAction
Lens' UpdateAction ActionDefinitionInput
uaDefinition ((ActionDefinitionInput -> m ActionDefinitionInput)
 -> UpdateAction -> m UpdateAction)
-> ((RequestTransform -> m RequestTransform)
    -> ActionDefinitionInput -> m ActionDefinitionInput)
-> (RequestTransform -> m RequestTransform)
-> UpdateAction
-> m UpdateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe RequestTransform -> m (Maybe RequestTransform))
-> ActionDefinitionInput -> m ActionDefinitionInput
forall arg webhook (f :: * -> *).
Functor f =>
(Maybe RequestTransform -> f (Maybe RequestTransform))
-> ActionDefinition arg webhook -> f (ActionDefinition arg webhook)
adRequestTransform ((Maybe RequestTransform -> m (Maybe RequestTransform))
 -> ActionDefinitionInput -> m ActionDefinitionInput)
-> ((RequestTransform -> m RequestTransform)
    -> Maybe RequestTransform -> m (Maybe RequestTransform))
-> (RequestTransform -> m RequestTransform)
-> ActionDefinitionInput
-> m ActionDefinitionInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RequestTransform -> m RequestTransform)
-> Maybe RequestTransform -> m (Maybe RequestTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      ((UpdateAction -> m UpdateAction)
-> Unvalidated UpdateAction -> m (Unvalidated UpdateAction)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((UpdateAction -> m UpdateAction)
 -> Unvalidated UpdateAction -> m (Unvalidated UpdateAction))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> UpdateAction -> m UpdateAction)
-> LensLike
     m
     (Unvalidated UpdateAction)
     (Unvalidated UpdateAction)
     MetadataResponseTransform
     MetadataResponseTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ActionDefinitionInput -> m ActionDefinitionInput)
-> UpdateAction -> m UpdateAction
Lens' UpdateAction ActionDefinitionInput
uaDefinition ((ActionDefinitionInput -> m ActionDefinitionInput)
 -> UpdateAction -> m UpdateAction)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> ActionDefinitionInput -> m ActionDefinitionInput)
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> UpdateAction
-> m UpdateAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe MetadataResponseTransform
 -> m (Maybe MetadataResponseTransform))
-> ActionDefinitionInput -> m ActionDefinitionInput
forall arg webhook (f :: * -> *).
Functor f =>
(Maybe MetadataResponseTransform
 -> f (Maybe MetadataResponseTransform))
-> ActionDefinition arg webhook -> f (ActionDefinition arg webhook)
adResponseTransform ((Maybe MetadataResponseTransform
  -> m (Maybe MetadataResponseTransform))
 -> ActionDefinitionInput -> m ActionDefinitionInput)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> Maybe MetadataResponseTransform
    -> m (Maybe MetadataResponseTransform))
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> ActionDefinitionInput
-> m ActionDefinitionInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MetadataResponseTransform -> m MetadataResponseTransform)
-> Maybe MetadataResponseTransform
-> m (Maybe MetadataResponseTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      (UpdateAction -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
UpdateAction -> m EncJSON
runUpdateAction (UpdateAction -> m EncJSON)
-> (Unvalidated UpdateAction -> UpdateAction)
-> Unvalidated UpdateAction
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unvalidated UpdateAction -> UpdateAction
forall a. Unvalidated a -> a
_unUnvalidate)
      Unvalidated UpdateAction
q
  RMCreateActionPermission CreateActionPermission
q -> CreateActionPermission -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
CreateActionPermission -> m EncJSON
runCreateActionPermission CreateActionPermission
q
  RMDropActionPermission DropActionPermission
q -> DropActionPermission -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
DropActionPermission -> m EncJSON
runDropActionPermission DropActionPermission
q
  RMCreateQueryCollection CreateCollection
q -> CreateCollection -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
CreateCollection -> m EncJSON
runCreateCollection CreateCollection
q
  RMRenameQueryCollection RenameCollection
q -> RenameCollection -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
RenameCollection -> m EncJSON
runRenameCollection RenameCollection
q
  RMDropQueryCollection DropCollection
q -> DropCollection -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
DropCollection -> m EncJSON
runDropCollection DropCollection
q
  RMAddQueryToCollection AddQueryToCollection
q -> AddQueryToCollection -> m EncJSON
forall (m :: * -> *).
(CacheRWM m, MonadError QErr m, MetadataM m) =>
AddQueryToCollection -> m EncJSON
runAddQueryToCollection AddQueryToCollection
q
  RMDropQueryFromCollection DropQueryFromCollection
q -> DropQueryFromCollection -> m EncJSON
forall (m :: * -> *).
(CacheRWM m, MonadError QErr m, MetadataM m) =>
DropQueryFromCollection -> m EncJSON
runDropQueryFromCollection DropQueryFromCollection
q
  RMAddCollectionToAllowlist AllowlistEntry
q -> AllowlistEntry -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
AllowlistEntry -> m EncJSON
runAddCollectionToAllowlist AllowlistEntry
q
  RMDropCollectionFromAllowlist DropCollectionFromAllowlist
q -> DropCollectionFromAllowlist -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
DropCollectionFromAllowlist -> m EncJSON
runDropCollectionFromAllowlist DropCollectionFromAllowlist
q
  RMUpdateScopeOfCollectionInAllowlist UpdateScopeOfCollectionInAllowlist
q -> UpdateScopeOfCollectionInAllowlist -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
UpdateScopeOfCollectionInAllowlist -> m EncJSON
runUpdateScopeOfCollectionInAllowlist UpdateScopeOfCollectionInAllowlist
q
  RMCreateRestEndpoint CreateEndpoint
q -> CreateEndpoint -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
CreateEndpoint -> m EncJSON
runCreateEndpoint CreateEndpoint
q
  RMDropRestEndpoint DropEndpoint
q -> DropEndpoint -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
DropEndpoint -> m EncJSON
runDropEndpoint DropEndpoint
q
  RMDCAddAgent DCAddAgent
q -> DCAddAgent -> m EncJSON
forall (m :: * -> *) r.
(MetadataM m, ProvidesNetwork m, CacheRWM m, Has (Logger Hasura) r,
 MonadReader r m, MonadError QErr m, MonadIO m,
 MonadBaseControl IO m) =>
DCAddAgent -> m EncJSON
runAddDataConnectorAgent DCAddAgent
q
  RMDCDeleteAgent DCDeleteAgent
q -> DCDeleteAgent -> m EncJSON
forall (m :: * -> *).
(CacheRWM m, MetadataM m, MonadError QErr m) =>
DCDeleteAgent -> m EncJSON
runDeleteDataConnectorAgent DCDeleteAgent
q
  RMSetCustomTypes CustomTypes
q -> CustomTypes -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
CustomTypes -> m EncJSON
runSetCustomTypes CustomTypes
q
  RMSetApiLimits ApiLimit
q -> ApiLimit -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m, MonadGetPolicies m) =>
ApiLimit -> m EncJSON
runSetApiLimits ApiLimit
q
  RQLMetadataV1
RMRemoveApiLimits -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
m EncJSON
runRemoveApiLimits
  RMSetMetricsConfig MetricsConfig
q -> MetricsConfig -> m EncJSON
forall (m :: * -> *).
(MonadIO m, CacheRWM m, MetadataM m, MonadError QErr m) =>
MetricsConfig -> m EncJSON
runSetMetricsConfig MetricsConfig
q
  RQLMetadataV1
RMRemoveMetricsConfig -> m EncJSON
forall (m :: * -> *).
(MonadIO m, CacheRWM m, MetadataM m, MonadError QErr m) =>
m EncJSON
runRemoveMetricsConfig
  RMAddInheritedRole InheritedRole
q -> InheritedRole -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
InheritedRole -> m EncJSON
runAddInheritedRole InheritedRole
q
  RMDropInheritedRole DropInheritedRole
q -> DropInheritedRole -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, CacheRWM m, MetadataM m) =>
DropInheritedRole -> m EncJSON
runDropInheritedRole DropInheritedRole
q
  RMReplaceMetadata ReplaceMetadata
q -> ReplaceMetadata -> m EncJSON
forall (m :: * -> *) r.
(CacheRWM m, MetadataM m, MonadIO m, MonadBaseControl IO m,
 MonadMetadataStorage m, MonadReader r m, MonadError QErr m,
 Has (Logger Hasura) r, MonadEventLogCleanup m,
 MonadGetPolicies m) =>
ReplaceMetadata -> m EncJSON
runReplaceMetadata ReplaceMetadata
q
  RMExportMetadata ExportMetadata
q -> ExportMetadata -> m EncJSON
forall (m :: * -> *).
(QErrM m, MetadataM m) =>
ExportMetadata -> m EncJSON
runExportMetadata ExportMetadata
q
  RMClearMetadata ClearMetadata
q -> ClearMetadata -> m EncJSON
forall (m :: * -> *) r.
(MonadIO m, CacheRWM m, MetadataM m, MonadMetadataStorage m,
 MonadBaseControl IO m, MonadReader r m, MonadError QErr m,
 Has (Logger Hasura) r, MonadEventLogCleanup m,
 MonadGetPolicies m) =>
ClearMetadata -> m EncJSON
runClearMetadata ClearMetadata
q
  RMReloadMetadata ReloadMetadata
q -> ReloadMetadata -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
ReloadMetadata -> m EncJSON
runReloadMetadata ReloadMetadata
q
  RMGetInconsistentMetadata GetInconsistentMetadata
q -> GetInconsistentMetadata -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRM m) =>
GetInconsistentMetadata -> m EncJSON
runGetInconsistentMetadata GetInconsistentMetadata
q
  RMDropInconsistentMetadata DropInconsistentMetadata
q -> DropInconsistentMetadata -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
DropInconsistentMetadata -> m EncJSON
runDropInconsistentMetadata DropInconsistentMetadata
q
  RMSetGraphqlSchemaIntrospectionOptions SetGraphqlIntrospectionOptions
q -> SetGraphqlIntrospectionOptions -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
SetGraphqlIntrospectionOptions -> m EncJSON
runSetGraphqlSchemaIntrospectionOptions SetGraphqlIntrospectionOptions
q
  RMAddHostToTLSAllowlist AddHostToTLSAllowlist
q -> AddHostToTLSAllowlist -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
AddHostToTLSAllowlist -> m EncJSON
runAddHostToTLSAllowlist AddHostToTLSAllowlist
q
  RMDropHostFromTLSAllowlist DropHostFromTLSAllowlist
q -> DropHostFromTLSAllowlist -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
DropHostFromTLSAllowlist -> m EncJSON
runDropHostFromTLSAllowlist DropHostFromTLSAllowlist
q
  RMDumpInternalState DumpInternalState
q -> DumpInternalState -> m EncJSON
forall (m :: * -> *).
(QErrM m, CacheRM m) =>
DumpInternalState -> m EncJSON
runDumpInternalState DumpInternalState
q
  RMGetCatalogState GetCatalogState
q -> GetCatalogState -> m EncJSON
forall (m :: * -> *).
(MonadMetadataStorage m, MonadError QErr m) =>
GetCatalogState -> m EncJSON
runGetCatalogState GetCatalogState
q
  RMSetCatalogState SetCatalogState
q -> SetCatalogState -> m EncJSON
forall (m :: * -> *).
(MonadMetadataStorage m, MonadError QErr m) =>
SetCatalogState -> m EncJSON
runSetCatalogState SetCatalogState
q
  RMTestWebhookTransform Unvalidated TestWebhookTransform
q ->
    LensLike
  m
  (Unvalidated TestWebhookTransform)
  (Unvalidated TestWebhookTransform)
  RequestTransform
  RequestTransform
-> LensLike
     m
     (Unvalidated TestWebhookTransform)
     (Unvalidated TestWebhookTransform)
     MetadataResponseTransform
     MetadataResponseTransform
-> (Unvalidated TestWebhookTransform -> m EncJSON)
-> Unvalidated TestWebhookTransform
-> m EncJSON
forall (m :: * -> *) api.
MonadError QErr m =>
LensLike m api api RequestTransform RequestTransform
-> LensLike
     m api api MetadataResponseTransform MetadataResponseTransform
-> (api -> m EncJSON)
-> api
-> m EncJSON
validateTransforms
      ((TestWebhookTransform -> m TestWebhookTransform)
-> Unvalidated TestWebhookTransform
-> m (Unvalidated TestWebhookTransform)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((TestWebhookTransform -> m TestWebhookTransform)
 -> Unvalidated TestWebhookTransform
 -> m (Unvalidated TestWebhookTransform))
-> ((RequestTransform -> m RequestTransform)
    -> TestWebhookTransform -> m TestWebhookTransform)
-> LensLike
     m
     (Unvalidated TestWebhookTransform)
     (Unvalidated TestWebhookTransform)
     RequestTransform
     RequestTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RequestTransform -> m RequestTransform)
-> TestWebhookTransform -> m TestWebhookTransform
Lens' TestWebhookTransform RequestTransform
twtRequestTransformer)
      ((TestWebhookTransform -> m TestWebhookTransform)
-> Unvalidated TestWebhookTransform
-> m (Unvalidated TestWebhookTransform)
forall a (f :: * -> *).
Functor f =>
(a -> f a) -> Unvalidated a -> f (Unvalidated a)
unUnvalidate ((TestWebhookTransform -> m TestWebhookTransform)
 -> Unvalidated TestWebhookTransform
 -> m (Unvalidated TestWebhookTransform))
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> TestWebhookTransform -> m TestWebhookTransform)
-> LensLike
     m
     (Unvalidated TestWebhookTransform)
     (Unvalidated TestWebhookTransform)
     MetadataResponseTransform
     MetadataResponseTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe MetadataResponseTransform
 -> m (Maybe MetadataResponseTransform))
-> TestWebhookTransform -> m TestWebhookTransform
Lens' TestWebhookTransform (Maybe MetadataResponseTransform)
twtResponseTransformer ((Maybe MetadataResponseTransform
  -> m (Maybe MetadataResponseTransform))
 -> TestWebhookTransform -> m TestWebhookTransform)
-> ((MetadataResponseTransform -> m MetadataResponseTransform)
    -> Maybe MetadataResponseTransform
    -> m (Maybe MetadataResponseTransform))
-> (MetadataResponseTransform -> m MetadataResponseTransform)
-> TestWebhookTransform
-> m TestWebhookTransform
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MetadataResponseTransform -> m MetadataResponseTransform)
-> Maybe MetadataResponseTransform
-> m (Maybe MetadataResponseTransform)
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
_Just)
      (TestWebhookTransform -> m EncJSON
forall (m :: * -> *). QErrM m => TestWebhookTransform -> m EncJSON
runTestWebhookTransform (TestWebhookTransform -> m EncJSON)
-> (Unvalidated TestWebhookTransform -> TestWebhookTransform)
-> Unvalidated TestWebhookTransform
-> m EncJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unvalidated TestWebhookTransform -> TestWebhookTransform
forall a. Unvalidated a -> a
_unUnvalidate)
      Unvalidated TestWebhookTransform
q
  RMSetQueryTagsConfig SetQueryTagsConfig
q -> SetQueryTagsConfig -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
SetQueryTagsConfig -> m EncJSON
runSetQueryTagsConfig SetQueryTagsConfig
q
  RMSetOpenTelemetryConfig OpenTelemetryConfig
q -> OpenTelemetryConfig -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
OpenTelemetryConfig -> m EncJSON
runSetOpenTelemetryConfig OpenTelemetryConfig
q
  RMSetOpenTelemetryStatus OtelStatus
q -> OtelStatus -> m EncJSON
forall (m :: * -> *).
(MonadError QErr m, MetadataM m, CacheRWM m) =>
OtelStatus -> m EncJSON
runSetOpenTelemetryStatus OtelStatus
q
  RMBulk [RQLMetadataRequest]
q -> [EncJSON] -> EncJSON
encJFromList ([EncJSON] -> EncJSON) -> m [EncJSON] -> m EncJSON
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RQLMetadataRequest -> m EncJSON)
-> [RQLMetadataRequest] -> m [EncJSON]
forall (m :: * -> *) a b. QErrM m => (a -> m b) -> [a] -> m [b]
indexedMapM (Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
runMetadataQueryM Environment
env CheckFeatureFlag
checkFeatureFlag RemoteSchemaPermissions
remoteSchemaPerms MetadataResourceVersion
currentResourceVersion) [RQLMetadataRequest]
q
  RMBulkKeepGoing [RQLMetadataRequest]
commands -> do
    [EncJSON]
results <-
      [RQLMetadataRequest]
commands [RQLMetadataRequest]
-> ([RQLMetadataRequest] -> m [EncJSON]) -> m [EncJSON]
forall a b. a -> (a -> b) -> b
& (RQLMetadataRequest -> m EncJSON)
-> [RQLMetadataRequest] -> m [EncJSON]
forall (m :: * -> *) a b. QErrM m => (a -> m b) -> [a] -> m [b]
indexedMapM \RQLMetadataRequest
command ->
        Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
forall (m :: * -> *) r.
(MonadIO m, MonadBaseControl IO m, CacheRWM m, MonadTrace m,
 UserInfoM m, MetadataM m, MonadMetadataStorage m, MonadReader r m,
 Has (Logger Hasura) r, MonadError QErr m, MonadEventLogCleanup m,
 ProvidesHasuraServices m, MonadGetPolicies m,
 HasFeatureFlagChecker m) =>
Environment
-> CheckFeatureFlag
-> RemoteSchemaPermissions
-> MetadataResourceVersion
-> RQLMetadataRequest
-> m EncJSON
runMetadataQueryM Environment
env CheckFeatureFlag
checkFeatureFlag RemoteSchemaPermissions
remoteSchemaPerms MetadataResourceVersion
currentResourceVersion RQLMetadataRequest
command
          -- Because changes to the metadata are maintained in MetadataT, which is a state monad
          -- that is layered above the QErr error monad, this catchError causes any changes to
          -- the metadata made during running the failed API function to be rolled back
          m EncJSON -> (QErr -> m EncJSON) -> m EncJSON
forall a. m a -> (QErr -> m a) -> m a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
`catchError` \QErr
qerr -> EncJSON -> m EncJSON
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (QErr -> EncJSON
forall a. ToJSON a => a -> EncJSON
encJFromJValue QErr
qerr)

    EncJSON -> m EncJSON
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([EncJSON] -> EncJSON
encJFromList [EncJSON]
results)
  RMBulkAtomic [RQLMetadataRequest]
commands -> [RQLMetadataRequest] -> m EncJSON
forall (m :: * -> *).
(HasFeatureFlagChecker m, MonadError QErr m, CacheRWM m,
 MetadataM m) =>
[RQLMetadataRequest] -> m EncJSON
runBulkAtomic [RQLMetadataRequest]
commands
  where
    dispatchEventTrigger :: (forall b. (BackendEventTrigger b) => i b -> a) -> AnyBackend i -> a
    dispatchEventTrigger :: forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendEventTrigger b => i b -> a)
-> AnyBackend i -> a
dispatchEventTrigger forall (b :: BackendType). BackendEventTrigger b => i b -> a
f AnyBackend i
x = forall (c :: BackendType -> Constraint) (i :: BackendType -> *) r.
AllBackendsSatisfy c =>
AnyBackend i -> (forall (b :: BackendType). c b => i b -> r) -> r
dispatchAnyBackend @BackendEventTrigger AnyBackend i
x i b -> a
forall (b :: BackendType). BackendEventTrigger b => i b -> a
f

    dispatchMetadataAndEventTrigger ::
      (forall b. (BackendMetadata b, BackendEventTrigger b) => i b -> a) ->
      AnyBackend i ->
      a
    dispatchMetadataAndEventTrigger :: forall (i :: BackendType -> *) a.
(forall (b :: BackendType).
 (BackendMetadata b, BackendEventTrigger b) =>
 i b -> a)
-> AnyBackend i -> a
dispatchMetadataAndEventTrigger forall (b :: BackendType).
(BackendMetadata b, BackendEventTrigger b) =>
i b -> a
f AnyBackend i
x = forall (c1 :: BackendType -> Constraint)
       (c2 :: BackendType -> Constraint) (i :: BackendType -> *) r.
(AllBackendsSatisfy c1, AllBackendsSatisfy c2) =>
AnyBackend i
-> (forall (b :: BackendType). (c1 b, c2 b) => i b -> r) -> r
dispatchAnyBackendWithTwoConstraints @BackendMetadata @BackendEventTrigger AnyBackend i
x i b -> a
forall (b :: BackendType).
(BackendMetadata b, BackendEventTrigger b) =>
i b -> a
f

dispatchMetadata ::
  (forall b. (BackendMetadata b) => i b -> a) ->
  AnyBackend i ->
  a
dispatchMetadata :: forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata forall (b :: BackendType). BackendMetadata b => i b -> a
f AnyBackend i
x = forall (c :: BackendType -> Constraint) (i :: BackendType -> *) r.
AllBackendsSatisfy c =>
AnyBackend i -> (forall (b :: BackendType). c b => i b -> r) -> r
dispatchAnyBackend @BackendMetadata AnyBackend i
x i b -> a
forall (b :: BackendType). BackendMetadata b => i b -> a
f

-- | the atomic commands work slightly differently
-- each one just returns the metadata modifier, we then chain them all and
-- run the schema cache validation once. This allows us to combine drop and
-- re-add commands to do edits, or add two interdependent items at once.
runBulkAtomic ::
  forall m.
  ( HasFeatureFlagChecker m,
    MonadError QErr m,
    CacheRWM m,
    MetadataM m
  ) =>
  [RQLMetadataRequest] ->
  m EncJSON
runBulkAtomic :: forall (m :: * -> *).
(HasFeatureFlagChecker m, MonadError QErr m, CacheRWM m,
 MetadataM m) =>
[RQLMetadataRequest] -> m EncJSON
runBulkAtomic [RQLMetadataRequest]
cmds = do
  -- get the metadata modifiers for all our commands
  ([Metadata -> m Metadata]
mdModifiers :: [Metadata -> m Metadata]) <- do
    ([Metadata -> m MetadataModifier]
mods :: [Metadata -> m MetadataModifier]) <- (RQLMetadataRequest -> m (Metadata -> m MetadataModifier))
-> [RQLMetadataRequest] -> m [Metadata -> m MetadataModifier]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse RQLMetadataRequest -> m (Metadata -> m MetadataModifier)
getMetadataModifierForCommand [RQLMetadataRequest]
cmds
    [Metadata -> m Metadata] -> m [Metadata -> m Metadata]
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
      ([Metadata -> m Metadata] -> m [Metadata -> m Metadata])
-> [Metadata -> m Metadata] -> m [Metadata -> m Metadata]
forall a b. (a -> b) -> a -> b
$ ((Metadata -> m MetadataModifier) -> Metadata -> m Metadata)
-> [Metadata -> m MetadataModifier] -> [Metadata -> m Metadata]
forall a b. (a -> b) -> [a] -> [b]
map
        ( \Metadata -> m MetadataModifier
checker Metadata
metadata -> do
            MetadataModifier Metadata -> Metadata
modifier <- Metadata -> m MetadataModifier
checker Metadata
metadata
            Metadata -> m Metadata
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Metadata -> m Metadata) -> Metadata -> m Metadata
forall a b. (a -> b) -> a -> b
$ Metadata -> Metadata
modifier Metadata
metadata
        )
        [Metadata -> m MetadataModifier]
mods

  -- Try building the schema cache using the combined modifiers. If we run into
  -- any inconsistencies, we should fail and roll back.
  HashMap MetadataObjId (NonEmpty InconsistentMetadata)
inconsistencies <- [Metadata -> m Metadata]
-> m (HashMap MetadataObjId (NonEmpty InconsistentMetadata))
forall (m :: * -> *).
(CacheRWM m, MetadataM m) =>
[Metadata -> m Metadata]
-> m (HashMap MetadataObjId (NonEmpty InconsistentMetadata))
tryBuildSchemaCacheWithModifiers [Metadata -> m Metadata]
mdModifiers

  Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (HashMap MetadataObjId (NonEmpty InconsistentMetadata) -> Bool
forall a. HashMap MetadataObjId a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null HashMap MetadataObjId (NonEmpty InconsistentMetadata)
inconsistencies)
    (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ Code -> Text -> Value -> m ()
forall (m :: * -> *) a. QErrM m => Code -> Text -> Value -> m a
throw400WithDetail Code
BadRequest Text
"Schema inconsistency"
    (Value -> m ()) -> Value -> m ()
forall a b. (a -> b) -> a -> b
$ [NonEmpty InconsistentMetadata] -> Value
forall a. ToJSON a => a -> Value
toJSON (HashMap MetadataObjId (NonEmpty InconsistentMetadata)
-> [NonEmpty InconsistentMetadata]
forall k v. HashMap k v -> [v]
HashMap.elems HashMap MetadataObjId (NonEmpty InconsistentMetadata)
inconsistencies)

  EncJSON -> m EncJSON
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EncJSON
successMsg
  where
    forgetMetadataObjId ::
      (command -> Metadata -> m (MetadataObjId, MetadataModifier)) ->
      command ->
      Metadata ->
      m MetadataModifier
    forgetMetadataObjId :: forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId command -> Metadata -> m (MetadataObjId, MetadataModifier)
f command
x Metadata
y = ((MetadataObjId, MetadataModifier) -> MetadataModifier)
-> m (MetadataObjId, MetadataModifier) -> m MetadataModifier
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (MetadataObjId, MetadataModifier) -> MetadataModifier
forall a b. (a, b) -> b
snd (command -> Metadata -> m (MetadataObjId, MetadataModifier)
f command
x Metadata
y)

    getMetadataModifierForCommand :: RQLMetadataRequest -> m (Metadata -> m MetadataModifier)
    getMetadataModifierForCommand :: RQLMetadataRequest -> m (Metadata -> m MetadataModifier)
getMetadataModifierForCommand = \case
      RMV1 RQLMetadataV1
v -> case RQLMetadataV1
v of
        -- Whoa there, cowboy! Chances are you're here to add table tracking to
        -- the list of things that bulk_atomic can do. Before you do that,
        -- though, there is a big, particularly-Citus-shaped problem you might
        -- need to consider:
        --
        -- \* There are specific validation rules around how Citus handles
        --   relationships (see 'validateRel' in 'PostgresMetadata'), which
        --   will either need to be deferred until the end of the bulk /or/
        --   moved to the schema cache.
        -- \* This would also introduce the possibility of a table state that is
        --   eventually consistent but currently inconsistent: I add table X, a
        --   relationship between X and Y, and then I add table Y. Currently,
        --   this can't be done, so all validation checks in
        --   'execCreateRelationship' and 'execDropRelationship' remain as they
        --   are in the @run@ versions.

        RMCreateObjectRelationship AnyBackend CreateObjRel
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 CreateObjRel b -> Metadata -> m MetadataModifier)
-> AnyBackend CreateObjRel -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((CreateObjRel b -> Metadata -> m (MetadataObjId, MetadataModifier))
-> CreateObjRel b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId ((CreateObjRel b
  -> Metadata -> m (MetadataObjId, MetadataModifier))
 -> CreateObjRel b -> Metadata -> m MetadataModifier)
-> (CreateObjRel b
    -> Metadata -> m (MetadataObjId, MetadataModifier))
-> CreateObjRel b
-> Metadata
-> m MetadataModifier
forall a b. (a -> b) -> a -> b
$ RelType
-> WithTable b (RelDef (ObjRelUsing b))
-> Metadata
-> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *) a.
(BackendMetadata b, CacheRM m, MonadError QErr m, ToJSON a) =>
RelType
-> WithTable b (RelDef a)
-> Metadata
-> m (MetadataObjId, MetadataModifier)
execCreateRelationship RelType
ObjRel (WithTable b (RelDef (ObjRelUsing b))
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> (CreateObjRel b -> WithTable b (RelDef (ObjRelUsing b)))
-> CreateObjRel b
-> Metadata
-> m (MetadataObjId, MetadataModifier)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateObjRel b -> WithTable b (RelDef (ObjRelUsing b))
forall (b :: BackendType).
CreateObjRel b -> WithTable b (ObjRelDef b)
unCreateObjRel) AnyBackend CreateObjRel
q
        RMCreateArrayRelationship AnyBackend CreateArrRel
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 CreateArrRel b -> Metadata -> m MetadataModifier)
-> AnyBackend CreateArrRel -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((CreateArrRel b -> Metadata -> m (MetadataObjId, MetadataModifier))
-> CreateArrRel b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId ((CreateArrRel b
  -> Metadata -> m (MetadataObjId, MetadataModifier))
 -> CreateArrRel b -> Metadata -> m MetadataModifier)
-> (CreateArrRel b
    -> Metadata -> m (MetadataObjId, MetadataModifier))
-> CreateArrRel b
-> Metadata
-> m MetadataModifier
forall a b. (a -> b) -> a -> b
$ RelType
-> WithTable b (RelDef (ArrRelUsing b))
-> Metadata
-> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *) a.
(BackendMetadata b, CacheRM m, MonadError QErr m, ToJSON a) =>
RelType
-> WithTable b (RelDef a)
-> Metadata
-> m (MetadataObjId, MetadataModifier)
execCreateRelationship RelType
ArrRel (WithTable b (RelDef (ArrRelUsing b))
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> (CreateArrRel b -> WithTable b (RelDef (ArrRelUsing b)))
-> CreateArrRel b
-> Metadata
-> m (MetadataObjId, MetadataModifier)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateArrRel b -> WithTable b (RelDef (ArrRelUsing b))
forall (b :: BackendType).
CreateArrRel b -> WithTable b (ArrRelDef b)
unCreateArrRel) AnyBackend CreateArrRel
q
        RMDropRelationship AnyBackend DropRel
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 DropRel b -> Metadata -> m MetadataModifier)
-> AnyBackend DropRel -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata (m MetadataModifier -> Metadata -> m MetadataModifier
forall a b. a -> b -> a
const (m MetadataModifier -> Metadata -> m MetadataModifier)
-> (DropRel b -> m MetadataModifier)
-> DropRel b
-> Metadata
-> m MetadataModifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DropRel b -> m MetadataModifier
forall (b :: BackendType) (m :: * -> *).
(MonadError QErr m, CacheRWM m, BackendMetadata b) =>
DropRel b -> m MetadataModifier
execDropRel) AnyBackend DropRel
q
        RMDeleteRemoteRelationship AnyBackend DeleteFromSourceRelationship
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 DeleteFromSourceRelationship b -> Metadata -> m MetadataModifier)
-> AnyBackend DeleteFromSourceRelationship
-> Metadata
-> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((DeleteFromSourceRelationship b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> DeleteFromSourceRelationship b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId ((DeleteFromSourceRelationship b
  -> Metadata -> m (MetadataObjId, MetadataModifier))
 -> DeleteFromSourceRelationship b
 -> Metadata
 -> m MetadataModifier)
-> (DeleteFromSourceRelationship b
    -> Metadata -> m (MetadataObjId, MetadataModifier))
-> DeleteFromSourceRelationship b
-> Metadata
-> m MetadataModifier
forall a b. (a -> b) -> a -> b
$ m (MetadataObjId, MetadataModifier)
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall a b. a -> b -> a
const (m (MetadataObjId, MetadataModifier)
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> (DeleteFromSourceRelationship b
    -> m (MetadataObjId, MetadataModifier))
-> DeleteFromSourceRelationship b
-> Metadata
-> m (MetadataObjId, MetadataModifier)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DeleteFromSourceRelationship b
-> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m, CacheRWM m) =>
DeleteFromSourceRelationship b
-> m (MetadataObjId, MetadataModifier)
execDeleteRemoteRelationship) AnyBackend DeleteFromSourceRelationship
q
        RMTrackNativeQuery AnyBackend TrackNativeQuery
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 TrackNativeQuery b -> Metadata -> m MetadataModifier)
-> AnyBackend TrackNativeQuery -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((TrackNativeQuery b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> TrackNativeQuery b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId TrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
TrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
NativeQueries.execTrackNativeQuery) AnyBackend TrackNativeQuery
q
        RMUntrackNativeQuery AnyBackend UntrackNativeQuery
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 UntrackNativeQuery b -> Metadata -> m MetadataModifier)
-> AnyBackend UntrackNativeQuery -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((UntrackNativeQuery b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> UntrackNativeQuery b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId UntrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
UntrackNativeQuery b
-> Metadata -> m (MetadataObjId, MetadataModifier)
NativeQueries.execUntrackNativeQuery) AnyBackend UntrackNativeQuery
q
        RMTrackLogicalModel AnyBackend TrackLogicalModel
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 TrackLogicalModel b -> Metadata -> m MetadataModifier)
-> AnyBackend TrackLogicalModel -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((TrackLogicalModel b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> TrackLogicalModel b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId TrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
TrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
LogicalModel.execTrackLogicalModel) AnyBackend TrackLogicalModel
q
        RMUntrackLogicalModel AnyBackend UntrackLogicalModel
q -> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Metadata -> m MetadataModifier)
 -> m (Metadata -> m MetadataModifier))
-> (Metadata -> m MetadataModifier)
-> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ (forall (b :: BackendType).
 BackendMetadata b =>
 UntrackLogicalModel b -> Metadata -> m MetadataModifier)
-> AnyBackend UntrackLogicalModel -> Metadata -> m MetadataModifier
forall (i :: BackendType -> *) a.
(forall (b :: BackendType). BackendMetadata b => i b -> a)
-> AnyBackend i -> a
dispatchMetadata ((UntrackLogicalModel b
 -> Metadata -> m (MetadataObjId, MetadataModifier))
-> UntrackLogicalModel b -> Metadata -> m MetadataModifier
forall command.
(command -> Metadata -> m (MetadataObjId, MetadataModifier))
-> command -> Metadata -> m MetadataModifier
forgetMetadataObjId UntrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
forall (b :: BackendType) (m :: * -> *).
(BackendMetadata b, MonadError QErr m) =>
UntrackLogicalModel b
-> Metadata -> m (MetadataObjId, MetadataModifier)
LogicalModel.execUntrackLogicalModel) AnyBackend UntrackLogicalModel
q
        RQLMetadataV1
_ -> Text -> m (Metadata -> m MetadataModifier)
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500 Text
"Bulk atomic does not support this command"
      RMV2 RQLMetadataV2
_ -> Text -> m (Metadata -> m MetadataModifier)
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500 (Text -> m (Metadata -> m MetadataModifier))
-> Text -> m (Metadata -> m MetadataModifier)
forall a b. (a -> b) -> a -> b
$ Text
"Bulk atomic does not support this command"

runMetadataQueryV2M ::
  ( MonadIO m,
    CacheRWM m,
    MonadBaseControl IO m,
    MetadataM m,
    MonadMetadataStorage m,
    MonadReader r m,
    Has (L.Logger L.Hasura) r,
    MonadError QErr m,
    MonadEventLogCleanup m,
    MonadGetPolicies m
  ) =>
  MetadataResourceVersion ->
  RQLMetadataV2 ->
  m EncJSON
runMetadataQueryV2M :: forall (m :: * -> *) r.
(MonadIO m, CacheRWM m, MonadBaseControl IO m, MetadataM m,
 MonadMetadataStorage m, MonadReader r m, Has (Logger Hasura) r,
 MonadError QErr m, MonadEventLogCleanup m, MonadGetPolicies m) =>
MetadataResourceVersion -> RQLMetadataV2 -> m EncJSON
runMetadataQueryV2M MetadataResourceVersion
currentResourceVersion = \case
  RMV2ReplaceMetadata ReplaceMetadataV2
q -> ReplaceMetadataV2 -> m EncJSON
forall (m :: * -> *) r.
(CacheRWM m, MetadataM m, MonadIO m, MonadBaseControl IO m,
 MonadMetadataStorage m, MonadReader r m, MonadError QErr m,
 Has (Logger Hasura) r, MonadEventLogCleanup m,
 MonadGetPolicies m) =>
ReplaceMetadataV2 -> m EncJSON
runReplaceMetadataV2 ReplaceMetadataV2
q
  RMV2ExportMetadata ExportMetadata
q -> MetadataResourceVersion -> ExportMetadata -> m EncJSON
forall (m :: * -> *).
(QErrM m, MetadataM m) =>
MetadataResourceVersion -> ExportMetadata -> m EncJSON
runExportMetadataV2 MetadataResourceVersion
currentResourceVersion ExportMetadata
q

runSingleExec ::
  forall m request.
  ( MonadError QErr m,
    CacheRWM m,
    MetadataM m
  ) =>
  (request -> Metadata -> m (MetadataObjId, MetadataModifier)) ->
  request ->
  m EncJSON
runSingleExec :: forall (m :: * -> *) request.
(MonadError QErr m, CacheRWM m, MetadataM m) =>
(request -> Metadata -> m (MetadataObjId, MetadataModifier))
-> request -> m EncJSON
runSingleExec request -> Metadata -> m (MetadataObjId, MetadataModifier)
exec request
request = do
  Metadata
metadata <- m Metadata
forall (m :: * -> *). MetadataM m => m Metadata
getMetadata
  (MetadataObjId
obj, MetadataModifier
modifier) <- request -> Metadata -> m (MetadataObjId, MetadataModifier)
exec request
request Metadata
metadata
  MetadataObjId -> MetadataModifier -> m ()
forall (m :: * -> *).
(QErrM m, CacheRWM m, MetadataM m) =>
MetadataObjId -> MetadataModifier -> m ()
buildSchemaCacheFor MetadataObjId
obj MetadataModifier
modifier
  EncJSON -> m EncJSON
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EncJSON
successMsg