| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Hasura.RQL.Types.Metadata
Synopsis
- data MetadataVersion
 - currentMetadataVersion :: MetadataVersion
 - data Metadata = Metadata {
- _metaSources :: Sources
 - _metaRemoteSchemas :: RemoteSchemas
 - _metaQueryCollections :: QueryCollections
 - _metaAllowlist :: MetadataAllowlist
 - _metaCustomTypes :: CustomTypes
 - _metaActions :: Actions
 - _metaCronTriggers :: CronTriggers
 - _metaRestEndpoints :: Endpoints
 - _metaApiLimits :: ApiLimit
 - _metaMetricsConfig :: MetricsConfig
 - _metaInheritedRoles :: InheritedRoles
 - _metaSetGraphqlIntrospectionOptions :: SetGraphqlIntrospectionOptions
 - _metaNetwork :: Network
 - _metaBackendConfigs :: BackendMap BackendConfigWrapper
 
 - metaSources :: Lens' Metadata Sources
 - metaSetGraphqlIntrospectionOptions :: Lens' Metadata SetGraphqlIntrospectionOptions
 - metaRestEndpoints :: Lens' Metadata Endpoints
 - metaRemoteSchemas :: Lens' Metadata RemoteSchemas
 - metaQueryCollections :: Lens' Metadata QueryCollections
 - metaNetwork :: Lens' Metadata Network
 - metaMetricsConfig :: Lens' Metadata MetricsConfig
 - metaInheritedRoles :: Lens' Metadata InheritedRoles
 - metaCustomTypes :: Lens' Metadata CustomTypes
 - metaCronTriggers :: Lens' Metadata CronTriggers
 - metaBackendConfigs :: Lens' Metadata (BackendMap BackendConfigWrapper)
 - metaApiLimits :: Lens' Metadata ApiLimit
 - metaAllowlist :: Lens' Metadata MetadataAllowlist
 - metaActions :: Lens' Metadata Actions
 - emptyMetadata :: Metadata
 - tableMetadataSetter :: Backend b => SourceName -> TableName b -> ASetter' Metadata (TableMetadata b)
 - functionMetadataSetter :: Backend b => SourceName -> FunctionName b -> ASetter' Metadata (FunctionMetadata b)
 - class Monad m => MetadataM m where
- getMetadata :: m Metadata
 - putMetadata :: Metadata -> m ()
 
 - data MetadataNoSources = MetadataNoSources {}
 - newtype MetadataModifier = MetadataModifier {}
 - dropTableInMetadata :: forall b. Backend b => SourceName -> TableName b -> MetadataModifier
 - dropRelationshipInMetadata :: RelName -> TableMetadata b -> TableMetadata b
 - dropPermissionInMetadata :: RoleName -> PermType -> TableMetadata b -> TableMetadata b
 - dropComputedFieldInMetadata :: ComputedFieldName -> TableMetadata b -> TableMetadata b
 - dropEventTriggerInMetadata :: TriggerName -> TableMetadata b -> TableMetadata b
 - dropRemoteRelationshipInMetadata :: RelName -> TableMetadata b -> TableMetadata b
 - dropFunctionInMetadata :: forall b. Backend b => SourceName -> FunctionName b -> MetadataModifier
 - dropRemoteSchemaInMetadata :: RemoteSchemaName -> MetadataModifier
 - dropRemoteSchemaPermissionInMetadata :: RemoteSchemaName -> RoleName -> MetadataModifier
 - dropRemoteSchemaRemoteRelationshipInMetadata :: RemoteSchemaName -> Name -> RelName -> MetadataModifier
 - metadataToOrdJSON :: Metadata -> Value
 - metadataToDTO :: Metadata -> MetadataV3
 
Documentation
data MetadataVersion Source #
Versioning the Metadata JSON structure to track backwards incompatible changes.
 This value is included in the metadata JSON object at top level version key.
 Always metadata is emitted in the latest version via export metadata API (runExportMetadata handler).
 Adding a new value constructor to @MetadataVersion type bumps the metadata version.
NOTE: When metadata version is bumped: 1. The Hasura CLI and Console actively use export metadata API to read metadata. Hence, it is necessary to update CLI and Console to read latest metadata. All changes SHOULD be released hand in hand (preferebly in one pull request) 2. There might be other third party services (developed by Hasura users) which use the export metadata API. Apart from changelog, we need to establish the metadata version update by bumping up the minor version of the GraphQL Engine.
Constructors
| MVVersion1 | |
| MVVersion2 | |
| MVVersion3 | 
Instances
A complete GraphQL Engine metadata representation to be stored, exported/replaced via metadata queries.
Constructors
Instances
metaSources :: Lens' Metadata Sources Source #
metaRestEndpoints :: Lens' Metadata Endpoints Source #
metaRemoteSchemas :: Lens' Metadata RemoteSchemas Source #
metaQueryCollections :: Lens' Metadata QueryCollections Source #
metaNetwork :: Lens' Metadata Network Source #
metaMetricsConfig :: Lens' Metadata MetricsConfig Source #
metaInheritedRoles :: Lens' Metadata InheritedRoles Source #
metaCustomTypes :: Lens' Metadata CustomTypes Source #
metaCronTriggers :: Lens' Metadata CronTriggers Source #
metaBackendConfigs :: Lens' Metadata (BackendMap BackendConfigWrapper) Source #
metaApiLimits :: Lens' Metadata ApiLimit Source #
metaAllowlist :: Lens' Metadata MetadataAllowlist Source #
metaActions :: Lens' Metadata Actions Source #
tableMetadataSetter :: Backend b => SourceName -> TableName b -> ASetter' Metadata (TableMetadata b) Source #
functionMetadataSetter :: Backend b => SourceName -> FunctionName b -> ASetter' Metadata (FunctionMetadata b) Source #
A lens setter for the metadata of a specific function as identified by the source name and function name.
class Monad m => MetadataM m where Source #
A simple monad class which enables fetching and setting @Metadata
 in the state.
Instances
| MetadataM m => MetadataM (TraceT m) Source # | |
Defined in Hasura.RQL.Types.Metadata  | |
| Monad m => MetadataM (MetadataT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build Methods getMetadata :: MetadataT m Metadata Source # putMetadata :: Metadata -> MetadataT m () Source #  | |
| MetadataM m => MetadataM (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.Metadata Methods getMetadata :: ReaderT r m Metadata Source # putMetadata :: Metadata -> ReaderT r m () Source #  | |
| MetadataM m => MetadataM (StateT r m) Source # | |
Defined in Hasura.RQL.Types.Metadata  | |
data MetadataNoSources Source #
Constructors
| MetadataNoSources | |
Instances
| Eq MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata Methods (==) :: MetadataNoSources -> MetadataNoSources -> Bool # (/=) :: MetadataNoSources -> MetadataNoSources -> Bool #  | |
| FromJSON MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata Methods parseJSON :: Value -> Parser MetadataNoSources parseJSONList :: Value -> Parser [MetadataNoSources]  | |
| ToJSON MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata Methods toJSON :: MetadataNoSources -> Value toEncoding :: MetadataNoSources -> Encoding toJSONList :: [MetadataNoSources] -> Value toEncodingList :: [MetadataNoSources] -> Encoding  | |
newtype MetadataModifier Source #
Constructors
| MetadataModifier | |
Fields  | |
Instances
| Semigroup MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata Methods (<>) :: MetadataModifier -> MetadataModifier -> MetadataModifier # sconcat :: NonEmpty MetadataModifier -> MetadataModifier # stimes :: Integral b => b -> MetadataModifier -> MetadataModifier #  | |
| Monoid MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata Methods mappend :: MetadataModifier -> MetadataModifier -> MetadataModifier # mconcat :: [MetadataModifier] -> MetadataModifier #  | |
dropTableInMetadata :: forall b. Backend b => SourceName -> TableName b -> MetadataModifier Source #
dropRelationshipInMetadata :: RelName -> TableMetadata b -> TableMetadata b Source #
dropPermissionInMetadata :: RoleName -> PermType -> TableMetadata b -> TableMetadata b Source #
dropEventTriggerInMetadata :: TriggerName -> TableMetadata b -> TableMetadata b Source #
dropRemoteRelationshipInMetadata :: RelName -> TableMetadata b -> TableMetadata b Source #
dropFunctionInMetadata :: forall b. Backend b => SourceName -> FunctionName b -> MetadataModifier Source #
dropRemoteSchemaRemoteRelationshipInMetadata :: RemoteSchemaName -> Name -> RelName -> MetadataModifier Source #
metadataToOrdJSON :: Metadata -> Value Source #
Encode Metadata to JSON with deterministic ordering (e.g. "version" being at the top).
 The CLI system stores metadata in files and has option to show changes in git diff style.
 The diff shouldn't appear different for no metadata changes. So, the ordering of object keys and
 array elements should  remain consistent across versions of graphql-engine if possible.
Note: While modifying any part of the code below, make sure the encoded JSON of each type is
 parsable via its FromJSON instance.
TODO: we can use 'aeson-pretty' to serialize in a consistent way, and to specify a (partial) order of keys, while getting the benefits of auto-generated To/FromJSON instances. `FromJSON TableMetadata` complicates this though...
metadataToDTO :: Metadata -> MetadataV3 Source #
Convert Metadata to a DTO for serialization. In the near future the plan
 is to use this function instead of the ToJSON instance of Metadata.
 For the time being DTO serialization does not match the same order of object
 keys as the ToJSON instance - we can't switch to using this function until
 that issue is resolved. See https://hasurahq.atlassian.net/browse/MM-29