Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype MetadataResourceVersion = MetadataResourceVersion {}
- initialResourceVersion :: MetadataResourceVersion
- mkParentDep :: forall b. Backend b => SourceName -> TableName b -> SchemaDependency
- mkColDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> Column b -> SchemaDependency
- mkComputedFieldDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> ComputedFieldName -> SchemaDependency
- type WithDeps a = (a, [SchemaDependency])
- data IntrospectionResult = IntrospectionResult {
- irDoc :: RemoteSchemaIntrospection
- irQueryRoot :: Name
- irMutationRoot :: Maybe Name
- irSubscriptionRoot :: Maybe Name
- type RemoteSchemaRelationships = InsOrdHashMap Name (InsOrdHashMap RelName (RemoteFieldInfo Name))
- data RemoteSchemaCtx = RemoteSchemaCtx {}
- getIntrospectionResult :: RemoteSchemaPermissions -> RoleName -> RemoteSchemaCtx -> Maybe IntrospectionResult
- rscRemoteRelationships :: Lens' RemoteSchemaCtx RemoteSchemaRelationships
- rscRawIntrospectionResult :: Lens' RemoteSchemaCtx ByteString
- rscPermissions :: Lens' RemoteSchemaCtx (HashMap RoleName IntrospectionResult)
- rscName :: Lens' RemoteSchemaCtx RemoteSchemaName
- rscIntroOriginal :: Lens' RemoteSchemaCtx IntrospectionResult
- rscInfo :: Lens' RemoteSchemaCtx RemoteSchemaInfo
- type RemoteSchemaMap = HashMap RemoteSchemaName RemoteSchemaCtx
- type DepMap = HashMap SchemaObjId (HashSet SchemaDependency)
- data CronTriggerInfo = CronTriggerInfo {
- ctiName :: TriggerName
- ctiSchedule :: CronSchedule
- ctiPayload :: Maybe Value
- ctiRetryConf :: STRetryConf
- ctiWebhookInfo :: EnvRecord ResolvedWebhook
- ctiHeaders :: [EventHeaderInfo]
- ctiComment :: Maybe Text
- ctiRequestTransform :: Maybe RequestTransform
- ctiResponseTransform :: Maybe MetadataResponseTransform
- newtype SchemaCacheVer = SchemaCacheVer {}
- initSchemaCacheVer :: SchemaCacheVer
- incSchemaCacheVer :: SchemaCacheVer -> SchemaCacheVer
- type ActionCache = HashMap ActionName ActionInfo
- type InheritedRolesCache = HashMap RoleName (HashSet RoleName)
- askSourceInfo :: forall b m. (CacheRM m, MetadataM m, MonadError QErr m, Backend b) => SourceName -> m (SourceInfo b)
- askSourceConfig :: forall b m. (CacheRM m, MonadError QErr m, Backend b, MetadataM m) => SourceName -> m (SourceConfig b)
- unsafeTableCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (TableCache b)
- askTableCache :: forall b m. (Backend b, CacheRM m) => SourceName -> m (Maybe (TableCache b))
- unsafeTableInfo :: forall b. Backend b => SourceName -> TableName b -> SourceCache -> Maybe (TableInfo b)
- askTableInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableInfo b)
- askTableCoreInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableCoreInfo b)
- askTableFieldInfoMap :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (FieldInfoMap (FieldInfo b))
- askTableMetadata :: forall b m. (QErrM m, MetadataM m, Backend b) => SourceName -> TableName b -> m (TableMetadata b)
- unsafeFunctionCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (FunctionCache b)
- unsafeFunctionInfo :: forall b. Backend b => SourceName -> FunctionName b -> SourceCache -> Maybe (FunctionInfo b)
- askFunctionInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> FunctionName b -> m (FunctionInfo b)
- data SchemaCache = SchemaCache {
- scSources :: SourceCache
- scActions :: ActionCache
- scRemoteSchemas :: RemoteSchemaMap
- scAllowlist :: InlinedAllowlist
- scAdminIntrospection :: SchemaIntrospection
- scGQLContext :: HashMap RoleName (RoleContext GQLContext)
- scUnauthenticatedGQLContext :: GQLContext
- scRelayContext :: HashMap RoleName (RoleContext GQLContext)
- scUnauthenticatedRelayContext :: GQLContext
- scDepMap :: DepMap
- scInconsistentObjs :: [InconsistentMetadata]
- scCronTriggers :: HashMap TriggerName CronTriggerInfo
- scEndpoints :: EndpointTrie GQLQueryWithText
- scApiLimits :: ApiLimit
- scMetricsConfig :: MetricsConfig
- scMetadataResourceVersion :: Maybe MetadataResourceVersion
- scSetGraphqlIntrospectionOptions :: SetGraphqlIntrospectionOptions
- scTlsAllowlist :: [TlsAllow]
- scQueryCollections :: QueryCollections
- getAllRemoteSchemas :: SchemaCache -> [RemoteSchemaName]
- class Monad m => SourceM m where
- newtype SourceT m a = SourceT {
- runSourceT :: SourceName -> m a
- class SourceM m => TableCoreInfoRM b m where
- lookupTableCoreInfo :: TableName b -> m (Maybe (TableCoreInfo b))
- newtype TableCoreCacheRT b m a = TableCoreCacheRT {
- runTableCoreCacheRT :: (SourceName, Dependency (TableCoreCache b)) -> m a
- class TableCoreInfoRM b m => TableInfoRM b m where
- lookupTableInfo :: TableName b -> m (Maybe (TableInfo b))
- newtype TableCacheRT b m a = TableCacheRT {
- runTableCacheRT :: (SourceName, TableCache b) -> m a
- class Monad m => CacheRM m where
- getDependentObjs :: SchemaCache -> SchemaObjId -> [SchemaObjId]
- getDependentObjsWith :: (DependencyReason -> Bool) -> SchemaCache -> SchemaObjId -> [SchemaObjId]
- getRemoteDependencies :: SchemaCache -> SourceName -> [SchemaObjId]
- getBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> TableName b -> AnnBoolExpPartialSQL b -> [SchemaDependency]
- getBoolExpDeps' :: forall b. (Backend b, GetAggregationPredicatesDeps b) => AnnBoolExpPartialSQL b -> BoolExpM b [SchemaDependency]
- getColExpDeps :: forall b. (Backend b, GetAggregationPredicatesDeps b) => AnnBoolExpFld b (PartialSQLExp b) -> BoolExpM b [SchemaDependency]
- getOpExpDeps :: forall b. Backend b => [OpExpG b (PartialSQLExp b)] -> BoolExpM b [SchemaDependency]
- askFieldInfoMapSource :: (QErrM m, Backend b, TableCoreInfoRM b m) => TableName b -> m (FieldInfoMap (FieldInfo b))
Documentation
newtype MetadataResourceVersion Source #
Instances
mkParentDep :: forall b. Backend b => SourceName -> TableName b -> SchemaDependency Source #
mkColDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> Column b -> SchemaDependency Source #
mkComputedFieldDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> ComputedFieldName -> SchemaDependency Source #
type WithDeps a = (a, [SchemaDependency]) Source #
data IntrospectionResult Source #
IntrospectionResult | |
|
Instances
type RemoteSchemaRelationships = InsOrdHashMap Name (InsOrdHashMap RelName (RemoteFieldInfo Name)) Source #
data RemoteSchemaCtx Source #
See fetchRemoteSchema
.
RemoteSchemaCtx | |
|
Instances
ToJSON RemoteSchemaCtx Source # | |
Defined in Hasura.RQL.Types.SchemaCache toJSON :: RemoteSchemaCtx -> Value toEncoding :: RemoteSchemaCtx -> Encoding toJSONList :: [RemoteSchemaCtx] -> Value toEncodingList :: [RemoteSchemaCtx] -> Encoding |
getIntrospectionResult :: RemoteSchemaPermissions -> RoleName -> RemoteSchemaCtx -> Maybe IntrospectionResult Source #
rscPermissions :: Lens' RemoteSchemaCtx (HashMap RoleName IntrospectionResult) Source #
rscName :: Lens' RemoteSchemaCtx RemoteSchemaName Source #
rscInfo :: Lens' RemoteSchemaCtx RemoteSchemaInfo Source #
type RemoteSchemaMap = HashMap RemoteSchemaName RemoteSchemaCtx Source #
type DepMap = HashMap SchemaObjId (HashSet SchemaDependency) Source #
data CronTriggerInfo Source #
CronTriggerInfo | |
|
Instances
Eq CronTriggerInfo Source # | |
Defined in Hasura.RQL.Types.SchemaCache (==) :: CronTriggerInfo -> CronTriggerInfo -> Bool # (/=) :: CronTriggerInfo -> CronTriggerInfo -> Bool # | |
Show CronTriggerInfo Source # | |
Defined in Hasura.RQL.Types.SchemaCache showsPrec :: Int -> CronTriggerInfo -> ShowS # show :: CronTriggerInfo -> String # showList :: [CronTriggerInfo] -> ShowS # | |
ToJSON CronTriggerInfo Source # | |
Defined in Hasura.RQL.Types.SchemaCache toJSON :: CronTriggerInfo -> Value toEncoding :: CronTriggerInfo -> Encoding toJSONList :: [CronTriggerInfo] -> Value toEncodingList :: [CronTriggerInfo] -> Encoding |
newtype SchemaCacheVer Source #
Instances
type ActionCache = HashMap ActionName ActionInfo Source #
type InheritedRolesCache = HashMap RoleName (HashSet RoleName) Source #
askSourceInfo :: forall b m. (CacheRM m, MetadataM m, MonadError QErr m, Backend b) => SourceName -> m (SourceInfo b) Source #
Retrieves the source info for a given source name.
This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. This function must be used with a _type annotation_, such as `askSourceInfo @('Postgres 'Vanilla)`. It throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.
askSourceConfig :: forall b m. (CacheRM m, MonadError QErr m, Backend b, MetadataM m) => SourceName -> m (SourceConfig b) Source #
Retrieves the source config for a given source name.
This function relies on askSourceInfo
and similarly throws an error if the
source isn't found.
unsafeTableCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (TableCache b) Source #
Retrieves the table cache for a given source cache and source name.
This function must be used with a _type annotation_, such as
`unsafeTableCache ('Postgres 'Vanilla)`. It returns
Nothing@ if it fails to
find that source or if the kind of the source does not match the type
annotation, and does not distinguish between the two cases.
askTableCache :: forall b m. (Backend b, CacheRM m) => SourceName -> m (Maybe (TableCache b)) Source #
Retrieves the table cache for a given source name.
This function retrieves the schema cache from the monadic context, and
attempts to look the corresponding source up in the source cache. It must be
used with a _type annotation_, such as `unsafeTableCache ('Postgres
'Vanilla)`. It returns
Nothing@ if it fails to find that source or if the
kind of the source does not match the type annotation, and does not
distinguish between the two cases.
unsafeTableInfo :: forall b. Backend b => SourceName -> TableName b -> SourceCache -> Maybe (TableInfo b) Source #
Retrieves the information about a table from the source cache, the source name, and the table name.
This function returns Nothing
if it fails to find that source or if the
kind of the source does not match the type annotation, and does not
distinguish between the two cases.
askTableInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableInfo b) Source #
Retrieves the information about a table for a given source name and table name.
This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. it throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.
askTableCoreInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableCoreInfo b) Source #
Similar to askTableInfo
, but drills further down to extract the
underlying core info.
askTableFieldInfoMap :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (FieldInfoMap (FieldInfo b)) Source #
Similar to askTableCoreInfo
, but drills further down to extract the
underlying field info map.
askTableMetadata :: forall b m. (QErrM m, MetadataM m, Backend b) => SourceName -> TableName b -> m (TableMetadata b) Source #
Retrieves the metadata information about a table for a given source name and table name.
Unlike most other ask
functions in this module, this function does not
drill through the schema cache, and instead inspects the metadata. Like most
others, it throws an error if it fails to find that source, in which case it
looks that source up in the metadata, to differentiate between the source not
existing or the type of the source not matching.
unsafeFunctionCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (FunctionCache b) Source #
Retrieves the function cache for a given source cache and source name.
This function must be used with a _type annotation_, such as
`unsafeFunctionCache ('Postgres 'Vanilla)`. It returns
Nothing@ if it fails
to find that source or if the kind of the source does not match the type
annotation, and does not distinguish between the two cases.
unsafeFunctionInfo :: forall b. Backend b => SourceName -> FunctionName b -> SourceCache -> Maybe (FunctionInfo b) Source #
Retrieves the information about a function from the source cache, the source name, and the function name.
This function returns Nothing
if it fails to find that source or if the
kind of the source does not match the type annotation, and does not
distinguish between the two cases.
askFunctionInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> FunctionName b -> m (FunctionInfo b) Source #
Retrieves the information about a function cache for a given source name and function name.
This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. It throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.
data SchemaCache Source #
Instances
ToJSON SchemaCache Source # | |
Defined in Hasura.RQL.Types.SchemaCache toJSON :: SchemaCache -> Value toEncoding :: SchemaCache -> Encoding toJSONList :: [SchemaCache] -> Value toEncodingList :: [SchemaCache] -> Encoding |
class Monad m => SourceM m where Source #
Instances
SourceM m => SourceM (TraceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
Monad m => SourceM (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
SourceM m => SourceM (MetadataT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build | |
SourceM m => SourceM (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askCurrentSource :: ReaderT r m SourceName Source # | |
SourceM m => SourceM (StateT s m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askCurrentSource :: StateT s m SourceName Source # | |
(Monoid w, SourceM m) => SourceM (WriterT w m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askCurrentSource :: WriterT w m SourceName Source # | |
Monad m => SourceM (TableCacheRT b m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
Monad m => SourceM (TableCoreCacheRT b m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache |
SourceT | |
|
Instances
MonadTrans SourceT Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
MonadWriter w m => MonadWriter w (SourceT m) Source # | |
MonadState s m => MonadState s (SourceT m) Source # | |
MonadError e m => MonadError e (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache throwError :: e -> SourceT m a # catchError :: SourceT m a -> (e -> SourceT m a) -> SourceT m a # | |
TableCoreInfoRM b m => TableCoreInfoRM b (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache lookupTableCoreInfo :: TableName b -> SourceT m (Maybe (TableCoreInfo b)) Source # | |
Monad m => Monad (SourceT m) Source # | |
Functor m => Functor (SourceT m) Source # | |
Applicative m => Applicative (SourceT m) Source # | |
MonadIO m => MonadIO (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
MonadTx m => MonadTx (SourceT m) Source # | |
CacheRM m => CacheRM (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
Monad m => SourceM (SourceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache |
class SourceM m => TableCoreInfoRM b m where Source #
A more limited version of CacheRM
that is used when building the schema cache, since the
entire schema cache has not been built yet.
lookupTableCoreInfo :: TableName b -> m (Maybe (TableCoreInfo b)) Source #
Instances
newtype TableCoreCacheRT b m a Source #
TableCoreCacheRT | |
|
Instances
class TableCoreInfoRM b m => TableInfoRM b m where Source #
All our RQL DML queries operate over a single source. This typeclass facilitates that.
Instances
TableInfoRM b m => TableInfoRM b (TraceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
(Monad m, Backend b) => TableInfoRM b (TableCacheRT b m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache lookupTableInfo :: TableName b -> TableCacheRT b m (Maybe (TableInfo b)) Source # | |
(Monoid w, TableInfoRM b m) => TableInfoRM b (WriterT w m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
TableInfoRM b m => TableInfoRM b (StateT s m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
TableInfoRM b m => TableInfoRM b (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache |
newtype TableCacheRT b m a Source #
TableCacheRT | |
|
Instances
class Monad m => CacheRM m where Source #
askSchemaCache :: m SchemaCache Source #
Instances
getDependentObjs :: SchemaCache -> SchemaObjId -> [SchemaObjId] Source #
getDependentObjsWith :: (DependencyReason -> Bool) -> SchemaCache -> SchemaObjId -> [SchemaObjId] Source #
getRemoteDependencies :: SchemaCache -> SourceName -> [SchemaObjId] Source #
Compute all remote dependencies on a source.
Given a source name, this function computes all of its dependencies, direct or indirect, and returns all of the dependencies that are not "local" to the source, i.e. that belong to another source or to a remote schema, here dubbed "remote dependencies".
This functions returns a SchemaObjId
for each such dependency, but makes no
attempt at extracting the underlying SourceObjId
(if any), for two reasons:
1. a SourceObjId
no longer contains the source name, which most callers
need to identify where the corresponding dependency is
2. this would prevent us from returning remote schema dependencies, which
by definition do not have a corresponding SourceObjId
getBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> TableName b -> AnnBoolExpPartialSQL b -> [SchemaDependency] Source #
Discover the schema dependencies of an AnnBoolExpPartialSQL
.
getBoolExpDeps' :: forall b. (Backend b, GetAggregationPredicatesDeps b) => AnnBoolExpPartialSQL b -> BoolExpM b [SchemaDependency] Source #
getColExpDeps :: forall b. (Backend b, GetAggregationPredicatesDeps b) => AnnBoolExpFld b (PartialSQLExp b) -> BoolExpM b [SchemaDependency] Source #
getOpExpDeps :: forall b. Backend b => [OpExpG b (PartialSQLExp b)] -> BoolExpM b [SchemaDependency] Source #
askFieldInfoMapSource :: (QErrM m, Backend b, TableCoreInfoRM b m) => TableName b -> m (FieldInfoMap (FieldInfo b)) Source #
Asking for a table's fields info without explicit SourceName
argument.
The source name is implicitly inferred from SourceM
via @TableCoreInfoRM
.