module Hasura.RQL.DDL.Schema.Cache.Dependencies
( resolveDependencies,
)
where
import Control.Arrow.Extended
import Control.Lens hiding ((.=))
import Data.Aeson
import Data.HashMap.Strict.Extended qualified as HashMap
import Data.HashMap.Strict.InsOrd qualified as InsOrdHashMap
import Data.HashSet qualified as HS
import Data.List (nub)
import Data.Monoid (First)
import Data.Text.Extended
import Hasura.Base.Error
import Hasura.Function.Lenses (fiPermissions)
import Hasura.LogicalModel.Cache (LogicalModelInfo (..))
import Hasura.LogicalModel.Lenses (lmiPermissions)
import Hasura.NativeQuery.Cache (NativeQueryInfo (_nqiReturns))
import Hasura.NativeQuery.Lenses (nqiRelationships)
import Hasura.Prelude
import Hasura.RQL.DDL.Permission.Internal (permissionIsDefined)
import Hasura.RQL.DDL.Schema.Cache.Common
import Hasura.RQL.Types.Action
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.BackendType
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.ComputedField
import Hasura.RQL.Types.Metadata.Object
import Hasura.RQL.Types.Permission
import Hasura.RQL.Types.Relationships.Local
import Hasura.RQL.Types.SchemaCache
import Hasura.RQL.Types.SchemaCache.Build
import Hasura.RQL.Types.SchemaCacheTypes
import Hasura.RQL.Types.Source
import Hasura.RemoteSchema.SchemaCache (rscPermissions, rscRemoteRelationships)
import Hasura.SQL.AnyBackend qualified as AB
import Hasura.SQL.BackendMap qualified as BackendMap
import Hasura.StoredProcedure.Cache (StoredProcedureInfo (_spiReturns))
import Hasura.Table.Cache
import Language.GraphQL.Draft.Syntax qualified as G
resolveDependencies ::
(ArrowKleisli m arr, QErrM m) =>
( BuildOutputs,
[MetadataDependency]
)
`arr` (BuildOutputs, [InconsistentMetadata], DepMap)
resolveDependencies :: forall (m :: * -> *) (arr :: * -> * -> *).
(ArrowKleisli m arr, QErrM m) =>
arr
(BuildOutputs, [MetadataDependency])
(BuildOutputs, [InconsistentMetadata], DepMap)
resolveDependencies = ((BuildOutputs, [MetadataDependency])
-> m (BuildOutputs, [InconsistentMetadata], DepMap))
-> arr
(BuildOutputs, [MetadataDependency])
(BuildOutputs, [InconsistentMetadata], DepMap)
forall a b. (a -> m b) -> arr a b
forall (m :: * -> *) (arr :: * -> * -> *) a b.
ArrowKleisli m arr =>
(a -> m b) -> arr a b
arrM \(BuildOutputs
cache, [MetadataDependency]
dependencies) -> do
let dependencyMap :: HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
dependencyMap =
[MetadataDependency]
dependencies
[MetadataDependency]
-> ([MetadataDependency]
-> HashMap SchemaObjId [MetadataDependency])
-> HashMap SchemaObjId [MetadataDependency]
forall a b. a -> (a -> b) -> b
& (MetadataDependency -> SchemaObjId)
-> [MetadataDependency] -> HashMap SchemaObjId [MetadataDependency]
forall k (t :: * -> *) v.
(Hashable k, Foldable t) =>
(v -> k) -> t v -> HashMap k [v]
HashMap.groupOn (\case MetadataDependency MetadataObject
_ SchemaObjId
schemaObjId SchemaDependency
_ -> SchemaObjId
schemaObjId)
HashMap SchemaObjId [MetadataDependency]
-> (HashMap SchemaObjId [MetadataDependency]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
forall a b. a -> (a -> b) -> b
& ([MetadataDependency] -> [(MetadataObject, SchemaDependency)])
-> HashMap SchemaObjId [MetadataDependency]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
forall a b.
(a -> b) -> HashMap SchemaObjId a -> HashMap SchemaObjId b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((MetadataDependency -> (MetadataObject, SchemaDependency))
-> [MetadataDependency] -> [(MetadataObject, SchemaDependency)]
forall a b. (a -> b) -> [a] -> [b]
map \case MetadataDependency MetadataObject
metadataObject SchemaObjId
_ SchemaDependency
schemaDependency -> (MetadataObject
metadataObject, SchemaDependency
schemaDependency))
Int
-> BuildOutputs
-> [InconsistentMetadata]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
forall (m :: * -> *).
QErrM m =>
Int
-> BuildOutputs
-> [InconsistentMetadata]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
performIteration Int
0 BuildOutputs
cache [] HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
dependencyMap
performIteration ::
(QErrM m) =>
Int ->
BuildOutputs ->
[InconsistentMetadata] ->
HashMap SchemaObjId [(MetadataObject, SchemaDependency)] ->
m (BuildOutputs, [InconsistentMetadata], DepMap)
performIteration :: forall (m :: * -> *).
QErrM m =>
Int
-> BuildOutputs
-> [InconsistentMetadata]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
performIteration Int
iterationNumber BuildOutputs
cache [InconsistentMetadata]
inconsistencies HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
dependencies = do
let ([InconsistentMetadata]
newInconsistencies, HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
prunedDependencies) = BuildOutputs
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
pruneDanglingDependents BuildOutputs
cache HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
dependencies
case [InconsistentMetadata]
newInconsistencies of
[] -> (BuildOutputs, [InconsistentMetadata], DepMap)
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuildOutputs
cache, [InconsistentMetadata]
inconsistencies, [SchemaDependency] -> HashSet SchemaDependency
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList ([SchemaDependency] -> HashSet SchemaDependency)
-> ([(MetadataObject, SchemaDependency)] -> [SchemaDependency])
-> [(MetadataObject, SchemaDependency)]
-> HashSet SchemaDependency
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((MetadataObject, SchemaDependency) -> SchemaDependency)
-> [(MetadataObject, SchemaDependency)] -> [SchemaDependency]
forall a b. (a -> b) -> [a] -> [b]
map (MetadataObject, SchemaDependency) -> SchemaDependency
forall a b. (a, b) -> b
snd ([(MetadataObject, SchemaDependency)] -> HashSet SchemaDependency)
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> DepMap
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
prunedDependencies)
[InconsistentMetadata]
_
| Int
iterationNumber Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
100 -> do
let inconsistentIds :: [MetadataObjId]
inconsistentIds = [MetadataObjId] -> [MetadataObjId]
forall a. Eq a => [a] -> [a]
nub ([MetadataObjId] -> [MetadataObjId])
-> [MetadataObjId] -> [MetadataObjId]
forall a b. (a -> b) -> a -> b
$ (InconsistentMetadata -> [MetadataObjId])
-> [InconsistentMetadata] -> [MetadataObjId]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap InconsistentMetadata -> [MetadataObjId]
imObjectIds [InconsistentMetadata]
newInconsistencies
prunedCache :: BuildOutputs
prunedCache = (BuildOutputs -> MetadataObjId -> BuildOutputs)
-> BuildOutputs -> [MetadataObjId] -> BuildOutputs
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((MetadataObjId -> BuildOutputs -> BuildOutputs)
-> BuildOutputs -> MetadataObjId -> BuildOutputs
forall a b c. (a -> b -> c) -> b -> a -> c
flip MetadataObjId -> BuildOutputs -> BuildOutputs
deleteMetadataObject) BuildOutputs
cache [MetadataObjId]
inconsistentIds
allInconsistencies :: [InconsistentMetadata]
allInconsistencies = [InconsistentMetadata]
inconsistencies [InconsistentMetadata]
-> [InconsistentMetadata] -> [InconsistentMetadata]
forall a. Semigroup a => a -> a -> a
<> [InconsistentMetadata]
newInconsistencies
Int
-> BuildOutputs
-> [InconsistentMetadata]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
forall (m :: * -> *).
QErrM m =>
Int
-> BuildOutputs
-> [InconsistentMetadata]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> m (BuildOutputs, [InconsistentMetadata], DepMap)
performIteration (Int
iterationNumber Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) BuildOutputs
prunedCache [InconsistentMetadata]
allInconsistencies HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
prunedDependencies
| Bool
otherwise ->
QErr -> m (BuildOutputs, [InconsistentMetadata], DepMap)
forall a. QErr -> m a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError
(Code -> Text -> QErr
err500 Code
Unexpected Text
"schema dependency resolution failed to terminate")
{ qeInternal :: Maybe QErrExtra
qeInternal =
QErrExtra -> Maybe QErrExtra
forall a. a -> Maybe a
Just
(QErrExtra -> Maybe QErrExtra) -> QErrExtra -> Maybe QErrExtra
forall a b. (a -> b) -> a -> b
$ Value -> QErrExtra
ExtraInternal
(Value -> QErrExtra) -> Value -> QErrExtra
forall a b. (a -> b) -> a -> b
$ [Pair] -> Value
object
[ Key
"inconsistent_objects"
Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= [Pair] -> Value
object
[ Key
"old" Key -> [InconsistentMetadata] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= [InconsistentMetadata]
inconsistencies,
Key
"new" Key -> [InconsistentMetadata] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= [InconsistentMetadata]
newInconsistencies
],
Key
"pruned_dependencies" Key -> HashMap SchemaObjId [SchemaDependency] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= (((MetadataObject, SchemaDependency) -> SchemaDependency)
-> [(MetadataObject, SchemaDependency)] -> [SchemaDependency]
forall a b. (a -> b) -> [a] -> [b]
map (MetadataObject, SchemaDependency) -> SchemaDependency
forall a b. (a, b) -> b
snd ([(MetadataObject, SchemaDependency)] -> [SchemaDependency])
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> HashMap SchemaObjId [SchemaDependency]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
prunedDependencies)
]
}
pruneDanglingDependents ::
BuildOutputs ->
HashMap SchemaObjId [(MetadataObject, SchemaDependency)] ->
([InconsistentMetadata], HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
pruneDanglingDependents :: BuildOutputs
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
pruneDanglingDependents BuildOutputs
cache =
(HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
forall a b.
(a -> b)
-> ([InconsistentMetadata], a) -> ([InconsistentMetadata], b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (([(MetadataObject, SchemaDependency)] -> Bool)
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
forall v k. (v -> Bool) -> HashMap k v -> HashMap k v
HashMap.filter (Bool -> Bool
not (Bool -> Bool)
-> ([(MetadataObject, SchemaDependency)] -> Bool)
-> [(MetadataObject, SchemaDependency)]
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(MetadataObject, SchemaDependency)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null)) (([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)]))
-> (HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)]))
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata], [(MetadataObject, SchemaDependency)]))
-> HashMap SchemaObjId [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata],
HashMap SchemaObjId [(MetadataObject, SchemaDependency)])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HashMap SchemaObjId a -> f (HashMap SchemaObjId b)
traverse do
[Either InconsistentMetadata (MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata], [(MetadataObject, SchemaDependency)])
forall a b. [Either a b] -> ([a], [b])
partitionEithers ([Either InconsistentMetadata (MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata], [(MetadataObject, SchemaDependency)]))
-> ([(MetadataObject, SchemaDependency)]
-> [Either
InconsistentMetadata (MetadataObject, SchemaDependency)])
-> [(MetadataObject, SchemaDependency)]
-> ([InconsistentMetadata], [(MetadataObject, SchemaDependency)])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((MetadataObject, SchemaDependency)
-> Either InconsistentMetadata (MetadataObject, SchemaDependency))
-> [(MetadataObject, SchemaDependency)]
-> [Either InconsistentMetadata (MetadataObject, SchemaDependency)]
forall a b. (a -> b) -> [a] -> [b]
map \(MetadataObject
metadataObject, SchemaDependency
dependency) -> case SchemaDependency -> Either Text ()
resolveDependency SchemaDependency
dependency of
Right () -> (MetadataObject, SchemaDependency)
-> Either InconsistentMetadata (MetadataObject, SchemaDependency)
forall a b. b -> Either a b
Right (MetadataObject
metadataObject, SchemaDependency
dependency)
Left Text
errorMessage -> InconsistentMetadata
-> Either InconsistentMetadata (MetadataObject, SchemaDependency)
forall a b. a -> Either a b
Left (Text -> Maybe Value -> MetadataObject -> InconsistentMetadata
InconsistentObject Text
errorMessage Maybe Value
forall a. Maybe a
Nothing MetadataObject
metadataObject)
where
resolveDependency :: SchemaDependency -> Either Text ()
resolveDependency :: SchemaDependency -> Either Text ()
resolveDependency (SchemaDependency SchemaObjId
objectId DependencyReason
_) = case SchemaObjId
objectId of
SOSource SourceName
source ->
Either Text BackendSourceInfo -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(Either Text BackendSourceInfo -> Either Text ())
-> Either Text BackendSourceInfo -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceName
-> HashMap SourceName BackendSourceInfo -> Maybe BackendSourceInfo
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup SourceName
source (BuildOutputs -> HashMap SourceName BackendSourceInfo
_boSources BuildOutputs
cache)
Maybe BackendSourceInfo
-> Either Text BackendSourceInfo -> Either Text BackendSourceInfo
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text BackendSourceInfo
forall a b. a -> Either a b
Left (Text
"no such source exists: " Text -> SourceName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> SourceName
source)
SORemoteSchema RemoteSchemaName
remoteSchemaName ->
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (RemoteSchemaName
remoteSchemaName RemoteSchemaName
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Bool
forall k a. (Eq k, Hashable k) => k -> HashMap k a -> Bool
`HashMap.member` BuildOutputs
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
_boRemoteSchemas BuildOutputs
cache)
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"remote schema "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RemoteSchemaName
remoteSchemaName
RemoteSchemaName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not found"
SORemoteSchemaPermission RemoteSchemaName
remoteSchemaName RoleName
roleName -> do
(RemoteSchemaCtx, MetadataObject)
remoteSchema <-
Maybe (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
onNothing (RemoteSchemaName
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup RemoteSchemaName
remoteSchemaName (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ BuildOutputs
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
_boRemoteSchemas BuildOutputs
cache)
(Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject))
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ Text -> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. a -> Either a b
Left
(Text -> Either Text (RemoteSchemaCtx, MetadataObject))
-> Text -> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ Text
"remote schema "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RemoteSchemaName
remoteSchemaName
RemoteSchemaName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not found"
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (RoleName
roleName RoleName -> HashMap RoleName IntrospectionResult -> Bool
forall k a. (Eq k, Hashable k) => k -> HashMap k a -> Bool
`HashMap.member` RemoteSchemaCtx -> HashMap RoleName IntrospectionResult
forall remoteFieldInfo.
RemoteSchemaCtxG remoteFieldInfo
-> HashMap RoleName IntrospectionResult
_rscPermissions ((RemoteSchemaCtx, MetadataObject) -> RemoteSchemaCtx
forall a b. (a, b) -> a
fst (RemoteSchemaCtx, MetadataObject)
remoteSchema))
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"no permission defined on remote schema "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RemoteSchemaName
remoteSchemaName
RemoteSchemaName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" for role "
Text -> RoleName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> RoleName
roleName
SORemoteSchemaRemoteRelationship RemoteSchemaName
remoteSchemaName Name
typeName RelName
relationshipName -> do
RemoteSchemaCtx
remoteSchema <-
((RemoteSchemaCtx, MetadataObject) -> RemoteSchemaCtx)
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text RemoteSchemaCtx
forall a b. (a -> b) -> Either Text a -> Either Text b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (RemoteSchemaCtx, MetadataObject) -> RemoteSchemaCtx
forall a b. (a, b) -> a
fst
(Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text RemoteSchemaCtx)
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text RemoteSchemaCtx
forall a b. (a -> b) -> a -> b
$ Maybe (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
onNothing (RemoteSchemaName
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup RemoteSchemaName
remoteSchemaName (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Maybe (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ BuildOutputs
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
_boRemoteSchemas BuildOutputs
cache)
(Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject))
-> Either Text (RemoteSchemaCtx, MetadataObject)
-> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ Text -> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. a -> Either a b
Left
(Text -> Either Text (RemoteSchemaCtx, MetadataObject))
-> Text -> Either Text (RemoteSchemaCtx, MetadataObject)
forall a b. (a -> b) -> a -> b
$ Text
"remote schema "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RemoteSchemaName
remoteSchemaName
RemoteSchemaName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not found"
Either Text (RemoteFieldInfo Name) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(Either Text (RemoteFieldInfo Name) -> Either Text ())
-> Either Text (RemoteFieldInfo Name) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Maybe (RemoteFieldInfo Name)
-> Either Text (RemoteFieldInfo Name)
-> Either Text (RemoteFieldInfo Name)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
onNothing
(Name
-> RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
-> Maybe (InsOrdHashMap RelName (RemoteFieldInfo Name))
forall k v. (Eq k, Hashable k) => k -> InsOrdHashMap k v -> Maybe v
InsOrdHashMap.lookup Name
typeName (RemoteSchemaCtx
-> RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
forall remoteFieldInfo.
RemoteSchemaCtxG remoteFieldInfo
-> RemoteSchemaRelationshipsG remoteFieldInfo
_rscRemoteRelationships RemoteSchemaCtx
remoteSchema) Maybe (InsOrdHashMap RelName (RemoteFieldInfo Name))
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Maybe (RemoteFieldInfo Name))
-> Maybe (RemoteFieldInfo Name)
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= RelName
-> InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Maybe (RemoteFieldInfo Name)
forall k v. (Eq k, Hashable k) => k -> InsOrdHashMap k v -> Maybe v
InsOrdHashMap.lookup RelName
relationshipName)
(Either Text (RemoteFieldInfo Name)
-> Either Text (RemoteFieldInfo Name))
-> Either Text (RemoteFieldInfo Name)
-> Either Text (RemoteFieldInfo Name)
forall a b. (a -> b) -> a -> b
$ Text -> Either Text (RemoteFieldInfo Name)
forall a b. a -> Either a b
Left
(Text -> Either Text (RemoteFieldInfo Name))
-> Text -> Either Text (RemoteFieldInfo Name)
forall a b. (a -> b) -> a -> b
$ Text
"remote relationship "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RelName
relationshipName
RelName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" on type "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Name -> Text
G.unName Name
typeName
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" on "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RemoteSchemaName
remoteSchemaName
RemoteSchemaName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not found"
SOSourceObj SourceName
source AnyBackend SourceObjId
exists -> do
forall (c :: BackendType -> Constraint) (i :: BackendType -> *) r.
AllBackendsSatisfy c =>
AnyBackend i -> (forall (b :: BackendType). c b => i b -> r) -> r
AB.dispatchAnyBackend @Backend AnyBackend SourceObjId
exists ((forall (b :: BackendType).
Backend b =>
SourceObjId b -> Either Text ())
-> Either Text ())
-> (forall (b :: BackendType).
Backend b =>
SourceObjId b -> Either Text ())
-> Either Text ()
forall a b. (a -> b) -> a -> b
$ \(SourceObjId b
sourceObjId :: SourceObjId b) -> do
SourceInfo b
sourceInfo <- SourceName -> SourceObjId b -> Either Text (SourceInfo b)
forall (b :: BackendType).
Backend b =>
SourceName -> SourceObjId b -> Either Text (SourceInfo b)
castSourceInfo SourceName
source SourceObjId b
sourceObjId
case SourceObjId b
sourceObjId of
SOITable TableName b
tableName ->
Either Text (TableInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (TableInfo b) -> Either Text ())
-> Either Text (TableInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b -> TableName b -> Either Text (TableInfo b)
forall {b :: BackendType}.
(Hashable (TableName b), ToTxt (TableName b)) =>
SourceInfo b -> TableName b -> Either Text (TableInfo b)
resolveTable SourceInfo b
sourceInfo TableName b
tableName
SOIFunction FunctionName b
functionName ->
Either Text (FunctionInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(Either Text (FunctionInfo b) -> Either Text ())
-> Either Text (FunctionInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ FunctionName b
-> HashMap (FunctionName b) (FunctionInfo b)
-> Maybe (FunctionInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup FunctionName b
functionName (SourceInfo b -> HashMap (FunctionName b) (FunctionInfo b)
forall (b :: BackendType). SourceInfo b -> FunctionCache b
_siFunctions SourceInfo b
sourceInfo)
Maybe (FunctionInfo b)
-> Either Text (FunctionInfo b) -> Either Text (FunctionInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (FunctionInfo b)
forall a b. a -> Either a b
Left (Text
"function " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> FunctionName b
functionName FunctionName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not tracked")
SOILogicalModel LogicalModelName
logicalModelName ->
Either Text (LogicalModelInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (LogicalModelInfo b) -> Either Text ())
-> Either Text (LogicalModelInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
forall {b :: BackendType}.
SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
resolveLogicalModel SourceInfo b
sourceInfo LogicalModelName
logicalModelName
SOILogicalModelObj LogicalModelName
logicalModelName LogicalModelObjId b
logicalModelObjId -> do
LogicalModelInfo b
logicalModel <- SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
forall {b :: BackendType}.
SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
resolveLogicalModel SourceInfo b
sourceInfo LogicalModelName
logicalModelName
case LogicalModelObjId b
logicalModelObjId of
LMOReferencedLogicalModel LogicalModelName
inner ->
Either Text (LogicalModelInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (LogicalModelInfo b) -> Either Text ())
-> Either Text (LogicalModelInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
forall {b :: BackendType}.
SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
resolveLogicalModel SourceInfo b
sourceInfo LogicalModelName
inner
LMOPerm RoleName
roleName PermType
permType -> do
let rolePermissions :: Maybe (RolePermInfo b)
rolePermissions :: Maybe (RolePermInfo b)
rolePermissions = LogicalModelInfo b
logicalModel LogicalModelInfo b
-> Getting
(First (RolePermInfo b)) (LogicalModelInfo b) (RolePermInfo b)
-> Maybe (RolePermInfo b)
forall s a. s -> Getting (First a) s a -> Maybe a
^? (RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> LogicalModelInfo b
-> Const (First (RolePermInfo b)) (LogicalModelInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> LogicalModelInfo b -> f (LogicalModelInfo b)
lmiPermissions ((RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> LogicalModelInfo b
-> Const (First (RolePermInfo b)) (LogicalModelInfo b))
-> ((RolePermInfo b
-> Const (First (RolePermInfo b)) (RolePermInfo b))
-> RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> Getting
(First (RolePermInfo b)) (LogicalModelInfo b) (RolePermInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((RolePermInfo b -> Bool) -> Maybe (RolePermInfo b) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (PermType -> RolePermInfo b -> Bool
forall (backend :: BackendType).
PermType -> RolePermInfo backend -> Bool
permissionIsDefined PermType
permType) Maybe (RolePermInfo b)
rolePermissions)
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"no "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> PermType -> Text
permTypeToCode PermType
permType
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" permission defined on logical model "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LogicalModelName
logicalModelName
LogicalModelName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" for role "
Text -> RoleName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> RoleName
roleName
LMOCol Column b
column ->
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Column b -> InsOrdHashMap (Column b) (LogicalModelField b) -> Bool
forall k a. (Eq k, Hashable k) => k -> InsOrdHashMap k a -> Bool
InsOrdHashMap.member Column b
column (LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
forall (b :: BackendType).
LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
_lmiFields LogicalModelInfo b
logicalModel)) do
Text -> Either Text ()
forall a b. a -> Either a b
Left (Text
"Could not find column " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Column b
column Column b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" in logical model " Text -> LogicalModelName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> LogicalModelName
logicalModelName)
SOINativeQuery NativeQueryName
nativeQueryName -> do
Either Text (NativeQueryInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (NativeQueryInfo b) -> Either Text ())
-> Either Text (NativeQueryInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b -> NativeQueryName -> Either Text (NativeQueryInfo b)
forall {b :: BackendType}.
SourceInfo b -> NativeQueryName -> Either Text (NativeQueryInfo b)
resolveNativeQuery SourceInfo b
sourceInfo NativeQueryName
nativeQueryName
SOINativeQueryObj NativeQueryName
nativeQueryName NativeQueryObjId b
nativeQueryObjId -> do
NativeQueryInfo b
nativeQueryInfo <- SourceInfo b -> NativeQueryName -> Either Text (NativeQueryInfo b)
forall {b :: BackendType}.
SourceInfo b -> NativeQueryName -> Either Text (NativeQueryInfo b)
resolveNativeQuery SourceInfo b
sourceInfo NativeQueryName
nativeQueryName
case NativeQueryObjId b
nativeQueryObjId of
NQOCol Column b
colName ->
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Column b -> InsOrdHashMap (Column b) (LogicalModelField b) -> Bool
forall k a. (Eq k, Hashable k) => k -> InsOrdHashMap k a -> Bool
InsOrdHashMap.member Column b
colName (LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
forall (b :: BackendType).
LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
_lmiFields (NativeQueryInfo b -> LogicalModelInfo b
forall (b :: BackendType). NativeQueryInfo b -> LogicalModelInfo b
_nqiReturns NativeQueryInfo b
nativeQueryInfo)))
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text
"native query " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> NativeQueryName
nativeQueryName NativeQueryName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" has no field named " Text -> Column b -> Text
forall t. ToTxt t => Text -> t -> Text
<>> Column b
colName)
NQOReferencedLogicalModel LogicalModelName
inner ->
Either Text (LogicalModelInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (LogicalModelInfo b) -> Either Text ())
-> Either Text (LogicalModelInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
forall {b :: BackendType}.
SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
resolveLogicalModel SourceInfo b
sourceInfo LogicalModelName
inner
SOIStoredProcedure FunctionName b
storedProcedureName -> do
Either Text (StoredProcedureInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (StoredProcedureInfo b) -> Either Text ())
-> Either Text (StoredProcedureInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ SourceInfo b
-> FunctionName b -> Either Text (StoredProcedureInfo b)
forall {b :: BackendType}.
(Hashable (FunctionName b), ToTxt (FunctionName b)) =>
SourceInfo b
-> FunctionName b -> Either Text (StoredProcedureInfo b)
resolveStoredProcedure SourceInfo b
sourceInfo FunctionName b
storedProcedureName
SOIStoredProcedureObj FunctionName b
storedProcedureName StoredProcedureObjId b
storedProcedureObjId -> do
StoredProcedureInfo b
storedProcedureInfo <- SourceInfo b
-> FunctionName b -> Either Text (StoredProcedureInfo b)
forall {b :: BackendType}.
(Hashable (FunctionName b), ToTxt (FunctionName b)) =>
SourceInfo b
-> FunctionName b -> Either Text (StoredProcedureInfo b)
resolveStoredProcedure SourceInfo b
sourceInfo FunctionName b
storedProcedureName
case StoredProcedureObjId b
storedProcedureObjId of
SPOCol Column b
colName ->
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Column b -> InsOrdHashMap (Column b) (LogicalModelField b) -> Bool
forall k a. (Eq k, Hashable k) => k -> InsOrdHashMap k a -> Bool
InsOrdHashMap.member Column b
colName (LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
forall (b :: BackendType).
LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
_lmiFields (StoredProcedureInfo b -> LogicalModelInfo b
forall (b :: BackendType).
StoredProcedureInfo b -> LogicalModelInfo b
_spiReturns StoredProcedureInfo b
storedProcedureInfo)))
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text
"stored procedure " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> FunctionName b
storedProcedureName FunctionName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" has no field named " Text -> Column b -> Text
forall t. ToTxt t => Text -> t -> Text
<>> Column b
colName)
SOITableObj TableName b
tableName TableObjId b
tableObjectId -> do
TableInfo b
tableInfo <- SourceInfo b -> TableName b -> Either Text (TableInfo b)
forall {b :: BackendType}.
(Hashable (TableName b), ToTxt (TableName b)) =>
SourceInfo b -> TableName b -> Either Text (TableInfo b)
resolveTable SourceInfo b
sourceInfo TableName b
tableName
case TableObjId b
tableObjectId of
TOCol Column b
columnName ->
Either Text (StructuredColumnInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (StructuredColumnInfo b) -> Either Text ())
-> Either Text (StructuredColumnInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ TableInfo b
-> FieldName
-> Getting
(First (StructuredColumnInfo b))
(FieldInfo b)
(StructuredColumnInfo b)
-> Text
-> Either Text (StructuredColumnInfo b)
forall (b :: BackendType) a.
Backend b =>
TableInfo b
-> FieldName
-> Getting (First a) (FieldInfo b) a
-> Text
-> Either Text a
resolveField TableInfo b
tableInfo (TableInfo b -> Column b -> FieldName
forall (b :: BackendType).
Backend b =>
TableInfo b -> Column b -> FieldName
columnToFieldName TableInfo b
tableInfo Column b
columnName) Getting
(First (StructuredColumnInfo b))
(FieldInfo b)
(StructuredColumnInfo b)
forall (b :: BackendType) (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (StructuredColumnInfo b) (f (StructuredColumnInfo b))
-> p (FieldInfo b) (f (FieldInfo b))
_FIColumn Text
"column"
TORel RelName
relName ->
Either Text (RelInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (RelInfo b) -> Either Text ())
-> Either Text (RelInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ TableInfo b
-> FieldName
-> Getting (First (RelInfo b)) (FieldInfo b) (RelInfo b)
-> Text
-> Either Text (RelInfo b)
forall (b :: BackendType) a.
Backend b =>
TableInfo b
-> FieldName
-> Getting (First a) (FieldInfo b) a
-> Text
-> Either Text a
resolveField TableInfo b
tableInfo (RelName -> FieldName
fromRel RelName
relName) Getting (First (RelInfo b)) (FieldInfo b) (RelInfo b)
forall (b :: BackendType) (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (RelInfo b) (f (RelInfo b)) -> p (FieldInfo b) (f (FieldInfo b))
_FIRelationship Text
"relationship"
TOComputedField ComputedFieldName
fieldName ->
Either Text (ComputedFieldInfo b) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (ComputedFieldInfo b) -> Either Text ())
-> Either Text (ComputedFieldInfo b) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ TableInfo b
-> FieldName
-> Getting
(First (ComputedFieldInfo b)) (FieldInfo b) (ComputedFieldInfo b)
-> Text
-> Either Text (ComputedFieldInfo b)
forall (b :: BackendType) a.
Backend b =>
TableInfo b
-> FieldName
-> Getting (First a) (FieldInfo b) a
-> Text
-> Either Text a
resolveField TableInfo b
tableInfo (ComputedFieldName -> FieldName
fromComputedField ComputedFieldName
fieldName) Getting
(First (ComputedFieldInfo b)) (FieldInfo b) (ComputedFieldInfo b)
forall (b :: BackendType) (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (ComputedFieldInfo b) (f (ComputedFieldInfo b))
-> p (FieldInfo b) (f (FieldInfo b))
_FIComputedField Text
"computed field"
TORemoteRel RelName
fieldName ->
Either Text (RemoteFieldInfo (DBJoinField b)) -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Either Text (RemoteFieldInfo (DBJoinField b)) -> Either Text ())
-> Either Text (RemoteFieldInfo (DBJoinField b)) -> Either Text ()
forall a b. (a -> b) -> a -> b
$ TableInfo b
-> FieldName
-> Getting
(First (RemoteFieldInfo (DBJoinField b)))
(FieldInfo b)
(RemoteFieldInfo (DBJoinField b))
-> Text
-> Either Text (RemoteFieldInfo (DBJoinField b))
forall (b :: BackendType) a.
Backend b =>
TableInfo b
-> FieldName
-> Getting (First a) (FieldInfo b) a
-> Text
-> Either Text a
resolveField TableInfo b
tableInfo (RelName -> FieldName
fromRemoteRelationship RelName
fieldName) Getting
(First (RemoteFieldInfo (DBJoinField b)))
(FieldInfo b)
(RemoteFieldInfo (DBJoinField b))
forall (b :: BackendType) (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (RemoteFieldInfo (DBJoinField b))
(f (RemoteFieldInfo (DBJoinField b)))
-> p (FieldInfo b) (f (FieldInfo b))
_FIRemoteRelationship Text
"remote relationship"
TOForeignKey ConstraintName b
constraintName -> do
let foreignKeys :: HashSet (ForeignKey b)
foreignKeys = TableCoreInfoG b (FieldInfo b) (ColumnInfo b)
-> HashSet (ForeignKey b)
forall (b :: BackendType) field primaryKeyColumn.
TableCoreInfoG b field primaryKeyColumn -> HashSet (ForeignKey b)
_tciForeignKeys (TableCoreInfoG b (FieldInfo b) (ColumnInfo b)
-> HashSet (ForeignKey b))
-> TableCoreInfoG b (FieldInfo b) (ColumnInfo b)
-> HashSet (ForeignKey b)
forall a b. (a -> b) -> a -> b
$ TableInfo b -> TableCoreInfoG b (FieldInfo b) (ColumnInfo b)
forall (b :: BackendType). TableInfo b -> TableCoreInfo b
_tiCoreInfo TableInfo b
tableInfo
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Maybe (ForeignKey b) -> Bool
forall a. Maybe a -> Bool
isJust (Maybe (ForeignKey b) -> Bool) -> Maybe (ForeignKey b) -> Bool
forall a b. (a -> b) -> a -> b
$ (ForeignKey b -> Bool)
-> HashSet (ForeignKey b) -> Maybe (ForeignKey b)
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find ((ConstraintName b -> ConstraintName b -> Bool
forall a. Eq a => a -> a -> Bool
== ConstraintName b
constraintName) (ConstraintName b -> Bool)
-> (ForeignKey b -> ConstraintName b) -> ForeignKey b -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Constraint b -> ConstraintName b
forall (b :: BackendType). Constraint b -> ConstraintName b
_cName (Constraint b -> ConstraintName b)
-> (ForeignKey b -> Constraint b)
-> ForeignKey b
-> ConstraintName b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignKey b -> Constraint b
forall (b :: BackendType). ForeignKey b -> Constraint b
_fkConstraint) HashSet (ForeignKey b)
foreignKeys)
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"no foreign key constraint named "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ConstraintName b
constraintName
ConstraintName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"defined for table "
Text -> TableName b -> Text
forall t. ToTxt t => Text -> t -> Text
<>> TableName b
tableName
TOPerm RoleName
roleName PermType
permType -> do
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((RolePermInfo b -> Bool) -> Maybe (RolePermInfo b) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (PermType -> RolePermInfo b -> Bool
forall (backend :: BackendType).
PermType -> RolePermInfo backend -> Bool
permissionIsDefined PermType
permType) (TableInfo b
tableInfo TableInfo b
-> Getting (First (RolePermInfo b)) (TableInfo b) (RolePermInfo b)
-> Maybe (RolePermInfo b)
forall s a. s -> Getting (First a) s a -> Maybe a
^? ((RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> TableInfo b -> Const (First (RolePermInfo b)) (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiRolePermInfoMap ((RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> TableInfo b -> Const (First (RolePermInfo b)) (TableInfo b))
-> ((RolePermInfo b
-> Const (First (RolePermInfo b)) (RolePermInfo b))
-> RolePermInfoMap b
-> Const (First (RolePermInfo b)) (RolePermInfoMap b))
-> Getting (First (RolePermInfo b)) (TableInfo b) (RolePermInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName)))
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"no "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> PermType -> Text
permTypeToCode PermType
permType
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" permission defined on table "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TableName b
tableName
TableName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" for role "
Text -> RoleName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> RoleName
roleName
TOTrigger TriggerName
triggerName ->
Bool -> Either Text () -> Either Text ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (TriggerName -> HashMap TriggerName (EventTriggerInfo b) -> Bool
forall k a. (Eq k, Hashable k) => k -> HashMap k a -> Bool
HashMap.member TriggerName
triggerName (TableInfo b -> HashMap TriggerName (EventTriggerInfo b)
forall (b :: BackendType). TableInfo b -> EventTriggerInfoMap b
_tiEventTriggerInfoMap TableInfo b
tableInfo))
(Either Text () -> Either Text ())
-> Either Text () -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text -> Either Text ()
forall a b. a -> Either a b
Left
(Text -> Either Text ()) -> Text -> Either Text ()
forall a b. (a -> b) -> a -> b
$ Text
"no event trigger named "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TriggerName
triggerName
TriggerName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is defined for table "
Text -> TableName b -> Text
forall t. ToTxt t => Text -> t -> Text
<>> TableName b
tableName
SORole RoleName
roleName ->
Either Text Role -> Either Text ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(Either Text Role -> Either Text ())
-> Either Text Role -> Either Text ()
forall a b. (a -> b) -> a -> b
$ (RoleName -> HashMap RoleName Role -> Maybe Role
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup RoleName
roleName (BuildOutputs -> HashMap RoleName Role
_boRoles BuildOutputs
cache))
Maybe Role -> Either Text Role -> Either Text Role
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text Role
forall a b. a -> Either a b
Left (Text
"parent role " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> RoleName
roleName RoleName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" does not exist")
castSourceInfo ::
(Backend b) => SourceName -> SourceObjId b -> Either Text (SourceInfo b)
castSourceInfo :: forall (b :: BackendType).
Backend b =>
SourceName -> SourceObjId b -> Either Text (SourceInfo b)
castSourceInfo SourceName
sourceName SourceObjId b
_ =
(SourceName
-> HashMap SourceName BackendSourceInfo -> Maybe BackendSourceInfo
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup SourceName
sourceName (BuildOutputs -> HashMap SourceName BackendSourceInfo
_boSources BuildOutputs
cache) Maybe BackendSourceInfo
-> (BackendSourceInfo -> Maybe (SourceInfo b))
-> Maybe (SourceInfo b)
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= BackendSourceInfo -> Maybe (SourceInfo b)
forall (b :: BackendType).
HasTag b =>
BackendSourceInfo -> Maybe (SourceInfo b)
unsafeSourceInfo)
Maybe (SourceInfo b)
-> Either Text (SourceInfo b) -> Either Text (SourceInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (SourceInfo b)
forall a b. a -> Either a b
Left (Text
"no such source found " Text -> SourceName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> SourceName
sourceName)
resolveTable :: SourceInfo b -> TableName b -> Either Text (TableInfo b)
resolveTable SourceInfo b
sourceInfo TableName b
tableName =
TableName b
-> HashMap (TableName b) (TableInfo b) -> Maybe (TableInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup TableName b
tableName (SourceInfo b -> HashMap (TableName b) (TableInfo b)
forall (b :: BackendType). SourceInfo b -> TableCache b
_siTables SourceInfo b
sourceInfo)
Maybe (TableInfo b)
-> Either Text (TableInfo b) -> Either Text (TableInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (TableInfo b)
forall a b. a -> Either a b
Left (Text
"table " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TableName b
tableName TableName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not tracked")
resolveNativeQuery :: SourceInfo b -> NativeQueryName -> Either Text (NativeQueryInfo b)
resolveNativeQuery SourceInfo b
sourceInfo NativeQueryName
nativeQueryName =
NativeQueryName
-> HashMap NativeQueryName (NativeQueryInfo b)
-> Maybe (NativeQueryInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup NativeQueryName
nativeQueryName (SourceInfo b -> HashMap NativeQueryName (NativeQueryInfo b)
forall (b :: BackendType). SourceInfo b -> NativeQueryCache b
_siNativeQueries SourceInfo b
sourceInfo)
Maybe (NativeQueryInfo b)
-> Either Text (NativeQueryInfo b)
-> Either Text (NativeQueryInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (NativeQueryInfo b)
forall a b. a -> Either a b
Left (Text
"native query " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> NativeQueryName
nativeQueryName NativeQueryName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not tracked")
resolveStoredProcedure :: SourceInfo b
-> FunctionName b -> Either Text (StoredProcedureInfo b)
resolveStoredProcedure SourceInfo b
sourceInfo FunctionName b
storedProcedureName =
FunctionName b
-> HashMap (FunctionName b) (StoredProcedureInfo b)
-> Maybe (StoredProcedureInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup FunctionName b
storedProcedureName (SourceInfo b -> HashMap (FunctionName b) (StoredProcedureInfo b)
forall (b :: BackendType). SourceInfo b -> StoredProcedureCache b
_siStoredProcedures SourceInfo b
sourceInfo)
Maybe (StoredProcedureInfo b)
-> Either Text (StoredProcedureInfo b)
-> Either Text (StoredProcedureInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (StoredProcedureInfo b)
forall a b. a -> Either a b
Left (Text
"stored procedure " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> FunctionName b
storedProcedureName FunctionName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not tracked")
resolveLogicalModel :: SourceInfo b
-> LogicalModelName -> Either Text (LogicalModelInfo b)
resolveLogicalModel SourceInfo b
sourceInfo LogicalModelName
logicalModelName =
LogicalModelName
-> HashMap LogicalModelName (LogicalModelInfo b)
-> Maybe (LogicalModelInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup LogicalModelName
logicalModelName (SourceInfo b -> HashMap LogicalModelName (LogicalModelInfo b)
forall (b :: BackendType). SourceInfo b -> LogicalModelCache b
_siLogicalModels SourceInfo b
sourceInfo)
Maybe (LogicalModelInfo b)
-> Either Text (LogicalModelInfo b)
-> Either Text (LogicalModelInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (LogicalModelInfo b)
forall a b. a -> Either a b
Left (Text
"logical model " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LogicalModelName
logicalModelName LogicalModelName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not tracked")
columnToFieldName :: forall b. (Backend b) => TableInfo b -> Column b -> FieldName
columnToFieldName :: forall (b :: BackendType).
Backend b =>
TableInfo b -> Column b -> FieldName
columnToFieldName TableInfo b
_ = forall (b :: BackendType). Backend b => Column b -> FieldName
fromCol @b
resolveField ::
(Backend b) =>
TableInfo b ->
FieldName ->
Getting (First a) (FieldInfo b) a ->
Text ->
Either Text a
resolveField :: forall (b :: BackendType) a.
Backend b =>
TableInfo b
-> FieldName
-> Getting (First a) (FieldInfo b) a
-> Text
-> Either Text a
resolveField TableInfo b
tableInfo FieldName
fieldName Getting (First a) (FieldInfo b) a
fieldType Text
fieldTypeName = do
let coreInfo :: TableCoreInfo b
coreInfo = TableInfo b -> TableCoreInfo b
forall (b :: BackendType). TableInfo b -> TableCoreInfo b
_tiCoreInfo TableInfo b
tableInfo
tableName :: TableName b
tableName = TableInfo b -> TableName b
forall (b :: BackendType). TableInfo b -> TableName b
tableInfoName TableInfo b
tableInfo
FieldInfo b
fieldInfo <-
FieldName -> HashMap FieldName (FieldInfo b) -> Maybe (FieldInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HashMap.lookup FieldName
fieldName (TableCoreInfo b -> HashMap FieldName (FieldInfo b)
forall (b :: BackendType) field primaryKeyColumn.
TableCoreInfoG b field primaryKeyColumn -> FieldInfoMap field
_tciFieldInfoMap TableCoreInfo b
coreInfo)
Maybe (FieldInfo b)
-> Either Text (FieldInfo b) -> Either Text (FieldInfo b)
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text (FieldInfo b)
forall a b. a -> Either a b
Left
(Text
"table " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TableName b
tableName TableName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" has no field named " Text -> FieldName -> Text
forall t. ToTxt t => Text -> t -> Text
<>> FieldName
fieldName)
(FieldInfo b
fieldInfo FieldInfo b -> Getting (First a) (FieldInfo b) a -> Maybe a
forall s a. s -> Getting (First a) s a -> Maybe a
^? Getting (First a) (FieldInfo b) a
fieldType)
Maybe a -> Either Text a -> Either Text a
forall (m :: * -> *) a. Applicative m => Maybe a -> m a -> m a
`onNothing` Text -> Either Text a
forall a b. a -> Either a b
Left
(Text
"field " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> FieldName
fieldName FieldName -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
"of table " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TableName b
tableName TableName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
" is not a " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fieldTypeName)
deleteMetadataObject ::
MetadataObjId -> BuildOutputs -> BuildOutputs
deleteMetadataObject :: MetadataObjId -> BuildOutputs -> BuildOutputs
deleteMetadataObject = \case
MOSource SourceName
name -> (HashMap SourceName BackendSourceInfo
-> Identity (HashMap SourceName BackendSourceInfo))
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs (HashMap SourceName BackendSourceInfo)
boSources ((HashMap SourceName BackendSourceInfo
-> Identity (HashMap SourceName BackendSourceInfo))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap SourceName BackendSourceInfo
-> HashMap SourceName BackendSourceInfo)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ SourceName
-> HashMap SourceName BackendSourceInfo
-> HashMap SourceName BackendSourceInfo
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete SourceName
name
MOSourceObjId SourceName
source AnyBackend SourceMetadataObjId
exists -> forall (c :: BackendType -> Constraint) (i :: BackendType -> *) r.
AllBackendsSatisfy c =>
AnyBackend i -> (forall (b :: BackendType). c b => i b -> r) -> r
AB.dispatchAnyBackend @Backend AnyBackend SourceMetadataObjId
exists (\SourceMetadataObjId b
sourceObjId -> (HashMap SourceName BackendSourceInfo
-> Identity (HashMap SourceName BackendSourceInfo))
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs (HashMap SourceName BackendSourceInfo)
boSources ((HashMap SourceName BackendSourceInfo
-> Identity (HashMap SourceName BackendSourceInfo))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap SourceName BackendSourceInfo
-> HashMap SourceName BackendSourceInfo)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (BackendSourceInfo -> BackendSourceInfo)
-> SourceName
-> HashMap SourceName BackendSourceInfo
-> HashMap SourceName BackendSourceInfo
forall k v.
(Eq k, Hashable k) =>
(v -> v) -> k -> HashMap k v -> HashMap k v
HashMap.adjust (SourceMetadataObjId b -> BackendSourceInfo -> BackendSourceInfo
forall (b :: BackendType).
Backend b =>
SourceMetadataObjId b -> BackendSourceInfo -> BackendSourceInfo
deleteObjId SourceMetadataObjId b
sourceObjId) SourceName
source)
MORemoteSchema RemoteSchemaName
name -> (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs
Lens'
BuildOutputs
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
boRemoteSchemas ((HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RemoteSchemaName
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete RemoteSchemaName
name
MORemoteSchemaPermissions RemoteSchemaName
name RoleName
role -> (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs
Lens'
BuildOutputs
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
boRemoteSchemas ((HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs)
-> ((HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> (HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> BuildOutputs
-> Identity BuildOutputs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
-> Traversal'
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
(IxValue
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
RemoteSchemaName
name (((RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> ((HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> (HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject)
forall s t a b. Field1 s t a b => Lens s t a b
Lens
(RemoteSchemaCtx, MetadataObject)
(RemoteSchemaCtx, MetadataObject)
RemoteSchemaCtx
RemoteSchemaCtx
_1 ((RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> ((HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> RemoteSchemaCtx -> Identity RemoteSchemaCtx
forall remoteFieldInfo (f :: * -> *).
Functor f =>
(HashMap RoleName IntrospectionResult
-> f (HashMap RoleName IntrospectionResult))
-> RemoteSchemaCtxG remoteFieldInfo
-> f (RemoteSchemaCtxG remoteFieldInfo)
rscPermissions ((HashMap RoleName IntrospectionResult
-> Identity (HashMap RoleName IntrospectionResult))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap RoleName IntrospectionResult
-> HashMap RoleName IntrospectionResult)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RoleName
-> HashMap RoleName IntrospectionResult
-> HashMap RoleName IntrospectionResult
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete RoleName
role
MORemoteSchemaRemoteRelationship RemoteSchemaName
remoteSchema Name
typeName RelName
relationshipName ->
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs
Lens'
BuildOutputs
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
boRemoteSchemas ((HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> BuildOutputs -> Identity BuildOutputs)
-> ((InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> BuildOutputs
-> Identity BuildOutputs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
-> Traversal'
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
(IxValue
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
RemoteSchemaName
remoteSchema (((RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)))
-> ((InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject)
-> Identity
(HashMap RemoteSchemaName (RemoteSchemaCtx, MetadataObject))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject)
forall s t a b. Field1 s t a b => Lens s t a b
Lens
(RemoteSchemaCtx, MetadataObject)
(RemoteSchemaCtx, MetadataObject)
RemoteSchemaCtx
RemoteSchemaCtx
_1 ((RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject))
-> ((InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> (RemoteSchemaCtx, MetadataObject)
-> Identity (RemoteSchemaCtx, MetadataObject)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
-> Identity (RemoteSchemaRelationshipsG (RemoteFieldInfo Name)))
-> RemoteSchemaCtx -> Identity RemoteSchemaCtx
forall remoteFieldInfo1 remoteFieldInfo2 (f :: * -> *).
Functor f =>
(RemoteSchemaRelationshipsG remoteFieldInfo1
-> f (RemoteSchemaRelationshipsG remoteFieldInfo2))
-> RemoteSchemaCtxG remoteFieldInfo1
-> f (RemoteSchemaCtxG remoteFieldInfo2)
rscRemoteRelationships ((RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
-> Identity (RemoteSchemaRelationshipsG (RemoteFieldInfo Name)))
-> RemoteSchemaCtx -> Identity RemoteSchemaCtx)
-> ((InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> RemoteSchemaRelationshipsG (RemoteFieldInfo Name)
-> Identity (RemoteSchemaRelationshipsG (RemoteFieldInfo Name)))
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> RemoteSchemaCtx
-> Identity RemoteSchemaCtx
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RemoteSchemaRelationshipsG (RemoteFieldInfo Name))
-> Traversal'
(RemoteSchemaRelationshipsG (RemoteFieldInfo Name))
(IxValue (RemoteSchemaRelationshipsG (RemoteFieldInfo Name)))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Name
Index (RemoteSchemaRelationshipsG (RemoteFieldInfo Name))
typeName ((InsOrdHashMap RelName (RemoteFieldInfo Name)
-> Identity (InsOrdHashMap RelName (RemoteFieldInfo Name)))
-> BuildOutputs -> Identity BuildOutputs)
-> (InsOrdHashMap RelName (RemoteFieldInfo Name)
-> InsOrdHashMap RelName (RemoteFieldInfo Name))
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RelName
-> InsOrdHashMap RelName (RemoteFieldInfo Name)
-> InsOrdHashMap RelName (RemoteFieldInfo Name)
forall k v.
(Eq k, Hashable k) =>
k -> InsOrdHashMap k v -> InsOrdHashMap k v
InsOrdHashMap.delete RelName
relationshipName
MetadataObjId
MOCustomTypes -> (AnnotatedCustomTypes -> Identity AnnotatedCustomTypes)
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs AnnotatedCustomTypes
boCustomTypes ((AnnotatedCustomTypes -> Identity AnnotatedCustomTypes)
-> BuildOutputs -> Identity BuildOutputs)
-> (AnnotatedCustomTypes -> AnnotatedCustomTypes)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AnnotatedCustomTypes
-> AnnotatedCustomTypes -> AnnotatedCustomTypes
forall a b. a -> b -> a
const AnnotatedCustomTypes
forall a. Monoid a => a
mempty
MOAction ActionName
name -> (ActionCache -> Identity ActionCache)
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs ActionCache
boActions ((ActionCache -> Identity ActionCache)
-> BuildOutputs -> Identity BuildOutputs)
-> (ActionCache -> ActionCache) -> BuildOutputs -> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ ActionName -> ActionCache -> ActionCache
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete ActionName
name
MOActionPermission ActionName
name RoleName
role -> (ActionCache -> Identity ActionCache)
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs ActionCache
boActions ((ActionCache -> Identity ActionCache)
-> BuildOutputs -> Identity BuildOutputs)
-> ((HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> ActionCache -> Identity ActionCache)
-> (HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> BuildOutputs
-> Identity BuildOutputs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index ActionCache -> Traversal' ActionCache (IxValue ActionCache)
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index ActionCache
ActionName
name ((ActionInfo -> Identity ActionInfo)
-> ActionCache -> Identity ActionCache)
-> ((HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> ActionInfo -> Identity ActionInfo)
-> (HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> ActionCache
-> Identity ActionCache
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> ActionInfo -> Identity ActionInfo
Lens' ActionInfo (HashMap RoleName ActionPermissionInfo)
aiPermissions ((HashMap RoleName ActionPermissionInfo
-> Identity (HashMap RoleName ActionPermissionInfo))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap RoleName ActionPermissionInfo
-> HashMap RoleName ActionPermissionInfo)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RoleName
-> HashMap RoleName ActionPermissionInfo
-> HashMap RoleName ActionPermissionInfo
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete RoleName
role
MOInheritedRole RoleName
name -> (HashMap RoleName Role -> Identity (HashMap RoleName Role))
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs (HashMap RoleName Role)
boRoles ((HashMap RoleName Role -> Identity (HashMap RoleName Role))
-> BuildOutputs -> Identity BuildOutputs)
-> (HashMap RoleName Role -> HashMap RoleName Role)
-> BuildOutputs
-> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RoleName -> HashMap RoleName Role -> HashMap RoleName Role
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete RoleName
name
MODataConnectorAgent DataConnectorName
agentName ->
(BackendCache -> Identity BackendCache)
-> BuildOutputs -> Identity BuildOutputs
Lens' BuildOutputs BackendCache
boBackendCache
((BackendCache -> Identity BackendCache)
-> BuildOutputs -> Identity BuildOutputs)
-> (BackendCache -> BackendCache) -> BuildOutputs -> BuildOutputs
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (forall (b :: BackendType) (i :: BackendType -> *).
(HasTag b, Monoid (i b)) =>
(i b -> i b) -> BackendMap i -> BackendMap i
BackendMap.modify @'DataConnector ((BackendInfoWrapper 'DataConnector
-> BackendInfoWrapper 'DataConnector)
-> BackendCache -> BackendCache)
-> (BackendInfoWrapper 'DataConnector
-> BackendInfoWrapper 'DataConnector)
-> BackendCache
-> BackendCache
forall a b. (a -> b) -> a -> b
$ HashMap DataConnectorName DataConnectorInfo
-> BackendInfoWrapper 'DataConnector
BackendInfo 'DataConnector -> BackendInfoWrapper 'DataConnector
forall (b :: BackendType). BackendInfo b -> BackendInfoWrapper b
BackendInfoWrapper (HashMap DataConnectorName DataConnectorInfo
-> BackendInfoWrapper 'DataConnector)
-> (BackendInfoWrapper 'DataConnector
-> HashMap DataConnectorName DataConnectorInfo)
-> BackendInfoWrapper 'DataConnector
-> BackendInfoWrapper 'DataConnector
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataConnectorName
-> HashMap DataConnectorName DataConnectorInfo
-> HashMap DataConnectorName DataConnectorInfo
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete DataConnectorName
agentName (HashMap DataConnectorName DataConnectorInfo
-> HashMap DataConnectorName DataConnectorInfo)
-> (BackendInfoWrapper 'DataConnector
-> HashMap DataConnectorName DataConnectorInfo)
-> BackendInfoWrapper 'DataConnector
-> HashMap DataConnectorName DataConnectorInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BackendInfoWrapper 'DataConnector
-> HashMap DataConnectorName DataConnectorInfo
BackendInfoWrapper 'DataConnector -> BackendInfo 'DataConnector
forall (b :: BackendType). BackendInfoWrapper b -> BackendInfo b
unBackendInfoWrapper)
MOCronTrigger TriggerName
_ -> BuildOutputs -> BuildOutputs
forall a. a -> a
id
MOEndpoint EndpointName
_ -> BuildOutputs -> BuildOutputs
forall a. a -> a
id
MOQueryCollectionsQuery CollectionName
_ ListedQuery
_ -> BuildOutputs -> BuildOutputs
forall a. a -> a
id
MOOpenTelemetry OpenTelemetryConfigSubobject
_ -> BuildOutputs -> BuildOutputs
forall a. a -> a
id
where
deleteObjId :: forall b. (Backend b) => SourceMetadataObjId b -> BackendSourceInfo -> BackendSourceInfo
deleteObjId :: forall (b :: BackendType).
Backend b =>
SourceMetadataObjId b -> BackendSourceInfo -> BackendSourceInfo
deleteObjId SourceMetadataObjId b
sourceObjId BackendSourceInfo
sourceInfo =
BackendSourceInfo
-> (SourceInfo b -> BackendSourceInfo)
-> Maybe (SourceInfo b)
-> BackendSourceInfo
forall b a. b -> (a -> b) -> Maybe a -> b
maybe
BackendSourceInfo
sourceInfo
(SourceInfo b -> BackendSourceInfo
forall (b :: BackendType) (i :: BackendType -> *).
HasTag b =>
i b -> AnyBackend i
AB.mkAnyBackend (SourceInfo b -> BackendSourceInfo)
-> (SourceInfo b -> SourceInfo b)
-> SourceInfo b
-> BackendSourceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SourceMetadataObjId b -> SourceInfo b -> SourceInfo b
forall (b :: BackendType).
Backend b =>
SourceMetadataObjId b -> SourceInfo b -> SourceInfo b
deleteObjFn SourceMetadataObjId b
sourceObjId)
(Maybe (SourceInfo b) -> BackendSourceInfo)
-> Maybe (SourceInfo b) -> BackendSourceInfo
forall a b. (a -> b) -> a -> b
$ BackendSourceInfo -> Maybe (SourceInfo b)
forall (b :: BackendType).
HasTag b =>
BackendSourceInfo -> Maybe (SourceInfo b)
unsafeSourceInfo BackendSourceInfo
sourceInfo
deleteObjFn :: forall b. (Backend b) => SourceMetadataObjId b -> SourceInfo b -> SourceInfo b
deleteObjFn :: forall (b :: BackendType).
Backend b =>
SourceMetadataObjId b -> SourceInfo b -> SourceInfo b
deleteObjFn = \case
SMOTable TableName b
name -> (HashMap (TableName b) (TableInfo b)
-> Identity (HashMap (TableName b) (TableInfo b)))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(TableCache b -> f (TableCache b))
-> SourceInfo b -> f (SourceInfo b)
siTables ((HashMap (TableName b) (TableInfo b)
-> Identity (HashMap (TableName b) (TableInfo b)))
-> SourceInfo b -> Identity (SourceInfo b))
-> (HashMap (TableName b) (TableInfo b)
-> HashMap (TableName b) (TableInfo b))
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ TableName b
-> HashMap (TableName b) (TableInfo b)
-> HashMap (TableName b) (TableInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete TableName b
name
SMOFunction FunctionName b
name -> (HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(FunctionCache b -> f (FunctionCache b))
-> SourceInfo b -> f (SourceInfo b)
siFunctions ((HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> SourceInfo b -> Identity (SourceInfo b))
-> (HashMap (FunctionName b) (FunctionInfo b)
-> HashMap (FunctionName b) (FunctionInfo b))
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FunctionName b
-> HashMap (FunctionName b) (FunctionInfo b)
-> HashMap (FunctionName b) (FunctionInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete FunctionName b
name
SMOFunctionPermission FunctionName b
functionName RoleName
role ->
(HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(FunctionCache b -> f (FunctionCache b))
-> SourceInfo b -> f (SourceInfo b)
siFunctions ((HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> SourceInfo b -> Identity (SourceInfo b))
-> ((FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> (FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> SourceInfo b
-> Identity (SourceInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (HashMap (FunctionName b) (FunctionInfo b))
-> Traversal'
(HashMap (FunctionName b) (FunctionInfo b))
(IxValue (HashMap (FunctionName b) (FunctionInfo b)))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (HashMap (FunctionName b) (FunctionInfo b))
FunctionName b
functionName ((FunctionInfo b -> Identity (FunctionInfo b))
-> HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b)))
-> ((FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> FunctionInfo b -> Identity (FunctionInfo b))
-> (FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> HashMap (FunctionName b) (FunctionInfo b)
-> Identity (HashMap (FunctionName b) (FunctionInfo b))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> FunctionInfo b -> Identity (FunctionInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(FunctionPermissionsMap -> f FunctionPermissionsMap)
-> FunctionInfo b -> f (FunctionInfo b)
fiPermissions ((FunctionPermissionsMap -> Identity FunctionPermissionsMap)
-> SourceInfo b -> Identity (SourceInfo b))
-> (FunctionPermissionsMap -> FunctionPermissionsMap)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RoleName -> FunctionPermissionsMap -> FunctionPermissionsMap
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete RoleName
role
SMONativeQuery NativeQueryName
name -> (NativeQueryCache b -> Identity (NativeQueryCache b))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(NativeQueryCache b -> f (NativeQueryCache b))
-> SourceInfo b -> f (SourceInfo b)
siNativeQueries ((NativeQueryCache b -> Identity (NativeQueryCache b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (NativeQueryCache b -> NativeQueryCache b)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ NativeQueryName -> NativeQueryCache b -> NativeQueryCache b
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete NativeQueryName
name
SMONativeQueryObj NativeQueryName
nativeQueryName NativeQueryMetadataObjId
nativeQueryObjId ->
(NativeQueryCache b -> Identity (NativeQueryCache b))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(NativeQueryCache b -> f (NativeQueryCache b))
-> SourceInfo b -> f (SourceInfo b)
siNativeQueries ((NativeQueryCache b -> Identity (NativeQueryCache b))
-> SourceInfo b -> Identity (SourceInfo b))
-> ((NativeQueryInfo b -> Identity (NativeQueryInfo b))
-> NativeQueryCache b -> Identity (NativeQueryCache b))
-> (NativeQueryInfo b -> Identity (NativeQueryInfo b))
-> SourceInfo b
-> Identity (SourceInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (NativeQueryCache b)
-> Traversal' (NativeQueryCache b) (IxValue (NativeQueryCache b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (NativeQueryCache b)
NativeQueryName
nativeQueryName ((NativeQueryInfo b -> Identity (NativeQueryInfo b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (NativeQueryInfo b -> NativeQueryInfo b)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ case NativeQueryMetadataObjId
nativeQueryObjId of
NQMORel RelName
name RelType
_ -> (InsOrdHashMap RelName (RelInfo b)
-> Identity (InsOrdHashMap RelName (RelInfo b)))
-> NativeQueryInfo b -> Identity (NativeQueryInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(InsOrdHashMap RelName (RelInfo b)
-> f (InsOrdHashMap RelName (RelInfo b)))
-> NativeQueryInfo b -> f (NativeQueryInfo b)
nqiRelationships ((InsOrdHashMap RelName (RelInfo b)
-> Identity (InsOrdHashMap RelName (RelInfo b)))
-> NativeQueryInfo b -> Identity (NativeQueryInfo b))
-> (InsOrdHashMap RelName (RelInfo b)
-> InsOrdHashMap RelName (RelInfo b))
-> NativeQueryInfo b
-> NativeQueryInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ RelName
-> InsOrdHashMap RelName (RelInfo b)
-> InsOrdHashMap RelName (RelInfo b)
forall k v.
(Eq k, Hashable k) =>
k -> InsOrdHashMap k v -> InsOrdHashMap k v
InsOrdHashMap.delete RelName
name
NQMOReferencedLogicalModel LogicalModelName
_ -> NativeQueryInfo b -> NativeQueryInfo b
forall a. a -> a
id
SMOStoredProcedure FunctionName b
name -> (StoredProcedureCache b -> Identity (StoredProcedureCache b))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(StoredProcedureCache b -> f (StoredProcedureCache b))
-> SourceInfo b -> f (SourceInfo b)
siStoredProcedures ((StoredProcedureCache b -> Identity (StoredProcedureCache b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (StoredProcedureCache b -> StoredProcedureCache b)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FunctionName b -> StoredProcedureCache b -> StoredProcedureCache b
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete FunctionName b
name
SMOLogicalModel LogicalModelName
name ->
(LogicalModelCache b -> Identity (LogicalModelCache b))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(LogicalModelCache b -> f (LogicalModelCache b))
-> SourceInfo b -> f (SourceInfo b)
siLogicalModels ((LogicalModelCache b -> Identity (LogicalModelCache b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (LogicalModelCache b -> LogicalModelCache b)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ LogicalModelName -> LogicalModelCache b -> LogicalModelCache b
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete LogicalModelName
name
SMOLogicalModelObj LogicalModelName
logicalModelName LogicalModelMetadataObjId
logicalModelObjectId ->
(LogicalModelCache b -> Identity (LogicalModelCache b))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(LogicalModelCache b -> f (LogicalModelCache b))
-> SourceInfo b -> f (SourceInfo b)
siLogicalModels ((LogicalModelCache b -> Identity (LogicalModelCache b))
-> SourceInfo b -> Identity (SourceInfo b))
-> ((LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> LogicalModelCache b -> Identity (LogicalModelCache b))
-> (LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> SourceInfo b
-> Identity (SourceInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (LogicalModelCache b)
-> Traversal' (LogicalModelCache b) (IxValue (LogicalModelCache b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (LogicalModelCache b)
LogicalModelName
logicalModelName ((LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (LogicalModelInfo b -> LogicalModelInfo b)
-> SourceInfo b
-> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ case LogicalModelMetadataObjId
logicalModelObjectId of
LMMOPerm RoleName
roleName PermType
PTSelect -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> LogicalModelInfo b -> f (LogicalModelInfo b)
lmiPermissions ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> LogicalModelInfo b
-> Identity (LogicalModelInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (SelPermInfo b) -> f (Maybe (SelPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permSel ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> Maybe (SelPermInfo b)
-> LogicalModelInfo b
-> LogicalModelInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (SelPermInfo b)
forall a. Maybe a
Nothing
LMMOPerm RoleName
roleName PermType
PTInsert -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> LogicalModelInfo b -> f (LogicalModelInfo b)
lmiPermissions ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> LogicalModelInfo b
-> Identity (LogicalModelInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (InsPermInfo b) -> f (Maybe (InsPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permIns ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> Maybe (InsPermInfo b)
-> LogicalModelInfo b
-> LogicalModelInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (InsPermInfo b)
forall a. Maybe a
Nothing
LMMOPerm RoleName
roleName PermType
PTUpdate -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> LogicalModelInfo b -> f (LogicalModelInfo b)
lmiPermissions ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> LogicalModelInfo b
-> Identity (LogicalModelInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (UpdPermInfo b) -> f (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permUpd ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> Maybe (UpdPermInfo b)
-> LogicalModelInfo b
-> LogicalModelInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (UpdPermInfo b)
forall a. Maybe a
Nothing
LMMOPerm RoleName
roleName PermType
PTDelete -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> LogicalModelInfo b -> f (LogicalModelInfo b)
lmiPermissions ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> LogicalModelInfo b
-> Identity (LogicalModelInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (DelPermInfo b) -> f (Maybe (DelPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permDel ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> LogicalModelInfo b -> Identity (LogicalModelInfo b))
-> Maybe (DelPermInfo b)
-> LogicalModelInfo b
-> LogicalModelInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (DelPermInfo b)
forall a. Maybe a
Nothing
LMMOReferencedLogicalModel LogicalModelName
_ -> LogicalModelInfo b -> LogicalModelInfo b
forall a. a -> a
id
SMOTableObj TableName b
tableName TableMetadataObjId
tableObjectId ->
(HashMap (TableName b) (TableInfo b)
-> Identity (HashMap (TableName b) (TableInfo b)))
-> SourceInfo b -> Identity (SourceInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(TableCache b -> f (TableCache b))
-> SourceInfo b -> f (SourceInfo b)
siTables ((HashMap (TableName b) (TableInfo b)
-> Identity (HashMap (TableName b) (TableInfo b)))
-> SourceInfo b -> Identity (SourceInfo b))
-> ((TableInfo b -> Identity (TableInfo b))
-> HashMap (TableName b) (TableInfo b)
-> Identity (HashMap (TableName b) (TableInfo b)))
-> (TableInfo b -> Identity (TableInfo b))
-> SourceInfo b
-> Identity (SourceInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (HashMap (TableName b) (TableInfo b))
-> Traversal'
(HashMap (TableName b) (TableInfo b))
(IxValue (HashMap (TableName b) (TableInfo b)))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (HashMap (TableName b) (TableInfo b))
TableName b
tableName ((TableInfo b -> Identity (TableInfo b))
-> SourceInfo b -> Identity (SourceInfo b))
-> (TableInfo b -> TableInfo b) -> SourceInfo b -> SourceInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ case TableMetadataObjId
tableObjectId of
MTORel RelName
name RelType
_ -> (TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(TableCoreInfo b -> f (TableCoreInfo b))
-> TableInfo b -> f (TableInfo b)
tiCoreInfo ((TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b))
-> ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b))
-> (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b)
forall (b :: BackendType) field1 primaryKeyColumn field2
(f :: * -> *).
Functor f =>
(FieldInfoMap field1 -> f (FieldInfoMap field2))
-> TableCoreInfoG b field1 primaryKeyColumn
-> f (TableCoreInfoG b field2 primaryKeyColumn)
tciFieldInfoMap ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> (FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b))
-> TableInfo b
-> TableInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FieldName
-> FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete (RelName -> FieldName
fromRel RelName
name)
MTOComputedField ComputedFieldName
name -> (TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(TableCoreInfo b -> f (TableCoreInfo b))
-> TableInfo b -> f (TableInfo b)
tiCoreInfo ((TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b))
-> ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b))
-> (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b)
forall (b :: BackendType) field1 primaryKeyColumn field2
(f :: * -> *).
Functor f =>
(FieldInfoMap field1 -> f (FieldInfoMap field2))
-> TableCoreInfoG b field1 primaryKeyColumn
-> f (TableCoreInfoG b field2 primaryKeyColumn)
tciFieldInfoMap ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> (FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b))
-> TableInfo b
-> TableInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FieldName
-> FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete (ComputedFieldName -> FieldName
fromComputedField ComputedFieldName
name)
MTORemoteRelationship RelName
name -> (TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(TableCoreInfo b -> f (TableCoreInfo b))
-> TableInfo b -> f (TableInfo b)
tiCoreInfo ((TableCoreInfo b -> Identity (TableCoreInfo b))
-> TableInfo b -> Identity (TableInfo b))
-> ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b))
-> (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableCoreInfo b -> Identity (TableCoreInfo b)
forall (b :: BackendType) field1 primaryKeyColumn field2
(f :: * -> *).
Functor f =>
(FieldInfoMap field1 -> f (FieldInfoMap field2))
-> TableCoreInfoG b field1 primaryKeyColumn
-> f (TableCoreInfoG b field2 primaryKeyColumn)
tciFieldInfoMap ((FieldInfoMap (FieldInfo b)
-> Identity (FieldInfoMap (FieldInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> (FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b))
-> TableInfo b
-> TableInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FieldName
-> FieldInfoMap (FieldInfo b) -> FieldInfoMap (FieldInfo b)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete (RelName -> FieldName
fromRemoteRelationship RelName
name)
MTOTrigger TriggerName
name -> (EventTriggerInfoMap b -> Identity (EventTriggerInfoMap b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(EventTriggerInfoMap b -> f (EventTriggerInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiEventTriggerInfoMap ((EventTriggerInfoMap b -> Identity (EventTriggerInfoMap b))
-> TableInfo b -> Identity (TableInfo b))
-> (EventTriggerInfoMap b -> EventTriggerInfoMap b)
-> TableInfo b
-> TableInfo b
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ TriggerName -> EventTriggerInfoMap b -> EventTriggerInfoMap b
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
HashMap.delete TriggerName
name
MTOPerm RoleName
roleName PermType
PTSelect -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiRolePermInfoMap ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b))
-> ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (SelPermInfo b) -> f (Maybe (SelPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permSel ((Maybe (SelPermInfo b) -> Identity (Maybe (SelPermInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> Maybe (SelPermInfo b) -> TableInfo b -> TableInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (SelPermInfo b)
forall a. Maybe a
Nothing
MTOPerm RoleName
roleName PermType
PTInsert -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiRolePermInfoMap ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b))
-> ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (InsPermInfo b) -> f (Maybe (InsPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permIns ((Maybe (InsPermInfo b) -> Identity (Maybe (InsPermInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> Maybe (InsPermInfo b) -> TableInfo b -> TableInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (InsPermInfo b)
forall a. Maybe a
Nothing
MTOPerm RoleName
roleName PermType
PTUpdate -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiRolePermInfoMap ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b))
-> ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (UpdPermInfo b) -> f (Maybe (UpdPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permUpd ((Maybe (UpdPermInfo b) -> Identity (Maybe (UpdPermInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> Maybe (UpdPermInfo b) -> TableInfo b -> TableInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (UpdPermInfo b)
forall a. Maybe a
Nothing
MTOPerm RoleName
roleName PermType
PTDelete -> (RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(RolePermInfoMap b -> f (RolePermInfoMap b))
-> TableInfo b -> f (TableInfo b)
tiRolePermInfoMap ((RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> TableInfo b -> Identity (TableInfo b))
-> ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> TableInfo b
-> Identity (TableInfo b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (RolePermInfoMap b)
-> Traversal' (RolePermInfoMap b) (IxValue (RolePermInfoMap b))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (RolePermInfoMap b)
RoleName
roleName ((RolePermInfo b -> Identity (RolePermInfo b))
-> RolePermInfoMap b -> Identity (RolePermInfoMap b))
-> ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b))
-> (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfoMap b
-> Identity (RolePermInfoMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> RolePermInfo b -> Identity (RolePermInfo b)
forall (b :: BackendType) (f :: * -> *).
Functor f =>
(Maybe (DelPermInfo b) -> f (Maybe (DelPermInfo b)))
-> RolePermInfo b -> f (RolePermInfo b)
permDel ((Maybe (DelPermInfo b) -> Identity (Maybe (DelPermInfo b)))
-> TableInfo b -> Identity (TableInfo b))
-> Maybe (DelPermInfo b) -> TableInfo b -> TableInfo b
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe (DelPermInfo b)
forall a. Maybe a
Nothing