Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype MetadataResourceVersion = MetadataResourceVersion {}
- initialResourceVersion :: MetadataResourceVersion
- showMetadataResourceVersion :: MetadataResourceVersion -> Text
- data MetadataWithResourceVersion = MetadataWithResourceVersion {}
- mkParentDep :: forall b. Backend b => SourceName -> TableName b -> SchemaDependency
- mkLogicalModelParentDep :: forall b. Backend b => SourceName -> LogicalModelName -> SchemaDependency
- mkColDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> Column b -> SchemaDependency
- mkLogicalModelColDep :: forall b. Backend b => DependencyReason -> SourceName -> LogicalModelName -> Column b -> SchemaDependency
- mkComputedFieldDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> ComputedFieldName -> SchemaDependency
- type WithDeps a = (a, Seq SchemaDependency)
- type RemoteSchemaRelationships = RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
- type RemoteSchemaCtx = RemoteSchemaCtxG (RemoteFieldInfo Name)
- type RemoteSchemaMap = HashMap RemoteSchemaName RemoteSchemaCtx
- type PartiallyResolvedRemoteSchemaCtx = RemoteSchemaCtxG (PartiallyResolvedRemoteRelationship RemoteRelationshipDefinition)
- type PartiallyResolvedRemoteSchemaMap = HashMap RemoteSchemaName PartiallyResolvedRemoteSchemaCtx
- type DepMap = HashMap SchemaObjId (HashSet SchemaDependency)
- data CronTriggerInfo = CronTriggerInfo {}
- 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)
- askSourceInfoMaybe :: forall b m. (CacheRM m, Backend b) => SourceName -> m (Maybe (SourceInfo b))
- askSourceConfig :: forall b m. (CacheRM m, MonadError QErr m, Backend b, MetadataM m) => SourceName -> m (SourceConfig b)
- askSourceConfigMaybe :: forall b m. (CacheRM m, Backend b) => SourceName -> m (Maybe (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)
- newtype BackendInfoWrapper (b :: BackendType) = BackendInfoWrapper {}
- type BackendCache = BackendMap BackendInfoWrapper
- getBackendInfo :: forall b m. (CacheRM m, HasTag b) => m (Maybe (BackendInfo 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 :: MetadataResourceVersion
- scSetGraphqlIntrospectionOptions :: SetGraphqlIntrospectionOptions
- scTlsAllowlist :: [TlsAllow]
- scQueryCollections :: QueryCollections
- scBackendCache :: BackendCache
- scSourceHealthChecks :: SourceHealthCheckCache
- scSourcePingConfig :: SourcePingCache
- scOpenTelemetryConfig :: OpenTelemetryInfo
- getAllRemoteSchemas :: SchemaCache -> [RemoteSchemaName]
- class Monad m => TableCoreInfoRM b m where
- lookupTableCoreInfo :: TableName b -> m (Maybe (TableCoreInfo b))
- newtype TableCoreCacheRT b m a = TableCoreCacheRT {
- runTableCoreCacheRT :: 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 :: TableCache b -> m a
- class Monad m => CacheRM m where
- getDependentObjs :: SchemaCache -> SchemaObjId -> [SchemaObjId]
- getDependentObjsWith :: (DependencyReason -> Bool) -> SchemaCache -> SchemaObjId -> [SchemaObjId]
- getRemoteDependencies :: SchemaCache -> SourceName -> [SchemaObjId]
- getLogicalModelBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> LogicalModelName -> AnnBoolExpPartialSQL b -> [SchemaDependency]
- getBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> TableName b -> AnnBoolExpPartialSQL 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 #
mkLogicalModelParentDep :: forall b. Backend b => SourceName -> LogicalModelName -> SchemaDependency Source #
When we depend on anything to do with logical models, we also declare that we depend on the logical model as a whole. This is the "parent" dependency in the dependency tree for a given logical model.
mkColDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> Column b -> SchemaDependency Source #
mkLogicalModelColDep :: forall b. Backend b => DependencyReason -> SourceName -> LogicalModelName -> Column b -> SchemaDependency Source #
Declare a dependency on a particular column of a logical model
mkComputedFieldDep :: forall b. Backend b => DependencyReason -> SourceName -> TableName b -> ComputedFieldName -> SchemaDependency Source #
type WithDeps a = (a, Seq SchemaDependency) Source #
type PartiallyResolvedRemoteSchemaCtx = RemoteSchemaCtxG (PartiallyResolvedRemoteRelationship RemoteRelationshipDefinition) Source #
type PartiallyResolvedRemoteSchemaMap = HashMap RemoteSchemaName PartiallyResolvedRemoteSchemaCtx Source #
type DepMap = HashMap SchemaObjId (HashSet SchemaDependency) Source #
data CronTriggerInfo Source #
Instances
type ActionCache = HashMap ActionName ActionInfo 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: 1. The function fails to find the named source at all 2. The named source exists but does not match the expected type 3. The named source exists, and is of the expected type, but is inconsistent
askSourceInfoMaybe :: forall b m. (CacheRM m, Backend b) => SourceName -> m (Maybe (SourceInfo b)) Source #
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.
askSourceConfigMaybe :: forall b m. (CacheRM m, Backend b) => SourceName -> m (Maybe (SourceConfig b)) Source #
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.
newtype BackendInfoWrapper (b :: BackendType) Source #
Instances
ToJSON (BackendInfo b) => ToJSON (BackendInfoWrapper b) Source # | |
Defined in Hasura.RQL.Types.SchemaCache toJSON :: BackendInfoWrapper b -> Value Source # toEncoding :: BackendInfoWrapper b -> Encoding Source # toJSONList :: [BackendInfoWrapper b] -> Value Source # toEncodingList :: [BackendInfoWrapper b] -> Encoding Source # | |
Monoid (BackendInfo b) => Monoid (BackendInfoWrapper b) Source # | |
Defined in Hasura.RQL.Types.SchemaCache mempty :: BackendInfoWrapper b # mappend :: BackendInfoWrapper b -> BackendInfoWrapper b -> BackendInfoWrapper b # mconcat :: [BackendInfoWrapper b] -> BackendInfoWrapper b # | |
Semigroup (BackendInfo b) => Semigroup (BackendInfoWrapper b) Source # | |
Defined in Hasura.RQL.Types.SchemaCache (<>) :: BackendInfoWrapper b -> BackendInfoWrapper b -> BackendInfoWrapper b # sconcat :: NonEmpty (BackendInfoWrapper b) -> BackendInfoWrapper b # stimes :: Integral b0 => b0 -> BackendInfoWrapper b -> BackendInfoWrapper b # |
getBackendInfo :: forall b m. (CacheRM m, HasTag b) => m (Maybe (BackendInfo b)) Source #
data SchemaCache Source #
Instances
ToJSON SchemaCache Source # | |
Defined in Hasura.RQL.Types.SchemaCache toJSON :: SchemaCache -> Value Source # toEncoding :: SchemaCache -> Encoding Source # toJSONList :: [SchemaCache] -> Value Source # toEncodingList :: [SchemaCache] -> Encoding Source # |
class Monad 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 # | |
TableInfoRM b m => TableInfoRM b (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
TableInfoRM b m => TableInfoRM b (StateT s m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
(Monoid w, TableInfoRM b m) => TableInfoRM b (WriterT w 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
Monad m => CacheRM (CacheRWT m) Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache | |
CacheRM m => CacheRM (MetadataT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache.Build | |
CacheRM m => CacheRM (TraceT m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache | |
CacheRM m => CacheRM (TxET e m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askSchemaCache :: TxET e m SchemaCache Source # | |
CacheRM m => CacheRM (TxET QErr m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askSchemaCache :: TxET QErr m SchemaCache Source # | |
CacheRM m => CacheRM (ReaderT r m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askSchemaCache :: ReaderT r m SchemaCache Source # | |
CacheRM m => CacheRM (StateT s m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askSchemaCache :: StateT s m SchemaCache Source # | |
(Monoid w, CacheRM m) => CacheRM (WriterT w m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache askSchemaCache :: WriterT w m SchemaCache Source # |
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
getLogicalModelBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> LogicalModelName -> AnnBoolExpPartialSQL b -> [SchemaDependency] Source #
What schema dependencies does a given row permission for a logical model have? This will almost certainly involve some number of dependencies on logical models, but may also involve dependencies on tables. Although we can't relate tables and logical models yet, we can still declare permissions like, "you can only see this logical model if your user ID exists in this table".
getBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> TableName b -> AnnBoolExpPartialSQL b -> [SchemaDependency] Source #
Discover the schema dependencies of an AnnBoolExpPartialSQL
.
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
.