mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
server: methods for loading and storing source introspection
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9087 GitOrigin-RevId: 702c29b09ea880c7b37b1979b60c18dae39ed8cf
This commit is contained in:
parent
d0acdcf414
commit
c963b4b46f
@ -783,6 +783,10 @@ instance MonadMetadataStorage AppM where
|
||||
getCatalogState = runInSeparateTx getCatalogStateTx
|
||||
setCatalogState a b = runInSeparateTx $ setCatalogStateTx a b
|
||||
|
||||
-- stored source introspection is not available in this distribution
|
||||
fetchSourceIntrospection _ = pure $ Right Nothing
|
||||
storeSourceIntrospection _ _ = pure $ Right ()
|
||||
|
||||
getMetadataDbUid = runInSeparateTx getDbId
|
||||
checkMetadataStorageHealth = runInSeparateTx $ checkDbConnection
|
||||
|
||||
|
@ -21,6 +21,7 @@ import Data.Aeson
|
||||
import Hasura.Base.Error
|
||||
import Hasura.Eventing.ScheduledTrigger.Types
|
||||
import Hasura.Prelude
|
||||
import Hasura.RQL.DDL.Schema.Cache.Common (StoredIntrospection)
|
||||
import Hasura.RQL.Types.Action
|
||||
import Hasura.RQL.Types.EECredentials
|
||||
import Hasura.RQL.Types.EventTrigger
|
||||
@ -105,6 +106,13 @@ class Monad m => MonadMetadataStorage m where
|
||||
-- it is disabled when maintenance mode is on
|
||||
setCatalogState :: CatalogStateType -> Value -> m (Either QErr ())
|
||||
|
||||
-- methods for storing and retrieving source introspection which is stored in
|
||||
-- "stored introspection" db. See 'StoredIntrospection'.
|
||||
-- This returns a @Maybe StoredIntrospection@ as in some distributions
|
||||
-- fetching of source introspection may not be available
|
||||
fetchSourceIntrospection :: MetadataResourceVersion -> m (Either QErr (Maybe StoredIntrospection))
|
||||
storeSourceIntrospection :: StoredIntrospection -> MetadataResourceVersion -> m (Either QErr ())
|
||||
|
||||
-- get the @db_uuid@ that we store in the database.
|
||||
getMetadataDbUid :: m (Either QErr MetadataDbId)
|
||||
checkMetadataStorageHealth :: m (Either QErr ())
|
||||
@ -154,6 +162,9 @@ instance (MonadMetadataStorage m, MonadTrans t, Monad (t m)) => MonadMetadataSto
|
||||
getCatalogState = lift getCatalogState
|
||||
setCatalogState a b = lift $ setCatalogState a b
|
||||
|
||||
fetchSourceIntrospection = lift . fetchSourceIntrospection
|
||||
storeSourceIntrospection a b = lift $ storeSourceIntrospection a b
|
||||
|
||||
getMetadataDbUid = lift getMetadataDbUid
|
||||
checkMetadataStorageHealth = lift checkMetadataStorageHealth
|
||||
|
||||
|
@ -46,7 +46,7 @@ where
|
||||
|
||||
import Control.Arrow.Extended
|
||||
import Control.Arrow.Interpret
|
||||
import Control.Lens
|
||||
import Control.Lens hiding ((.=))
|
||||
import Control.Monad.Trans.Control (MonadBaseControl)
|
||||
import Data.Aeson.Extended
|
||||
import Data.HashMap.Strict.Extended qualified as HashMap
|
||||
@ -179,6 +179,12 @@ instance FromJSON StoredIntrospection where
|
||||
remotes <- o .: "remotes"
|
||||
pure $ StoredIntrospection backendIntrospection remotes
|
||||
|
||||
instance ToJSON StoredIntrospection where
|
||||
toJSON _introspection =
|
||||
object
|
||||
[ "remotes" .= ("dummy" :: Text)
|
||||
]
|
||||
|
||||
data TableBuildInput b = TableBuildInput
|
||||
{ _tbiName :: TableName b,
|
||||
_tbiIsEnum :: Bool,
|
||||
|
Loading…
Reference in New Issue
Block a user