graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.RQL.Types.Metadata

Synopsis

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

Instances details
FromJSON MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

ToJSON MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Generic MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Associated Types

type Rep MetadataVersion :: Type -> Type #

Show MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Eq MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

type Rep MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

type Rep MetadataVersion = D1 ('MetaData "MetadataVersion" "Hasura.RQL.Types.Metadata" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "MVVersion1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MVVersion2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MVVersion3" 'PrefixI 'False) (U1 :: Type -> Type)))

data Metadata Source #

A complete GraphQL Engine metadata representation to be stored, exported/replaced via metadata queries.

Instances

Instances details
FromJSON Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

ToJSON Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Generic Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Associated Types

type Rep Metadata :: Type -> Type #

Methods

from :: Metadata -> Rep Metadata x #

to :: Rep Metadata x -> Metadata #

Show Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Eq Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

FromEnv Metadata Source # 
Instance details

Defined in Hasura.Server.Init.Env

Select Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Associated Types

type Selector Metadata :: Type -> Type Source #

Methods

select :: Selector Metadata b -> Metadata -> b Source #

type Rep Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

type Rep Metadata = D1 ('MetaData "Metadata" "Hasura.RQL.Types.Metadata" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "Metadata" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_metaSources") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Sources) :*: (S1 ('MetaSel ('Just "_metaRemoteSchemas") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RemoteSchemas) :*: S1 ('MetaSel ('Just "_metaQueryCollections") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 QueryCollections))) :*: ((S1 ('MetaSel ('Just "_metaAllowlist") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MetadataAllowlist) :*: S1 ('MetaSel ('Just "_metaCustomTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CustomTypes)) :*: (S1 ('MetaSel ('Just "_metaActions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Actions) :*: S1 ('MetaSel ('Just "_metaCronTriggers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CronTriggers)))) :*: (((S1 ('MetaSel ('Just "_metaRestEndpoints") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Endpoints) :*: S1 ('MetaSel ('Just "_metaApiLimits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ApiLimit)) :*: (S1 ('MetaSel ('Just "_metaMetricsConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MetricsConfig) :*: S1 ('MetaSel ('Just "_metaInheritedRoles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 InheritedRoles))) :*: ((S1 ('MetaSel ('Just "_metaSetGraphqlIntrospectionOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SetGraphqlIntrospectionOptions) :*: S1 ('MetaSel ('Just "_metaNetwork") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Network)) :*: (S1 ('MetaSel ('Just "_metaBackendConfigs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (BackendMap BackendConfigWrapper)) :*: S1 ('MetaSel ('Just "_metaOpenTelemetryConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 OpenTelemetryConfig))))))
type Selector Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

newtype MetadataDefaults Source #

This type serves to allow Metadata arguments to be distinguished

overrideMetadataDefaults :: Metadata -> MetadataDefaults -> Metadata Source #

This acts like a Semigroup instance for Metadata, favouring the non-default Metadata

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.

Instances

Instances details
Monad m => MetadataM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

MetadataM m => MetadataM (TraceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

MetadataM m => MetadataM (ReaderT r m) Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

MetadataM m => MetadataM (StateT r m) Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

data MetadataNoSources Source #

Instances

Instances details
FromJSON MetadataNoSources Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

ToJSON MetadataNoSources Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Generic MetadataNoSources Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Associated Types

type Rep MetadataNoSources :: Type -> Type #

Eq MetadataNoSources Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

type Rep MetadataNoSources Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

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...

See: https://github.com/hasura/graphql-engine/issues/6348

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