chore(server): split Logical Model lenses into files

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8989
GitOrigin-RevId: f0f6e75732408f21ebe5fdc5af3f680cd96ae789
This commit is contained in:
Daniel Harvey 2023-04-28 19:46:09 +01:00 committed by hasura-bot
parent 53749aa796
commit 6178a1fd82
8 changed files with 55 additions and 31 deletions

View File

@ -715,6 +715,7 @@ library
, Hasura.LogicalModel.Cache
, Hasura.LogicalModel.Common
, Hasura.LogicalModel.IR
, Hasura.LogicalModel.Lenses
, Hasura.LogicalModel.Metadata
, Hasura.LogicalModel.NullableScalarType
, Hasura.LogicalModel.Schema
@ -746,6 +747,7 @@ library
, Hasura.NativeQuery.IR
, Hasura.NativeQuery.Cache
, Hasura.NativeQuery.Lenses
, Hasura.NativeQuery.Metadata
, Hasura.NativeQuery.API
, Hasura.NativeQuery.Schema
@ -753,6 +755,7 @@ library
, Hasura.StoredProcedure.IR
, Hasura.StoredProcedure.Cache
, Hasura.StoredProcedure.Lenses
, Hasura.StoredProcedure.Metadata
, Hasura.StoredProcedure.API
, Hasura.StoredProcedure.Schema

View File

@ -1,17 +1,11 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
module Hasura.LogicalModel.Cache
( LogicalModelInfo (..),
LogicalModelCache,
lmiName,
lmiPermissions,
lmiDescription,
lmiFields,
)
where
import Control.Lens (makeLenses)
import Data.Aeson (ToJSON (..), genericToJSON)
import Data.HashMap.Strict.InsOrd qualified as InsOrdHashMap
import Hasura.LogicalModel.Types (LogicalModelField, LogicalModelName)
@ -31,8 +25,6 @@ data LogicalModelInfo (b :: BackendType) = LogicalModelInfo
}
deriving (Generic)
makeLenses ''LogicalModelInfo
instance
(Backend b, ToJSON (RolePermInfoMap b)) =>
ToJSON (LogicalModelInfo b)

View File

@ -0,0 +1,14 @@
{-# LANGUAGE TemplateHaskell #-}
module Hasura.LogicalModel.Lenses
( lmiName,
lmiPermissions,
lmiDescription,
lmiFields,
)
where
import Control.Lens (makeLenses)
import Hasura.LogicalModel.Cache (LogicalModelInfo (..))
makeLenses ''LogicalModelInfo

View File

@ -1,20 +1,12 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
-- | The representation of native queries as derived from the schema cache.
module Hasura.NativeQuery.Cache
( NativeQueryInfo (..),
NativeQueryCache,
nqiRootFieldName,
nqiArrayRelationships,
nqiCode,
nqiReturns,
nqiArguments,
nqiDescription,
)
where
import Control.Lens (makeLenses)
import Data.Aeson (ToJSON (toJSON), genericToJSON)
import Hasura.LogicalModel.Cache (LogicalModelInfo)
import Hasura.NativeQuery.Metadata (InterpolatedQuery, NativeQueryArgumentName, NativeQueryName)
@ -45,5 +37,3 @@ instance
ToJSON (NativeQueryInfo b)
where
toJSON = genericToJSON hasuraJSON
makeLenses ''NativeQueryInfo

View File

@ -0,0 +1,16 @@
{-# LANGUAGE TemplateHaskell #-}
module Hasura.NativeQuery.Lenses
( nqiRootFieldName,
nqiArrayRelationships,
nqiCode,
nqiReturns,
nqiArguments,
nqiDescription,
)
where
import Control.Lens (makeLenses)
import Hasura.NativeQuery.Cache (NativeQueryInfo (..))
makeLenses ''NativeQueryInfo

View File

@ -14,8 +14,10 @@ import Data.Monoid (First)
import Data.Text.Extended
import Hasura.Base.Error
import Hasura.Function.Lenses (fiPermissions)
import Hasura.LogicalModel.Cache (LogicalModelInfo (..), lmiPermissions)
import Hasura.NativeQuery.Cache (NativeQueryInfo (_nqiReturns), nqiArrayRelationships)
import Hasura.LogicalModel.Cache (LogicalModelInfo (..))
import Hasura.LogicalModel.Lenses (lmiPermissions)
import Hasura.NativeQuery.Cache (NativeQueryInfo (_nqiReturns))
import Hasura.NativeQuery.Lenses (nqiArrayRelationships)
import Hasura.Prelude
import Hasura.RQL.DDL.Permission.Internal (permissionIsDefined)
import Hasura.RQL.DDL.Schema.Cache.Common
@ -36,7 +38,8 @@ import Hasura.RQL.Types.Table
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), spiArrayRelationships)
import Hasura.StoredProcedure.Cache (StoredProcedureInfo (_spiReturns))
import Hasura.StoredProcedure.Lenses (spiArrayRelationships)
import Language.GraphQL.Draft.Syntax qualified as G
-- | Processes collected 'CIDependency' values into a 'DepMap', performing integrity checking to

View File

@ -1,20 +1,12 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
-- | The representation of stored procedures as derived from the schema cache.
module Hasura.StoredProcedure.Cache
( StoredProcedureInfo (..),
StoredProcedureCache,
spiRootFieldName,
spiArrayRelationships,
spiCode,
spiReturns,
spiArguments,
spiDescription,
)
where
import Control.Lens (makeLenses)
import Data.Aeson (ToJSON (toJSON), genericToJSON)
import Hasura.LogicalModel.Cache (LogicalModelInfo)
import Hasura.Prelude
@ -45,5 +37,3 @@ instance
ToJSON (StoredProcedureInfo b)
where
toJSON = genericToJSON hasuraJSON
makeLenses ''StoredProcedureInfo

View File

@ -0,0 +1,16 @@
{-# LANGUAGE TemplateHaskell #-}
module Hasura.StoredProcedure.Lenses
( spiRootFieldName,
spiArrayRelationships,
spiCode,
spiReturns,
spiArguments,
spiDescription,
)
where
import Control.Lens (makeLenses)
import Hasura.StoredProcedure.Cache (StoredProcedureInfo (..))
makeLenses ''StoredProcedureInfo