graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
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
Eq MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Show 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 #

FromJSON MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Methods

parseJSON :: Value -> Parser MetadataVersion

parseJSONList :: Value -> Parser [MetadataVersion]

ToJSON MetadataVersion Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Methods

toJSON :: MetadataVersion -> Value

toEncoding :: MetadataVersion -> Encoding

toJSONList :: [MetadataVersion] -> Value

toEncodingList :: [MetadataVersion] -> Encoding

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
Eq Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Show 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 #

FromJSON Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Methods

parseJSON :: Value -> Parser Metadata

parseJSONList :: Value -> Parser [Metadata]

ToJSON Metadata Source # 
Instance details

Defined in Hasura.RQL.Types.Metadata

Methods

toJSON :: Metadata -> Value

toEncoding :: Metadata -> Encoding

toJSONList :: [Metadata] -> Value

toEncodingList :: [Metadata] -> Encoding

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

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

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

Defined in Hasura.RQL.Types.Metadata

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

Defined in Hasura.RQL.Types.SchemaCache.Build

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

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