Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Instances
A complete GraphQL Engine metadata representation to be stored, exported/replaced via metadata queries.
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.
getMetadata :: m Metadata Source #
putMetadata :: Metadata -> m () Source #
Instances
MetadataM m => MetadataM (TraceT m) Source # | |
Defined in Hasura.RQL.Types.Metadata getMetadata :: TraceT m Metadata Source # putMetadata :: Metadata -> TraceT m () Source # | |
Monad m => MetadataM (MetadataT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build getMetadata :: MetadataT m Metadata Source # putMetadata :: Metadata -> MetadataT m () Source # | |
MetadataM m => MetadataM (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.Metadata 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 getMetadata :: StateT r m Metadata Source # putMetadata :: Metadata -> StateT r m () Source # |
data MetadataNoSources Source #
Instances
Eq MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata (==) :: MetadataNoSources -> MetadataNoSources -> Bool # (/=) :: MetadataNoSources -> MetadataNoSources -> Bool # | |
FromJSON MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata parseJSON :: Value -> Parser MetadataNoSources parseJSONList :: Value -> Parser [MetadataNoSources] | |
ToJSON MetadataNoSources Source # | |
Defined in Hasura.RQL.Types.Metadata toJSON :: MetadataNoSources -> Value toEncoding :: MetadataNoSources -> Encoding toJSONList :: [MetadataNoSources] -> Value toEncodingList :: [MetadataNoSources] -> Encoding |
newtype MetadataModifier Source #
Instances
Semigroup MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata (<>) :: MetadataModifier -> MetadataModifier -> MetadataModifier # sconcat :: NonEmpty MetadataModifier -> MetadataModifier # stimes :: Integral b => b -> MetadataModifier -> MetadataModifier # | |
Monoid MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata |
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