Safe Haskell | Safe-Inferred |
---|---|
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
- _metaOpenTelemetryConfig :: OpenTelemetryConfig
- metaSources :: Lens' Metadata Sources
- metaSetGraphqlIntrospectionOptions :: Lens' Metadata SetGraphqlIntrospectionOptions
- metaRestEndpoints :: Lens' Metadata Endpoints
- metaRemoteSchemas :: Lens' Metadata RemoteSchemas
- metaQueryCollections :: Lens' Metadata QueryCollections
- metaOpenTelemetryConfig :: Lens' Metadata OpenTelemetryConfig
- 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
- newtype MetadataDefaults = MetadataDefaults Metadata
- emptyMetadataDefaults :: MetadataDefaults
- overrideMetadataDefaults :: Metadata -> MetadataDefaults -> Metadata
- tableMetadataSetter :: Backend b => SourceName -> TableName b -> ASetter' Metadata (TableMetadata b)
- functionMetadataSetter :: Backend b => SourceName -> FunctionName b -> ASetter' Metadata (FunctionMetadata b)
- logicalModelMetadataSetter :: Backend b => SourceName -> LogicalModelName -> ASetter' Metadata (LogicalModelMetadata b)
- nativeQueryMetadataSetter :: Backend b => SourceName -> NativeQueryName -> ASetter' Metadata (NativeQueryMetadata b)
- storedProcedureMetadataSetter :: Backend b => SourceName -> FunctionName b -> ASetter' Metadata (StoredProcedureMetadata 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
- dropNativeQueryRelationshipInMetadata :: RelName -> NativeQueryMetadata b -> NativeQueryMetadata b
- dropPermissionInMetadata :: RoleName -> PermType -> TableMetadata b -> TableMetadata b
- dropLogicalModelPermissionInMetadata :: RoleName -> PermType -> LogicalModelMetadata b -> LogicalModelMetadata 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
newtype MetadataDefaults Source #
This type serves to allow Metadata arguments to be distinguished
Instances
overrideMetadataDefaults :: Metadata -> MetadataDefaults -> Metadata Source #
This acts like a Semigroup instance for Metadata, favouring the non-default Metadata
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.
logicalModelMetadataSetter :: Backend b => SourceName -> LogicalModelName -> ASetter' Metadata (LogicalModelMetadata b) Source #
A lens setter for the metadata of a logical model as identified by the source name and root field name.
nativeQueryMetadataSetter :: Backend b => SourceName -> NativeQueryName -> ASetter' Metadata (NativeQueryMetadata b) Source #
A lens setter for the metadata of a native query as identified by the source name and root field name.
storedProcedureMetadataSetter :: Backend b => SourceName -> FunctionName b -> ASetter' Metadata (StoredProcedureMetadata b) Source #
A lens setter for the metadata of a stored procedure as identified by the source name and root field 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
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 (TraceT m) Source # | |
Defined in Hasura.RQL.Types.Metadata getMetadata :: TraceT m Metadata Source # putMetadata :: Metadata -> TraceT 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
newtype MetadataModifier Source #
Instances
Monoid MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata | |
Semigroup MetadataModifier Source # | |
Defined in Hasura.RQL.Types.Metadata (<>) :: MetadataModifier -> MetadataModifier -> MetadataModifier # sconcat :: NonEmpty MetadataModifier -> MetadataModifier # stimes :: Integral b => b -> MetadataModifier -> MetadataModifier # |
dropTableInMetadata :: forall b. Backend b => SourceName -> TableName b -> MetadataModifier Source #
dropRelationshipInMetadata :: RelName -> TableMetadata b -> TableMetadata b Source #
dropNativeQueryRelationshipInMetadata :: RelName -> NativeQueryMetadata b -> NativeQueryMetadata b Source #
dropPermissionInMetadata :: RoleName -> PermType -> TableMetadata b -> TableMetadata b Source #
dropLogicalModelPermissionInMetadata :: RoleName -> PermType -> LogicalModelMetadata b -> LogicalModelMetadata 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